@typeship-ax/mcp 0.6.0 → 0.9.1
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 +31 -0
- package/README.md +67 -10
- package/api.json +6735 -3243
- package/api.md +8537 -248
- package/dist/api-identity.d.ts +40 -0
- package/dist/api-identity.d.ts.map +1 -0
- package/dist/api-identity.js +128 -0
- package/dist/auth-profiles.d.ts +30 -0
- package/dist/auth-profiles.d.ts.map +1 -0
- package/dist/auth-profiles.js +138 -0
- package/dist/core/http.d.ts +21 -92
- package/dist/core/http.d.ts.map +1 -1
- package/dist/core/http.js +143 -221
- package/dist/core/pagination.d.ts.map +1 -1
- package/dist/core/pagination.js +6 -34
- package/dist/credential-storage.d.ts +24 -0
- package/dist/credential-storage.d.ts.map +1 -0
- package/dist/credential-storage.js +207 -0
- package/dist/dates.d.ts +0 -2
- package/dist/dates.d.ts.map +1 -1
- package/dist/dates.js +0 -1
- package/dist/docs.d.ts +36 -0
- package/dist/docs.d.ts.map +1 -0
- package/dist/docs.js +258 -0
- package/dist/errors.d.ts +42 -34
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +30 -20
- package/dist/index.d.ts +27 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +40 -14
- package/dist/mcp-authorization.d.ts +52 -0
- package/dist/mcp-authorization.d.ts.map +1 -0
- package/dist/mcp-authorization.js +232 -0
- package/dist/mcp-protocol.d.ts +69 -25
- package/dist/mcp-protocol.d.ts.map +1 -1
- package/dist/mcp-protocol.js +386 -138
- package/dist/mcp.d.ts +21 -3
- package/dist/mcp.d.ts.map +1 -1
- package/dist/mcp.js +199 -85
- package/dist/named-credentials.d.ts +21 -0
- package/dist/named-credentials.d.ts.map +1 -0
- package/dist/named-credentials.js +86 -0
- package/dist/oauth-request.d.ts +21 -0
- package/dist/oauth-request.d.ts.map +1 -0
- package/dist/oauth-request.js +119 -0
- package/dist/oauth-session.d.ts +106 -0
- package/dist/oauth-session.d.ts.map +1 -0
- package/dist/oauth-session.js +244 -0
- package/dist/ops.d.ts +18 -0
- package/dist/ops.d.ts.map +1 -1
- package/dist/ops.js +31 -17
- package/dist/resources/account.d.ts +4 -4
- package/dist/resources/account.d.ts.map +1 -1
- package/dist/resources/account.js +1 -0
- package/dist/resources/api-keys.d.ts +13 -8
- package/dist/resources/api-keys.d.ts.map +1 -1
- package/dist/resources/api-keys.js +5 -1
- package/dist/resources/definition-revisions.d.ts +58 -0
- package/dist/resources/definition-revisions.d.ts.map +1 -0
- package/dist/resources/definition-revisions.js +114 -0
- package/dist/resources/definitions.d.ts +35 -0
- package/dist/resources/definitions.d.ts.map +1 -0
- package/dist/resources/definitions.js +60 -0
- package/dist/resources/generate.d.ts +18 -7
- package/dist/resources/generate.d.ts.map +1 -1
- package/dist/resources/generate.js +13 -5
- package/dist/resources/generations.d.ts +6 -6
- package/dist/resources/generations.d.ts.map +1 -1
- package/dist/resources/generations.js +3 -1
- package/dist/resources/projects.d.ts +111 -35
- package/dist/resources/projects.d.ts.map +1 -1
- package/dist/resources/projects.js +125 -15
- package/dist/resources/targets.d.ts +97 -0
- package/dist/resources/targets.d.ts.map +1 -0
- package/dist/resources/targets.js +197 -0
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +135 -62
- package/dist/types.d.ts +2072 -267
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +20 -3
- package/dist/worker.js +4 -4
- package/package.json +11 -1
- package/server.json +42 -0
- package/src/api-identity.ts +98 -0
- package/src/auth-profiles.ts +114 -0
- package/src/core/http.ts +156 -305
- package/src/core/pagination.ts +6 -30
- package/src/credential-storage.ts +183 -0
- package/src/dates.ts +0 -1
- package/src/docs.ts +239 -0
- package/src/errors.ts +52 -41
- package/src/index.ts +49 -14
- package/src/mcp-authorization.ts +211 -0
- package/src/mcp-protocol.ts +432 -133
- package/src/mcp.ts +204 -90
- package/src/named-credentials.ts +74 -0
- package/src/oauth-request.ts +90 -0
- package/src/oauth-session.ts +258 -0
- package/src/ops.ts +56 -17
- package/src/resources/account.ts +6 -3
- package/src/resources/api-keys.ts +27 -7
- package/src/resources/definition-revisions.ts +207 -0
- package/src/resources/definitions.ts +122 -0
- package/src/resources/generate.ts +29 -6
- package/src/resources/generations.ts +9 -4
- package/src/resources/projects.ts +274 -41
- package/src/resources/targets.ts +378 -0
- package/src/schemas.ts +135 -62
- package/src/types.ts +2273 -322
- package/src/worker.ts +4 -4
- package/dist/resources/spec-revisions.d.ts +0 -47
- package/dist/resources/spec-revisions.d.ts.map +0 -1
- package/dist/resources/spec-revisions.js +0 -90
- package/src/resources/spec-revisions.ts +0 -150
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Identity comes from the authenticated API response, including opaque-token APIs. */
|
|
2
|
+
export type IdentityKind = "subject" | "account" | "organization";
|
|
3
|
+
export type IdentityPolicy = Partial<Record<IdentityKind, string>>;
|
|
4
|
+
export type ApiIdentity = Partial<Record<IdentityKind, string | null>>;
|
|
5
|
+
export interface VerifiedIdentity {
|
|
6
|
+
values: ApiIdentity;
|
|
7
|
+
checkedAt: string;
|
|
8
|
+
}
|
|
9
|
+
export interface IdentityConfiguration {
|
|
10
|
+
operation: string;
|
|
11
|
+
fields: IdentityPolicy;
|
|
12
|
+
}
|
|
13
|
+
export declare function validateIdentityPointer(pointer: unknown): asserts pointer is string;
|
|
14
|
+
export declare function identityPolicyOf(auth?: {
|
|
15
|
+
identitySubject?: string | null;
|
|
16
|
+
identityAccount?: string | null;
|
|
17
|
+
identityOrganization?: string | null;
|
|
18
|
+
}): IdentityPolicy;
|
|
19
|
+
export declare function readApiIdentity(data: unknown, policy: IdentityPolicy): ApiIdentity;
|
|
20
|
+
export declare function assertApiIdentity(expected: ApiIdentity, actual: ApiIdentity): void;
|
|
21
|
+
/** No redirects, bounded decoded response, and one deadline including body reads. */
|
|
22
|
+
export declare function identityFetch(apiBaseUrl: string): typeof fetch;
|
|
23
|
+
type IdentityResult = {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
data?: unknown;
|
|
26
|
+
error?: {
|
|
27
|
+
status?: number;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
export declare function identityResult(client: unknown, operation: {
|
|
31
|
+
resource: string;
|
|
32
|
+
method: string;
|
|
33
|
+
}): Promise<IdentityResult>;
|
|
34
|
+
export declare function verifyClientIdentity(createClient: (options: Record<string, unknown>) => unknown, options: Record<string, unknown>, operation: {
|
|
35
|
+
resource: string;
|
|
36
|
+
method: string;
|
|
37
|
+
}, policy: IdentityPolicy, expected?: ApiIdentity): Promise<VerifiedIdentity>;
|
|
38
|
+
export declare function verifyApiIdentity(read: (anonymous: boolean) => Promise<IdentityResult>, policy: IdentityPolicy, expected?: ApiIdentity): Promise<VerifiedIdentity>;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=api-identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-identity.d.ts","sourceRoot":"","sources":["../src/api-identity.ts"],"names":[],"mappings":"AAAA,uFAAuF;AACvF,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;AAClE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;AACnE,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC;AACvE,MAAM,WAAW,gBAAgB;IAAG,MAAM,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE;AAC5E,MAAM,WAAW,qBAAqB;IAAG,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,cAAc,CAAA;CAAE;AAEpF,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,MAAM,CAInF;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE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EAAE,QAAQ,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,gBAAgB,CAAC,CASxK"}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
export function validateIdentityPointer(pointer) {
|
|
2
|
+
if (typeof pointer !== "string" || !pointer.startsWith("/") || pointer.length > 512 || /[\x00-\x1f\x7f]/.test(pointer) || /~(?:[^01]|$)/.test(pointer)) {
|
|
3
|
+
throw new Error("Identity fields must be JSON Pointers starting with /, at most 512 characters, with ~0 and ~1 escapes.");
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
export function identityPolicyOf(auth = {}) {
|
|
7
|
+
const entries = [["subject", auth.identitySubject], ["account", auth.identityAccount], ["organization", auth.identityOrganization]];
|
|
8
|
+
const policy = {};
|
|
9
|
+
for (const [kind, pointer] of entries)
|
|
10
|
+
if (pointer !== undefined && pointer !== null) {
|
|
11
|
+
validateIdentityPointer(pointer);
|
|
12
|
+
policy[kind] = pointer;
|
|
13
|
+
}
|
|
14
|
+
return policy;
|
|
15
|
+
}
|
|
16
|
+
export function readApiIdentity(data, policy) {
|
|
17
|
+
const result = {};
|
|
18
|
+
if (!Object.keys(policy).length)
|
|
19
|
+
throw new Error("Configure at least one identity field before verifying a session.");
|
|
20
|
+
for (const [kind, pointer] of Object.entries(policy)) {
|
|
21
|
+
validateIdentityPointer(pointer);
|
|
22
|
+
let value = data;
|
|
23
|
+
for (const part of pointer.slice(1).split("/").map((part) => part.replaceAll("~1", "/").replaceAll("~0", "~"))) {
|
|
24
|
+
if (!value || typeof value !== "object" || !Object.hasOwn(value, part))
|
|
25
|
+
throw new Error("The API identity response is missing a configured field. Check the identity field mapping.");
|
|
26
|
+
value = value[part];
|
|
27
|
+
}
|
|
28
|
+
if (value === null && kind === "organization")
|
|
29
|
+
result[kind] = null;
|
|
30
|
+
else if ((typeof value === "string" && value.length > 0 && value.length <= 512 && !/[\x00-\x1f\x7f]/.test(value)) || (typeof value === "number" && Number.isSafeInteger(value)))
|
|
31
|
+
result[kind] = String(value);
|
|
32
|
+
else
|
|
33
|
+
throw new Error("The API identity field must return a nonempty ID string or safe integer. Only an organization may be null.");
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
export function assertApiIdentity(expected, actual) {
|
|
38
|
+
if (!Object.keys(expected).length || Object.entries(expected).some(([key, value]) => !Object.hasOwn(actual, key) || actual[key] !== value)) {
|
|
39
|
+
throw new Error("The authenticated account, subject or organization does not match this login. Sign in again with the intended account and organization.");
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/** No redirects, bounded decoded response, and one deadline including body reads. */
|
|
43
|
+
export function identityFetch(apiBaseUrl) {
|
|
44
|
+
const base = new URL(apiBaseUrl);
|
|
45
|
+
if ((base.protocol !== "https:" && !(base.protocol === "http:" && ["localhost", "127.0.0.1", "[::1]"].includes(base.hostname))) || base.username || base.password || base.search || base.hash)
|
|
46
|
+
throw new Error("Identity verification requires an HTTPS API URL; loopback HTTP is allowed for development.");
|
|
47
|
+
const basePath = base.pathname.replace(/\/+$/, "");
|
|
48
|
+
return async (input, init) => {
|
|
49
|
+
const url = new URL(input instanceof Request ? input.url : String(input));
|
|
50
|
+
if (url.origin !== base.origin || (url.pathname !== basePath && !url.pathname.startsWith(basePath + "/")) || url.username || url.password || url.hash)
|
|
51
|
+
throw new Error("The identity read must stay on the configured API.");
|
|
52
|
+
const abort = new AbortController();
|
|
53
|
+
const timeout = setTimeout(() => abort.abort(), 10_000);
|
|
54
|
+
try {
|
|
55
|
+
const signal = init?.signal ? AbortSignal.any([init.signal, abort.signal]) : abort.signal;
|
|
56
|
+
const response = await fetch(input, { ...init, redirect: "error", signal });
|
|
57
|
+
const reader = response.body?.getReader();
|
|
58
|
+
const chunks = [];
|
|
59
|
+
let size = 0;
|
|
60
|
+
if (reader) {
|
|
61
|
+
try {
|
|
62
|
+
while (true) {
|
|
63
|
+
const chunk = await reader.read();
|
|
64
|
+
if (chunk.done)
|
|
65
|
+
break;
|
|
66
|
+
size += chunk.value.byteLength;
|
|
67
|
+
if (size > 1_048_576) {
|
|
68
|
+
abort.abort();
|
|
69
|
+
throw new Error();
|
|
70
|
+
}
|
|
71
|
+
chunks.push(chunk.value);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
reader.releaseLock();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
const bytes = new Uint8Array(size);
|
|
79
|
+
let offset = 0;
|
|
80
|
+
for (const chunk of chunks) {
|
|
81
|
+
bytes.set(chunk, offset);
|
|
82
|
+
offset += chunk.byteLength;
|
|
83
|
+
}
|
|
84
|
+
return new Response([204, 205, 304].includes(response.status) ? null : bytes, { status: response.status, statusText: response.statusText, headers: response.headers });
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
throw new Error("The API identity read failed. Check the API URL, connectivity and response size before signing in again.");
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
clearTimeout(timeout);
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
export async function identityResult(client, operation) {
|
|
95
|
+
const target = client[operation.resource];
|
|
96
|
+
if (!target?.[operation.method])
|
|
97
|
+
throw new Error("The configured identity operation is not available in this package.");
|
|
98
|
+
return target[operation.method]();
|
|
99
|
+
}
|
|
100
|
+
export function verifyClientIdentity(createClient, options, operation, policy, expected) {
|
|
101
|
+
if (typeof options.baseUrl !== "string")
|
|
102
|
+
throw new Error("Configure the API base URL before verifying identity.");
|
|
103
|
+
const shared = { baseUrl: options.baseUrl, environment: options.environment, fetch: identityFetch(options.baseUrl), maxRetries: 0, timeoutMs: 10_000 };
|
|
104
|
+
return verifyApiIdentity((anonymous) => identityResult(createClient(anonymous ? shared : { ...options, ...shared }), operation), policy, expected);
|
|
105
|
+
}
|
|
106
|
+
export async function verifyApiIdentity(read, policy, expected) {
|
|
107
|
+
let anonymous, authenticated;
|
|
108
|
+
try {
|
|
109
|
+
anonymous = await read(true);
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
throw new Error("Could not verify that the identity read rejects anonymous access.");
|
|
113
|
+
}
|
|
114
|
+
if (anonymous.ok || ![401, 403].includes(anonymous.error?.status ?? 0))
|
|
115
|
+
throw new Error("The identity read must reject anonymous access with 401 or 403 before login can be verified.");
|
|
116
|
+
try {
|
|
117
|
+
authenticated = await read(false);
|
|
118
|
+
}
|
|
119
|
+
catch {
|
|
120
|
+
throw new Error("The API identity read failed with the new credential. Check the API configuration and granted permissions.");
|
|
121
|
+
}
|
|
122
|
+
if (!authenticated.ok)
|
|
123
|
+
throw new Error("The API did not accept the new login credential for its identity read. Check the audience, scopes and account access.");
|
|
124
|
+
const values = readApiIdentity(authenticated.data, policy);
|
|
125
|
+
if (expected)
|
|
126
|
+
assertApiIdentity(expected, values);
|
|
127
|
+
return { values, checkedAt: new Date().toISOString() };
|
|
128
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface ProfileConfig {
|
|
2
|
+
baseUrl?: string;
|
|
3
|
+
environment?: string;
|
|
4
|
+
docsUrl?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ProfileContext {
|
|
7
|
+
name: string;
|
|
8
|
+
directory: string;
|
|
9
|
+
source: "flag" | "environment" | "selected" | "default";
|
|
10
|
+
}
|
|
11
|
+
export declare function profileName(value: string): string;
|
|
12
|
+
export declare function profileDirectory(root: string, name: string): string;
|
|
13
|
+
export declare function resolveProfile(root: string, options?: {
|
|
14
|
+
flag?: string;
|
|
15
|
+
environment?: string;
|
|
16
|
+
allowMissing?: boolean;
|
|
17
|
+
}): ProfileContext;
|
|
18
|
+
export declare function selectProfile(root: string, name: string): void;
|
|
19
|
+
export declare function readProfileConfig(directory: string): ProfileConfig;
|
|
20
|
+
export declare function updateProfileConfig(directory: string, change: (current: ProfileConfig) => ProfileConfig): Promise<void>;
|
|
21
|
+
export declare function listProfiles(root: string): {
|
|
22
|
+
name: string;
|
|
23
|
+
config: ProfileConfig;
|
|
24
|
+
hasSavedCredentials: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
/** Removing a profile requires logout first. Hold the settings and both storage
|
|
27
|
+
* locks so a concurrent login cannot be deleted underneath its transaction. */
|
|
28
|
+
export declare function removeProfile(root: string, name: string): Promise<void>;
|
|
29
|
+
export declare function profileFlag(args: string[]): string | undefined;
|
|
30
|
+
//# sourceMappingURL=auth-profiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-profiles.d.ts","sourceRoot":"","sources":["../src/auth-profiles.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,aAAa;IAAG,OAAO,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE;AAC3F,MAAM,WAAW,cAAc;IAAG,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,aAAa,GAAG,UAAU,GAAG,SAAS,CAAA;CAAE;AAE5H,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGjD;AAqBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,cAAc,CAa1I;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAI9D;AAED,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAIlE;AAED,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAE7H;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAC;IAAC,mBAAmB,EAAE,OAAO,CAAA;CAAE,EAAE,CAYlH;AAED;+EAC+E;AAC/E,wBAAsB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAc7E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,SAAS,CAS9D"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import { FileCredentialStore } from "./oauth-session.js";
|
|
5
|
+
export function profileName(value) {
|
|
6
|
+
if (!/^[a-z0-9][a-z0-9_-]{0,63}$/.test(value) || /^(con|prn|aux|nul|com[0-9]|lpt[0-9])$/.test(value))
|
|
7
|
+
throw new Error("Profile names use 1–64 lowercase letters, numbers, hyphens or underscores and cannot be reserved OS names.");
|
|
8
|
+
return value;
|
|
9
|
+
}
|
|
10
|
+
function json(path) {
|
|
11
|
+
try {
|
|
12
|
+
const value = JSON.parse(readFileSync(path, "utf8"));
|
|
13
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
14
|
+
throw new Error();
|
|
15
|
+
return value;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (error.code === "ENOENT")
|
|
19
|
+
return null;
|
|
20
|
+
throw new Error("Cannot read profile settings. Repair the settings file before retrying.");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
function write(directory, file, value) {
|
|
24
|
+
mkdirSync(directory, { recursive: true, mode: 0o700 });
|
|
25
|
+
const temporary = join(directory, ".profile-" + randomBytes(16).toString("hex") + ".tmp");
|
|
26
|
+
try {
|
|
27
|
+
writeFileSync(temporary, JSON.stringify(value, null, 2) + "\n", { flag: "wx", mode: 0o600, flush: true });
|
|
28
|
+
renameSync(temporary, join(directory, file));
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
rmSync(temporary, { force: true });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function profileDirectory(root, name) {
|
|
35
|
+
const directory = join(root, "profiles", profileName(name));
|
|
36
|
+
try {
|
|
37
|
+
const entry = lstatSync(directory);
|
|
38
|
+
if (entry.isSymbolicLink() || !entry.isDirectory())
|
|
39
|
+
throw new Error("A profile must be a directory, not a link or another file.");
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (error.code !== "ENOENT")
|
|
43
|
+
throw error;
|
|
44
|
+
}
|
|
45
|
+
return directory;
|
|
46
|
+
}
|
|
47
|
+
export function resolveProfile(root, options = {}) {
|
|
48
|
+
let name, source;
|
|
49
|
+
if (options.flag !== undefined) {
|
|
50
|
+
name = profileName(options.flag);
|
|
51
|
+
source = "flag";
|
|
52
|
+
}
|
|
53
|
+
else if (options.environment !== undefined) {
|
|
54
|
+
name = profileName(options.environment);
|
|
55
|
+
source = "environment";
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const settings = json(join(root, "profiles.json"));
|
|
59
|
+
if (settings && typeof settings.selected !== "string")
|
|
60
|
+
throw new Error("The selected profile setting is invalid. Pass --profile default to recover.");
|
|
61
|
+
name = settings ? profileName(settings.selected) : "default";
|
|
62
|
+
source = settings ? "selected" : "default";
|
|
63
|
+
}
|
|
64
|
+
const directory = profileDirectory(root, name);
|
|
65
|
+
if (name !== "default" && !options.allowMissing && !existsSync(directory))
|
|
66
|
+
throw new Error("Profile '" + name + "' does not exist. Run login --profile " + name + " or configure that profile first.");
|
|
67
|
+
return { name, directory, source };
|
|
68
|
+
}
|
|
69
|
+
export function selectProfile(root, name) {
|
|
70
|
+
const directory = profileDirectory(root, name);
|
|
71
|
+
if (name !== "default" && !existsSync(directory))
|
|
72
|
+
throw new Error("Profile '" + name + "' does not exist. Log in or configure it before selecting it.");
|
|
73
|
+
write(root, "profiles.json", { selected: name });
|
|
74
|
+
}
|
|
75
|
+
export function readProfileConfig(directory) {
|
|
76
|
+
const value = json(join(directory, "config.json")) ?? {};
|
|
77
|
+
for (const [key, field] of Object.entries(value))
|
|
78
|
+
if (!["baseUrl", "environment", "docsUrl"].includes(key) || typeof field !== "string")
|
|
79
|
+
throw new Error("Profile settings contain an unknown field or a non-string value.");
|
|
80
|
+
return value;
|
|
81
|
+
}
|
|
82
|
+
export async function updateProfileConfig(directory, change) {
|
|
83
|
+
await new FileCredentialStore(join(directory, "config.json")).withLock(async () => { write(directory, "config.json", change(readProfileConfig(directory))); });
|
|
84
|
+
}
|
|
85
|
+
export function listProfiles(root) {
|
|
86
|
+
const names = new Set(["default"]);
|
|
87
|
+
try {
|
|
88
|
+
for (const entry of readdirSync(join(root, "profiles"), { withFileTypes: true })) {
|
|
89
|
+
if (!entry.isDirectory() || entry.isSymbolicLink())
|
|
90
|
+
continue;
|
|
91
|
+
try {
|
|
92
|
+
names.add(profileName(entry.name));
|
|
93
|
+
}
|
|
94
|
+
catch { /* unrelated directories are not profiles */ }
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
catch (error) {
|
|
98
|
+
if (error.code !== "ENOENT")
|
|
99
|
+
throw error;
|
|
100
|
+
}
|
|
101
|
+
return [...names].sort().map((name) => {
|
|
102
|
+
const directory = profileDirectory(root, name);
|
|
103
|
+
return { name, config: readProfileConfig(directory), hasSavedCredentials: ["credentials.enc", "credentials.json"].some((file) => existsSync(join(directory, file))) };
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
/** Removing a profile requires logout first. Hold the settings and both storage
|
|
107
|
+
* locks so a concurrent login cannot be deleted underneath its transaction. */
|
|
108
|
+
export async function removeProfile(root, name) {
|
|
109
|
+
const directory = profileDirectory(root, name);
|
|
110
|
+
if (!existsSync(directory))
|
|
111
|
+
throw new Error("Profile '" + name + "' does not exist.");
|
|
112
|
+
const paths = ["config.json", "credentials.enc", "credentials.json"].map((file) => join(directory, file));
|
|
113
|
+
await new FileCredentialStore(paths[0]).withLock(async () => {
|
|
114
|
+
await new FileCredentialStore(paths[1]).withLock(async () => {
|
|
115
|
+
await new FileCredentialStore(paths[2]).withLock(async () => {
|
|
116
|
+
if (paths.slice(1).some((path) => existsSync(path)))
|
|
117
|
+
throw new Error("Log out of both credential stores for profile '" + name + "' before removing it. Use logout --profile " + name + ".");
|
|
118
|
+
const selected = json(join(root, "profiles.json"));
|
|
119
|
+
if (selected?.selected === name)
|
|
120
|
+
selectProfile(root, "default");
|
|
121
|
+
rmSync(directory, { recursive: true });
|
|
122
|
+
});
|
|
123
|
+
});
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
export function profileFlag(args) {
|
|
127
|
+
let value;
|
|
128
|
+
for (let i = 0; i < args.length; i++) {
|
|
129
|
+
if (args[i] === "--profile") {
|
|
130
|
+
value = args[++i];
|
|
131
|
+
if (value === undefined || value.startsWith("--"))
|
|
132
|
+
throw new Error("--profile requires a profile name.");
|
|
133
|
+
}
|
|
134
|
+
else if (args[i].startsWith("--profile="))
|
|
135
|
+
value = args[i].slice("--profile=".length);
|
|
136
|
+
}
|
|
137
|
+
return value === undefined ? undefined : profileName(value);
|
|
138
|
+
}
|
package/dist/core/http.d.ts
CHANGED
|
@@ -15,7 +15,12 @@ export interface RequestOptions {
|
|
|
15
15
|
export interface ResponseMeta {
|
|
16
16
|
status: number;
|
|
17
17
|
headers: Headers;
|
|
18
|
-
/**
|
|
18
|
+
/** Parsed wire body before it is narrowed to the generated response type.
|
|
19
|
+
* Use this escape hatch for additive fields or variants introduced after
|
|
20
|
+
* this generator edition. */
|
|
21
|
+
rawBody?: unknown;
|
|
22
|
+
/** Request identifier from the JSON response body, or from headers for
|
|
23
|
+
* raw and bodyless responses. */
|
|
19
24
|
requestId?: string;
|
|
20
25
|
}
|
|
21
26
|
/**
|
|
@@ -32,15 +37,6 @@ export interface RequestContext {
|
|
|
32
37
|
/** 0 on the first try, increments per retry. */
|
|
33
38
|
attempt: number;
|
|
34
39
|
}
|
|
35
|
-
/** One server-sent event from a text/event-stream response. */
|
|
36
|
-
export interface SseEvent {
|
|
37
|
-
/** The `event:` field; undefined for unnamed events. */
|
|
38
|
-
event?: string;
|
|
39
|
-
/** The `id:` field, when the server sends one. */
|
|
40
|
-
id?: string;
|
|
41
|
-
/** Concatenated `data:` lines. Parse as JSON if your API sends JSON. */
|
|
42
|
-
data: string;
|
|
43
|
-
}
|
|
44
40
|
/**
|
|
45
41
|
* Every SDK call returns a discriminated result instead of throwing.
|
|
46
42
|
* Narrow on `ok` and the error side is a typed union of the documented
|
|
@@ -68,62 +64,14 @@ export declare class ApiError<S extends number = number, B = unknown> extends Er
|
|
|
68
64
|
export declare class UnexpectedApiError extends ApiError<number, unknown> {
|
|
69
65
|
constructor(status: number, body: unknown, response: ResponseMeta);
|
|
70
66
|
}
|
|
71
|
-
/** A
|
|
72
|
-
export declare class
|
|
73
|
-
|
|
74
|
-
readonly
|
|
75
|
-
message?: string;
|
|
76
|
-
path?: unknown[];
|
|
77
|
-
extensions?: unknown;
|
|
78
|
-
}[];
|
|
67
|
+
/** A successful response declared JSON but carried a body that could not be parsed. */
|
|
68
|
+
export declare class ResponseParseError extends Error {
|
|
69
|
+
readonly status: number;
|
|
70
|
+
readonly body: string;
|
|
79
71
|
readonly response: ResponseMeta;
|
|
80
|
-
|
|
72
|
+
readonly cause?: unknown;
|
|
73
|
+
constructor(body: string, response: ResponseMeta, cause?: unknown);
|
|
81
74
|
}
|
|
82
|
-
type Primitive = string | number | boolean | bigint | symbol | null | undefined;
|
|
83
|
-
type Unwrap<T> = NonNullable<T> extends readonly (infer U)[] ? Unwrap<U> : NonNullable<T>;
|
|
84
|
-
type IsUnion<T, U = T> = T extends unknown ? ([U] extends [T] ? false : true) : never;
|
|
85
|
-
type TypeNameOf<T> = T extends {
|
|
86
|
-
__typename?: infer N;
|
|
87
|
-
} ? Extract<N, string> : never;
|
|
88
|
-
type Prettify<T> = {
|
|
89
|
-
[K in keyof T]: T[K];
|
|
90
|
-
} & {};
|
|
91
|
-
/**
|
|
92
|
-
* A selection over a GraphQL result type `T`: `true` picks a leaf field, a
|
|
93
|
-
* nested object picks inside an object field, and `on` picks per concrete
|
|
94
|
-
* type when `T` is a union or interface (`{ on: { Transaction: { amount: true } } }`).
|
|
95
|
-
* Keys are checked against the schema, so a typo is a compile error.
|
|
96
|
-
*/
|
|
97
|
-
export type Selection<T> = Unwrap<T> extends Primitive ? never : SelectionObject<Unwrap<T>>;
|
|
98
|
-
type FieldSelection<V> = Unwrap<V> extends Primitive ? true : SelectionObject<Unwrap<V>>;
|
|
99
|
-
type SelectionObject<T> = {
|
|
100
|
-
[K in Extract<keyof T, string> as K extends "__typename" ? never : K]?: FieldSelection<T[K]>;
|
|
101
|
-
} & {
|
|
102
|
-
__typename?: true;
|
|
103
|
-
} & (IsUnion<T> extends true ? {
|
|
104
|
-
on?: {
|
|
105
|
-
[N in TypeNameOf<T>]?: SelectionObject<Extract<T, {
|
|
106
|
-
__typename?: N;
|
|
107
|
-
}>>;
|
|
108
|
-
};
|
|
109
|
-
} : {
|
|
110
|
-
on?: never;
|
|
111
|
-
});
|
|
112
|
-
/** The result type a {@link Selection} `S` produces from result type `T`:
|
|
113
|
-
* exactly the fields picked, nullability and lists preserved, union members
|
|
114
|
-
* narrowed by `__typename`. */
|
|
115
|
-
export type Selected<T, S> = T extends readonly (infer U)[] ? Selected<U, S>[] : T extends Primitive ? T : S extends object ? Prettify<SelectedMember<T, S>> : never;
|
|
116
|
-
type SelectedMember<T, S> = (S extends {
|
|
117
|
-
on?: infer O;
|
|
118
|
-
} ? O extends object ? TypeNameOf<T> extends keyof O ? PickSelected<T, NonNullable<O[TypeNameOf<T>]>> : {} : {} : {}) & PickSelected<T, S>;
|
|
119
|
-
type PickSelected<T, S> = {
|
|
120
|
-
-readonly [K in keyof S as K extends "on" ? never : K extends keyof T ? (S[K] extends true | object ? K : never) : never]-?: K extends "__typename" ? NonNullable<T[K & keyof T]> : S[K] extends true ? Exclude<T[K & keyof T], undefined> : Selected<Exclude<T[K & keyof T], undefined>, S[K]>;
|
|
121
|
-
};
|
|
122
|
-
/** A selection object or a raw selection set (`"{ id name }"`). */
|
|
123
|
-
export type SelectionInput = string | Record<string, unknown>;
|
|
124
|
-
/** Serialize a selection object to a GraphQL selection set. Strings pass
|
|
125
|
-
* through untouched. */
|
|
126
|
-
export declare function selectionToString(selection: SelectionInput): string;
|
|
127
75
|
export interface Violation {
|
|
128
76
|
path: string;
|
|
129
77
|
message: string;
|
|
@@ -142,13 +90,14 @@ export declare class ValidationError extends Error {
|
|
|
142
90
|
* are ignored: validation can miss drift but never false-alarms.
|
|
143
91
|
*/
|
|
144
92
|
export declare function validateAgainstSchema(value: unknown, schema: unknown, path: string, out: Violation[], defs?: Record<string, unknown>): void;
|
|
145
|
-
/** The request
|
|
93
|
+
/** The request failed before a complete HTTP response arrived (network failure, timeout, abort, or truncated body). */
|
|
146
94
|
export declare class TransportError extends Error {
|
|
147
95
|
readonly cause?: unknown;
|
|
148
96
|
constructor(message: string, cause?: unknown);
|
|
149
97
|
}
|
|
150
98
|
type ErrorCtor = new (body: any, response: ResponseMeta) => ApiError<number, unknown>;
|
|
151
99
|
export interface CoreRequest {
|
|
100
|
+
security?: Record<string, string[]>[];
|
|
152
101
|
method: string;
|
|
153
102
|
path: string;
|
|
154
103
|
query?: Record<string, unknown>;
|
|
@@ -159,14 +108,9 @@ export interface CoreRequest {
|
|
|
159
108
|
errors?: Record<string, ErrorCtor>;
|
|
160
109
|
/** Idempotent requests are retried automatically. */
|
|
161
110
|
idempotent?: boolean;
|
|
162
|
-
/** Success body is text/event-stream: yield SseEvents instead of parsing. */
|
|
163
|
-
stream?: boolean;
|
|
164
111
|
/** Header name auto-filled with one UUID per call (stable across retries)
|
|
165
112
|
* when the caller doesn't supply a value. */
|
|
166
113
|
idempotencyKey?: string;
|
|
167
|
-
/** GraphQL: unwrap body.data[field] and turn body.errors into a
|
|
168
|
-
* GraphQLRequestError. */
|
|
169
|
-
graphqlField?: string;
|
|
170
114
|
/** Key into the schemas table for optional runtime validation. */
|
|
171
115
|
schemaKey?: string;
|
|
172
116
|
/** Operation-level retry policy (x-typeship-retries), merged over the
|
|
@@ -184,7 +128,13 @@ export interface RetryPolicy {
|
|
|
184
128
|
/** Also retry non-idempotent methods (POST/PATCH). */
|
|
185
129
|
retryNonIdempotent?: boolean;
|
|
186
130
|
}
|
|
131
|
+
export interface SecurityCredential {
|
|
132
|
+
headers?: Record<string, AuthValue>;
|
|
133
|
+
query?: Record<string, AuthValue>;
|
|
134
|
+
}
|
|
187
135
|
export interface CoreConfig {
|
|
136
|
+
/** Named credentials are selected using each operation's requirements. */
|
|
137
|
+
credentials?: Record<string, SecurityCredential>;
|
|
188
138
|
baseUrl: string;
|
|
189
139
|
headers: Record<string, AuthValue>;
|
|
190
140
|
/** Auth carried as query parameters (apiKey-in-query schemes). */
|
|
@@ -242,7 +192,7 @@ export interface DebugEvent {
|
|
|
242
192
|
/** 1-based; >1 means this was a retry */
|
|
243
193
|
attempt: number;
|
|
244
194
|
requestId?: string;
|
|
245
|
-
/** transport failure message, when
|
|
195
|
+
/** transport failure message, when the request failed before a complete response */
|
|
246
196
|
error?: string;
|
|
247
197
|
}
|
|
248
198
|
export declare class HttpCore {
|
|
@@ -277,27 +227,6 @@ export declare class HttpCore {
|
|
|
277
227
|
export declare function formatDebugEvent(name: string, event: DebugEvent): string;
|
|
278
228
|
/** Wrap a bearer credential (static or callback) as an Authorization value. */
|
|
279
229
|
export declare function bearerAuth(token: AuthValue): AuthValue;
|
|
280
|
-
export interface ClientCredentialsConfig {
|
|
281
|
-
clientId: string;
|
|
282
|
-
clientSecret: string;
|
|
283
|
-
tokenUrl: string;
|
|
284
|
-
scopes?: string[];
|
|
285
|
-
/** Extra token-request parameters, e.g. the "audience" some
|
|
286
|
-
* authorization servers require for API-valid access tokens. */
|
|
287
|
-
tokenParams?: Record<string, string>;
|
|
288
|
-
/** How credentials reach the token endpoint. Default "post"
|
|
289
|
-
* (client_secret_post, form fields); "basic" sends an Authorization
|
|
290
|
-
* header (client_secret_basic). */
|
|
291
|
-
authMethod?: "post" | "basic";
|
|
292
|
-
fetchImpl?: typeof fetch;
|
|
293
|
-
}
|
|
294
|
-
/**
|
|
295
|
-
* OAuth2 client-credentials token source: fetches from the token URL,
|
|
296
|
-
* caches until expiry (60s early refresh), and shares one in-flight
|
|
297
|
-
* request across concurrent callers. Returned function plugs in as an
|
|
298
|
-
* Authorization AuthValue, resolved before every attempt.
|
|
299
|
-
*/
|
|
300
|
-
export declare function oauthClientCredentials(config: ClientCredentialsConfig): () => Promise<string>;
|
|
301
230
|
export declare function toBase64(input: string): string;
|
|
302
231
|
export {};
|
|
303
232
|
//# sourceMappingURL=http.d.ts.map
|
package/dist/core/http.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/core/http.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,cAAc;IAC7B,iEAAiE;IACjE,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,yEAAyE;IACzE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wEAAwE;IACxE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/core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