@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.
- package/AGENTS.md +10 -5
- package/README.md +5 -5
- package/api.json +9773 -4501
- package/api.md +501 -271
- package/dist/api-identity.d.ts.map +1 -1
- package/dist/api-identity.js +6 -1
- package/dist/cli-agent.d.ts +5 -5
- package/dist/cli-agent.d.ts.map +1 -1
- package/dist/cli-agent.js +14 -10
- package/dist/cli.js +158 -82
- package/dist/core/http.d.ts +29 -16
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +108 -25
- package/dist/core/pagination.d.ts +8 -8
- package/dist/core/pagination.d.ts.map +1 -1
- package/dist/core/pagination.js +7 -16
- package/dist/errors.d.ts +20 -13
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +29 -20
- package/dist/index.d.ts +37 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +42 -18
- package/dist/ops.d.ts +5 -1
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js +42 -35
- package/dist/polling-login.d.ts.map +1 -1
- package/dist/polling-login.js +11 -1
- package/dist/resources/api-keys.d.ts +44 -18
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +46 -14
- package/dist/resources/deliveries.d.ts +46 -0
- package/dist/resources/deliveries.d.ts.map +1 -0
- package/dist/resources/deliveries.js +70 -0
- package/dist/resources/drafts.d.ts +155 -0
- package/dist/resources/drafts.d.ts.map +1 -0
- package/dist/resources/drafts.js +230 -0
- package/dist/resources/files.d.ts +23 -0
- package/dist/resources/files.d.ts.map +1 -0
- package/dist/resources/files.js +38 -0
- package/dist/resources/generate.d.ts +49 -20
- package/dist/resources/generate.d.ts.map +1 -1
- package/dist/resources/generate.js +56 -14
- package/dist/resources/generations.d.ts +70 -18
- package/dist/resources/generations.d.ts.map +1 -1
- package/dist/resources/generations.js +84 -16
- package/dist/resources/organization.d.ts +18 -0
- package/dist/resources/organization.d.ts.map +1 -0
- package/dist/resources/organization.js +32 -0
- package/dist/resources/projects.d.ts +87 -124
- package/dist/resources/projects.d.ts.map +1 -1
- package/dist/resources/projects.js +70 -173
- package/dist/resources/publications.d.ts +46 -0
- package/dist/resources/publications.d.ts.map +1 -0
- package/dist/resources/publications.js +70 -0
- package/dist/resources/releases.d.ts +66 -0
- package/dist/resources/releases.d.ts.map +1 -0
- package/dist/resources/releases.js +101 -0
- package/dist/resources/spec-revisions.d.ts +85 -0
- package/dist/resources/spec-revisions.d.ts.map +1 -0
- package/dist/resources/spec-revisions.js +116 -0
- package/dist/resources/specs.d.ts +72 -0
- package/dist/resources/specs.d.ts.map +1 -0
- package/dist/resources/specs.js +107 -0
- package/dist/resources/targets.d.ts +85 -105
- package/dist/resources/targets.d.ts.map +1 -1
- package/dist/resources/targets.js +70 -163
- package/dist/schemas.d.ts +1 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +194 -139
- package/dist/types.d.ts +2626 -1141
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +90 -11
- package/package.json +3 -3
- package/src/api-identity.ts +6 -2
- package/src/cli-agent.ts +17 -13
- package/src/cli.ts +145 -77
- package/src/core/http.ts +106 -30
- package/src/core/pagination.ts +13 -23
- package/src/errors.ts +30 -20
- package/src/index.ts +46 -24
- package/src/ops.ts +47 -36
- package/src/polling-login.ts +10 -1
- package/src/resources/api-keys.ts +87 -19
- package/src/resources/deliveries.ts +139 -0
- package/src/resources/drafts.ts +422 -0
- package/src/resources/files.ts +68 -0
- package/src/resources/generate.ts +81 -19
- package/src/resources/generations.ts +167 -29
- package/src/resources/organization.ts +53 -0
- package/src/resources/projects.ts +129 -322
- package/src/resources/publications.ts +139 -0
- package/src/resources/releases.ts +199 -0
- package/src/resources/spec-revisions.ts +237 -0
- package/src/resources/specs.ts +200 -0
- package/src/resources/targets.ts +135 -304
- package/src/schemas.ts +195 -140
- package/src/types.ts +2793 -1177
- package/dist/resources/account.d.ts +0 -18
- package/dist/resources/account.d.ts.map +0 -1
- package/dist/resources/account.js +0 -27
- package/dist/resources/definition-revisions.d.ts +0 -58
- package/dist/resources/definition-revisions.d.ts.map +0 -1
- package/dist/resources/definition-revisions.js +0 -114
- package/dist/resources/definitions.d.ts +0 -35
- package/dist/resources/definitions.d.ts.map +0 -1
- package/dist/resources/definitions.js +0 -60
- package/src/resources/account.ts +0 -46
- package/src/resources/definition-revisions.ts +0 -207
- package/src/resources/definitions.ts +0 -122
package/src/polling-login.ts
CHANGED
|
@@ -149,7 +149,16 @@ export async function customBrowserApproval(config: { authUrl: string; name: str
|
|
|
149
149
|
await pause(Math.min(intervalMs, Math.max(0, deadline - Date.now())), flow.signal);
|
|
150
150
|
flow.check();
|
|
151
151
|
if (Date.now() >= deadline) throw new LoginPollingError("expired");
|
|
152
|
-
|
|
152
|
+
let result: Awaited<ReturnType<typeof oauthJsonRequest>>;
|
|
153
|
+
try {
|
|
154
|
+
result = await oauthJsonRequest(url + "/status", post({ session: start.session, code_verifier: verifier }), Math.min(15_000, deadline - Date.now()));
|
|
155
|
+
} catch (error) {
|
|
156
|
+
flow.check();
|
|
157
|
+
if (error instanceof OAuthResponseError && error.code === "timed_out" && Date.now() >= deadline) {
|
|
158
|
+
throw new LoginPollingError("expired");
|
|
159
|
+
}
|
|
160
|
+
throw error;
|
|
161
|
+
}
|
|
153
162
|
flow.check();
|
|
154
163
|
if (Date.now() >= deadline) throw new LoginPollingError("expired");
|
|
155
164
|
if (result.status !== 200) throw new LoginPollingError("request_failed");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// typeship — apiKeys resource.
|
|
2
|
-
// Generated by typeship — https://typeship.dev
|
|
2
|
+
// Generated by typeship — https://typeship.dev
|
|
3
3
|
|
|
4
|
-
import { HttpCore, type
|
|
4
|
+
import { HttpCore, type RequestOptions } from "../core/http.js";
|
|
5
5
|
import { paginate, PagePromise } from "../core/pagination.js";
|
|
6
6
|
import {
|
|
7
7
|
ResponseParseError,
|
|
@@ -10,7 +10,9 @@ import {
|
|
|
10
10
|
ValidationError,
|
|
11
11
|
BadRequestError,
|
|
12
12
|
ForbiddenError,
|
|
13
|
+
InternalServerError,
|
|
13
14
|
NotFoundError,
|
|
15
|
+
PreconditionFailedError,
|
|
14
16
|
RateLimitedError,
|
|
15
17
|
UnauthorizedError,
|
|
16
18
|
} from "../errors.js";
|
|
@@ -28,16 +30,16 @@ export class ApiKeysResource {
|
|
|
28
30
|
/**
|
|
29
31
|
* List API keys
|
|
30
32
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
33
|
+
* Lists key metadata and the last four characters of each key. Full keys are not returned. Create
|
|
34
|
+
* keys in the Console.
|
|
33
35
|
*
|
|
34
36
|
* Auto-paginates: `for await (const item of …)` walks every page.
|
|
35
|
-
* `GET /
|
|
37
|
+
* `GET /api-keys`
|
|
36
38
|
*/
|
|
37
39
|
list(params?: ApiKeysListParams, options?: RequestOptions): PagePromise<ApiKeyRead, ApiKeysListError> {
|
|
38
40
|
return paginate<ApiKeyRead, ApiKeysListError>(this._core, {
|
|
39
41
|
method: "GET",
|
|
40
|
-
path: "/
|
|
42
|
+
path: "/api-keys",
|
|
41
43
|
security: [{"apiKey":[]}],
|
|
42
44
|
query: {
|
|
43
45
|
limit: params?.limit,
|
|
@@ -48,6 +50,7 @@ export class ApiKeysResource {
|
|
|
48
50
|
"401": UnauthorizedError,
|
|
49
51
|
"403": ForbiddenError,
|
|
50
52
|
"429": RateLimitedError,
|
|
53
|
+
"500": InternalServerError,
|
|
51
54
|
},
|
|
52
55
|
idempotent: true,
|
|
53
56
|
schemaKey: "apiKeys.list",
|
|
@@ -62,28 +65,61 @@ export class ApiKeysResource {
|
|
|
62
65
|
});
|
|
63
66
|
}
|
|
64
67
|
|
|
68
|
+
/**
|
|
69
|
+
* Get an API key
|
|
70
|
+
*
|
|
71
|
+
* Returns the key summary and its ETag for conditional revocation.
|
|
72
|
+
* `GET /api-keys/{api_key_id}`
|
|
73
|
+
*/
|
|
74
|
+
async get(apiKeyId: string, options?: RequestOptions): Promise<ApiKeyResponseRead> {
|
|
75
|
+
return this._core.requestData<ApiKeyResponseRead, ApiKeysGetError>({
|
|
76
|
+
method: "GET",
|
|
77
|
+
path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
|
|
78
|
+
security: [{"apiKey":[]}],
|
|
79
|
+
errors: {
|
|
80
|
+
"401": UnauthorizedError,
|
|
81
|
+
"403": ForbiddenError,
|
|
82
|
+
"404": NotFoundError,
|
|
83
|
+
"429": RateLimitedError,
|
|
84
|
+
"500": InternalServerError,
|
|
85
|
+
},
|
|
86
|
+
idempotent: true,
|
|
87
|
+
schemaKey: "apiKeys.get",
|
|
88
|
+
options,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
|
|
65
92
|
/**
|
|
66
93
|
* Revoke an API key
|
|
67
94
|
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
95
|
+
* Revokes a key. Repeating the request returns the same result.
|
|
96
|
+
*
|
|
97
|
+
* With OAuth, members can revoke their own keys; organization admins can revoke any key.
|
|
98
|
+
* Organization API keys can revoke any key in their organization.
|
|
99
|
+
* See [conditional writes](https://typeship.dev/docs/typeship-api#conditional-writes) for ETag
|
|
100
|
+
* and If-Match.
|
|
101
|
+
* `DELETE /api-keys/{api_key_id}`
|
|
73
102
|
*/
|
|
74
103
|
async revoke(
|
|
75
104
|
apiKeyId: string,
|
|
105
|
+
params?: ApiKeysRevokeParams,
|
|
76
106
|
options?: RequestOptions,
|
|
77
|
-
): Promise<
|
|
78
|
-
return this._core.
|
|
107
|
+
): Promise<ApiKeyResponseRead> {
|
|
108
|
+
return this._core.requestData<ApiKeyResponseRead, ApiKeysRevokeError>({
|
|
79
109
|
method: "DELETE",
|
|
80
|
-
path: `/
|
|
110
|
+
path: `/api-keys/${encodeURIComponent(String(apiKeyId))}`,
|
|
81
111
|
security: [{"apiKey":[]}],
|
|
112
|
+
headers: {
|
|
113
|
+
"If-Match": params?.ifMatch === undefined ? undefined : String(params?.ifMatch),
|
|
114
|
+
},
|
|
82
115
|
errors: {
|
|
116
|
+
"400": BadRequestError,
|
|
83
117
|
"401": UnauthorizedError,
|
|
84
118
|
"403": ForbiddenError,
|
|
85
119
|
"404": NotFoundError,
|
|
120
|
+
"412": PreconditionFailedError,
|
|
86
121
|
"429": RateLimitedError,
|
|
122
|
+
"500": InternalServerError,
|
|
87
123
|
},
|
|
88
124
|
idempotent: true,
|
|
89
125
|
schemaKey: "apiKeys.revoke",
|
|
@@ -93,32 +129,64 @@ export class ApiKeysResource {
|
|
|
93
129
|
}
|
|
94
130
|
|
|
95
131
|
export interface ApiKeysListParams {
|
|
96
|
-
/**
|
|
132
|
+
/**
|
|
133
|
+
* Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
|
|
134
|
+
* representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
|
|
135
|
+
* invalid_request. List query parameters must appear only once; unrecognized parameters also
|
|
136
|
+
* return 400.
|
|
137
|
+
*/
|
|
97
138
|
limit?: number;
|
|
98
139
|
/**
|
|
99
|
-
* Opaque cursor from the preceding page's next_cursor. Valid only for the same
|
|
100
|
-
* operation, filters, and ordering that issued it.
|
|
140
|
+
* Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
|
|
141
|
+
* operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
|
|
142
|
+
* malformed, or repeated cursors return 400 invalid_request. The page limit may change between
|
|
143
|
+
* requests.
|
|
101
144
|
*/
|
|
102
145
|
cursor?: string;
|
|
103
146
|
}
|
|
104
147
|
|
|
105
|
-
/**
|
|
148
|
+
/** Typed errors `list` can throw. */
|
|
106
149
|
export type ApiKeysListError =
|
|
107
150
|
| BadRequestError
|
|
108
151
|
| UnauthorizedError
|
|
109
152
|
| ForbiddenError
|
|
110
153
|
| RateLimitedError
|
|
154
|
+
| InternalServerError
|
|
111
155
|
| UnexpectedApiError
|
|
112
156
|
| ResponseParseError
|
|
113
157
|
| TransportError
|
|
114
158
|
| ValidationError;
|
|
115
159
|
|
|
116
|
-
/**
|
|
160
|
+
/** Typed errors `get` can throw. */
|
|
161
|
+
export type ApiKeysGetError =
|
|
162
|
+
| UnauthorizedError
|
|
163
|
+
| ForbiddenError
|
|
164
|
+
| NotFoundError
|
|
165
|
+
| RateLimitedError
|
|
166
|
+
| InternalServerError
|
|
167
|
+
| UnexpectedApiError
|
|
168
|
+
| ResponseParseError
|
|
169
|
+
| TransportError
|
|
170
|
+
| ValidationError;
|
|
171
|
+
|
|
172
|
+
export interface ApiKeysRevokeParams {
|
|
173
|
+
/**
|
|
174
|
+
* ETag from a preceding response. The write applies only if the resource still has that version;
|
|
175
|
+
* otherwise it returns 412 precondition_failed without changes. Omit to write the current
|
|
176
|
+
* version. See https://typeship.dev/docs/typeship-api#conditional-writes.
|
|
177
|
+
*/
|
|
178
|
+
ifMatch?: string;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Typed errors `revoke` can throw. */
|
|
117
182
|
export type ApiKeysRevokeError =
|
|
183
|
+
| BadRequestError
|
|
118
184
|
| UnauthorizedError
|
|
119
185
|
| ForbiddenError
|
|
120
186
|
| NotFoundError
|
|
187
|
+
| PreconditionFailedError
|
|
121
188
|
| RateLimitedError
|
|
189
|
+
| InternalServerError
|
|
122
190
|
| UnexpectedApiError
|
|
123
191
|
| ResponseParseError
|
|
124
192
|
| TransportError
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// typeship — deliveries resource.
|
|
2
|
+
// Generated by typeship — https://typeship.dev
|
|
3
|
+
|
|
4
|
+
import { HttpCore, type RequestOptions } from "../core/http.js";
|
|
5
|
+
import { paginate, PagePromise } from "../core/pagination.js";
|
|
6
|
+
import {
|
|
7
|
+
ResponseParseError,
|
|
8
|
+
TransportError,
|
|
9
|
+
UnexpectedApiError,
|
|
10
|
+
ValidationError,
|
|
11
|
+
BadRequestError,
|
|
12
|
+
ForbiddenError,
|
|
13
|
+
InternalServerError,
|
|
14
|
+
NotFoundError,
|
|
15
|
+
RateLimitedError,
|
|
16
|
+
UnauthorizedError,
|
|
17
|
+
} from "../errors.js";
|
|
18
|
+
import type {
|
|
19
|
+
Delivery,
|
|
20
|
+
DeliveryId,
|
|
21
|
+
DeliveryList,
|
|
22
|
+
DeliveryListRead,
|
|
23
|
+
DeliveryRead,
|
|
24
|
+
DeliveryResponse,
|
|
25
|
+
DeliveryResponseRead,
|
|
26
|
+
TargetId,
|
|
27
|
+
} from "../types.js";
|
|
28
|
+
|
|
29
|
+
export class DeliveriesResource {
|
|
30
|
+
constructor(private readonly _core: HttpCore) {}
|
|
31
|
+
/**
|
|
32
|
+
* List Deliveries
|
|
33
|
+
*
|
|
34
|
+
* Auto-paginates: `for await (const item of …)` walks every page.
|
|
35
|
+
* `GET /deliveries`
|
|
36
|
+
*/
|
|
37
|
+
list(
|
|
38
|
+
params?: DeliveriesListParams,
|
|
39
|
+
options?: RequestOptions,
|
|
40
|
+
): PagePromise<DeliveryRead, DeliveriesListError> {
|
|
41
|
+
return paginate<DeliveryRead, DeliveriesListError>(this._core, {
|
|
42
|
+
method: "GET",
|
|
43
|
+
path: "/deliveries",
|
|
44
|
+
security: [{"apiKey":[]}],
|
|
45
|
+
query: {
|
|
46
|
+
limit: params?.limit,
|
|
47
|
+
cursor: params?.cursor,
|
|
48
|
+
target_id: params?.targetId,
|
|
49
|
+
},
|
|
50
|
+
errors: {
|
|
51
|
+
"400": BadRequestError,
|
|
52
|
+
"401": UnauthorizedError,
|
|
53
|
+
"403": ForbiddenError,
|
|
54
|
+
"404": NotFoundError,
|
|
55
|
+
"429": RateLimitedError,
|
|
56
|
+
"500": InternalServerError,
|
|
57
|
+
},
|
|
58
|
+
idempotent: true,
|
|
59
|
+
schemaKey: "deliveries.list",
|
|
60
|
+
options,
|
|
61
|
+
}, {
|
|
62
|
+
style: "cursor",
|
|
63
|
+
itemsField: "data",
|
|
64
|
+
cursorParam: "cursor",
|
|
65
|
+
nextCursorField: "next_cursor",
|
|
66
|
+
hasMoreField: "has_more",
|
|
67
|
+
limitParam: "limit",
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Get a Delivery
|
|
73
|
+
*
|
|
74
|
+
* Returns the configured repository or hosted MCP Delivery for a Target. A Delivery in another
|
|
75
|
+
* organization returns 404 not_found.
|
|
76
|
+
* `GET /deliveries/{delivery_id}`
|
|
77
|
+
*/
|
|
78
|
+
async get(deliveryId: DeliveryId, options?: RequestOptions): Promise<DeliveryResponseRead> {
|
|
79
|
+
return this._core.requestData<DeliveryResponseRead, DeliveriesGetError>({
|
|
80
|
+
method: "GET",
|
|
81
|
+
path: `/deliveries/${encodeURIComponent(String(deliveryId))}`,
|
|
82
|
+
security: [{"apiKey":[]}],
|
|
83
|
+
errors: {
|
|
84
|
+
"401": UnauthorizedError,
|
|
85
|
+
"403": ForbiddenError,
|
|
86
|
+
"404": NotFoundError,
|
|
87
|
+
"429": RateLimitedError,
|
|
88
|
+
"500": InternalServerError,
|
|
89
|
+
},
|
|
90
|
+
idempotent: true,
|
|
91
|
+
schemaKey: "deliveries.get",
|
|
92
|
+
options,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export interface DeliveriesListParams {
|
|
98
|
+
/**
|
|
99
|
+
* Maximum number of resources to return. Omit for 20; otherwise supply base-10 digits
|
|
100
|
+
* representing an integer from 1 to 100. Empty, malformed, or out-of-range values return 400
|
|
101
|
+
* invalid_request. List query parameters must appear only once; unrecognized parameters also
|
|
102
|
+
* return 400.
|
|
103
|
+
*/
|
|
104
|
+
limit?: number;
|
|
105
|
+
/**
|
|
106
|
+
* Opaque cursor from the preceding page's next_cursor. Valid only for the same organization,
|
|
107
|
+
* operation, filters, and ordering that issued it. Omit to start at the first page. Empty,
|
|
108
|
+
* malformed, or repeated cursors return 400 invalid_request. The page limit may change between
|
|
109
|
+
* requests.
|
|
110
|
+
*/
|
|
111
|
+
cursor?: string;
|
|
112
|
+
/** Only Deliveries of this Target. */
|
|
113
|
+
targetId?: TargetId;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Typed errors `list` can throw. */
|
|
117
|
+
export type DeliveriesListError =
|
|
118
|
+
| BadRequestError
|
|
119
|
+
| UnauthorizedError
|
|
120
|
+
| ForbiddenError
|
|
121
|
+
| NotFoundError
|
|
122
|
+
| RateLimitedError
|
|
123
|
+
| InternalServerError
|
|
124
|
+
| UnexpectedApiError
|
|
125
|
+
| ResponseParseError
|
|
126
|
+
| TransportError
|
|
127
|
+
| ValidationError;
|
|
128
|
+
|
|
129
|
+
/** Typed errors `get` can throw. */
|
|
130
|
+
export type DeliveriesGetError =
|
|
131
|
+
| UnauthorizedError
|
|
132
|
+
| ForbiddenError
|
|
133
|
+
| NotFoundError
|
|
134
|
+
| RateLimitedError
|
|
135
|
+
| InternalServerError
|
|
136
|
+
| UnexpectedApiError
|
|
137
|
+
| ResponseParseError
|
|
138
|
+
| TransportError
|
|
139
|
+
| ValidationError;
|