@typeship-ax/cli 0.9.1 → 0.20.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 (70) hide show
  1. package/AGENTS.md +9 -4
  2. package/README.md +4 -4
  3. package/api.json +6257 -589
  4. package/api.md +475 -81
  5. package/dist/cli-agent.d.ts +5 -5
  6. package/dist/cli-agent.d.ts.map +1 -1
  7. package/dist/cli-agent.js +14 -10
  8. package/dist/cli.js +151 -75
  9. package/dist/core/http.d.ts +3 -2
  10. package/dist/core/http.d.ts.map +1 -1
  11. package/dist/core/http.js +18 -6
  12. package/dist/errors.d.ts +17 -10
  13. package/dist/errors.d.ts.map +1 -1
  14. package/dist/errors.js +24 -15
  15. package/dist/index.d.ts +7 -3
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +9 -5
  18. package/dist/ops.d.ts +4 -0
  19. package/dist/ops.d.ts.map +1 -1
  20. package/dist/ops.js +45 -31
  21. package/dist/polling-login.d.ts.map +1 -1
  22. package/dist/polling-login.js +11 -1
  23. package/dist/resources/account.d.ts +4 -4
  24. package/dist/resources/account.d.ts.map +1 -1
  25. package/dist/resources/account.js +10 -5
  26. package/dist/resources/api-keys.d.ts +40 -14
  27. package/dist/resources/api-keys.d.ts.map +1 -1
  28. package/dist/resources/api-keys.js +45 -13
  29. package/dist/resources/definition-revisions.d.ts +35 -18
  30. package/dist/resources/definition-revisions.d.ts.map +1 -1
  31. package/dist/resources/definition-revisions.js +43 -15
  32. package/dist/resources/definitions.d.ts +21 -6
  33. package/dist/resources/definitions.d.ts.map +1 -1
  34. package/dist/resources/definitions.js +16 -3
  35. package/dist/resources/generate.d.ts +44 -15
  36. package/dist/resources/generate.d.ts.map +1 -1
  37. package/dist/resources/generate.js +55 -13
  38. package/dist/resources/generations.d.ts +14 -6
  39. package/dist/resources/generations.d.ts.map +1 -1
  40. package/dist/resources/generations.js +26 -5
  41. package/dist/resources/projects.d.ts +106 -53
  42. package/dist/resources/projects.d.ts.map +1 -1
  43. package/dist/resources/projects.js +78 -31
  44. package/dist/resources/targets.d.ts +285 -22
  45. package/dist/resources/targets.d.ts.map +1 -1
  46. package/dist/resources/targets.js +408 -10
  47. package/dist/schemas.d.ts +1 -0
  48. package/dist/schemas.d.ts.map +1 -1
  49. package/dist/schemas.js +175 -102
  50. package/dist/types.d.ts +2162 -134
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/types.js +99 -2
  53. package/package.json +3 -3
  54. package/src/cli-agent.ts +17 -13
  55. package/src/cli.ts +138 -70
  56. package/src/core/http.ts +17 -6
  57. package/src/errors.ts +25 -15
  58. package/src/index.ts +9 -5
  59. package/src/ops.ts +49 -31
  60. package/src/polling-login.ts +10 -1
  61. package/src/resources/account.ts +11 -4
  62. package/src/resources/api-keys.ts +84 -13
  63. package/src/resources/definition-revisions.ts +74 -16
  64. package/src/resources/definitions.ts +28 -4
  65. package/src/resources/generate.ts +78 -13
  66. package/src/resources/generations.ts +31 -4
  67. package/src/resources/projects.ts +141 -39
  68. package/src/resources/targets.ts +756 -13
  69. package/src/schemas.ts +176 -103
  70. package/src/types.ts +2372 -189
@@ -149,7 +149,16 @@ export async function customBrowserApproval(config: { authUrl: string; name: str
149
149
  await pause(Math.min(intervalMs, Math.max(0, deadline - Date.now())), flow.signal);
150
150
  flow.check();
151
151
  if (Date.now() >= deadline) throw new LoginPollingError("expired");
152
- const result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, deadline - Date.now()));
152
+ let result: Awaited<ReturnType<typeof oauthJsonRequest>>;
153
+ try {
154
+ result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, deadline - Date.now()));
155
+ } catch (error) {
156
+ flow.check();
157
+ if (error instanceof OAuthResponseError && error.code === "timed_out" && Date.now() >= deadline) {
158
+ throw new LoginPollingError("expired");
159
+ }
160
+ throw error;
161
+ }
153
162
  flow.check();
154
163
  if (Date.now() >= deadline) throw new LoginPollingError("expired");
155
164
  if (result.status !== 200) throw new LoginPollingError("request_failed");
@@ -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