@typeship-ax/mcp 0.9.1 → 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 +6055 -645
  4. package/api.md +5225 -567
  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 -31
  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 +285 -22
  44. package/dist/resources/targets.d.ts.map +1 -1
  45. package/dist/resources/targets.js +408 -10
  46. package/dist/schemas.d.ts.map +1 -1
  47. package/dist/schemas.js +138 -73
  48. package/dist/types.d.ts +2162 -134
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/types.js +99 -2
  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 -31
  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 +756 -13
  67. package/src/schemas.ts +138 -73
  68. package/src/types.ts +2372 -189
@@ -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";
@@ -8,10 +8,14 @@ import {
8
8
  TransportError,
9
9
  UnexpectedApiError,
10
10
  ValidationError,
11
+ BadGatewayError,
11
12
  BadRequestError,
12
13
  ConflictError,
13
14
  ForbiddenError,
15
+ InternalServerError,
14
16
  NotFoundError,
17
+ PaymentRequiredError,
18
+ PreconditionFailedError,
15
19
  RateLimitedError,
16
20
  UnauthorizedError,
17
21
  UnprocessableEntityError,
@@ -19,8 +23,34 @@ import {
19
23
  import type {
20
24
  DeletedTarget,
21
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,
22
43
  ProjectId,
44
+ PublicationId,
45
+ PublicationResponse,
46
+ PublicationResponseRead,
47
+ RecoverDraftHistory,
48
+ ResolveDraftConflicts,
23
49
  Target,
50
+ TargetAdoption,
51
+ TargetDraftResponse,
52
+ TargetDraftResponseRead,
53
+ TargetDraftUpdate,
24
54
  TargetFields,
25
55
  TargetId,
26
56
  TargetList,
@@ -65,6 +95,7 @@ export class TargetsResource {
65
95
  "403": ForbiddenError,
66
96
  "404": NotFoundError,
67
97
  "429": RateLimitedError,
98
+ "500": InternalServerError,
68
99
  },
69
100
  idempotent: true,
70
101
  schemaKey: "targets.list",
@@ -82,8 +113,8 @@ export class TargetsResource {
82
113
  /**
83
114
  * Create an independently configured Target
84
115
  *
85
- * Several Targets may use the same generator with distinct configuration, Deliveries, and release
86
- * streams.
116
+ * Creates a Target with its own configuration, Deliveries, and release history. Multiple Targets
117
+ * can use the same generator.
87
118
  *
88
119
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
89
120
  * `POST /projects/{project_id}/targets`
@@ -105,11 +136,13 @@ export class TargetsResource {
105
136
  errors: {
106
137
  "400": BadRequestError,
107
138
  "401": UnauthorizedError,
139
+ "402": PaymentRequiredError,
108
140
  "403": ForbiddenError,
109
141
  "404": NotFoundError,
110
142
  "409": ConflictError,
111
143
  "422": UnprocessableEntityError,
112
144
  "429": RateLimitedError,
145
+ "500": InternalServerError,
113
146
  },
114
147
  idempotencyKey: "Idempotency-Key",
115
148
  schemaKey: "targets.create",
@@ -134,6 +167,7 @@ export class TargetsResource {
134
167
  "403": ForbiddenError,
135
168
  "404": NotFoundError,
136
169
  "429": RateLimitedError,
170
+ "500": InternalServerError,
137
171
  },
138
172
  idempotent: true,
139
173
  schemaKey: "targets.retrieve",
@@ -144,24 +178,35 @@ export class TargetsResource {
144
178
  /**
145
179
  * Delete an unused Target
146
180
  *
147
- * Targets with Generation or release history, or an active release candidate, must be disabled
148
- * 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.
149
187
  * `DELETE /targets/{target_id}`
150
188
  */
151
189
  async delete(
152
190
  targetId: TargetId,
191
+ params?: TargetsDeleteParams,
153
192
  options?: RequestOptions,
154
193
  ): Promise<ApiResult<DeletedTargetRead, TargetsDeleteError>> {
155
194
  return this._core.request<DeletedTargetRead, TargetsDeleteError>({
156
195
  method: "DELETE",
157
196
  path: `/targets/${encodeURIComponent(String(targetId))}`,
158
197
  security: [{"apiKey":[]}],
198
+ headers: {
199
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
200
+ },
159
201
  errors: {
202
+ "400": BadRequestError,
160
203
  "401": UnauthorizedError,
161
204
  "403": ForbiddenError,
162
205
  "404": NotFoundError,
163
206
  "409": ConflictError,
207
+ "412": PreconditionFailedError,
164
208
  "429": RateLimitedError,
209
+ "500": InternalServerError,
165
210
  },
166
211
  idempotent: true,
167
212
  schemaKey: "targets.delete",
@@ -171,26 +216,50 @@ export class TargetsResource {
171
216
 
172
217
  /**
173
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.
174
235
  * `PATCH /targets/{target_id}`
175
236
  */
176
237
  async update(
177
238
  targetId: TargetId,
178
239
  body: TargetUpdateRequest,
240
+ params?: TargetsUpdateParams,
179
241
  options?: RequestOptions,
180
242
  ): Promise<ApiResult<TargetResponseRead, TargetsUpdateError>> {
181
243
  return this._core.request<TargetResponseRead, TargetsUpdateError>({
182
244
  method: "PATCH",
183
245
  path: `/targets/${encodeURIComponent(String(targetId))}`,
184
246
  security: [{"apiKey":[]}],
247
+ headers: {
248
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
249
+ },
185
250
  body,
186
251
  errors: {
187
252
  "400": BadRequestError,
188
253
  "401": UnauthorizedError,
254
+ "402": PaymentRequiredError,
189
255
  "403": ForbiddenError,
190
256
  "404": NotFoundError,
191
257
  "409": ConflictError,
258
+ "412": PreconditionFailedError,
192
259
  "422": UnprocessableEntityError,
193
260
  "429": RateLimitedError,
261
+ "500": InternalServerError,
262
+ "502": BadGatewayError,
194
263
  },
195
264
  schemaKey: "targets.update",
196
265
  options,
@@ -222,6 +291,7 @@ export class TargetsResource {
222
291
  "403": ForbiddenError,
223
292
  "404": NotFoundError,
224
293
  "429": RateLimitedError,
294
+ "500": InternalServerError,
225
295
  },
226
296
  idempotent: true,
227
297
  schemaKey: "targets.listReleases",
@@ -236,9 +306,131 @@ export class TargetsResource {
236
306
  });
237
307
  }
238
308
 
309
+ /**
310
+ * Retrieve a Target's rolling Draft release
311
+ *
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.
316
+ * `GET /targets/{target_id}/draft`
317
+ */
318
+ async retrieveDraft(
319
+ targetId: TargetId,
320
+ options?: RequestOptions,
321
+ ): Promise<ApiResult<TargetDraftResponseRead, TargetsRetrieveDraftError>> {
322
+ return this._core.request<TargetDraftResponseRead, TargetsRetrieveDraftError>({
323
+ method: "GET",
324
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft`,
325
+ security: [{"apiKey":[]}],
326
+ errors: {
327
+ "401": UnauthorizedError,
328
+ "403": ForbiddenError,
329
+ "404": NotFoundError,
330
+ "429": RateLimitedError,
331
+ "500": InternalServerError,
332
+ },
333
+ idempotent: true,
334
+ schemaKey: "targets.retrieveDraft",
335
+ options,
336
+ });
337
+ }
338
+
339
+ /**
340
+ * Select an exact Draft version or return to automatic versioning
341
+ *
342
+ * Checks your version choice against the required version bump, then regenerates the existing
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.
358
+ * `PATCH /targets/{target_id}/draft`
359
+ */
360
+ async updateDraft(
361
+ targetId: TargetId,
362
+ body: TargetDraftUpdate,
363
+ params?: TargetsUpdateDraftParams,
364
+ options?: RequestOptions,
365
+ ): Promise<ApiResult<TargetDraftResponseRead, TargetsUpdateDraftError>> {
366
+ return this._core.request<TargetDraftResponseRead, TargetsUpdateDraftError>({
367
+ method: "PATCH",
368
+ path: `/targets/${encodeURIComponent(String(targetId))}/draft`,
369
+ security: [{"apiKey":[]}],
370
+ headers: {
371
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
372
+ },
373
+ body,
374
+ errors: {
375
+ "400": BadRequestError,
376
+ "401": UnauthorizedError,
377
+ "403": ForbiddenError,
378
+ "404": NotFoundError,
379
+ "409": ConflictError,
380
+ "412": PreconditionFailedError,
381
+ "422": UnprocessableEntityError,
382
+ "429": RateLimitedError,
383
+ "500": InternalServerError,
384
+ "502": BadGatewayError,
385
+ },
386
+ schemaKey: "targets.updateDraft",
387
+ options,
388
+ });
389
+ }
390
+
391
+ /**
392
+ * Adopt a verified existing package as Current
393
+ *
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.
397
+ *
398
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
399
+ * `POST /targets/{target_id}/adopt`
400
+ */
401
+ async adoptRelease(
402
+ targetId: TargetId,
403
+ body: TargetAdoption,
404
+ params?: TargetsAdoptReleaseParams,
405
+ options?: RequestOptions,
406
+ ): Promise<ApiResult<TargetReleaseResponseRead, TargetsAdoptReleaseError>> {
407
+ return this._core.request<TargetReleaseResponseRead, TargetsAdoptReleaseError>({
408
+ method: "POST",
409
+ path: `/targets/${encodeURIComponent(String(targetId))}/adopt`,
410
+ security: [{"apiKey":[]}],
411
+ headers: {
412
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
413
+ },
414
+ body,
415
+ errors: {
416
+ "400": BadRequestError,
417
+ "401": UnauthorizedError,
418
+ "403": ForbiddenError,
419
+ "404": NotFoundError,
420
+ "409": ConflictError,
421
+ "422": UnprocessableEntityError,
422
+ "429": RateLimitedError,
423
+ "500": InternalServerError,
424
+ },
425
+ idempotencyKey: "Idempotency-Key",
426
+ schemaKey: "targets.adoptRelease",
427
+ options,
428
+ });
429
+ }
430
+
239
431
  /**
240
432
  * Retrieve an immutable Target release
241
- * `GET /target_releases/{target_release_id}`
433
+ * `GET /target-releases/{target_release_id}`
242
434
  */
243
435
  async retrieveRelease(
244
436
  targetReleaseId: TargetReleaseId,
@@ -246,27 +438,326 @@ export class TargetsResource {
246
438
  ): Promise<ApiResult<TargetReleaseResponseRead, TargetsRetrieveReleaseError>> {
247
439
  return this._core.request<TargetReleaseResponseRead, TargetsRetrieveReleaseError>({
248
440
  method: "GET",
249
- path: `/target_releases/${encodeURIComponent(String(targetReleaseId))}`,
441
+ path: `/target-releases/${encodeURIComponent(String(targetReleaseId))}`,
250
442
  security: [{"apiKey":[]}],
251
443
  errors: {
252
444
  "401": UnauthorizedError,
253
445
  "403": ForbiddenError,
254
446
  "404": NotFoundError,
255
447
  "429": RateLimitedError,
448
+ "500": InternalServerError,
256
449
  },
257
450
  idempotent: true,
258
451
  schemaKey: "targets.retrieveRelease",
259
452
  options,
260
453
  });
261
454
  }
455
+
456
+ /**
457
+ * Retry publication of an exact Target release
458
+ *
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.
463
+ *
464
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
465
+ * `POST /target-releases/{target_release_id}/republish`
466
+ */
467
+ async republishRelease(
468
+ targetReleaseId: TargetReleaseId,
469
+ params?: TargetsRepublishReleaseParams,
470
+ options?: RequestOptions,
471
+ ): Promise<ApiResult<TargetReleaseResponseRead, TargetsRepublishReleaseError>> {
472
+ return this._core.request<TargetReleaseResponseRead, TargetsRepublishReleaseError>({
473
+ method: "POST",
474
+ path: `/target-releases/${encodeURIComponent(String(targetReleaseId))}/republish`,
475
+ security: [{"apiKey":[]}],
476
+ headers: {
477
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
478
+ },
479
+ errors: {
480
+ "400": BadRequestError,
481
+ "401": UnauthorizedError,
482
+ "403": ForbiddenError,
483
+ "404": NotFoundError,
484
+ "409": ConflictError,
485
+ "429": RateLimitedError,
486
+ "500": InternalServerError,
487
+ "502": BadGatewayError,
488
+ },
489
+ idempotencyKey: "Idempotency-Key",
490
+ schemaKey: "targets.republishRelease",
491
+ options,
492
+ });
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
+ }
262
746
  }
263
747
 
264
748
  export interface TargetsListParams {
265
- /** 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
+ */
266
755
  limit?: number;
267
756
  /**
268
757
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
269
- * 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.
270
761
  */
271
762
  cursor?: string;
272
763
  }
@@ -278,6 +769,7 @@ export type TargetsListError =
278
769
  | ForbiddenError
279
770
  | NotFoundError
280
771
  | RateLimitedError
772
+ | InternalServerError
281
773
  | UnexpectedApiError
282
774
  | ResponseParseError
283
775
  | TransportError
@@ -287,8 +779,8 @@ export interface TargetsCreateParams {
287
779
  /**
288
780
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
289
781
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
290
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
291
- * 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.
292
784
  */
293
785
  idempotencyKey?: string;
294
786
  }
@@ -297,11 +789,13 @@ export interface TargetsCreateParams {
297
789
  export type TargetsCreateError =
298
790
  | BadRequestError
299
791
  | UnauthorizedError
792
+ | PaymentRequiredError
300
793
  | ForbiddenError
301
794
  | NotFoundError
302
795
  | ConflictError
303
796
  | UnprocessableEntityError
304
797
  | RateLimitedError
798
+ | InternalServerError
305
799
  | UnexpectedApiError
306
800
  | ResponseParseError
307
801
  | TransportError
@@ -313,43 +807,76 @@ export type TargetsRetrieveError =
313
807
  | ForbiddenError
314
808
  | NotFoundError
315
809
  | RateLimitedError
810
+ | InternalServerError
316
811
  | UnexpectedApiError
317
812
  | ResponseParseError
318
813
  | TransportError
319
814
  | ValidationError;
320
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
+
321
825
  /** Every error `delete` can produce, as a discriminated union. */
322
826
  export type TargetsDeleteError =
827
+ | BadRequestError
323
828
  | UnauthorizedError
324
829
  | ForbiddenError
325
830
  | NotFoundError
326
831
  | ConflictError
832
+ | PreconditionFailedError
327
833
  | RateLimitedError
834
+ | InternalServerError
328
835
  | UnexpectedApiError
329
836
  | ResponseParseError
330
837
  | TransportError
331
838
  | ValidationError;
332
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
+
333
849
  /** Every error `update` can produce, as a discriminated union. */
334
850
  export type TargetsUpdateError =
335
851
  | BadRequestError
336
852
  | UnauthorizedError
853
+ | PaymentRequiredError
337
854
  | ForbiddenError
338
855
  | NotFoundError
339
856
  | ConflictError
857
+ | PreconditionFailedError
340
858
  | UnprocessableEntityError
341
859
  | RateLimitedError
860
+ | InternalServerError
861
+ | BadGatewayError
342
862
  | UnexpectedApiError
343
863
  | ResponseParseError
344
864
  | TransportError
345
865
  | ValidationError;
346
866
 
347
867
  export interface TargetsListReleasesParams {
348
- /** 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
+ */
349
874
  limit?: number;
350
875
  /**
351
876
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
352
- * 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.
353
880
  */
354
881
  cursor?: string;
355
882
  }
@@ -361,6 +888,70 @@ export type TargetsListReleasesError =
361
888
  | ForbiddenError
362
889
  | NotFoundError
363
890
  | RateLimitedError
891
+ | InternalServerError
892
+ | UnexpectedApiError
893
+ | ResponseParseError
894
+ | TransportError
895
+ | ValidationError;
896
+
897
+ /** Every error `retrieveDraft` can produce, as a discriminated union. */
898
+ export type TargetsRetrieveDraftError =
899
+ | UnauthorizedError
900
+ | ForbiddenError
901
+ | NotFoundError
902
+ | RateLimitedError
903
+ | InternalServerError
904
+ | UnexpectedApiError
905
+ | ResponseParseError
906
+ | TransportError
907
+ | ValidationError;
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
+
918
+ /** Every error `updateDraft` can produce, as a discriminated union. */
919
+ export type TargetsUpdateDraftError =
920
+ | BadRequestError
921
+ | UnauthorizedError
922
+ | ForbiddenError
923
+ | NotFoundError
924
+ | ConflictError
925
+ | PreconditionFailedError
926
+ | UnprocessableEntityError
927
+ | RateLimitedError
928
+ | InternalServerError
929
+ | BadGatewayError
930
+ | UnexpectedApiError
931
+ | ResponseParseError
932
+ | TransportError
933
+ | ValidationError;
934
+
935
+ export interface TargetsAdoptReleaseParams {
936
+ /**
937
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
938
+ * operation; account-less generation uses a hashed network identity. Retrying the same method,
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.
941
+ */
942
+ idempotencyKey?: string;
943
+ }
944
+
945
+ /** Every error `adoptRelease` can produce, as a discriminated union. */
946
+ export type TargetsAdoptReleaseError =
947
+ | BadRequestError
948
+ | UnauthorizedError
949
+ | ForbiddenError
950
+ | NotFoundError
951
+ | ConflictError
952
+ | UnprocessableEntityError
953
+ | RateLimitedError
954
+ | InternalServerError
364
955
  | UnexpectedApiError
365
956
  | ResponseParseError
366
957
  | TransportError
@@ -372,6 +963,158 @@ export type TargetsRetrieveReleaseError =
372
963
  | ForbiddenError
373
964
  | NotFoundError
374
965
  | RateLimitedError
966
+ | InternalServerError
967
+ | UnexpectedApiError
968
+ | ResponseParseError
969
+ | TransportError
970
+ | ValidationError;
971
+
972
+ export interface TargetsRepublishReleaseParams {
973
+ /**
974
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
975
+ * operation; account-less generation uses a hashed network identity. Retrying the same method,
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.
978
+ */
979
+ idempotencyKey?: string;
980
+ }
981
+
982
+ /** Every error `republishRelease` can produce, as a discriminated union. */
983
+ export type TargetsRepublishReleaseError =
984
+ | BadRequestError
985
+ | UnauthorizedError
986
+ | ForbiddenError
987
+ | NotFoundError
988
+ | ConflictError
989
+ | RateLimitedError
990
+ | InternalServerError
991
+ | BadGatewayError
992
+ | UnexpectedApiError
993
+ | ResponseParseError
994
+ | TransportError
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
375
1118
  | UnexpectedApiError
376
1119
  | ResponseParseError
377
1120
  | TransportError