@typeship-ax/mcp 0.10.0 → 0.19.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 (68) hide show
  1. package/AGENTS.md +10 -4
  2. package/README.md +16 -5
  3. package/api.json +4539 -616
  4. package/api.md +3827 -673
  5. package/dist/core/http.d.ts +3 -2
  6. package/dist/core/http.d.ts.map +1 -1
  7. package/dist/core/http.js +18 -6
  8. package/dist/errors.d.ts +17 -10
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/errors.js +24 -15
  11. package/dist/index.d.ts +7 -3
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +9 -5
  14. package/dist/mcp-protocol.d.ts +10 -6
  15. package/dist/mcp-protocol.d.ts.map +1 -1
  16. package/dist/mcp-protocol.js +108 -37
  17. package/dist/mcp.d.ts.map +1 -1
  18. package/dist/mcp.js +36 -17
  19. package/dist/ops.d.ts +4 -0
  20. package/dist/ops.d.ts.map +1 -1
  21. package/dist/ops.js +45 -35
  22. package/dist/resources/account.d.ts +4 -4
  23. package/dist/resources/account.d.ts.map +1 -1
  24. package/dist/resources/account.js +10 -5
  25. package/dist/resources/api-keys.d.ts +40 -14
  26. package/dist/resources/api-keys.d.ts.map +1 -1
  27. package/dist/resources/api-keys.js +45 -13
  28. package/dist/resources/definition-revisions.d.ts +35 -18
  29. package/dist/resources/definition-revisions.d.ts.map +1 -1
  30. package/dist/resources/definition-revisions.js +43 -15
  31. package/dist/resources/definitions.d.ts +21 -6
  32. package/dist/resources/definitions.d.ts.map +1 -1
  33. package/dist/resources/definitions.js +16 -3
  34. package/dist/resources/generate.d.ts +44 -15
  35. package/dist/resources/generate.d.ts.map +1 -1
  36. package/dist/resources/generate.js +55 -13
  37. package/dist/resources/generations.d.ts +14 -6
  38. package/dist/resources/generations.d.ts.map +1 -1
  39. package/dist/resources/generations.js +26 -5
  40. package/dist/resources/projects.d.ts +106 -53
  41. package/dist/resources/projects.d.ts.map +1 -1
  42. package/dist/resources/projects.js +78 -31
  43. package/dist/resources/targets.d.ts +240 -40
  44. package/dist/resources/targets.d.ts.map +1 -1
  45. package/dist/resources/targets.js +307 -21
  46. package/dist/schemas.d.ts.map +1 -1
  47. package/dist/schemas.js +130 -78
  48. package/dist/types.d.ts +1969 -154
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/types.js +87 -3
  51. package/package.json +3 -3
  52. package/server.json +3 -3
  53. package/src/core/http.ts +17 -6
  54. package/src/errors.ts +25 -15
  55. package/src/index.ts +9 -5
  56. package/src/mcp-protocol.ts +93 -36
  57. package/src/mcp.ts +32 -15
  58. package/src/ops.ts +49 -35
  59. package/src/resources/account.ts +11 -4
  60. package/src/resources/api-keys.ts +84 -13
  61. package/src/resources/definition-revisions.ts +74 -16
  62. package/src/resources/definitions.ts +28 -4
  63. package/src/resources/generate.ts +78 -13
  64. package/src/resources/generations.ts +31 -4
  65. package/src/resources/projects.ts +141 -39
  66. package/src/resources/targets.ts +561 -27
  67. package/src/schemas.ts +130 -78
  68. package/src/types.ts +2105 -154
@@ -1,5 +1,5 @@
1
1
  // typeship — account resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
 
4
4
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
5
  import {
@@ -8,6 +8,7 @@ import {
8
8
  UnexpectedApiError,
9
9
  ValidationError,
10
10
  ForbiddenError,
11
+ InternalServerError,
11
12
  RateLimitedError,
12
13
  UnauthorizedError,
13
14
  } from "../errors.js";
@@ -18,8 +19,8 @@ export class AccountResource {
18
19
  /**
19
20
  * The account behind the presented credentials
20
21
  *
21
- * Returns the account that owns the presented API key. This is also the
22
- * identity endpoint the generated typeship CLI's `whoami` calls.
22
+ * Returns the account associated with your credential. The Typeship CLI uses this endpoint for
23
+ * `whoami`.
23
24
  * `GET /me`
24
25
  */
25
26
  async retrieve(options?: RequestOptions): Promise<ApiResult<AccountRead, AccountRetrieveError>> {
@@ -27,7 +28,12 @@ export class AccountResource {
27
28
  method: "GET",
28
29
  path: "/me",
29
30
  security: [{"apiKey":[]}],
30
- errors: { "401": UnauthorizedError, "403": ForbiddenError, "429": RateLimitedError },
31
+ errors: {
32
+ "401": UnauthorizedError,
33
+ "403": ForbiddenError,
34
+ "429": RateLimitedError,
35
+ "500": InternalServerError,
36
+ },
31
37
  idempotent: true,
32
38
  schemaKey: "account.retrieve",
33
39
  options,
@@ -40,6 +46,7 @@ export type AccountRetrieveError =
40
46
  | UnauthorizedError
41
47
  | ForbiddenError
42
48
  | RateLimitedError
49
+ | InternalServerError
43
50
  | UnexpectedApiError
44
51
  | ResponseParseError
45
52
  | TransportError
@@ -1,5 +1,5 @@
1
1
  // typeship — apiKeys resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
 
4
4
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
5
  import { paginate, PagePromise } from "../core/pagination.js";
@@ -10,7 +10,9 @@ import {
10
10
  ValidationError,
11
11
  BadRequestError,
12
12
  ForbiddenError,
13
+ InternalServerError,
13
14
  NotFoundError,
15
+ PreconditionFailedError,
14
16
  RateLimitedError,
15
17
  UnauthorizedError,
16
18
  } from "../errors.js";
@@ -28,16 +30,16 @@ export class ApiKeysResource {
28
30
  /**
29
31
  * List API keys
30
32
  *
31
- * Keys are never returned in full — only their identity and last four. Creation stays in the
32
- * console deliberately: a leaked key that can mint more keys is a leaked account.
33
+ * Lists key metadata and the last four characters of each key. Full keys are not returned. Create
34
+ * keys in the Console.
33
35
  *
34
36
  * Auto-paginates: `for await (const item of …)` walks every page.
35
- * `GET /api_keys`
37
+ * `GET /api-keys`
36
38
  */
37
39
  list(params?: ApiKeysListParams, options?: RequestOptions): PagePromise<ApiKeyRead, ApiKeysListError> {
38
40
  return paginate<ApiKeyRead, ApiKeysListError>(this._core, {
39
41
  method: "GET",
40
- path: "/api_keys",
42
+ path: "/api-keys",
41
43
  security: [{"apiKey":[]}],
42
44
  query: {
43
45
  limit: params?.limit,
@@ -48,6 +50,7 @@ export class ApiKeysResource {
48
50
  "401": UnauthorizedError,
49
51
  "403": ForbiddenError,
50
52
  "429": RateLimitedError,
53
+ "500": InternalServerError,
51
54
  },
52
55
  idempotent: true,
53
56
  schemaKey: "apiKeys.list",
@@ -62,28 +65,64 @@ export class ApiKeysResource {
62
65
  });
63
66
  }
64
67
 
68
+ /**
69
+ * Retrieve an API key
70
+ *
71
+ * Returns the key summary and its ETag for conditional revocation.
72
+ * `GET /api-keys/{api_key_id}`
73
+ */
74
+ async retrieve(
75
+ apiKeyId: string,
76
+ options?: RequestOptions,
77
+ ): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRetrieveError>> {
78
+ return this._core.request<ApiKeyResponseRead, ApiKeysRetrieveError>({
79
+ method: "GET",
80
+ path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
81
+ security: [{"apiKey":[]}],
82
+ errors: {
83
+ "401": UnauthorizedError,
84
+ "403": ForbiddenError,
85
+ "404": NotFoundError,
86
+ "429": RateLimitedError,
87
+ "500": InternalServerError,
88
+ },
89
+ idempotent: true,
90
+ schemaKey: "apiKeys.retrieve",
91
+ options,
92
+ });
93
+ }
94
+
65
95
  /**
66
96
  * Revoke an API key
67
97
  *
68
- * Idempotent: revoking an already-revoked key returns the same body, so a rotation script that
69
- * re-runs does not have to special-case having already succeeded. An OAuth member may revoke a
70
- * key they created; an organization admin may revoke any key. Organization API keys retain
71
- * account-wide authority.
72
- * `DELETE /api_keys/{api_key_id}`
98
+ * Revokes a key. Repeating the request returns the same result.
99
+ *
100
+ * With OAuth, members can revoke their own keys; organization admins can revoke any key.
101
+ * Organization API keys can revoke any key in their account.
102
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
103
+ * and If-Match.
104
+ * `DELETE /api-keys/{api_key_id}`
73
105
  */
74
106
  async revoke(
75
107
  apiKeyId: string,
108
+ params?: ApiKeysRevokeParams,
76
109
  options?: RequestOptions,
77
110
  ): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRevokeError>> {
78
111
  return this._core.request<ApiKeyResponseRead, ApiKeysRevokeError>({
79
112
  method: "DELETE",
80
- path: `/api_keys/${encodeURIComponent(String(apiKeyId))}`,
113
+ path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
81
114
  security: [{"apiKey":[]}],
115
+ headers: {
116
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
117
+ },
82
118
  errors: {
119
+ "400": BadRequestError,
83
120
  "401": UnauthorizedError,
84
121
  "403": ForbiddenError,
85
122
  "404": NotFoundError,
123
+ "412": PreconditionFailedError,
86
124
  "429": RateLimitedError,
125
+ "500": InternalServerError,
87
126
  },
88
127
  idempotent: true,
89
128
  schemaKey: "apiKeys.revoke",
@@ -93,11 +132,18 @@ export class ApiKeysResource {
93
132
  }
94
133
 
95
134
  export interface ApiKeysListParams {
96
- /** Maximum number of resources to return. */
135
+ /**
136
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
137
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
138
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
139
+ * return 400.
140
+ */
97
141
  limit?: number;
98
142
  /**
99
143
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
100
- * operation, filters, and ordering that issued it.
144
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
145
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
146
+ * requests.
101
147
  */
102
148
  cursor?: string;
103
149
  }
@@ -108,17 +154,42 @@ export type ApiKeysListError =
108
154
  | UnauthorizedError
109
155
  | ForbiddenError
110
156
  | RateLimitedError
157
+ | InternalServerError
158
+ | UnexpectedApiError
159
+ | ResponseParseError
160
+ | TransportError
161
+ | ValidationError;
162
+
163
+ /** Every error `retrieve` can produce, as a discriminated union. */
164
+ export type ApiKeysRetrieveError =
165
+ | UnauthorizedError
166
+ | ForbiddenError
167
+ | NotFoundError
168
+ | RateLimitedError
169
+ | InternalServerError
111
170
  | UnexpectedApiError
112
171
  | ResponseParseError
113
172
  | TransportError
114
173
  | ValidationError;
115
174
 
175
+ export interface ApiKeysRevokeParams {
176
+ /**
177
+ * ETag from a preceding response. The write applies only if the resource still has that version;
178
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
179
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
180
+ */
181
+ ifMatch?: string;
182
+ }
183
+
116
184
  /** Every error `revoke` can produce, as a discriminated union. */
117
185
  export type ApiKeysRevokeError =
186
+ | BadRequestError
118
187
  | UnauthorizedError
119
188
  | ForbiddenError
120
189
  | NotFoundError
190
+ | PreconditionFailedError
121
191
  | RateLimitedError
192
+ | InternalServerError
122
193
  | UnexpectedApiError
123
194
  | ResponseParseError
124
195
  | TransportError
@@ -1,5 +1,5 @@
1
1
  // typeship — definitionRevisions resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
 
4
4
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
5
  import { paginate, PagePromise } from "../core/pagination.js";
@@ -10,12 +10,15 @@ import {
10
10
  ValidationError,
11
11
  BadRequestError,
12
12
  ForbiddenError,
13
+ InternalServerError,
13
14
  NotFoundError,
14
15
  RateLimitedError,
15
16
  UnauthorizedError,
16
17
  } from "../errors.js";
17
18
  import type {
18
19
  DefinitionDocumentId,
20
+ DefinitionDocumentResponse,
21
+ DefinitionDocumentResponseRead,
19
22
  DefinitionId,
20
23
  DefinitionRevision,
21
24
  DefinitionRevisionId,
@@ -31,9 +34,8 @@ export class DefinitionRevisionsResource {
31
34
  /**
32
35
  * List Definition Revisions
33
36
  *
34
- * Immutable snapshots of the complete resolved document graph this Definition observed, newest
35
- * first. Content is available from the revision and document endpoints and is never embedded in a
36
- * list response.
37
+ * Lists the Definition's revisions, newest first. Source content is not included; retrieve the
38
+ * revision content or individual documents separately.
37
39
  *
38
40
  * Auto-paginates: `for await (const item of …)` walks every page.
39
41
  * `GET /definitions/{definition_id}/revisions`
@@ -57,6 +59,7 @@ export class DefinitionRevisionsResource {
57
59
  "403": ForbiddenError,
58
60
  "404": NotFoundError,
59
61
  "429": RateLimitedError,
62
+ "500": InternalServerError,
60
63
  },
61
64
  idempotent: true,
62
65
  schemaKey: "definitionRevisions.list",
@@ -74,9 +77,9 @@ export class DefinitionRevisionsResource {
74
77
  /**
75
78
  * Retrieve a Definition Revision
76
79
  *
77
- * Metadata for one immutable resolved document graph. Fetch its canonical content or individual
78
- * source documents from the content endpoints.
79
- * `GET /definition_revisions/{definition_revision_id}`
80
+ * Returns metadata for a saved Definition Revision. Retrieve its resolved content or individual
81
+ * source documents separately.
82
+ * `GET /definition-revisions/{definition_revision_id}`
80
83
  */
81
84
  async retrieve(
82
85
  definitionRevisionId: DefinitionRevisionId,
@@ -84,13 +87,14 @@ export class DefinitionRevisionsResource {
84
87
  ): Promise<ApiResult<DefinitionRevisionResponseRead, DefinitionRevisionsRetrieveError>> {
85
88
  return this._core.request<DefinitionRevisionResponseRead, DefinitionRevisionsRetrieveError>({
86
89
  method: "GET",
87
- path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}`,
90
+ path: `/definition-revisions/${encodeURIComponent(String(definitionRevisionId))}`,
88
91
  security: [{"apiKey":[]}],
89
92
  errors: {
90
93
  "401": UnauthorizedError,
91
94
  "403": ForbiddenError,
92
95
  "404": NotFoundError,
93
96
  "429": RateLimitedError,
97
+ "500": InternalServerError,
94
98
  },
95
99
  idempotent: true,
96
100
  schemaKey: "definitionRevisions.retrieve",
@@ -101,9 +105,9 @@ export class DefinitionRevisionsResource {
101
105
  /**
102
106
  * Retrieve a Definition Revision's canonical content
103
107
  *
104
- * Returns the exact canonical resolved content identified by the revision's graph digest,
105
- * suitable for saving or piping into a diff.
106
- * `GET /definition_revisions/{definition_revision_id}/content`
108
+ * Returns the saved, resolved content for this revision. Save it locally or compare it with
109
+ * another revision.
110
+ * `GET /definition-revisions/{definition_revision_id}/content`
107
111
  */
108
112
  async retrieveContent(
109
113
  definitionRevisionId: DefinitionRevisionId,
@@ -111,13 +115,14 @@ export class DefinitionRevisionsResource {
111
115
  ): Promise<ApiResult<string, DefinitionRevisionsRetrieveContentError>> {
112
116
  return this._core.request<string, DefinitionRevisionsRetrieveContentError>({
113
117
  method: "GET",
114
- path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}/content`,
118
+ path: `/definition-revisions/${encodeURIComponent(String(definitionRevisionId))}/content`,
115
119
  security: [{"apiKey":[]}],
116
120
  errors: {
117
121
  "401": UnauthorizedError,
118
122
  "403": ForbiddenError,
119
123
  "404": NotFoundError,
120
124
  "429": RateLimitedError,
125
+ "500": InternalServerError,
121
126
  },
122
127
  idempotent: true,
123
128
  schemaKey: "definitionRevisions.retrieveContent",
@@ -127,7 +132,7 @@ export class DefinitionRevisionsResource {
127
132
 
128
133
  /**
129
134
  * Retrieve one source document from a Definition Revision
130
- * `GET /definition_revisions/{definition_revision_id}/documents/{document_id}/content`
135
+ * `GET /definition-revisions/{definition_revision_id}/documents/{document_id}/content`
131
136
  */
132
137
  async retrieveDocumentContent(
133
138
  definitionRevisionId: DefinitionRevisionId,
@@ -136,27 +141,64 @@ export class DefinitionRevisionsResource {
136
141
  ): Promise<ApiResult<string, DefinitionRevisionsRetrieveDocumentContentError>> {
137
142
  return this._core.request<string, DefinitionRevisionsRetrieveDocumentContentError>({
138
143
  method: "GET",
139
- path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}/documents/${encodeURIComponent(String(documentId))}/content`,
144
+ path: `/definition-revisions/${encodeURIComponent(String(definitionRevisionId))}/documents/${encodeURIComponent(String(documentId))}/content`,
140
145
  security: [{"apiKey":[]}],
141
146
  errors: {
142
147
  "401": UnauthorizedError,
143
148
  "403": ForbiddenError,
144
149
  "404": NotFoundError,
145
150
  "429": RateLimitedError,
151
+ "500": InternalServerError,
146
152
  },
147
153
  idempotent: true,
148
154
  schemaKey: "definitionRevisions.retrieveDocumentContent",
149
155
  options,
150
156
  });
151
157
  }
158
+
159
+ /**
160
+ * Retrieve a Definition Document
161
+ *
162
+ * Returns metadata for one source document captured in a Definition Revision. Retrieve its
163
+ * content through the revision's document content endpoint. A document in another organization
164
+ * returns 404 not_found.
165
+ * `GET /definition-documents/{definition_document_id}`
166
+ */
167
+ async retrieveDocument(
168
+ definitionDocumentId: DefinitionDocumentId,
169
+ options?: RequestOptions,
170
+ ): Promise<ApiResult<DefinitionDocumentResponseRead, DefinitionRevisionsRetrieveDocumentError>> {
171
+ return this._core.request<DefinitionDocumentResponseRead, DefinitionRevisionsRetrieveDocumentError>({
172
+ method: "GET",
173
+ path: `/definition-documents/${encodeURIComponent(String(definitionDocumentId))}`,
174
+ security: [{"apiKey":[]}],
175
+ errors: {
176
+ "401": UnauthorizedError,
177
+ "403": ForbiddenError,
178
+ "404": NotFoundError,
179
+ "429": RateLimitedError,
180
+ "500": InternalServerError,
181
+ },
182
+ idempotent: true,
183
+ schemaKey: "definitionRevisions.retrieveDocument",
184
+ options,
185
+ });
186
+ }
152
187
  }
153
188
 
154
189
  export interface DefinitionRevisionsListParams {
155
- /** Maximum number of resources to return. */
190
+ /**
191
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
192
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
193
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
194
+ * return 400.
195
+ */
156
196
  limit?: number;
157
197
  /**
158
198
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
159
- * operation, filters, and ordering that issued it.
199
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
200
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
201
+ * requests.
160
202
  */
161
203
  cursor?: string;
162
204
  }
@@ -168,6 +210,7 @@ export type DefinitionRevisionsListError =
168
210
  | ForbiddenError
169
211
  | NotFoundError
170
212
  | RateLimitedError
213
+ | InternalServerError
171
214
  | UnexpectedApiError
172
215
  | ResponseParseError
173
216
  | TransportError
@@ -179,6 +222,7 @@ export type DefinitionRevisionsRetrieveError =
179
222
  | ForbiddenError
180
223
  | NotFoundError
181
224
  | RateLimitedError
225
+ | InternalServerError
182
226
  | UnexpectedApiError
183
227
  | ResponseParseError
184
228
  | TransportError
@@ -190,6 +234,7 @@ export type DefinitionRevisionsRetrieveContentError =
190
234
  | ForbiddenError
191
235
  | NotFoundError
192
236
  | RateLimitedError
237
+ | InternalServerError
193
238
  | UnexpectedApiError
194
239
  | ResponseParseError
195
240
  | TransportError
@@ -201,6 +246,19 @@ export type DefinitionRevisionsRetrieveDocumentContentError =
201
246
  | ForbiddenError
202
247
  | NotFoundError
203
248
  | RateLimitedError
249
+ | InternalServerError
250
+ | UnexpectedApiError
251
+ | ResponseParseError
252
+ | TransportError
253
+ | ValidationError;
254
+
255
+ /** Every error `retrieveDocument` can produce, as a discriminated union. */
256
+ export type DefinitionRevisionsRetrieveDocumentError =
257
+ | UnauthorizedError
258
+ | ForbiddenError
259
+ | NotFoundError
260
+ | RateLimitedError
261
+ | InternalServerError
204
262
  | UnexpectedApiError
205
263
  | ResponseParseError
206
264
  | TransportError
@@ -1,5 +1,5 @@
1
1
  // typeship — definitions resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
 
4
4
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
5
  import {
@@ -10,7 +10,9 @@ import {
10
10
  BadRequestError,
11
11
  ConflictError,
12
12
  ForbiddenError,
13
+ InternalServerError,
13
14
  NotFoundError,
15
+ PreconditionFailedError,
14
16
  RateLimitedError,
15
17
  UnauthorizedError,
16
18
  UnprocessableEntityError,
@@ -41,6 +43,7 @@ export class DefinitionsResource {
41
43
  "403": ForbiddenError,
42
44
  "404": NotFoundError,
43
45
  "429": RateLimitedError,
46
+ "500": InternalServerError,
44
47
  },
45
48
  idempotent: true,
46
49
  schemaKey: "definitions.retrieve",
@@ -51,7 +54,16 @@ export class DefinitionsResource {
51
54
  /**
52
55
  * Update and resolve a Definition
53
56
  *
54
- * Resolves the complete document graph and records a new immutable revision before saving.
57
+ * Resolves the source documents before saving the update and records a new Definition Revision
58
+ * when the source changes.
59
+ * Omitted fields remain unchanged; supplied objects and arrays replace the whole field.
60
+ * If the Definition or its Project configuration changes during validation, returns 409
61
+ * definition_changed without saving the rejected update. Retrieve the current Definition and
62
+ * Project, reconcile your changes,
63
+ * and submit a new request with a new Idempotency-Key if using one.
64
+ *
65
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
66
+ * and If-Match.
55
67
  *
56
68
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
57
69
  * `PATCH /definitions/{definition_id}`
@@ -67,6 +79,7 @@ export class DefinitionsResource {
67
79
  path: `/definitions/${encodeURIComponent(String(definitionId))}`,
68
80
  security: [{"apiKey":[]}],
69
81
  headers: {
82
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
70
83
  "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
71
84
  },
72
85
  body,
@@ -76,8 +89,10 @@ export class DefinitionsResource {
76
89
  "403": ForbiddenError,
77
90
  "404": NotFoundError,
78
91
  "409": ConflictError,
92
+ "412": PreconditionFailedError,
79
93
  "422": UnprocessableEntityError,
80
94
  "429": RateLimitedError,
95
+ "500": InternalServerError,
81
96
  },
82
97
  idempotencyKey: "Idempotency-Key",
83
98
  schemaKey: "definitions.update",
@@ -92,17 +107,24 @@ export type DefinitionsRetrieveError =
92
107
  | ForbiddenError
93
108
  | NotFoundError
94
109
  | RateLimitedError
110
+ | InternalServerError
95
111
  | UnexpectedApiError
96
112
  | ResponseParseError
97
113
  | TransportError
98
114
  | ValidationError;
99
115
 
100
116
  export interface DefinitionsUpdateParams {
117
+ /**
118
+ * ETag from a preceding response. The write applies only if the resource still has that version;
119
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
120
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
121
+ */
122
+ ifMatch?: string;
101
123
  /**
102
124
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
103
125
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
104
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
105
- * returns 409. After expiry the key starts a new write.
126
+ * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
127
+ * changed intent returns 409. After expiry the key starts a new write.
106
128
  */
107
129
  idempotencyKey?: string;
108
130
  }
@@ -114,8 +136,10 @@ export type DefinitionsUpdateError =
114
136
  | ForbiddenError
115
137
  | NotFoundError
116
138
  | ConflictError
139
+ | PreconditionFailedError
117
140
  | UnprocessableEntityError
118
141
  | RateLimitedError
142
+ | InternalServerError
119
143
  | UnexpectedApiError
120
144
  | ResponseParseError
121
145
  | TransportError
@@ -1,5 +1,5 @@
1
1
  // typeship — generate resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
 
4
4
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
5
5
  import {
@@ -11,6 +11,8 @@ import {
11
11
  BadRequestError,
12
12
  ConflictError,
13
13
  ForbiddenError,
14
+ InternalServerError,
15
+ NotFoundError,
14
16
  PayloadTooLargeError,
15
17
  RateLimitedError,
16
18
  UnauthorizedError,
@@ -21,17 +23,26 @@ import type { GenerateRequest, GenerationResult, GenerationResultRead } from "..
21
23
  export class GenerateResource {
22
24
  constructor(private readonly _core: HttpCore) {}
23
25
  /**
24
- * Generate one Target from a Definition
26
+ * Generate one package from a Definition
25
27
  *
26
- * Stateless generation: nothing is stored. Returns the full generated
27
- * package as files. Works without an API key: anonymous calls generate
28
- * the first 25 operations, rate limited per IP address, and the
29
- * response's `limits` object says what was held back and where to lift
30
- * it; anonymous calls from a Definition URL also carry `claim.url`, a link
31
- * that turns the run into a project once a person signs in. With a key, the free plan generates
32
- * the first 25 operations and
33
- * paid plans generate the complete Definition. A present but invalid key is a
34
- * 401, not a downgrade to anonymous.
28
+ * Returns one generated package without creating a Project.
29
+ *
30
+ * Supports [idempotent retries](https://typeship.dev/docs/typeship-api/idempotency); keyed
31
+ * responses include generated files in the replay cache.
32
+ *
33
+ * Use `download.url` to save the complete ZIP, verify `download.sha256`, and extract it into an
34
+ * empty directory. The link expires at `download.expires_at` and grants access to anyone who has
35
+ * it. CLI, MCP, and SDK calls supply an idempotency key automatically. Agents should request
36
+ * `fields=["download","meta","warnings","limits","claim"]` to keep the MCP result compact; files
37
+ * can exceed the response limit. Download the ZIP instead of repeating generation to retrieve
38
+ * omitted files.
39
+ *
40
+ * Anonymous and Free requests include the first 25 operations. Paid plans include all operations.
41
+ * Anonymous requests are rate limited by IP address. Check `limits` for omitted operations; an
42
+ * invalid API key returns `401`.
43
+ *
44
+ * An anonymous URL request without source headers may return `claim.url`. Sign in through that
45
+ * link within seven days to save the recipe as a Project.
35
46
  *
36
47
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
37
48
  * `POST /generate`
@@ -57,6 +68,7 @@ export class GenerateResource {
57
68
  "413": PayloadTooLargeError,
58
69
  "422": UnprocessableEntityError,
59
70
  "429": RateLimitedError,
71
+ "500": InternalServerError,
60
72
  default: ApiResponseError,
61
73
  },
62
74
  idempotencyKey: "Idempotency-Key",
@@ -64,14 +76,50 @@ export class GenerateResource {
64
76
  options,
65
77
  });
66
78
  }
79
+
80
+ /**
81
+ * Download a generated package
82
+ *
83
+ * Download the complete ZIP referenced by `generate_run`'s `download.url`. Pass the token from
84
+ * that URL. No API key is needed; the token grants access only to that exact package until its
85
+ * replay window expires. Keep the token private.
86
+ *
87
+ * The local MCP server saves this binary response to disk. On a hosted MCP connection, download
88
+ * the original URL directly to your workspace. Verify the ZIP against `download.sha256` before
89
+ * extracting it into an empty directory. Expired or invalid tokens return `404`; a new generation
90
+ * creates a new download.
91
+ * `GET /generate/download`
92
+ */
93
+ async downloadPackage(
94
+ params: GenerateDownloadPackageParams,
95
+ options?: RequestOptions,
96
+ ): Promise<ApiResult<Blob, GenerateDownloadPackageError>> {
97
+ return this._core.request<Blob, GenerateDownloadPackageError>({
98
+ method: "GET",
99
+ path: "/generate/download",
100
+ security: [{}],
101
+ query: {
102
+ token: params.token,
103
+ },
104
+ errors: {
105
+ "400": BadRequestError,
106
+ "404": NotFoundError,
107
+ "429": RateLimitedError,
108
+ "500": InternalServerError,
109
+ },
110
+ idempotent: true,
111
+ schemaKey: "generate.downloadPackage",
112
+ options,
113
+ });
114
+ }
67
115
  }
68
116
 
69
117
  export interface GenerateRunParams {
70
118
  /**
71
119
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
72
120
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
73
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
74
- * returns 409. After expiry the key starts a new write.
121
+ * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
122
+ * changed intent returns 409. After expiry the key starts a new write.
75
123
  */
76
124
  idempotencyKey?: string;
77
125
  }
@@ -85,8 +133,25 @@ export type GenerateRunError =
85
133
  | PayloadTooLargeError
86
134
  | UnprocessableEntityError
87
135
  | RateLimitedError
136
+ | InternalServerError
88
137
  | ApiResponseError
89
138
  | UnexpectedApiError
90
139
  | ResponseParseError
91
140
  | TransportError
92
141
  | ValidationError;
142
+
143
+ export interface GenerateDownloadPackageParams {
144
+ /** Private download token from download.url in the generation result. */
145
+ token: string;
146
+ }
147
+
148
+ /** Every error `downloadPackage` can produce, as a discriminated union. */
149
+ export type GenerateDownloadPackageError =
150
+ | BadRequestError
151
+ | NotFoundError
152
+ | RateLimitedError
153
+ | InternalServerError
154
+ | UnexpectedApiError
155
+ | ResponseParseError
156
+ | TransportError
157
+ | ValidationError;