| 1 | import * as Schema from "effect/Schema" |
| 2 | |
| 3 | export const Bucket = Schema.Literals(["type", "value"]) |
| 4 | |
| 5 | export type Bucket = typeof Bucket.Type |
| 6 | |
| 7 | export const SourceLocation = Schema.Struct({ |
| 8 | file: Schema.String, |
| 9 | line: Schema.Number, |
| 10 | column: Schema.Number |
| 11 | }) |
| 12 | |
| 13 | export type SourceLocation = typeof SourceLocation.Type |
| 14 | |
| 15 | export interface Documentation { |
| 16 | readonly summary?: string | undefined |
| 17 | readonly deprecated?: string | undefined |
| 18 | readonly since?: string | undefined |
| 19 | readonly category?: string | undefined |
| 20 | readonly stability?: "stable" | "unstable" | "experimental" | undefined |
| 21 | } |
| 22 | |
| 23 | export interface TypeModel { |
| 24 | readonly kind: string |
| 25 | readonly [key: string]: unknown |
| 26 | } |
| 27 | |
| 28 | export interface DeclarationModel { |
| 29 | readonly kind: string |
| 30 | readonly name: string |
| 31 | readonly typeParameters?: ReadonlyArray<TypeParameterModel> | undefined |
| 32 | readonly parameters?: ReadonlyArray<ParameterModel> | undefined |
| 33 | readonly returnType?: TypeModel | undefined |
| 34 | readonly type?: TypeModel | undefined |
| 35 | readonly members?: ReadonlyArray<DeclarationModel> | undefined |
| 36 | readonly overloads?: ReadonlyArray<DeclarationModel> | undefined |
| 37 | readonly heritage?: ReadonlyArray<TypeModel> | undefined |
| 38 | readonly modifiers?: ReadonlyArray<string> | undefined |
| 39 | readonly value?: string | number | undefined |
| 40 | } |
| 41 | |
| 42 | export interface TypeParameterModel { |
| 43 | readonly id: string |
| 44 | readonly displayName: string |
| 45 | readonly constraint?: TypeModel | undefined |
| 46 | readonly default?: TypeModel | undefined |
| 47 | } |
| 48 | |
| 49 | export interface ParameterModel { |
| 50 | readonly name: string |
| 51 | readonly type: TypeModel |
| 52 | readonly optional: boolean |
| 53 | readonly rest: boolean |
| 54 | readonly modifiers?: ReadonlyArray<string> | undefined |
| 55 | } |
| 56 | |
| 57 | export interface ImportRoute { |
| 58 | readonly module: string |
| 59 | readonly path: ReadonlyArray<string> |
| 60 | } |
| 61 | |
| 62 | export interface ApiEntity { |
| 63 | readonly id: string |
| 64 | readonly packageName: string |
| 65 | readonly module: string |
| 66 | readonly path: ReadonlyArray<string> |
| 67 | readonly bucket: Bucket |
| 68 | readonly declarationKind: string |
| 69 | readonly importRoutes: ReadonlyArray<ImportRoute> |
| 70 | readonly declarations: ReadonlyArray<DeclarationModel> |
| 71 | readonly displaySignature: string |
| 72 | readonly fingerprint: string |
| 73 | readonly documentation: Documentation |
| 74 | readonly source: SourceLocation |
| 75 | } |
| 76 | |
| 77 | export interface Entrypoint { |
| 78 | readonly packageName: string |
| 79 | readonly module: string |
| 80 | readonly declarationFile: string |
| 81 | } |
| 82 | |
| 83 | export const SnapshotDiagnostic = Schema.Struct({ |
| 84 | code: Schema.String, |
| 85 | message: Schema.String, |
| 86 | module: Schema.optional(Schema.String), |
| 87 | path: Schema.optional(Schema.Array(Schema.String)), |
| 88 | source: Schema.optional(SourceLocation) |
| 89 | }) |
| 90 | |
| 91 | export type SnapshotDiagnostic = typeof SnapshotDiagnostic.Type |
| 92 | |
| 93 | export interface ApiSnapshot { |
| 94 | readonly version: 1 |
| 95 | readonly compiler: { |
| 96 | readonly name: "typescript" |
| 97 | readonly version: string |
| 98 | } |
| 99 | readonly ref: string |
| 100 | readonly sha: string |
| 101 | readonly packages: ReadonlyArray<string> |
| 102 | readonly entrypoints: ReadonlyArray<Entrypoint> |
| 103 | readonly entities: ReadonlyArray<ApiEntity> |
| 104 | readonly diagnostics: ReadonlyArray<SnapshotDiagnostic> |
| 105 | } |
| 106 | |
| 107 | export type ChangeClassification = |
| 108 | | "package-added" |
| 109 | | "package-removed" |
| 110 | | "module-added" |
| 111 | | "module-removed" |
| 112 | | "api-added" |
| 113 | | "api-removed" |
| 114 | | "api-moved" |
| 115 | | "api-renamed" |
| 116 | | "bucket-changed" |
| 117 | | "declaration-kind-changed" |
| 118 | | "overload-added" |
| 119 | | "overload-removed" |
| 120 | | "overload-reordered" |
| 121 | | "parameter-added" |
| 122 | | "parameter-removed" |
| 123 | | "parameter-reordered" |
| 124 | | "parameter-changed" |
| 125 | | "return-type-changed" |
| 126 | | "generic-parameter-changed" |
| 127 | | "member-added" |
| 128 | | "member-removed" |
| 129 | | "member-changed" |
| 130 | | "heritage-changed" |
| 131 | | "union-member-changed" |
| 132 | | "intersection-member-changed" |
| 133 | | "documentation-changed" |
| 134 | | "structural-change" |
| 135 | |
| 136 | export interface ApiChange { |
| 137 | readonly id: string |
| 138 | readonly classification: ChangeClassification |
| 139 | readonly confidence: number |
| 140 | readonly baseApiId?: string | undefined |
| 141 | readonly headApiId?: string | undefined |
| 142 | readonly before?: string | undefined |
| 143 | readonly after?: string | undefined |
| 144 | readonly delta?: unknown |
| 145 | readonly baseSource?: SourceLocation | undefined |
| 146 | readonly headSource?: SourceLocation | undefined |
| 147 | readonly reviewNotes?: string | undefined |
| 148 | readonly authoritative: boolean |
| 149 | } |
| 150 | |
| 151 | export interface ApiDiff { |
| 152 | readonly version: 1 |
| 153 | readonly base: { readonly ref: string; readonly sha: string } |
| 154 | readonly head: { readonly ref: string; readonly sha: string } |
| 155 | readonly changes: ReadonlyArray<ApiChange> |
| 156 | } |