@xemahq/api-client-generator 2.4.0 → 2.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/README.md +38 -0
- package/dist/.source-stamp.json +1 -1
- package/dist/lib/client-package.d.ts.map +1 -1
- package/dist/lib/client-package.js +25 -9
- package/dist/lib/client-package.js.map +1 -1
- package/dist/lib/client-readme.d.ts +1 -0
- package/dist/lib/client-readme.d.ts.map +1 -1
- package/dist/lib/client-readme.js +12 -5
- package/dist/lib/client-readme.js.map +1 -1
- package/dist/lib/client-repository.d.ts +2 -0
- package/dist/lib/client-repository.d.ts.map +1 -1
- package/dist/lib/client-repository.js +17 -0
- package/dist/lib/client-repository.js.map +1 -1
- package/dist/lib/client-surface.d.ts.map +1 -1
- package/dist/lib/client-surface.js +63 -3
- package/dist/lib/client-surface.js.map +1 -1
- package/dist/lib/custom-fetch-template.d.ts +1 -1
- package/dist/lib/custom-fetch-template.d.ts.map +1 -1
- package/dist/lib/custom-fetch-template.js +33 -12
- package/dist/lib/custom-fetch-template.js.map +1 -1
- package/dist/lib/generate-clients.d.ts.map +1 -1
- package/dist/lib/generate-clients.js +22 -13
- package/dist/lib/generate-clients.js.map +1 -1
- package/dist/lib/service-config.d.ts +3 -1
- package/dist/lib/service-config.d.ts.map +1 -1
- package/dist/lib/service-config.js +24 -2
- package/dist/lib/service-config.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -87,6 +87,44 @@ comparison proved is refused, not silently raised; a higher one is always
|
|
|
87
87
|
honoured. Decide it from the PUBLISHED tarball of the current version rather
|
|
88
88
|
than from the source tree.
|
|
89
89
|
|
|
90
|
+
A member **added** to an enum-like declaration (`enum`, an `as const` object, a
|
|
91
|
+
union of literals), with every existing member unchanged, classifies as a
|
|
92
|
+
**minor** whether the type is a request or a response; a removed or re-valued
|
|
93
|
+
member is still indeterminate. A workspace-only client (below) is never
|
|
94
|
+
classified and gets no changeset.
|
|
95
|
+
|
|
96
|
+
`XEMA_CLIENT_BUMP_CLASS` is read from the process environment, so a turbo task
|
|
97
|
+
that runs the generator must list it in `passThroughEnv` (or `env`), or turbo
|
|
98
|
+
strips it before the generator sees it.
|
|
99
|
+
|
|
100
|
+
### Clients in a customer-owned repository
|
|
101
|
+
|
|
102
|
+
The consumer repository, not the generator, decides what its clients are called
|
|
103
|
+
and whether they are published. Both are declared in the `client` block of
|
|
104
|
+
`tooling/ci/release.config.mjs`, beside `license` and `copyrightHolder`:
|
|
105
|
+
|
|
106
|
+
```js
|
|
107
|
+
export default {
|
|
108
|
+
repository: 'acme/cpb',
|
|
109
|
+
client: {
|
|
110
|
+
packageScope: '', // "@acme", or "" for unscoped names
|
|
111
|
+
private: true, // workspace-only: never published
|
|
112
|
+
license: 'UNLICENSED',
|
|
113
|
+
copyrightHolder: 'Acme, S.A.',
|
|
114
|
+
},
|
|
115
|
+
};
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
- **Name**: `client.packageScope` (`<scope>/<service>-client`, or the bare
|
|
119
|
+
`<service>-client` for `""`), else the `name` of the client package already on
|
|
120
|
+
disk. A repository that declares neither **fails**, naming
|
|
121
|
+
`client.packageScope`. Only a first-party Xema repository (one that declares no
|
|
122
|
+
`client.license` and carries a first-party `LICENSE`) defaults to `@xemahq`.
|
|
123
|
+
- **Private mode**: `client.private: true`, or a client package that is already
|
|
124
|
+
`"private": true`. It emits no `publishConfig`, no `prepublishOnly`, a README
|
|
125
|
+
with no banner, npm badges or xema.dev links, and skips bump classification and
|
|
126
|
+
changesets entirely.
|
|
127
|
+
|
|
90
128
|
## Peer requirements
|
|
91
129
|
|
|
92
130
|
- `@nestjs/common`, `@nestjs/core`, `@nestjs/swagger`, `@nestjs/testing` — the
|
package/dist/.source-stamp.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-package.d.ts","sourceRoot":"","sources":["../../src/lib/client-package.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK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;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAgH1C"}
|
|
@@ -47,6 +47,12 @@ const CLIENT_TSCONFIG = {
|
|
|
47
47
|
},
|
|
48
48
|
include: ['src/**/*.ts'],
|
|
49
49
|
};
|
|
50
|
+
function isWorkspaceOnlyClient(ctx, manifest) {
|
|
51
|
+
return ctx.ownership?.private === true || manifest.private === true;
|
|
52
|
+
}
|
|
53
|
+
function withoutKey(record, key) {
|
|
54
|
+
return Object.fromEntries(Object.entries(record).filter(([k]) => k !== key));
|
|
55
|
+
}
|
|
50
56
|
function generatorTag() {
|
|
51
57
|
const pkg = require('../../package.json');
|
|
52
58
|
return `@xemahq/api-client-generator@${pkg.version}`;
|
|
@@ -101,8 +107,8 @@ function assertDeclaredRepository(packageName, declared, expected) {
|
|
|
101
107
|
function ensureClientPackage(ctx, surface, version, repositoryUrl, license) {
|
|
102
108
|
const clientDir = (0, service_config_1.surfaceClientDir)(ctx, surface);
|
|
103
109
|
const clientSrc = (0, node_path_1.join)(clientDir, 'src');
|
|
110
|
+
const packageName = (0, service_config_1.surfaceClientPackageName)(ctx, surface);
|
|
104
111
|
(0, node_fs_1.mkdirSync)(clientSrc, { recursive: true });
|
|
105
|
-
const packageName = (0, service_config_1.surfaceClientPackageName)(ctx.api.serviceId, surface);
|
|
106
112
|
const xema = {
|
|
107
113
|
kind: 'api-client',
|
|
108
114
|
surface,
|
|
@@ -127,25 +133,35 @@ function ensureClientPackage(ctx, surface, version, repositoryUrl, license) {
|
|
|
127
133
|
if (existing.repository !== undefined) {
|
|
128
134
|
assertDeclaredRepository(packageName, existing.repository, repository);
|
|
129
135
|
}
|
|
136
|
+
const workspaceOnly = isWorkspaceOnlyClient(ctx, existing);
|
|
137
|
+
const baseManifest = workspaceOnly ? withoutKey(existing, 'publishConfig') : existing;
|
|
138
|
+
const baseScripts = workspaceOnly
|
|
139
|
+
? withoutKey(existingScripts, 'prepublishOnly')
|
|
140
|
+
: existingScripts;
|
|
130
141
|
const pkg = {
|
|
131
|
-
...
|
|
142
|
+
...baseManifest,
|
|
132
143
|
name: packageName,
|
|
133
144
|
version: typeof existing.version === 'string' ? existing.version : version,
|
|
134
145
|
...(existing.repository === undefined ? { repository } : {}),
|
|
146
|
+
...(workspaceOnly ? { private: true } : {}),
|
|
135
147
|
main: './dist/index.js',
|
|
136
148
|
types: './dist/index.d.ts',
|
|
137
149
|
files: ['dist'],
|
|
138
150
|
license,
|
|
139
151
|
scripts: {
|
|
140
|
-
...
|
|
152
|
+
...baseScripts,
|
|
141
153
|
build: 'tsc -p tsconfig.json',
|
|
142
|
-
prepublishOnly: 'npm run build',
|
|
143
|
-
},
|
|
144
|
-
publishConfig: {
|
|
145
|
-
access: ctx.ownership?.access ?? 'public',
|
|
146
|
-
...existingPublishConfig,
|
|
147
|
-
registry: ctx.ownership?.registry ?? 'https://registry.npmjs.org/',
|
|
154
|
+
...(workspaceOnly ? {} : { prepublishOnly: 'npm run build' }),
|
|
148
155
|
},
|
|
156
|
+
...(workspaceOnly
|
|
157
|
+
? {}
|
|
158
|
+
: {
|
|
159
|
+
publishConfig: {
|
|
160
|
+
access: ctx.ownership?.access ?? 'public',
|
|
161
|
+
...existingPublishConfig,
|
|
162
|
+
registry: ctx.ownership?.registry ?? 'https://registry.npmjs.org/',
|
|
163
|
+
},
|
|
164
|
+
}),
|
|
149
165
|
devDependencies: {
|
|
150
166
|
...existingDevDeps,
|
|
151
167
|
typescript: 'catalog:',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-package.js","sourceRoot":"","sources":["../../src/lib/client-package.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"client-package.js","sourceRoot":"","sources":["../../src/lib/client-package.ts"],"names":[],"mappings":";;AAkLA,sEAgCC;AAoDD,kDAsHC;AA5XD,qCAKiB;AACjB,yCAAiC;AAIjC,2DAG6B;AAC7B,mEAAiE;AACjE,qDAI0B;AAkB1B,MAAM,mBAAmB,GAAG,uCAAuC,CAAC;A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AAE,UAAU,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;CACzB,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"client-readme.d.ts","sourceRoot":"","sources":["../../src/lib/client-readme.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAuBrD,wBAAgB,4BAA4B,CAC1C,SAAS,EAAE;IAAE,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,EAChD,QAAQ,EAAE,MAAM,GACf,MAAM,CAUR;AAQD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,GAAG,MAAM,CAUlF;AAqBD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,UAAU,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IAExB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GAAG,IAAI,CAwEP"}
|
|
@@ -53,7 +53,7 @@ function ensureClientReadme(params) {
|
|
|
53
53
|
const surfaceWord = surface === xema_decorators_1.ApiSurface.Public ? '' : `${surface} `;
|
|
54
54
|
const tagline = `Typed, generated ${surfaceWord}HTTP client for the ${serviceTitle}.`;
|
|
55
55
|
const licenseLine = renderLicenseLine(license, copyrightHolder);
|
|
56
|
-
const
|
|
56
|
+
const head = `<!-- Generated by @xemahq/api-client-generator. Do not edit by hand. -->
|
|
57
57
|
<p align="center">
|
|
58
58
|
${banner(packageName, tagline)}
|
|
59
59
|
</p>
|
|
@@ -69,7 +69,16 @@ ${banner(packageName, tagline)}
|
|
|
69
69
|
<img alt="types" src="https://img.shields.io/npm/types/${enc}?color=3178c6">
|
|
70
70
|
</p>
|
|
71
71
|
|
|
72
|
-
|
|
72
|
+
`;
|
|
73
|
+
const markup = params.workspaceOnly === true
|
|
74
|
+
? '<!-- Generated by @xemahq/api-client-generator. Do not edit by hand. -->\n\n'
|
|
75
|
+
: head;
|
|
76
|
+
const fence = '```';
|
|
77
|
+
const installCommand = params.workspaceOnly === true
|
|
78
|
+
? `pnpm add ${packageName}@workspace:*`
|
|
79
|
+
: `pnpm add ${packageName}`;
|
|
80
|
+
const installation = `${fence}bash\n${installCommand}\n${fence}`;
|
|
81
|
+
const md = `${markup}# ${packageName}
|
|
73
82
|
|
|
74
83
|
> ${tagline}
|
|
75
84
|
|
|
@@ -89,9 +98,7 @@ the service's API changes — do not edit it by hand.
|
|
|
89
98
|
|
|
90
99
|
## Installation
|
|
91
100
|
|
|
92
|
-
|
|
93
|
-
pnpm add ${packageName}
|
|
94
|
-
\`\`\`
|
|
101
|
+
${installation}
|
|
95
102
|
|
|
96
103
|
## Usage
|
|
97
104
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-readme.js","sourceRoot":"","sources":["../../src/lib/client-readme.ts"],"names":[],"mappings":";;AA0BA,oEAaC;AAQD,8CAUC;AAqBD,
|
|
1
|
+
{"version":3,"file":"client-readme.js","sourceRoot":"","sources":["../../src/lib/client-readme.ts"],"names":[],"mappings":";;AA0BA,oEAaC;AAQD,8CAUC;AAqBD,gDAiFC;AA/JD,qCAAwC;AACxC,yCAAiC;AAEjC,6DAAqD;AAYrD,MAAM,aAAa,GAAG,SAAS,CAAC;AAEhC,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,KAAK;SACT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC;SACtB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;AAC7B,CAAC;AAGD,SAAgB,4BAA4B,CAC1C,SAAgD,EAChD,QAAgB;IAEhB,IAA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KAAK,4BAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,OAAO,GAAG,CAAC;IACvE,MAAM,OAAO,GAAG,oBAAoB,WAAW,uBAAuB,YAAY,GAAG,CAAC;IACtF,MAAM,WAAW,GAAG,iBAAiB,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;IAEhE,MAAM,IAAI,GAAG;;EAEb,MAAM,CAAC,WAAW,EAAE,OAAO,CAAC;;;;;2CAKa,WAAW;;;;qDAID,GAAG;yDACC,GAAG;2DACD,GAAG;;;CAG7D,CAAC;IACA,MAAM,MAAM,GAAG,MAAM,CAAC,aAAa,KAAK,IAAI;QAC1C,CAAC,CAAC,8EAA8E;QAChF,CAAC,CAAC,IAAI,CAAC;IACT,MAAM,KAAK,GAAG,KAAK,CAAC;IACpB,MAAM,cAAc,GAClB,MAAM,CAAC,aAAa,KAAK,IAAI;QAC3B,CAAC,CAAC,YAAY,WAAW,cAAc;QACvC,CAAC,CAAC,YAAY,WAAW,EAAE,CAAC;IAChC,MAAM,YAAY,GAAG,GAAG,KAAK,SAAS,cAAc,KAAK,KAAK,EAAE,CAAC;IACjE,MAAM,EAAE,GAAG,GAAG,MAAM,KAAK,WAAW;;IAElC,OAAO;;;;6CAIkC,YAAY;;;;;;;;6DAQI,YAAY;;;;;;EAMvE,YAAY;;;;;;2BAMa,WAAW;;;;;;;;EAQpC,WAAW;CACZ,CAAC;IAEA,IAAA,uBAAa,EAAC,IAAA,gBAAI,EAAC,SAAS,EAAE,WAAW,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -16,6 +16,8 @@ export type ClientOwnershipDeclaration = {
|
|
|
16
16
|
readonly copyrightHolder?: string;
|
|
17
17
|
readonly access?: 'public' | 'restricted';
|
|
18
18
|
readonly registry?: string;
|
|
19
|
+
readonly packageScope?: string;
|
|
20
|
+
readonly private?: boolean;
|
|
19
21
|
};
|
|
20
22
|
export declare function resolveClientOwnership(repoRoot: string): Promise<ClientOwnershipDeclaration>;
|
|
21
23
|
//# sourceMappingURL=client-repository.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-repository.d.ts","sourceRoot":"","sources":["../../src/lib/client-repository.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAaD,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAgBnE,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAEnE;AAqBD,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA0BjB;AA6CD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,yBAAyB,CAW5B;AAqCD,MAAM,MAAM,0BAA0B,GAAG;IAevC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAE1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"client-repository.d.ts","sourceRoot":"","sources":["../../src/lib/client-repository.ts"],"names":[],"mappings":"AAgCA,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAErB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IAErB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAaD,eAAO,MAAM,mBAAmB,kCAAkC,CAAC;AAgBnE,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,MAAM,GAAG,MAAM,CAEnE;AAqBD,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,CAAC,CA0BjB;AA6CD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE;IAChD,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB,GAAG,yBAAyB,CAW5B;AAqCD,MAAM,MAAM,0BAA0B,GAAG;IAevC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAE1B,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC,QAAQ,CAAC,MAAM,CAAC,EAAE,QAAQ,GAAG,YAAY,CAAC;IAE1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAM3B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAM/B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAsCF,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,0BAA0B,CAAC,CA4ErC"}
|
|
@@ -55,6 +55,7 @@ function generatedClientRepository(params) {
|
|
|
55
55
|
}
|
|
56
56
|
return { type: 'git', url: repositoryUrl, directory };
|
|
57
57
|
}
|
|
58
|
+
const NPM_SCOPE_PATTERN = /^@[a-z0-9][a-z0-9._~-]*$/u;
|
|
58
59
|
function asString(value) {
|
|
59
60
|
return typeof value === 'string' && value.trim() !== '' ? value : undefined;
|
|
60
61
|
}
|
|
@@ -75,6 +76,20 @@ async function resolveClientOwnership(repoRoot) {
|
|
|
75
76
|
`value that is neither must not fall back to "public", which would ` +
|
|
76
77
|
`publish a private client to the public registry.`);
|
|
77
78
|
}
|
|
79
|
+
const rawScope = declared.packageScope;
|
|
80
|
+
if (rawScope !== undefined &&
|
|
81
|
+
rawScope !== null &&
|
|
82
|
+
!(typeof rawScope === 'string' && (rawScope === '' || NPM_SCOPE_PATTERN.test(rawScope)))) {
|
|
83
|
+
throw new Error(`api-client-generator: ${configPath} declares a \`client.packageScope\` ` +
|
|
84
|
+
`that is not an npm scope (found ${JSON.stringify(rawScope)}). Expected ` +
|
|
85
|
+
`"@scope", or "" for unscoped package names.`);
|
|
86
|
+
}
|
|
87
|
+
const rawPrivate = declared.private;
|
|
88
|
+
if (rawPrivate !== undefined && rawPrivate !== null && typeof rawPrivate !== 'boolean') {
|
|
89
|
+
throw new Error(`api-client-generator: ${configPath} declares \`client.private\` as ` +
|
|
90
|
+
`${JSON.stringify(rawPrivate)}. It must be true or false - a value that ` +
|
|
91
|
+
`is neither must not silently resolve to "publishable".`);
|
|
92
|
+
}
|
|
78
93
|
const rawLicense = declared.license;
|
|
79
94
|
if (rawLicense !== undefined &&
|
|
80
95
|
rawLicense !== null &&
|
|
@@ -94,6 +109,8 @@ async function resolveClientOwnership(repoRoot) {
|
|
|
94
109
|
...(copyrightHolder === undefined ? {} : { copyrightHolder }),
|
|
95
110
|
...(access === undefined ? {} : { access: access }),
|
|
96
111
|
...(registry === undefined ? {} : { registry }),
|
|
112
|
+
...(typeof rawScope === 'string' ? { packageScope: rawScope } : {}),
|
|
113
|
+
...(rawPrivate === true ? { private: true } : {}),
|
|
97
114
|
};
|
|
98
115
|
}
|
|
99
116
|
//# sourceMappingURL=client-repository.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-repository.js","sourceRoot":"","sources":["../../src/lib/client-repository.ts"],"names":[],"mappings":";;;AAmEA,oDAEC;AAqBD,gEA4BC;AA6CD,8DAeC;
|
|
1
|
+
{"version":3,"file":"client-repository.js","sourceRoot":"","sources":["../../src/lib/client-repository.ts"],"names":[],"mappings":";;;AAmEA,oDAEC;AAqBD,gEA4BC;AA6CD,8DAeC;AA6GD,wDA8EC;AA7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,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClD,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-surface.d.ts","sourceRoot":"","sources":["../../src/lib/client-surface.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAqF1B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAQD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAsCrE;
|
|
1
|
+
{"version":3,"file":"client-surface.d.ts","sourceRoot":"","sources":["../../src/lib/client-surface.ts"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AAqF1B,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1C;AAQD,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,aAAa,CAsCrE;AAyMD,MAAM,MAAM,cAAc,GACtB;IACE,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC,GACD;IAAE,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,CAAC;AAuB5E,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IAC1C,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC;IAC9B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;CAClC,GAAG,cAAc,CAwFjB;AAqBD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC;IACjC,QAAQ,CAAC,QAAQ,EAAE,SAAS,GAAG,SAAS,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;CAC7C,GAAG,SAAS,CAoCZ"}
|
|
@@ -137,6 +137,58 @@ function collectStatement(args) {
|
|
|
137
137
|
}
|
|
138
138
|
unrecognised.push(rel);
|
|
139
139
|
}
|
|
140
|
+
function enumMembers(text) {
|
|
141
|
+
const source = ts.createSourceFile('declaration.ts', text, ts.ScriptTarget.Latest, false, ts.ScriptKind.TS);
|
|
142
|
+
const [statement, ...rest] = source.statements;
|
|
143
|
+
if (statement === undefined || rest.length > 0) {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
const members = new Map();
|
|
147
|
+
if (ts.isEnumDeclaration(statement)) {
|
|
148
|
+
for (const member of statement.members) {
|
|
149
|
+
members.set(member.name.getText(source), member.initializer?.getText(source) ?? '');
|
|
150
|
+
}
|
|
151
|
+
return members;
|
|
152
|
+
}
|
|
153
|
+
if (ts.isTypeAliasDeclaration(statement) && ts.isUnionTypeNode(statement.type)) {
|
|
154
|
+
for (const type of statement.type.types) {
|
|
155
|
+
if (!ts.isLiteralTypeNode(type)) {
|
|
156
|
+
return undefined;
|
|
157
|
+
}
|
|
158
|
+
members.set(type.getText(source), type.getText(source));
|
|
159
|
+
}
|
|
160
|
+
return members;
|
|
161
|
+
}
|
|
162
|
+
if (ts.isVariableStatement(statement)) {
|
|
163
|
+
const [declaration, ...others] = statement.declarationList.declarations;
|
|
164
|
+
let initializer = declaration?.initializer;
|
|
165
|
+
if (others.length > 0 || initializer === undefined) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
if (ts.isAsExpression(initializer)) {
|
|
169
|
+
initializer = initializer.expression;
|
|
170
|
+
}
|
|
171
|
+
if (!ts.isObjectLiteralExpression(initializer)) {
|
|
172
|
+
return undefined;
|
|
173
|
+
}
|
|
174
|
+
for (const property of initializer.properties) {
|
|
175
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
176
|
+
return undefined;
|
|
177
|
+
}
|
|
178
|
+
members.set(property.name.getText(source), property.initializer.getText(source));
|
|
179
|
+
}
|
|
180
|
+
return members;
|
|
181
|
+
}
|
|
182
|
+
return undefined;
|
|
183
|
+
}
|
|
184
|
+
function onlyGainsEnumMembers(before, after) {
|
|
185
|
+
const was = enumMembers(before);
|
|
186
|
+
const now = enumMembers(after);
|
|
187
|
+
if (was === undefined || now === undefined || now.size <= was.size) {
|
|
188
|
+
return false;
|
|
189
|
+
}
|
|
190
|
+
return [...was].every(([name, value]) => now.get(name) === value);
|
|
191
|
+
}
|
|
140
192
|
const MAX_NAMED_REASONS = 8;
|
|
141
193
|
function summarise(label, keys) {
|
|
142
194
|
const named = keys.slice(0, MAX_NAMED_REASONS).join(', ');
|
|
@@ -154,13 +206,14 @@ function classifySurfaceChange(args) {
|
|
|
154
206
|
}
|
|
155
207
|
const removed = [];
|
|
156
208
|
const changed = [];
|
|
209
|
+
const enumGrown = [];
|
|
157
210
|
for (const [key, text] of before.exports) {
|
|
158
211
|
const next = after.exports.get(key);
|
|
159
212
|
if (next === undefined) {
|
|
160
213
|
removed.push(key);
|
|
161
214
|
}
|
|
162
215
|
else if (next !== text) {
|
|
163
|
-
changed.push(key);
|
|
216
|
+
(onlyGainsEnumMembers(text, next) ? enumGrown : changed).push(key);
|
|
164
217
|
}
|
|
165
218
|
}
|
|
166
219
|
const added = [...after.exports.keys()].filter((key) => !before.exports.has(key));
|
|
@@ -192,11 +245,18 @@ function classifySurfaceChange(args) {
|
|
|
192
245
|
],
|
|
193
246
|
};
|
|
194
247
|
}
|
|
195
|
-
if (added.length > 0) {
|
|
248
|
+
if (added.length > 0 || enumGrown.length > 0) {
|
|
196
249
|
return {
|
|
197
250
|
kind: 'determinate',
|
|
198
251
|
bumpClass: 'minor',
|
|
199
|
-
reasons: [
|
|
252
|
+
reasons: [
|
|
253
|
+
...(added.length > 0
|
|
254
|
+
? [summarise('exports ADDED, none removed or altered', added.sort())]
|
|
255
|
+
: []),
|
|
256
|
+
...(enumGrown.length > 0
|
|
257
|
+
? [summarise('enum members ADDED, none removed or altered', enumGrown.sort())]
|
|
258
|
+
: []),
|
|
259
|
+
],
|
|
200
260
|
};
|
|
201
261
|
}
|
|
202
262
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-surface.js","sourceRoot":"","sources":["../../src/lib/client-surface.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwGA,oDAsCC;AA4JD,sDAoFC;AAqBD,wDAyCC;AA5bD,qCAAuC;AAEvC,+CAAiC;AAEjC,qDAI0B;AAgG1B,SAAgB,oBAAoB,CAAC,SAAiB;IACpD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,OAAO,GAAG,EAAE,CAAC,aAAa,CAAC;QAC/B,cAAc,EAAE,IAAI;QACpB,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,QAAQ;KACjC,CAAC,CAAC;IAEH,KAAK,MAAM,IAAI,IAAI,IAAA,0CAAyB,EAAC,SAAS,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAI9B,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YAC5B,SAAS;QACX,CAAC;QACD,MAAM,SAAS,GAAG,IAA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AAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC3D,6EAA6E;YAC7E,IAAI,OAAO,CAAC,SAAS,qDAAqD,CAC7E,CAAC;IACJ,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const CANONICAL_CUSTOM_FETCH = "/**\n * Configurable fetch wrapper for Orval-generated clients.\n *\n * AUTO-GENERATED by `@xemahq/api-client-generator` \u2014 DO NOT EDIT. Every client\n * in the fleet ships this file byte-for-byte; a hand edit is erased by the next\n * regeneration and, until then, makes this one client speak to the platform\n * differently from all of its siblings.\n *\n * Canonical source: `CANONICAL_CUSTOM_FETCH` in\n * `packages/sdks/api-client-generator/src/lib/custom-fetch-template.ts`\n * (repository `xema-kernel-sdk`). Change it there.\n *\n * Regenerate, from the root of THIS repository:\n * pnpm --filter <owning-service> run openapi\n * pnpm --filter <owning-service> run client:generate\n * A mirror of this client under `xema-host-web` is not regenerated there: it\n * is written by the frontend bridge, `tooling/frontend-bridge` in the\n * xema-monorepo aggregator.\n *\n * Consumers must call `configureClient()` before using any endpoint function.\n * The baseUrl is prepended to the relative paths generated by Orval.\n *\n * By default this transport issues exactly ONE request and adds no delay of its\n * own, so a slow call is a slow server. Retrying is opt-in, and opting in\n * requires supplying an observer \u2014 see `maxRetries` / `onRetry` below.\n */\n\n/** What {@link ClientConfig.onRetry} is told before each re-attempt. */\nexport interface RetryNotice {\n /** 1-based index of the re-attempt about to be made. */\n attempt: number;\n /** The configured budget this re-attempt is spending from. */\n maxRetries: number;\n /** The response status that made the previous attempt retryable. */\n status: number;\n /** Delay before the re-attempt, in ms \u2014 from `Retry-After` when the server sent one. */\n waitMs: number;\n /** Whether {@link waitMs} came from the server's `Retry-After` header. */\n retryAfterHonoured: boolean;\n /** Absolute URL being re-requested. */\n url: string;\n /** HTTP method being re-requested. */\n method: string;\n}\n\n/**\n * Per-request context handed to the callbacks this transport awaits BEFORE it\n * sends the request.\n *\n * `signal` is the request's own `AbortSignal` (`options.signal`). It is the\n * CALLER's cancellation: a callback may use it to stop work that is private to\n * this request, but a callback serving several requests from one shared,\n * single-flight acquisition (a token refresh) must NOT abort that shared work\n * because one caller stopped \u2014 every other caller waiting on it would fail.\n * The transport stops WAITING on its own regardless, so a callback that\n * ignores the signal still cannot hold an aborted request.\n */\nexport interface ClientCallbackOptions {\n signal?: AbortSignal;\n}\n\nexport interface ClientConfig {\n /**\n * Static base URL (e.g. 'http://localhost:3140') \u2014 no trailing slash.\n * Mutually exclusive with `baseUrlResolver`; exactly one MUST be set.\n */\n baseUrl?: string;\n /**\n * Per-request base-URL resolver. When set, the peer URL is resolved from\n * the service registry on EVERY request (boot-order-safe). Wired by\n * `configureOrvalClientResolved` from `@xemahq/platform-common`.\n */\n baseUrlResolver?: (\n options?: ClientCallbackOptions,\n ) => string | Promise<string>;\n /**\n * Optional async callback to get an auth token. Auto-sets Authorization\n * header on every request. Receives the request's signal \u2014 see\n * {@link ClientCallbackOptions} for what it may and may not abort.\n */\n getAuthToken?: (options?: ClientCallbackOptions) => Promise<string>;\n /** Optional callback returning headers to inject on every request. Per-call headers take precedence. */\n getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;\n /**\n * Optional resolver for the CORRELATION ID of the request being made \u2014 the\n * handle that ties one causal chain together across every service hop.\n *\n * WHY IT IS A CALLBACK AND NOT A VALUE. `ClientConfig` is process-global\n * (`configureClient` is called once at wiring time), and a correlation id is\n * per-request. This is invoked INSIDE the request, so a server can point it\n * at whatever carries its ambient request context and get the CURRENT id\n * rather than the one that happened to be live at boot.\n *\n * WHY THE TRANSPORT DOES NOT MINT ONE. Returning `undefined` sends no header,\n * and the receiving service's `RequestContextMiddleware` mints its own \u2014 a\n * new trace, which is honest. A transport that minted per call would produce\n * a FRESH id on every hop while looking like propagation, which is strictly\n * worse than none: every row would carry a correlation id and no two rows\n * that belong together would share one. That is the exact defect this exists\n * to fix, so the transport must not reproduce it one layer down.\n *\n * A caller-supplied `X-Correlation-Id` header always wins, and so does one\n * from `getHeaders`.\n */\n getCorrelationId?: () =>\n | string\n | undefined\n | Promise<string | undefined>;\n /**\n * Optional callback invoked on a 401 before ONE re-attempt. Supplying it is\n * what opts this client into that re-attempt; without it a 401 comes back to\n * the caller as a `ClientError` like any other 4xx.\n */\n onUnauthorized?: () => Promise<void>;\n /**\n * Re-attempts for a retryable status. **Defaults to 0 \u2014 no retry.**\n *\n * Setting it above 0 REQUIRES `onRetry`; `configureClient` throws otherwise.\n * See the block above `customFetch` for why the budget is opt-in and why an\n * observer is mandatory rather than advisory.\n */\n maxRetries?: number;\n /**\n * Called immediately before every re-attempt, with the reason and the delay.\n *\n * Mandatory whenever `maxRetries` is above 0. It is the difference between a\n * retry and a hidden degradation path: without it a caller cannot tell a slow\n * server from this transport sleeping between attempts.\n */\n onRetry?: (notice: RetryNotice) => void;\n}\n\n/**\n * Cross-package identity for `ClientError`.\n *\n * \u2500\u2500 THE OUTAGE THIS IS FOR \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * PRODUCTION, 2026-09-22. A session launch aborted on\n * `HTTP 503 from http://skill-registry-api\u2026/skills`. A 503 is the archetypal\n * TRANSIENT \u2014 agent-session's launch taxonomy already listed it as retryable \u2014\n * but it was classified PERMANENT and the launch was abandoned.\n *\n * The cause was this file. Every generated client package gets its OWN copy of\n * `ClientError`, so there are as many classes as there are clients (81 at the\n * time of writing), all byte-identical and all DIFFERENT OBJECTS. A consumer\n * naturally writes `err instanceof ClientError` against the one client it\n * imported \u2014 which reads as obviously correct and is silently package-local. An\n * error from any OTHER client fails it, falls past every status check, and lands\n * on whatever the default is.\n *\n * That was not the first time: biome-host had already switched to structural\n * detection for the same reason, and canopy imports TWO `ClientError` classes\n * and tests both. Three more call sites elsewhere carry the same shape.\n *\n * \u2500\u2500 WHY A BRAND AND NOT A SHARED PACKAGE \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * The obvious fix is one shared runtime class every client imports. It was\n * rejected on measurement: the 81 generated clients are DEPENDENCY-FREE by\n * design (exactly one has any dependency at all), and a shared class would have\n * to be a PEER dependency to be safe \u2014 a normal dependency can be installed\n * twice under version skew, which reinstates this identical bug in a form that\n * is HARDER to see, because the classes then look like they ought to match.\n *\n * `Symbol.for` is a process-wide registry keyed by STRING, so every copy of\n * this template resolves the same symbol without importing anything. The brand\n * costs no dependency, cannot skew, and needs no new package.\n *\n * `Symbol.hasInstance` then makes plain `instanceof` mean the right thing\n * fleet-wide: an error from ANY generated client satisfies `instanceof\n * ClientError` in ANY other. A helper would have made the safe pattern\n * available; this makes the dangerous pattern impossible.\n *\n * Narrow on purpose \u2014 the brand is set only by this constructor, so an unrelated\n * error carrying a `status` is not admitted.\n */\nconst CLIENT_ERROR_BRAND: unique symbol = Symbol.for(\n 'xema.generatedClientError',\n) as never;\n\nexport class ClientError extends Error {\n constructor(\n public readonly status: number,\n public readonly url: string,\n public readonly body: unknown,\n ) {\n super(`HTTP ${status} from ${url}`);\n this.name = 'ClientError';\n // Non-enumerable: it must not appear in JSON, logs or snapshots \u2014 it is an\n // identity marker, not payload.\n Object.defineProperty(this, CLIENT_ERROR_BRAND, { value: true });\n }\n\n // `override` because the member shadows `Function.prototype[Symbol.hasInstance]`,\n // which a class constructor inherits: TypeScript 5.9+ reports TS4114 without it\n // under `noImplicitOverride`. Measured to compile on 5.5.4, 5.9.3, 6.0.3 and\n // 7.0.2 with the flag on AND off \u2014 pinned by\n // tests/custom-fetch-compiles-standalone.test.cjs.\n static override [Symbol.hasInstance](candidate: unknown): boolean {\n return (\n typeof candidate === 'object' &&\n candidate !== null &&\n CLIENT_ERROR_BRAND in candidate\n );\n }\n}\n\nlet clientConfig: ClientConfig | null = null;\n\n/**\n * THE MOUNT SCOPE \u2014 how one process can host several services without their\n * clients speaking for each other.\n *\n * `clientConfig` below is a MODULE global, and in a single-service process\n * that is correct: one writer, one configuration. Compose two services into one\n * process and both call `configureClient` on THIS SAME module instance, so the\n * second overwrites the first and every outbound call from BOTH services leaves\n * as whichever wired itself last \u2014 wrong base URL, and, because\n * `getAuthToken` is part of the config, WRONG BEARER. That is one tenant's\n * service calling a peer holding another tenant's credential, and it is silent.\n *\n * A composing host installs a hook under this well-known symbol that answers\n * one question: WHICH MOUNT is currently on the stack. Nothing else crosses.\n * `configureClient` then files the config under that mount, and\n * `getClientConfig` reads it back out under the same key.\n *\n * Three properties make this safe rather than clever:\n *\n * - The CONFIG is still built by the mount's own wiring, exactly as today.\n * The hook never supplies one. So a mount's base URL and bearer are\n * resolved FROM THE MOUNT; the scope only decides which drawer they go in.\n * A hook that RETURNED configuration would be a mount taking its identity\n * from ambient storage a neighbour can write \u2014 the inversion to refuse.\n * - The key is an OPAQUE OBJECT and the store is a `WeakMap`, so a mount's\n * configuration becomes unreachable when the host drops the mount, and no\n * client can enumerate the mounts or reach a sibling's entry.\n * - With NO hook installed \u2014 every process in the fleet today \u2014 both\n * functions behave exactly as they did before this existed.\n *\n * `Symbol.for` is the seam because a generated client must keep its\n * dependency surface at zero and a host cannot enumerate the clients a process\n * happens to load. It is the same instrument, and the same reasoning, as the\n * `ClientError` brand above.\n */\nconst XEMA_CLIENT_CONFIG_SCOPE = Symbol.for('xema.client-config-scope');\n\ntype MountScopeHook = () => object | undefined;\n\nfunction mountScopeHook(): MountScopeHook | undefined {\n const hook = (globalThis as Record<symbol, unknown>)[\n XEMA_CLIENT_CONFIG_SCOPE\n ];\n return typeof hook === 'function' ? (hook as MountScopeHook) : undefined;\n}\n\nfunction currentMountKey(): object | undefined {\n return mountScopeHook()?.();\n}\n\nconst perMountConfig = new WeakMap<object, ClientConfig>();\n\n\nexport function configureClient(config: ClientConfig): void {\n // Fail at WIRING time, not on the request that happens to be retried. A\n // client configured to retry without an observer is the exact defect this\n // transport was rebuilt to remove, so it must not be constructible.\n if ((config.maxRetries ?? 0) > 0 && !config.onRetry) {\n throw new Error(\n 'configureClient: maxRetries above 0 requires onRetry. A retry nothing ' +\n 'reports is indistinguishable from a slow server, which is how two ' +\n 'silent re-attempts were read as a 3,312ms call.',\n );\n }\n const hook = mountScopeHook();\n if (hook !== undefined) {\n const mount = hook();\n if (mount === undefined) {\n // A composing host is installed and no member is on the stack, so this\n // configuration belongs to NO member. Filing it in the module global\n // would hand it to every member that did not configure this client \u2014\n // someone else's base URL and bearer, silently.\n throw new Error(\n 'configureClient: called in a composed process outside every member. ' +\n 'Configure the client inside the member that uses it (its providers ' +\n 'and factories already run there).',\n );\n }\n perMountConfig.set(mount, config);\n return;\n }\n clientConfig = config;\n}\n\nexport function getClientConfig(): ClientConfig {\n const mount = currentMountKey();\n if (mount !== undefined) {\n const scoped = perMountConfig.get(mount);\n if (scoped) {\n return scoped;\n }\n // A member that never configured THIS client behaves exactly like a\n // dedicated service that did not either: it is refused. It used to fall\n // through to the module global, which in a composed process can only have\n // been written by some OTHER code \u2014 so the member called peers under a\n // base URL and bearer that were never its own.\n throw new Error(\n 'Client not configured for this member. Call configureClient({ baseUrl }) ' +\n 'inside the member before using endpoint functions.',\n );\n }\n if (!clientConfig) {\n throw new Error(\n 'Client not configured. Call configureClient({ baseUrl }) before using endpoint functions.',\n );\n }\n return clientConfig;\n}\n\n/*\n * RETRYING IS OPT-IN, OBSERVED, AND NARROW. Do not widen any of the three.\n *\n * This transport used to retry up to `maxRetries` (defaulting to THREE) over\n * 429/502/503/504 AND over any thrown network error, backing off from 1000ms,\n * with no log line anywhere. Three properties were wrong:\n *\n * 1. The DEFAULT was on. ~99% of the fleet's client configurations never\n * mention `maxRetries`, so two re-attempts could add ~3s to any call with\n * nothing to distinguish that from a slow peer. Every caller that DID set\n * it set it LOWER \u2014 canopy's control plane to 1, \"so a hard outage\n * surfaces inside the turn's latency budget rather than after three\n * backoffs\"; two llm-registry callers to 1; a test to 0. Nobody ever\n * raised it. A default three separate call sites work around is not a\n * default, and `configureOrvalClientResolved` cannot express the field at\n * all, so most callers could not have opted out if they had wanted to.\n * 2. It retried AMBIGUOUS failures. 502 and 504 mean a gateway did not get a\n * timely answer from upstream \u2014 the upstream may well have APPLIED the\n * request. So did a thrown network error mid-flight. Re-sending a POST in\n * either case is a duplicate write, and no amount of logging makes that\n * safe. Only 429 and 503 state positively that the request was NOT\n * processed, so only those are retried; everything else surfaces at once.\n * 3. Nothing reported it. Now `onRetry` is mandatory whenever the budget is\n * above 0, enforced in `configureClient`.\n *\n * Also note `baseUrlResolver` is awaited ONCE, above the loop: a re-attempt\n * returns to the same resolved instance. In a registry-resolved fleet the cure\n * for an unhealthy peer is re-resolution, which lives above this file \u2014 which\n * is a further reason not to lean on retrying here.\n *\n * Retry policy a caller genuinely wants belongs in `@xemahq/managed-fetch`,\n * which has backoff, a circuit breaker, a token bucket and health reporting,\n * and reports what it did.\n *\n * Enforced fleet-wide by `check-client-transport-envelope`, which compares\n * every client's transport to this template.\n */\n\n/** The only statuses that state the request was NOT processed. See above. */\nconst RETRYABLE_STATUSES = [429, 503];\n\n/**\n * The platform's correlation header, spelled once.\n *\n * Value-identical to what `RequestContextMiddleware` reads in\n * `@xemahq/platform-common`. It is a literal here rather than an import\n * because this file has ZERO imports on purpose: it ships byte-identical into\n * browser-target clients as well as server-target ones, and a dependency on a\n * NestJS-peer package would follow it into every one of them.\n */\nconst CORRELATION_ID_HEADER = 'X-Correlation-Id';\n\n/** Backoff floor, doubling per attempt up to {@link MAX_BACKOFF_MS}. */\nconst BASE_BACKOFF_MS = 1000;\n\n/** Ceiling on a single backoff, however many attempts have elapsed. */\nconst MAX_BACKOFF_MS = 30_000;\n\n/*\n * CALLER CANCELLATION REACHES EVERY WAIT BEFORE THE REQUEST IS SENT.\n *\n * `fetch` always honoured `options.signal`, but everything this transport\n * awaits BEFORE `fetch` \u2014 base-URL resolution, the header callbacks, the auth\n * token \u2014 did not, so a caller that aborted while a token was being minted sat\n * out the mint and then, at best, had its request refused. The only way to\n * cancel that wait was a process-wide interceptor aborting every outbound\n * request, which also aborts a SHARED single-flight token refresh and so fails\n * every other caller waiting on it.\n *\n * So each pre-send wait is RACED against the signal: the caller stops waiting\n * at once, and the work it was waiting on carries on for anybody else. The\n * rejection is the signal's own reason \u2014 exactly what `fetch` rejects with \u2014\n * so a caller sees ONE abort shape whenever it aborts. An aborted request is\n * never retried. Without a signal nothing here changes.\n */\nfunction abortedReason(signal: AbortSignal): unknown {\n // `abort()` with no argument sets a DOMException reason, so this is only\n // ever `undefined` for a hand-built signal; say so rather than throw it.\n return signal.reason ?? new DOMException('This operation was aborted', 'AbortError');\n}\n\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) {\n throw abortedReason(signal);\n }\n}\n\nfunction raceAbort<V>(\n pending: V | Promise<V>,\n signal: AbortSignal | undefined,\n): Promise<V> {\n const promise = Promise.resolve(pending);\n if (!signal) {\n return promise;\n }\n if (signal.aborted) {\n promise.catch(() => undefined);\n return Promise.reject(abortedReason(signal));\n }\n return new Promise<V>((resolve, reject) => {\n const onAbort = (): void => {\n // The pending work may be shared; it carries on, and its eventual\n // rejection must not surface as an unhandled one on this side.\n promise.catch(() => undefined);\n reject(abortedReason(signal));\n };\n signal.addEventListener('abort', onAbort, { once: true });\n promise.then(\n (value) => {\n signal.removeEventListener('abort', onAbort);\n resolve(value);\n },\n (err: unknown) => {\n signal.removeEventListener('abort', onAbort);\n reject(err);\n },\n );\n });\n}\n\nasync function buildHeaders(\n config: ClientConfig,\n callerHeaders: RequestInit['headers'],\n signal: AbortSignal | undefined,\n): Promise<Headers> {\n const headers = new Headers(callerHeaders);\n\n // Global headers from config (caller-provided headers take precedence)\n if (config.getHeaders) {\n const globalHeaders = await raceAbort(config.getHeaders(), signal);\n for (const [key, value] of Object.entries(globalHeaders)) {\n if (!headers.has(key)) {\n headers.set(key, value);\n }\n }\n }\n\n // Correlation id (caller and global headers still take precedence).\n //\n // Without this, every server-to-server hop through a generated client started\n // a NEW trace: the id is read-or-minted per hop by the receiving service's\n // RequestContextMiddleware, and nothing carried it outbound \u2014 so an audit\n // journal could record a whole causal chain and offer no way to join it back\n // together.\n //\n // Absent resolver, or a resolver that answers `undefined`: NO header. The\n // receiver mints and a new trace begins, which is the truthful outcome when\n // there is nothing to continue.\n if (config.getCorrelationId && !headers.has(CORRELATION_ID_HEADER)) {\n const correlationId = await raceAbort(config.getCorrelationId(), signal);\n if (correlationId) {\n headers.set(CORRELATION_ID_HEADER, correlationId);\n }\n }\n\n // Auth token (caller or global headers take precedence)\n if (config.getAuthToken && !headers.has('Authorization')) {\n const token = await raceAbort(\n config.getAuthToken(signal ? { signal } : undefined),\n signal,\n );\n headers.set('Authorization', `Bearer ${token}`);\n }\n\n return headers;\n}\n\n/*\n * THE TRANSPORT RETURNS THE BODY UNCHANGED. Do not reintroduce an unwrap here.\n *\n * Xema services wrap every 2xx payload in a { data: T } envelope via the global\n * ResponseEnvelopeInterceptor (platform-common), and the generator emits types\n * that describe THAT ENVELOPE \u2014 every endpoint returns Promise<XDataEnvelope>\n * or Promise<XPaginatedEnvelope>, never a bare inner T. Consumers read the data\n * property themselves.\n *\n * This template used to peel data, justified by a comment claiming generated\n * types describe the inner T. That stopped being true when the generator moved\n * to envelope-typed returns, and the comment outlived the fact \u2014 so the peel\n * then contradicted every type in every package it seeded. Four clients shipped\n * that way (resource-governance x3, workload-runtime-api): declared\n * *DataEnvelope, returned the already-peeled inner object, so .data read\n * undefined at runtime on every non-paginated endpoint. Paginated calls hid it,\n * because the old peel deliberately preserved an envelope carrying pagination.\n *\n * Four MORE shipped it in repositories the gate could not see \u2014 license-api and\n * license-internal-api in xema-operator, plus their host-web mirrors \u2014 because\n * the gate ran in xema-base only. That is why it now runs in every repository\n * that ships a client, and why this file is generator-owned rather than seeded.\n */\n\nexport const customFetch = async <T>(\n url: string,\n options: RequestInit,\n): Promise<T> => {\n const config = getClientConfig();\n const signal = options.signal ?? undefined;\n throwIfAborted(signal);\n const base = config.baseUrlResolver\n ? await raceAbort(\n config.baseUrlResolver(signal ? { signal } : undefined),\n signal,\n )\n : config.baseUrl;\n if (base === undefined) {\n throw new Error(\n 'Client not configured: set baseUrl or baseUrlResolver via configureClient().',\n );\n }\n const fullUrl = `${base}${url}`;\n const maxRetries = config.maxRetries ?? 0;\n\n // A caller that supplied its own Authorization header owns that credential.\n // `buildHeaders` lets it win, so refreshing the CLIENT-WIDE token and\n // re-sending would replay the identical failing request with the identical\n // credential: one wasted round trip, plus a global refresh nobody asked for.\n const callerSuppliedAuth = new Headers(options.headers).has('Authorization');\n\n const headers = await buildHeaders(config, options.headers, signal);\n const requestInit: RequestInit = { ...options, headers };\n\n let delay = BASE_BACKOFF_MS;\n\n for (let attempt = 0; ; attempt++) {\n const response = await fetch(fullUrl, requestInit);\n\n if (\n response.status === 401 &&\n config.onUnauthorized &&\n !callerSuppliedAuth &&\n attempt === 0\n ) {\n await raceAbort(config.onUnauthorized(), signal);\n const refreshedHeaders = await buildHeaders(\n config,\n options.headers,\n signal,\n );\n const retryResponse = await fetch(fullUrl, {\n ...options,\n headers: refreshedHeaders,\n });\n const retryBody = await parseBody(retryResponse);\n if (retryResponse.status >= 400) {\n throw new ClientError(retryResponse.status, fullUrl, retryBody);\n }\n return retryBody as T;\n }\n\n if (\n !RETRYABLE_STATUSES.includes(response.status) ||\n attempt >= maxRetries\n ) {\n const body = await parseBody(response);\n if (response.status >= 400) {\n throw new ClientError(response.status, fullUrl, body);\n }\n return body as T;\n }\n\n const retryAfter = parseRetryAfter(response.headers.get('Retry-After'));\n const waitMs = retryAfter ?? addJitter(delay);\n // Non-null: `configureClient` refuses a budget above 0 without an observer,\n // and this line is unreachable unless `maxRetries` is above 0.\n (config.onRetry as (notice: RetryNotice) => void)({\n attempt: attempt + 1,\n maxRetries,\n status: response.status,\n waitMs,\n retryAfterHonoured: retryAfter !== undefined,\n url: fullUrl,\n method: options.method ?? 'GET',\n });\n await sleep(waitMs, signal);\n delay = Math.min(delay * 2, MAX_BACKOFF_MS);\n }\n};\n\n/**\n * Does this media type carry JSON?\n *\n * \u2500\u2500 THE OUTAGE THIS FIXES \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * This used to be `contentType?.includes('application/json')`, and EVERY error\n * this fleet returns failed that test. The platform's `GlobalExceptionFilter`\n * emits RFC 9457 problem documents and sets the media type explicitly \u2014\n * `.type(PROBLEM_DETAILS_CONTENT_TYPE)` before `.json()`, so it cannot be\n * overridden \u2014 and that constant is `application/problem+json`, which does NOT\n * contain the substring `application/json`: after `application/` comes\n * `problem+json`.\n *\n * So every non-2xx body fell through to `response.text()` and reached the\n * caller as an UNPARSED STRING. `ClientError.body` is typed `unknown`, so\n * nothing complained; every consumer that reads a machine-readable code off an\n * error \u2014 `error.body.code`, `error.body.details.code` \u2014 silently read\n * `undefined` instead, for every error, in every service.\n *\n * Measured in production on 2026-09-15: skill-registry-api's\n * `resolveOrNull()` absorbs `RELEASE_CHANNEL_NOT_FOUND` into `null` by exactly\n * that read. With the code unreadable the absorb never fired, a routine \"no\n * pointer on this channel\" 404 became a 500 on `GET /skills` and\n * `GET /describe-objects`, and agent-session-api's `apply_control_bundle` step\n * aborted EVERY session launch in the organisation \u2014 7,871 failed resolutions\n * an hour. A fix written for that exact page months earlier was present in the\n * running image and could not help, because the classifier it repaired was\n * being handed a string.\n *\n * \u2500\u2500 WHY THE STRUCTURED SUFFIX, NOT A SECOND SUBSTRING \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * Adding `|| includes('application/problem+json')` would fix this one media\n * type and leave the next one \u2014 `application/vnd.api+json`, and anything else\n * a service legitimately emits. RFC 6839 defines `+json` as the structured\n * syntax suffix meaning \"this is JSON\"; that is the actual rule, so it is the\n * rule implemented. Parameters are stripped first, because\n * `application/problem+json; charset=utf-8` is the same media type.\n */\nfunction isJsonMediaType(contentType: string | null): boolean {\n if (contentType === null) {\n return false;\n }\n const essence = contentType.split(';')[0]?.trim().toLowerCase() ?? '';\n return essence === 'application/json' || essence.endsWith('+json');\n}\n\n/**\n * Does this media type carry TEXT a caller reads as a string?\n *\n * The response body is decoded by its declared media type, in three classes,\n * and each class matches what the generated function's return type says for\n * the schema such a route declares:\n *\n * - JSON (`application/json` or an RFC 6839 `+json` suffix) \u2192 parsed;\n * - TEXT (`text/*` \u2014 including `text/event-stream` \u2014 `application/javascript`,\n * `application/ecmascript`, `application/xml` or an RFC 7303 `+xml`\n * suffix) \u2192 a string, which is what a `{ type: string }` schema generates;\n * - anything else \u2014 `application/octet-stream`, `application/gzip`,\n * `application/pdf`, an Office document type, any `format: binary` body \u2014\n * \u2192 a `Blob`, which is what a `format: binary` schema generates.\n *\n * Reading every non-JSON body as text, as this transport did until 2026-10-04,\n * handed a caller typed `Blob` a string: `response.text()` decodes the bytes\n * as UTF-8, so a PDF or a gzip tarball arrived corrupted under a type that\n * promised the bytes.\n *\n * A response with NO content type is read as text, so an empty body stays the\n * empty string it always was.\n */\nfunction isTextMediaType(contentType: string): boolean {\n const essence = contentType.split(';')[0]?.trim().toLowerCase() ?? '';\n return (\n essence.startsWith('text/') ||\n essence === 'application/javascript' ||\n essence === 'application/ecmascript' ||\n essence === 'application/xml' ||\n essence.endsWith('+xml')\n );\n}\n\nasync function parseBody(response: Response): Promise<unknown> {\n // 204 FIRST, and deliberately \u2014 this ORDER is carried from `develop`, which\n // fixed the same defect independently and got this half right where `main`\n // did not. A 204 carries no body, so `response.json()` on one throws\n // SyntaxError; and a 204 whose headers STILL declare a JSON content type is\n // ordinary, because the framework sets the header before the handler returns\n // nothing. With the JSON branch first, a documented `undefined` becomes a\n // thrown parse error. Pinned by a case in `transport-problem-json.test.cjs`.\n if (response.status === 204) {\n return undefined;\n }\n const contentType = response.headers.get('content-type');\n if (isJsonMediaType(contentType)) {\n return response.json();\n }\n if (contentType === null || isTextMediaType(contentType)) {\n return response.text();\n }\n return response.blob();\n}\n\nfunction parseRetryAfter(value: string | null): number | undefined {\n if (!value) return undefined;\n const seconds = Number(value);\n if (!isNaN(seconds) && seconds >= 0) return seconds * 1000;\n const date = new Date(value);\n if (!isNaN(date.getTime())) return Math.max(0, date.getTime() - Date.now());\n return undefined;\n}\n\nfunction addJitter(delay: number): number {\n return delay + (Math.random() * 2 - 1) * delay * 0.25;\n}\n\n/** A retry backoff; the caller's signal ends it at once and is never retried. */\nfunction sleep(ms: number, signal: AbortSignal | undefined): Promise<void> {\n if (!signal) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n if (signal.aborted) {\n return Promise.reject(abortedReason(signal));\n }\n return new Promise((resolve, reject) => {\n const onAbort = (): void => {\n clearTimeout(timer);\n reject(abortedReason(signal));\n };\n const timer = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal.addEventListener('abort', onAbort, { once: true });\n });\n}\n\nexport default customFetch;\n";
|
|
1
|
+
export declare const CANONICAL_CUSTOM_FETCH = "/**\n * Configurable fetch wrapper for Orval-generated clients.\n *\n * AUTO-GENERATED by `@xemahq/api-client-generator` \u2014 DO NOT EDIT. Every client\n * in the fleet ships this file byte-for-byte; a hand edit is erased by the next\n * regeneration and, until then, makes this one client speak to the platform\n * differently from all of its siblings.\n *\n * Canonical source: `CANONICAL_CUSTOM_FETCH` in\n * `packages/sdks/api-client-generator/src/lib/custom-fetch-template.ts`\n * (repository `xema-kernel-sdk`). Change it there.\n *\n * Regenerate, from the root of THIS repository:\n * pnpm --filter <owning-service> run openapi\n * pnpm --filter <owning-service> run client:generate\n * A mirror of this client under `xema-host-web` is not regenerated there: it\n * is written by the frontend bridge, `tooling/frontend-bridge` in the\n * xema-monorepo aggregator.\n *\n * Consumers must call `configureClient()` before using any endpoint function.\n * The baseUrl is prepended to the relative paths generated by Orval.\n *\n * By default this transport issues exactly ONE request and adds no delay of its\n * own, so a slow call is a slow server. Retrying is opt-in, and opting in\n * requires supplying an observer \u2014 see `maxRetries` / `onRetry` below.\n */\n\n/** What {@link ClientConfig.onRetry} is told before each re-attempt. */\nexport interface RetryNotice {\n /** 1-based index of the re-attempt about to be made. */\n attempt: number;\n /** The configured budget this re-attempt is spending from. */\n maxRetries: number;\n /** The response status that made the previous attempt retryable. */\n status: number;\n /** Delay before the re-attempt, in ms \u2014 from `Retry-After` when the server sent one. */\n waitMs: number;\n /** Whether {@link waitMs} came from the server's `Retry-After` header. */\n retryAfterHonoured: boolean;\n /** Absolute URL being re-requested. */\n url: string;\n /** HTTP method being re-requested. */\n method: string;\n}\n\n/**\n * Per-request context handed to the callbacks this transport awaits BEFORE it\n * sends the request.\n *\n * `signal` is the request's own `AbortSignal` (`options.signal`). It is the\n * CALLER's cancellation: a callback may use it to stop work that is private to\n * this request, but a callback serving several requests from one shared,\n * single-flight acquisition (a token refresh) must NOT abort that shared work\n * because one caller stopped \u2014 every other caller waiting on it would fail.\n * The transport stops WAITING on its own regardless, so a callback that\n * ignores the signal still cannot hold an aborted request.\n */\nexport interface ClientCallbackOptions {\n signal?: AbortSignal;\n}\n\n/** What {@link ClientConfig.onUnauthorized} is told about the 401 it answers. */\nexport interface UnauthorizedContext {\n /**\n * The token `getAuthToken` returned for the attempt the server rejected.\n * `undefined` when no `getAuthToken` produced the Authorization header\n * (a header from `getHeaders` or no credential at all): there is then no\n * client-held token to drop.\n */\n readonly rejectedToken: string | undefined;\n}\n\nexport interface ClientConfig {\n /**\n * Static base URL (e.g. 'http://localhost:3140') \u2014 no trailing slash.\n * Mutually exclusive with `baseUrlResolver`; exactly one MUST be set.\n */\n baseUrl?: string;\n /**\n * Per-request base-URL resolver. When set, the peer URL is resolved from\n * the service registry on EVERY request (boot-order-safe). Wired by\n * `configureOrvalClientResolved` from `@xemahq/platform-common`.\n */\n baseUrlResolver?: (\n options?: ClientCallbackOptions,\n ) => string | Promise<string>;\n /**\n * Optional async callback to get an auth token. Auto-sets Authorization\n * header on every request. Receives the request's signal \u2014 see\n * {@link ClientCallbackOptions} for what it may and may not abort.\n */\n getAuthToken?: (options?: ClientCallbackOptions) => Promise<string>;\n /** Optional callback returning headers to inject on every request. Per-call headers take precedence. */\n getHeaders?: () => Record<string, string> | Promise<Record<string, string>>;\n /**\n * Optional resolver for the CORRELATION ID of the request being made \u2014 the\n * handle that ties one causal chain together across every service hop.\n *\n * WHY IT IS A CALLBACK AND NOT A VALUE. `ClientConfig` is process-global\n * (`configureClient` is called once at wiring time), and a correlation id is\n * per-request. This is invoked INSIDE the request, so a server can point it\n * at whatever carries its ambient request context and get the CURRENT id\n * rather than the one that happened to be live at boot.\n *\n * WHY THE TRANSPORT DOES NOT MINT ONE. Returning `undefined` sends no header,\n * and the receiving service's `RequestContextMiddleware` mints its own \u2014 a\n * new trace, which is honest. A transport that minted per call would produce\n * a FRESH id on every hop while looking like propagation, which is strictly\n * worse than none: every row would carry a correlation id and no two rows\n * that belong together would share one. That is the exact defect this exists\n * to fix, so the transport must not reproduce it one layer down.\n *\n * A caller-supplied `X-Correlation-Id` header always wins, and so does one\n * from `getHeaders`.\n */\n getCorrelationId?: () =>\n | string\n | undefined\n | Promise<string | undefined>;\n /**\n * Optional callback invoked on a 401 before ONE re-attempt. Supplying it is\n * what opts this client into that re-attempt; without it a 401 comes back to\n * the caller as a `ClientError` like any other 4xx.\n *\n * It is told WHAT was rejected (see {@link UnauthorizedContext}), so a\n * callback that drops a cached credential can drop exactly that one and leave\n * a newer one, minted by a concurrent request, alone.\n */\n onUnauthorized?: (context: UnauthorizedContext) => Promise<void>;\n /**\n * Re-attempts for a retryable status. **Defaults to 0 \u2014 no retry.**\n *\n * Setting it above 0 REQUIRES `onRetry`; `configureClient` throws otherwise.\n * See the block above `customFetch` for why the budget is opt-in and why an\n * observer is mandatory rather than advisory.\n */\n maxRetries?: number;\n /**\n * Called immediately before every re-attempt, with the reason and the delay.\n *\n * Mandatory whenever `maxRetries` is above 0. It is the difference between a\n * retry and a hidden degradation path: without it a caller cannot tell a slow\n * server from this transport sleeping between attempts.\n */\n onRetry?: (notice: RetryNotice) => void;\n}\n\n/**\n * Cross-package identity for `ClientError`.\n *\n * \u2500\u2500 THE OUTAGE THIS IS FOR \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * PRODUCTION, 2026-09-22. A session launch aborted on\n * `HTTP 503 from http://skill-registry-api\u2026/skills`. A 503 is the archetypal\n * TRANSIENT \u2014 agent-session's launch taxonomy already listed it as retryable \u2014\n * but it was classified PERMANENT and the launch was abandoned.\n *\n * The cause was this file. Every generated client package gets its OWN copy of\n * `ClientError`, so there are as many classes as there are clients (81 at the\n * time of writing), all byte-identical and all DIFFERENT OBJECTS. A consumer\n * naturally writes `err instanceof ClientError` against the one client it\n * imported \u2014 which reads as obviously correct and is silently package-local. An\n * error from any OTHER client fails it, falls past every status check, and lands\n * on whatever the default is.\n *\n * That was not the first time: biome-host had already switched to structural\n * detection for the same reason, and canopy imports TWO `ClientError` classes\n * and tests both. Three more call sites elsewhere carry the same shape.\n *\n * \u2500\u2500 WHY A BRAND AND NOT A SHARED PACKAGE \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * The obvious fix is one shared runtime class every client imports. It was\n * rejected on measurement: the 81 generated clients are DEPENDENCY-FREE by\n * design (exactly one has any dependency at all), and a shared class would have\n * to be a PEER dependency to be safe \u2014 a normal dependency can be installed\n * twice under version skew, which reinstates this identical bug in a form that\n * is HARDER to see, because the classes then look like they ought to match.\n *\n * `Symbol.for` is a process-wide registry keyed by STRING, so every copy of\n * this template resolves the same symbol without importing anything. The brand\n * costs no dependency, cannot skew, and needs no new package.\n *\n * `Symbol.hasInstance` then makes plain `instanceof` mean the right thing\n * fleet-wide: an error from ANY generated client satisfies `instanceof\n * ClientError` in ANY other. A helper would have made the safe pattern\n * available; this makes the dangerous pattern impossible.\n *\n * Narrow on purpose \u2014 the brand is set only by this constructor, so an unrelated\n * error carrying a `status` is not admitted.\n */\nconst CLIENT_ERROR_BRAND: unique symbol = Symbol.for(\n 'xema.generatedClientError',\n) as never;\n\nexport class ClientError extends Error {\n constructor(\n public readonly status: number,\n public readonly url: string,\n public readonly body: unknown,\n ) {\n super(`HTTP ${status} from ${url}`);\n this.name = 'ClientError';\n // Non-enumerable: it must not appear in JSON, logs or snapshots \u2014 it is an\n // identity marker, not payload.\n Object.defineProperty(this, CLIENT_ERROR_BRAND, { value: true });\n }\n\n // `override` because the member shadows `Function.prototype[Symbol.hasInstance]`,\n // which a class constructor inherits: TypeScript 5.9+ reports TS4114 without it\n // under `noImplicitOverride`. Measured to compile on 5.5.4, 5.9.3, 6.0.3 and\n // 7.0.2 with the flag on AND off \u2014 pinned by\n // tests/custom-fetch-compiles-standalone.test.cjs.\n static override [Symbol.hasInstance](candidate: unknown): boolean {\n return (\n typeof candidate === 'object' &&\n candidate !== null &&\n CLIENT_ERROR_BRAND in candidate\n );\n }\n}\n\nlet clientConfig: ClientConfig | null = null;\n\n/**\n * THE MOUNT SCOPE \u2014 how one process can host several services without their\n * clients speaking for each other.\n *\n * `clientConfig` below is a MODULE global, and in a single-service process\n * that is correct: one writer, one configuration. Compose two services into one\n * process and both call `configureClient` on THIS SAME module instance, so the\n * second overwrites the first and every outbound call from BOTH services leaves\n * as whichever wired itself last \u2014 wrong base URL, and, because\n * `getAuthToken` is part of the config, WRONG BEARER. That is one tenant's\n * service calling a peer holding another tenant's credential, and it is silent.\n *\n * A composing host installs a hook under this well-known symbol that answers\n * one question: WHICH MOUNT is currently on the stack. Nothing else crosses.\n * `configureClient` then files the config under that mount, and\n * `getClientConfig` reads it back out under the same key.\n *\n * Three properties make this safe rather than clever:\n *\n * - The CONFIG is still built by the mount's own wiring, exactly as today.\n * The hook never supplies one. So a mount's base URL and bearer are\n * resolved FROM THE MOUNT; the scope only decides which drawer they go in.\n * A hook that RETURNED configuration would be a mount taking its identity\n * from ambient storage a neighbour can write \u2014 the inversion to refuse.\n * - The key is an OPAQUE OBJECT and the store is a `WeakMap`, so a mount's\n * configuration becomes unreachable when the host drops the mount, and no\n * client can enumerate the mounts or reach a sibling's entry.\n * - With NO hook installed \u2014 every process in the fleet today \u2014 both\n * functions behave exactly as they did before this existed.\n *\n * `Symbol.for` is the seam because a generated client must keep its\n * dependency surface at zero and a host cannot enumerate the clients a process\n * happens to load. It is the same instrument, and the same reasoning, as the\n * `ClientError` brand above.\n */\nconst XEMA_CLIENT_CONFIG_SCOPE = Symbol.for('xema.client-config-scope');\n\ntype MountScopeHook = () => object | undefined;\n\nfunction mountScopeHook(): MountScopeHook | undefined {\n const hook = (globalThis as Record<symbol, unknown>)[\n XEMA_CLIENT_CONFIG_SCOPE\n ];\n return typeof hook === 'function' ? (hook as MountScopeHook) : undefined;\n}\n\nfunction currentMountKey(): object | undefined {\n return mountScopeHook()?.();\n}\n\nconst perMountConfig = new WeakMap<object, ClientConfig>();\n\n\nexport function configureClient(config: ClientConfig): void {\n // Fail at WIRING time, not on the request that happens to be retried. A\n // client configured to retry without an observer is the exact defect this\n // transport was rebuilt to remove, so it must not be constructible.\n if ((config.maxRetries ?? 0) > 0 && !config.onRetry) {\n throw new Error(\n 'configureClient: maxRetries above 0 requires onRetry. A retry nothing ' +\n 'reports is indistinguishable from a slow server, which is how two ' +\n 'silent re-attempts were read as a 3,312ms call.',\n );\n }\n const hook = mountScopeHook();\n if (hook !== undefined) {\n const mount = hook();\n if (mount === undefined) {\n // A composing host is installed and no member is on the stack, so this\n // configuration belongs to NO member. Filing it in the module global\n // would hand it to every member that did not configure this client \u2014\n // someone else's base URL and bearer, silently.\n throw new Error(\n 'configureClient: called in a composed process outside every member. ' +\n 'Configure the client inside the member that uses it (its providers ' +\n 'and factories already run there).',\n );\n }\n perMountConfig.set(mount, config);\n return;\n }\n clientConfig = config;\n}\n\nexport function getClientConfig(): ClientConfig {\n const mount = currentMountKey();\n if (mount !== undefined) {\n const scoped = perMountConfig.get(mount);\n if (scoped) {\n return scoped;\n }\n // A member that never configured THIS client behaves exactly like a\n // dedicated service that did not either: it is refused. It used to fall\n // through to the module global, which in a composed process can only have\n // been written by some OTHER code \u2014 so the member called peers under a\n // base URL and bearer that were never its own.\n throw new Error(\n 'Client not configured for this member. Call configureClient({ baseUrl }) ' +\n 'inside the member before using endpoint functions.',\n );\n }\n if (!clientConfig) {\n throw new Error(\n 'Client not configured. Call configureClient({ baseUrl }) before using endpoint functions.',\n );\n }\n return clientConfig;\n}\n\n/*\n * RETRYING IS OPT-IN, OBSERVED, AND NARROW. Do not widen any of the three.\n *\n * This transport used to retry up to `maxRetries` (defaulting to THREE) over\n * 429/502/503/504 AND over any thrown network error, backing off from 1000ms,\n * with no log line anywhere. Three properties were wrong:\n *\n * 1. The DEFAULT was on. ~99% of the fleet's client configurations never\n * mention `maxRetries`, so two re-attempts could add ~3s to any call with\n * nothing to distinguish that from a slow peer. Every caller that DID set\n * it set it LOWER \u2014 canopy's control plane to 1, \"so a hard outage\n * surfaces inside the turn's latency budget rather than after three\n * backoffs\"; two llm-registry callers to 1; a test to 0. Nobody ever\n * raised it. A default three separate call sites work around is not a\n * default, and `configureOrvalClientResolved` cannot express the field at\n * all, so most callers could not have opted out if they had wanted to.\n * 2. It retried AMBIGUOUS failures. 502 and 504 mean a gateway did not get a\n * timely answer from upstream \u2014 the upstream may well have APPLIED the\n * request. So did a thrown network error mid-flight. Re-sending a POST in\n * either case is a duplicate write, and no amount of logging makes that\n * safe. Only 429 and 503 state positively that the request was NOT\n * processed, so only those are retried; everything else surfaces at once.\n * 3. Nothing reported it. Now `onRetry` is mandatory whenever the budget is\n * above 0, enforced in `configureClient`.\n *\n * Also note `baseUrlResolver` is awaited ONCE, above the loop: a re-attempt\n * returns to the same resolved instance. In a registry-resolved fleet the cure\n * for an unhealthy peer is re-resolution, which lives above this file \u2014 which\n * is a further reason not to lean on retrying here.\n *\n * Retry policy a caller genuinely wants belongs in `@xemahq/managed-fetch`,\n * which has backoff, a circuit breaker, a token bucket and health reporting,\n * and reports what it did.\n *\n * Enforced fleet-wide by `check-client-transport-envelope`, which compares\n * every client's transport to this template.\n */\n\n/** The only statuses that state the request was NOT processed. See above. */\nconst RETRYABLE_STATUSES = [429, 503];\n\n/**\n * The platform's correlation header, spelled once.\n *\n * Value-identical to what `RequestContextMiddleware` reads in\n * `@xemahq/platform-common`. It is a literal here rather than an import\n * because this file has ZERO imports on purpose: it ships byte-identical into\n * browser-target clients as well as server-target ones, and a dependency on a\n * NestJS-peer package would follow it into every one of them.\n */\nconst CORRELATION_ID_HEADER = 'X-Correlation-Id';\n\n/** Backoff floor, doubling per attempt up to {@link MAX_BACKOFF_MS}. */\nconst BASE_BACKOFF_MS = 1000;\n\n/** Ceiling on a single backoff, however many attempts have elapsed. */\nconst MAX_BACKOFF_MS = 30_000;\n\n/*\n * CALLER CANCELLATION REACHES EVERY WAIT BEFORE THE REQUEST IS SENT.\n *\n * `fetch` always honoured `options.signal`, but everything this transport\n * awaits BEFORE `fetch` \u2014 base-URL resolution, the header callbacks, the auth\n * token \u2014 did not, so a caller that aborted while a token was being minted sat\n * out the mint and then, at best, had its request refused. The only way to\n * cancel that wait was a process-wide interceptor aborting every outbound\n * request, which also aborts a SHARED single-flight token refresh and so fails\n * every other caller waiting on it.\n *\n * So each pre-send wait is RACED against the signal: the caller stops waiting\n * at once, and the work it was waiting on carries on for anybody else. The\n * rejection is the signal's own reason \u2014 exactly what `fetch` rejects with \u2014\n * so a caller sees ONE abort shape whenever it aborts. An aborted request is\n * never retried. Without a signal nothing here changes.\n */\nfunction abortedReason(signal: AbortSignal): unknown {\n // `abort()` with no argument sets a DOMException reason, so this is only\n // ever `undefined` for a hand-built signal; say so rather than throw it.\n return signal.reason ?? new DOMException('This operation was aborted', 'AbortError');\n}\n\nfunction throwIfAborted(signal: AbortSignal | undefined): void {\n if (signal?.aborted) {\n throw abortedReason(signal);\n }\n}\n\nfunction raceAbort<V>(\n pending: V | Promise<V>,\n signal: AbortSignal | undefined,\n): Promise<V> {\n const promise = Promise.resolve(pending);\n if (!signal) {\n return promise;\n }\n if (signal.aborted) {\n promise.catch(() => undefined);\n return Promise.reject(abortedReason(signal));\n }\n return new Promise<V>((resolve, reject) => {\n const onAbort = (): void => {\n // The pending work may be shared; it carries on, and its eventual\n // rejection must not surface as an unhandled one on this side.\n promise.catch(() => undefined);\n reject(abortedReason(signal));\n };\n signal.addEventListener('abort', onAbort, { once: true });\n promise.then(\n (value) => {\n signal.removeEventListener('abort', onAbort);\n resolve(value);\n },\n (err: unknown) => {\n signal.removeEventListener('abort', onAbort);\n reject(err);\n },\n );\n });\n}\n\ninterface BuiltHeaders {\n readonly headers: Headers;\n /** The token `getAuthToken` produced for these headers, if it did. */\n readonly authToken: string | undefined;\n}\n\nasync function buildHeaders(\n config: ClientConfig,\n callerHeaders: RequestInit['headers'],\n signal: AbortSignal | undefined,\n): Promise<BuiltHeaders> {\n const headers = new Headers(callerHeaders);\n\n // Global headers from config (caller-provided headers take precedence)\n if (config.getHeaders) {\n const globalHeaders = await raceAbort(config.getHeaders(), signal);\n for (const [key, value] of Object.entries(globalHeaders)) {\n if (!headers.has(key)) {\n headers.set(key, value);\n }\n }\n }\n\n // Correlation id (caller and global headers still take precedence).\n //\n // Without this, every server-to-server hop through a generated client started\n // a NEW trace: the id is read-or-minted per hop by the receiving service's\n // RequestContextMiddleware, and nothing carried it outbound \u2014 so an audit\n // journal could record a whole causal chain and offer no way to join it back\n // together.\n //\n // Absent resolver, or a resolver that answers `undefined`: NO header. The\n // receiver mints and a new trace begins, which is the truthful outcome when\n // there is nothing to continue.\n if (config.getCorrelationId && !headers.has(CORRELATION_ID_HEADER)) {\n const correlationId = await raceAbort(config.getCorrelationId(), signal);\n if (correlationId) {\n headers.set(CORRELATION_ID_HEADER, correlationId);\n }\n }\n\n // Auth token (caller or global headers take precedence)\n let authToken: string | undefined;\n if (config.getAuthToken && !headers.has('Authorization')) {\n authToken = await raceAbort(\n config.getAuthToken(signal ? { signal } : undefined),\n signal,\n );\n headers.set('Authorization', `Bearer ${authToken}`);\n }\n\n return { headers, authToken };\n}\n\n/*\n * THE TRANSPORT RETURNS THE BODY UNCHANGED. Do not reintroduce an unwrap here.\n *\n * Xema services wrap every 2xx payload in a { data: T } envelope via the global\n * ResponseEnvelopeInterceptor (platform-common), and the generator emits types\n * that describe THAT ENVELOPE \u2014 every endpoint returns Promise<XDataEnvelope>\n * or Promise<XPaginatedEnvelope>, never a bare inner T. Consumers read the data\n * property themselves.\n *\n * This template used to peel data, justified by a comment claiming generated\n * types describe the inner T. That stopped being true when the generator moved\n * to envelope-typed returns, and the comment outlived the fact \u2014 so the peel\n * then contradicted every type in every package it seeded. Four clients shipped\n * that way (resource-governance x3, workload-runtime-api): declared\n * *DataEnvelope, returned the already-peeled inner object, so .data read\n * undefined at runtime on every non-paginated endpoint. Paginated calls hid it,\n * because the old peel deliberately preserved an envelope carrying pagination.\n *\n * Four MORE shipped it in repositories the gate could not see \u2014 license-api and\n * license-internal-api in xema-operator, plus their host-web mirrors \u2014 because\n * the gate ran in xema-base only. That is why it now runs in every repository\n * that ships a client, and why this file is generator-owned rather than seeded.\n */\n\nexport const customFetch = async <T>(\n url: string,\n options: RequestInit,\n): Promise<T> => {\n const config = getClientConfig();\n const signal = options.signal ?? undefined;\n throwIfAborted(signal);\n const base = config.baseUrlResolver\n ? await raceAbort(\n config.baseUrlResolver(signal ? { signal } : undefined),\n signal,\n )\n : config.baseUrl;\n if (base === undefined) {\n throw new Error(\n 'Client not configured: set baseUrl or baseUrlResolver via configureClient().',\n );\n }\n const fullUrl = `${base}${url}`;\n const maxRetries = config.maxRetries ?? 0;\n\n // A caller that supplied its own Authorization header owns that credential.\n // `buildHeaders` lets it win, so refreshing the CLIENT-WIDE token and\n // re-sending would replay the identical failing request with the identical\n // credential: one wasted round trip, plus a global refresh nobody asked for.\n const callerSuppliedAuth = new Headers(options.headers).has('Authorization');\n\n const built = await buildHeaders(config, options.headers, signal);\n const requestInit: RequestInit = { ...options, headers: built.headers };\n\n let delay = BASE_BACKOFF_MS;\n\n for (let attempt = 0; ; attempt++) {\n const response = await fetch(fullUrl, requestInit);\n\n if (\n response.status === 401 &&\n config.onUnauthorized &&\n !callerSuppliedAuth &&\n attempt === 0\n ) {\n await raceAbort(\n config.onUnauthorized({ rejectedToken: built.authToken }),\n signal,\n );\n const refreshed = await buildHeaders(config, options.headers, signal);\n const retryResponse = await fetch(fullUrl, {\n ...options,\n headers: refreshed.headers,\n });\n const retryBody = await parseBody(retryResponse);\n if (retryResponse.status >= 400) {\n throw new ClientError(retryResponse.status, fullUrl, retryBody);\n }\n return retryBody as T;\n }\n\n if (\n !RETRYABLE_STATUSES.includes(response.status) ||\n attempt >= maxRetries\n ) {\n const body = await parseBody(response);\n if (response.status >= 400) {\n throw new ClientError(response.status, fullUrl, body);\n }\n return body as T;\n }\n\n const retryAfter = parseRetryAfter(response.headers.get('Retry-After'));\n const waitMs = retryAfter ?? addJitter(delay);\n // Non-null: `configureClient` refuses a budget above 0 without an observer,\n // and this line is unreachable unless `maxRetries` is above 0.\n (config.onRetry as (notice: RetryNotice) => void)({\n attempt: attempt + 1,\n maxRetries,\n status: response.status,\n waitMs,\n retryAfterHonoured: retryAfter !== undefined,\n url: fullUrl,\n method: options.method ?? 'GET',\n });\n await sleep(waitMs, signal);\n delay = Math.min(delay * 2, MAX_BACKOFF_MS);\n }\n};\n\n/**\n * Does this media type carry JSON?\n *\n * \u2500\u2500 THE OUTAGE THIS FIXES \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * This used to be `contentType?.includes('application/json')`, and EVERY error\n * this fleet returns failed that test. The platform's `GlobalExceptionFilter`\n * emits RFC 9457 problem documents and sets the media type explicitly \u2014\n * `.type(PROBLEM_DETAILS_CONTENT_TYPE)` before `.json()`, so it cannot be\n * overridden \u2014 and that constant is `application/problem+json`, which does NOT\n * contain the substring `application/json`: after `application/` comes\n * `problem+json`.\n *\n * So every non-2xx body fell through to `response.text()` and reached the\n * caller as an UNPARSED STRING. `ClientError.body` is typed `unknown`, so\n * nothing complained; every consumer that reads a machine-readable code off an\n * error \u2014 `error.body.code`, `error.body.details.code` \u2014 silently read\n * `undefined` instead, for every error, in every service.\n *\n * Measured in production on 2026-09-15: skill-registry-api's\n * `resolveOrNull()` absorbs `RELEASE_CHANNEL_NOT_FOUND` into `null` by exactly\n * that read. With the code unreadable the absorb never fired, a routine \"no\n * pointer on this channel\" 404 became a 500 on `GET /skills` and\n * `GET /describe-objects`, and agent-session-api's `apply_control_bundle` step\n * aborted EVERY session launch in the organisation \u2014 7,871 failed resolutions\n * an hour. A fix written for that exact page months earlier was present in the\n * running image and could not help, because the classifier it repaired was\n * being handed a string.\n *\n * \u2500\u2500 WHY THE STRUCTURED SUFFIX, NOT A SECOND SUBSTRING \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n *\n * Adding `|| includes('application/problem+json')` would fix this one media\n * type and leave the next one \u2014 `application/vnd.api+json`, and anything else\n * a service legitimately emits. RFC 6839 defines `+json` as the structured\n * syntax suffix meaning \"this is JSON\"; that is the actual rule, so it is the\n * rule implemented. Parameters are stripped first, because\n * `application/problem+json; charset=utf-8` is the same media type.\n */\nfunction isJsonMediaType(contentType: string | null): boolean {\n if (contentType === null) {\n return false;\n }\n const essence = contentType.split(';')[0]?.trim().toLowerCase() ?? '';\n return essence === 'application/json' || essence.endsWith('+json');\n}\n\n/**\n * Does this media type carry TEXT a caller reads as a string?\n *\n * The response body is decoded by its declared media type, in three classes,\n * and each class matches what the generated function's return type says for\n * the schema such a route declares:\n *\n * - JSON (`application/json` or an RFC 6839 `+json` suffix) \u2192 parsed;\n * - TEXT (`text/*` \u2014 including `text/event-stream` \u2014 `application/javascript`,\n * `application/ecmascript`, `application/xml` or an RFC 7303 `+xml`\n * suffix) \u2192 a string, which is what a `{ type: string }` schema generates;\n * - anything else \u2014 `application/octet-stream`, `application/gzip`,\n * `application/pdf`, an Office document type, any `format: binary` body \u2014\n * \u2192 a `Blob`, which is what a `format: binary` schema generates.\n *\n * Reading every non-JSON body as text, as this transport did until 2026-10-04,\n * handed a caller typed `Blob` a string: `response.text()` decodes the bytes\n * as UTF-8, so a PDF or a gzip tarball arrived corrupted under a type that\n * promised the bytes.\n *\n * A response with NO content type is read as text, so an empty body stays the\n * empty string it always was.\n */\nfunction isTextMediaType(contentType: string): boolean {\n const essence = contentType.split(';')[0]?.trim().toLowerCase() ?? '';\n return (\n essence.startsWith('text/') ||\n essence === 'application/javascript' ||\n essence === 'application/ecmascript' ||\n essence === 'application/xml' ||\n essence.endsWith('+xml')\n );\n}\n\nasync function parseBody(response: Response): Promise<unknown> {\n // 204 FIRST, and deliberately \u2014 this ORDER is carried from `develop`, which\n // fixed the same defect independently and got this half right where `main`\n // did not. A 204 carries no body, so `response.json()` on one throws\n // SyntaxError; and a 204 whose headers STILL declare a JSON content type is\n // ordinary, because the framework sets the header before the handler returns\n // nothing. With the JSON branch first, a documented `undefined` becomes a\n // thrown parse error. Pinned by a case in `transport-problem-json.test.cjs`.\n if (response.status === 204) {\n return undefined;\n }\n const contentType = response.headers.get('content-type');\n if (isJsonMediaType(contentType)) {\n return response.json();\n }\n if (contentType === null || isTextMediaType(contentType)) {\n return response.text();\n }\n return response.blob();\n}\n\nfunction parseRetryAfter(value: string | null): number | undefined {\n if (!value) return undefined;\n const seconds = Number(value);\n if (!isNaN(seconds) && seconds >= 0) return seconds * 1000;\n const date = new Date(value);\n if (!isNaN(date.getTime())) return Math.max(0, date.getTime() - Date.now());\n return undefined;\n}\n\nfunction addJitter(delay: number): number {\n return delay + (Math.random() * 2 - 1) * delay * 0.25;\n}\n\n/** A retry backoff; the caller's signal ends it at once and is never retried. */\nfunction sleep(ms: number, signal: AbortSignal | undefined): Promise<void> {\n if (!signal) {\n return new Promise((resolve) => setTimeout(resolve, ms));\n }\n if (signal.aborted) {\n return Promise.reject(abortedReason(signal));\n }\n return new Promise((resolve, reject) => {\n const onAbort = (): void => {\n clearTimeout(timer);\n reject(abortedReason(signal));\n };\n const timer = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal.addEventListener('abort', onAbort, { once: true });\n });\n}\n\nexport default customFetch;\n";
|
|
2
2
|
//# sourceMappingURL=custom-fetch-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fetch-template.d.ts","sourceRoot":"","sources":["../../src/lib/custom-fetch-template.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,sBAAsB,
|
|
1
|
+
{"version":3,"file":"custom-fetch-template.d.ts","sourceRoot":"","sources":["../../src/lib/custom-fetch-template.ts"],"names":[],"mappings":"AAoBA,eAAO,MAAM,sBAAsB,4oiCAgvBlC,CAAC"}
|
|
@@ -62,6 +62,17 @@ export interface ClientCallbackOptions {
|
|
|
62
62
|
signal?: AbortSignal;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
+
/** What {@link ClientConfig.onUnauthorized} is told about the 401 it answers. */
|
|
66
|
+
export interface UnauthorizedContext {
|
|
67
|
+
/**
|
|
68
|
+
* The token \`getAuthToken\` returned for the attempt the server rejected.
|
|
69
|
+
* \`undefined\` when no \`getAuthToken\` produced the Authorization header
|
|
70
|
+
* (a header from \`getHeaders\` or no credential at all): there is then no
|
|
71
|
+
* client-held token to drop.
|
|
72
|
+
*/
|
|
73
|
+
readonly rejectedToken: string | undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
65
76
|
export interface ClientConfig {
|
|
66
77
|
/**
|
|
67
78
|
* Static base URL (e.g. 'http://localhost:3140') — no trailing slash.
|
|
@@ -113,8 +124,12 @@ export interface ClientConfig {
|
|
|
113
124
|
* Optional callback invoked on a 401 before ONE re-attempt. Supplying it is
|
|
114
125
|
* what opts this client into that re-attempt; without it a 401 comes back to
|
|
115
126
|
* the caller as a \`ClientError\` like any other 4xx.
|
|
127
|
+
*
|
|
128
|
+
* It is told WHAT was rejected (see {@link UnauthorizedContext}), so a
|
|
129
|
+
* callback that drops a cached credential can drop exactly that one and leave
|
|
130
|
+
* a newer one, minted by a concurrent request, alone.
|
|
116
131
|
*/
|
|
117
|
-
onUnauthorized?: () => Promise<void>;
|
|
132
|
+
onUnauthorized?: (context: UnauthorizedContext) => Promise<void>;
|
|
118
133
|
/**
|
|
119
134
|
* Re-attempts for a retryable status. **Defaults to 0 — no retry.**
|
|
120
135
|
*
|
|
@@ -438,11 +453,17 @@ function raceAbort<V>(
|
|
|
438
453
|
});
|
|
439
454
|
}
|
|
440
455
|
|
|
456
|
+
interface BuiltHeaders {
|
|
457
|
+
readonly headers: Headers;
|
|
458
|
+
/** The token \`getAuthToken\` produced for these headers, if it did. */
|
|
459
|
+
readonly authToken: string | undefined;
|
|
460
|
+
}
|
|
461
|
+
|
|
441
462
|
async function buildHeaders(
|
|
442
463
|
config: ClientConfig,
|
|
443
464
|
callerHeaders: RequestInit['headers'],
|
|
444
465
|
signal: AbortSignal | undefined,
|
|
445
|
-
): Promise<
|
|
466
|
+
): Promise<BuiltHeaders> {
|
|
446
467
|
const headers = new Headers(callerHeaders);
|
|
447
468
|
|
|
448
469
|
// Global headers from config (caller-provided headers take precedence)
|
|
@@ -474,15 +495,16 @@ async function buildHeaders(
|
|
|
474
495
|
}
|
|
475
496
|
|
|
476
497
|
// Auth token (caller or global headers take precedence)
|
|
498
|
+
let authToken: string | undefined;
|
|
477
499
|
if (config.getAuthToken && !headers.has('Authorization')) {
|
|
478
|
-
|
|
500
|
+
authToken = await raceAbort(
|
|
479
501
|
config.getAuthToken(signal ? { signal } : undefined),
|
|
480
502
|
signal,
|
|
481
503
|
);
|
|
482
|
-
headers.set('Authorization', \`Bearer \${
|
|
504
|
+
headers.set('Authorization', \`Bearer \${authToken}\`);
|
|
483
505
|
}
|
|
484
506
|
|
|
485
|
-
return headers;
|
|
507
|
+
return { headers, authToken };
|
|
486
508
|
}
|
|
487
509
|
|
|
488
510
|
/*
|
|
@@ -536,8 +558,8 @@ export const customFetch = async <T>(
|
|
|
536
558
|
// credential: one wasted round trip, plus a global refresh nobody asked for.
|
|
537
559
|
const callerSuppliedAuth = new Headers(options.headers).has('Authorization');
|
|
538
560
|
|
|
539
|
-
const
|
|
540
|
-
const requestInit: RequestInit = { ...options, headers };
|
|
561
|
+
const built = await buildHeaders(config, options.headers, signal);
|
|
562
|
+
const requestInit: RequestInit = { ...options, headers: built.headers };
|
|
541
563
|
|
|
542
564
|
let delay = BASE_BACKOFF_MS;
|
|
543
565
|
|
|
@@ -550,15 +572,14 @@ export const customFetch = async <T>(
|
|
|
550
572
|
!callerSuppliedAuth &&
|
|
551
573
|
attempt === 0
|
|
552
574
|
) {
|
|
553
|
-
await raceAbort(
|
|
554
|
-
|
|
555
|
-
config,
|
|
556
|
-
options.headers,
|
|
575
|
+
await raceAbort(
|
|
576
|
+
config.onUnauthorized({ rejectedToken: built.authToken }),
|
|
557
577
|
signal,
|
|
558
578
|
);
|
|
579
|
+
const refreshed = await buildHeaders(config, options.headers, signal);
|
|
559
580
|
const retryResponse = await fetch(fullUrl, {
|
|
560
581
|
...options,
|
|
561
|
-
headers:
|
|
582
|
+
headers: refreshed.headers,
|
|
562
583
|
});
|
|
563
584
|
const retryBody = await parseBody(retryResponse);
|
|
564
585
|
if (retryResponse.status >= 400) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-fetch-template.js","sourceRoot":"","sources":["../../src/lib/custom-fetch-template.ts"],"names":[],"mappings":";;;AAoBa,QAAA,sBAAsB,GAAG
|
|
1
|
+
{"version":3,"file":"custom-fetch-template.js","sourceRoot":"","sources":["../../src/lib/custom-fetch-template.ts"],"names":[],"mappings":";;;AAoBa,QAAA,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgvBrC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-clients.d.ts","sourceRoot":"","sources":["../../src/lib/generate-clients.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAYxE,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AA2M1B,MAAM,WAAW,sBAAsB;IAQrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAE3C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAgGD,wBAAsB,yBAAyB,CAC7C,UAAU,GAAE,MAAsB,EAClC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,UAAU,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"generate-clients.d.ts","sourceRoot":"","sources":["../../src/lib/generate-clients.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAYxE,OAAO,EAQL,KAAK,SAAS,EACf,MAAM,kBAAkB,CAAC;AA2M1B,MAAM,WAAW,sBAAsB;IAQrC,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;IAE3C,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC/C;AAgGD,wBAAsB,yBAAyB,CAC7C,UAAU,GAAE,MAAsB,EAClC,OAAO,GAAE,sBAA2B,GACnC,OAAO,CAAC,UAAU,EAAE,CAAC,CA6MvB;AAmBD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG;IACjF,QAAQ,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C,CA8BA;AAGD,wBAAgB,oBAAoB,IAAI,IAAI,CAe3C"}
|
|
@@ -127,16 +127,20 @@ function resolveSurfaceBumpClass(args) {
|
|
|
127
127
|
async function generateClientsForService(serviceDir = process.cwd(), options = {}) {
|
|
128
128
|
const baseCtx = (0, service_config_1.resolveServiceContext)(serviceDir);
|
|
129
129
|
const ownership = await (0, client_repository_1.resolveClientOwnership)(baseCtx.repoRoot);
|
|
130
|
+
const license = ownership.license ?? (0, client_package_1.resolveGeneratedClientLicense)(baseCtx.repoRoot);
|
|
130
131
|
const ctx = {
|
|
131
132
|
...baseCtx,
|
|
132
133
|
...(Object.keys(ownership).length === 0 ? {} : { ownership }),
|
|
134
|
+
firstPartyRepository: ownership.license === undefined,
|
|
133
135
|
};
|
|
134
136
|
const generate = await resolveOrvalGenerate(ctx.serviceDir);
|
|
135
137
|
const repositoryUrl = await (0, client_repository_1.resolveClientRepositoryUrl)(ctx.repoRoot);
|
|
136
|
-
const license = ownership.license ?? (0, client_package_1.resolveGeneratedClientLicense)(ctx.repoRoot);
|
|
137
138
|
const copyrightHolder = (0, client_readme_1.requireClientCopyrightHolder)(ownership, ctx.repoRoot);
|
|
138
139
|
const surfacesWithSpec = xema_decorators_1.ALL_SURFACES.filter((s) => (0, node_fs_1.existsSync)((0, service_config_1.surfaceSpecPath)(ctx, s)));
|
|
139
140
|
assertNoOrphanedSurfaceClients(ctx, surfacesWithSpec);
|
|
141
|
+
for (const surface of surfacesWithSpec) {
|
|
142
|
+
(0, service_config_1.surfaceClientPackageName)(ctx, surface);
|
|
143
|
+
}
|
|
140
144
|
const existingClientVersions = (0, client_version_1.readExistingClientVersions)(ctx);
|
|
141
145
|
const baseline = (0, client_version_1.resolveClientVersionBaseline)(existingClientVersions.map((c) => c.version), ctx.version);
|
|
142
146
|
const generated = [];
|
|
@@ -154,11 +158,12 @@ async function generateClientsForService(serviceDir = process.cwd(), options = {
|
|
|
154
158
|
snapshots.push((0, generated_output_snapshot_1.snapshotGeneratedOutput)(clientDir));
|
|
155
159
|
(0, client_readme_1.ensureClientReadme)({
|
|
156
160
|
clientDir,
|
|
157
|
-
packageName: (0, service_config_1.surfaceClientPackageName)(ctx
|
|
161
|
+
packageName: (0, service_config_1.surfaceClientPackageName)(ctx, surface),
|
|
158
162
|
serviceTitle: ctx.api.title,
|
|
159
163
|
surface,
|
|
160
164
|
license,
|
|
161
165
|
copyrightHolder,
|
|
166
|
+
workspaceOnly: (0, client_version_1.readClientPrivate)(clientDir),
|
|
162
167
|
});
|
|
163
168
|
(0, node_fs_1.rmSync)((0, node_path_1.join)(clientSrc, 'endpoints'), { recursive: true, force: true });
|
|
164
169
|
(0, node_fs_1.rmSync)((0, node_path_1.join)(clientSrc, 'models'), { recursive: true, force: true });
|
|
@@ -175,17 +180,21 @@ async function generateClientsForService(serviceDir = process.cwd(), options = {
|
|
|
175
180
|
});
|
|
176
181
|
generated.push(surface);
|
|
177
182
|
}
|
|
183
|
+
const classified = generated.filter((surface) => !(0, client_version_1.readClientPrivate)(clientDirs.get(surface)));
|
|
178
184
|
let bumpClass;
|
|
179
185
|
try {
|
|
180
|
-
bumpClass =
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
bumpClass =
|
|
187
|
+
classified.length === 0
|
|
188
|
+
? 'none'
|
|
189
|
+
: resolveSurfaceBumpClass({
|
|
190
|
+
serviceId: ctx.api.serviceId,
|
|
191
|
+
surfaces: classified,
|
|
192
|
+
surfacesBefore,
|
|
193
|
+
surfacesAfter,
|
|
194
|
+
contentChanged,
|
|
195
|
+
explicit: options.bumpClass,
|
|
196
|
+
explicitOrigin: options.bumpClassOrigin,
|
|
197
|
+
});
|
|
189
198
|
}
|
|
190
199
|
catch (error) {
|
|
191
200
|
for (const snapshot of snapshots) {
|
|
@@ -199,13 +208,13 @@ async function generateClientsForService(serviceDir = process.cwd(), options = {
|
|
|
199
208
|
}
|
|
200
209
|
}
|
|
201
210
|
const hadExistingClients = existingClientVersions.length > 0;
|
|
202
|
-
const changesets = contentChanged && hadExistingClients
|
|
211
|
+
const changesets = contentChanged && hadExistingClients && classified.length > 0
|
|
203
212
|
? (0, client_changeset_1.applyClientChangesets)({
|
|
204
213
|
repoRoot: ctx.repoRoot,
|
|
205
214
|
serviceId: ctx.api.serviceId,
|
|
206
215
|
bumpClass,
|
|
207
216
|
packages: generated.map((surface) => ({
|
|
208
|
-
name: (0, service_config_1.surfaceClientPackageName)(ctx
|
|
217
|
+
name: (0, service_config_1.surfaceClientPackageName)(ctx, surface),
|
|
209
218
|
version: (0, client_version_1.readClientVersion)(clientDirs.get(surface)),
|
|
210
219
|
private: (0, client_version_1.readClientPrivate)(clientDirs.get(surface)),
|
|
211
220
|
})),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-clients.js","sourceRoot":"","sources":["../../src/lib/generate-clients.ts"],"names":[],"mappings":";;AAgVA,8DA4LC;AAmBD,4CAiCC;AAGD,oDAeC;AAllBD,2DAAkD;AAClD,qCAA6C;AAC7C,yCAAiC;AACjC,uCAAyC;AAEzC,6DAAwE;AAExE,yDAA2D;AAC3D,qDAAsF;AACtF,mDAAmF;AACnF,2DAAyF;AACzF,qDAK0B;AAC1B,qDAS0B;AAC1B,2EAKqC;AACrC,2DAAwD;AACxD,qDAM0B;AAQ1B,KAAK,UAAU,iBAAiB,CAC9B,UA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;SAC9C,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SAC3B,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QACtB,OAAO,CAAC,KAAK,CAAC,2CAA2C,EAAE,GAAG,CAAC,CAAC;QAChE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -12,11 +12,13 @@ export interface ResolvedServiceContext {
|
|
|
12
12
|
readonly api: XemaApiConfig;
|
|
13
13
|
readonly version: string;
|
|
14
14
|
readonly ownership?: ClientOwnershipDeclaration;
|
|
15
|
+
readonly firstPartyRepository?: boolean;
|
|
15
16
|
}
|
|
17
|
+
export declare const FIRST_PARTY_CLIENT_SCOPE = "@xemahq";
|
|
16
18
|
export declare function findRepoRoot(start: string): string;
|
|
17
19
|
export declare function resolveServiceContext(serviceDir: string): ResolvedServiceContext;
|
|
18
20
|
export declare function surfaceClientShortName(serviceId: string, surface: ApiSurface): string;
|
|
19
|
-
export declare function surfaceClientPackageName(
|
|
21
|
+
export declare function surfaceClientPackageName(ctx: ResolvedServiceContext, surface: ApiSurface): string;
|
|
20
22
|
export declare function surfaceClientDir(ctx: ResolvedServiceContext, surface: ApiSurface): string;
|
|
21
23
|
export declare function surfaceSpecPath(ctx: ResolvedServiceContext, surface: ApiSurface, outDir?: string): string;
|
|
22
24
|
//# sourceMappingURL=service-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-config.d.ts","sourceRoot":"","sources":["../../src/lib/service-config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAetE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAA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MAAM,GAAG,sBAAsB,CA0DhF;AAeD,wBAAgB,sBAAsB,CACpC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,UAAU,GAClB,MAAM,CAUR;AAgBD,wBAAgB,wBAAwB,CACtC,GAAG,EAAE,sBAAsB,EAC3B,OAAO,EAAE,UAAU,GAClB,MAAM,CAwBR;AAGD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,sBAAsB,EAC3B,OAAO,EAAE,UAAU,GAClB,MAAM,CAMR;AAGD,wBAAgB,eAAe,CAC7B,GAAG,EAAE,sBAAsB,EAC3B,OAAO,EAAE,UAAU,EAWnB,MAAM,CAAC,EAAE,MAAM,GACd,MAAM,CAER"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FIRST_PARTY_CLIENT_SCOPE = void 0;
|
|
3
4
|
exports.findRepoRoot = findRepoRoot;
|
|
4
5
|
exports.resolveServiceContext = resolveServiceContext;
|
|
5
6
|
exports.surfaceClientShortName = surfaceClientShortName;
|
|
@@ -9,6 +10,7 @@ exports.surfaceSpecPath = surfaceSpecPath;
|
|
|
9
10
|
const node_fs_1 = require("node:fs");
|
|
10
11
|
const node_path_1 = require("node:path");
|
|
11
12
|
const xema_decorators_1 = require("@xemahq/xema-decorators");
|
|
13
|
+
exports.FIRST_PARTY_CLIENT_SCOPE = '@xemahq';
|
|
12
14
|
function findRepoRoot(start) {
|
|
13
15
|
let dir = (0, node_path_1.resolve)(start);
|
|
14
16
|
while (dir !== (0, node_path_1.dirname)(dir)) {
|
|
@@ -70,8 +72,28 @@ function surfaceClientShortName(serviceId, surface) {
|
|
|
70
72
|
}
|
|
71
73
|
return `${serviceId}-${segment}-client`;
|
|
72
74
|
}
|
|
73
|
-
function surfaceClientPackageName(
|
|
74
|
-
|
|
75
|
+
function surfaceClientPackageName(ctx, surface) {
|
|
76
|
+
const short = surfaceClientShortName(ctx.api.serviceId, surface);
|
|
77
|
+
const declaredScope = ctx.ownership?.packageScope;
|
|
78
|
+
if (declaredScope !== undefined) {
|
|
79
|
+
return declaredScope === '' ? short : `${declaredScope}/${short}`;
|
|
80
|
+
}
|
|
81
|
+
const pkgPath = (0, node_path_1.join)(surfaceClientDir(ctx, surface), 'package.json');
|
|
82
|
+
if ((0, node_fs_1.existsSync)(pkgPath)) {
|
|
83
|
+
const name = JSON.parse((0, node_fs_1.readFileSync)(pkgPath, 'utf8'))
|
|
84
|
+
.name;
|
|
85
|
+
if (typeof name === 'string' && name.trim() !== '') {
|
|
86
|
+
return name;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (ctx.firstPartyRepository === true) {
|
|
90
|
+
return `${exports.FIRST_PARTY_CLIENT_SCOPE}/${short}`;
|
|
91
|
+
}
|
|
92
|
+
throw new Error(`api-client-generator: ${ctx.repoRoot} does not say what its ${ctx.api.serviceId} ` +
|
|
93
|
+
`${surface} client package is called. Declare \`client.packageScope\` in ` +
|
|
94
|
+
`tooling/ci/release.config.mjs (an npm scope such as "@acme", or "" for ` +
|
|
95
|
+
`unscoped names) or give the client package an existing \`name\`. ` +
|
|
96
|
+
`There is no \`@xemahq\` default outside a first-party repository.`);
|
|
75
97
|
}
|
|
76
98
|
function surfaceClientDir(ctx, surface) {
|
|
77
99
|
const dirName = surfaceClientShortName(ctx.api.serviceId, surface).replace(/-client$/, '');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-config.js","sourceRoot":"","sources":["../../src/lib/service-config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"service-config.js","sourceRoot":"","sources":["../../src/lib/service-config.ts"],"names":[],"mappings":";;;AAgEA,oCAYC;AAOD,sDA0DC;AAeD,wDAaC;AAgBD,4DA2BC;AAGD,4CASC;AAGD,0CAgBC;AAnPD,qCAAmD;AACnD,yCAAmD;AAEnD,6DAAqD;AA0DxC,QAAA,wBAAwB,GAAG,SAAS,CAAC;AAG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C,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,EAAE,WAAW,KAAK,SAAS,CAAC;QAC3D,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IACpD,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,gBAAgB,GACpB,OAAO,QAAQ,CAAC,IAAI,EAAE,WAAW,KAAK,QAAQ;QAC5C,CAAC,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,WAAW,MAAM;QACpC,CAAC,CAAC,SAAS,CAAC;IAChB,MAAM,KAAK,GACT,OAAO,SAAS,CAAC,QAAQ,EAAE,WAAW,KAAK,QAAQ;QACjD,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW;QAChC,CAAC,CAAC,gBAAgB,CAAC;IACvB,MAAM,WAAW,GACf,OAAO,SAAS,CAAC,QAAQ,EAAE,WAAW,KAAK,QAAQ;QACjD,CAAC,CAAC,SAAS,CAAC,QAAQ,CAAC,WAAW;QAChC,CAAC,CAAC,SAAS,CAAC;IAIhB,OAAO;QACL,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC;QACzC,GAAG,CAAC,WAAW,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC;KACtD,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xemahq/api-client-generator",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.0",
|
|
4
4
|
"description": "Layer 1 — the single, central OpenAPI + ORVAL client generator for every Xema NestJS service. Replaces the per-service orval.config.ts / scripts/extract-openapi.ts / scripts/build-client-index.js trio with two bins (xema-openapi, xema-client-generate). Extracts one OpenAPI document per ApiSurface (public/internal/operator) using the @XemaApiSurface decorator metadata, generates one ORVAL client package per non-empty surface (every surface of a service landing on ONE derived version — the highest its clients already carry, advanced a patch when the generated output changes), and stamps deterministic `xema` provenance metadata into each generated client package.json. No heuristics: a route ships in a surface only if it (or its controller) is explicitly classified, and no client version is ever typed by hand.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"xema",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"prettier": "3.6.2",
|
|
63
63
|
"reflect-metadata": "0.2.2",
|
|
64
64
|
"typescript": "5.9.3",
|
|
65
|
-
"@xemahq/
|
|
66
|
-
"@xemahq/
|
|
65
|
+
"@xemahq/eslint-config": "0.14.0",
|
|
66
|
+
"@xemahq/xema-decorators": "1.0.0"
|
|
67
67
|
},
|
|
68
68
|
"exports": {
|
|
69
69
|
".": {
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
82
82
|
},
|
|
83
83
|
"xemaRelease": {
|
|
84
|
-
"sourceDigest": "sha256:
|
|
84
|
+
"sourceDigest": "sha256:94a7bad88a2523dc216b1afb6f9a1e4f3a3b36fff3e9bf2870c89f2860a51d41"
|
|
85
85
|
}
|
|
86
86
|
}
|