@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 — targets 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";
@@ -12,7 +12,10 @@ import {
12
12
  BadRequestError,
13
13
  ConflictError,
14
14
  ForbiddenError,
15
+ InternalServerError,
15
16
  NotFoundError,
17
+ PaymentRequiredError,
18
+ PreconditionFailedError,
16
19
  RateLimitedError,
17
20
  UnauthorizedError,
18
21
  UnprocessableEntityError,
@@ -20,7 +23,29 @@ import {
20
23
  import type {
21
24
  DeletedTarget,
22
25
  DeletedTargetRead,
26
+ DeliveryId,
27
+ DeliveryResponse,
28
+ DeliveryResponseRead,
29
+ DiscardDraftCustomizations,
30
+ DraftConflictResolutionResponse,
31
+ DraftConflictResolutionResponseRead,
32
+ DraftCustomizationDiscardResponse,
33
+ DraftCustomizationDiscardResponseRead,
34
+ DraftFile,
35
+ DraftFileContentResponse,
36
+ DraftFileContentResponseRead,
37
+ DraftFileList,
38
+ DraftFileListRead,
39
+ DraftFileRead,
40
+ DraftFileSide,
41
+ DraftHistoryRecoveryResponse,
42
+ DraftHistoryRecoveryResponseRead,
23
43
  ProjectId,
44
+ PublicationId,
45
+ PublicationResponse,
46
+ PublicationResponseRead,
47
+ RecoverDraftHistory,
48
+ ResolveDraftConflicts,
24
49
  Target,
25
50
  TargetAdoption,
26
51
  TargetDraftResponse,
@@ -70,6 +95,7 @@ export class TargetsResource {
70
95
  "403": ForbiddenError,
71
96
  "404": NotFoundError,
72
97
  "429": RateLimitedError,
98
+ "500": InternalServerError,
73
99
  },
74
100
  idempotent: true,
75
101
  schemaKey: "targets.list",
@@ -87,8 +113,8 @@ export class TargetsResource {
87
113
  /**
88
114
  * Create an independently configured Target
89
115
  *
90
- * Several Targets may use the same generator with distinct configuration, Deliveries, and release
91
- * streams.
116
+ * Creates a Target with its own configuration, Deliveries, and release history. Multiple Targets
117
+ * can use the same generator.
92
118
  *
93
119
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
94
120
  * `POST /projects/{project_id}/targets`
@@ -110,11 +136,13 @@ export class TargetsResource {
110
136
  errors: {
111
137
  "400": BadRequestError,
112
138
  "401": UnauthorizedError,
139
+ "402": PaymentRequiredError,
113
140
  "403": ForbiddenError,
114
141
  "404": NotFoundError,
115
142
  "409": ConflictError,
116
143
  "422": UnprocessableEntityError,
117
144
  "429": RateLimitedError,
145
+ "500": InternalServerError,
118
146
  },
119
147
  idempotencyKey: "Idempotency-Key",
120
148
  schemaKey: "targets.create",
@@ -139,6 +167,7 @@ export class TargetsResource {
139
167
  "403": ForbiddenError,
140
168
  "404": NotFoundError,
141
169
  "429": RateLimitedError,
170
+ "500": InternalServerError,
142
171
  },
143
172
  idempotent: true,
144
173
  schemaKey: "targets.retrieve",
@@ -149,24 +178,35 @@ export class TargetsResource {
149
178
  /**
150
179
  * Delete an unused Target
151
180
  *
152
- * Targets with Generation or release history, or an active release candidate, must be disabled
153
- * instead.
181
+ * Deletes a Target with no Generation history, release history, or active Draft. A `409
182
+ * resource_has_dependencies` means one of those resources still depends on it. Retrieve the
183
+ * Target, disable it instead, or resolve the dependency before retrying.
184
+ *
185
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
186
+ * and If-Match.
154
187
  * `DELETE /targets/{target_id}`
155
188
  */
156
189
  async delete(
157
190
  targetId: TargetId,
191
+ params?: TargetsDeleteParams,
158
192
  options?: RequestOptions,
159
193
  ): Promise<ApiResult<DeletedTargetRead, TargetsDeleteError>> {
160
194
  return this._core.request<DeletedTargetRead, TargetsDeleteError>({
161
195
  method: "DELETE",
162
196
  path: `/targets/${encodeURIComponent(String(targetId))}`,
163
197
  security: [{"apiKey":[]}],
198
+ headers: {
199
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
200
+ },
164
201
  errors: {
202
+ "400": BadRequestError,
165
203
  "401": UnauthorizedError,
166
204
  "403": ForbiddenError,
167
205
  "404": NotFoundError,
168
206
  "409": ConflictError,
207
+ "412": PreconditionFailedError,
169
208
  "429": RateLimitedError,
209
+ "500": InternalServerError,
170
210
  },
171
211
  idempotent: true,
172
212
  schemaKey: "targets.delete",
@@ -176,26 +216,50 @@ export class TargetsResource {
176
216
 
177
217
  /**
178
218
  * Update a Target, its Deliveries, or its next reviewed version
219
+ *
220
+ * Omitted fields keep their current values. Supplied config, checks, and deliveries replace their
221
+ * complete stored values.
222
+ * Omitting If-Match applies the update to the current resource; with If-Match, a stale ETag
223
+ * returns 412 precondition_failed without saving.
224
+ * Send proposed_version by itself; use the Draft endpoint to select a version directly.
225
+ *
226
+ * A `409 target_busy` means the Target is publishing; wait for it to finish. A `409
227
+ * delivery_conflict` means another Target owns the requested repository tree; retrieve both
228
+ * Targets, choose a free destination, and retry.
229
+ * A `502` response means the update was saved, but retiring an obsolete review or regenerating a
230
+ * version selection failed. Retrieve the Target and follow the error's retryable and
231
+ * suggested_action fields. Repeating an unfinished version selection resumes generation;
232
+ * repeating a completed selection starts no new work.
233
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
234
+ * and If-Match.
179
235
  * `PATCH /targets/{target_id}`
180
236
  */
181
237
  async update(
182
238
  targetId: TargetId,
183
239
  body: TargetUpdateRequest,
240
+ params?: TargetsUpdateParams,
184
241
  options?: RequestOptions,
185
242
  ): Promise<ApiResult<TargetResponseRead, TargetsUpdateError>> {
186
243
  return this._core.request<TargetResponseRead, TargetsUpdateError>({
187
244
  method: "PATCH",
188
245
  path: `/targets/${encodeURIComponent(String(targetId))}`,
189
246
  security: [{"apiKey":[]}],
247
+ headers: {
248
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
249
+ },
190
250
  body,
191
251
  errors: {
192
252
  "400": BadRequestError,
193
253
  "401": UnauthorizedError,
254
+ "402": PaymentRequiredError,
194
255
  "403": ForbiddenError,
195
256
  "404": NotFoundError,
196
257
  "409": ConflictError,
258
+ "412": PreconditionFailedError,
197
259
  "422": UnprocessableEntityError,
198
260
  "429": RateLimitedError,
261
+ "500": InternalServerError,
262
+ "502": BadGatewayError,
199
263
  },
200
264
  schemaKey: "targets.update",
201
265
  options,
@@ -227,6 +291,7 @@ export class TargetsResource {
227
291
  "403": ForbiddenError,
228
292
  "404": NotFoundError,
229
293
  "429": RateLimitedError,
294
+ "500": InternalServerError,
230
295
  },
231
296
  idempotent: true,
232
297
  schemaKey: "targets.listReleases",
@@ -244,8 +309,10 @@ export class TargetsResource {
244
309
  /**
245
310
  * Retrieve a Target's rolling Draft release
246
311
  *
247
- * Returns Current, the cumulative Draft version and readiness, its exact head, and the optimistic
248
- * release revision.
312
+ * Returns the Draft's status and its one next step, Current's version, the proposed version,
313
+ * readiness, checks, and conflict counts. Every status is described on `status`. The response
314
+ * carries an `ETag`; send it in `If-Match` when updating the Draft to avoid changing a newer
315
+ * version selection.
249
316
  * `GET /targets/{target_id}/draft`
250
317
  */
251
318
  async retrieveDraft(
@@ -261,6 +328,7 @@ export class TargetsResource {
261
328
  "403": ForbiddenError,
262
329
  "404": NotFoundError,
263
330
  "429": RateLimitedError,
331
+ "500": InternalServerError,
264
332
  },
265
333
  idempotent: true,
266
334
  schemaKey: "targets.retrieveDraft",
@@ -271,19 +339,37 @@ export class TargetsResource {
271
339
  /**
272
340
  * Select an exact Draft version or return to automatic versioning
273
341
  *
274
- * Validates the selection against the cumulative required bump and regenerates the same rolling
342
+ * Checks your version choice against the required version bump, then regenerates the existing
275
343
  * Draft pull request.
344
+ *
345
+ * Send the Draft's `ETag` in `If-Match` to reject an intervening change with 412
346
+ * precondition_failed before saving or regenerating. Omitting `If-Match` applies the selection to
347
+ * the current Draft. Version is required; null restores automatic selection.
348
+ *
349
+ * A `502` response means the selected version was saved, but regeneration failed. Follow the
350
+ * error's retryable and suggested_action fields. Repeating an unfinished selection resumes
351
+ * generation; repeating a completed selection starts no new work. If using If-Match, retrieve the
352
+ * Draft and confirm the saved selection before retrying with its current ETag.
353
+ * A `409 target_busy` means the Target is publishing; wait and retry. A `409 version_occupied`
354
+ * means the version is already released; retrieve the Draft and releases, choose a new version,
355
+ * and retry.
356
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
357
+ * and If-Match.
276
358
  * `PATCH /targets/{target_id}/draft`
277
359
  */
278
360
  async updateDraft(
279
361
  targetId: TargetId,
280
362
  body: TargetDraftUpdate,
363
+ params?: TargetsUpdateDraftParams,
281
364
  options?: RequestOptions,
282
365
  ): Promise<ApiResult<TargetDraftResponseRead, TargetsUpdateDraftError>> {
283
366
  return this._core.request<TargetDraftResponseRead, TargetsUpdateDraftError>({
284
367
  method: "PATCH",
285
368
  path: `/targets/${encodeURIComponent(String(targetId))}/draft`,
286
369
  security: [{"apiKey":[]}],
370
+ headers: {
371
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
372
+ },
287
373
  body,
288
374
  errors: {
289
375
  "400": BadRequestError,
@@ -291,8 +377,11 @@ export class TargetsResource {
291
377
  "403": ForbiddenError,
292
378
  "404": NotFoundError,
293
379
  "409": ConflictError,
380
+ "412": PreconditionFailedError,
294
381
  "422": UnprocessableEntityError,
295
382
  "429": RateLimitedError,
383
+ "500": InternalServerError,
384
+ "502": BadGatewayError,
296
385
  },
297
386
  schemaKey: "targets.updateDraft",
298
387
  options,
@@ -302,9 +391,9 @@ export class TargetsResource {
302
391
  /**
303
392
  * Adopt a verified existing package as Current
304
393
  *
305
- * Verifies the repository tag, package metadata, and registry artifact; records an Imported
306
- * Current release; then opens the first Typeship Draft at the next major version because no
307
- * trusted generated baseline exists yet.
394
+ * Checks the repository tag, package metadata, and registry artifact, then records the package as
395
+ * an Imported Current release. Opens the first Typeship Draft at the next major version; review
396
+ * it to establish the baseline for preserving existing code.
308
397
  *
309
398
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
310
399
  * `POST /targets/{target_id}/adopt`
@@ -331,6 +420,7 @@ export class TargetsResource {
331
420
  "409": ConflictError,
332
421
  "422": UnprocessableEntityError,
333
422
  "429": RateLimitedError,
423
+ "500": InternalServerError,
334
424
  },
335
425
  idempotencyKey: "Idempotency-Key",
336
426
  schemaKey: "targets.adoptRelease",
@@ -340,7 +430,7 @@ export class TargetsResource {
340
430
 
341
431
  /**
342
432
  * Retrieve an immutable Target release
343
- * `GET /target_releases/{target_release_id}`
433
+ * `GET /target-releases/{target_release_id}`
344
434
  */
345
435
  async retrieveRelease(
346
436
  targetReleaseId: TargetReleaseId,
@@ -348,13 +438,14 @@ export class TargetsResource {
348
438
  ): Promise<ApiResult<TargetReleaseResponseRead, TargetsRetrieveReleaseError>> {
349
439
  return this._core.request<TargetReleaseResponseRead, TargetsRetrieveReleaseError>({
350
440
  method: "GET",
351
- path: `/target_releases/${encodeURIComponent(String(targetReleaseId))}`,
441
+ path: `/target-releases/${encodeURIComponent(String(targetReleaseId))}`,
352
442
  security: [{"apiKey":[]}],
353
443
  errors: {
354
444
  "401": UnauthorizedError,
355
445
  "403": ForbiddenError,
356
446
  "404": NotFoundError,
357
447
  "429": RateLimitedError,
448
+ "500": InternalServerError,
358
449
  },
359
450
  idempotent: true,
360
451
  schemaKey: "targets.retrieveRelease",
@@ -365,11 +456,13 @@ export class TargetsResource {
365
456
  /**
366
457
  * Retry publication of an exact Target release
367
458
  *
368
- * Dispatches the repository-owned republish workflow for this immutable version and accepted
369
- * commit. It never selects the latest Draft or release.
459
+ * Retries publication of the specified release through its repository workflow. Uses that
460
+ * release's version and accepted commit, even if a newer Draft or release exists.
461
+ *
462
+ * A `502` response means the repository publication workflow could not be dispatched.
370
463
  *
371
464
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
372
- * `POST /target_releases/{target_release_id}/republish`
465
+ * `POST /target-releases/{target_release_id}/republish`
373
466
  */
374
467
  async republishRelease(
375
468
  targetReleaseId: TargetReleaseId,
@@ -378,17 +471,19 @@ export class TargetsResource {
378
471
  ): Promise<ApiResult<TargetReleaseResponseRead, TargetsRepublishReleaseError>> {
379
472
  return this._core.request<TargetReleaseResponseRead, TargetsRepublishReleaseError>({
380
473
  method: "POST",
381
- path: `/target_releases/${encodeURIComponent(String(targetReleaseId))}/republish`,
474
+ path: `/target-releases/${encodeURIComponent(String(targetReleaseId))}/republish`,
382
475
  security: [{"apiKey":[]}],
383
476
  headers: {
384
477
  "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
385
478
  },
386
479
  errors: {
480
+ "400": BadRequestError,
387
481
  "401": UnauthorizedError,
388
482
  "403": ForbiddenError,
389
483
  "404": NotFoundError,
390
484
  "409": ConflictError,
391
485
  "429": RateLimitedError,
486
+ "500": InternalServerError,
392
487
  "502": BadGatewayError,
393
488
  },
394
489
  idempotencyKey: "Idempotency-Key",
@@ -396,14 +491,273 @@ export class TargetsResource {
396
491
  options,
397
492
  });
398
493
  }
494
+
495
+ /**
496
+ * List customized and conflicted files on a Draft
497
+ *
498
+ * Lists the Draft's files that differ from the last accepted package or need a conflict decision,
499
+ * ordered by path, without file content. Each conflict names its kind, where the incoming version
500
+ * comes from, the saved decision, and the sides you can read with retrieveDraftFileContent. With
501
+ * `filter=history`, lists the files affected by a default-branch history rewrite instead; the
502
+ * list is empty when none is pending.
503
+ *
504
+ * Returns `409 stale_draft` while Typeship has not integrated the Draft's latest commit (Draft
505
+ * status generating or branch_changed), or when the Draft changes between pages.
506
+ *
507
+ * Auto-paginates: `for await (const item of …)` walks every page.
508
+ * `GET /targets/{target_id}/draft/files`
509
+ */
510
+ listDraftFiles(
511
+ targetId: TargetId,
512
+ params?: TargetsListDraftFilesParams,
513
+ options?: RequestOptions,
514
+ ): PagePromise<DraftFileRead, TargetsListDraftFilesError> {
515
+ return paginate<DraftFileRead, TargetsListDraftFilesError>(this._core, {
516
+ method: "GET",
517
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft/files`,
518
+ security: [{"apiKey":[]}],
519
+ query: {
520
+ filter: params?.filter,
521
+ limit: params?.limit,
522
+ cursor: params?.cursor,
523
+ },
524
+ errors: {
525
+ "400": BadRequestError,
526
+ "401": UnauthorizedError,
527
+ "403": ForbiddenError,
528
+ "404": NotFoundError,
529
+ "409": ConflictError,
530
+ "429": RateLimitedError,
531
+ "500": InternalServerError,
532
+ },
533
+ idempotent: true,
534
+ schemaKey: "targets.listDraftFiles",
535
+ options,
536
+ }, {
537
+ style: "cursor",
538
+ itemsField: "data",
539
+ cursorParam: "cursor",
540
+ nextCursorField: "next_cursor",
541
+ hasMoreField: "has_more",
542
+ limitParam: "limit",
543
+ });
544
+ }
545
+
546
+ /**
547
+ * Read one side of a Draft file
548
+ *
549
+ * Returns up to 24 KiB of one side of a conflicted or history-affected file: text as UTF-8,
550
+ * binary content as base64. Follow `next_cursor` with the same path and side to read the rest,
551
+ * and concatenate the chunks in order. A side where the file is absent returns 404.
552
+ * `GET /targets/{target_id}/draft/files/content`
553
+ */
554
+ async retrieveDraftFileContent(
555
+ targetId: TargetId,
556
+ params: TargetsRetrieveDraftFileContentParams,
557
+ options?: RequestOptions,
558
+ ): Promise<ApiResult<DraftFileContentResponseRead, TargetsRetrieveDraftFileContentError>> {
559
+ return this._core.request<DraftFileContentResponseRead, TargetsRetrieveDraftFileContentError>({
560
+ method: "GET",
561
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft/files/content`,
562
+ security: [{"apiKey":[]}],
563
+ query: {
564
+ path: params.path,
565
+ side: params.side,
566
+ cursor: params.cursor,
567
+ },
568
+ errors: {
569
+ "400": BadRequestError,
570
+ "401": UnauthorizedError,
571
+ "403": ForbiddenError,
572
+ "404": NotFoundError,
573
+ "409": ConflictError,
574
+ "429": RateLimitedError,
575
+ "500": InternalServerError,
576
+ },
577
+ idempotent: true,
578
+ schemaKey: "targets.retrieveDraftFileContent",
579
+ options,
580
+ });
581
+ }
582
+
583
+ /**
584
+ * Resolve selected Draft conflicts
585
+ *
586
+ * Saves decisions for conflicts on the Draft's head_revision: keep the repository or incoming
587
+ * version, or supply the final content as text or, for binary files, base64. Decisions save
588
+ * together or not at all, and a decision can be replaced until it is applied. Use `dry_run` to
589
+ * validate them first.
590
+ *
591
+ * Saving changes no files. When every conflict has a decision, `remaining_conflicts` is 0 and the
592
+ * Draft status becomes `needs_generation`: generate the Target to apply the decisions and run its
593
+ * checks. Applying them can report conflicts from the next merge stage.
594
+ * `POST /targets/{target_id}/draft/conflicts/resolve`
595
+ */
596
+ async resolveDraftConflicts(
597
+ targetId: TargetId,
598
+ body: ResolveDraftConflicts,
599
+ options?: RequestOptions,
600
+ ): Promise<ApiResult<DraftConflictResolutionResponseRead, TargetsResolveDraftConflictsError>> {
601
+ return this._core.request<DraftConflictResolutionResponseRead, TargetsResolveDraftConflictsError>({
602
+ method: "POST",
603
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft/conflicts/resolve`,
604
+ security: [{"apiKey":[]}],
605
+ body,
606
+ errors: {
607
+ "400": BadRequestError,
608
+ "401": UnauthorizedError,
609
+ "403": ForbiddenError,
610
+ "404": NotFoundError,
611
+ "409": ConflictError,
612
+ "429": RateLimitedError,
613
+ "500": InternalServerError,
614
+ },
615
+ schemaKey: "targets.resolveDraftConflicts",
616
+ options,
617
+ });
618
+ }
619
+
620
+ /**
621
+ * Discard selected Draft customizations
622
+ *
623
+ * Replaces the listed customized paths that are not conflicts with the generated files, in one
624
+ * commit on the Draft branch. A listed file that exists only on the Draft is deleted. Use
625
+ * `dry_run` to see the planned writes and deletions first. Resolve conflicts with
626
+ * resolveDraftConflicts.
627
+ *
628
+ * After the commit, the Draft status is `branch_changed` until Typeship integrates it from the
629
+ * repository's pull request event and reruns the checks; you do not need to generate the Target.
630
+ * `POST /targets/{target_id}/draft/customizations/discard`
631
+ */
632
+ async discardDraftCustomizations(
633
+ targetId: TargetId,
634
+ body: DiscardDraftCustomizations,
635
+ options?: RequestOptions,
636
+ ): Promise<ApiResult<DraftCustomizationDiscardResponseRead, TargetsDiscardDraftCustomizationsError>> {
637
+ return this._core.request<DraftCustomizationDiscardResponseRead, TargetsDiscardDraftCustomizationsError>({
638
+ method: "POST",
639
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft/customizations/discard`,
640
+ security: [{"apiKey":[]}],
641
+ body,
642
+ errors: {
643
+ "400": BadRequestError,
644
+ "401": UnauthorizedError,
645
+ "403": ForbiddenError,
646
+ "404": NotFoundError,
647
+ "409": ConflictError,
648
+ "429": RateLimitedError,
649
+ "500": InternalServerError,
650
+ },
651
+ schemaKey: "targets.discardDraftCustomizations",
652
+ options,
653
+ });
654
+ }
655
+
656
+ /**
657
+ * Approve recovery from rewritten default-branch history
658
+ *
659
+ * When the Draft status is `history_rewritten`, review the affected files with `listDraftFiles`
660
+ * and `filter=history`, then approve with the Draft's `history_recovery` revisions. Approval
661
+ * saves the recovery without changing Git, and the Draft status becomes `needs_generation`:
662
+ * generate the Target to open a new Draft from the rewritten default branch. The previous Draft
663
+ * branch stays available, and overlapping code comes back as conflicts to resolve. A rewritten
664
+ * Draft branch alone needs no approval.
665
+ * `POST /targets/{target_id}/draft/history/recover`
666
+ */
667
+ async recoverDraftHistory(
668
+ targetId: TargetId,
669
+ body: RecoverDraftHistory,
670
+ options?: RequestOptions,
671
+ ): Promise<ApiResult<DraftHistoryRecoveryResponseRead, TargetsRecoverDraftHistoryError>> {
672
+ return this._core.request<DraftHistoryRecoveryResponseRead, TargetsRecoverDraftHistoryError>({
673
+ method: "POST",
674
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft/history/recover`,
675
+ security: [{"apiKey":[]}],
676
+ body,
677
+ errors: {
678
+ "400": BadRequestError,
679
+ "401": UnauthorizedError,
680
+ "403": ForbiddenError,
681
+ "404": NotFoundError,
682
+ "409": ConflictError,
683
+ "429": RateLimitedError,
684
+ "500": InternalServerError,
685
+ },
686
+ schemaKey: "targets.recoverDraftHistory",
687
+ options,
688
+ });
689
+ }
690
+
691
+ /**
692
+ * Retrieve a Delivery
693
+ *
694
+ * Returns the configured repository or hosted MCP Delivery for a Target. A Delivery in another
695
+ * organization returns 404 not_found.
696
+ * `GET /deliveries/{delivery_id}`
697
+ */
698
+ async retrieveDelivery(
699
+ deliveryId: DeliveryId,
700
+ options?: RequestOptions,
701
+ ): Promise<ApiResult<DeliveryResponseRead, TargetsRetrieveDeliveryError>> {
702
+ return this._core.request<DeliveryResponseRead, TargetsRetrieveDeliveryError>({
703
+ method: "GET",
704
+ path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
705
+ security: [{"apiKey":[]}],
706
+ errors: {
707
+ "401": UnauthorizedError,
708
+ "403": ForbiddenError,
709
+ "404": NotFoundError,
710
+ "429": RateLimitedError,
711
+ "500": InternalServerError,
712
+ },
713
+ idempotent: true,
714
+ schemaKey: "targets.retrieveDelivery",
715
+ options,
716
+ });
717
+ }
718
+
719
+ /**
720
+ * Retrieve a Publication
721
+ *
722
+ * Returns the current registry publication state for a Target Release. A Publication in another
723
+ * organization returns 404 not_found.
724
+ * `GET /publications/{publication_id}`
725
+ */
726
+ async retrievePublication(
727
+ publicationId: PublicationId,
728
+ options?: RequestOptions,
729
+ ): Promise<ApiResult<PublicationResponseRead, TargetsRetrievePublicationError>> {
730
+ return this._core.request<PublicationResponseRead, TargetsRetrievePublicationError>({
731
+ method: "GET",
732
+ path: `/publications/${encodeURIComponent(String(publicationId))}`,
733
+ security: [{"apiKey":[]}],
734
+ errors: {
735
+ "401": UnauthorizedError,
736
+ "403": ForbiddenError,
737
+ "404": NotFoundError,
738
+ "429": RateLimitedError,
739
+ "500": InternalServerError,
740
+ },
741
+ idempotent: true,
742
+ schemaKey: "targets.retrievePublication",
743
+ options,
744
+ });
745
+ }
399
746
  }
400
747
 
401
748
  export interface TargetsListParams {
402
- /** Maximum number of resources to return. */
749
+ /**
750
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
751
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
752
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
753
+ * return 400.
754
+ */
403
755
  limit?: number;
404
756
  /**
405
757
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
406
- * operation, filters, and ordering that issued it.
758
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
759
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
760
+ * requests.
407
761
  */
408
762
  cursor?: string;
409
763
  }
@@ -415,6 +769,7 @@ export type TargetsListError =
415
769
  | ForbiddenError
416
770
  | NotFoundError
417
771
  | RateLimitedError
772
+ | InternalServerError
418
773
  | UnexpectedApiError
419
774
  | ResponseParseError
420
775
  | TransportError
@@ -424,8 +779,8 @@ export interface TargetsCreateParams {
424
779
  /**
425
780
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
426
781
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
427
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
428
- * returns 409. After expiry the key starts a new write.
782
+ * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
783
+ * changed intent returns 409. After expiry the key starts a new write.
429
784
  */
430
785
  idempotencyKey?: string;
431
786
  }
@@ -434,11 +789,13 @@ export interface TargetsCreateParams {
434
789
  export type TargetsCreateError =
435
790
  | BadRequestError
436
791
  | UnauthorizedError
792
+ | PaymentRequiredError
437
793
  | ForbiddenError
438
794
  | NotFoundError
439
795
  | ConflictError
440
796
  | UnprocessableEntityError
441
797
  | RateLimitedError
798
+ | InternalServerError
442
799
  | UnexpectedApiError
443
800
  | ResponseParseError
444
801
  | TransportError
@@ -450,43 +807,76 @@ export type TargetsRetrieveError =
450
807
  | ForbiddenError
451
808
  | NotFoundError
452
809
  | RateLimitedError
810
+ | InternalServerError
453
811
  | UnexpectedApiError
454
812
  | ResponseParseError
455
813
  | TransportError
456
814
  | ValidationError;
457
815
 
816
+ export interface TargetsDeleteParams {
817
+ /**
818
+ * ETag from a preceding response. The write applies only if the resource still has that version;
819
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
820
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
821
+ */
822
+ ifMatch?: string;
823
+ }
824
+
458
825
  /** Every error `delete` can produce, as a discriminated union. */
459
826
  export type TargetsDeleteError =
827
+ | BadRequestError
460
828
  | UnauthorizedError
461
829
  | ForbiddenError
462
830
  | NotFoundError
463
831
  | ConflictError
832
+ | PreconditionFailedError
464
833
  | RateLimitedError
834
+ | InternalServerError
465
835
  | UnexpectedApiError
466
836
  | ResponseParseError
467
837
  | TransportError
468
838
  | ValidationError;
469
839
 
840
+ export interface TargetsUpdateParams {
841
+ /**
842
+ * ETag from a preceding response. The write applies only if the resource still has that version;
843
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
844
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
845
+ */
846
+ ifMatch?: string;
847
+ }
848
+
470
849
  /** Every error `update` can produce, as a discriminated union. */
471
850
  export type TargetsUpdateError =
472
851
  | BadRequestError
473
852
  | UnauthorizedError
853
+ | PaymentRequiredError
474
854
  | ForbiddenError
475
855
  | NotFoundError
476
856
  | ConflictError
857
+ | PreconditionFailedError
477
858
  | UnprocessableEntityError
478
859
  | RateLimitedError
860
+ | InternalServerError
861
+ | BadGatewayError
479
862
  | UnexpectedApiError
480
863
  | ResponseParseError
481
864
  | TransportError
482
865
  | ValidationError;
483
866
 
484
867
  export interface TargetsListReleasesParams {
485
- /** Maximum number of resources to return. */
868
+ /**
869
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
870
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
871
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
872
+ * return 400.
873
+ */
486
874
  limit?: number;
487
875
  /**
488
876
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
489
- * operation, filters, and ordering that issued it.
877
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
878
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
879
+ * requests.
490
880
  */
491
881
  cursor?: string;
492
882
  }
@@ -498,6 +888,7 @@ export type TargetsListReleasesError =
498
888
  | ForbiddenError
499
889
  | NotFoundError
500
890
  | RateLimitedError
891
+ | InternalServerError
501
892
  | UnexpectedApiError
502
893
  | ResponseParseError
503
894
  | TransportError
@@ -509,11 +900,21 @@ export type TargetsRetrieveDraftError =
509
900
  | ForbiddenError
510
901
  | NotFoundError
511
902
  | RateLimitedError
903
+ | InternalServerError
512
904
  | UnexpectedApiError
513
905
  | ResponseParseError
514
906
  | TransportError
515
907
  | ValidationError;
516
908
 
909
+ export interface TargetsUpdateDraftParams {
910
+ /**
911
+ * ETag from a preceding response. The write applies only if the resource still has that version;
912
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
913
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
914
+ */
915
+ ifMatch?: string;
916
+ }
917
+
517
918
  /** Every error `updateDraft` can produce, as a discriminated union. */
518
919
  export type TargetsUpdateDraftError =
519
920
  | BadRequestError
@@ -521,8 +922,11 @@ export type TargetsUpdateDraftError =
521
922
  | ForbiddenError
522
923
  | NotFoundError
523
924
  | ConflictError
925
+ | PreconditionFailedError
524
926
  | UnprocessableEntityError
525
927
  | RateLimitedError
928
+ | InternalServerError
929
+ | BadGatewayError
526
930
  | UnexpectedApiError
527
931
  | ResponseParseError
528
932
  | TransportError
@@ -532,8 +936,8 @@ export interface TargetsAdoptReleaseParams {
532
936
  /**
533
937
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
534
938
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
535
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
536
- * returns 409. After expiry the key starts a new write.
939
+ * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
940
+ * changed intent returns 409. After expiry the key starts a new write.
537
941
  */
538
942
  idempotencyKey?: string;
539
943
  }
@@ -547,6 +951,7 @@ export type TargetsAdoptReleaseError =
547
951
  | ConflictError
548
952
  | UnprocessableEntityError
549
953
  | RateLimitedError
954
+ | InternalServerError
550
955
  | UnexpectedApiError
551
956
  | ResponseParseError
552
957
  | TransportError
@@ -558,6 +963,7 @@ export type TargetsRetrieveReleaseError =
558
963
  | ForbiddenError
559
964
  | NotFoundError
560
965
  | RateLimitedError
966
+ | InternalServerError
561
967
  | UnexpectedApiError
562
968
  | ResponseParseError
563
969
  | TransportError
@@ -567,21 +973,149 @@ export interface TargetsRepublishReleaseParams {
567
973
  /**
568
974
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
569
975
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
570
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
571
- * returns 409. After expiry the key starts a new write.
976
+ * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
977
+ * changed intent returns 409. After expiry the key starts a new write.
572
978
  */
573
979
  idempotencyKey?: string;
574
980
  }
575
981
 
576
982
  /** Every error `republishRelease` can produce, as a discriminated union. */
577
983
  export type TargetsRepublishReleaseError =
984
+ | BadRequestError
578
985
  | UnauthorizedError
579
986
  | ForbiddenError
580
987
  | NotFoundError
581
988
  | ConflictError
582
989
  | RateLimitedError
990
+ | InternalServerError
583
991
  | BadGatewayError
584
992
  | UnexpectedApiError
585
993
  | ResponseParseError
586
994
  | TransportError
587
995
  | ValidationError;
996
+
997
+ export interface TargetsListDraftFilesParams {
998
+ /**
999
+ * conflicted: conflicts only. customized: files that differ from the last accepted package.
1000
+ * history: files affected by a default-branch history rewrite. Omit for conflicted and customized
1001
+ * files.
1002
+ */
1003
+ filter?: "conflicted" | "customized" | "history";
1004
+ /**
1005
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
1006
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
1007
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
1008
+ * return 400.
1009
+ */
1010
+ limit?: number;
1011
+ /**
1012
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
1013
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
1014
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
1015
+ * requests.
1016
+ */
1017
+ cursor?: string;
1018
+ }
1019
+
1020
+ /** Every error `listDraftFiles` can produce, as a discriminated union. */
1021
+ export type TargetsListDraftFilesError =
1022
+ | BadRequestError
1023
+ | UnauthorizedError
1024
+ | ForbiddenError
1025
+ | NotFoundError
1026
+ | ConflictError
1027
+ | RateLimitedError
1028
+ | InternalServerError
1029
+ | UnexpectedApiError
1030
+ | ResponseParseError
1031
+ | TransportError
1032
+ | ValidationError;
1033
+
1034
+ export interface TargetsRetrieveDraftFileContentParams {
1035
+ /** File path from listDraftFiles. */
1036
+ path: string;
1037
+ /** A side listed for the file. */
1038
+ side: DraftFileSide;
1039
+ /** next_cursor from the preceding chunk of the same path and side. */
1040
+ cursor?: string;
1041
+ }
1042
+
1043
+ /** Every error `retrieveDraftFileContent` can produce, as a discriminated union. */
1044
+ export type TargetsRetrieveDraftFileContentError =
1045
+ | BadRequestError
1046
+ | UnauthorizedError
1047
+ | ForbiddenError
1048
+ | NotFoundError
1049
+ | ConflictError
1050
+ | RateLimitedError
1051
+ | InternalServerError
1052
+ | UnexpectedApiError
1053
+ | ResponseParseError
1054
+ | TransportError
1055
+ | ValidationError;
1056
+
1057
+ /** Every error `resolveDraftConflicts` can produce, as a discriminated union. */
1058
+ export type TargetsResolveDraftConflictsError =
1059
+ | BadRequestError
1060
+ | UnauthorizedError
1061
+ | ForbiddenError
1062
+ | NotFoundError
1063
+ | ConflictError
1064
+ | RateLimitedError
1065
+ | InternalServerError
1066
+ | UnexpectedApiError
1067
+ | ResponseParseError
1068
+ | TransportError
1069
+ | ValidationError;
1070
+
1071
+ /** Every error `discardDraftCustomizations` can produce, as a discriminated union. */
1072
+ export type TargetsDiscardDraftCustomizationsError =
1073
+ | BadRequestError
1074
+ | UnauthorizedError
1075
+ | ForbiddenError
1076
+ | NotFoundError
1077
+ | ConflictError
1078
+ | RateLimitedError
1079
+ | InternalServerError
1080
+ | UnexpectedApiError
1081
+ | ResponseParseError
1082
+ | TransportError
1083
+ | ValidationError;
1084
+
1085
+ /** Every error `recoverDraftHistory` can produce, as a discriminated union. */
1086
+ export type TargetsRecoverDraftHistoryError =
1087
+ | BadRequestError
1088
+ | UnauthorizedError
1089
+ | ForbiddenError
1090
+ | NotFoundError
1091
+ | ConflictError
1092
+ | RateLimitedError
1093
+ | InternalServerError
1094
+ | UnexpectedApiError
1095
+ | ResponseParseError
1096
+ | TransportError
1097
+ | ValidationError;
1098
+
1099
+ /** Every error `retrieveDelivery` can produce, as a discriminated union. */
1100
+ export type TargetsRetrieveDeliveryError =
1101
+ | UnauthorizedError
1102
+ | ForbiddenError
1103
+ | NotFoundError
1104
+ | RateLimitedError
1105
+ | InternalServerError
1106
+ | UnexpectedApiError
1107
+ | ResponseParseError
1108
+ | TransportError
1109
+ | ValidationError;
1110
+
1111
+ /** Every error `retrievePublication` can produce, as a discriminated union. */
1112
+ export type TargetsRetrievePublicationError =
1113
+ | UnauthorizedError
1114
+ | ForbiddenError
1115
+ | NotFoundError
1116
+ | RateLimitedError
1117
+ | InternalServerError
1118
+ | UnexpectedApiError
1119
+ | ResponseParseError
1120
+ | TransportError
1121
+ | ValidationError;