@typeship-ax/cli 0.22.0 → 0.24.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 (146) hide show
  1. package/AGENTS.md +13 -9
  2. package/README.md +14 -27
  3. package/api.json +8898 -9026
  4. package/api.md +370 -328
  5. package/dist/arguments.d.ts +54 -0
  6. package/dist/arguments.d.ts.map +1 -0
  7. package/dist/arguments.js +265 -0
  8. package/dist/cli-agent.d.ts +73 -9
  9. package/dist/cli-agent.d.ts.map +1 -1
  10. package/dist/cli-agent.js +331 -44
  11. package/dist/cli.js +802 -291
  12. package/dist/core/http.d.ts +162 -19
  13. package/dist/core/http.d.ts.map +1 -1
  14. package/dist/core/http.js +381 -48
  15. package/dist/core/pagination.d.ts +42 -6
  16. package/dist/core/pagination.d.ts.map +1 -1
  17. package/dist/core/pagination.js +111 -17
  18. package/dist/credential-storage.d.ts +10 -3
  19. package/dist/credential-storage.d.ts.map +1 -1
  20. package/dist/credential-storage.js +15 -6
  21. package/dist/dates.d.ts +1 -1
  22. package/dist/dates.js +1 -1
  23. package/dist/errors.d.ts +20 -84
  24. package/dist/errors.d.ts.map +1 -1
  25. package/dist/errors.js +20 -108
  26. package/dist/fields.d.ts +36 -0
  27. package/dist/fields.d.ts.map +1 -0
  28. package/dist/fields.js +187 -0
  29. package/dist/index.d.ts +28 -18
  30. package/dist/index.d.ts.map +1 -1
  31. package/dist/index.js +35 -25
  32. package/dist/named-credentials.d.ts +19 -0
  33. package/dist/named-credentials.d.ts.map +1 -1
  34. package/dist/named-credentials.js +81 -1
  35. package/dist/oauth-login.d.ts +8 -2
  36. package/dist/oauth-login.d.ts.map +1 -1
  37. package/dist/oauth-login.js +31 -19
  38. package/dist/oauth-request.d.ts +7 -1
  39. package/dist/oauth-request.d.ts.map +1 -1
  40. package/dist/oauth-request.js +26 -4
  41. package/dist/oauth-session.d.ts +13 -1
  42. package/dist/oauth-session.d.ts.map +1 -1
  43. package/dist/oauth-session.js +34 -18
  44. package/dist/ops.d.ts +58 -5
  45. package/dist/ops.d.ts.map +1 -1
  46. package/dist/ops.js +110 -41
  47. package/dist/polling-login.d.ts +8 -2
  48. package/dist/polling-login.d.ts.map +1 -1
  49. package/dist/polling-login.js +25 -11
  50. package/dist/resources/api-keys.d.ts +10 -7
  51. package/dist/resources/api-keys.d.ts.map +1 -1
  52. package/dist/resources/api-keys.js +10 -31
  53. package/dist/resources/deliveries.d.ts +89 -5
  54. package/dist/resources/deliveries.d.ts.map +1 -1
  55. package/dist/resources/deliveries.js +96 -19
  56. package/dist/resources/drafts.d.ts +16 -16
  57. package/dist/resources/drafts.d.ts.map +1 -1
  58. package/dist/resources/drafts.js +12 -65
  59. package/dist/resources/files.d.ts +4 -4
  60. package/dist/resources/files.d.ts.map +1 -1
  61. package/dist/resources/files.js +3 -12
  62. package/dist/resources/generations.d.ts +16 -16
  63. package/dist/resources/generations.d.ts.map +1 -1
  64. package/dist/resources/generations.js +23 -47
  65. package/dist/resources/organization.d.ts +4 -4
  66. package/dist/resources/organization.d.ts.map +1 -1
  67. package/dist/resources/organization.js +3 -10
  68. package/dist/resources/{generate.d.ts → packages.d.ts} +16 -16
  69. package/dist/resources/packages.d.ts.map +1 -0
  70. package/dist/resources/{generate.js → packages.js} +13 -29
  71. package/dist/resources/projects.d.ts +50 -50
  72. package/dist/resources/projects.d.ts.map +1 -1
  73. package/dist/resources/projects.js +60 -116
  74. package/dist/resources/releases.d.ts +22 -17
  75. package/dist/resources/releases.d.ts.map +1 -1
  76. package/dist/resources/releases.js +19 -40
  77. package/dist/resources/spec-revisions.d.ts +16 -7
  78. package/dist/resources/spec-revisions.d.ts.map +1 -1
  79. package/dist/resources/spec-revisions.js +7 -29
  80. package/dist/resources/specs.d.ts +7 -7
  81. package/dist/resources/specs.d.ts.map +1 -1
  82. package/dist/resources/specs.js +6 -34
  83. package/dist/resources/targets.d.ts +49 -49
  84. package/dist/resources/targets.d.ts.map +1 -1
  85. package/dist/resources/targets.js +59 -115
  86. package/dist/schemas.d.ts.map +1 -1
  87. package/dist/schemas.js +83 -81
  88. package/dist/search.d.ts +54 -0
  89. package/dist/search.d.ts.map +1 -0
  90. package/dist/search.js +421 -0
  91. package/dist/table.d.ts +28 -0
  92. package/dist/table.d.ts.map +1 -0
  93. package/dist/table.js +167 -0
  94. package/dist/type-docs.d.ts +61 -0
  95. package/dist/type-docs.d.ts.map +1 -0
  96. package/dist/type-docs.js +174 -0
  97. package/dist/types.d.ts +499 -339
  98. package/dist/types.d.ts.map +1 -1
  99. package/dist/types.js +18 -18
  100. package/package.json +5 -2
  101. package/src/arguments.ts +254 -0
  102. package/src/cli-agent.ts +351 -46
  103. package/src/cli.ts +753 -266
  104. package/src/core/http.ts +457 -58
  105. package/src/core/pagination.ts +129 -18
  106. package/src/credential-storage.ts +16 -6
  107. package/src/dates.ts +1 -1
  108. package/src/errors.ts +46 -115
  109. package/src/fields.ts +167 -0
  110. package/src/index.ts +45 -28
  111. package/src/named-credentials.ts +66 -1
  112. package/src/oauth-login.ts +36 -21
  113. package/src/oauth-request.ts +32 -6
  114. package/src/oauth-session.ts +37 -19
  115. package/src/ops.ts +146 -45
  116. package/src/polling-login.ts +24 -11
  117. package/src/resources/api-keys.ts +34 -48
  118. package/src/resources/deliveries.ts +213 -32
  119. package/src/resources/drafts.ts +62 -109
  120. package/src/resources/files.ts +19 -20
  121. package/src/resources/generations.ts +61 -79
  122. package/src/resources/organization.ts +11 -16
  123. package/src/resources/{generate.ts → packages.ts} +43 -51
  124. package/src/resources/projects.ts +145 -200
  125. package/src/resources/releases.ts +50 -67
  126. package/src/resources/spec-revisions.ts +40 -49
  127. package/src/resources/specs.ts +39 -59
  128. package/src/resources/targets.ts +144 -194
  129. package/src/schemas.ts +83 -81
  130. package/src/search.ts +434 -0
  131. package/src/table.ts +167 -0
  132. package/src/type-docs.ts +205 -0
  133. package/src/types.ts +538 -357
  134. package/dist/console-login-check.d.ts +0 -21
  135. package/dist/console-login-check.d.ts.map +0 -1
  136. package/dist/console-login-check.js +0 -107
  137. package/dist/console-login-contract.d.ts +0 -45
  138. package/dist/console-login-contract.d.ts.map +0 -1
  139. package/dist/console-login-contract.js +0 -40
  140. package/dist/resources/generate.d.ts.map +0 -1
  141. package/dist/resources/publications.d.ts +0 -47
  142. package/dist/resources/publications.d.ts.map +0 -1
  143. package/dist/resources/publications.js +0 -70
  144. package/src/console-login-check.ts +0 -88
  145. package/src/console-login-contract.ts +0 -65
  146. package/src/resources/publications.ts +0 -140
@@ -1,8 +1,14 @@
1
1
  export declare class LoginPollingError extends Error {
2
- readonly code: "cancelled" | "expired" | "denied" | "invalid_response" | "request_failed";
3
- constructor(code: "cancelled" | "expired" | "denied" | "invalid_response" | "request_failed");
2
+ readonly code: "cancelled" | "expired" | "denied" | "consumed" | "invalid_response" | "request_failed";
3
+ /** The provider's own `error: error_description`, when it sent one. */
4
+ readonly providerError?: string;
5
+ constructor(code: "cancelled" | "expired" | "denied" | "consumed" | "invalid_response" | "request_failed", providerError?: string);
4
6
  }
5
7
  export declare function loginEndpoint(value: string): URL;
8
+ /** Neither the API Spec nor the provider's metadata declares a device endpoint. */
9
+ export declare class DeviceFlowUnavailableError extends Error {
10
+ constructor();
11
+ }
6
12
  export interface DeviceLoginConfig {
7
13
  clientId: string;
8
14
  issuer?: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"polling-login.d.ts","sourceRoot":"","sources":["../src/polling-login.ts"],"names":[],"mappings":"AAGA,qBAAa,iBAAkB,SAAQ,KAAK;IAC9B,QAAQ,CAAC,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,kBAAkB,GAAG,gBAAgB;gBAAhF,IAAI,EAAE,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,kBAAkB,GAAG,gBAAgB;CAItG;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,GAAG,CAQhD;AAkCD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAA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"node:crypto";
2
2
  import { oauthJsonRequest, oauthDeviceRequest, OAuthResponseError } from "./oauth-request.js";
3
3
  export class LoginPollingError extends Error {
4
4
  code;
5
- constructor(code) {
6
- super({ cancelled: "Login was cancelled.", expired: "Login expired. Run login again and approve the new request.", denied: "Login was denied. Run login again if you want to retry.", invalid_response: "The login service returned an invalid response. Check its configuration.", request_failed: "The login request failed. Check the service and start a new login." }[code]);
5
+ /** The provider's own `error: error_description`, when it sent one. */
6
+ providerError;
7
+ constructor(code, providerError) {
8
+ super((providerError ? "The provider returned " + providerError + ". " : "") + { cancelled: "Login was cancelled.", expired: "Login expired. Run login again and approve the new request.", denied: "Login was denied. Run login again if you want to retry.", consumed: "This approval was already used. Run login again.", invalid_response: "The login service returned an invalid response. Check its configuration.", request_failed: "The login request failed. Check the service and start a new login." }[code]);
7
9
  this.code = code;
8
10
  this.name = "LoginPollingError";
11
+ if (providerError)
12
+ this.providerError = providerError;
9
13
  }
10
14
  }
11
15
  export function loginEndpoint(value) {
@@ -60,6 +64,10 @@ async function pause(ms, signal) {
60
64
  });
61
65
  }
62
66
  const form = (params, signal) => ({ method: "POST", headers: { "Content-Type": "application/x-www-form-urlencoded", Accept: "application/json" }, body: new URLSearchParams(params), signal });
67
+ /** Neither the API Spec nor the provider's metadata declares a device endpoint. */
68
+ export class DeviceFlowUnavailableError extends Error {
69
+ constructor() { super("This provider does not declare device authorization. Use browser login instead."); this.name = "DeviceFlowUnavailableError"; }
70
+ }
63
71
  /** RFC 8628: pending and slow_down are the only responses that keep polling.
64
72
  * All deadlines include response bodies; cancellation also interrupts waits. */
65
73
  export async function oauthDeviceLogin(config, interaction) {
@@ -90,12 +98,12 @@ export async function oauthDeviceLogin(config, interaction) {
90
98
  revocationUrl = loginEndpoint(data.revocation_endpoint).href;
91
99
  }
92
100
  if (!deviceUrl || !tokenUrl)
93
- throw new LoginPollingError("invalid_response");
101
+ throw new DeviceFlowUnavailableError();
94
102
  const params = { ...(config.audience ? { audience: config.audience } : {}), ...(config.resource ? { resource: config.resource } : {}) };
95
103
  const start = await oauthJsonRequest(deviceUrl, form({ client_id: config.clientId, ...(config.scopes.length ? { scope: config.scopes.join(" ") } : {}), ...params }, flow.signal));
96
104
  const data = start.data;
97
105
  if (start.status !== 200)
98
- throw new LoginPollingError("request_failed");
106
+ throw new LoginPollingError("request_failed", start.providerError);
99
107
  if (!data || !text(data.device_code) || !text(data.user_code, 512) || !text(data.verification_uri, 8192) || !seconds(data.expires_in))
100
108
  throw new LoginPollingError("invalid_response");
101
109
  loginEndpoint(data.verification_uri);
@@ -106,11 +114,14 @@ export async function oauthDeviceLogin(config, interaction) {
106
114
  while (true) {
107
115
  await pause(Math.min(intervalMs, Math.max(0, deadline - Date.now())), flow.signal);
108
116
  flow.check();
109
- if (Date.now() >= deadline)
117
+ // One reading of the clock: a request budget of zero or less is the
118
+ // login expiring, not a failed request.
119
+ const remaining = deadline - Date.now();
120
+ if (remaining <= 0)
110
121
  throw new LoginPollingError("expired");
111
122
  let response;
112
123
  try {
113
- response = await oauthDeviceRequest(tokenUrl, form({ ...params, grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: data.device_code, client_id: config.clientId }, flow.signal), Math.min(30_000, deadline - Date.now()));
124
+ response = await oauthDeviceRequest(tokenUrl, form({ ...params, grant_type: "urn:ietf:params:oauth:grant-type:device_code", device_code: data.device_code, client_id: config.clientId }, flow.signal), Math.min(30_000, remaining));
114
125
  }
115
126
  catch (error) {
116
127
  flow.check();
@@ -134,7 +145,7 @@ export async function oauthDeviceLogin(config, interaction) {
134
145
  if (response.status === 400 && response.error === "expired_token")
135
146
  throw new LoginPollingError("expired");
136
147
  if (response.status !== 200)
137
- throw new LoginPollingError("request_failed");
148
+ throw new LoginPollingError("request_failed", response.providerError);
138
149
  const token = response.data;
139
150
  if (!text(token.access_token) || typeof token.token_type !== "string" || token.token_type.toLowerCase() !== "bearer" || token.error !== undefined || token.refresh_token !== undefined && !text(token.refresh_token) || token.expires_in !== undefined && !seconds(token.expires_in) || token.scope !== undefined && typeof token.scope !== "string")
140
151
  throw new LoginPollingError("invalid_response");
@@ -163,7 +174,7 @@ export async function customBrowserApproval(config, interaction) {
163
174
  const post = (body) => ({ method: "POST", headers: { "Content-Type": "application/json", Accept: "application/json" }, body: JSON.stringify(body), signal: flow.signal });
164
175
  const response = await oauthJsonRequest(url + "/start", post({ code_challenge: challenge, name: config.name, source: config.source }), 15_000);
165
176
  if (response.status !== 200)
166
- throw new LoginPollingError("request_failed");
177
+ throw new LoginPollingError("request_failed", response.providerError);
167
178
  const start = response.data;
168
179
  if (!text(start.session) || !text(start.verification_url, 8192) || start.expires_in !== undefined && !seconds(start.expires_in))
169
180
  throw new LoginPollingError("invalid_response");
@@ -174,11 +185,12 @@ export async function customBrowserApproval(config, interaction) {
174
185
  while (true) {
175
186
  await pause(Math.min(intervalMs, Math.max(0, deadline - Date.now())), flow.signal);
176
187
  flow.check();
177
- if (Date.now() >= deadline)
188
+ const remaining = deadline - Date.now();
189
+ if (remaining <= 0)
178
190
  throw new LoginPollingError("expired");
179
191
  let result;
180
192
  try {
181
- result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, deadline - Date.now()));
193
+ result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, remaining));
182
194
  }
183
195
  catch (error) {
184
196
  flow.check();
@@ -191,7 +203,7 @@ export async function customBrowserApproval(config, interaction) {
191
203
  if (Date.now() >= deadline)
192
204
  throw new LoginPollingError("expired");
193
205
  if (result.status !== 200)
194
- throw new LoginPollingError("request_failed");
206
+ throw new LoginPollingError("request_failed", result.providerError);
195
207
  const poll = result.data;
196
208
  if (poll.status === "pending")
197
209
  continue;
@@ -199,6 +211,8 @@ export async function customBrowserApproval(config, interaction) {
199
211
  throw new LoginPollingError("denied");
200
212
  if (poll.status === "expired")
201
213
  throw new LoginPollingError("expired");
214
+ if (poll.status === "consumed")
215
+ throw new LoginPollingError("consumed");
202
216
  if (poll.status !== "complete" || !text(poll.api_key) || poll.key_name !== undefined && !text(poll.key_name, 1024) || poll.org_id !== undefined && !text(poll.org_id, 1024))
203
217
  throw new LoginPollingError("invalid_response");
204
218
  return { api_key: poll.api_key, key_name: typeof poll.key_name === "string" ? poll.key_name : config.name, ...(typeof poll.org_id === "string" ? { org_id: poll.org_id } : {}), revocationUrl: url + "/revoke" };
@@ -1,7 +1,7 @@
1
1
  import { HttpCore, type RequestOptions } from "../core/http.js";
2
2
  import { PagePromise } from "../core/pagination.js";
3
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError } from "../errors.js";
4
- import type { ApiKeyRead, ApiKeyResponseRead } from "../types.js";
3
+ import { RateLimitError, ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, NotFoundError, PreconditionFailedError, ServerError, UnauthorizedError } from "../errors.js";
4
+ import type { ApiKeyRead, ApiKeyResponseRead, ErrorModelRead } from "../types.js";
5
5
  export declare class ApiKeysResource {
6
6
  private readonly _core;
7
7
  constructor(_core: HttpCore);
@@ -25,13 +25,14 @@ export declare class ApiKeysResource {
25
25
  /**
26
26
  * Revoke an API key
27
27
  *
28
- * Revokes a key. Repeating the request returns the same result.
28
+ * Revokes a key immediately. The key stays listed with `status: revoked`. Repeating the request
29
+ * returns the same result.
29
30
  *
30
31
  * With OAuth, members can revoke their own keys; organization admins can revoke any key.
31
32
  * Organization API keys can revoke any key in their organization.
32
33
  * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
33
34
  * and If-Match.
34
- * `DELETE /api-keys/{api_key_id}`
35
+ * `POST /api-keys/{api_key_id}/revoke`
35
36
  */
36
37
  revoke(apiKeyId: string, params?: ApiKeysRevokeParams, options?: RequestOptions): Promise<ApiKeyResponseRead>;
37
38
  }
@@ -51,11 +52,13 @@ export interface ApiKeysListParams {
51
52
  * change between requests.
52
53
  */
53
54
  cursor?: string;
55
+ /** Only keys with this status. */
56
+ status?: "active" | "revoked";
54
57
  }
55
58
  /** Typed errors `list` can throw. */
56
- export type ApiKeysListError = BadRequestError | UnauthorizedError | ForbiddenError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
59
+ export type ApiKeysListError = BadRequestError<ErrorModelRead> | UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
57
60
  /** Typed errors `get` can throw. */
58
- export type ApiKeysGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
61
+ export type ApiKeysGetError = UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
59
62
  export interface ApiKeysRevokeParams {
60
63
  /**
61
64
  * ETag from a preceding response. The write applies only if the resource still has that version;
@@ -65,5 +68,5 @@ export interface ApiKeysRevokeParams {
65
68
  ifMatch?: string;
66
69
  }
67
70
  /** Typed errors `revoke` can throw. */
68
- export type ApiKeysRevokeError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | PreconditionFailedError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
71
+ export type ApiKeysRevokeError = BadRequestError<ErrorModelRead> | UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | PreconditionFailedError | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
69
72
  //# sourceMappingURL=api-keys.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"api-keys.d.ts","sourceRoot":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ClB,cAAc,GACd,eAAe,CAAC"}
@@ -1,7 +1,7 @@
1
- // typeship — apiKeys resource.
2
- // Generated by typeship — https://typeship.dev
1
+ // Typeship — apiKeys resource.
2
+ // Generated by Typeship — https://typeship.dev
3
3
  import { paginate } from "../core/pagination.js";
4
- import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
+ import { PreconditionFailedError, } from "../errors.js";
5
5
  export class ApiKeysResource {
6
6
  _core;
7
7
  constructor(_core) {
@@ -24,13 +24,7 @@ export class ApiKeysResource {
24
24
  query: {
25
25
  limit: params?.limit,
26
26
  cursor: params?.cursor,
27
- },
28
- errors: {
29
- "400": BadRequestError,
30
- "401": UnauthorizedError,
31
- "403": ForbiddenError,
32
- "429": RateLimitedError,
33
- "500": InternalServerError,
27
+ status: params?.status,
34
28
  },
35
29
  idempotent: true,
36
30
  schemaKey: "apiKeys.list",
@@ -55,13 +49,6 @@ export class ApiKeysResource {
55
49
  method: "GET",
56
50
  path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
57
51
  security: [{ "apiKey": [] }],
58
- errors: {
59
- "401": UnauthorizedError,
60
- "403": ForbiddenError,
61
- "404": NotFoundError,
62
- "429": RateLimitedError,
63
- "500": InternalServerError,
64
- },
65
52
  idempotent: true,
66
53
  schemaKey: "apiKeys.get",
67
54
  options,
@@ -70,32 +57,24 @@ export class ApiKeysResource {
70
57
  /**
71
58
  * Revoke an API key
72
59
  *
73
- * Revokes a key. Repeating the request returns the same result.
60
+ * Revokes a key immediately. The key stays listed with `status: revoked`. Repeating the request
61
+ * returns the same result.
74
62
  *
75
63
  * With OAuth, members can revoke their own keys; organization admins can revoke any key.
76
64
  * Organization API keys can revoke any key in their organization.
77
65
  * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
78
66
  * and If-Match.
79
- * `DELETE /api-keys/{api_key_id}`
67
+ * `POST /api-keys/{api_key_id}/revoke`
80
68
  */
81
69
  async revoke(apiKeyId, params, options) {
82
70
  return this._core.requestData({
83
- method: "DELETE",
84
- path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
71
+ method: "POST",
72
+ path: `/api-keys/${encodeURIComponent(String(apiKeyId))}/revoke`,
85
73
  security: [{ "apiKey": [] }],
86
74
  headers: {
87
75
  "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
88
76
  },
89
- errors: {
90
- "400": BadRequestError,
91
- "401": UnauthorizedError,
92
- "403": ForbiddenError,
93
- "404": NotFoundError,
94
- "412": PreconditionFailedError,
95
- "429": RateLimitedError,
96
- "500": InternalServerError,
97
- },
98
- idempotent: true,
77
+ errors: { "412": PreconditionFailedError },
99
78
  schemaKey: "apiKeys.revoke",
100
79
  options,
101
80
  });
@@ -1,10 +1,28 @@
1
1
  import { HttpCore, type RequestOptions } from "../core/http.js";
2
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";
3
+ import { RateLimitError, ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ConflictError, ForbiddenError, NotFoundError, PreconditionFailedError, ServerError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
4
+ import type { DeletedDeliveryRead, DeliveryCreateRequest, DeliveryId, DeliveryRead, DeliveryResponseRead, DeliveryUpdateRequest, ErrorModelRead, TargetId } from "../types.js";
5
5
  export declare class DeliveriesResource {
6
6
  private readonly _core;
7
7
  constructor(_core: HttpCore);
8
+ /**
9
+ * Create a Delivery
10
+ *
11
+ * Adds a repository or hosted MCP Delivery to a Target. A Target has at most one Delivery of each
12
+ * type; a `409 delivery_exists` means it already has one, so update that Delivery instead.
13
+ * With Project auto_generate enabled, adding a Delivery queues the Target's Generation. A queued
14
+ * or running Target reuses that Generation.
15
+ *
16
+ * A `409 delivery_conflict` means another Target owns the requested repository directory. A `409
17
+ * target_busy` means the Target is publishing; wait for it to finish.
18
+ * A `502 follow_up_failed` means the Delivery was saved, but retiring an obsolete review or
19
+ * regenerating the Target failed. Get the Delivery and follow the error's retryable and
20
+ * suggested_action fields.
21
+ *
22
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
23
+ * `POST /deliveries`
24
+ */
25
+ create(body: DeliveryCreateRequest, params?: DeliveriesCreateParams, options?: RequestOptions): Promise<DeliveryResponseRead>;
8
26
  /**
9
27
  * List Deliveries
10
28
  *
@@ -20,7 +38,53 @@ export declare class DeliveriesResource {
20
38
  * `GET /deliveries/{delivery_id}`
21
39
  */
22
40
  get(deliveryId: DeliveryId, options?: RequestOptions): Promise<DeliveryResponseRead>;
41
+ /**
42
+ * Update a Delivery
43
+ *
44
+ * Replaces a repository Delivery's settings. Omitted optional settings reset to their defaults.
45
+ * Hosted MCP Deliveries have no settings to update.
46
+ * With Project auto_generate enabled, changing a Delivery queues the Target's Generation. A
47
+ * queued or running Target reuses that Generation.
48
+ * Omitting If-Match applies the update to the current Delivery; with If-Match, a stale ETag
49
+ * returns 412 precondition_failed without saving.
50
+ *
51
+ * A `409 delivery_conflict` means another Target owns the requested repository directory. A `409
52
+ * target_busy` means the Target is publishing; wait for it to finish.
53
+ * A `502 follow_up_failed` means the Delivery was saved, but retiring an obsolete review or
54
+ * regenerating the Target failed. Get the Delivery and follow the error's retryable and
55
+ * suggested_action fields.
56
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
57
+ * and If-Match.
58
+ * `PATCH /deliveries/{delivery_id}`
59
+ */
60
+ update(deliveryId: DeliveryId, body: DeliveryUpdateRequest, params?: DeliveriesUpdateParams, options?: RequestOptions): Promise<DeliveryResponseRead>;
61
+ /**
62
+ * Delete a Delivery
63
+ *
64
+ * Removes a Delivery from its Target. Removing a repository Delivery retires the Target's open
65
+ * Draft pull request; removing a hosted MCP Delivery stops serving its URL. Recreating the type
66
+ * later allocates a new ID and, for hosted MCP, a new URL.
67
+ *
68
+ * A `409 target_busy` means the Target is publishing; wait for it to finish. A `502
69
+ * follow_up_failed` means the Delivery was removed, but retiring an obsolete review or
70
+ * regenerating the Target failed.
71
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
72
+ * and If-Match.
73
+ * `DELETE /deliveries/{delivery_id}`
74
+ */
75
+ delete(deliveryId: DeliveryId, params?: DeliveriesDeleteParams, options?: RequestOptions): Promise<DeletedDeliveryRead>;
76
+ }
77
+ export interface DeliveriesCreateParams {
78
+ /**
79
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
80
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
81
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
82
+ * the key with changed intent returns 409. After expiry the key starts a new write.
83
+ */
84
+ idempotencyKey?: string;
23
85
  }
86
+ /** Typed errors `create` can throw. */
87
+ export type DeliveriesCreateError = BadRequestError<ErrorModelRead> | UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | ConflictError<ErrorModelRead> | UnprocessableEntityError<ErrorModelRead> | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
24
88
  export interface DeliveriesListParams {
25
89
  /**
26
90
  * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
@@ -38,10 +102,30 @@ export interface DeliveriesListParams {
38
102
  */
39
103
  cursor?: string;
40
104
  /** Only Deliveries of this Target. */
41
- targetId?: TargetId;
105
+ target_id?: TargetId;
42
106
  }
43
107
  /** Typed errors `list` can throw. */
44
- export type DeliveriesListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
108
+ export type DeliveriesListError = BadRequestError<ErrorModelRead> | UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
45
109
  /** Typed errors `get` can throw. */
46
- export type DeliveriesGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
110
+ export type DeliveriesGetError = UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
111
+ export interface DeliveriesUpdateParams {
112
+ /**
113
+ * ETag from a preceding response. The write applies only if the resource still has that version;
114
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
115
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
116
+ */
117
+ ifMatch?: string;
118
+ }
119
+ /** Typed errors `update` can throw. */
120
+ export type DeliveriesUpdateError = BadRequestError<ErrorModelRead> | UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | ConflictError<ErrorModelRead> | PreconditionFailedError | UnprocessableEntityError<ErrorModelRead> | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
121
+ export interface DeliveriesDeleteParams {
122
+ /**
123
+ * ETag from a preceding response. The write applies only if the resource still has that version;
124
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
125
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
126
+ */
127
+ ifMatch?: string;
128
+ }
129
+ /** Typed errors `delete` can throw. */
130
+ export type DeliveriesDeleteError = BadRequestError<ErrorModelRead> | UnauthorizedError<ErrorModelRead> | ForbiddenError<ErrorModelRead> | NotFoundError<ErrorModelRead> | ConflictError<ErrorModelRead> | PreconditionFailedError | RateLimitError<ErrorModelRead> | ServerError<ErrorModelRead> | RateLimitError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
47
131
  //# sourceMappingURL=deliveries.d.ts.map
@@ -1 +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"}
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,cAAc,EACd,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,mBAAmB,EAEnB,qBAAqB,EACrB,UAAU,EAGV,YAAY,EAEZ,oBAAoB,EACpB,qBAAqB,EAErB,cAAc,EACd,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;;;;;;;;;OAgBG;IACG,MAAM,CACV,IAAI,EAAE,qBAAqB,EAC3B,MAAM,CAAC,EAAE,sBAAsB,EAC/B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;IAehC;;;;;OAKG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,YAAY,EAAE,mBAAmB,CAAC;IAuBjD;;;;;;OAMG;IACG,GAAG,CAAC,UAAU,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,c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c,GACd,eAAe,CAAC"}
@@ -1,12 +1,43 @@
1
- // typeship — deliveries resource.
2
- // Generated by typeship — https://typeship.dev
1
+ // Typeship — deliveries resource.
2
+ // Generated by Typeship — https://typeship.dev
3
3
  import { paginate } from "../core/pagination.js";
4
- import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
+ import { PreconditionFailedError, } from "../errors.js";
5
5
  export class DeliveriesResource {
6
6
  _core;
7
7
  constructor(_core) {
8
8
  this._core = _core;
9
9
  }
10
+ /**
11
+ * Create a Delivery
12
+ *
13
+ * Adds a repository or hosted MCP Delivery to a Target. A Target has at most one Delivery of each
14
+ * type; a `409 delivery_exists` means it already has one, so update that Delivery instead.
15
+ * With Project auto_generate enabled, adding a Delivery queues the Target's Generation. A queued
16
+ * or running Target reuses that Generation.
17
+ *
18
+ * A `409 delivery_conflict` means another Target owns the requested repository directory. A `409
19
+ * target_busy` means the Target is publishing; wait for it to finish.
20
+ * A `502 follow_up_failed` means the Delivery was saved, but retiring an obsolete review or
21
+ * regenerating the Target failed. Get the Delivery and follow the error's retryable and
22
+ * suggested_action fields.
23
+ *
24
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
25
+ * `POST /deliveries`
26
+ */
27
+ async create(body, params, options) {
28
+ return this._core.requestData({
29
+ method: "POST",
30
+ path: "/deliveries",
31
+ security: [{ "apiKey": [] }],
32
+ headers: {
33
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
34
+ },
35
+ body,
36
+ idempotencyKey: "Idempotency-Key",
37
+ schemaKey: "deliveries.create",
38
+ options,
39
+ });
40
+ }
10
41
  /**
11
42
  * List Deliveries
12
43
  *
@@ -21,15 +52,7 @@ export class DeliveriesResource {
21
52
  query: {
22
53
  limit: params?.limit,
23
54
  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,
55
+ target_id: params?.target_id,
33
56
  },
34
57
  idempotent: true,
35
58
  schemaKey: "deliveries.list",
@@ -55,16 +78,70 @@ export class DeliveriesResource {
55
78
  method: "GET",
56
79
  path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
57
80
  security: [{ "apiKey": [] }],
58
- errors: {
59
- "401": UnauthorizedError,
60
- "403": ForbiddenError,
61
- "404": NotFoundError,
62
- "429": RateLimitedError,
63
- "500": InternalServerError,
64
- },
65
81
  idempotent: true,
66
82
  schemaKey: "deliveries.get",
67
83
  options,
68
84
  });
69
85
  }
86
+ /**
87
+ * Update a Delivery
88
+ *
89
+ * Replaces a repository Delivery's settings. Omitted optional settings reset to their defaults.
90
+ * Hosted MCP Deliveries have no settings to update.
91
+ * With Project auto_generate enabled, changing a Delivery queues the Target's Generation. A
92
+ * queued or running Target reuses that Generation.
93
+ * Omitting If-Match applies the update to the current Delivery; with If-Match, a stale ETag
94
+ * returns 412 precondition_failed without saving.
95
+ *
96
+ * A `409 delivery_conflict` means another Target owns the requested repository directory. A `409
97
+ * target_busy` means the Target is publishing; wait for it to finish.
98
+ * A `502 follow_up_failed` means the Delivery was saved, but retiring an obsolete review or
99
+ * regenerating the Target failed. Get the Delivery and follow the error's retryable and
100
+ * suggested_action fields.
101
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
102
+ * and If-Match.
103
+ * `PATCH /deliveries/{delivery_id}`
104
+ */
105
+ async update(deliveryId, body, params, options) {
106
+ return this._core.requestData({
107
+ method: "PATCH",
108
+ path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
109
+ security: [{ "apiKey": [] }],
110
+ headers: {
111
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
112
+ },
113
+ body,
114
+ errors: { "412": PreconditionFailedError },
115
+ schemaKey: "deliveries.update",
116
+ options,
117
+ });
118
+ }
119
+ /**
120
+ * Delete a Delivery
121
+ *
122
+ * Removes a Delivery from its Target. Removing a repository Delivery retires the Target's open
123
+ * Draft pull request; removing a hosted MCP Delivery stops serving its URL. Recreating the type
124
+ * later allocates a new ID and, for hosted MCP, a new URL.
125
+ *
126
+ * A `409 target_busy` means the Target is publishing; wait for it to finish. A `502
127
+ * follow_up_failed` means the Delivery was removed, but retiring an obsolete review or
128
+ * regenerating the Target failed.
129
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
130
+ * and If-Match.
131
+ * `DELETE /deliveries/{delivery_id}`
132
+ */
133
+ async delete(deliveryId, params, options) {
134
+ return this._core.requestData({
135
+ method: "DELETE",
136
+ path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
137
+ security: [{ "apiKey": [] }],
138
+ headers: {
139
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
140
+ },
141
+ errors: { "412": PreconditionFailedError },
142
+ idempotent: true,
143
+ schemaKey: "deliveries.delete",
144
+ options,
145
+ });
146
+ }
70
147
  }