@typeship-ax/cli 0.10.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 (109) hide show
  1. package/AGENTS.md +10 -5
  2. package/README.md +5 -5
  3. package/api.json +9773 -4501
  4. package/api.md +501 -271
  5. package/dist/api-identity.d.ts.map +1 -1
  6. package/dist/api-identity.js +6 -1
  7. package/dist/cli-agent.d.ts +5 -5
  8. package/dist/cli-agent.d.ts.map +1 -1
  9. package/dist/cli-agent.js +14 -10
  10. package/dist/cli.js +158 -82
  11. package/dist/core/http.d.ts +29 -16
  12. package/dist/core/http.d.ts.map +1 -1
  13. package/dist/core/http.js +108 -25
  14. package/dist/core/pagination.d.ts +8 -8
  15. package/dist/core/pagination.d.ts.map +1 -1
  16. package/dist/core/pagination.js +7 -16
  17. package/dist/errors.d.ts +20 -13
  18. package/dist/errors.d.ts.map +1 -1
  19. package/dist/errors.js +29 -20
  20. package/dist/index.d.ts +37 -19
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +42 -18
  23. package/dist/ops.d.ts +5 -1
  24. package/dist/ops.d.ts.map +1 -1
  25. package/dist/ops.js +42 -35
  26. package/dist/polling-login.d.ts.map +1 -1
  27. package/dist/polling-login.js +11 -1
  28. package/dist/resources/api-keys.d.ts +44 -18
  29. package/dist/resources/api-keys.d.ts.map +1 -1
  30. package/dist/resources/api-keys.js +46 -14
  31. package/dist/resources/deliveries.d.ts +46 -0
  32. package/dist/resources/deliveries.d.ts.map +1 -0
  33. package/dist/resources/deliveries.js +70 -0
  34. package/dist/resources/drafts.d.ts +155 -0
  35. package/dist/resources/drafts.d.ts.map +1 -0
  36. package/dist/resources/drafts.js +230 -0
  37. package/dist/resources/files.d.ts +23 -0
  38. package/dist/resources/files.d.ts.map +1 -0
  39. package/dist/resources/files.js +38 -0
  40. package/dist/resources/generate.d.ts +49 -20
  41. package/dist/resources/generate.d.ts.map +1 -1
  42. package/dist/resources/generate.js +56 -14
  43. package/dist/resources/generations.d.ts +70 -18
  44. package/dist/resources/generations.d.ts.map +1 -1
  45. package/dist/resources/generations.js +84 -16
  46. package/dist/resources/organization.d.ts +18 -0
  47. package/dist/resources/organization.d.ts.map +1 -0
  48. package/dist/resources/organization.js +32 -0
  49. package/dist/resources/projects.d.ts +87 -124
  50. package/dist/resources/projects.d.ts.map +1 -1
  51. package/dist/resources/projects.js +70 -173
  52. package/dist/resources/publications.d.ts +46 -0
  53. package/dist/resources/publications.d.ts.map +1 -0
  54. package/dist/resources/publications.js +70 -0
  55. package/dist/resources/releases.d.ts +66 -0
  56. package/dist/resources/releases.d.ts.map +1 -0
  57. package/dist/resources/releases.js +101 -0
  58. package/dist/resources/spec-revisions.d.ts +85 -0
  59. package/dist/resources/spec-revisions.d.ts.map +1 -0
  60. package/dist/resources/spec-revisions.js +116 -0
  61. package/dist/resources/specs.d.ts +72 -0
  62. package/dist/resources/specs.d.ts.map +1 -0
  63. package/dist/resources/specs.js +107 -0
  64. package/dist/resources/targets.d.ts +85 -105
  65. package/dist/resources/targets.d.ts.map +1 -1
  66. package/dist/resources/targets.js +70 -163
  67. package/dist/schemas.d.ts +1 -0
  68. package/dist/schemas.d.ts.map +1 -1
  69. package/dist/schemas.js +194 -139
  70. package/dist/types.d.ts +2626 -1141
  71. package/dist/types.d.ts.map +1 -1
  72. package/dist/types.js +90 -11
  73. package/package.json +3 -3
  74. package/src/api-identity.ts +6 -2
  75. package/src/cli-agent.ts +17 -13
  76. package/src/cli.ts +145 -77
  77. package/src/core/http.ts +106 -30
  78. package/src/core/pagination.ts +13 -23
  79. package/src/errors.ts +30 -20
  80. package/src/index.ts +46 -24
  81. package/src/ops.ts +47 -36
  82. package/src/polling-login.ts +10 -1
  83. package/src/resources/api-keys.ts +87 -19
  84. package/src/resources/deliveries.ts +139 -0
  85. package/src/resources/drafts.ts +422 -0
  86. package/src/resources/files.ts +68 -0
  87. package/src/resources/generate.ts +81 -19
  88. package/src/resources/generations.ts +167 -29
  89. package/src/resources/organization.ts +53 -0
  90. package/src/resources/projects.ts +129 -322
  91. package/src/resources/publications.ts +139 -0
  92. package/src/resources/releases.ts +199 -0
  93. package/src/resources/spec-revisions.ts +237 -0
  94. package/src/resources/specs.ts +200 -0
  95. package/src/resources/targets.ts +135 -304
  96. package/src/schemas.ts +195 -140
  97. package/src/types.ts +2793 -1177
  98. package/dist/resources/account.d.ts +0 -18
  99. package/dist/resources/account.d.ts.map +0 -1
  100. package/dist/resources/account.js +0 -27
  101. package/dist/resources/definition-revisions.d.ts +0 -58
  102. package/dist/resources/definition-revisions.d.ts.map +0 -1
  103. package/dist/resources/definition-revisions.js +0 -114
  104. package/dist/resources/definitions.d.ts +0 -35
  105. package/dist/resources/definitions.d.ts.map +0 -1
  106. package/dist/resources/definitions.js +0 -60
  107. package/src/resources/account.ts +0 -46
  108. package/src/resources/definition-revisions.ts +0 -207
  109. package/src/resources/definitions.ts +0 -122
@@ -0,0 +1,200 @@
1
+ // typeship — specs resource.
2
+ // Generated by typeship — https://typeship.dev
3
+
4
+ import { HttpCore, type RequestOptions } from "../core/http.js";
5
+ import {
6
+ ResponseParseError,
7
+ TransportError,
8
+ UnexpectedApiError,
9
+ ValidationError,
10
+ BadGatewayError,
11
+ BadRequestError,
12
+ ConflictError,
13
+ ForbiddenError,
14
+ InternalServerError,
15
+ NotFoundError,
16
+ PreconditionFailedError,
17
+ RateLimitedError,
18
+ UnauthorizedError,
19
+ UnprocessableEntityError,
20
+ } from "../errors.js";
21
+ import type { Spec, SpecId, SpecRead, SpecUpdateRequest } from "../types.js";
22
+
23
+ export class SpecsResource {
24
+ constructor(private readonly _core: HttpCore) {}
25
+ /**
26
+ * Get a Spec
27
+ * `GET /specs/{spec_id}`
28
+ */
29
+ async get(specId: SpecId, options?: RequestOptions): Promise<SpecRead> {
30
+ return this._core.requestData<SpecRead, SpecsGetError>({
31
+ method: "GET",
32
+ path: `/specs/${encodeURIComponent(String(specId))}`,
33
+ security: [{"apiKey":[]}],
34
+ errors: {
35
+ "401": UnauthorizedError,
36
+ "403": ForbiddenError,
37
+ "404": NotFoundError,
38
+ "429": RateLimitedError,
39
+ "500": InternalServerError,
40
+ },
41
+ idempotent: true,
42
+ schemaKey: "specs.get",
43
+ options,
44
+ });
45
+ }
46
+
47
+ /**
48
+ * Update and resolve a Spec
49
+ *
50
+ * Resolves the source files before saving the update and records a new Spec Revision when the
51
+ * source changes.
52
+ * Omitted fields remain unchanged; supplied objects and arrays replace the whole field.
53
+ * If the Spec or its Project configuration changes during validation, returns 409
54
+ * resource_changed without saving the rejected update. Retrieve the current Spec and Project,
55
+ * reconcile your changes,
56
+ * and submit a new request with a new Idempotency-Key if using one.
57
+ *
58
+ * See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
59
+ * and If-Match.
60
+ *
61
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
62
+ * `PATCH /specs/{spec_id}`
63
+ */
64
+ async update(
65
+ specId: SpecId,
66
+ body: SpecUpdateRequest,
67
+ params?: SpecsUpdateParams,
68
+ options?: RequestOptions,
69
+ ): Promise<SpecRead> {
70
+ return this._core.requestData<SpecRead, SpecsUpdateError>({
71
+ method: "PATCH",
72
+ path: `/specs/${encodeURIComponent(String(specId))}`,
73
+ security: [{"apiKey":[]}],
74
+ headers: {
75
+ "If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
76
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
77
+ },
78
+ body,
79
+ errors: {
80
+ "400": BadRequestError,
81
+ "401": UnauthorizedError,
82
+ "403": ForbiddenError,
83
+ "404": NotFoundError,
84
+ "409": ConflictError,
85
+ "412": PreconditionFailedError,
86
+ "422": UnprocessableEntityError,
87
+ "429": RateLimitedError,
88
+ "500": InternalServerError,
89
+ },
90
+ idempotencyKey: "Idempotency-Key",
91
+ schemaKey: "specs.update",
92
+ options,
93
+ });
94
+ }
95
+
96
+ /**
97
+ * Refresh a Spec from its configured source
98
+ *
99
+ * Fetches the configured source now and creates a new Spec Revision only when its content
100
+ * changes. Diagnostics then reads that revision. If automatic generation is enabled, refresh
101
+ * queues generation for active Targets even when the source is unchanged.
102
+ *
103
+ * A `Idempotency-Key` UUID is generated per call (stable across retries) unless you pass one.
104
+ * `POST /specs/{spec_id}/refresh`
105
+ */
106
+ async refresh(specId: SpecId, params?: SpecsRefreshParams, options?: RequestOptions): Promise<SpecRead> {
107
+ return this._core.requestData<SpecRead, SpecsRefreshError>({
108
+ method: "POST",
109
+ path: `/specs/${encodeURIComponent(String(specId))}/refresh`,
110
+ security: [{"apiKey":[]}],
111
+ headers: {
112
+ "Idempotency-Key": params?.idempotencyKey === undefined ? undefined : String(params?.idempotencyKey),
113
+ },
114
+ errors: {
115
+ "400": BadRequestError,
116
+ "401": UnauthorizedError,
117
+ "403": ForbiddenError,
118
+ "404": NotFoundError,
119
+ "409": ConflictError,
120
+ "422": UnprocessableEntityError,
121
+ "429": RateLimitedError,
122
+ "500": InternalServerError,
123
+ "502": BadGatewayError,
124
+ },
125
+ idempotencyKey: "Idempotency-Key",
126
+ schemaKey: "specs.refresh",
127
+ options,
128
+ });
129
+ }
130
+ }
131
+
132
+ /** Typed errors `get` can throw. */
133
+ export type SpecsGetError =
134
+ | UnauthorizedError
135
+ | ForbiddenError
136
+ | NotFoundError
137
+ | RateLimitedError
138
+ | InternalServerError
139
+ | UnexpectedApiError
140
+ | ResponseParseError
141
+ | TransportError
142
+ | ValidationError;
143
+
144
+ export interface SpecsUpdateParams {
145
+ /**
146
+ * ETag from a preceding response. The write applies only if the resource still has that version;
147
+ * otherwise it returns 412 precondition_failed without changes. Omit to write the current
148
+ * version. See https://typeship.dev/docs/typeship-api#conditional-writes.
149
+ */
150
+ ifMatch?: string;
151
+ /**
152
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
153
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
154
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
155
+ * the key with changed intent returns 409. After expiry the key starts a new write.
156
+ */
157
+ idempotencyKey?: string;
158
+ }
159
+
160
+ /** Typed errors `update` can throw. */
161
+ export type SpecsUpdateError =
162
+ | BadRequestError
163
+ | UnauthorizedError
164
+ | ForbiddenError
165
+ | NotFoundError
166
+ | ConflictError
167
+ | PreconditionFailedError
168
+ | UnprocessableEntityError
169
+ | RateLimitedError
170
+ | InternalServerError
171
+ | UnexpectedApiError
172
+ | ResponseParseError
173
+ | TransportError
174
+ | ValidationError;
175
+
176
+ export interface SpecsRefreshParams {
177
+ /**
178
+ * Identifies one logical write for 24 hours. The key is scoped to the authenticated organization
179
+ * and operation; generation without an organization uses a hashed network identity. Retrying the
180
+ * same method, path, query, If-Match header, and JSON body replays the original response. Reusing
181
+ * the key with changed intent returns 409. After expiry the key starts a new write.
182
+ */
183
+ idempotencyKey?: string;
184
+ }
185
+
186
+ /** Typed errors `refresh` can throw. */
187
+ export type SpecsRefreshError =
188
+ | BadRequestError
189
+ | UnauthorizedError
190
+ | ForbiddenError
191
+ | NotFoundError
192
+ | ConflictError
193
+ | UnprocessableEntityError
194
+ | RateLimitedError
195
+ | InternalServerError
196
+ | BadGatewayError
197
+ | UnexpectedApiError
198
+ | ResponseParseError
199
+ | TransportError
200
+ | ValidationError;