diff options
author | HampusM <hampus@hampusmat.com> | 2021-07-06 14:00:33 +0200 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2021-07-06 14:00:33 +0200 |
commit | 49e6ae50447130ba6e2efd2b561f1b1dcc033099 (patch) | |
tree | 1bda29bb29568cf01e7d01879d983a880b02bb60 /packages/shared_types/src | |
parent | 39c38c737114dc7f946b1895b2a4ba27a5546c60 (diff) |
Added a package with shared types
Diffstat (limited to 'packages/shared_types/src')
-rw-r--r-- | packages/shared_types/src/branch.d.ts | 10 | ||||
-rw-r--r-- | packages/shared_types/src/commit.d.ts | 48 | ||||
-rw-r--r-- | packages/shared_types/src/index.d.ts | 7 | ||||
-rw-r--r-- | packages/shared_types/src/info.d.ts | 4 | ||||
-rw-r--r-- | packages/shared_types/src/misc.d.ts | 4 | ||||
-rw-r--r-- | packages/shared_types/src/repository.d.ts | 12 | ||||
-rw-r--r-- | packages/shared_types/src/tag.d.ts | 7 | ||||
-rw-r--r-- | packages/shared_types/src/tree.d.ts | 12 |
8 files changed, 104 insertions, 0 deletions
diff --git a/packages/shared_types/src/branch.d.ts b/packages/shared_types/src/branch.d.ts new file mode 100644 index 0000000..a32515e --- /dev/null +++ b/packages/shared_types/src/branch.d.ts @@ -0,0 +1,10 @@ +import { LatestCommit } from "./commit"; + +export interface BranchSummary { + id: string, + name: string +} + +export interface Branch extends BranchSummary { + latest_commit: LatestCommit +}
\ No newline at end of file diff --git a/packages/shared_types/src/commit.d.ts b/packages/shared_types/src/commit.d.ts new file mode 100644 index 0000000..2eff901 --- /dev/null +++ b/packages/shared_types/src/commit.d.ts @@ -0,0 +1,48 @@ +import { Author } from "./misc"; + +export type Hunk = { + new_start: number, + new_lines_cnt: number, + new_lines: number[], + old_start: number, + old_lines_cnt: number, + deleted_lines: number[], + hunk: string +} + +export type Patch = { + additions: number, + deletions: number, + from: string, + to: string, + too_large: boolean, + hunks: Hunk[] +} +export type Commit = { + message: string, + author: Author, + date: number, + insertions: number, + deletions: number, + files_changed: number, + diff: Patch[] +} + +export type LogCommit = { + id: string, + author: { + name: string, + email: string + }, + message: string, + date: number, + insertions: number, + deletions: number, + files_changed: number +} + +export type LatestCommit = { + id: string, + message: string, + date: number +}
\ No newline at end of file diff --git a/packages/shared_types/src/index.d.ts b/packages/shared_types/src/index.d.ts new file mode 100644 index 0000000..71be945 --- /dev/null +++ b/packages/shared_types/src/index.d.ts @@ -0,0 +1,7 @@ +export { Tree, TreeEntry } from "./tree"; +export { Commit, Patch, Hunk, LatestCommit, LogCommit } from "./commit"; +export { Repository, RepositorySummary } from "./repository"; +export { Branch, BranchSummary } from "./branch"; +export { Author } from "./misc"; +export { Tag } from "./tag"; +export { Info } from "./info";
\ No newline at end of file diff --git a/packages/shared_types/src/info.d.ts b/packages/shared_types/src/info.d.ts new file mode 100644 index 0000000..1101cea --- /dev/null +++ b/packages/shared_types/src/info.d.ts @@ -0,0 +1,4 @@ +export type Info = { + title: string, + about: string, +}
\ No newline at end of file diff --git a/packages/shared_types/src/misc.d.ts b/packages/shared_types/src/misc.d.ts new file mode 100644 index 0000000..e43fae5 --- /dev/null +++ b/packages/shared_types/src/misc.d.ts @@ -0,0 +1,4 @@ +export type Author = { + name: string, + email: string +}
\ No newline at end of file diff --git a/packages/shared_types/src/repository.d.ts b/packages/shared_types/src/repository.d.ts new file mode 100644 index 0000000..f07c173 --- /dev/null +++ b/packages/shared_types/src/repository.d.ts @@ -0,0 +1,12 @@ +interface RepositoryBase { + name: string, + description: string +} + +export interface RepositorySummary extends RepositoryBase { + last_updated: number | string +} + +export interface Repository extends RepositoryBase { + has_readme: boolean +}
\ No newline at end of file diff --git a/packages/shared_types/src/tag.d.ts b/packages/shared_types/src/tag.d.ts new file mode 100644 index 0000000..7c418da --- /dev/null +++ b/packages/shared_types/src/tag.d.ts @@ -0,0 +1,7 @@ +import { Author } from "./misc"; + +export type Tag = { + name: string, + author: Author, + date: number +}
\ No newline at end of file diff --git a/packages/shared_types/src/tree.d.ts b/packages/shared_types/src/tree.d.ts new file mode 100644 index 0000000..d2b4708 --- /dev/null +++ b/packages/shared_types/src/tree.d.ts @@ -0,0 +1,12 @@ +import { LatestCommit } from "./commit"; + +export type TreeEntry = { + name: string, + type: "tree" | "blob", + latest_commit: LatestCommit +}; + +export type Tree = { + type: "tree" | "blob", + content: string | TreeEntry[] +};
\ No newline at end of file |