@typeship-ax/mcp 0.6.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/LICENSE +9 -0
- package/README.md +43 -0
- package/api.json +5163 -0
- package/api.md +512 -0
- package/dist/core/http.d.ts +303 -0
- package/dist/core/http.d.ts.map +1 -0
- package/dist/core/http.js +770 -0
- package/dist/core/pagination.d.ts +51 -0
- package/dist/core/pagination.d.ts.map +1 -0
- package/dist/core/pagination.js +154 -0
- package/dist/dates.d.ts +33 -0
- package/dist/dates.d.ts.map +1 -0
- package/dist/dates.js +136 -0
- package/dist/errors.d.ts +81 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +103 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +86 -0
- package/dist/mcp-protocol.d.ts +453 -0
- package/dist/mcp-protocol.d.ts.map +1 -0
- package/dist/mcp-protocol.js +1262 -0
- package/dist/mcp.d.ts +5 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +449 -0
- package/dist/ops.d.ts +115 -0
- package/dist/ops.d.ts.map +1 -0
- package/dist/ops.js +79 -0
- package/dist/resources/account.d.ts +18 -0
- package/dist/resources/account.d.ts.map +1 -0
- package/dist/resources/account.js +26 -0
- package/dist/resources/api-keys.d.ts +37 -0
- package/dist/resources/api-keys.d.ts.map +1 -0
- package/dist/resources/api-keys.js +67 -0
- package/dist/resources/generate.d.ts +25 -0
- package/dist/resources/generate.d.ts.map +1 -0
- package/dist/resources/generate.js +41 -0
- package/dist/resources/generations.d.ts +31 -0
- package/dist/resources/generations.d.ts.map +1 -0
- package/dist/resources/generations.js +56 -0
- package/dist/resources/projects.d.ts +110 -0
- package/dist/resources/projects.d.ts.map +1 -0
- package/dist/resources/projects.js +220 -0
- package/dist/resources/spec-revisions.d.ts +47 -0
- package/dist/resources/spec-revisions.d.ts.map +1 -0
- package/dist/resources/spec-revisions.js +90 -0
- package/dist/schemas.d.ts +6 -0
- package/dist/schemas.d.ts.map +1 -0
- package/dist/schemas.js +88 -0
- package/dist/types.d.ts +759 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +37 -0
- package/dist/worker.d.ts +5 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +12 -0
- package/package.json +45 -0
- package/src/core/http.ts +1008 -0
- package/src/core/pagination.ts +195 -0
- package/src/dates.ts +126 -0
- package/src/errors.ts +117 -0
- package/src/index.ts +153 -0
- package/src/mcp-protocol.ts +1451 -0
- package/src/mcp.ts +448 -0
- package/src/ops.ts +174 -0
- package/src/resources/account.ts +43 -0
- package/src/resources/api-keys.ts +105 -0
- package/src/resources/generate.ts +69 -0
- package/src/resources/generations.ts +100 -0
- package/src/resources/projects.ts +391 -0
- package/src/resources/spec-revisions.ts +150 -0
- package/src/schemas.ts +90 -0
- package/src/types.ts +825 -0
- package/src/worker.ts +13 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,825 @@
|
|
|
1
|
+
// typeship — API types.
|
|
2
|
+
// Generated by typeship — https://typeship.dev — do not edit by hand.
|
|
3
|
+
|
|
4
|
+
/** Unique identifier for a project. */
|
|
5
|
+
export type ProjectId = string;
|
|
6
|
+
|
|
7
|
+
/** Unique identifier for a generation. */
|
|
8
|
+
export type GenerationId = string;
|
|
9
|
+
|
|
10
|
+
/** Unique identifier for an immutable specification revision. */
|
|
11
|
+
export type SpecRevisionId = string;
|
|
12
|
+
|
|
13
|
+
/** Identifier used to correlate an API error with Typeship logs. */
|
|
14
|
+
export type RequestId = string;
|
|
15
|
+
|
|
16
|
+
/** Identifies a cursor-paginated collection. */
|
|
17
|
+
export type ListObject = "list";
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* One customer-selected output. CLI and MCP include the private TypeScript request runtime they
|
|
21
|
+
* need; that dependency is not a selected or billable TypeScript SDK.
|
|
22
|
+
*/
|
|
23
|
+
export const OutputId = {
|
|
24
|
+
TYPESCRIPT_SDK: "typescript-sdk",
|
|
25
|
+
PYTHON_SDK: "python-sdk",
|
|
26
|
+
GO_SDK: "go-sdk",
|
|
27
|
+
CLI: "cli",
|
|
28
|
+
MCP: "mcp",
|
|
29
|
+
} as const;
|
|
30
|
+
export type OutputId = (typeof OutputId)[keyof typeof OutputId];
|
|
31
|
+
|
|
32
|
+
export interface UrlSpecInput {
|
|
33
|
+
/**
|
|
34
|
+
* URL of an OpenAPI document, a GraphQL SDL file, or a GraphQL
|
|
35
|
+
* endpoint (introspected automatically). Fetched server-side.
|
|
36
|
+
* Format: uri
|
|
37
|
+
*/
|
|
38
|
+
url: string;
|
|
39
|
+
/**
|
|
40
|
+
* Request headers for a protected URL. Sent on the document GET and GraphQL introspection POST,
|
|
41
|
+
* never returned or retained by stateless generation.
|
|
42
|
+
*/
|
|
43
|
+
headers?: Record<string, string>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export interface InlineSpecInput {
|
|
47
|
+
/** Raw spec text (OpenAPI JSON/YAML or GraphQL SDL). Up to 10MB. */
|
|
48
|
+
inline: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The specification for stateless generation, provided as exactly one URL or inline document. */
|
|
52
|
+
export type SpecInput = UrlSpecInput | InlineSpecInput;
|
|
53
|
+
|
|
54
|
+
export interface GenerateRequest {
|
|
55
|
+
spec: SpecInput;
|
|
56
|
+
/**
|
|
57
|
+
* The one output package to generate. Linked projects can select any combination of outputs and
|
|
58
|
+
* keep each package current.
|
|
59
|
+
*/
|
|
60
|
+
outputs: OutputId[];
|
|
61
|
+
/**
|
|
62
|
+
* Registry name for the selected delivery package: an npm package, Python distribution, or Go
|
|
63
|
+
* module path. Defaults to a name derived from the API title.
|
|
64
|
+
*/
|
|
65
|
+
package_name?: string;
|
|
66
|
+
config?: Config;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface GeneratedFile {
|
|
70
|
+
/** Repo-relative path inside the generated package. */
|
|
71
|
+
path: string;
|
|
72
|
+
content: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface GenerationMeta {
|
|
76
|
+
title: string;
|
|
77
|
+
version: string;
|
|
78
|
+
spec_format?: "openapi" | "graphql";
|
|
79
|
+
/** Detected spec version, "2.0", "3.0", or "3.1". */
|
|
80
|
+
oas_version: string;
|
|
81
|
+
/** True when the input was Swagger 2.0 and was converted. */
|
|
82
|
+
converted?: boolean;
|
|
83
|
+
package_name: string;
|
|
84
|
+
client_name: string;
|
|
85
|
+
/** Customer-selected outputs present in this delivery package. */
|
|
86
|
+
outputs: OutputId[];
|
|
87
|
+
resource_count?: number;
|
|
88
|
+
operation_count?: number;
|
|
89
|
+
schema_count?: number;
|
|
90
|
+
paginated_operation_count?: number;
|
|
91
|
+
/** Operations beyond the plan's endpoint allowance, not generated. */
|
|
92
|
+
omitted_operation_count?: number;
|
|
93
|
+
/** Pull request opened by this regeneration, when one was. */
|
|
94
|
+
pr_url?: string | null;
|
|
95
|
+
pr_number?: number | null;
|
|
96
|
+
/**
|
|
97
|
+
* Whether a destination pull request opened, was unnecessary because the generated tree already
|
|
98
|
+
* matched, or could not be opened.
|
|
99
|
+
*/
|
|
100
|
+
pr_status?: "opened" | "no_changes" | "blocked";
|
|
101
|
+
/**
|
|
102
|
+
* Why the configured destination pull request was not opened. Generation itself still succeeded;
|
|
103
|
+
* fix this action and regenerate.
|
|
104
|
+
*/
|
|
105
|
+
pr_error?: string;
|
|
106
|
+
/**
|
|
107
|
+
* Markdown changelog entry for this regeneration, from the API surface diff. Absent on a first
|
|
108
|
+
* generation or when nothing changed.
|
|
109
|
+
*/
|
|
110
|
+
changelog?: string;
|
|
111
|
+
/**
|
|
112
|
+
* Breaking changes in the diff; removed methods and fields, changed types, inputs that became
|
|
113
|
+
* required.
|
|
114
|
+
*/
|
|
115
|
+
breaking_count?: number;
|
|
116
|
+
/**
|
|
117
|
+
* What the diff was measured against; "destination" means the .typeship/surface.json merged in
|
|
118
|
+
* the destination repository.
|
|
119
|
+
*/
|
|
120
|
+
baseline?: "destination" | "last-generation" | "none";
|
|
121
|
+
/**
|
|
122
|
+
* The package compatibility verdict on the regeneration pull request; failure means breaking
|
|
123
|
+
* changes without a major version bump.
|
|
124
|
+
*/
|
|
125
|
+
package_compatibility?: "success" | "failure";
|
|
126
|
+
/** The verdict in one line, as the commit status describes it. */
|
|
127
|
+
package_compatibility_note?: string;
|
|
128
|
+
/** The package version the destination had before this regeneration. */
|
|
129
|
+
previous_version?: string;
|
|
130
|
+
file_count?: number;
|
|
131
|
+
total_lines?: number;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export interface GenerationResult {
|
|
135
|
+
files: GeneratedFile[];
|
|
136
|
+
warnings: string[];
|
|
137
|
+
meta: GenerationMeta;
|
|
138
|
+
limits?: GenerationLimits;
|
|
139
|
+
/**
|
|
140
|
+
* Anonymous, URL-sourced generations only. A link a signed-in person can open to turn this run
|
|
141
|
+
* into a project in their organization (same spec, outputs, and config). Lasts seven days. Null
|
|
142
|
+
* for inline specs; absent on keyed calls.
|
|
143
|
+
*/
|
|
144
|
+
claim?: null
|
|
145
|
+
| {
|
|
146
|
+
url: string;
|
|
147
|
+
/** Format: date-time */
|
|
148
|
+
expires_at: string;
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Present when the generation was capped: by the free plan, or because the call was anonymous.
|
|
154
|
+
* Absent on uncapped generations.
|
|
155
|
+
*/
|
|
156
|
+
export interface GenerationLimits {
|
|
157
|
+
/** How many operations this generation was allowed to include. */
|
|
158
|
+
max_operations: number;
|
|
159
|
+
/** How many operations in the spec were left out. */
|
|
160
|
+
omitted_operations: number;
|
|
161
|
+
reason: "anonymous" | "free_plan";
|
|
162
|
+
/** Anonymous calls only. Where to create an account. */
|
|
163
|
+
signup_url?: string;
|
|
164
|
+
/** Where the cap is lifted. */
|
|
165
|
+
upgrade_url: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export interface UrlProjectSource {
|
|
169
|
+
kind: "url";
|
|
170
|
+
/**
|
|
171
|
+
* URL fetched for every generation.
|
|
172
|
+
* Format: uri
|
|
173
|
+
*/
|
|
174
|
+
url: string;
|
|
175
|
+
/** Whether Typeship has stored write-only request headers for this URL. */
|
|
176
|
+
headers_configured: boolean;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export interface GithubProjectSource {
|
|
180
|
+
kind: "github";
|
|
181
|
+
/** GitHub repository in owner/name form. */
|
|
182
|
+
repository: string;
|
|
183
|
+
/** Repository-relative path to the specification. */
|
|
184
|
+
path: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
/** The single source of truth for where a project's specification lives. */
|
|
188
|
+
export type ProjectSource = UrlProjectSource | GithubProjectSource;
|
|
189
|
+
|
|
190
|
+
export interface UrlProjectSourceInput {
|
|
191
|
+
kind: "url";
|
|
192
|
+
/**
|
|
193
|
+
* URL of an OpenAPI document, GraphQL SDL file, or GraphQL endpoint.
|
|
194
|
+
* Format: uri
|
|
195
|
+
*/
|
|
196
|
+
url: string;
|
|
197
|
+
/**
|
|
198
|
+
* Request headers for a protected URL. Values are never returned or recorded in revision history.
|
|
199
|
+
* When updating the same URL, omit headers to preserve the stored values or pass null to remove
|
|
200
|
+
* them. Changing the URL without headers clears the old values so a credential is never forwarded
|
|
201
|
+
* to a different source.
|
|
202
|
+
*/
|
|
203
|
+
headers?: Record<string, string> | null;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export interface GithubProjectSourceInput {
|
|
207
|
+
kind: "github";
|
|
208
|
+
/** GitHub repository in owner/name form. */
|
|
209
|
+
repository: string;
|
|
210
|
+
/** Repository-relative path to the specification. */
|
|
211
|
+
path: string;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export type ProjectSourceInput = UrlProjectSourceInput | GithubProjectSourceInput;
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* A fix applied to the spec before generation. Targets are JSON
|
|
218
|
+
* Pointers into the document. A patch whose target no longer exists is
|
|
219
|
+
* skipped and reported as a warning on the generation, never silently.
|
|
220
|
+
*/
|
|
221
|
+
export interface SpecPatch {
|
|
222
|
+
op: "set" | "append" | "remove" | "rename";
|
|
223
|
+
/**
|
|
224
|
+
* JSON-Pointer-style path. Pattern segments enable bulk fixes:
|
|
225
|
+
* * (any child), ** (any depth), [key=value] (filter), e.g.
|
|
226
|
+
* /paths/**\/parameters/[name=account_id]/schema/type. Renaming a
|
|
227
|
+
* schema under /components/schemas also rewrites its $refs.
|
|
228
|
+
*/
|
|
229
|
+
path: string;
|
|
230
|
+
/** set only; the replacement value. */
|
|
231
|
+
value?: unknown;
|
|
232
|
+
/** rename only; the new key name. */
|
|
233
|
+
to?: string | null;
|
|
234
|
+
reason?: string | null;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** Where regeneration pull requests land. */
|
|
238
|
+
export interface Destination {
|
|
239
|
+
/** Defaults to the source repository when the source is a repo. */
|
|
240
|
+
repo?: string | null;
|
|
241
|
+
/** Directory the generated package is written to. */
|
|
242
|
+
directory?: string | null;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/** Registry identity and reviewed pull-request destination for one delivery package. */
|
|
246
|
+
export interface PackageDelivery {
|
|
247
|
+
/**
|
|
248
|
+
* npm package name, Python distribution name, or Go module path. Null derives a name from the API
|
|
249
|
+
* title.
|
|
250
|
+
*/
|
|
251
|
+
name?: string | null;
|
|
252
|
+
/**
|
|
253
|
+
* Release version for this output package. Null falls back to the legacy config.package.version,
|
|
254
|
+
* then the specification version.
|
|
255
|
+
*/
|
|
256
|
+
version?: string | null;
|
|
257
|
+
destination?: Destination | null;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Independent delivery packages keyed by output. Every selected output owns its registry identity,
|
|
262
|
+
* version, destination pull request, and release lifecycle. Selected outputs must resolve to
|
|
263
|
+
* distinct repository-and-directory trees; the TypeScript SDK, CLI, and MCP packages must also have
|
|
264
|
+
* distinct npm names.
|
|
265
|
+
*/
|
|
266
|
+
export interface Packages {
|
|
267
|
+
"typescript-sdk"?: PackageDelivery;
|
|
268
|
+
"python-sdk"?: PackageDelivery;
|
|
269
|
+
"go-sdk"?: PackageDelivery;
|
|
270
|
+
cli?: PackageDelivery;
|
|
271
|
+
mcp?: PackageDelivery;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export interface ProjectDestination {
|
|
275
|
+
repo: string | null;
|
|
276
|
+
directory: string | null;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export interface ProjectPackageDelivery {
|
|
280
|
+
name: string | null;
|
|
281
|
+
version: string | null;
|
|
282
|
+
destination: ProjectDestination | null;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Complete package configuration. All outputs are returned even when their output is not selected,
|
|
287
|
+
* so saved delivery settings do not disappear when an output is disabled.
|
|
288
|
+
*/
|
|
289
|
+
export interface ProjectPackages {
|
|
290
|
+
"typescript-sdk": ProjectPackageDelivery;
|
|
291
|
+
"python-sdk": ProjectPackageDelivery;
|
|
292
|
+
"go-sdk": ProjectPackageDelivery;
|
|
293
|
+
cli: ProjectPackageDelivery;
|
|
294
|
+
mcp: ProjectPackageDelivery;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export interface GithubHealthIssue {
|
|
298
|
+
code: "installation_missing"
|
|
299
|
+
| "spec_unreadable"
|
|
300
|
+
| "contents_write_missing"
|
|
301
|
+
| "breaking_label_missing"
|
|
302
|
+
| "github_unavailable";
|
|
303
|
+
message: string;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export interface GithubRepositoryHealth {
|
|
307
|
+
repository: string;
|
|
308
|
+
roles: Array<"source" | "destination">;
|
|
309
|
+
status: "ready" | "action_required";
|
|
310
|
+
default_branch?: string;
|
|
311
|
+
can_read?: boolean;
|
|
312
|
+
can_write?: boolean;
|
|
313
|
+
breaking_label?: boolean | null;
|
|
314
|
+
spec?: "readable" | "missing";
|
|
315
|
+
issues: GithubHealthIssue[];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
export interface GithubDeliveryHealth {
|
|
319
|
+
id: string;
|
|
320
|
+
event: string;
|
|
321
|
+
status: "queued" | "processing" | "succeeded" | "failed" | "superseded";
|
|
322
|
+
error: string | null;
|
|
323
|
+
/** Format: date-time */
|
|
324
|
+
created_at: string;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
export interface GithubIntegrationHealth {
|
|
328
|
+
object: "github_integration_health";
|
|
329
|
+
project_id: ProjectId;
|
|
330
|
+
status: "ready" | "action_required";
|
|
331
|
+
repositories: GithubRepositoryHealth[];
|
|
332
|
+
required_statuses: {
|
|
333
|
+
source: string[];
|
|
334
|
+
destination: string[];
|
|
335
|
+
};
|
|
336
|
+
last_delivery: GithubDeliveryHealth | null;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
export interface Project {
|
|
340
|
+
id: ProjectId;
|
|
341
|
+
object: "project";
|
|
342
|
+
name: string;
|
|
343
|
+
source: ProjectSource;
|
|
344
|
+
packages: ProjectPackages;
|
|
345
|
+
/**
|
|
346
|
+
* Regenerate when the spec changes: on every push to the default branch for a repository source,
|
|
347
|
+
* every 30 minutes for a URL source. Off by default: the first generation is always one you asked
|
|
348
|
+
* for. Off means only "generate now" and POST /projects/{project_id}/generations regenerate.
|
|
349
|
+
*/
|
|
350
|
+
auto_regen: boolean;
|
|
351
|
+
spec_patches: SpecPatch[];
|
|
352
|
+
config: Config | null;
|
|
353
|
+
/**
|
|
354
|
+
* Whether the hosted MCP endpoint is on. Requires the MCP output and Enterprise; turning the
|
|
355
|
+
* output off turns this off.
|
|
356
|
+
*/
|
|
357
|
+
mcp_enabled: boolean;
|
|
358
|
+
/** Path of the hosted MCP endpoint while it is on; read-only. */
|
|
359
|
+
mcp_url: string | null;
|
|
360
|
+
/**
|
|
361
|
+
* Whether the webhook relay is on, letting the generated CLI's webhooks listen command mint relay
|
|
362
|
+
* sessions. Requires the cli output and Pro; turning the output off turns this off.
|
|
363
|
+
*/
|
|
364
|
+
relay_enabled: boolean;
|
|
365
|
+
/**
|
|
366
|
+
* First-class generated outputs. Any non-empty combination is valid. Free keeps every selected
|
|
367
|
+
* output current for the first 25 operations in one linked project. On Pro, each selected output
|
|
368
|
+
* is billed once; shared implementation runtimes are included.
|
|
369
|
+
*/
|
|
370
|
+
outputs: OutputId[];
|
|
371
|
+
/** Format: date-time */
|
|
372
|
+
created_at: string;
|
|
373
|
+
/**
|
|
374
|
+
* When the project configuration last changed.
|
|
375
|
+
* Format: date-time
|
|
376
|
+
*/
|
|
377
|
+
updated_at: string;
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
export interface CreateProjectRequest {
|
|
381
|
+
name: string;
|
|
382
|
+
source: ProjectSourceInput;
|
|
383
|
+
/** First-class outputs Typeship will keep current for this project. */
|
|
384
|
+
outputs: OutputId[];
|
|
385
|
+
/**
|
|
386
|
+
* Initial package names, versions, and destinations. Omitted outputs use derived names and no
|
|
387
|
+
* destination.
|
|
388
|
+
*/
|
|
389
|
+
packages?: Packages;
|
|
390
|
+
/**
|
|
391
|
+
* Whether Typeship should regenerate automatically when the source changes.
|
|
392
|
+
* Default: false
|
|
393
|
+
*/
|
|
394
|
+
auto_regen?: boolean;
|
|
395
|
+
/** Initial patches. Omit or pass an empty array for none. */
|
|
396
|
+
spec_patches?: SpecPatch[];
|
|
397
|
+
/**
|
|
398
|
+
* Serve this project as a hosted MCP endpoint. Requires the MCP output and Enterprise.
|
|
399
|
+
* Default: false
|
|
400
|
+
*/
|
|
401
|
+
mcp_enabled?: boolean;
|
|
402
|
+
/**
|
|
403
|
+
* Enable webhook relay sessions. Requires the CLI output and Pro.
|
|
404
|
+
* Default: false
|
|
405
|
+
*/
|
|
406
|
+
relay_enabled?: boolean;
|
|
407
|
+
config?: Config | null;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
export interface UpdateProjectRequest {
|
|
411
|
+
name?: string;
|
|
412
|
+
source?: ProjectSourceInput;
|
|
413
|
+
/** Replaces the selected outputs; delivered files are not deleted. */
|
|
414
|
+
outputs?: OutputId[];
|
|
415
|
+
/**
|
|
416
|
+
* Replaces package configuration for every output. Include any existing output settings you want
|
|
417
|
+
* to keep.
|
|
418
|
+
*/
|
|
419
|
+
packages?: Packages;
|
|
420
|
+
auto_regen?: boolean;
|
|
421
|
+
/** Replaces the full patch list. Pass an empty array to clear it. */
|
|
422
|
+
spec_patches?: SpecPatch[];
|
|
423
|
+
/** Serve this project as a hosted MCP endpoint. Requires the MCP output and Enterprise. */
|
|
424
|
+
mcp_enabled?: boolean;
|
|
425
|
+
/** Enable webhook relay sessions. Requires the CLI output and Pro. */
|
|
426
|
+
relay_enabled?: boolean;
|
|
427
|
+
/** Replaces the entire configuration; pass null to clear it. */
|
|
428
|
+
config?: Config | null;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* The organization an API key belongs to. Members share its projects, keys, and plan; sign-in
|
|
433
|
+
* identity is not part of the API.
|
|
434
|
+
*/
|
|
435
|
+
export interface Account {
|
|
436
|
+
id: string;
|
|
437
|
+
object: "account";
|
|
438
|
+
/** The organization's display name. */
|
|
439
|
+
name: string;
|
|
440
|
+
plan: "free" | "pro" | "enterprise";
|
|
441
|
+
/** Format: date-time */
|
|
442
|
+
created_at: string;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/** How the generated CLI behaves. Part of Config. */
|
|
446
|
+
export interface CliBehavior {
|
|
447
|
+
/**
|
|
448
|
+
* resource.method of a zero-argument GET that the generated CLI's whoami command calls. Overrides
|
|
449
|
+
* auto-detection; a value that matches nothing is reported as a generation warning.
|
|
450
|
+
*/
|
|
451
|
+
whoami_operation?: string | null;
|
|
452
|
+
/**
|
|
453
|
+
* OAuth client id baked into the generated CLI for device-flow login. Without it, login prompts
|
|
454
|
+
* for a pasted credential.
|
|
455
|
+
*/
|
|
456
|
+
oauth_client_id?: string | null;
|
|
457
|
+
/**
|
|
458
|
+
* Scopes requested during device-flow login. Include offline_access if the authorization server
|
|
459
|
+
* gates refresh tokens behind it.
|
|
460
|
+
*/
|
|
461
|
+
oauth_scopes?: string[];
|
|
462
|
+
/**
|
|
463
|
+
* Audience sent with the device-authorization request, for authorization servers that require one
|
|
464
|
+
* to issue API-valid access tokens.
|
|
465
|
+
*/
|
|
466
|
+
oauth_audience?: string | null;
|
|
467
|
+
/**
|
|
468
|
+
* Opt in to a once-a-day registry check that prints an upgrade hint. Off by default; generated
|
|
469
|
+
* code phones nobody unless this is enabled.
|
|
470
|
+
*/
|
|
471
|
+
update_notice?: boolean;
|
|
472
|
+
/**
|
|
473
|
+
* Where the generated CLI's feedback command sends users. GitHub issues/new URLs get a prefilled
|
|
474
|
+
* title and environment details.
|
|
475
|
+
*/
|
|
476
|
+
support_url?: string | null;
|
|
477
|
+
/**
|
|
478
|
+
* Base URL of the browser-approval endpoint pair used by CLI login. The CLI keeps the verifier
|
|
479
|
+
* and receives the credential directly; no key is pasted through a conversation.
|
|
480
|
+
*/
|
|
481
|
+
auth_url?: string | null;
|
|
482
|
+
/**
|
|
483
|
+
* Hosted MCP endpoint installed by the generated CLI instead of launching the package's local
|
|
484
|
+
* stdio server.
|
|
485
|
+
*/
|
|
486
|
+
mcp_url?: string | null;
|
|
487
|
+
/** GitHub owner/name of the skills package the generated CLI offers to install during init. */
|
|
488
|
+
skills_repo?: string | null;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/** How the generated MCP server and the hosted endpoint behave. Part of Config. */
|
|
492
|
+
export interface McpBehavior {
|
|
493
|
+
/**
|
|
494
|
+
* MCP tool shape. meta collapses per-operation tools into search_docs, read_docs, and execute so
|
|
495
|
+
* large APIs don't flood an agent's context window. Auto considers the serialized tool schemas,
|
|
496
|
+
* switching near 10k tokens or above 100 operations.
|
|
497
|
+
*/
|
|
498
|
+
tool_mode?: "auto" | "operations" | "meta";
|
|
499
|
+
/**
|
|
500
|
+
* Guidance appended to the MCP server's instructions, which agents read once when they connect
|
|
501
|
+
* (server/discover): what to call first, conventions the spec does not state, what not to do.
|
|
502
|
+
* Carried by the package's server and the hosted endpoint alike.
|
|
503
|
+
*/
|
|
504
|
+
instructions?: string | null;
|
|
505
|
+
/**
|
|
506
|
+
* Hand-written MCP tool descriptions keyed by operationId or "METHOD /path". Each replaces the
|
|
507
|
+
* text typeship derives for that operation (summary, first sentence, method and path, deprecation
|
|
508
|
+
* and auth notes). For flows the spec cannot describe, such as a multi-step upload. Keys that
|
|
509
|
+
* match no operation are reported as generation warnings.
|
|
510
|
+
*/
|
|
511
|
+
tool_descriptions?: Record<string, string>;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
/**
|
|
515
|
+
* Published-package metadata the API spec does not own. Repository is derived from each
|
|
516
|
+
* destination; release versions belong to packages.
|
|
517
|
+
*/
|
|
518
|
+
export interface PackageBehavior {
|
|
519
|
+
/**
|
|
520
|
+
* Lockstep version fallback. Prefer packages.<output>.version so every SDK, CLI, and MCP package
|
|
521
|
+
* can advance independently.
|
|
522
|
+
* @deprecated
|
|
523
|
+
*/
|
|
524
|
+
version?: string | null;
|
|
525
|
+
/** Homepage written into registry metadata. */
|
|
526
|
+
homepage?: string | null;
|
|
527
|
+
/** SPDX identifier written into registry metadata. Defaults to info.license. */
|
|
528
|
+
license?: string | null;
|
|
529
|
+
/**
|
|
530
|
+
* Exact LICENSE file contents. Supply this for licences the engine does not build in; MIT is
|
|
531
|
+
* built in when copyright is also set.
|
|
532
|
+
*/
|
|
533
|
+
license_text?: string | null;
|
|
534
|
+
/** Copyright line used in generated license files. */
|
|
535
|
+
copyright?: string | null;
|
|
536
|
+
/** CLI executable name when it differs from the npm package name. */
|
|
537
|
+
bin_name?: string | null;
|
|
538
|
+
/** Go identifier when the destination repository name is unsuitable. */
|
|
539
|
+
go_package_name?: string | null;
|
|
540
|
+
/** Official MCP registry name written into package.json. */
|
|
541
|
+
mcp_name?: string | null;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/**
|
|
545
|
+
* Everything typeship needs beyond the spec, in one object: generation customization (globals,
|
|
546
|
+
* retries, pagination) and how the generated tooling behaves (cli, mcp, package, docs_url). Plain
|
|
547
|
+
* configuration. typeship never requires vendor extensions inside the spec itself. The same shape
|
|
548
|
+
* is accepted on a project and on POST /generate.
|
|
549
|
+
*/
|
|
550
|
+
export interface Config {
|
|
551
|
+
/**
|
|
552
|
+
* Wire names of query/header parameters that become settable once on the generated client and
|
|
553
|
+
* auto-apply to every operation that accepts them; per-call values win. Names that match nothing
|
|
554
|
+
* are reported as generation warnings.
|
|
555
|
+
*/
|
|
556
|
+
globals?: string[];
|
|
557
|
+
retries?: RetryTuning;
|
|
558
|
+
/**
|
|
559
|
+
* Per-operation pagination control, keyed by operationId or "METHOD /path". Unmatched keys are
|
|
560
|
+
* reported as generation warnings.
|
|
561
|
+
*/
|
|
562
|
+
pagination?: Record<string, PaginationRule | boolean>;
|
|
563
|
+
graphql?: GraphqlSettings;
|
|
564
|
+
cli?: CliBehavior;
|
|
565
|
+
mcp?: McpBehavior;
|
|
566
|
+
package?: PackageBehavior;
|
|
567
|
+
/**
|
|
568
|
+
* The API's documentation site. Read through its llms.txt by the generated CLI's docs command,
|
|
569
|
+
* the MCP server's docs tools, and the package's AGENTS.md. Defaults to the spec's externalDocs
|
|
570
|
+
* URL.
|
|
571
|
+
*/
|
|
572
|
+
docs_url?: string | null;
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
/** What a GraphQL schema cannot say about itself. Ignored for OpenAPI specs. */
|
|
576
|
+
export interface GraphqlSettings {
|
|
577
|
+
/**
|
|
578
|
+
* The URL every request is POSTed to; the generated client's default baseUrl. Defaults to the URL
|
|
579
|
+
* the schema was fetched from. Without either, baseUrl is a required client option.
|
|
580
|
+
* Format: uri
|
|
581
|
+
*/
|
|
582
|
+
endpoint?: string;
|
|
583
|
+
/**
|
|
584
|
+
* Named endpoints (sandbox, production). Each becomes a client environment; the first is the
|
|
585
|
+
* default unless endpoint is set.
|
|
586
|
+
*/
|
|
587
|
+
environments?: Array<{
|
|
588
|
+
name: string;
|
|
589
|
+
/** Format: uri */
|
|
590
|
+
url: string;
|
|
591
|
+
}>;
|
|
592
|
+
/**
|
|
593
|
+
* How requests authenticate. bearer sends Authorization: Bearer; basic is for key-pair APIs
|
|
594
|
+
* (public key as username, private key as password); api_key sends a header named by
|
|
595
|
+
* api_key_header; none generates no auth option.
|
|
596
|
+
* Default: "bearer"
|
|
597
|
+
*/
|
|
598
|
+
auth?: "bearer" | "basic" | "api_key" | "none";
|
|
599
|
+
/**
|
|
600
|
+
* Header carrying the key when auth is api_key. Required for that mode; Typeship does not invent
|
|
601
|
+
* a vendor-specific header name.
|
|
602
|
+
*/
|
|
603
|
+
api_key_header?: string;
|
|
604
|
+
/**
|
|
605
|
+
* The API's name; drives the package and client names ("Braintree" gives braintree and
|
|
606
|
+
* BraintreeClient). Defaults to a name derived from the endpoint's host.
|
|
607
|
+
*/
|
|
608
|
+
title?: string;
|
|
609
|
+
/**
|
|
610
|
+
* JSON representation of each custom scalar, keyed by GraphQL scalar name. Unmapped scalars
|
|
611
|
+
* generate as the language's untyped JSON value and produce a warning. Unmatched keys warn.
|
|
612
|
+
*/
|
|
613
|
+
scalars?: Record<string, "string" | "integer" | "number" | "boolean" | "json">;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
/**
|
|
617
|
+
* Retry behavior. Top-level fields adjust every operation; operations maps operationId or "METHOD
|
|
618
|
+
* /path" keys to per-operation overrides.
|
|
619
|
+
*/
|
|
620
|
+
export interface RetryTuning {
|
|
621
|
+
max_retries?: number;
|
|
622
|
+
/** Replaces the default retryable set (408, 429, 500, 502, 503, 504). */
|
|
623
|
+
statuses?: number[];
|
|
624
|
+
initial_delay_ms?: number;
|
|
625
|
+
max_delay_ms?: number;
|
|
626
|
+
/** Also retry non-idempotent methods (POST/PATCH). */
|
|
627
|
+
retry_non_idempotent?: boolean;
|
|
628
|
+
/** Shorthand for max_retries 0. */
|
|
629
|
+
disabled?: boolean;
|
|
630
|
+
operations?: Record<string, RetryTuning>;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
export interface PaginationRule {
|
|
634
|
+
/** Default: "cursor" */
|
|
635
|
+
style?: "cursor" | "cursorFromLastId" | "page" | "offset";
|
|
636
|
+
/** Response field holding the item array. */
|
|
637
|
+
items_field: string;
|
|
638
|
+
cursor_param?: string;
|
|
639
|
+
next_cursor_field?: string;
|
|
640
|
+
has_more_field?: string;
|
|
641
|
+
id_field?: string;
|
|
642
|
+
page_param?: string;
|
|
643
|
+
offset_param?: string;
|
|
644
|
+
limit_param?: string;
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
export interface FileStub {
|
|
648
|
+
path: string;
|
|
649
|
+
bytes: number;
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
export interface Generation {
|
|
653
|
+
id: GenerationId;
|
|
654
|
+
object: "generation";
|
|
655
|
+
/**
|
|
656
|
+
* Present and true when the generated output was too large to inline; files_index lists paths,
|
|
657
|
+
* fetched one at a time via GET /generations/{generation_id}/file.
|
|
658
|
+
*/
|
|
659
|
+
files_omitted?: boolean;
|
|
660
|
+
files_index?: FileStub[];
|
|
661
|
+
project_id: ProjectId;
|
|
662
|
+
status: "succeeded" | "failed";
|
|
663
|
+
trigger: "manual" | "webhook" | "poll" | "preview";
|
|
664
|
+
/** The independently delivered output this run generated. */
|
|
665
|
+
output: OutputId;
|
|
666
|
+
/** Null only for a failed or legacy generation that produced no metadata. */
|
|
667
|
+
meta: GenerationMeta | null;
|
|
668
|
+
warnings: string[];
|
|
669
|
+
/** Present on retrieve and create; omitted in lists. */
|
|
670
|
+
files?: GeneratedFile[];
|
|
671
|
+
error: string | null;
|
|
672
|
+
/** Format: date-time */
|
|
673
|
+
created_at: string;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
/** A selected output that did not generate in a multi-output run. */
|
|
677
|
+
export interface GenerationFailure {
|
|
678
|
+
output: OutputId;
|
|
679
|
+
status: "failed";
|
|
680
|
+
error: string;
|
|
681
|
+
}
|
|
682
|
+
|
|
683
|
+
export interface GenerationBatch {
|
|
684
|
+
data: Array<Generation | GenerationFailure>;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export interface ApiKey {
|
|
688
|
+
id: string;
|
|
689
|
+
object: "api_key";
|
|
690
|
+
name: string;
|
|
691
|
+
/** Last four characters of the secret; the secret itself is never stored. */
|
|
692
|
+
last4: string;
|
|
693
|
+
revoked: boolean;
|
|
694
|
+
/** Format: date-time */
|
|
695
|
+
last_used_at: string | null;
|
|
696
|
+
/** Format: date-time */
|
|
697
|
+
created_at: string;
|
|
698
|
+
}
|
|
699
|
+
|
|
700
|
+
export interface UrlSpecRevisionSource {
|
|
701
|
+
kind: "url";
|
|
702
|
+
/** Format: uri */
|
|
703
|
+
url: string;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
export interface GithubSpecRevisionSource {
|
|
707
|
+
kind: "github";
|
|
708
|
+
/** GitHub repository in owner/name form. */
|
|
709
|
+
repository: string;
|
|
710
|
+
/** Repository-relative specification path. */
|
|
711
|
+
path: string;
|
|
712
|
+
/** Git ref resolved for this revision, when recorded. */
|
|
713
|
+
ref?: string | null;
|
|
714
|
+
/** Exact Git commit consumed, when recorded. */
|
|
715
|
+
commit_sha?: string | null;
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
export type SpecRevisionSource = UrlSpecRevisionSource | GithubSpecRevisionSource;
|
|
719
|
+
|
|
720
|
+
export interface SpecRevision {
|
|
721
|
+
id: SpecRevisionId;
|
|
722
|
+
object: "spec_revision";
|
|
723
|
+
project_id: ProjectId;
|
|
724
|
+
/** SHA-256 digest of the exact raw specification text. */
|
|
725
|
+
sha256: string;
|
|
726
|
+
/** Size of the raw specification text in bytes. */
|
|
727
|
+
size_bytes: number;
|
|
728
|
+
/** Origin recorded when this immutable revision was created. */
|
|
729
|
+
source: SpecRevisionSource | null;
|
|
730
|
+
/** Format: date-time */
|
|
731
|
+
created_at: string;
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
export interface ProjectList {
|
|
735
|
+
object: ListObject;
|
|
736
|
+
data: Project[];
|
|
737
|
+
/** Whether another page is available after this one. */
|
|
738
|
+
has_more: boolean;
|
|
739
|
+
/** Pass this value as cursor to retrieve the next page; null on the last page. */
|
|
740
|
+
next_cursor: string | null;
|
|
741
|
+
}
|
|
742
|
+
|
|
743
|
+
export interface GenerationList {
|
|
744
|
+
object: ListObject;
|
|
745
|
+
data: Generation[];
|
|
746
|
+
/** Whether another page is available after this one. */
|
|
747
|
+
has_more: boolean;
|
|
748
|
+
/** Pass this value as cursor to retrieve the next page; null on the last page. */
|
|
749
|
+
next_cursor: string | null;
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
export interface SpecRevisionList {
|
|
753
|
+
object: ListObject;
|
|
754
|
+
data: SpecRevision[];
|
|
755
|
+
/** Whether another page is available after this one. */
|
|
756
|
+
has_more: boolean;
|
|
757
|
+
/** Pass this value as cursor to retrieve the next page; null on the last page. */
|
|
758
|
+
next_cursor: string | null;
|
|
759
|
+
}
|
|
760
|
+
|
|
761
|
+
export interface ApiKeyList {
|
|
762
|
+
object: ListObject;
|
|
763
|
+
data: ApiKey[];
|
|
764
|
+
/** Whether another page is available after this one. */
|
|
765
|
+
has_more: boolean;
|
|
766
|
+
/** Pass this value as cursor to retrieve the next page; null on the last page. */
|
|
767
|
+
next_cursor: string | null;
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
export interface DeletedProject {
|
|
771
|
+
id: ProjectId;
|
|
772
|
+
object: "project";
|
|
773
|
+
deleted: true;
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
/** Stable category for deciding how to handle the error. */
|
|
777
|
+
export const ErrorType = {
|
|
778
|
+
REQUEST_ERROR: "request_error",
|
|
779
|
+
AUTHENTICATION_ERROR: "authentication_error",
|
|
780
|
+
AUTHORIZATION_ERROR: "authorization_error",
|
|
781
|
+
PLAN_ERROR: "plan_error",
|
|
782
|
+
SOURCE_ERROR: "source_error",
|
|
783
|
+
RATE_LIMIT_ERROR: "rate_limit_error",
|
|
784
|
+
API_ERROR: "api_error",
|
|
785
|
+
} as const;
|
|
786
|
+
export type ErrorType = (typeof ErrorType)[keyof typeof ErrorType];
|
|
787
|
+
|
|
788
|
+
/** Stable programmatic identifier. Do not branch on message. */
|
|
789
|
+
export const ErrorCode = {
|
|
790
|
+
INVALID_REQUEST: "invalid_request",
|
|
791
|
+
IDEMPOTENCY_KEY_REUSED: "idempotency_key_reused",
|
|
792
|
+
UNAUTHORIZED: "unauthorized",
|
|
793
|
+
ORGANIZATION_REQUIRED: "organization_required",
|
|
794
|
+
NOT_FOUND: "not_found",
|
|
795
|
+
SPEC_ERROR: "spec_error",
|
|
796
|
+
FETCH_ERROR: "fetch_error",
|
|
797
|
+
PLAN_LIMIT_REACHED: "plan_limit_reached",
|
|
798
|
+
PAYLOAD_TOO_LARGE: "payload_too_large",
|
|
799
|
+
RATE_LIMITED: "rate_limited",
|
|
800
|
+
INTERNAL_ERROR: "internal_error",
|
|
801
|
+
} as const;
|
|
802
|
+
export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
|
|
803
|
+
|
|
804
|
+
export interface ErrorDetail {
|
|
805
|
+
type: ErrorType;
|
|
806
|
+
code: ErrorCode;
|
|
807
|
+
/** JSON Pointer to the invalid request field, when one field caused the error. */
|
|
808
|
+
field?: string;
|
|
809
|
+
/** Human-readable explanation. Its wording may change. */
|
|
810
|
+
message: string;
|
|
811
|
+
/** Whether retrying later can succeed without changing the request. */
|
|
812
|
+
retryable: boolean;
|
|
813
|
+
/** Stable, concise recovery instruction suitable for a person or agent. */
|
|
814
|
+
suggested_action: string;
|
|
815
|
+
/**
|
|
816
|
+
* Documentation for this class of error.
|
|
817
|
+
* Format: uri
|
|
818
|
+
*/
|
|
819
|
+
docs_url: string;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
export interface ErrorModel {
|
|
823
|
+
errors: ErrorDetail[];
|
|
824
|
+
request_id: RequestId;
|
|
825
|
+
}
|