@typeship-ax/cli 0.10.0 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (70) hide show
  1. package/AGENTS.md +9 -4
  2. package/README.md +4 -4
  3. package/api.json +4829 -679
  4. package/api.md +387 -91
  5. package/dist/cli-agent.d.ts +5 -5
  6. package/dist/cli-agent.d.ts.map +1 -1
  7. package/dist/cli-agent.js +14 -10
  8. package/dist/cli.js +151 -75
  9. package/dist/core/http.d.ts +3 -2
  10. package/dist/core/http.d.ts.map +1 -1
  11. package/dist/core/http.js +18 -6
  12. package/dist/errors.d.ts +17 -10
  13. package/dist/errors.d.ts.map +1 -1
  14. package/dist/errors.js +24 -15
  15. package/dist/index.d.ts +7 -3
  16. package/dist/index.d.ts.map +1 -1
  17. package/dist/index.js +9 -5
  18. package/dist/ops.d.ts +4 -0
  19. package/dist/ops.d.ts.map +1 -1
  20. package/dist/ops.js +45 -35
  21. package/dist/polling-login.d.ts.map +1 -1
  22. package/dist/polling-login.js +11 -1
  23. package/dist/resources/account.d.ts +4 -4
  24. package/dist/resources/account.d.ts.map +1 -1
  25. package/dist/resources/account.js +10 -5
  26. package/dist/resources/api-keys.d.ts +40 -14
  27. package/dist/resources/api-keys.d.ts.map +1 -1
  28. package/dist/resources/api-keys.js +45 -13
  29. package/dist/resources/definition-revisions.d.ts +35 -18
  30. package/dist/resources/definition-revisions.d.ts.map +1 -1
  31. package/dist/resources/definition-revisions.js +43 -15
  32. package/dist/resources/definitions.d.ts +21 -6
  33. package/dist/resources/definitions.d.ts.map +1 -1
  34. package/dist/resources/definitions.js +16 -3
  35. package/dist/resources/generate.d.ts +44 -15
  36. package/dist/resources/generate.d.ts.map +1 -1
  37. package/dist/resources/generate.js +55 -13
  38. package/dist/resources/generations.d.ts +14 -6
  39. package/dist/resources/generations.d.ts.map +1 -1
  40. package/dist/resources/generations.js +26 -5
  41. package/dist/resources/projects.d.ts +106 -53
  42. package/dist/resources/projects.d.ts.map +1 -1
  43. package/dist/resources/projects.js +78 -31
  44. package/dist/resources/targets.d.ts +240 -40
  45. package/dist/resources/targets.d.ts.map +1 -1
  46. package/dist/resources/targets.js +307 -21
  47. package/dist/schemas.d.ts +1 -0
  48. package/dist/schemas.d.ts.map +1 -1
  49. package/dist/schemas.js +171 -111
  50. package/dist/types.d.ts +1969 -154
  51. package/dist/types.d.ts.map +1 -1
  52. package/dist/types.js +87 -3
  53. package/package.json +3 -3
  54. package/src/cli-agent.ts +17 -13
  55. package/src/cli.ts +138 -70
  56. package/src/core/http.ts +17 -6
  57. package/src/errors.ts +25 -15
  58. package/src/index.ts +9 -5
  59. package/src/ops.ts +49 -35
  60. package/src/polling-login.ts +10 -1
  61. package/src/resources/account.ts +11 -4
  62. package/src/resources/api-keys.ts +84 -13
  63. package/src/resources/definition-revisions.ts +74 -16
  64. package/src/resources/definitions.ts +28 -4
  65. package/src/resources/generate.ts +78 -13
  66. package/src/resources/generations.ts +31 -4
  67. package/src/resources/projects.ts +141 -39
  68. package/src/resources/targets.ts +561 -27
  69. package/src/schemas.ts +172 -112
  70. package/src/types.ts +2105 -154
@@ -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,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAC;IAClE,SAAS,CAA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;AAChF,wBAAsB,gBAAgB,CAAC,MAAM,EAAE,iBAAiB,EAAE,WAAW,EAAE;IAC7E,SAAS,CAAC,KAAK,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACzF,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC1C,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAsD9B;AAED,MAAM,WAAW,kBAAkB;IAAG,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE;AAEjH;kFACkF;AAClF,wBAAsB,qBAAqB,CAAC,MAAM,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,KAAK,CAAA;CAAE,EAAE,WAAW,EAAE;IAC3H,SAAS,CAAC,KAAK,EAAE;QAAE,eAAe,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;IACvE,MAAM,CAAC,EAAE,WAAW,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC1C,GAAG,OAAO,CAAC,kBAAkB,CAAC,CA2C9B"}
@@ -176,7 +176,17 @@ export async function customBrowserApproval(config, interaction) {
176
176
  flow.check();
177
177
  if (Date.now() >= deadline)
178
178
  throw new LoginPollingError("expired");
179
- const result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, deadline - Date.now()));
179
+ let result;
180
+ try {
181
+ result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, deadline - Date.now()));
182
+ }
183
+ catch (error) {
184
+ flow.check();
185
+ if (error instanceof OAuthResponseError && error.code === "timed_out" && Date.now() >= deadline) {
186
+ throw new LoginPollingError("expired");
187
+ }
188
+ throw error;
189
+ }
180
190
  flow.check();
181
191
  if (Date.now() >= deadline)
182
192
  throw new LoginPollingError("expired");
@@ -1,5 +1,5 @@
1
1
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
2
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, ForbiddenError, RateLimitedError, UnauthorizedError } from "../errors.js";
2
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, ForbiddenError, InternalServerError, RateLimitedError, UnauthorizedError } from "../errors.js";
3
3
  import type { AccountRead } from "../types.js";
4
4
  export declare class AccountResource {
5
5
  private readonly _core;
@@ -7,12 +7,12 @@ export declare class AccountResource {
7
7
  /**
8
8
  * The account behind the presented credentials
9
9
  *
10
- * Returns the account that owns the presented API key. This is also the
11
- * identity endpoint the generated typeship CLI's `whoami` calls.
10
+ * Returns the account associated with your credential. The Typeship CLI uses this endpoint for
11
+ * `whoami`.
12
12
  * `GET /me`
13
13
  */
14
14
  retrieve(options?: RequestOptions): Promise<ApiResult<AccountRead, AccountRetrieveError>>;
15
15
  }
16
16
  /** Every error `retrieve` can produce, as a discriminated union. */
17
- export type AccountRetrieveError = UnauthorizedError | ForbiddenError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
17
+ export type AccountRetrieveError = UnauthorizedError | ForbiddenError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
18
18
  //# sourceMappingURL=account.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/resources/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;OAMG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;CAWhG;AAED,oEAAoE;AACpE,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../src/resources/account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAW,WAAW,EAAE,MAAM,aAAa,CAAC;AAExD,qBAAa,eAAe;IACd,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;OAMG;IACG,QAAQ,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,SAAS,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;CAgBhG;AAED,oEAAoE;AACpE,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // typeship — account resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
3
- import { ForbiddenError, RateLimitedError, UnauthorizedError, } from "../errors.js";
2
+ // Generated by typeship — https://typeship.dev
3
+ import { ForbiddenError, InternalServerError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
4
  export class AccountResource {
5
5
  _core;
6
6
  constructor(_core) {
@@ -9,8 +9,8 @@ export class AccountResource {
9
9
  /**
10
10
  * The account behind the presented credentials
11
11
  *
12
- * Returns the account that owns the presented API key. This is also the
13
- * identity endpoint the generated typeship CLI's `whoami` calls.
12
+ * Returns the account associated with your credential. The Typeship CLI uses this endpoint for
13
+ * `whoami`.
14
14
  * `GET /me`
15
15
  */
16
16
  async retrieve(options) {
@@ -18,7 +18,12 @@ export class AccountResource {
18
18
  method: "GET",
19
19
  path: "/me",
20
20
  security: [{ "apiKey": [] }],
21
- errors: { "401": UnauthorizedError, "403": ForbiddenError, "429": RateLimitedError },
21
+ errors: {
22
+ "401": UnauthorizedError,
23
+ "403": ForbiddenError,
24
+ "429": RateLimitedError,
25
+ "500": InternalServerError,
26
+ },
22
27
  idempotent: true,
23
28
  schemaKey: "account.retrieve",
24
29
  options,
@@ -1,6 +1,6 @@
1
1
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
2
2
  import { PagePromise } from "../core/pagination.js";
3
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
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";
5
5
  export declare class ApiKeysResource {
6
6
  private readonly _core;
@@ -8,35 +8,61 @@ export declare class ApiKeysResource {
8
8
  /**
9
9
  * List API keys
10
10
  *
11
- * Keys are never returned in full — only their identity and last four. Creation stays in the
12
- * console deliberately: a leaked key that can mint more keys is a leaked account.
11
+ * Lists key metadata and the last four characters of each key. Full keys are not returned. Create
12
+ * keys in the Console.
13
13
  *
14
14
  * Auto-paginates: `for await (const item of …)` walks every page.
15
- * `GET /api_keys`
15
+ * `GET /api-keys`
16
16
  */
17
17
  list(params?: ApiKeysListParams, options?: RequestOptions): PagePromise<ApiKeyRead, ApiKeysListError>;
18
+ /**
19
+ * Retrieve an API key
20
+ *
21
+ * Returns the key summary and its ETag for conditional revocation.
22
+ * `GET /api-keys/{api_key_id}`
23
+ */
24
+ retrieve(apiKeyId: string, options?: RequestOptions): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRetrieveError>>;
18
25
  /**
19
26
  * Revoke an API key
20
27
  *
21
- * Idempotent: revoking an already-revoked key returns the same body, so a rotation script that
22
- * re-runs does not have to special-case having already succeeded. An OAuth member may revoke a
23
- * key they created; an organization admin may revoke any key. Organization API keys retain
24
- * account-wide authority.
25
- * `DELETE /api_keys/{api_key_id}`
28
+ * Revokes a key. Repeating the request returns the same result.
29
+ *
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.
32
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
33
+ * and If-Match.
34
+ * `DELETE /api-keys/{api_key_id}`
26
35
  */
27
- revoke(apiKeyId: string, options?: RequestOptions): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRevokeError>>;
36
+ revoke(apiKeyId: string, params?: ApiKeysRevokeParams, options?: RequestOptions): Promise<ApiResult<ApiKeyResponseRead, ApiKeysRevokeError>>;
28
37
  }
29
38
  export interface ApiKeysListParams {
30
- /** Maximum number of resources to return. */
39
+ /**
40
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
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.
44
+ */
31
45
  limit?: number;
32
46
  /**
33
47
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
34
- * operation, filters, and ordering that issued it.
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.
35
51
  */
36
52
  cursor?: string;
37
53
  }
38
54
  /** Every error `list` can produce, as a discriminated union. */
39
- export type ApiKeysListError = BadRequestError | UnauthorizedError | ForbiddenError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
55
+ 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;
58
+ export interface ApiKeysRevokeParams {
59
+ /**
60
+ * ETag from a preceding response. The write applies only if the resource still has that version;
61
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
62
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
63
+ */
64
+ ifMatch?: string;
65
+ }
40
66
  /** Every error `revoke` can produce, as a discriminated union. */
41
- export type ApiKeysRevokeError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
67
+ export type ApiKeysRevokeError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | PreconditionFailedError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
42
68
  //# 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,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AkB,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,7 +1,7 @@
1
1
  // typeship — apiKeys resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
  import { paginate } from "../core/pagination.js";
4
- import { BadRequestError, ForbiddenError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
+ import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError, } from "../errors.js";
5
5
  export class ApiKeysResource {
6
6
  _core;
7
7
  constructor(_core) {
@@ -10,16 +10,16 @@ export class ApiKeysResource {
10
10
  /**
11
11
  * List API keys
12
12
  *
13
- * Keys are never returned in full — only their identity and last four. Creation stays in the
14
- * console deliberately: a leaked key that can mint more keys is a leaked account.
13
+ * Lists key metadata and the last four characters of each key. Full keys are not returned. Create
14
+ * keys in the Console.
15
15
  *
16
16
  * Auto-paginates: `for await (const item of …)` walks every page.
17
- * `GET /api_keys`
17
+ * `GET /api-keys`
18
18
  */
19
19
  list(params, options) {
20
20
  return paginate(this._core, {
21
21
  method: "GET",
22
- path: "/api_keys",
22
+ path: "/api-keys",
23
23
  security: [{ "apiKey": [] }],
24
24
  query: {
25
25
  limit: params?.limit,
@@ -30,6 +30,7 @@ export class ApiKeysResource {
30
30
  "401": UnauthorizedError,
31
31
  "403": ForbiddenError,
32
32
  "429": RateLimitedError,
33
+ "500": InternalServerError,
33
34
  },
34
35
  idempotent: true,
35
36
  schemaKey: "apiKeys.list",
@@ -43,25 +44,56 @@ export class ApiKeysResource {
43
44
  limitParam: "limit",
44
45
  });
45
46
  }
47
+ /**
48
+ * Retrieve an API key
49
+ *
50
+ * Returns the key summary and its ETag for conditional revocation.
51
+ * `GET /api-keys/{api_key_id}`
52
+ */
53
+ async retrieve(apiKeyId, options) {
54
+ return this._core.request({
55
+ method: "GET",
56
+ path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
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: "apiKeys.retrieve",
67
+ options,
68
+ });
69
+ }
46
70
  /**
47
71
  * Revoke an API key
48
72
  *
49
- * Idempotent: revoking an already-revoked key returns the same body, so a rotation script that
50
- * re-runs does not have to special-case having already succeeded. An OAuth member may revoke a
51
- * key they created; an organization admin may revoke any key. Organization API keys retain
52
- * account-wide authority.
53
- * `DELETE /api_keys/{api_key_id}`
73
+ * Revokes a key. Repeating the request returns the same result.
74
+ *
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.
77
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
78
+ * and If-Match.
79
+ * `DELETE /api-keys/{api_key_id}`
54
80
  */
55
- async revoke(apiKeyId, options) {
81
+ async revoke(apiKeyId, params, options) {
56
82
  return this._core.request({
57
83
  method: "DELETE",
58
- path: `/api_keys/${encodeURIComponent(String(apiKeyId))}`,
84
+ path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
59
85
  security: [{ "apiKey": [] }],
86
+ headers: {
87
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
88
+ },
60
89
  errors: {
90
+ "400": BadRequestError,
61
91
  "401": UnauthorizedError,
62
92
  "403": ForbiddenError,
63
93
  "404": NotFoundError,
94
+ "412": PreconditionFailedError,
64
95
  "429": RateLimitedError,
96
+ "500": InternalServerError,
65
97
  },
66
98
  idempotent: true,
67
99
  schemaKey: "apiKeys.revoke",
@@ -1,16 +1,15 @@
1
1
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
2
2
  import { PagePromise } from "../core/pagination.js";
3
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
4
- import type { DefinitionDocumentId, DefinitionId, DefinitionRevisionId, DefinitionRevisionRead, DefinitionRevisionResponseRead } from "../types.js";
3
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
4
+ import type { DefinitionDocumentId, DefinitionDocumentResponseRead, DefinitionId, DefinitionRevisionId, DefinitionRevisionRead, DefinitionRevisionResponseRead } from "../types.js";
5
5
  export declare class DefinitionRevisionsResource {
6
6
  private readonly _core;
7
7
  constructor(_core: HttpCore);
8
8
  /**
9
9
  * List Definition Revisions
10
10
  *
11
- * Immutable snapshots of the complete resolved document graph this Definition observed, newest
12
- * first. Content is available from the revision and document endpoints and is never embedded in a
13
- * list response.
11
+ * Lists the Definition's revisions, newest first. Source content is not included; retrieve the
12
+ * revision content or individual documents separately.
14
13
  *
15
14
  * Auto-paginates: `for await (const item of …)` walks every page.
16
15
  * `GET /definitions/{definition_id}/revisions`
@@ -19,40 +18,58 @@ export declare class DefinitionRevisionsResource {
19
18
  /**
20
19
  * Retrieve a Definition Revision
21
20
  *
22
- * Metadata for one immutable resolved document graph. Fetch its canonical content or individual
23
- * source documents from the content endpoints.
24
- * `GET /definition_revisions/{definition_revision_id}`
21
+ * Returns metadata for a saved Definition Revision. Retrieve its resolved content or individual
22
+ * source documents separately.
23
+ * `GET /definition-revisions/{definition_revision_id}`
25
24
  */
26
25
  retrieve(definitionRevisionId: DefinitionRevisionId, options?: RequestOptions): Promise<ApiResult<DefinitionRevisionResponseRead, DefinitionRevisionsRetrieveError>>;
27
26
  /**
28
27
  * Retrieve a Definition Revision's canonical content
29
28
  *
30
- * Returns the exact canonical resolved content identified by the revision's graph digest,
31
- * suitable for saving or piping into a diff.
32
- * `GET /definition_revisions/{definition_revision_id}/content`
29
+ * Returns the saved, resolved content for this revision. Save it locally or compare it with
30
+ * another revision.
31
+ * `GET /definition-revisions/{definition_revision_id}/content`
33
32
  */
34
33
  retrieveContent(definitionRevisionId: DefinitionRevisionId, options?: RequestOptions): Promise<ApiResult<string, DefinitionRevisionsRetrieveContentError>>;
35
34
  /**
36
35
  * Retrieve one source document from a Definition Revision
37
- * `GET /definition_revisions/{definition_revision_id}/documents/{document_id}/content`
36
+ * `GET /definition-revisions/{definition_revision_id}/documents/{document_id}/content`
38
37
  */
39
38
  retrieveDocumentContent(definitionRevisionId: DefinitionRevisionId, documentId: DefinitionDocumentId, options?: RequestOptions): Promise<ApiResult<string, DefinitionRevisionsRetrieveDocumentContentError>>;
39
+ /**
40
+ * Retrieve a Definition Document
41
+ *
42
+ * Returns metadata for one source document captured in a Definition Revision. Retrieve its
43
+ * content through the revision's document content endpoint. A document in another organization
44
+ * returns 404 not_found.
45
+ * `GET /definition-documents/{definition_document_id}`
46
+ */
47
+ retrieveDocument(definitionDocumentId: DefinitionDocumentId, options?: RequestOptions): Promise<ApiResult<DefinitionDocumentResponseRead, DefinitionRevisionsRetrieveDocumentError>>;
40
48
  }
41
49
  export interface DefinitionRevisionsListParams {
42
- /** Maximum number of resources to return. */
50
+ /**
51
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
52
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
53
+ * invalid_request. List query parameters must appear only once; unrecognized parameters also
54
+ * return 400.
55
+ */
43
56
  limit?: number;
44
57
  /**
45
58
  * Opaque cursor from the preceding page's next_cursor. Valid only for the same account,
46
- * operation, filters, and ordering that issued it.
59
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
60
+ * malformed, or repeated cursors return 400 invalid_request. The page limit may change between
61
+ * requests.
47
62
  */
48
63
  cursor?: string;
49
64
  }
50
65
  /** Every error `list` can produce, as a discriminated union. */
51
- export type DefinitionRevisionsListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
66
+ export type DefinitionRevisionsListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
52
67
  /** Every error `retrieve` can produce, as a discriminated union. */
53
- export type DefinitionRevisionsRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
68
+ export type DefinitionRevisionsRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
54
69
  /** Every error `retrieveContent` can produce, as a discriminated union. */
55
- export type DefinitionRevisionsRetrieveContentError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
70
+ export type DefinitionRevisionsRetrieveContentError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
56
71
  /** Every error `retrieveDocumentContent` can produce, as a discriminated union. */
57
- export type DefinitionRevisionsRetrieveDocumentContentError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
72
+ export type DefinitionRevisionsRetrieveDocumentContentError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
73
+ /** Every error `retrieveDocument` can produce, as a discriminated union. */
74
+ export type DefinitionRevisionsRetrieveDocumentError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
58
75
  //# sourceMappingURL=definition-revisions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definition-revisions.d.ts","sourceRoot":"","sources":["../../src/resources/definition-revisions.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,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EAEZ,oBAAoB,EAGpB,sBAAsB,EAEtB,8BAA8B,EAC/B,MAAM,aAAa,CAAC;AAErB,qBAAa,2BAA2B;IAC1B,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;;OASG;IACH,IAAI,CACF,YAAY,EAAE,YAAY,EAC1B,MAAM,CAAC,EAAE,6BAA6B,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,sBAAsB,EAAE,4BAA4B,CAAC;IA6BpE;;;;;;OAMG;IACG,QAAQ,CACZ,oBAAoB,EAAE,oBAAoB,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,8BAA8B,EAAE,gCAAgC,CAAC,CAAC;IAiBvF;;;;;;OAMG;IACG,eAAe,CACnB,oBAAoB,EAAE,oBAAoB,EAC1C,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,uCAAuC,CAAC,CAAC;IAiBtE;;;OAGG;IACG,uBAAuB,CAC3B,oBAAoB,EAAE,oBAAoB,EAC1C,UAAU,EAAE,oBAAoB,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,+CAA+C,CAAC,CAAC;CAgB/E;AAED,MAAM,WAAW,6BAA6B;IAC5C,6CAA6C;IAC7C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,gEAAgE;AAChE,MAAM,MAAM,4BAA4B,GACpC,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,gCAAgC,GACxC,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,2EAA2E;AAC3E,MAAM,MAAM,uCAAuC,GAC/C,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,mFAAmF;AACnF,MAAM,MAAM,+CAA+C,GACvD,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"definition-revisions.d.ts","sourceRoot":"","sources":["../../src/resources/definition-revisions.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,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAA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e,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,oEAAoE;AACpE,MAAM,MAAM,gCAAgC,GACxC,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,2EAA2E;AAC3E,MAAM,MAAM,uCAAuC,GAC/C,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,mFAAmF;AACnF,MAAM,MAAM,+CAA+C,GACvD,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,4EAA4E;AAC5E,MAAM,MAAM,wCAAwC,GAChD,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -1,7 +1,7 @@
1
1
  // typeship — definitionRevisions resource.
2
- // Generated by typeship — https://typeship.dev — do not edit by hand.
2
+ // Generated by typeship — https://typeship.dev
3
3
  import { paginate } from "../core/pagination.js";
4
- import { BadRequestError, ForbiddenError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
+ import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
5
5
  export class DefinitionRevisionsResource {
6
6
  _core;
7
7
  constructor(_core) {
@@ -10,9 +10,8 @@ export class DefinitionRevisionsResource {
10
10
  /**
11
11
  * List Definition Revisions
12
12
  *
13
- * Immutable snapshots of the complete resolved document graph this Definition observed, newest
14
- * first. Content is available from the revision and document endpoints and is never embedded in a
15
- * list response.
13
+ * Lists the Definition's revisions, newest first. Source content is not included; retrieve the
14
+ * revision content or individual documents separately.
16
15
  *
17
16
  * Auto-paginates: `for await (const item of …)` walks every page.
18
17
  * `GET /definitions/{definition_id}/revisions`
@@ -32,6 +31,7 @@ export class DefinitionRevisionsResource {
32
31
  "403": ForbiddenError,
33
32
  "404": NotFoundError,
34
33
  "429": RateLimitedError,
34
+ "500": InternalServerError,
35
35
  },
36
36
  idempotent: true,
37
37
  schemaKey: "definitionRevisions.list",
@@ -48,20 +48,21 @@ export class DefinitionRevisionsResource {
48
48
  /**
49
49
  * Retrieve a Definition Revision
50
50
  *
51
- * Metadata for one immutable resolved document graph. Fetch its canonical content or individual
52
- * source documents from the content endpoints.
53
- * `GET /definition_revisions/{definition_revision_id}`
51
+ * Returns metadata for a saved Definition Revision. Retrieve its resolved content or individual
52
+ * source documents separately.
53
+ * `GET /definition-revisions/{definition_revision_id}`
54
54
  */
55
55
  async retrieve(definitionRevisionId, options) {
56
56
  return this._core.request({
57
57
  method: "GET",
58
- path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}`,
58
+ path: `/definition-revisions/${encodeURIComponent(String(definitionRevisionId))}`,
59
59
  security: [{ "apiKey": [] }],
60
60
  errors: {
61
61
  "401": UnauthorizedError,
62
62
  "403": ForbiddenError,
63
63
  "404": NotFoundError,
64
64
  "429": RateLimitedError,
65
+ "500": InternalServerError,
65
66
  },
66
67
  idempotent: true,
67
68
  schemaKey: "definitionRevisions.retrieve",
@@ -71,20 +72,21 @@ export class DefinitionRevisionsResource {
71
72
  /**
72
73
  * Retrieve a Definition Revision's canonical content
73
74
  *
74
- * Returns the exact canonical resolved content identified by the revision's graph digest,
75
- * suitable for saving or piping into a diff.
76
- * `GET /definition_revisions/{definition_revision_id}/content`
75
+ * Returns the saved, resolved content for this revision. Save it locally or compare it with
76
+ * another revision.
77
+ * `GET /definition-revisions/{definition_revision_id}/content`
77
78
  */
78
79
  async retrieveContent(definitionRevisionId, options) {
79
80
  return this._core.request({
80
81
  method: "GET",
81
- path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}/content`,
82
+ path: `/definition-revisions/${encodeURIComponent(String(definitionRevisionId))}/content`,
82
83
  security: [{ "apiKey": [] }],
83
84
  errors: {
84
85
  "401": UnauthorizedError,
85
86
  "403": ForbiddenError,
86
87
  "404": NotFoundError,
87
88
  "429": RateLimitedError,
89
+ "500": InternalServerError,
88
90
  },
89
91
  idempotent: true,
90
92
  schemaKey: "definitionRevisions.retrieveContent",
@@ -93,22 +95,48 @@ export class DefinitionRevisionsResource {
93
95
  }
94
96
  /**
95
97
  * Retrieve one source document from a Definition Revision
96
- * `GET /definition_revisions/{definition_revision_id}/documents/{document_id}/content`
98
+ * `GET /definition-revisions/{definition_revision_id}/documents/{document_id}/content`
97
99
  */
98
100
  async retrieveDocumentContent(definitionRevisionId, documentId, options) {
99
101
  return this._core.request({
100
102
  method: "GET",
101
- path: `/definition_revisions/${encodeURIComponent(String(definitionRevisionId))}/documents/${encodeURIComponent(String(documentId))}/content`,
103
+ path: `/definition-revisions/${encodeURIComponent(String(definitionRevisionId))}/documents/${encodeURIComponent(String(documentId))}/content`,
102
104
  security: [{ "apiKey": [] }],
103
105
  errors: {
104
106
  "401": UnauthorizedError,
105
107
  "403": ForbiddenError,
106
108
  "404": NotFoundError,
107
109
  "429": RateLimitedError,
110
+ "500": InternalServerError,
108
111
  },
109
112
  idempotent: true,
110
113
  schemaKey: "definitionRevisions.retrieveDocumentContent",
111
114
  options,
112
115
  });
113
116
  }
117
+ /**
118
+ * Retrieve a Definition Document
119
+ *
120
+ * Returns metadata for one source document captured in a Definition Revision. Retrieve its
121
+ * content through the revision's document content endpoint. A document in another organization
122
+ * returns 404 not_found.
123
+ * `GET /definition-documents/{definition_document_id}`
124
+ */
125
+ async retrieveDocument(definitionDocumentId, options) {
126
+ return this._core.request({
127
+ method: "GET",
128
+ path: `/definition-documents/${encodeURIComponent(String(definitionDocumentId))}`,
129
+ security: [{ "apiKey": [] }],
130
+ errors: {
131
+ "401": UnauthorizedError,
132
+ "403": ForbiddenError,
133
+ "404": NotFoundError,
134
+ "429": RateLimitedError,
135
+ "500": InternalServerError,
136
+ },
137
+ idempotent: true,
138
+ schemaKey: "definitionRevisions.retrieveDocument",
139
+ options,
140
+ });
141
+ }
114
142
  }
@@ -1,5 +1,5 @@
1
1
  import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
2
- import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ConflictError, ForbiddenError, NotFoundError, RateLimitedError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
2
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PreconditionFailedError, RateLimitedError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
3
3
  import type { DefinitionId, DefinitionRead, DefinitionUpdateRequest } from "../types.js";
4
4
  export declare class DefinitionsResource {
5
5
  private readonly _core;
@@ -12,7 +12,16 @@ export declare class DefinitionsResource {
12
12
  /**
13
13
  * Update and resolve a Definition
14
14
  *
15
- * Resolves the complete document graph and records a new immutable revision before saving.
15
+ * Resolves the source documents before saving the update and records a new Definition Revision
16
+ * when the source changes.
17
+ * Omitted fields remain unchanged; supplied objects and arrays replace the whole field.
18
+ * If the Definition or its Project configuration changes during validation, returns 409
19
+ * definition_changed without saving the rejected update. Retrieve the current Definition and
20
+ * Project, reconcile your changes,
21
+ * and submit a new request with a new Idempotency-Key if using one.
22
+ *
23
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
24
+ * and If-Match.
16
25
  *
17
26
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
18
27
  * `PATCH /definitions/{definition_id}`
@@ -20,16 +29,22 @@ export declare class DefinitionsResource {
20
29
  update(definitionId: DefinitionId, body: DefinitionUpdateRequest, params?: DefinitionsUpdateParams, options?: RequestOptions): Promise<ApiResult<DefinitionRead, DefinitionsUpdateError>>;
21
30
  }
22
31
  /** Every error `retrieve` can produce, as a discriminated union. */
23
- export type DefinitionsRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
32
+ export type DefinitionsRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
24
33
  export interface DefinitionsUpdateParams {
34
+ /**
35
+ * ETag from a preceding response. The write applies only if the resource still has that version;
36
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
37
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
38
+ */
39
+ ifMatch?: string;
25
40
  /**
26
41
  * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
27
42
  * operation; account-less generation uses a hashed network identity. Retrying the same method,
28
- * path, query, and JSON body replays the original response. Reusing the key with changed intent
29
- * returns 409. After expiry the key starts a new write.
43
+ * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
44
+ * changed intent returns 409. After expiry the key starts a new write.
30
45
  */
31
46
  idempotencyKey?: string;
32
47
  }
33
48
  /** Every error `update` can produce, as a discriminated union. */
34
- export type DefinitionsUpdateError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | ConflictError | UnprocessableEntityError | RateLimitedError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
49
+ export type DefinitionsUpdateError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | ConflictError | PreconditionFailedError | UnprocessableEntityError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
35
50
  //# sourceMappingURL=definitions.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/resources/definitions.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChF,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,aAAa,EACb,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAEV,YAAY,EACZ,cAAc,EACd,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAErB,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;OAGG;IACG,QAAQ,CACZ,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,wBAAwB,CAAC,CAAC;IAiB/D;;;;;;;OAOG;IACG,MAAM,CACV,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,uBAAuB,EAC7B,MAAM,CAAC,EAAE,uBAAuB,EAChC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,cAAc,EAAE,sBAAsB,CAAC,CAAC;CAuB9D;AAED,oEAAoE;AACpE,MAAM,MAAM,wBAAwB,GAChC,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,uBAAuB;IACtC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,kEAAkE;AAClE,MAAM,MAAM,sBAAsB,GAC9B,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,aAAa,GACb,wBAAwB,GACxB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../src/resources/definitions.ts"],"names":[],"mappings":"AAGA,OAAO,E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