@typeship-ax/mcp 0.19.0 → 0.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/AGENTS.md +3 -3
  2. package/README.md +1 -1
  3. package/api.json +7519 -6363
  4. package/api.md +8015 -6765
  5. package/dist/api-identity.d.ts.map +1 -1
  6. package/dist/api-identity.js +6 -1
  7. package/dist/core/http.d.ts +26 -14
  8. package/dist/core/http.d.ts.map +1 -1
  9. package/dist/core/http.js +90 -19
  10. package/dist/core/pagination.d.ts +8 -8
  11. package/dist/core/pagination.d.ts.map +1 -1
  12. package/dist/core/pagination.js +7 -16
  13. package/dist/errors.d.ts +4 -4
  14. package/dist/errors.d.ts.map +1 -1
  15. package/dist/errors.js +7 -7
  16. package/dist/index.d.ts +33 -19
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +37 -17
  19. package/dist/mcp-protocol.js +2 -2
  20. package/dist/mcp.d.ts.map +1 -1
  21. package/dist/mcp.js +6 -5
  22. package/dist/ops.d.ts +1 -1
  23. package/dist/ops.d.ts.map +1 -1
  24. package/dist/ops.js +40 -43
  25. package/dist/resources/api-keys.d.ts +16 -15
  26. package/dist/resources/api-keys.d.ts.map +1 -1
  27. package/dist/resources/api-keys.js +6 -6
  28. package/dist/resources/deliveries.d.ts +47 -0
  29. package/dist/resources/deliveries.d.ts.map +1 -0
  30. package/dist/resources/deliveries.js +70 -0
  31. package/dist/resources/drafts.d.ts +157 -0
  32. package/dist/resources/drafts.d.ts.map +1 -0
  33. package/dist/resources/drafts.js +230 -0
  34. package/dist/resources/files.d.ts +23 -0
  35. package/dist/resources/files.d.ts.map +1 -0
  36. package/dist/resources/files.js +38 -0
  37. package/dist/resources/generate.d.ts +14 -14
  38. package/dist/resources/generate.d.ts.map +1 -1
  39. package/dist/resources/generate.js +7 -7
  40. package/dist/resources/generations.d.ts +67 -21
  41. package/dist/resources/generations.d.ts.map +1 -1
  42. package/dist/resources/generations.js +67 -20
  43. package/dist/resources/organization.d.ts +18 -0
  44. package/dist/resources/organization.d.ts.map +1 -0
  45. package/dist/resources/{account.js → organization.js} +10 -10
  46. package/dist/resources/projects.d.ts +50 -139
  47. package/dist/resources/projects.d.ts.map +1 -1
  48. package/dist/resources/projects.js +29 -179
  49. package/dist/resources/publications.d.ts +47 -0
  50. package/dist/resources/publications.d.ts.map +1 -0
  51. package/dist/resources/publications.js +70 -0
  52. package/dist/resources/releases.d.ts +68 -0
  53. package/dist/resources/releases.d.ts.map +1 -0
  54. package/dist/resources/releases.js +102 -0
  55. package/dist/resources/spec-revisions.d.ts +87 -0
  56. package/dist/resources/spec-revisions.d.ts.map +1 -0
  57. package/dist/resources/spec-revisions.js +116 -0
  58. package/dist/resources/specs.d.ts +73 -0
  59. package/dist/resources/specs.d.ts.map +1 -0
  60. package/dist/resources/specs.js +108 -0
  61. package/dist/resources/targets.d.ts +48 -267
  62. package/dist/resources/targets.d.ts.map +1 -1
  63. package/dist/resources/targets.js +28 -407
  64. package/dist/schemas.d.ts.map +1 -1
  65. package/dist/schemas.js +143 -149
  66. package/dist/types.d.ts +1320 -1637
  67. package/dist/types.d.ts.map +1 -1
  68. package/dist/types.js +84 -76
  69. package/package.json +1 -1
  70. package/server.json +2 -2
  71. package/src/api-identity.ts +6 -2
  72. package/src/core/http.ts +89 -24
  73. package/src/core/pagination.ts +13 -23
  74. package/src/errors.ts +7 -7
  75. package/src/index.ts +41 -23
  76. package/src/mcp-protocol.ts +2 -2
  77. package/src/mcp.ts +7 -6
  78. package/src/ops.ts +41 -44
  79. package/src/resources/api-keys.ts +19 -21
  80. package/src/resources/deliveries.ts +140 -0
  81. package/src/resources/drafts.ts +424 -0
  82. package/src/resources/files.ts +68 -0
  83. package/src/resources/generate.ts +16 -19
  84. package/src/resources/generations.ts +148 -35
  85. package/src/resources/{account.ts → organization.ts} +14 -14
  86. package/src/resources/projects.ts +56 -350
  87. package/src/resources/publications.ts +140 -0
  88. package/src/resources/releases.ts +201 -0
  89. package/src/resources/spec-revisions.ts +239 -0
  90. package/src/resources/specs.ts +201 -0
  91. package/src/resources/targets.ts +63 -765
  92. package/src/schemas.ts +143 -149
  93. package/src/types.ts +1418 -1740
  94. package/dist/resources/account.d.ts +0 -18
  95. package/dist/resources/account.d.ts.map +0 -1
  96. package/dist/resources/definition-revisions.d.ts +0 -75
  97. package/dist/resources/definition-revisions.d.ts.map +0 -1
  98. package/dist/resources/definition-revisions.js +0 -142
  99. package/dist/resources/definitions.d.ts +0 -50
  100. package/dist/resources/definitions.d.ts.map +0 -1
  101. package/dist/resources/definitions.js +0 -73
  102. package/src/resources/definition-revisions.ts +0 -265
  103. package/src/resources/definitions.ts +0 -146
@@ -1,4 +1,4 @@
1
- import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
2
  import { PagePromise } from "../core/pagination.js";
3
3
  import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError } from "../errors.js";
4
4
  import type { ApiKeyRead, ApiKeyResponseRead } from "../types.js";
@@ -16,45 +16,46 @@ export declare class ApiKeysResource {
16
16
  */
17
17
  list(params?: ApiKeysListParams, options?: RequestOptions): PagePromise<ApiKeyRead, ApiKeysListError>;
18
18
  /**
19
- * Retrieve an API key
19
+ * Get an API key
20
20
  *
21
21
  * Returns the key summary and its ETag for conditional revocation.
22
22
  * `GET /api-keys/{api_key_id}`
23
23
  */
24
- retrieve(apiKeyId: string, options?: RequestOptions): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRetrieveError>>;
24
+ get(apiKeyId: string, options?: RequestOptions): Promise<ApiKeyResponseRead>;
25
25
  /**
26
26
  * Revoke an API key
27
27
  *
28
28
  * Revokes a key. Repeating the request returns the same result.
29
29
  *
30
30
  * With OAuth, members can revoke their own keys; organization admins can revoke any key.
31
- * Organization API keys can revoke any key in their account.
31
+ * Organization API keys can revoke any key in their organization.
32
32
  * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
33
33
  * and If-Match.
34
34
  * `DELETE /api-keys/{api_key_id}`
35
35
  */
36
- revoke(apiKeyId: string, params?: ApiKeysRevokeParams, options?: RequestOptions): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRevokeError>>;
36
+ revoke(apiKeyId: string, params?: ApiKeysRevokeParams, options?: RequestOptions): Promise<ApiKeyResponseRead>;
37
37
  }
38
38
  export interface ApiKeysListParams {
39
39
  /**
40
40
  * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
41
41
  * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
42
- * invalid_request. List query parameters must appear only once; unrecognized parameters also
43
- * return 400.
42
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
43
+ * return 400 query_param_invalid.
44
44
  */
45
45
  limit?: number;
46
46
  /**
47
- * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
48
- * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
49
- * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
50
- * requests.
47
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
48
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
49
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
50
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
51
+ * change between requests.
51
52
  */
52
53
  cursor?: string;
53
54
  }
54
- /** Every error `list` can produce, as a discriminated union. */
55
+ /** Typed errors `list` can throw. */
55
56
  export type ApiKeysListError = BadRequestError | UnauthorizedError | ForbiddenError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
56
- /** Every error `retrieve` can produce, as a discriminated union. */
57
- export type ApiKeysRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
57
+ /** Typed errors `get` can throw. */
58
+ export type ApiKeysGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
58
59
  export interface ApiKeysRevokeParams {
59
60
  /**
60
61
  * ETag from a preceding response. The write applies only if the resource still has that version;
@@ -63,6 +64,6 @@ export interface ApiKeysRevokeParams {
63
64
  */
64
65
  ifMatch?: string;
65
66
  }
66
- /** Every error `revoke` can produce, as a discriminated union. */
67
+ /** Typed errors `revoke` can throw. */
67
68
  export type ApiKeysRevokeError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | PreconditionFailedError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
68
69
  //# sourceMappingURL=api-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAIV,UAAU,EAEV,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;OAQG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC;IA6BrG;;;;;OAKG;IACG,QAAQ,CACZ,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC;IAkB/D;;;;;;;;;;OAUG;IACG,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC,CAAC;CAsB9D;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gEAAgE;AAChE,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,kEAAkE;AAClE,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,uBAAuB,GACvB,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"api-keys.d.ts","sourceRoot":"","sources":["../../src/resources/api-keys.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,uBAAuB,EACvB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAIV,UAAU,EAEV,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAErB,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;OAQG;IACH,IAAI,CAAC,MAAM,CAAC,EAAE,iBAAiB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,WAAW,CAAC,UAAU,EAAE,gBAAgB,CAAC;IA6BrG;;;;;OAKG;IACG,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAkBlF;;;;;;;;;;OAUG;IACG,MAAM,CACV,QAAQ,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,kBAAkB,CAAC;CAsB/B;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,qCAAqC;AACrC,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,oCAAoC;AACpC,MAAM,MAAM,eAAe,GACvB,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,mBAAmB;IAClC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,uCAAuC;AACvC,MAAM,MAAM,kBAAkB,GAC1B,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,uBAAuB,GACvB,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -45,13 +45,13 @@ export class ApiKeysResource {
45
45
  });
46
46
  }
47
47
  /**
48
- * Retrieve an API key
48
+ * Get an API key
49
49
  *
50
50
  * Returns the key summary and its ETag for conditional revocation.
51
51
  * `GET /api-keys/{api_key_id}`
52
52
  */
53
- async retrieve(apiKeyId, options) {
54
- return this._core.request({
53
+ async get(apiKeyId, options) {
54
+ return this._core.requestData({
55
55
  method: "GET",
56
56
  path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
57
57
  security: [{ "apiKey": [] }],
@@ -63,7 +63,7 @@ export class ApiKeysResource {
63
63
  "500": InternalServerError,
64
64
  },
65
65
  idempotent: true,
66
- schemaKey: "apiKeys.retrieve",
66
+ schemaKey: "apiKeys.get",
67
67
  options,
68
68
  });
69
69
  }
@@ -73,13 +73,13 @@ export class ApiKeysResource {
73
73
  * Revokes a key. Repeating the request returns the same result.
74
74
  *
75
75
  * With OAuth, members can revoke their own keys; organization admins can revoke any key.
76
- * Organization API keys can revoke any key in their account.
76
+ * Organization API keys can revoke any key in their organization.
77
77
  * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
78
78
  * and If-Match.
79
79
  * `DELETE /api-keys/{api_key_id}`
80
80
  */
81
81
  async revoke(apiKeyId, params, options) {
82
- return this._core.request({
82
+ return this._core.requestData({
83
83
  method: "DELETE",
84
84
  path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
85
85
  security: [{ "apiKey": [] }],
@@ -0,0 +1,47 @@
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { PagePromise } from "../core/pagination.js";
3
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
4
+ import type { DeliveryId, DeliveryRead, DeliveryResponseRead, TargetId } from "../types.js";
5
+ export declare class DeliveriesResource {
6
+ private readonly _core;
7
+ constructor(_core: HttpCore);
8
+ /**
9
+ * List Deliveries
10
+ *
11
+ * Auto-paginates: `for await (const item of …)` walks every page.
12
+ * `GET /deliveries`
13
+ */
14
+ list(params?: DeliveriesListParams, options?: RequestOptions): PagePromise<DeliveryRead, DeliveriesListError>;
15
+ /**
16
+ * Get a Delivery
17
+ *
18
+ * Returns the configured repository or hosted MCP Delivery for a Target. A Delivery in another
19
+ * organization returns 404 resource_not_found.
20
+ * `GET /deliveries/{delivery_id}`
21
+ */
22
+ get(deliveryId: DeliveryId, options?: RequestOptions): Promise<DeliveryResponseRead>;
23
+ }
24
+ export interface DeliveriesListParams {
25
+ /**
26
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
27
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
28
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
29
+ * return 400 query_param_invalid.
30
+ */
31
+ limit?: number;
32
+ /**
33
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
34
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
35
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
36
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
37
+ * change between requests.
38
+ */
39
+ cursor?: string;
40
+ /** Only Deliveries of this Target. */
41
+ targetId?: TargetId;
42
+ }
43
+ /** Typed errors `list` can throw. */
44
+ export type DeliveriesListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
45
+ /** Typed errors `get` can throw. */
46
+ export type DeliveriesGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
47
+ //# sourceMappingURL=deliveries.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deliveries.d.ts","sourceRoot":"","sources":["../../src/resources/deliveries.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAY,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,UAAU,EAGV,YAAY,EAEZ,oBAAoB,EACpB,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;OAKG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,YAAY,EAAE,mBAAmB,CAAC;IA+BjD;;;;;;OAMG;IACG,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC;CAiB3F;AAED,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,qCAAqC;AACrC,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,oCAAoC;AACpC,MAAM,MAAM,kBAAkB,GAC1B,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -0,0 +1,70 @@
1
+ // typeship — deliveries resource.
2
+ // Generated by typeship — https://typeship.dev
3
+ import { paginate } from "../core/pagination.js";
4
+ import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
5
+ export class DeliveriesResource {
6
+ _core;
7
+ constructor(_core) {
8
+ this._core = _core;
9
+ }
10
+ /**
11
+ * List Deliveries
12
+ *
13
+ * Auto-paginates: `for await (const item of …)` walks every page.
14
+ * `GET /deliveries`
15
+ */
16
+ list(params, options) {
17
+ return paginate(this._core, {
18
+ method: "GET",
19
+ path: "/deliveries",
20
+ security: [{ "apiKey": [] }],
21
+ query: {
22
+ limit: params?.limit,
23
+ cursor: params?.cursor,
24
+ target_id: params?.targetId,
25
+ },
26
+ errors: {
27
+ "400": BadRequestError,
28
+ "401": UnauthorizedError,
29
+ "403": ForbiddenError,
30
+ "404": NotFoundError,
31
+ "429": RateLimitedError,
32
+ "500": InternalServerError,
33
+ },
34
+ idempotent: true,
35
+ schemaKey: "deliveries.list",
36
+ options,
37
+ }, {
38
+ style: "cursor",
39
+ itemsField: "data",
40
+ cursorParam: "cursor",
41
+ nextCursorField: "next_cursor",
42
+ hasMoreField: "has_more",
43
+ limitParam: "limit",
44
+ });
45
+ }
46
+ /**
47
+ * Get a Delivery
48
+ *
49
+ * Returns the configured repository or hosted MCP Delivery for a Target. A Delivery in another
50
+ * organization returns 404 resource_not_found.
51
+ * `GET /deliveries/{delivery_id}`
52
+ */
53
+ async get(deliveryId, options) {
54
+ return this._core.requestData({
55
+ method: "GET",
56
+ path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
57
+ security: [{ "apiKey": [] }],
58
+ errors: {
59
+ "401": UnauthorizedError,
60
+ "403": ForbiddenError,
61
+ "404": NotFoundError,
62
+ "429": RateLimitedError,
63
+ "500": InternalServerError,
64
+ },
65
+ idempotent: true,
66
+ schemaKey: "deliveries.get",
67
+ options,
68
+ });
69
+ }
70
+ }
@@ -0,0 +1,157 @@
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { PagePromise } from "../core/pagination.js";
3
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadGatewayError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
4
+ import type { DraftFileRead, DraftId, DraftRead, DraftRecoverRequest, DraftResolveRequest, DraftResponseRead, DraftStatus, DraftUpdateRequest, TargetId } from "../types.js";
5
+ export declare class DraftsResource {
6
+ private readonly _core;
7
+ constructor(_core: HttpCore);
8
+ /**
9
+ * List Drafts
10
+ *
11
+ * Lists open and merged Drafts, newest first. Each Target has one open Draft; each merge adds a
12
+ * merged Draft.
13
+ *
14
+ * Auto-paginates: `for await (const item of …)` walks every page.
15
+ * `GET /drafts`
16
+ */
17
+ list(params?: DraftsListParams, options?: RequestOptions): PagePromise<DraftRead, DraftsListError>;
18
+ /**
19
+ * Get a Draft
20
+ *
21
+ * Returns the Draft's status. An open Draft also reports its typed reason when action is
22
+ * required, next version and its source, readiness, checks, and conflict counts. The response
23
+ * carries an `ETag`; send it in `If-Match` when updating the Draft to avoid changing a newer
24
+ * version selection.
25
+ * `GET /drafts/{draft_id}`
26
+ */
27
+ get(draftId: DraftId, options?: RequestOptions): Promise<DraftResponseRead>;
28
+ /**
29
+ * Select an exact Draft version or return to automatic versioning
30
+ *
31
+ * Checks your version choice against the required version bump, then regenerates the existing
32
+ * Draft pull request.
33
+ *
34
+ * Send the Draft's `ETag` in `If-Match` to reject an intervening change with 412
35
+ * precondition_failed before saving or regenerating. Omitting `If-Match` applies the selection to
36
+ * the current Draft. version_next is required; null restores automatic selection.
37
+ *
38
+ * A `502` response means the selected version was saved, but regeneration failed. Follow the
39
+ * error's retryable and suggested_action fields. Repeating an unfinished selection resumes
40
+ * generation; repeating a completed selection starts no new work. If using If-Match, retrieve the
41
+ * Draft and confirm the saved selection before retrying with its current ETag.
42
+ * A `409 draft_merged` means the Draft merged; retrieve the Target and select a version on its
43
+ * `draft_id`. A `409 target_busy` means the Target is publishing; wait and retry. A `409
44
+ * version_occupied` means the version is already released; retrieve the Draft and releases,
45
+ * choose a new version, and retry.
46
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
47
+ * and If-Match.
48
+ * `PATCH /drafts/{draft_id}`
49
+ */
50
+ update(draftId: DraftId, body: DraftUpdateRequest, params?: DraftsUpdateParams, options?: RequestOptions): Promise<DraftResponseRead>;
51
+ /**
52
+ * List customized and conflicted files on a Draft
53
+ *
54
+ * Lists the Draft's files that differ from the last merged package or need a conflict decision,
55
+ * ordered by path, without file content. Each conflict names its kind, the saved decision, and
56
+ * the sides you can read with getFile. With `filter=history`, lists files affected by a
57
+ * default-branch history rewrite; the list is empty when none is pending.
58
+ *
59
+ * Returns `409 resource_changed` while Typeship is carrying the Draft's latest commit forward
60
+ * (status working), or when the Draft changes between pages.
61
+ *
62
+ * Auto-paginates: `for await (const item of …)` walks every page.
63
+ * `GET /drafts/{draft_id}/files`
64
+ */
65
+ listFiles(draftId: DraftId, params?: DraftsListFilesParams, options?: RequestOptions): PagePromise<DraftFileRead, DraftsListFilesError>;
66
+ /**
67
+ * Resolve selected Draft files
68
+ *
69
+ * Resolves conflicts on the Draft's head_sha: keep yours or generated, or supply final content as
70
+ * text or, for binary files, base64. Choosing generated for a customized path replaces it with
71
+ * the generated file, or deletes a Draft-only file.
72
+ *
73
+ * Conflict decisions are saved together and can be replaced until applied. Choosing generated for
74
+ * customized paths commits those changes together on the Draft branch. Returns the Draft. When
75
+ * every conflict has a decision, `conflicts.decided` equals `conflicts.total` and Typeship
76
+ * continues the Draft and runs checks. Paths that already match the Draft change nothing.
77
+ * `POST /drafts/{draft_id}/resolve`
78
+ */
79
+ resolve(draftId: DraftId, body: DraftResolveRequest, options?: RequestOptions): Promise<DraftResponseRead>;
80
+ /**
81
+ * Approve recovery from rewritten default-branch history
82
+ *
83
+ * When the Draft has status `action_required` and reason `history_rewritten`, review affected
84
+ * files with `listDraftFiles` and `filter=history`, then approve with the Draft's
85
+ * `history_recovery` revisions. Approval saves the recovery without changing Git and returns the
86
+ * Draft; the next generation rebuilds it from the rewritten default branch. The previous Draft
87
+ * branch stays available, and overlapping code comes back as conflicts to resolve. A rewritten
88
+ * Draft branch alone needs no approval.
89
+ * `POST /drafts/{draft_id}/recover`
90
+ */
91
+ recover(draftId: DraftId, body: DraftRecoverRequest, options?: RequestOptions): Promise<DraftResponseRead>;
92
+ }
93
+ export interface DraftsListParams {
94
+ /**
95
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
96
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
97
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
98
+ * return 400 query_param_invalid.
99
+ */
100
+ limit?: number;
101
+ /**
102
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
103
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
104
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
105
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
106
+ * change between requests.
107
+ */
108
+ cursor?: string;
109
+ /** Only Drafts of this Target. */
110
+ targetId?: TargetId;
111
+ /** Only Drafts with this status. */
112
+ status?: DraftStatus;
113
+ }
114
+ /** Typed errors `list` can throw. */
115
+ export type DraftsListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
116
+ /** Typed errors `get` can throw. */
117
+ export type DraftsGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
118
+ export interface DraftsUpdateParams {
119
+ /**
120
+ * ETag from a preceding response. The write applies only if the resource still has that version;
121
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
122
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
123
+ */
124
+ ifMatch?: string;
125
+ }
126
+ /** Typed errors `update` can throw. */
127
+ export type DraftsUpdateError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | ConflictError | PreconditionFailedError | UnprocessableEntityError | RateLimitedError | InternalServerError | BadGatewayError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
128
+ export interface DraftsListFilesParams {
129
+ /**
130
+ * conflicted: conflicts only. customized: files that differ from the last merged package.
131
+ * history: files affected by a default-branch history rewrite. Omit for conflicted and customized
132
+ * files.
133
+ */
134
+ filter?: "conflicted" | "customized" | "history";
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
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
139
+ * return 400 query_param_invalid.
140
+ */
141
+ limit?: number;
142
+ /**
143
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
144
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
145
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
146
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
147
+ * change between requests.
148
+ */
149
+ cursor?: string;
150
+ }
151
+ /** Typed errors `listFiles` can throw. */
152
+ export type DraftsListFilesError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | ConflictError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
153
+ /** Typed errors `resolve` can throw. */
154
+ export type DraftsResolveError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | ConflictError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
155
+ /** Typed errors `recover` can throw. */
156
+ export type DraftsRecoverError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | ConflictError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
157
+ //# sourceMappingURL=drafts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"drafts.d.ts","sourceRoot":"","sources":["../../src/resources/drafts.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,230 @@
1
+ // typeship — drafts resource.
2
+ // Generated by typeship — https://typeship.dev
3
+ import { paginate } from "../core/pagination.js";
4
+ import { BadGatewayError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError, UnprocessableEntityError, } from "../errors.js";
5
+ export class DraftsResource {
6
+ _core;
7
+ constructor(_core) {
8
+ this._core = _core;
9
+ }
10
+ /**
11
+ * List Drafts
12
+ *
13
+ * Lists open and merged Drafts, newest first. Each Target has one open Draft; each merge adds a
14
+ * merged Draft.
15
+ *
16
+ * Auto-paginates: `for await (const item of …)` walks every page.
17
+ * `GET /drafts`
18
+ */
19
+ list(params, options) {
20
+ return paginate(this._core, {
21
+ method: "GET",
22
+ path: "/drafts",
23
+ security: [{ "apiKey": [] }],
24
+ query: {
25
+ limit: params?.limit,
26
+ cursor: params?.cursor,
27
+ target_id: params?.targetId,
28
+ status: params?.status,
29
+ },
30
+ errors: {
31
+ "400": BadRequestError,
32
+ "401": UnauthorizedError,
33
+ "403": ForbiddenError,
34
+ "404": NotFoundError,
35
+ "429": RateLimitedError,
36
+ "500": InternalServerError,
37
+ },
38
+ idempotent: true,
39
+ schemaKey: "drafts.list",
40
+ options,
41
+ }, {
42
+ style: "cursor",
43
+ itemsField: "data",
44
+ cursorParam: "cursor",
45
+ nextCursorField: "next_cursor",
46
+ hasMoreField: "has_more",
47
+ limitParam: "limit",
48
+ });
49
+ }
50
+ /**
51
+ * Get a Draft
52
+ *
53
+ * Returns the Draft's status. An open Draft also reports its typed reason when action is
54
+ * required, next version and its source, readiness, checks, and conflict counts. The response
55
+ * carries an `ETag`; send it in `If-Match` when updating the Draft to avoid changing a newer
56
+ * version selection.
57
+ * `GET /drafts/{draft_id}`
58
+ */
59
+ async get(draftId, options) {
60
+ return this._core.requestData({
61
+ method: "GET",
62
+ path: `/drafts/${encodeURIComponent(String(draftId))}`,
63
+ security: [{ "apiKey": [] }],
64
+ errors: {
65
+ "401": UnauthorizedError,
66
+ "403": ForbiddenError,
67
+ "404": NotFoundError,
68
+ "429": RateLimitedError,
69
+ "500": InternalServerError,
70
+ },
71
+ idempotent: true,
72
+ schemaKey: "drafts.get",
73
+ options,
74
+ });
75
+ }
76
+ /**
77
+ * Select an exact Draft version or return to automatic versioning
78
+ *
79
+ * Checks your version choice against the required version bump, then regenerates the existing
80
+ * Draft pull request.
81
+ *
82
+ * Send the Draft's `ETag` in `If-Match` to reject an intervening change with 412
83
+ * precondition_failed before saving or regenerating. Omitting `If-Match` applies the selection to
84
+ * the current Draft. version_next is required; null restores automatic selection.
85
+ *
86
+ * A `502` response means the selected version was saved, but regeneration failed. Follow the
87
+ * error's retryable and suggested_action fields. Repeating an unfinished selection resumes
88
+ * generation; repeating a completed selection starts no new work. If using If-Match, retrieve the
89
+ * Draft and confirm the saved selection before retrying with its current ETag.
90
+ * A `409 draft_merged` means the Draft merged; retrieve the Target and select a version on its
91
+ * `draft_id`. A `409 target_busy` means the Target is publishing; wait and retry. A `409
92
+ * version_occupied` means the version is already released; retrieve the Draft and releases,
93
+ * choose a new version, and retry.
94
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
95
+ * and If-Match.
96
+ * `PATCH /drafts/{draft_id}`
97
+ */
98
+ async update(draftId, body, params, options) {
99
+ return this._core.requestData({
100
+ method: "PATCH",
101
+ path: `/drafts/${encodeURIComponent(String(draftId))}`,
102
+ security: [{ "apiKey": [] }],
103
+ headers: {
104
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
105
+ },
106
+ body,
107
+ errors: {
108
+ "400": BadRequestError,
109
+ "401": UnauthorizedError,
110
+ "403": ForbiddenError,
111
+ "404": NotFoundError,
112
+ "409": ConflictError,
113
+ "412": PreconditionFailedError,
114
+ "422": UnprocessableEntityError,
115
+ "429": RateLimitedError,
116
+ "500": InternalServerError,
117
+ "502": BadGatewayError,
118
+ },
119
+ schemaKey: "drafts.update",
120
+ options,
121
+ });
122
+ }
123
+ /**
124
+ * List customized and conflicted files on a Draft
125
+ *
126
+ * Lists the Draft's files that differ from the last merged package or need a conflict decision,
127
+ * ordered by path, without file content. Each conflict names its kind, the saved decision, and
128
+ * the sides you can read with getFile. With `filter=history`, lists files affected by a
129
+ * default-branch history rewrite; the list is empty when none is pending.
130
+ *
131
+ * Returns `409 resource_changed` while Typeship is carrying the Draft's latest commit forward
132
+ * (status working), or when the Draft changes between pages.
133
+ *
134
+ * Auto-paginates: `for await (const item of …)` walks every page.
135
+ * `GET /drafts/{draft_id}/files`
136
+ */
137
+ listFiles(draftId, params, options) {
138
+ return paginate(this._core, {
139
+ method: "GET",
140
+ path: `/drafts/${encodeURIComponent(String(draftId))}/files`,
141
+ security: [{ "apiKey": [] }],
142
+ query: {
143
+ filter: params?.filter,
144
+ limit: params?.limit,
145
+ cursor: params?.cursor,
146
+ },
147
+ errors: {
148
+ "400": BadRequestError,
149
+ "401": UnauthorizedError,
150
+ "403": ForbiddenError,
151
+ "404": NotFoundError,
152
+ "409": ConflictError,
153
+ "429": RateLimitedError,
154
+ "500": InternalServerError,
155
+ },
156
+ idempotent: true,
157
+ schemaKey: "drafts.listFiles",
158
+ options,
159
+ }, {
160
+ style: "cursor",
161
+ itemsField: "data",
162
+ cursorParam: "cursor",
163
+ nextCursorField: "next_cursor",
164
+ hasMoreField: "has_more",
165
+ limitParam: "limit",
166
+ });
167
+ }
168
+ /**
169
+ * Resolve selected Draft files
170
+ *
171
+ * Resolves conflicts on the Draft's head_sha: keep yours or generated, or supply final content as
172
+ * text or, for binary files, base64. Choosing generated for a customized path replaces it with
173
+ * the generated file, or deletes a Draft-only file.
174
+ *
175
+ * Conflict decisions are saved together and can be replaced until applied. Choosing generated for
176
+ * customized paths commits those changes together on the Draft branch. Returns the Draft. When
177
+ * every conflict has a decision, `conflicts.decided` equals `conflicts.total` and Typeship
178
+ * continues the Draft and runs checks. Paths that already match the Draft change nothing.
179
+ * `POST /drafts/{draft_id}/resolve`
180
+ */
181
+ async resolve(draftId, body, options) {
182
+ return this._core.requestData({
183
+ method: "POST",
184
+ path: `/drafts/${encodeURIComponent(String(draftId))}/resolve`,
185
+ security: [{ "apiKey": [] }],
186
+ body,
187
+ errors: {
188
+ "400": BadRequestError,
189
+ "401": UnauthorizedError,
190
+ "403": ForbiddenError,
191
+ "404": NotFoundError,
192
+ "409": ConflictError,
193
+ "429": RateLimitedError,
194
+ "500": InternalServerError,
195
+ },
196
+ schemaKey: "drafts.resolve",
197
+ options,
198
+ });
199
+ }
200
+ /**
201
+ * Approve recovery from rewritten default-branch history
202
+ *
203
+ * When the Draft has status `action_required` and reason `history_rewritten`, review affected
204
+ * files with `listDraftFiles` and `filter=history`, then approve with the Draft's
205
+ * `history_recovery` revisions. Approval saves the recovery without changing Git and returns the
206
+ * Draft; the next generation rebuilds it from the rewritten default branch. The previous Draft
207
+ * branch stays available, and overlapping code comes back as conflicts to resolve. A rewritten
208
+ * Draft branch alone needs no approval.
209
+ * `POST /drafts/{draft_id}/recover`
210
+ */
211
+ async recover(draftId, body, options) {
212
+ return this._core.requestData({
213
+ method: "POST",
214
+ path: `/drafts/${encodeURIComponent(String(draftId))}/recover`,
215
+ security: [{ "apiKey": [] }],
216
+ body,
217
+ errors: {
218
+ "400": BadRequestError,
219
+ "401": UnauthorizedError,
220
+ "403": ForbiddenError,
221
+ "404": NotFoundError,
222
+ "409": ConflictError,
223
+ "429": RateLimitedError,
224
+ "500": InternalServerError,
225
+ },
226
+ schemaKey: "drafts.recover",
227
+ options,
228
+ });
229
+ }
230
+ }