@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.
Files changed (109) hide show
  1. package/AGENTS.md +10 -5
  2. package/README.md +5 -5
  3. package/api.json +9773 -4501
  4. package/api.md +501 -271
  5. package/dist/api-identity.d.ts.map +1 -1
  6. package/dist/api-identity.js +6 -1
  7. package/dist/cli-agent.d.ts +5 -5
  8. package/dist/cli-agent.d.ts.map +1 -1
  9. package/dist/cli-agent.js +14 -10
  10. package/dist/cli.js +158 -82
  11. package/dist/core/http.d.ts +29 -16
  12. package/dist/core/http.d.ts.map +1 -1
  13. package/dist/core/http.js +108 -25
  14. package/dist/core/pagination.d.ts +8 -8
  15. package/dist/core/pagination.d.ts.map +1 -1
  16. package/dist/core/pagination.js +7 -16
  17. package/dist/errors.d.ts +20 -13
  18. package/dist/errors.d.ts.map +1 -1
  19. package/dist/errors.js +29 -20
  20. package/dist/index.d.ts +37 -19
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +42 -18
  23. package/dist/ops.d.ts +5 -1
  24. package/dist/ops.d.ts.map +1 -1
  25. package/dist/ops.js +42 -35
  26. package/dist/polling-login.d.ts.map +1 -1
  27. package/dist/polling-login.js +11 -1
  28. package/dist/resources/api-keys.d.ts +44 -18
  29. package/dist/resources/api-keys.d.ts.map +1 -1
  30. package/dist/resources/api-keys.js +46 -14
  31. package/dist/resources/deliveries.d.ts +46 -0
  32. package/dist/resources/deliveries.d.ts.map +1 -0
  33. package/dist/resources/deliveries.js +70 -0
  34. package/dist/resources/drafts.d.ts +155 -0
  35. package/dist/resources/drafts.d.ts.map +1 -0
  36. package/dist/resources/drafts.js +230 -0
  37. package/dist/resources/files.d.ts +23 -0
  38. package/dist/resources/files.d.ts.map +1 -0
  39. package/dist/resources/files.js +38 -0
  40. package/dist/resources/generate.d.ts +49 -20
  41. package/dist/resources/generate.d.ts.map +1 -1
  42. package/dist/resources/generate.js +56 -14
  43. package/dist/resources/generations.d.ts +70 -18
  44. package/dist/resources/generations.d.ts.map +1 -1
  45. package/dist/resources/generations.js +84 -16
  46. package/dist/resources/organization.d.ts +18 -0
  47. package/dist/resources/organization.d.ts.map +1 -0
  48. package/dist/resources/organization.js +32 -0
  49. package/dist/resources/projects.d.ts +87 -124
  50. package/dist/resources/projects.d.ts.map +1 -1
  51. package/dist/resources/projects.js +70 -173
  52. package/dist/resources/publications.d.ts +46 -0
  53. package/dist/resources/publications.d.ts.map +1 -0
  54. package/dist/resources/publications.js +70 -0
  55. package/dist/resources/releases.d.ts +66 -0
  56. package/dist/resources/releases.d.ts.map +1 -0
  57. package/dist/resources/releases.js +101 -0
  58. package/dist/resources/spec-revisions.d.ts +85 -0
  59. package/dist/resources/spec-revisions.d.ts.map +1 -0
  60. package/dist/resources/spec-revisions.js +116 -0
  61. package/dist/resources/specs.d.ts +72 -0
  62. package/dist/resources/specs.d.ts.map +1 -0
  63. package/dist/resources/specs.js +107 -0
  64. package/dist/resources/targets.d.ts +85 -105
  65. package/dist/resources/targets.d.ts.map +1 -1
  66. package/dist/resources/targets.js +70 -163
  67. package/dist/schemas.d.ts +1 -0
  68. package/dist/schemas.d.ts.map +1 -1
  69. package/dist/schemas.js +194 -139
  70. package/dist/types.d.ts +2626 -1141
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/types.js +90 -11
  73. package/package.json +3 -3
  74. package/src/api-identity.ts +6 -2
  75. package/src/cli-agent.ts +17 -13
  76. package/src/cli.ts +145 -77
  77. package/src/core/http.ts +106 -30
  78. package/src/core/pagination.ts +13 -23
  79. package/src/errors.ts +30 -20
  80. package/src/index.ts +46 -24
  81. package/src/ops.ts +47 -36
  82. package/src/polling-login.ts +10 -1
  83. package/src/resources/api-keys.ts +87 -19
  84. package/src/resources/deliveries.ts +139 -0
  85. package/src/resources/drafts.ts +422 -0
  86. package/src/resources/files.ts +68 -0
  87. package/src/resources/generate.ts +81 -19
  88. package/src/resources/generations.ts +167 -29
  89. package/src/resources/organization.ts +53 -0
  90. package/src/resources/projects.ts +129 -322
  91. package/src/resources/publications.ts +139 -0
  92. package/src/resources/releases.ts +199 -0
  93. package/src/resources/spec-revisions.ts +237 -0
  94. package/src/resources/specs.ts +200 -0
  95. package/src/resources/targets.ts +135 -304
  96. package/src/schemas.ts +195 -140
  97. package/src/types.ts +2793 -1177
  98. package/dist/resources/account.d.ts +0 -18
  99. package/dist/resources/account.d.ts.map +0 -1
  100. package/dist/resources/account.js +0 -27
  101. package/dist/resources/definition-revisions.d.ts +0 -58
  102. package/dist/resources/definition-revisions.d.ts.map +0 -1
  103. package/dist/resources/definition-revisions.js +0 -114
  104. package/dist/resources/definitions.d.ts +0 -35
  105. package/dist/resources/definitions.d.ts.map +0 -1
  106. package/dist/resources/definitions.js +0 -60
  107. package/src/resources/account.ts +0 -46
  108. package/src/resources/definition-revisions.ts +0 -207
  109. package/src/resources/definitions.ts +0 -122
@@ -0,0 +1,230 @@
1
+ // typeship — drafts resource.
2
+ // Generated by typeship — https://typeship.dev
3
+ import { paginate } from "../core/pagination.js";
4
+ import { BadGatewayError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError, UnprocessableEntityError, } from "../errors.js";
5
+ export class DraftsResource {
6
+ _core;
7
+ constructor(_core) {
8
+ this._core = _core;
9
+ }
10
+ /**
11
+ * List Drafts
12
+ *
13
+ * Lists open and merged Drafts, newest first. Each Target has one open Draft; each merge adds a
14
+ * merged Draft.
15
+ *
16
+ * Auto-paginates: `for await (const item of …)` walks every page.
17
+ * `GET /drafts`
18
+ */
19
+ list(params, options) {
20
+ return paginate(this._core, {
21
+ method: "GET",
22
+ path: "/drafts",
23
+ security: [{ "apiKey": [] }],
24
+ query: {
25
+ limit: params?.limit,
26
+ cursor: params?.cursor,
27
+ target_id: params?.targetId,
28
+ status: params?.status,
29
+ },
30
+ errors: {
31
+ "400": BadRequestError,
32
+ "401": UnauthorizedError,
33
+ "403": ForbiddenError,
34
+ "404": NotFoundError,
35
+ "429": RateLimitedError,
36
+ "500": InternalServerError,
37
+ },
38
+ idempotent: true,
39
+ schemaKey: "drafts.list",
40
+ options,
41
+ }, {
42
+ style: "cursor",
43
+ itemsField: "data",
44
+ cursorParam: "cursor",
45
+ nextCursorField: "next_cursor",
46
+ hasMoreField: "has_more",
47
+ limitParam: "limit",
48
+ });
49
+ }
50
+ /**
51
+ * Get a Draft
52
+ *
53
+ * Returns the Draft's status. An open Draft also reports its typed reason when action is
54
+ * required, next version and its source, readiness, checks, and conflict counts. The response
55
+ * carries an `ETag`; send it in `If-Match` when updating the Draft to avoid changing a newer
56
+ * version selection.
57
+ * `GET /drafts/{draft_id}`
58
+ */
59
+ async get(draftId, options) {
60
+ return this._core.requestData({
61
+ method: "GET",
62
+ path: `/drafts/${encodeURIComponent(String(draftId))}`,
63
+ security: [{ "apiKey": [] }],
64
+ errors: {
65
+ "401": UnauthorizedError,
66
+ "403": ForbiddenError,
67
+ "404": NotFoundError,
68
+ "429": RateLimitedError,
69
+ "500": InternalServerError,
70
+ },
71
+ idempotent: true,
72
+ schemaKey: "drafts.get",
73
+ options,
74
+ });
75
+ }
76
+ /**
77
+ * Select an exact Draft version or return to automatic versioning
78
+ *
79
+ * Checks your version choice against the required version bump, then regenerates the existing
80
+ * Draft pull request.
81
+ *
82
+ * Send the Draft's `ETag` in `If-Match` to reject an intervening change with 412
83
+ * precondition_failed before saving or regenerating. Omitting `If-Match` applies the selection to
84
+ * the current Draft. version_next is required; null restores automatic selection.
85
+ *
86
+ * A `502` response means the selected version was saved, but regeneration failed. Follow the
87
+ * error's retryable and suggested_action fields. Repeating an unfinished selection resumes
88
+ * generation; repeating a completed selection starts no new work. If using If-Match, retrieve the
89
+ * Draft and confirm the saved selection before retrying with its current ETag.
90
+ * A `409 draft_merged` means the Draft merged; retrieve the Target and select a version on its
91
+ * `draft_id`. A `409 target_busy` means the Target is publishing; wait and retry. A `409
92
+ * version_occupied` means the version is already released; retrieve the Draft and releases,
93
+ * choose a new version, and retry.
94
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
95
+ * and If-Match.
96
+ * `PATCH /drafts/{draft_id}`
97
+ */
98
+ async update(draftId, body, params, options) {
99
+ return this._core.requestData({
100
+ method: "PATCH",
101
+ path: `/drafts/${encodeURIComponent(String(draftId))}`,
102
+ security: [{ "apiKey": [] }],
103
+ headers: {
104
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
105
+ },
106
+ body,
107
+ errors: {
108
+ "400": BadRequestError,
109
+ "401": UnauthorizedError,
110
+ "403": ForbiddenError,
111
+ "404": NotFoundError,
112
+ "409": ConflictError,
113
+ "412": PreconditionFailedError,
114
+ "422": UnprocessableEntityError,
115
+ "429": RateLimitedError,
116
+ "500": InternalServerError,
117
+ "502": BadGatewayError,
118
+ },
119
+ schemaKey: "drafts.update",
120
+ options,
121
+ });
122
+ }
123
+ /**
124
+ * List customized and conflicted files on a Draft
125
+ *
126
+ * Lists the Draft's files that differ from the last merged package or need a conflict decision,
127
+ * ordered by path, without file content. Each conflict names its kind, the saved decision, and
128
+ * the sides you can read with getFile. With `filter=history`, lists files affected by a
129
+ * default-branch history rewrite; the list is empty when none is pending.
130
+ *
131
+ * Returns `409 resource_changed` while Typeship is carrying the Draft's latest commit forward
132
+ * (status working), or when the Draft changes between pages.
133
+ *
134
+ * Auto-paginates: `for await (const item of …)` walks every page.
135
+ * `GET /drafts/{draft_id}/files`
136
+ */
137
+ listFiles(draftId, params, options) {
138
+ return paginate(this._core, {
139
+ method: "GET",
140
+ path: `/drafts/${encodeURIComponent(String(draftId))}/files`,
141
+ security: [{ "apiKey": [] }],
142
+ query: {
143
+ filter: params?.filter,
144
+ limit: params?.limit,
145
+ cursor: params?.cursor,
146
+ },
147
+ errors: {
148
+ "400": BadRequestError,
149
+ "401": UnauthorizedError,
150
+ "403": ForbiddenError,
151
+ "404": NotFoundError,
152
+ "409": ConflictError,
153
+ "429": RateLimitedError,
154
+ "500": InternalServerError,
155
+ },
156
+ idempotent: true,
157
+ schemaKey: "drafts.listFiles",
158
+ options,
159
+ }, {
160
+ style: "cursor",
161
+ itemsField: "data",
162
+ cursorParam: "cursor",
163
+ nextCursorField: "next_cursor",
164
+ hasMoreField: "has_more",
165
+ limitParam: "limit",
166
+ });
167
+ }
168
+ /**
169
+ * Resolve selected Draft files
170
+ *
171
+ * Resolves conflicts on the Draft's head_sha: keep yours or generated, or supply final content as
172
+ * text or, for binary files, base64. Choosing generated for a customized path replaces it with
173
+ * the generated file, or deletes a Draft-only file.
174
+ *
175
+ * Conflict decisions are saved together and can be replaced until applied. Choosing generated for
176
+ * customized paths commits those changes together on the Draft branch. Returns the Draft. When
177
+ * every conflict has a decision, `conflicts.decided` equals `conflicts.total` and Typeship
178
+ * continues the Draft and runs checks. Paths that already match the Draft change nothing.
179
+ * `POST /drafts/{draft_id}/resolve`
180
+ */
181
+ async resolve(draftId, body, options) {
182
+ return this._core.requestData({
183
+ method: "POST",
184
+ path: `/drafts/${encodeURIComponent(String(draftId))}/resolve`,
185
+ security: [{ "apiKey": [] }],
186
+ body,
187
+ errors: {
188
+ "400": BadRequestError,
189
+ "401": UnauthorizedError,
190
+ "403": ForbiddenError,
191
+ "404": NotFoundError,
192
+ "409": ConflictError,
193
+ "429": RateLimitedError,
194
+ "500": InternalServerError,
195
+ },
196
+ schemaKey: "drafts.resolve",
197
+ options,
198
+ });
199
+ }
200
+ /**
201
+ * Approve recovery from rewritten default-branch history
202
+ *
203
+ * When the Draft has status `action_required` and reason `history_rewritten`, review affected
204
+ * files with `listDraftFiles` and `filter=history`, then approve with the Draft's
205
+ * `history_recovery` revisions. Approval saves the recovery without changing Git and returns the
206
+ * Draft; the next generation rebuilds it from the rewritten default branch. The previous Draft
207
+ * branch stays available, and overlapping code comes back as conflicts to resolve. A rewritten
208
+ * Draft branch alone needs no approval.
209
+ * `POST /drafts/{draft_id}/recover`
210
+ */
211
+ async recover(draftId, body, options) {
212
+ return this._core.requestData({
213
+ method: "POST",
214
+ path: `/drafts/${encodeURIComponent(String(draftId))}/recover`,
215
+ security: [{ "apiKey": [] }],
216
+ body,
217
+ errors: {
218
+ "400": BadRequestError,
219
+ "401": UnauthorizedError,
220
+ "403": ForbiddenError,
221
+ "404": NotFoundError,
222
+ "409": ConflictError,
223
+ "429": RateLimitedError,
224
+ "500": InternalServerError,
225
+ },
226
+ schemaKey: "drafts.recover",
227
+ options,
228
+ });
229
+ }
230
+ }
@@ -0,0 +1,23 @@
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
3
+ import type { FileId, FileResponseRead } from "../types.js";
4
+ export declare class FilesResource {
5
+ private readonly _core;
6
+ constructor(_core: HttpCore);
7
+ /**
8
+ * Get a file
9
+ *
10
+ * Returns one bounded chunk of an immutable file: at most 24 KiB, as UTF-8 text or, for binary
11
+ * bytes, base64. When next_cursor is not null, repeat the request with cursor and concatenate the
12
+ * chunks in order. A file ID always returns the same bytes.
13
+ * `GET /files/{file_id}`
14
+ */
15
+ get(fileId: FileId, params?: FilesGetParams, options?: RequestOptions): Promise<FileResponseRead>;
16
+ }
17
+ export interface FilesGetParams {
18
+ /** next_cursor from the preceding chunk of this file. */
19
+ cursor?: string;
20
+ }
21
+ /** Typed errors `get` can throw. */
22
+ export type FilesGetError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
23
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,MAAM,EAAgB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1E,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;OAOG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAqBxG;AAED,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,oCAAoC;AACpC,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -0,0 +1,38 @@
1
+ // typeship — files resource.
2
+ // Generated by typeship — https://typeship.dev
3
+ import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
+ export class FilesResource {
5
+ _core;
6
+ constructor(_core) {
7
+ this._core = _core;
8
+ }
9
+ /**
10
+ * Get a file
11
+ *
12
+ * Returns one bounded chunk of an immutable file: at most 24 KiB, as UTF-8 text or, for binary
13
+ * bytes, base64. When next_cursor is not null, repeat the request with cursor and concatenate the
14
+ * chunks in order. A file ID always returns the same bytes.
15
+ * `GET /files/{file_id}`
16
+ */
17
+ async get(fileId, params, options) {
18
+ return this._core.requestData({
19
+ method: "GET",
20
+ path: `/files/${encodeURIComponent(String(fileId))}`,
21
+ security: [{ "apiKey": [] }],
22
+ query: {
23
+ cursor: params?.cursor,
24
+ },
25
+ errors: {
26
+ "400": BadRequestError,
27
+ "401": UnauthorizedError,
28
+ "403": ForbiddenError,
29
+ "404": NotFoundError,
30
+ "429": RateLimitedError,
31
+ "500": InternalServerError,
32
+ },
33
+ idempotent: true,
34
+ schemaKey: "files.get",
35
+ options,
36
+ });
37
+ }
38
+ }
@@ -1,36 +1,65 @@
1
- import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
2
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, ApiResponseError, BadRequestError, ConflictError, ForbiddenError, PayloadTooLargeError, RateLimitedError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, ApiResponseError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PayloadTooLargeError, RateLimitedError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
3
3
  import type { GenerateRequest, GenerationResultRead } from "../types.js";
4
4
  export declare class GenerateResource {
5
5
  private readonly _core;
6
6
  constructor(_core: HttpCore);
7
7
  /**
8
- * Generate one Target from a Definition
9
- *
10
- * Stateless generation: nothing is stored. Returns the full generated
11
- * package as files. Works without an API key: anonymous calls generate
12
- * the first 25 operations, rate limited per IP address, and the
13
- * response's `limits` object says what was held back and where to lift
14
- * it; anonymous calls from a Definition URL also carry `claim.url`, a link
15
- * that turns the run into a project once a person signs in. With a key, the free plan generates
16
- * the first 25 operations and
17
- * paid plans generate the complete Definition. A present but invalid key is a
18
- * 401, not a downgrade to anonymous.
8
+ * Generate one package from a Spec
9
+ *
10
+ * Returns one generated package without creating a Project.
11
+ *
12
+ * Supports [idempotent retries](https://typeship.dev/docs/typeship-api/idempotency); keyed
13
+ * responses include generated files in the replay cache.
14
+ *
15
+ * Use `download.url` to save the complete ZIP, verify `download.sha256`, and extract it into an
16
+ * empty directory. The link expires at `download.expires_at` and grants access to anyone who has
17
+ * it. CLI, MCP, and SDK calls supply an idempotency key automatically. Agents should request
18
+ * `fields=["download","coverage","warnings","claim"]` to keep the MCP result compact; files can
19
+ * exceed the response limit. Download the ZIP instead of repeating generation to retrieve omitted
20
+ * files.
21
+ *
22
+ * Anonymous and Free requests include the first 25 operations. Paid plans include all operations.
23
+ * Anonymous requests are rate limited by IP address. Check `coverage` for omitted operations; an
24
+ * invalid API key returns `401`.
25
+ *
26
+ * An anonymous URL request without source headers may return `claim.url`. Sign in through that
27
+ * link within seven days to save the recipe as a Project.
19
28
  *
20
29
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
21
30
  * `POST /generate`
22
31
  */
23
- run(body: GenerateRequest, params?: GenerateRunParams, options?: RequestOptions): Promise<ApiResult<GenerationResultRead, GenerateRunError>>;
32
+ run(body: GenerateRequest, params?: GenerateRunParams, options?: RequestOptions): Promise<GenerationResultRead>;
33
+ /**
34
+ * Download a generated package
35
+ *
36
+ * Download the complete ZIP referenced by `generate_run`'s `download.url`. Pass the token from
37
+ * that URL. No API key is needed; the token grants access only to that exact package until its
38
+ * replay window expires. Keep the token private.
39
+ *
40
+ * The local MCP server saves this binary response to disk. On a hosted MCP connection, download
41
+ * the original URL directly to your workspace. Verify the ZIP against `download.sha256` before
42
+ * extracting it into an empty directory. Expired or invalid tokens return `404`; a new generation
43
+ * creates a new download.
44
+ * `GET /generate/download`
45
+ */
46
+ downloadPackage(params: GenerateDownloadPackageParams, options?: RequestOptions): Promise<Blob>;
24
47
  }
25
48
  export interface GenerateRunParams {
26
49
  /**
27
- * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
28
- * operation; account-less generation uses a hashed network identity. Retrying the same method,
29
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
30
- * returns 409. After expiry the key starts a new write.
50
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
51
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
52
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
53
+ * the key with changed intent returns 409. After expiry the key starts a new write.
31
54
  */
32
55
  idempotencyKey?: string;
33
56
  }
34
- /** Every error `run` can produce, as a discriminated union. */
35
- export type GenerateRunError = BadRequestError | UnauthorizedError | ForbiddenError | ConflictError | PayloadTooLargeError | UnprocessableEntityError | RateLimitedError | ApiResponseError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
57
+ /** Typed errors `run` can throw. */
58
+ export type GenerateRunError = BadRequestError | UnauthorizedError | ForbiddenError | ConflictError | PayloadTooLargeError | UnprocessableEntityError | RateLimitedError | InternalServerError | ApiResponseError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
59
+ export interface GenerateDownloadPackageParams {
60
+ /** Private download token from download.url in the generation result. */
61
+ token: string;
62
+ }
63
+ /** Typed errors `downloadPackage` can throw. */
64
+ export type GenerateDownloadPackageError = BadRequestError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
36
65
  //# sourceMappingURL=generate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/resources/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;;;;;;;;OAeG;IACG,GAAG,CACP,IAAI,EAAE,eAAe,EACrB,MAAM,CAAC,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;CAwB9D;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,wBAAwB,GACxB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/resources/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,GAAG,CACP,IAAI,EAAE,eAAe,EACrB,MAAM,CAAC,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;IA0BhC;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,MAAM,EAAE,6BAA6B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBtG;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,wBAAwB,GACxB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,MAAM,MAAM,4BAA4B,GACpC,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -1,29 +1,38 @@
1
1
  // typeship — generate resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
3
- import { ApiResponseError, BadRequestError, ConflictError, ForbiddenError, PayloadTooLargeError, RateLimitedError, UnauthorizedError, UnprocessableEntityError, } from "../errors.js";
2
+ // Generated by typeship — https://typeship.dev
3
+ import { ApiResponseError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PayloadTooLargeError, RateLimitedError, UnauthorizedError, UnprocessableEntityError, } from "../errors.js";
4
4
  export class GenerateResource {
5
5
  _core;
6
6
  constructor(_core) {
7
7
  this._core = _core;
8
8
  }
9
9
  /**
10
- * Generate one Target from a Definition
11
- *
12
- * Stateless generation: nothing is stored. Returns the full generated
13
- * package as files. Works without an API key: anonymous calls generate
14
- * the first 25 operations, rate limited per IP address, and the
15
- * response's `limits` object says what was held back and where to lift
16
- * it; anonymous calls from a Definition URL also carry `claim.url`, a link
17
- * that turns the run into a project once a person signs in. With a key, the free plan generates
18
- * the first 25 operations and
19
- * paid plans generate the complete Definition. A present but invalid key is a
20
- * 401, not a downgrade to anonymous.
10
+ * Generate one package from a Spec
11
+ *
12
+ * Returns one generated package without creating a Project.
13
+ *
14
+ * Supports [idempotent retries](https://typeship.dev/docs/typeship-api/idempotency); keyed
15
+ * responses include generated files in the replay cache.
16
+ *
17
+ * Use `download.url` to save the complete ZIP, verify `download.sha256`, and extract it into an
18
+ * empty directory. The link expires at `download.expires_at` and grants access to anyone who has
19
+ * it. CLI, MCP, and SDK calls supply an idempotency key automatically. Agents should request
20
+ * `fields=["download","coverage","warnings","claim"]` to keep the MCP result compact; files can
21
+ * exceed the response limit. Download the ZIP instead of repeating generation to retrieve omitted
22
+ * files.
23
+ *
24
+ * Anonymous and Free requests include the first 25 operations. Paid plans include all operations.
25
+ * Anonymous requests are rate limited by IP address. Check `coverage` for omitted operations; an
26
+ * invalid API key returns `401`.
27
+ *
28
+ * An anonymous URL request without source headers may return `claim.url`. Sign in through that
29
+ * link within seven days to save the recipe as a Project.
21
30
  *
22
31
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
23
32
  * `POST /generate`
24
33
  */
25
34
  async run(body, params, options) {
26
- return this._core.request({
35
+ return this._core.requestData({
27
36
  method: "POST",
28
37
  path: "/generate",
29
38
  security: [{}, { "apiKey": [] }],
@@ -39,6 +48,7 @@ export class GenerateResource {
39
48
  "413": PayloadTooLargeError,
40
49
  "422": UnprocessableEntityError,
41
50
  "429": RateLimitedError,
51
+ "500": InternalServerError,
42
52
  default: ApiResponseError,
43
53
  },
44
54
  idempotencyKey: "Idempotency-Key",
@@ -46,4 +56,36 @@ export class GenerateResource {
46
56
  options,
47
57
  });
48
58
  }
59
+ /**
60
+ * Download a generated package
61
+ *
62
+ * Download the complete ZIP referenced by `generate_run`'s `download.url`. Pass the token from
63
+ * that URL. No API key is needed; the token grants access only to that exact package until its
64
+ * replay window expires. Keep the token private.
65
+ *
66
+ * The local MCP server saves this binary response to disk. On a hosted MCP connection, download
67
+ * the original URL directly to your workspace. Verify the ZIP against `download.sha256` before
68
+ * extracting it into an empty directory. Expired or invalid tokens return `404`; a new generation
69
+ * creates a new download.
70
+ * `GET /generate/download`
71
+ */
72
+ async downloadPackage(params, options) {
73
+ return this._core.requestData({
74
+ method: "GET",
75
+ path: "/generate/download",
76
+ security: [{}],
77
+ query: {
78
+ token: params.token,
79
+ },
80
+ errors: {
81
+ "400": BadRequestError,
82
+ "404": NotFoundError,
83
+ "429": RateLimitedError,
84
+ "500": InternalServerError,
85
+ },
86
+ idempotent: true,
87
+ schemaKey: "generate.downloadPackage",
88
+ options,
89
+ });
90
+ }
49
91
  }
@@ -1,31 +1,83 @@
1
- import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
2
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
3
- import type { GenerationId, GenerationResponseRead } from "../types.js";
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { PagePromise } from "../core/pagination.js";
3
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
4
+ import type { FileModelRead, GenerationId, GenerationResponseRead, GenerationStatus, GenerationSummaryRead, ProjectId, TargetId } from "../types.js";
4
5
  export declare class GenerationsResource {
5
6
  private readonly _core;
6
7
  constructor(_core: HttpCore);
7
8
  /**
8
- * Retrieve a generation
9
+ * List generations
9
10
  *
10
- * Includes the generated files when the generation succeeded.
11
+ * Auto-paginates: `for await (const item of …)` walks every page.
12
+ * `GET /generations`
13
+ */
14
+ list(params?: GenerationsListParams, options?: RequestOptions): PagePromise<GenerationSummaryRead, GenerationsListError>;
15
+ /**
16
+ * Get a generation
17
+ *
18
+ * Returns the status of that Generation. `queued` and `running` mean generation is still in
19
+ * progress. `completed` means generated files are saved, not that repository delivery or a Draft
20
+ * is complete. List its files with listGenerationFiles and read each with getFile.
11
21
  * `GET /generations/{generation_id}`
12
22
  */
13
- retrieve(generationId: GenerationId, options?: RequestOptions): Promise<ApiResult<GenerationResponseRead, GenerationsRetrieveError>>;
23
+ get(generationId: GenerationId, options?: RequestOptions): Promise<GenerationResponseRead>;
14
24
  /**
15
- * Fetch one file from a generation
25
+ * List a Generation's files
26
+ *
27
+ * Lists the generated package's files, ordered by path. Read content with getFile.
16
28
  *
17
- * Raw file content, for generations whose target was too large to inline (files_omitted true).
18
- * The generation's files_index lists valid paths.
19
- * `GET /generations/{generation_id}/file`
29
+ * Auto-paginates: `for await (const item of …)` walks every page.
30
+ * `GET /generations/{generation_id}/files`
20
31
  */
21
- retrieveFile(generationId: GenerationId, params: GenerationsRetrieveFileParams, options?: RequestOptions): Promise<ApiResult<string, GenerationsRetrieveFileError>>;
32
+ listFiles(generationId: GenerationId, params?: GenerationsListFilesParams, options?: RequestOptions): PagePromise<FileModelRead, GenerationsListFilesError>;
33
+ /** Poll until files are generated or the Generation fails. */
34
+ wait(generationId: GenerationId, options?: RequestOptions & {
35
+ intervalMs?: number;
36
+ waitTimeoutMs?: number;
37
+ }): Promise<GenerationResponseRead>;
22
38
  }
23
- /** Every error `retrieve` can produce, as a discriminated union. */
24
- export type GenerationsRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
25
- export interface GenerationsRetrieveFileParams {
26
- /** Repo-relative path inside the generated package. */
27
- path: string;
39
+ export interface GenerationsListParams {
40
+ /**
41
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
42
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
43
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
44
+ * return 400.
45
+ */
46
+ limit?: number;
47
+ /**
48
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
49
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
50
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
51
+ * requests.
52
+ */
53
+ cursor?: string;
54
+ /** Only Generations in this Project. */
55
+ projectId?: ProjectId;
56
+ /** Only Generations of this Target. */
57
+ targetId?: TargetId;
58
+ /** Only Generations with this status. */
59
+ status?: GenerationStatus;
60
+ }
61
+ /** Typed errors `list` can throw. */
62
+ export type GenerationsListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
63
+ /** Typed errors `get` can throw. */
64
+ export type GenerationsGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
65
+ export interface GenerationsListFilesParams {
66
+ /**
67
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
68
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
69
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
70
+ * return 400.
71
+ */
72
+ limit?: number;
73
+ /**
74
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
75
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
76
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
77
+ * requests.
78
+ */
79
+ cursor?: string;
28
80
  }
29
- /** Every error `retrieveFile` can produce, as a discriminated union. */
30
- export type GenerationsRetrieveFileError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
81
+ /** Typed errors `listFiles` can throw. */
82
+ export type GenerationsListFilesError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
31
83
  //# sourceMappingURL=generations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generations.d.ts","sourceRoot":"","sources":["../../src/resources/generations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAsB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE5F,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;OAKG;IACG,QAAQ,CACZ,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,wBAAwB,CAAC,CAAC;IAiBvE;;;;;;OAMG;IACG,YAAY,CAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,6BAA6B,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;CAoB5D;AAED,oEAAoE;AACpE,MAAM,MAAM,wBAAwB,GAChC,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wEAAwE;AACxE,MAAM,MAAM,4BAA4B,GACpC,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"generations.d.ts","sourceRoot":"","sources":["../../src/resources/generations.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAIV,aAAa,EACb,YAAY,EAIZ,sBAAsB,EACtB,gBAAgB,EAEhB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;OAKG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,qBAAqB,EAAE,oBAAoB,CAAC;IAiC3D;;;;;;;OAOG;IACG,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAkBhG;;;;;;;OAOG;IACH,SAAS,CACP,YAAY,EAAE,YAAY,EAC1B,MAAM,CAAC,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,aAAa,EAAE,yBAAyB,CAAC;IA8B1D,8DAA8D;IACtD,IAAI,CACR,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,cAAc,GAAG;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7E,OAAO,CAAC,sBAAsB,CAAC;CAcnC;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,yCAAyC;IACzC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAC5B,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,oCAAoC;AACpC,MAAM,MAAM,mBAAmB,GAC3B,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,MAAM,yBAAyB,GACjC,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}