@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
@@ -0,0 +1,23 @@
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
3
+ import type { FileId, FileResponseRead } from "../types.js";
4
+ export declare class FilesResource {
5
+ private readonly _core;
6
+ constructor(_core: HttpCore);
7
+ /**
8
+ * Get a file
9
+ *
10
+ * Returns one bounded chunk of an immutable file: at most 24 KiB, as UTF-8 text or, for binary
11
+ * bytes, base64. When next_cursor is not null, repeat the request with cursor and concatenate the
12
+ * chunks in order. A file ID always returns the same bytes.
13
+ * `GET /files/{file_id}`
14
+ */
15
+ get(fileId: FileId, params?: FilesGetParams, options?: RequestOptions): Promise<FileResponseRead>;
16
+ }
17
+ export interface FilesGetParams {
18
+ /** next_cursor from the preceding chunk of this file. */
19
+ cursor?: string;
20
+ }
21
+ /** Typed errors `get` can throw. */
22
+ export type FilesGetError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
23
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../src/resources/files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,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,EAAE,MAAM,EAAgB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1E,qBAAa,aAAa;IACZ,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;OAOG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAqBxG;AAED,MAAM,WAAW,cAAc;IAC7B,yDAAyD;IACzD,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,oCAAoC;AACpC,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -0,0 +1,38 @@
1
+ // typeship — files resource.
2
+ // Generated by typeship — https://typeship.dev
3
+ import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
+ export class FilesResource {
5
+ _core;
6
+ constructor(_core) {
7
+ this._core = _core;
8
+ }
9
+ /**
10
+ * Get a file
11
+ *
12
+ * Returns one bounded chunk of an immutable file: at most 24 KiB, as UTF-8 text or, for binary
13
+ * bytes, base64. When next_cursor is not null, repeat the request with cursor and concatenate the
14
+ * chunks in order. A file ID always returns the same bytes.
15
+ * `GET /files/{file_id}`
16
+ */
17
+ async get(fileId, params, options) {
18
+ return this._core.requestData({
19
+ method: "GET",
20
+ path: `/files/${encodeURIComponent(String(fileId))}`,
21
+ security: [{ "apiKey": [] }],
22
+ query: {
23
+ cursor: params?.cursor,
24
+ },
25
+ errors: {
26
+ "400": BadRequestError,
27
+ "401": UnauthorizedError,
28
+ "403": ForbiddenError,
29
+ "404": NotFoundError,
30
+ "429": RateLimitedError,
31
+ "500": InternalServerError,
32
+ },
33
+ idempotent: true,
34
+ schemaKey: "files.get",
35
+ options,
36
+ });
37
+ }
38
+ }
@@ -1,11 +1,11 @@
1
- import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
2
  import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, ApiResponseError, BadRequestError, ConflictError, ForbiddenError, InternalServerError, NotFoundError, PayloadTooLargeError, RateLimitedError, UnauthorizedError, UnprocessableEntityError } from "../errors.js";
3
3
  import type { GenerateRequest, GenerationResultRead } from "../types.js";
4
4
  export declare class GenerateResource {
5
5
  private readonly _core;
6
6
  constructor(_core: HttpCore);
7
7
  /**
8
- * Generate one package from a Definition
8
+ * Generate one package from a Spec
9
9
  *
10
10
  * Returns one generated package without creating a Project.
11
11
  *
@@ -15,12 +15,12 @@ export declare class GenerateResource {
15
15
  * Use `download.url` to save the complete ZIP, verify `download.sha256`, and extract it into an
16
16
  * empty directory. The link expires at `download.expires_at` and grants access to anyone who has
17
17
  * it. CLI, MCP, and SDK calls supply an idempotency key automatically. Agents should request
18
- * `fields=["download","meta","warnings","limits","claim"]` to keep the MCP result compact; files
19
- * can exceed the response limit. Download the ZIP instead of repeating generation to retrieve
20
- * omitted files.
18
+ * `fields=["download","coverage","warnings","claim"]` to keep the MCP result compact; files can
19
+ * exceed the response limit. Download the ZIP instead of repeating generation to retrieve omitted
20
+ * files.
21
21
  *
22
22
  * Anonymous and Free requests include the first 25 operations. Paid plans include all operations.
23
- * Anonymous requests are rate limited by IP address. Check `limits` for omitted operations; an
23
+ * Anonymous requests are rate limited by IP address. Check `coverage` for omitted operations; an
24
24
  * invalid API key returns `401`.
25
25
  *
26
26
  * An anonymous URL request without source headers may return `claim.url`. Sign in through that
@@ -29,7 +29,7 @@ export declare class GenerateResource {
29
29
  * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
30
30
  * `POST /generate`
31
31
  */
32
- run(body: GenerateRequest, params?: GenerateRunParams, options?: RequestOptions): Promise<ApiResult<GenerationResultRead, GenerateRunError>>;
32
+ run(body: GenerateRequest, params?: GenerateRunParams, options?: RequestOptions): Promise<GenerationResultRead>;
33
33
  /**
34
34
  * Download a generated package
35
35
  *
@@ -43,23 +43,23 @@ export declare class GenerateResource {
43
43
  * creates a new download.
44
44
  * `GET /generate/download`
45
45
  */
46
- downloadPackage(params: GenerateDownloadPackageParams, options?: RequestOptions): Promise<ApiResult<Blob, GenerateDownloadPackageError>>;
46
+ downloadPackage(params: GenerateDownloadPackageParams, options?: RequestOptions): Promise<Blob>;
47
47
  }
48
48
  export interface GenerateRunParams {
49
49
  /**
50
- * Identifies one logical write for 24 hours. The key is scoped to the authenticated account and
51
- * operation; account-less generation uses a hashed network identity. Retrying the same method,
52
- * path, query, If-Match header, and JSON body replays the original response. Reusing the key with
53
- * changed intent returns 409. After expiry the key starts a new write.
50
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
51
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
52
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
53
+ * the key with changed intent returns 409. After expiry the key starts a new write.
54
54
  */
55
55
  idempotencyKey?: string;
56
56
  }
57
- /** Every error `run` can produce, as a discriminated union. */
57
+ /** Typed errors `run` can throw. */
58
58
  export type GenerateRunError = BadRequestError | UnauthorizedError | ForbiddenError | ConflictError | PayloadTooLargeError | UnprocessableEntityError | RateLimitedError | InternalServerError | ApiResponseError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
59
59
  export interface GenerateDownloadPackageParams {
60
60
  /** Private download token from download.url in the generation result. */
61
61
  token: string;
62
62
  }
63
- /** Every error `downloadPackage` can produce, as a discriminated union. */
63
+ /** Typed errors `downloadPackage` can throw. */
64
64
  export type GenerateDownloadPackageError = BadRequestError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
65
65
  //# sourceMappingURL=generate.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/resources/generate.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,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,GAAG,CACP,IAAI,EAAE,eAAe,EACrB,MAAM,CAAC,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,CAAC;IA0B7D;;;;;;;;;;;;OAYG;IACG,eAAe,CACnB,MAAM,EAAE,6BAA6B,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,4BAA4B,CAAC,CAAC;CAmB1D;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,+DAA+D;AAC/D,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,wBAAwB,GACxB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,2EAA2E;AAC3E,MAAM,MAAM,4BAA4B,GACpC,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../src/resources/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,iBAAiB,EACjB,wBAAwB,EACzB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,eAAe,EAAoB,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAE3F,qBAAa,gBAAgB;IACf,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACG,GAAG,CACP,IAAI,EAAE,eAAe,EACrB,MAAM,CAAC,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,oBAAoB,CAAC;IA0BhC;;;;;;;;;;;;OAYG;IACG,eAAe,CAAC,MAAM,EAAE,6BAA6B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;CAmBtG;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oCAAoC;AACpC,MAAM,MAAM,gBAAgB,GACxB,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,oBAAoB,GACpB,wBAAwB,GACxB,gBAAgB,GAChB,mBAAmB,GACnB,gBAAgB,GAChB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C,yEAAyE;IACzE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,gDAAgD;AAChD,MAAM,MAAM,4BAA4B,GACpC,eAAe,GACf,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -7,7 +7,7 @@ export class GenerateResource {
7
7
  this._core = _core;
8
8
  }
9
9
  /**
10
- * Generate one package from a Definition
10
+ * Generate one package from a Spec
11
11
  *
12
12
  * Returns one generated package without creating a Project.
13
13
  *
@@ -17,12 +17,12 @@ export class GenerateResource {
17
17
  * Use `download.url` to save the complete ZIP, verify `download.sha256`, and extract it into an
18
18
  * empty directory. The link expires at `download.expires_at` and grants access to anyone who has
19
19
  * it. CLI, MCP, and SDK calls supply an idempotency key automatically. Agents should request
20
- * `fields=["download","meta","warnings","limits","claim"]` to keep the MCP result compact; files
21
- * can exceed the response limit. Download the ZIP instead of repeating generation to retrieve
22
- * omitted files.
20
+ * `fields=["download","coverage","warnings","claim"]` to keep the MCP result compact; files can
21
+ * exceed the response limit. Download the ZIP instead of repeating generation to retrieve omitted
22
+ * files.
23
23
  *
24
24
  * Anonymous and Free requests include the first 25 operations. Paid plans include all operations.
25
- * Anonymous requests are rate limited by IP address. Check `limits` for omitted operations; an
25
+ * Anonymous requests are rate limited by IP address. Check `coverage` for omitted operations; an
26
26
  * invalid API key returns `401`.
27
27
  *
28
28
  * An anonymous URL request without source headers may return `claim.url`. Sign in through that
@@ -32,7 +32,7 @@ export class GenerateResource {
32
32
  * `POST /generate`
33
33
  */
34
34
  async run(body, params, options) {
35
- return this._core.request({
35
+ return this._core.requestData({
36
36
  method: "POST",
37
37
  path: "/generate",
38
38
  security: [{}, { "apiKey": [] }],
@@ -70,7 +70,7 @@ export class GenerateResource {
70
70
  * `GET /generate/download`
71
71
  */
72
72
  async downloadPackage(params, options) {
73
- return this._core.request({
73
+ return this._core.requestData({
74
74
  method: "GET",
75
75
  path: "/generate/download",
76
76
  security: [{}],
@@ -1,39 +1,85 @@
1
- import { HttpCore, type ApiResult, type RequestOptions } from "../core/http.js";
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { PagePromise } from "../core/pagination.js";
2
3
  import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError } from "../errors.js";
3
- import type { GenerationId, GenerationResponseRead } from "../types.js";
4
+ import type { FileModelRead, GenerationId, GenerationResponseRead, GenerationStatus, GenerationSummaryRead, ProjectId, TargetId } from "../types.js";
4
5
  export declare class GenerationsResource {
5
6
  private readonly _core;
6
7
  constructor(_core: HttpCore);
7
8
  /**
8
- * Retrieve a generation
9
+ * List generations
9
10
  *
10
- * Returns the current Generation status. `queued` and `running` mean generation is still in
11
- * progress. `succeeded` means generated files are saved, not that repository delivery or a Draft
12
- * is complete. Successful results include files, or a file index when the package is too large to
13
- * inline.
11
+ * Auto-paginates: `for await (const item of …)` walks every page.
12
+ * `GET /generations`
13
+ */
14
+ list(params?: GenerationsListParams, options?: RequestOptions): PagePromise<GenerationSummaryRead, GenerationsListError>;
15
+ /**
16
+ * Get a generation
17
+ *
18
+ * Returns the status of that Generation. `queued` and `running` mean generation is still in
19
+ * progress. `completed` means generated files are saved, not that repository delivery or a Draft
20
+ * is complete. List its files with listGenerationFiles and read each with getFile.
14
21
  * `GET /generations/{generation_id}`
15
22
  */
16
- retrieve(generationId: GenerationId, options?: RequestOptions): Promise<ApiResult<GenerationResponseRead, GenerationsRetrieveError>>;
23
+ get(generationId: GenerationId, options?: RequestOptions): Promise<GenerationResponseRead>;
17
24
  /**
18
- * Fetch one file from a generation
25
+ * List a Generation's files
26
+ *
27
+ * Lists the generated package's files, ordered by path. Read content with getFile.
19
28
  *
20
- * Returns one file's raw content. Use a path from `files_index` when the Generation reports
21
- * `files_omitted: true`.
22
- * `GET /generations/{generation_id}/file`
29
+ * Auto-paginates: `for await (const item of …)` walks every page.
30
+ * `GET /generations/{generation_id}/files`
23
31
  */
24
- retrieveFile(generationId: GenerationId, params: GenerationsRetrieveFileParams, options?: RequestOptions): Promise<ApiResult<string, GenerationsRetrieveFileError>>;
32
+ listFiles(generationId: GenerationId, params?: GenerationsListFilesParams, options?: RequestOptions): PagePromise<FileModelRead, GenerationsListFilesError>;
25
33
  /** Poll until files are generated or the Generation fails. */
26
34
  wait(generationId: GenerationId, options?: RequestOptions & {
27
35
  intervalMs?: number;
28
36
  waitTimeoutMs?: number;
29
- }): Promise<ApiResult<GenerationResponseRead, GenerationsRetrieveError>>;
37
+ }): Promise<GenerationResponseRead>;
30
38
  }
31
- /** Every error `retrieve` can produce, as a discriminated union. */
32
- export type GenerationsRetrieveError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
33
- export interface GenerationsRetrieveFileParams {
34
- /** Repo-relative path inside the generated package. */
35
- path: string;
39
+ export interface GenerationsListParams {
40
+ /**
41
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
42
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
43
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
44
+ * return 400 query_param_invalid.
45
+ */
46
+ limit?: number;
47
+ /**
48
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
49
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
50
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
51
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
52
+ * change between requests.
53
+ */
54
+ cursor?: string;
55
+ /** Only Generations in this Project. */
56
+ projectId?: ProjectId;
57
+ /** Only Generations of this Target. */
58
+ targetId?: TargetId;
59
+ /** Only Generations with this status. */
60
+ status?: GenerationStatus;
61
+ }
62
+ /** Typed errors `list` can throw. */
63
+ export type GenerationsListError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
64
+ /** Typed errors `get` can throw. */
65
+ export type GenerationsGetError = UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
66
+ export interface GenerationsListFilesParams {
67
+ /**
68
+ * Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
69
+ * representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
70
+ * input_invalid. List query parameters must appear only once; repeated or unrecognized parameters
71
+ * return 400 query_param_invalid.
72
+ */
73
+ limit?: number;
74
+ /**
75
+ * Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
76
+ * operation, filters, and ordering that issued it. Omit to start at the first page. Empty or
77
+ * malformed cursors, and cursors issued for different filters, return 400 cursor_invalid; start
78
+ * again from the first page. Repeated cursors return 400 query_param_invalid. The page limit may
79
+ * change between requests.
80
+ */
81
+ cursor?: string;
36
82
  }
37
- /** Every error `retrieveFile` can produce, as a discriminated union. */
38
- export type GenerationsRetrieveFileError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
83
+ /** Typed errors `listFiles` can throw. */
84
+ export type GenerationsListFilesError = BadRequestError | UnauthorizedError | ForbiddenError | NotFoundError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
39
85
  //# sourceMappingURL=generations.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"generations.d.ts","sourceRoot":"","sources":["../../src/resources/generations.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,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAE,YAAY,EAAsB,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAE5F,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;;;OAQG;IACG,QAAQ,CACZ,YAAY,EAAE,YAAY,EAC1B,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,wBAAwB,CAAC,CAAC;IAkBvE;;;;;;OAMG;IACG,YAAY,CAChB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,6BAA6B,EACrC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CAAC,SAAS,CAAC,MAAM,EAAE,4BAA4B,CAAC,CAAC;IAsB7D,8DAA8D;IACtD,IAAI,CACR,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,cAAc,GAAG;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7E,OAAO,CAAC,SAAS,CAAC,sBAAsB,EAAE,wBAAwB,CAAC,CAAC;CAcxE;AAED,oEAAoE;AACpE,MAAM,MAAM,wBAAwB,GAChC,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,6BAA6B;IAC5C,uDAAuD;IACvD,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wEAAwE;AACxE,MAAM,MAAM,4BAA4B,GACpC,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
1
+ {"version":3,"file":"generations.d.ts","sourceRoot":"","sources":["../../src/resources/generations.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,EAIV,aAAa,EACb,YAAY,EAIZ,sBAAsB,EACtB,gBAAgB,EAEhB,qBAAqB,EACrB,SAAS,EACT,QAAQ,EACT,MAAM,aAAa,CAAC;AAErB,qBAAa,mBAAmB;IAClB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;OAKG;IACH,IAAI,CACF,MAAM,CAAC,EAAE,qBAAqB,EAC9B,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,qBAAqB,EAAE,oBAAoB,CAAC;IAiC3D;;;;;;;OAOG;IACG,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAkBhG;;;;;;;OAOG;IACH,SAAS,CACP,YAAY,EAAE,YAAY,EAC1B,MAAM,CAAC,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,aAAa,EAAE,yBAAyB,CAAC;IA8B1D,8DAA8D;IACtD,IAAI,CACR,YAAY,EAAE,YAAY,EAC1B,OAAO,GAAE,cAAc,GAAG;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,MAAM,CAAA;KAAO,GAC7E,OAAO,CAAC,sBAAsB,CAAC;CAcnC;AAED,MAAM,WAAW,qBAAqB;IACpC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,yCAAyC;IACzC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,qCAAqC;AACrC,MAAM,MAAM,oBAAoB,GAC5B,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,mBAAmB,GAC3B,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC;AAEpB,MAAM,WAAW,0BAA0B;IACzC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,0CAA0C;AAC1C,MAAM,MAAM,yBAAyB,GACjC,eAAe,GACf,iBAAiB,GACjB,cAAc,GACd,aAAa,GACb,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -1,5 +1,6 @@
1
1
  // typeship — generations resource.
2
2
  // Generated by typeship — https://typeship.dev
3
+ import { paginate } from "../core/pagination.js";
3
4
  import { BadRequestError, ForbiddenError, InternalServerError, NotFoundError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
5
  export class GenerationsResource {
5
6
  _core;
@@ -7,16 +8,53 @@ export class GenerationsResource {
7
8
  this._core = _core;
8
9
  }
9
10
  /**
10
- * Retrieve a generation
11
+ * List generations
11
12
  *
12
- * Returns the current Generation status. `queued` and `running` mean generation is still in
13
- * progress. `succeeded` means generated files are saved, not that repository delivery or a Draft
14
- * is complete. Successful results include files, or a file index when the package is too large to
15
- * inline.
13
+ * Auto-paginates: `for await (const item of …)` walks every page.
14
+ * `GET /generations`
15
+ */
16
+ list(params, options) {
17
+ return paginate(this._core, {
18
+ method: "GET",
19
+ path: "/generations",
20
+ security: [{ "apiKey": [] }],
21
+ query: {
22
+ limit: params?.limit,
23
+ cursor: params?.cursor,
24
+ project_id: params?.projectId,
25
+ target_id: params?.targetId,
26
+ status: params?.status,
27
+ },
28
+ errors: {
29
+ "400": BadRequestError,
30
+ "401": UnauthorizedError,
31
+ "403": ForbiddenError,
32
+ "404": NotFoundError,
33
+ "429": RateLimitedError,
34
+ "500": InternalServerError,
35
+ },
36
+ idempotent: true,
37
+ schemaKey: "generations.list",
38
+ options,
39
+ }, {
40
+ style: "cursor",
41
+ itemsField: "data",
42
+ cursorParam: "cursor",
43
+ nextCursorField: "next_cursor",
44
+ hasMoreField: "has_more",
45
+ limitParam: "limit",
46
+ });
47
+ }
48
+ /**
49
+ * Get a generation
50
+ *
51
+ * Returns the status of that Generation. `queued` and `running` mean generation is still in
52
+ * progress. `completed` means generated files are saved, not that repository delivery or a Draft
53
+ * is complete. List its files with listGenerationFiles and read each with getFile.
16
54
  * `GET /generations/{generation_id}`
17
55
  */
18
- async retrieve(generationId, options) {
19
- return this._core.request({
56
+ async get(generationId, options) {
57
+ return this._core.requestData({
20
58
  method: "GET",
21
59
  path: `/generations/${encodeURIComponent(String(generationId))}`,
22
60
  security: [{ "apiKey": [] }],
@@ -28,24 +66,26 @@ export class GenerationsResource {
28
66
  "500": InternalServerError,
29
67
  },
30
68
  idempotent: true,
31
- schemaKey: "generations.retrieve",
69
+ schemaKey: "generations.get",
32
70
  options,
33
71
  });
34
72
  }
35
73
  /**
36
- * Fetch one file from a generation
74
+ * List a Generation's files
75
+ *
76
+ * Lists the generated package's files, ordered by path. Read content with getFile.
37
77
  *
38
- * Returns one file's raw content. Use a path from `files_index` when the Generation reports
39
- * `files_omitted: true`.
40
- * `GET /generations/{generation_id}/file`
78
+ * Auto-paginates: `for await (const item of …)` walks every page.
79
+ * `GET /generations/{generation_id}/files`
41
80
  */
42
- async retrieveFile(generationId, params, options) {
43
- return this._core.request({
81
+ listFiles(generationId, params, options) {
82
+ return paginate(this._core, {
44
83
  method: "GET",
45
- path: `/generations/${encodeURIComponent(String(generationId))}/file`,
84
+ path: `/generations/${encodeURIComponent(String(generationId))}/files`,
46
85
  security: [{ "apiKey": [] }],
47
86
  query: {
48
- path: params.path,
87
+ limit: params?.limit,
88
+ cursor: params?.cursor,
49
89
  },
50
90
  errors: {
51
91
  "400": BadRequestError,
@@ -56,20 +96,27 @@ export class GenerationsResource {
56
96
  "500": InternalServerError,
57
97
  },
58
98
  idempotent: true,
59
- schemaKey: "generations.retrieveFile",
99
+ schemaKey: "generations.listFiles",
60
100
  options,
101
+ }, {
102
+ style: "cursor",
103
+ itemsField: "data",
104
+ cursorParam: "cursor",
105
+ nextCursorField: "next_cursor",
106
+ hasMoreField: "has_more",
107
+ limitParam: "limit",
61
108
  });
62
109
  }
63
110
  /** Poll until files are generated or the Generation fails. */
64
111
  async wait(generationId, options = {}) {
65
- const { intervalMs = 1_000, waitTimeoutMs = 600_000, ...requestOptions } = options;
112
+ const { intervalMs = 3_000, waitTimeoutMs = 600_000, ...requestOptions } = options;
66
113
  const deadline = Date.now() + waitTimeoutMs;
67
114
  while (true) {
68
115
  if (requestOptions.signal?.aborted) {
69
116
  throw requestOptions.signal.reason ?? new Error("Generation wait aborted.");
70
117
  }
71
- const result = await this.retrieve(generationId, requestOptions);
72
- if (!result.ok || (result.data.status !== "queued" && result.data.status !== "running"))
118
+ const result = await this.get(generationId, requestOptions);
119
+ if (result.status !== "queued" && result.status !== "running")
73
120
  return result;
74
121
  if (Date.now() >= deadline)
75
122
  throw new Error("Timed out waiting for Generation " + generationId + ".");
@@ -0,0 +1,18 @@
1
+ import { HttpCore, type RequestOptions } from "../core/http.js";
2
+ import { ResponseParseError, TransportError, UnexpectedApiError, ValidationError, ForbiddenError, InternalServerError, RateLimitedError, UnauthorizedError } from "../errors.js";
3
+ import type { OrganizationRead } from "../types.js";
4
+ export declare class OrganizationResource {
5
+ private readonly _core;
6
+ constructor(_core: HttpCore);
7
+ /**
8
+ * The organization behind the presented credentials
9
+ *
10
+ * Returns the organization associated with your credential. The Typeship CLI uses this endpoint
11
+ * for `whoami`.
12
+ * `GET /organization`
13
+ */
14
+ get(options?: RequestOptions): Promise<OrganizationRead>;
15
+ }
16
+ /** Typed errors `get` can throw. */
17
+ export type OrganizationGetError = UnauthorizedError | ForbiddenError | RateLimitedError | InternalServerError | UnexpectedApiError | ResponseParseError | TransportError | ValidationError;
18
+ //# sourceMappingURL=organization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization.d.ts","sourceRoot":"","sources":["../../src/resources/organization.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EACL,kBAAkB,EAClB,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,cAAc,CAAC;AACtB,OAAO,KAAK,EAAgB,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAElE,qBAAa,oBAAoB;IACnB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBAAL,KAAK,EAAE,QAAQ;IAC5C;;;;;;OAMG;IACG,GAAG,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAgB/D;AAED,oCAAoC;AACpC,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,GACjB,cAAc,GACd,gBAAgB,GAChB,mBAAmB,GACnB,kBAAkB,GAClB,kBAAkB,GAClB,cAAc,GACd,eAAe,CAAC"}
@@ -1,22 +1,22 @@
1
- // typeship — account resource.
1
+ // typeship — organization resource.
2
2
  // Generated by typeship — https://typeship.dev
3
3
  import { ForbiddenError, InternalServerError, RateLimitedError, UnauthorizedError, } from "../errors.js";
4
- export class AccountResource {
4
+ export class OrganizationResource {
5
5
  _core;
6
6
  constructor(_core) {
7
7
  this._core = _core;
8
8
  }
9
9
  /**
10
- * The account behind the presented credentials
10
+ * The organization behind the presented credentials
11
11
  *
12
- * Returns the account associated with your credential. The Typeship CLI uses this endpoint for
13
- * `whoami`.
14
- * `GET /me`
12
+ * Returns the organization associated with your credential. The Typeship CLI uses this endpoint
13
+ * for `whoami`.
14
+ * `GET /organization`
15
15
  */
16
- async retrieve(options) {
17
- return this._core.request({
16
+ async get(options) {
17
+ return this._core.requestData({
18
18
  method: "GET",
19
- path: "/me",
19
+ path: "/organization",
20
20
  security: [{ "apiKey": [] }],
21
21
  errors: {
22
22
  "401": UnauthorizedError,
@@ -25,7 +25,7 @@ export class AccountResource {
25
25
  "500": InternalServerError,
26
26
  },
27
27
  idempotent: true,
28
- schemaKey: "account.retrieve",
28
+ schemaKey: "organization.get",
29
29
  options,
30
30
  });
31
31
  }