@typeship-ax/cli 0.10.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +10 -5
- package/README.md +5 -5
- package/api.json +9773 -4501
- package/api.md +501 -271
- package/dist/api-identity.d.ts.map +1 -1
- package/dist/api-identity.js +6 -1
- package/dist/cli-agent.d.ts +5 -5
- package/dist/cli-agent.d.ts.map +1 -1
- package/dist/cli-agent.js +14 -10
- package/dist/cli.js +158 -82
- package/dist/core/http.d.ts +29 -16
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +108 -25
- package/dist/core/pagination.d.ts +8 -8
- package/dist/core/pagination.d.ts.map +1 -1
- package/dist/core/pagination.js +7 -16
- package/dist/errors.d.ts +20 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +29 -20
- package/dist/index.d.ts +37 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -18
- package/dist/ops.d.ts +5 -1
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js +42 -35
- package/dist/polling-login.d.ts.map +1 -1
- package/dist/polling-login.js +11 -1
- package/dist/resources/api-keys.d.ts +44 -18
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +46 -14
- package/dist/resources/deliveries.d.ts +46 -0
- package/dist/resources/deliveries.d.ts.map +1 -0
- package/dist/resources/deliveries.js +70 -0
- package/dist/resources/drafts.d.ts +155 -0
- package/dist/resources/drafts.d.ts.map +1 -0
- package/dist/resources/drafts.js +230 -0
- package/dist/resources/files.d.ts +23 -0
- package/dist/resources/files.d.ts.map +1 -0
- package/dist/resources/files.js +38 -0
- package/dist/resources/generate.d.ts +49 -20
- package/dist/resources/generate.d.ts.map +1 -1
- package/dist/resources/generate.js +56 -14
- package/dist/resources/generations.d.ts +70 -18
- package/dist/resources/generations.d.ts.map +1 -1
- package/dist/resources/generations.js +84 -16
- package/dist/resources/organization.d.ts +18 -0
- package/dist/resources/organization.d.ts.map +1 -0
- package/dist/resources/organization.js +32 -0
- package/dist/resources/projects.d.ts +87 -124
- package/dist/resources/projects.d.ts.map +1 -1
- package/dist/resources/projects.js +70 -173
- package/dist/resources/publications.d.ts +46 -0
- package/dist/resources/publications.d.ts.map +1 -0
- package/dist/resources/publications.js +70 -0
- package/dist/resources/releases.d.ts +66 -0
- package/dist/resources/releases.d.ts.map +1 -0
- package/dist/resources/releases.js +101 -0
- package/dist/resources/spec-revisions.d.ts +85 -0
- package/dist/resources/spec-revisions.d.ts.map +1 -0
- package/dist/resources/spec-revisions.js +116 -0
- package/dist/resources/specs.d.ts +72 -0
- package/dist/resources/specs.d.ts.map +1 -0
- package/dist/resources/specs.js +107 -0
- package/dist/resources/targets.d.ts +85 -105
- package/dist/resources/targets.d.ts.map +1 -1
- package/dist/resources/targets.js +70 -163
- package/dist/schemas.d.ts +1 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +194 -139
- package/dist/types.d.ts +2626 -1141
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +90 -11
- package/package.json +3 -3
- package/src/api-identity.ts +6 -2
- package/src/cli-agent.ts +17 -13
- package/src/cli.ts +145 -77
- package/src/core/http.ts +106 -30
- package/src/core/pagination.ts +13 -23
- package/src/errors.ts +30 -20
- package/src/index.ts +46 -24
- package/src/ops.ts +47 -36
- package/src/polling-login.ts +10 -1
- package/src/resources/api-keys.ts +87 -19
- package/src/resources/deliveries.ts +139 -0
- package/src/resources/drafts.ts +422 -0
- package/src/resources/files.ts +68 -0
- package/src/resources/generate.ts +81 -19
- package/src/resources/generations.ts +167 -29
- package/src/resources/organization.ts +53 -0
- package/src/resources/projects.ts +129 -322
- package/src/resources/publications.ts +139 -0
- package/src/resources/releases.ts +199 -0
- package/src/resources/spec-revisions.ts +237 -0
- package/src/resources/specs.ts +200 -0
- package/src/resources/targets.ts +135 -304
- package/src/schemas.ts +195 -140
- package/src/types.ts +2793 -1177
- package/dist/resources/account.d.ts +0 -18
- package/dist/resources/account.d.ts.map +0 -1
- package/dist/resources/account.js +0 -27
- package/dist/resources/definition-revisions.d.ts +0 -58
- package/dist/resources/definition-revisions.d.ts.map +0 -1
- package/dist/resources/definition-revisions.js +0 -114
- package/dist/resources/definitions.d.ts +0 -35
- package/dist/resources/definitions.d.ts.map +0 -1
- package/dist/resources/definitions.js +0 -60
- package/src/resources/account.ts +0 -46
- package/src/resources/definition-revisions.ts +0 -207
- package/src/resources/definitions.ts +0 -122
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// typeship — generations resource.
|
|
2
|
-
// Generated by typeship — https://typeship.dev
|
|
2
|
+
// Generated by typeship — https://typeship.dev
|
|
3
3
|
|
|
4
|
-
import { HttpCore, type
|
|
4
|
+
import { HttpCore, type RequestOptions } from "../core/http.js";
|
|
5
|
+
import { paginate, PagePromise } from "../core/pagination.js";
|
|
5
6
|
import {
|
|
6
7
|
ResponseParseError,
|
|
7
8
|
TransportError,
|
|
@@ -9,25 +10,82 @@ import {
|
|
|
9
10
|
ValidationError,
|
|
10
11
|
BadRequestError,
|
|
11
12
|
ForbiddenError,
|
|
13
|
+
InternalServerError,
|
|
12
14
|
NotFoundError,
|
|
13
15
|
RateLimitedError,
|
|
14
16
|
UnauthorizedError,
|
|
15
17
|
} from "../errors.js";
|
|
16
|
-
import type {
|
|
18
|
+
import type {
|
|
19
|
+
FileList,
|
|
20
|
+
FileListRead,
|
|
21
|
+
FileModel,
|
|
22
|
+
FileModelRead,
|
|
23
|
+
GenerationId,
|
|
24
|
+
GenerationList,
|
|
25
|
+
GenerationListRead,
|
|
26
|
+
GenerationResponse,
|
|
27
|
+
GenerationResponseRead,
|
|
28
|
+
GenerationStatus,
|
|
29
|
+
GenerationSummary,
|
|
30
|
+
GenerationSummaryRead,
|
|
31
|
+
ProjectId,
|
|
32
|
+
TargetId,
|
|
33
|
+
} from "../types.js";
|
|
17
34
|
|
|
18
35
|
export class GenerationsResource {
|
|
19
36
|
constructor(private readonly _core: HttpCore) {}
|
|
20
37
|
/**
|
|
21
|
-
*
|
|
38
|
+
* List generations
|
|
22
39
|
*
|
|
23
|
-
*
|
|
24
|
-
* `GET /generations
|
|
40
|
+
* Auto-paginates: `for await (const item of …)` walks every page.
|
|
41
|
+
* `GET /generations`
|
|
25
42
|
*/
|
|
26
|
-
|
|
27
|
-
|
|
43
|
+
list(
|
|
44
|
+
params?: GenerationsListParams,
|
|
28
45
|
options?: RequestOptions,
|
|
29
|
-
):
|
|
30
|
-
return this._core
|
|
46
|
+
): PagePromise<GenerationSummaryRead, GenerationsListError> {
|
|
47
|
+
return paginate<GenerationSummaryRead, GenerationsListError>(this._core, {
|
|
48
|
+
method: "GET",
|
|
49
|
+
path: "/generations",
|
|
50
|
+
security: [{"apiKey":[]}],
|
|
51
|
+
query: {
|
|
52
|
+
limit: params?.limit,
|
|
53
|
+
cursor: params?.cursor,
|
|
54
|
+
project_id: params?.projectId,
|
|
55
|
+
target_id: params?.targetId,
|
|
56
|
+
status: params?.status,
|
|
57
|
+
},
|
|
58
|
+
errors: {
|
|
59
|
+
"400": BadRequestError,
|
|
60
|
+
"401": UnauthorizedError,
|
|
61
|
+
"403": ForbiddenError,
|
|
62
|
+
"404": NotFoundError,
|
|
63
|
+
"429": RateLimitedError,
|
|
64
|
+
"500": InternalServerError,
|
|
65
|
+
},
|
|
66
|
+
idempotent: true,
|
|
67
|
+
schemaKey: "generations.list",
|
|
68
|
+
options,
|
|
69
|
+
}, {
|
|
70
|
+
style: "cursor",
|
|
71
|
+
itemsField: "data",
|
|
72
|
+
cursorParam: "cursor",
|
|
73
|
+
nextCursorField: "next_cursor",
|
|
74
|
+
hasMoreField: "has_more",
|
|
75
|
+
limitParam: "limit",
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get a generation
|
|
81
|
+
*
|
|
82
|
+
* Returns the status of that Generation. `queued` and `running` mean generation is still in
|
|
83
|
+
* progress. `completed` means generated files are saved, not that repository delivery or a Draft
|
|
84
|
+
* is complete. List its files with listGenerationFiles and read each with getFile.
|
|
85
|
+
* `GET /generations/{generation_id}`
|
|
86
|
+
*/
|
|
87
|
+
async get(generationId: GenerationId, options?: RequestOptions): Promise<GenerationResponseRead> {
|
|
88
|
+
return this._core.requestData<GenerationResponseRead, GenerationsGetError>({
|
|
31
89
|
method: "GET",
|
|
32
90
|
path: `/generations/${encodeURIComponent(String(generationId))}`,
|
|
33
91
|
security: [{"apiKey":[]}],
|
|
@@ -36,31 +94,34 @@ export class GenerationsResource {
|
|
|
36
94
|
"403": ForbiddenError,
|
|
37
95
|
"404": NotFoundError,
|
|
38
96
|
"429": RateLimitedError,
|
|
97
|
+
"500": InternalServerError,
|
|
39
98
|
},
|
|
40
99
|
idempotent: true,
|
|
41
|
-
schemaKey: "generations.
|
|
100
|
+
schemaKey: "generations.get",
|
|
42
101
|
options,
|
|
43
102
|
});
|
|
44
103
|
}
|
|
45
104
|
|
|
46
105
|
/**
|
|
47
|
-
*
|
|
106
|
+
* List a Generation's files
|
|
107
|
+
*
|
|
108
|
+
* Lists the generated package's files, ordered by path. Read content with getFile.
|
|
48
109
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
* `GET /generations/{generation_id}/file`
|
|
110
|
+
* Auto-paginates: `for await (const item of …)` walks every page.
|
|
111
|
+
* `GET /generations/{generation_id}/files`
|
|
52
112
|
*/
|
|
53
|
-
|
|
113
|
+
listFiles(
|
|
54
114
|
generationId: GenerationId,
|
|
55
|
-
params
|
|
115
|
+
params?: GenerationsListFilesParams,
|
|
56
116
|
options?: RequestOptions,
|
|
57
|
-
):
|
|
58
|
-
return this._core
|
|
117
|
+
): PagePromise<FileModelRead, GenerationsListFilesError> {
|
|
118
|
+
return paginate<FileModelRead, GenerationsListFilesError>(this._core, {
|
|
59
119
|
method: "GET",
|
|
60
|
-
path: `/generations/${encodeURIComponent(String(generationId))}/
|
|
120
|
+
path: `/generations/${encodeURIComponent(String(generationId))}/files`,
|
|
61
121
|
security: [{"apiKey":[]}],
|
|
62
122
|
query: {
|
|
63
|
-
|
|
123
|
+
limit: params?.limit,
|
|
124
|
+
cursor: params?.cursor,
|
|
64
125
|
},
|
|
65
126
|
errors: {
|
|
66
127
|
"400": BadRequestError,
|
|
@@ -68,37 +129,114 @@ export class GenerationsResource {
|
|
|
68
129
|
"403": ForbiddenError,
|
|
69
130
|
"404": NotFoundError,
|
|
70
131
|
"429": RateLimitedError,
|
|
132
|
+
"500": InternalServerError,
|
|
71
133
|
},
|
|
72
134
|
idempotent: true,
|
|
73
|
-
schemaKey: "generations.
|
|
135
|
+
schemaKey: "generations.listFiles",
|
|
74
136
|
options,
|
|
137
|
+
}, {
|
|
138
|
+
style: "cursor",
|
|
139
|
+
itemsField: "data",
|
|
140
|
+
cursorParam: "cursor",
|
|
141
|
+
nextCursorField: "next_cursor",
|
|
142
|
+
hasMoreField: "has_more",
|
|
143
|
+
limitParam: "limit",
|
|
75
144
|
});
|
|
76
145
|
}
|
|
146
|
+
|
|
147
|
+
/** Poll until files are generated or the Generation fails. */
|
|
148
|
+
async wait(
|
|
149
|
+
generationId: GenerationId,
|
|
150
|
+
options: RequestOptions & { intervalMs?: number; waitTimeoutMs?: number } = {},
|
|
151
|
+
): Promise<GenerationResponseRead> {
|
|
152
|
+
const { intervalMs = 3_000, waitTimeoutMs = 600_000, ...requestOptions } = options;
|
|
153
|
+
const deadline = Date.now() + waitTimeoutMs;
|
|
154
|
+
while (true) {
|
|
155
|
+
if (requestOptions.signal?.aborted) {
|
|
156
|
+
throw requestOptions.signal.reason ?? new Error("Generation wait aborted.");
|
|
157
|
+
}
|
|
158
|
+
const result = await this.get(generationId, requestOptions);
|
|
159
|
+
if (result.status !== "queued" && result.status !== "running") return result;
|
|
160
|
+
if (Date.now() >= deadline) throw new Error("Timed out waiting for Generation " + generationId + ".");
|
|
161
|
+
await new Promise<void>((resolve) =>
|
|
162
|
+
setTimeout(resolve, Math.min(intervalMs, deadline - Date.now())));
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface GenerationsListParams {
|
|
168
|
+
/**
|
|
169
|
+
* Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
|
|
170
|
+
* representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
|
|
171
|
+
* invalid_request. List query parameters must appear only once; unrecognized parameters also
|
|
172
|
+
* return 400.
|
|
173
|
+
*/
|
|
174
|
+
limit?: number;
|
|
175
|
+
/**
|
|
176
|
+
* Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
|
|
177
|
+
* operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
|
|
178
|
+
* malformed, or repeated cursors return 400 invalid_request. The page limit may change between
|
|
179
|
+
* requests.
|
|
180
|
+
*/
|
|
181
|
+
cursor?: string;
|
|
182
|
+
/** Only Generations in this Project. */
|
|
183
|
+
projectId?: ProjectId;
|
|
184
|
+
/** Only Generations of this Target. */
|
|
185
|
+
targetId?: TargetId;
|
|
186
|
+
/** Only Generations with this status. */
|
|
187
|
+
status?: GenerationStatus;
|
|
77
188
|
}
|
|
78
189
|
|
|
79
|
-
/**
|
|
80
|
-
export type
|
|
190
|
+
/** Typed errors `list` can throw. */
|
|
191
|
+
export type GenerationsListError =
|
|
192
|
+
| BadRequestError
|
|
81
193
|
| UnauthorizedError
|
|
82
194
|
| ForbiddenError
|
|
83
195
|
| NotFoundError
|
|
84
196
|
| RateLimitedError
|
|
197
|
+
| InternalServerError
|
|
85
198
|
| UnexpectedApiError
|
|
86
199
|
| ResponseParseError
|
|
87
200
|
| TransportError
|
|
88
201
|
| ValidationError;
|
|
89
202
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
203
|
+
/** Typed errors `get` can throw. */
|
|
204
|
+
export type GenerationsGetError =
|
|
205
|
+
| UnauthorizedError
|
|
206
|
+
| ForbiddenError
|
|
207
|
+
| NotFoundError
|
|
208
|
+
| RateLimitedError
|
|
209
|
+
| InternalServerError
|
|
210
|
+
| UnexpectedApiError
|
|
211
|
+
| ResponseParseError
|
|
212
|
+
| TransportError
|
|
213
|
+
| ValidationError;
|
|
214
|
+
|
|
215
|
+
export interface GenerationsListFilesParams {
|
|
216
|
+
/**
|
|
217
|
+
* Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
|
|
218
|
+
* representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
|
|
219
|
+
* invalid_request. List query parameters must appear only once; unrecognized parameters also
|
|
220
|
+
* return 400.
|
|
221
|
+
*/
|
|
222
|
+
limit?: number;
|
|
223
|
+
/**
|
|
224
|
+
* Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
|
|
225
|
+
* operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
|
|
226
|
+
* malformed, or repeated cursors return 400 invalid_request. The page limit may change between
|
|
227
|
+
* requests.
|
|
228
|
+
*/
|
|
229
|
+
cursor?: string;
|
|
93
230
|
}
|
|
94
231
|
|
|
95
|
-
/**
|
|
96
|
-
export type
|
|
232
|
+
/** Typed errors `listFiles` can throw. */
|
|
233
|
+
export type GenerationsListFilesError =
|
|
97
234
|
| BadRequestError
|
|
98
235
|
| UnauthorizedError
|
|
99
236
|
| ForbiddenError
|
|
100
237
|
| NotFoundError
|
|
101
238
|
| RateLimitedError
|
|
239
|
+
| InternalServerError
|
|
102
240
|
| UnexpectedApiError
|
|
103
241
|
| ResponseParseError
|
|
104
242
|
| TransportError
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// typeship — organization resource.
|
|
2
|
+
// Generated by typeship — https://typeship.dev
|
|
3
|
+
|
|
4
|
+
import { HttpCore, type RequestOptions } from "../core/http.js";
|
|
5
|
+
import {
|
|
6
|
+
ResponseParseError,
|
|
7
|
+
TransportError,
|
|
8
|
+
UnexpectedApiError,
|
|
9
|
+
ValidationError,
|
|
10
|
+
ForbiddenError,
|
|
11
|
+
InternalServerError,
|
|
12
|
+
RateLimitedError,
|
|
13
|
+
UnauthorizedError,
|
|
14
|
+
} from "../errors.js";
|
|
15
|
+
import type { Organization, OrganizationRead } from "../types.js";
|
|
16
|
+
|
|
17
|
+
export class OrganizationResource {
|
|
18
|
+
constructor(private readonly _core: HttpCore) {}
|
|
19
|
+
/**
|
|
20
|
+
* The organization behind the presented credentials
|
|
21
|
+
*
|
|
22
|
+
* Returns the organization associated with your credential. The Typeship CLI uses this endpoint
|
|
23
|
+
* for `whoami`.
|
|
24
|
+
* `GET /organization`
|
|
25
|
+
*/
|
|
26
|
+
async get(options?: RequestOptions): Promise<OrganizationRead> {
|
|
27
|
+
return this._core.requestData<OrganizationRead, OrganizationGetError>({
|
|
28
|
+
method: "GET",
|
|
29
|
+
path: "/organization",
|
|
30
|
+
security: [{"apiKey":[]}],
|
|
31
|
+
errors: {
|
|
32
|
+
"401": UnauthorizedError,
|
|
33
|
+
"403": ForbiddenError,
|
|
34
|
+
"429": RateLimitedError,
|
|
35
|
+
"500": InternalServerError,
|
|
36
|
+
},
|
|
37
|
+
idempotent: true,
|
|
38
|
+
schemaKey: "organization.get",
|
|
39
|
+
options,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** Typed errors `get` can throw. */
|
|
45
|
+
export type OrganizationGetError =
|
|
46
|
+
| UnauthorizedError
|
|
47
|
+
| ForbiddenError
|
|
48
|
+
| RateLimitedError
|
|
49
|
+
| InternalServerError
|
|
50
|
+
| UnexpectedApiError
|
|
51
|
+
| ResponseParseError
|
|
52
|
+
| TransportError
|
|
53
|
+
| ValidationError;
|