@webpieces/api-doc-model 0.4.863 → 0.4.865
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/package.json +2 -2
- package/src/extract/ApiDocExtractor.d.ts +3 -2
- package/src/extract/ApiDocExtractor.js +54 -32
- package/src/extract/ApiDocExtractor.js.map +1 -1
- package/src/index.d.ts +1 -1
- package/src/index.js +2 -1
- package/src/index.js.map +1 -1
- package/src/model/ApiDocModel.d.ts +16 -29
- package/src/model/ApiDocModel.js +23 -23
- package/src/model/ApiDocModel.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/api-doc-model",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.865",
|
|
4
4
|
"description": "TypeScript-compiler-API extractor producing one in-memory ApiDocModel from a webpieces API contract. No renderer, no runtime, no app-specific import.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"access": "public"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@webpieces/core-util": "0.4.
|
|
26
|
+
"@webpieces/core-util": "0.4.865",
|
|
27
27
|
"typescript": "5.9.3"
|
|
28
28
|
}
|
|
29
29
|
}
|
|
@@ -100,10 +100,11 @@ export declare class ApiDocExtractor {
|
|
|
100
100
|
private requestOf;
|
|
101
101
|
/** The declared return type, unwrapped from `Promise<...>` by the resolver. */
|
|
102
102
|
private responseOf;
|
|
103
|
-
/**
|
|
103
|
+
/** Read OR alternatives structurally rather than preserving an opaque WpAuth array. */
|
|
104
104
|
private static authOf;
|
|
105
|
+
static canonicalCallName(expression: ts.Expression): string | undefined;
|
|
105
106
|
/**
|
|
106
|
-
*
|
|
107
|
+
* `apiKey(regime, [{in: 'header', name: 'x-api-key', description: '…'}, …])`, parsed.
|
|
107
108
|
*
|
|
108
109
|
* A malformed declaration FAILS rather than yielding a half-parsed regime: the credentials are
|
|
109
110
|
* what a published document's security block is made of, and a document that silently omitted
|
|
@@ -43,25 +43,14 @@ const ENDPOINT = core_util_1.Endpoint.name;
|
|
|
43
43
|
const MASK_LOG = core_util_1.MaskLog.name;
|
|
44
44
|
const MCP_TOOL = core_util_1.WpMcpTool.name;
|
|
45
45
|
const MCP_INVALID = core_util_1.InvalidEndpointForMcp.name;
|
|
46
|
-
const
|
|
47
|
-
const API_KEY_AUTH = core_util_1.
|
|
46
|
+
const AUTHORIZATION = core_util_1.WpAuthorization.name;
|
|
47
|
+
const API_KEY_AUTH = core_util_1.apiKey.name;
|
|
48
48
|
const API_TYPE = core_util_1.ApiType.name;
|
|
49
49
|
/**
|
|
50
50
|
* The prefix shared by every credential decorator. A PREFIX genuinely has no symbol to take a name
|
|
51
51
|
* from, so it stays a literal — but the set it selects is pinned below, which is what stops it
|
|
52
52
|
* quietly matching nothing.
|
|
53
53
|
*/
|
|
54
|
-
const AUTH_PREFIX = 'WpAuth';
|
|
55
|
-
/** Every credential decorator, by real symbol, so a rename of any of them fails to compile here. */
|
|
56
|
-
const AUTH_DECORATORS = new Set([
|
|
57
|
-
core_util_1.WpAuthPublic.name,
|
|
58
|
-
core_util_1.WpAuthJwt.name,
|
|
59
|
-
core_util_1.WpAuthOidc.name,
|
|
60
|
-
core_util_1.WpAuthSharedSecret.name,
|
|
61
|
-
core_util_1.WpAuthWebhook.name,
|
|
62
|
-
core_util_1.WpAuthApiKey.name,
|
|
63
|
-
core_util_1.WpAuthLocalOnly.name,
|
|
64
|
-
]);
|
|
65
54
|
/** The REAL trigger kinds and side-effect contracts, so a contract cannot declare one that is not. */
|
|
66
55
|
const ENDPOINT_KINDS = [core_util_1.RPC, core_util_1.CLOUDTASKS, core_util_1.CRON, core_util_1.EXTERNAL];
|
|
67
56
|
const ENDPOINT_OPERATIONS = [core_util_1.READ, core_util_1.WRITE_IDEMPOTENT, core_util_1.WRITE];
|
|
@@ -152,6 +141,8 @@ class ApiDocExtractor {
|
|
|
152
141
|
}
|
|
153
142
|
/** {@link extractAll} against a program the caller already built. */
|
|
154
143
|
extractAllFrom(program, source) {
|
|
144
|
+
// Binding establishes AST parent links used by canonical import resolution.
|
|
145
|
+
program.getTypeChecker();
|
|
155
146
|
const models = [];
|
|
156
147
|
for (const statement of source.statements) {
|
|
157
148
|
if (ts.isClassDeclaration(statement) &&
|
|
@@ -163,6 +154,7 @@ class ApiDocExtractor {
|
|
|
163
154
|
}
|
|
164
155
|
/** The same extraction against a program the caller already built. */
|
|
165
156
|
extract(program, source) {
|
|
157
|
+
program.getTypeChecker();
|
|
166
158
|
return this.extractContract(program, this.findContract(source));
|
|
167
159
|
}
|
|
168
160
|
/** ONE contract class -> ONE model. The single place the walk actually happens. */
|
|
@@ -260,7 +252,7 @@ class ApiDocExtractor {
|
|
|
260
252
|
const doc = JsDoc_1.JsDoc.read(member);
|
|
261
253
|
const mcpTool = ApiDocExtractor.mcpToolOf(member, folder);
|
|
262
254
|
const streaming = new StreamingSignature_1.StreamingSignature().read(member, folder, resolver);
|
|
263
|
-
return new ApiDocModel_1.DocumentedEndpoint(methodName, httpMethod, path, operation, kind, ApiDocExtractor.booleanProperty(literal, 'hidden'), ApiDocExtractor.booleanProperty(literal, 'openWorld'), new ApiDocModel_1.DocumentedEndpointOptions(ApiDocExtractor.booleanProperty(literal, 'formPost'), ApiDocExtractor.stringProperty(literal, 'calledBy', folder), ApiDocExtractor.stringProperty(literal, 'callerKind', folder)), ApiDocExtractor.authOf(member, folder), mcpTool, ApiDocExtractor.invalidForMcpOf(member, folder), ApiDocExtractor.decoratorCall(member,
|
|
255
|
+
return new ApiDocModel_1.DocumentedEndpoint(methodName, httpMethod, path, operation, kind, ApiDocExtractor.booleanProperty(literal, 'hidden'), ApiDocExtractor.booleanProperty(literal, 'openWorld'), new ApiDocModel_1.DocumentedEndpointOptions(ApiDocExtractor.booleanProperty(literal, 'formPost'), ApiDocExtractor.stringProperty(literal, 'calledBy', folder), ApiDocExtractor.stringProperty(literal, 'callerKind', folder)), ApiDocExtractor.authOf(member, folder), mcpTool, ApiDocExtractor.invalidForMcpOf(member, folder), ApiDocExtractor.decoratorCall(member, AUTHORIZATION)?.arguments[0]?.getText(), ApiDocExtractor.maskLogOf(member), doc.description, doc.mcp, this.requestOf(member, methodName, resolver), streaming?.initialResponse ?? this.responseOf(member, methodName, resolver), streaming, ApiDocExtractor.decoratorCall(member, core_util_1.WpLocalOnly.name) !== undefined);
|
|
264
256
|
}
|
|
265
257
|
/**
|
|
266
258
|
* One REQUIRED positional argument of `@Endpoint`, folded to the string it denotes.
|
|
@@ -319,24 +311,55 @@ class ApiDocExtractor {
|
|
|
319
311
|
}
|
|
320
312
|
return resolver.resolve(member.type, `${methodName}.response`);
|
|
321
313
|
}
|
|
322
|
-
/**
|
|
323
|
-
// webpieces-disable no-function-outside-class -- private static reader
|
|
314
|
+
/** Read OR alternatives structurally rather than preserving an opaque WpAuth array. */
|
|
315
|
+
// webpieces-disable no-function-outside-class -- private static declaration reader
|
|
324
316
|
static authOf(member, folder) {
|
|
325
|
-
const
|
|
326
|
-
|
|
327
|
-
const
|
|
328
|
-
if (!
|
|
317
|
+
const publicCall = this.decoratorCall(member, core_util_1.WpAuthPublic.name);
|
|
318
|
+
if (publicCall) {
|
|
319
|
+
const reason = publicCall.arguments[0];
|
|
320
|
+
if (!reason)
|
|
321
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('Public authentication requires a reason', SourceLocation_1.SourceLocation.of(publicCall), "Declare @WpAuthPublic('reason').");
|
|
322
|
+
return new ApiDocModel_1.DocumentedAuth(folder.foldString(reason, 'public auth reason'), []);
|
|
323
|
+
}
|
|
324
|
+
const protectedCall = this.decoratorCall(member, core_util_1.WpAuth.name);
|
|
325
|
+
if (!protectedCall)
|
|
326
|
+
return undefined;
|
|
327
|
+
const array = protectedCall.arguments[0];
|
|
328
|
+
if (!array || !ts.isArrayLiteralExpression(array) || !array.elements.length)
|
|
329
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('WpAuth requires a nonempty descriptor array', SourceLocation_1.SourceLocation.of(protectedCall), 'Use @WpAuth([jwt(), oidc(...)]).');
|
|
330
|
+
const methods = [];
|
|
331
|
+
for (const element of array.elements) {
|
|
332
|
+
if (!ts.isCallExpression(element))
|
|
333
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('Auth method is not a descriptor call', SourceLocation_1.SourceLocation.of(element), 'Use canonical credential descriptors.');
|
|
334
|
+
const name = this.canonicalCallName(element.expression);
|
|
335
|
+
const kind = new Map([['jwt', 'jwt'], ['oidc', 'oidc'], ['sharedSecret', 'shared-secret'], ['webhook', 'webhook'], ['apiKey', 'apikey']]).get(name ?? '');
|
|
336
|
+
if (!kind)
|
|
337
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('Unknown authentication descriptor', SourceLocation_1.SourceLocation.of(element), 'Import jwt/oidc/sharedSecret/webhook/apiKey from core-util.');
|
|
338
|
+
methods.push(new ApiDocModel_1.DocumentedAuthMethod(kind, element.arguments.map((argument) => argument.getText()), name === API_KEY_AUTH ? this.apiKeyOf(element, folder) : undefined));
|
|
339
|
+
}
|
|
340
|
+
return new ApiDocModel_1.DocumentedAuth(undefined, methods);
|
|
341
|
+
}
|
|
342
|
+
// webpieces-disable no-function-outside-class -- canonical import-aware AST name resolution
|
|
343
|
+
static canonicalCallName(expression) {
|
|
344
|
+
for (const statement of expression.getSourceFile().statements) {
|
|
345
|
+
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier))
|
|
329
346
|
continue;
|
|
347
|
+
const module = statement.moduleSpecifier.text;
|
|
348
|
+
if (!['@webpieces/core-util', '@webpieces/http-routing', '@webpieces/http-client-browser'].includes(module) && !module.endsWith('/core-util/src/http/decorators') && !module.endsWith('/core-util/src/http/auth-mode') && !module.endsWith('/core-util/src/http/authorization'))
|
|
349
|
+
continue;
|
|
350
|
+
const bindings = statement.importClause?.namedBindings;
|
|
351
|
+
if (bindings && ts.isNamedImports(bindings) && ts.isIdentifier(expression)) {
|
|
352
|
+
const imported = bindings.elements.find((entry) => entry.name.text === expression.text);
|
|
353
|
+
if (imported)
|
|
354
|
+
return imported.propertyName?.text ?? imported.name.text;
|
|
330
355
|
}
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
return new ApiDocModel_1.DocumentedAuth(name, call.arguments.map((argument) => argument.getText()), name === API_KEY_AUTH ? ApiDocExtractor.apiKeyOf(call, folder) : undefined);
|
|
334
|
-
}
|
|
356
|
+
if (bindings && ts.isNamespaceImport(bindings) && ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.expression) && expression.expression.text === bindings.name.text)
|
|
357
|
+
return expression.name.text;
|
|
335
358
|
}
|
|
336
359
|
return undefined;
|
|
337
360
|
}
|
|
338
361
|
/**
|
|
339
|
-
*
|
|
362
|
+
* `apiKey(regime, [{in: 'header', name: 'x-api-key', description: '…'}, …])`, parsed.
|
|
340
363
|
*
|
|
341
364
|
* A malformed declaration FAILS rather than yielding a half-parsed regime: the credentials are
|
|
342
365
|
* what a published document's security block is made of, and a document that silently omitted
|
|
@@ -347,14 +370,14 @@ class ApiDocExtractor {
|
|
|
347
370
|
const regimeArgument = call.arguments[0];
|
|
348
371
|
const credentialsArgument = call.arguments[1];
|
|
349
372
|
if (regimeArgument === undefined || credentialsArgument === undefined) {
|
|
350
|
-
throw new ApiDocExtractionError_1.ApiDocExtractionError('
|
|
373
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('apiKey(...) needs a regime AND its credentials', SourceLocation_1.SourceLocation.of(call), "Write both: apiKey('partner', [{ in: 'header', name: 'x-api-key' }]).");
|
|
351
374
|
}
|
|
352
|
-
const regime = folder.foldString(regimeArgument, '
|
|
375
|
+
const regime = folder.foldString(regimeArgument, 'apiKey(...) regime');
|
|
353
376
|
// FOLLOW a name first: a credential list shared by every method of a contract is written
|
|
354
377
|
// once as a `const` and named per method, which is better source than a copy per method.
|
|
355
378
|
const credentialsLiteral = folder.follow(credentialsArgument);
|
|
356
379
|
if (!ts.isArrayLiteralExpression(credentialsLiteral)) {
|
|
357
|
-
throw new ApiDocExtractionError_1.ApiDocExtractionError('
|
|
380
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('apiKey(...) credentials is not an array literal', SourceLocation_1.SourceLocation.of(credentialsArgument), 'Write the credentials as an array literal, inline or in a `const`; a value ' +
|
|
358
381
|
'assembled at runtime cannot appear in a published security scheme.');
|
|
359
382
|
}
|
|
360
383
|
const credentials = [];
|
|
@@ -368,11 +391,11 @@ class ApiDocExtractor {
|
|
|
368
391
|
static credentialOf(expression, folder) {
|
|
369
392
|
const element = folder.follow(expression);
|
|
370
393
|
if (!ts.isObjectLiteralExpression(element)) {
|
|
371
|
-
throw new ApiDocExtractionError_1.ApiDocExtractionError('an
|
|
394
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('an apiKey(...) credential is not an object literal', SourceLocation_1.SourceLocation.of(element), "Write it inline: { in: 'header', name: 'x-api-key' }.");
|
|
372
395
|
}
|
|
373
396
|
const location = ApiDocExtractor.stringProperty(element, 'in', folder);
|
|
374
397
|
if (location === undefined) {
|
|
375
|
-
throw new ApiDocExtractionError_1.ApiDocExtractionError('an
|
|
398
|
+
throw new ApiDocExtractionError_1.ApiDocExtractionError('an apiKey(...) credential declares no `in`', SourceLocation_1.SourceLocation.of(element), "Say where it rides: `in: 'header'` with a name, or `in: 'bearer'`.");
|
|
376
399
|
}
|
|
377
400
|
return new ApiDocModel_1.DocumentedApiKeyCredential(location, ApiDocExtractor.stringProperty(element, 'name', folder), ApiDocExtractor.stringProperty(element, 'description', folder));
|
|
378
401
|
}
|
|
@@ -454,8 +477,7 @@ class ApiDocExtractor {
|
|
|
454
477
|
for (const decorator of decorators) {
|
|
455
478
|
const call = decorator.expression;
|
|
456
479
|
if (ts.isCallExpression(call) &&
|
|
457
|
-
|
|
458
|
-
call.expression.text === decoratorName) {
|
|
480
|
+
ApiDocExtractor.canonicalCallName(call.expression) === decoratorName) {
|
|
459
481
|
return call;
|
|
460
482
|
}
|
|
461
483
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiDocExtractor.js","sourceRoot":"","sources":["../../../../../../packages/docs/api-doc-model/src/extract/ApiDocExtractor.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AACjC,oDA2B8B;AAC9B,sDAS8B;AAE9B,mEAAgE;AAChE,qDAAkD;AAClD,mCAAgC;AAChC,qDAAkD;AAClD,mDAA+D;AAC/D,+DAA4D;AAC5D,mDAAgD;AAChD,iDAA8C;AAC9C,6DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,QAAQ,GAAG,mBAAO,CAAC,IAAI,CAAC;AAC9B,MAAM,QAAQ,GAAG,oBAAQ,CAAC,IAAI,CAAC;AAC/B,MAAM,QAAQ,GAAG,mBAAO,CAAC,IAAI,CAAC;AAC9B,MAAM,QAAQ,GAAG,qBAAS,CAAC,IAAI,CAAC;AAChC,MAAM,WAAW,GAAG,iCAAqB,CAAC,IAAI,CAAC;AAC/C,MAAM,QAAQ,GAAG,wBAAY,CAAC,IAAI,CAAC;AACnC,MAAM,YAAY,GAAG,wBAAY,CAAC,IAAI,CAAC;AACvC,MAAM,QAAQ,GAAG,mBAAO,CAAC,IAAI,CAAC;AAE9B;;;;GAIG;AACH,MAAM,WAAW,GAAG,QAAQ,CAAC;AAE7B,oGAAoG;AACpG,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC5B,wBAAY,CAAC,IAAI;IACjB,qBAAS,CAAC,IAAI;IACd,sBAAU,CAAC,IAAI;IACf,8BAAkB,CAAC,IAAI;IACvB,yBAAa,CAAC,IAAI;IAClB,wBAAY,CAAC,IAAI;IACjB,2BAAe,CAAC,IAAI;CACvB,CAAC,CAAC;AAEH,sGAAsG;AACtG,MAAM,cAAc,GAAsB,CAAC,eAAG,EAAE,sBAAU,EAAE,gBAAI,EAAE,oBAAQ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CAAC;IACrB,CAAC;IAED,qFAAqF;IAC7E,MAAM,CAAC,aAAa,CACxB,IAAa,EACb,aAAqB;QAErB,MAAM,UAAU,GAAG,EAAE,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACpF,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;YACjC,MAAM,IAAI,GAAG,SAAS,CAAC,UAAU,CAAC;YAClC,IACI,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBACzB,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,UAAU,CAAC;gBAChC,IAAI,CAAC,UAAU,CAAC,IAAI,KAAK,aAAa,EACxC,CAAC;gBACC,OAAO,IAAI,CAAC;YAChB,CAAC;QACL,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AAviBD,0CAuiBC","sourcesContent":["import * as ts from 'typescript';\nimport {\n ApiPath,\n CLOUDTASKS,\n CRON,\n Endpoint,\n EXTERNAL,\n GET,\n MaskLog,\n POST,\n READ,\n RPC,\n WRITE,\n WRITE_IDEMPOTENT,\n WpAuthApiKey,\n WpAuthJwt,\n WpAuthLocalOnly,\n WpAuthOidc,\n WpAuthPublic,\n WpAuthSharedSecret,\n WpAuthWebhook,\n ApiType,\n EXTERNAL_CUSTOMER,\n MCP,\n SVC_TO_SVC,\n InvalidEndpointForMcp,\n WpMcpAuthJwt,\n WpMcpTool,\n} from '@webpieces/core-util';\nimport {\n ApiComponentsModel,\n ApiDocModel,\n DocumentedApiKey,\n DocumentedApiKeyCredential,\n DocumentedAuth,\n DocumentedEndpoint,\n DocumentedEndpointOptions,\n DocumentedMcpTool,\n} from '../model/ApiDocModel';\nimport { TypeRef } from '../model/TypeRef';\nimport { ApiDocExtractionError } from './ApiDocExtractionError';\nimport { ConstantFolder } from './ConstantFolder';\nimport { JsDoc } from './JsDoc';\nimport { SourceLocation } from './SourceLocation';\nimport { assertApiTypeMatchesMcpTools } from './McpMembership';\nimport { ComponentsExtractor } from './ComponentsExtractor';\nimport { PackageOfFile } from './PackageOfFile';\nimport { TypeResolver } from './TypeResolver';\nimport { StreamingSignature } from './StreamingSignature';\n\n/**\n * The decorator names this extractor matches on, taken from the REAL SYMBOLS rather than re-typed as\n * string literals.\n *\n * ## Why `.name` and not `'Endpoint'`\n *\n * The extractor matches decorators by NAME on the syntax — it must, because it reads a contract with\n * the compiler and never executes it. The question is only where that name comes from, and a literal\n * has a silent failure mode that a symbol does not: rename `@WpMcpTool` in `core-util` and a literal\n * simply stops matching. The extractor then finds zero MCP tools, the MCP document is correctly not\n * written because it has no tools in it, and the BUILD IS GREEN. A partner-facing document silently\n * loses a section with nothing red anywhere (issue #1001).\n *\n * `Endpoint.name` makes that rename a COMPILE ERROR here, which in this repo is the delivery\n * mechanism for a migration rather than an obstacle to one: a compile break names the new spelling\n * and an agent applies it in one pass, where a green build teaches nobody anything.\n *\n * ## Why importing `@webpieces/core-util` is not the coupling it looks like\n *\n * Any contract carrying `@Endpoint` already depends on `core-util` by definition, so there is no\n * upstream project this import could shut out. It is build-time only, it creates no cycle, and it\n * costs a browser bundle nothing because nothing in a bundle imports this package. The direction that\n * WOULD be fatal is `core-util` depending on the TypeScript compiler, and that is not this.\n */\nconst API_PATH = ApiPath.name;\nconst ENDPOINT = Endpoint.name;\nconst MASK_LOG = MaskLog.name;\nconst MCP_TOOL = WpMcpTool.name;\nconst MCP_INVALID = InvalidEndpointForMcp.name;\nconst MCP_AUTH = WpMcpAuthJwt.name;\nconst API_KEY_AUTH = WpAuthApiKey.name;\nconst API_TYPE = ApiType.name;\n\n/**\n * The prefix shared by every credential decorator. A PREFIX genuinely has no symbol to take a name\n * from, so it stays a literal — but the set it selects is pinned below, which is what stops it\n * quietly matching nothing.\n */\nconst AUTH_PREFIX = 'WpAuth';\n\n/** Every credential decorator, by real symbol, so a rename of any of them fails to compile here. */\nconst AUTH_DECORATORS = new Set([\n WpAuthPublic.name,\n WpAuthJwt.name,\n WpAuthOidc.name,\n WpAuthSharedSecret.name,\n WpAuthWebhook.name,\n WpAuthApiKey.name,\n WpAuthLocalOnly.name,\n]);\n\n/** The REAL trigger kinds and side-effect contracts, so a contract cannot declare one that is not. */\nconst ENDPOINT_KINDS: readonly string[] = [RPC, CLOUDTASKS, CRON, EXTERNAL];\nconst ENDPOINT_OPERATIONS: readonly string[] = [READ, WRITE_IDEMPOTENT, WRITE];\nconst HTTP_METHODS: readonly string[] = [GET, POST];\n\n/** `@Endpoint`'s four required positions, named so a failure can say which one is missing. */\nconst ARGUMENT_NAMES = ['http method', 'path', 'operation', 'trigger kind'];\n\n/** The allowed values of each required position, in the same order, for the same failure. */\nconst ARGUMENT_VALUES: readonly (readonly string[])[] = [\n HTTP_METHODS,\n [],\n ENDPOINT_OPERATIONS,\n ENDPOINT_KINDS,\n];\n\n/** The REAL document types, so a contract cannot name a document that does not exist. */\nconst API_TYPES: readonly string[] = [SVC_TO_SVC, EXTERNAL_CUSTOMER, MCP];\n\n/** The fail-closed default: a contract that declares nothing feeds only the internal document. */\nconst DEFAULT_API_TYPES: readonly string[] = [SVC_TO_SVC];\n\n/**\n * ONE contract file -> ONE {@link ApiDocModel}. The single extraction pass both the OpenAPI documents\n * and the MCP tool list (#982) are rendered from.\n *\n * ## Why the compiler API at all\n *\n * A DTO field's TYPE IS ERASED AT RUNTIME. Reflection can see that `save` takes one argument; it\n * cannot see that the argument has a `deliveryWindow` that is a discriminated union of two shapes,\n * one of which carries an ISO timestamp. Those are precisely the shapes a partner-grade document is\n * made of, so the only place they exist is the source, and the only honest way to read the source is\n * the compiler.\n *\n * ## Why it IMPORTS `@webpieces/core-util`\n *\n * Decorators are matched BY NAME on the syntax — they must be, because this reads a contract and\n * never executes it. The NAMES come from the real symbols (`Endpoint.name`), so a rename in\n * `core-util` is a compile error here instead of a literal that quietly stops matching. The full\n * argument, and why the import is not the coupling it looks like, is at those constants.\n *\n * ## What it does NOT do\n *\n * It emits nothing. No OpenAPI, no MCP tool definitions, no file — that is #982, and keeping the\n * render out means the two renderers cannot drift apart about what the contract SAYS.\n */\nexport class ApiDocExtractor {\n /** Which package declares each file — the owner of every schema (#1058). Cached per directory. */\n private readonly packages = new PackageOfFile();\n /** A resolver whose HOME is the package declaring `source` — see {@link TypeResolver}. */\n private resolverFor(program: ts.Program, source: ts.SourceFile): TypeResolver {\n const home = this.packages.of(source.fileName)?.name;\n return new TypeResolver(program.getTypeChecker(), this.packages, home);\n }\n\n /**\n * Extract the contract in `entryFile`.\n *\n * @param entryFile absolute path to the `.ts` file holding the `@ApiPath` class.\n * @param compilerOptions handed straight to `ts.createProgram`; the caller owns them because\n * only the caller knows its own `paths` / `lib` setup.\n * @throws ApiDocExtractionError when the file holds no `@ApiPath` class, or when something that\n * must be exact (a path constant, a numeric bound) cannot be established.\n */\n extractFile(entryFile: string, compilerOptions: ts.CompilerOptions = {}): ApiDocModel {\n const program = ts.createProgram([entryFile], compilerOptions);\n const source = program.getSourceFile(entryFile);\n if (source === undefined) {\n throw new ApiDocExtractionError(\n 'entry file is not part of the program',\n entryFile,\n 'Pass an absolute path to a .ts file that exists.',\n );\n }\n return this.extract(program, source);\n }\n\n /**\n * EVERY `@ApiPath` contract in one file, in declaration order.\n *\n * {@link extractFile} answers \"what is THE contract in this file\", which is the shape a manifest\n * entry and a generated document have: one contract, one file. This answers a different question\n * — \"what does this file declare\" — and it exists because a REPO does not obey that convention.\n * `McpRemoteFixtures.ts` in `@webpieces/mcp-server` declares seven contracts, and the runtime\n * registers MCP tools from all seven; a sweep that read only the first would report green while\n * six contracts' worth of tools had never been looked at, which is the exact shape of silent miss\n * this epic exists to remove.\n *\n * A file with no contract yields an EMPTY list rather than throwing: \"this file has none\" is an\n * ordinary answer to this question, where it is a failure to answer {@link extractFile}'s.\n */\n extractAll(\n entryFile: string,\n compilerOptions: ts.CompilerOptions = {},\n ): readonly ApiDocModel[] {\n const program = ts.createProgram([entryFile], compilerOptions);\n const source = program.getSourceFile(entryFile);\n if (source === undefined) {\n throw new ApiDocExtractionError(\n 'entry file is not part of the program',\n entryFile,\n 'Pass an absolute path to a .ts file that exists.',\n );\n }\n return this.extractAllFrom(program, source);\n }\n\n /** {@link extractAll} against a program the caller already built. */\n extractAllFrom(program: ts.Program, source: ts.SourceFile): readonly ApiDocModel[] {\n const models: ApiDocModel[] = [];\n for (const statement of source.statements) {\n if (\n ts.isClassDeclaration(statement) &&\n ApiDocExtractor.decoratorCall(statement, API_PATH) !== undefined\n ) {\n models.push(this.extractContract(program, statement));\n }\n }\n return models;\n }\n\n /** The same extraction against a program the caller already built. */\n extract(program: ts.Program, source: ts.SourceFile): ApiDocModel {\n return this.extractContract(program, this.findContract(source));\n }\n\n /** ONE contract class -> ONE model. The single place the walk actually happens. */\n private extractContract(program: ts.Program, contract: ts.ClassDeclaration): ApiDocModel {\n const checker = program.getTypeChecker();\n const folder = new ConstantFolder(checker);\n const resolver = this.resolverFor(program, contract.getSourceFile());\n\n const pathDecorator = ApiDocExtractor.decoratorCall(contract, API_PATH)!;\n const basePathArgument = pathDecorator.arguments[0];\n const basePath =\n basePathArgument === undefined\n ? ''\n : folder.foldString(basePathArgument, '@ApiPath argument');\n\n const apiTypes = this.declaredApiTypes(contract, folder);\n const endpoints: DocumentedEndpoint[] = [];\n for (const member of contract.members) {\n const endpoint = this.endpointOf(member, folder, resolver);\n if (endpoint !== undefined) {\n endpoints.push(endpoint);\n }\n }\n assertApiTypeMatchesMcpTools(contract, apiTypes, endpoints);\n\n return new ApiDocModel(\n contract.name?.text ?? '<anonymous>',\n apiTypes,\n basePath,\n JsDoc.read(contract).description,\n endpoints,\n resolver.collectedTypes(),\n resolver.collectedUnmapped(),\n resolver.collectedCollisions(),\n );\n }\n\n /**\n * Extract ONE named type and everything it reaches, from a file that holds NO contract.\n *\n * This exists for a type nothing in a contract points at but a document still publishes — the\n * document-wide error body a renderer's manifest names. Reading it with the SAME resolver is the\n * point: a second reader would be a second answer to \"what shape is this type\", and the two\n * would drift the first time a field changed.\n *\n * @throws ApiDocExtractionError when the file does not declare that name.\n */\n extractType(\n entryFile: string,\n typeName: string,\n compilerOptions: ts.CompilerOptions = {},\n ): ApiDocModel {\n const program = ts.createProgram([entryFile], compilerOptions);\n const source = program.getSourceFile(entryFile);\n if (source === undefined) {\n throw new ApiDocExtractionError(\n 'entry file is not part of the program',\n entryFile,\n 'Pass an absolute path to a .ts file that exists.',\n );\n }\n const resolver = this.resolverFor(program, source);\n const declaration = ApiDocExtractor.declarationNamed(source, typeName);\n if (declaration === undefined) {\n throw new ApiDocExtractionError(\n `no type named '${typeName}' is declared in this file`,\n entryFile,\n `Declare and export '${typeName}' there, or name the file that does.`,\n );\n }\n resolver.resolveDeclaration(typeName, declaration, typeName);\n return new ApiDocModel(\n typeName,\n DEFAULT_API_TYPES,\n '',\n '',\n [],\n resolver.collectedTypes(),\n resolver.collectedUnmapped(),\n resolver.collectedCollisions(),\n );\n }\n\n /** A DTO library's exported types, for its components document (#1058). */\n extractComponents(\n entryFiles: readonly string[],\n compilerOptions: ts.CompilerOptions = {},\n ): ApiComponentsModel {\n return new ComponentsExtractor(this.packages).extract(entryFiles, compilerOptions);\n }\n\n /** The interface / class / type alias / enum declared under `name` at the file's top level. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static declarationNamed(\n source: ts.SourceFile,\n name: string,\n ): ts.Declaration | undefined {\n for (const statement of source.statements) {\n const named =\n ts.isInterfaceDeclaration(statement) ||\n ts.isClassDeclaration(statement) ||\n ts.isTypeAliasDeclaration(statement) ||\n ts.isEnumDeclaration(statement);\n if (named && statement.name?.text === name) {\n return statement;\n }\n }\n return undefined;\n }\n\n /** The one `@ApiPath` class in the file. Zero is a hard failure; the FIRST wins if there are two. */\n private findContract(source: ts.SourceFile): ts.ClassDeclaration {\n for (const statement of source.statements) {\n if (\n ts.isClassDeclaration(statement) &&\n ApiDocExtractor.decoratorCall(statement, API_PATH) !== undefined\n ) {\n return statement;\n }\n }\n throw new ApiDocExtractionError(\n 'no @ApiPath class in this file',\n source.fileName,\n 'Point the extractor at the contract file — the one whose class carries @ApiPath.',\n );\n }\n\n /** One `@Endpoint` method. Members without the decorator are not part of the contract. */\n private endpointOf(\n member: ts.ClassElement,\n folder: ConstantFolder,\n resolver: TypeResolver,\n ): DocumentedEndpoint | undefined {\n if (!ts.isMethodDeclaration(member) || !ts.isIdentifier(member.name)) {\n return undefined;\n }\n const call = ApiDocExtractor.decoratorCall(member, ENDPOINT);\n if (call === undefined) {\n return undefined;\n }\n const methodName = member.name.text;\n\n // `@Endpoint(httpMethod, path, operation, kind, options?)` — METHOD-FIRST, five positions.\n // The positions are read here and nowhere else, so the one place that has to change when the\n // decorator changes is this block plus `ARGUMENT_NAMES` beside it.\n const httpMethod = this.requiredArgument(call, methodName, 0, folder);\n const path = this.requiredArgument(call, methodName, 1, folder);\n const operation = this.requiredArgument(call, methodName, 2, folder);\n const kind = this.requiredArgument(call, methodName, 3, folder);\n\n const options = call.arguments[4];\n const literal =\n options !== undefined && ts.isObjectLiteralExpression(options) ? options : undefined;\n\n const doc = JsDoc.read(member);\n const mcpTool = ApiDocExtractor.mcpToolOf(member, folder);\n const streaming = new StreamingSignature().read(member, folder, resolver);\n return new DocumentedEndpoint(\n methodName,\n httpMethod,\n path,\n operation,\n kind,\n ApiDocExtractor.booleanProperty(literal, 'hidden'),\n ApiDocExtractor.booleanProperty(literal, 'openWorld'),\n new DocumentedEndpointOptions(\n ApiDocExtractor.booleanProperty(literal, 'formPost'),\n ApiDocExtractor.stringProperty(literal, 'calledBy', folder),\n ApiDocExtractor.stringProperty(literal, 'callerKind', folder),\n ),\n ApiDocExtractor.authOf(member, folder),\n mcpTool,\n ApiDocExtractor.invalidForMcpOf(member, folder),\n ApiDocExtractor.decoratorCall(member, MCP_AUTH)?.arguments[0]?.getText(),\n ApiDocExtractor.maskLogOf(member),\n doc.description,\n doc.mcp,\n this.requestOf(member, methodName, resolver),\n streaming?.initialResponse ?? this.responseOf(member, methodName, resolver),\n streaming,\n );\n }\n\n /**\n * One REQUIRED positional argument of `@Endpoint`, folded to the string it denotes.\n *\n * Every one of the four is an enum member (`POST`, `READ`, `RPC`) as often as it is a literal,\n * and the folder resolves both — a document that printed `RPC` where the trigger goes would be\n * worse than no document. A missing one is a hard failure naming the position, because the\n * alternative is a document quietly missing a verb.\n */\n private requiredArgument(\n call: ts.CallExpression,\n methodName: string,\n index: number,\n folder: ConstantFolder,\n ): string {\n const argument = call.arguments[index];\n const what = ARGUMENT_NAMES[index];\n if (argument === undefined) {\n throw new ApiDocExtractionError(\n `@Endpoint on '${methodName}' declares no ${what}`,\n SourceLocation.of(call),\n \"Write all four: @Endpoint(POST, '/thing', READ, RPC).\",\n );\n }\n const value = folder.foldString(argument, `@Endpoint ${what} on '${methodName}'`);\n const allowed = ARGUMENT_VALUES[index]!;\n if (allowed.length > 0 && !allowed.includes(value)) {\n throw new ApiDocExtractionError(\n `@Endpoint on '${methodName}' declares ${what} '${value}', which is not one of ` +\n allowed.join(', '),\n SourceLocation.of(argument),\n `Use one of the exported constants: ${allowed.join(', ')}.`,\n );\n }\n return value;\n }\n\n /**\n * `@ApiType(...)` on the contract, folded to the real values.\n *\n * A value that is not one of the three documents is a HARD FAILURE rather than a silent drop: a\n * contract that named `CUSTOMER` by mistake would otherwise feed nothing, which looks exactly\n * like a contract somebody deliberately kept internal.\n */\n private declaredApiTypes(node: ts.Node, folder: ConstantFolder): readonly string[] {\n const call = ApiDocExtractor.decoratorCall(node, API_TYPE);\n if (call === undefined) {\n return DEFAULT_API_TYPES;\n }\n const declared = call.arguments.map((argument: ts.Expression) =>\n folder.foldString(argument, `@${API_TYPE} argument`),\n );\n for (const apiType of declared) {\n if (!API_TYPES.includes(apiType)) {\n throw new ApiDocExtractionError(\n `@${API_TYPE} names '${apiType}', which is not a generated document`,\n SourceLocation.of(call),\n `Use one of the exported constants: ${API_TYPES.join(', ')}.`,\n );\n }\n }\n return declared.length === 0 ? DEFAULT_API_TYPES : declared;\n }\n\n /** The FIRST parameter's declared type. An endpoint with no parameter has no request document. */\n private requestOf(\n member: ts.MethodDeclaration,\n methodName: string,\n resolver: TypeResolver,\n ): TypeRef | undefined {\n const parameter = member.parameters[0];\n if (parameter?.type === undefined) {\n return undefined;\n }\n return resolver.resolve(parameter.type, `${methodName}.request`);\n }\n\n /** The declared return type, unwrapped from `Promise<...>` by the resolver. */\n private responseOf(\n member: ts.MethodDeclaration,\n methodName: string,\n resolver: TypeResolver,\n ): TypeRef | undefined {\n if (member.type === undefined) {\n return undefined;\n }\n return resolver.resolve(member.type, `${methodName}.response`);\n }\n\n /** `@WpAuthPublic()`, `@WpAuthJwt({...})`, … — recorded verbatim; this package rules on nothing. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static authOf(member: ts.Node, folder: ConstantFolder): DocumentedAuth | undefined {\n const decorators = ts.canHaveDecorators(member) ? (ts.getDecorators(member) ?? []) : [];\n for (const decorator of decorators) {\n const call = decorator.expression;\n if (!ts.isCallExpression(call) || !ts.isIdentifier(call.expression)) {\n continue;\n }\n const name = call.expression.text;\n if (name.startsWith(AUTH_PREFIX) && AUTH_DECORATORS.has(name)) {\n return new DocumentedAuth(\n name,\n call.arguments.map((argument: ts.Expression) => argument.getText()),\n name === API_KEY_AUTH ? ApiDocExtractor.apiKeyOf(call, folder) : undefined,\n );\n }\n }\n return undefined;\n }\n\n /**\n * `@WpAuthApiKey(regime, [{in: 'header', name: 'x-api-key', description: '…'}, …])`, parsed.\n *\n * A malformed declaration FAILS rather than yielding a half-parsed regime: the credentials are\n * what a published document's security block is made of, and a document that silently omitted\n * one would tell a partner they need fewer credentials than the running hook demands.\n */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static apiKeyOf(call: ts.CallExpression, folder: ConstantFolder): DocumentedApiKey {\n const regimeArgument = call.arguments[0];\n const credentialsArgument = call.arguments[1];\n if (regimeArgument === undefined || credentialsArgument === undefined) {\n throw new ApiDocExtractionError(\n '@WpAuthApiKey needs a regime AND its credentials',\n SourceLocation.of(call),\n \"Write both: @WpAuthApiKey('partner', [{ in: 'header', name: 'x-api-key' }]).\",\n );\n }\n const regime = folder.foldString(regimeArgument, '@WpAuthApiKey regime');\n // FOLLOW a name first: a credential list shared by every method of a contract is written\n // once as a `const` and named per method, which is better source than a copy per method.\n const credentialsLiteral = folder.follow(credentialsArgument);\n if (!ts.isArrayLiteralExpression(credentialsLiteral)) {\n throw new ApiDocExtractionError(\n '@WpAuthApiKey credentials is not an array literal',\n SourceLocation.of(credentialsArgument),\n 'Write the credentials as an array literal, inline or in a `const`; a value ' +\n 'assembled at runtime cannot appear in a published security scheme.',\n );\n }\n const credentials: DocumentedApiKeyCredential[] = [];\n for (const element of credentialsLiteral.elements) {\n credentials.push(ApiDocExtractor.credentialOf(element, folder));\n }\n return new DocumentedApiKey(regime, credentials);\n }\n\n /** ONE `{ in: …, name?: …, description?: … }` credential. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static credentialOf(\n expression: ts.Expression,\n folder: ConstantFolder,\n ): DocumentedApiKeyCredential {\n const element = folder.follow(expression);\n if (!ts.isObjectLiteralExpression(element)) {\n throw new ApiDocExtractionError(\n 'an @WpAuthApiKey credential is not an object literal',\n SourceLocation.of(element),\n \"Write it inline: { in: 'header', name: 'x-api-key' }.\",\n );\n }\n const location = ApiDocExtractor.stringProperty(element, 'in', folder);\n if (location === undefined) {\n throw new ApiDocExtractionError(\n 'an @WpAuthApiKey credential declares no `in`',\n SourceLocation.of(element),\n \"Say where it rides: `in: 'header'` with a name, or `in: 'bearer'`.\",\n );\n }\n return new DocumentedApiKeyCredential(\n location,\n ApiDocExtractor.stringProperty(element, 'name', folder),\n ApiDocExtractor.stringProperty(element, 'description', folder),\n );\n }\n\n /**\n * `@WpMcpTool('search_stores')` — the stable protocol name, which is the ONE fact the source\n * cannot otherwise state.\n *\n * Nothing else is read because nothing else is declared there any more (#984): the method's JSDoc\n * is the description for the agent and the partner alike, the three side-effect hints are computed\n * from the endpoint's `operation`, and `openWorldHint` is `@Endpoint`'s `openWorld`. See\n * {@link DocumentedMcpTool}.\n */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static mcpToolOf(\n member: ts.Node,\n folder: ConstantFolder,\n ): DocumentedMcpTool | undefined {\n const call = ApiDocExtractor.decoratorCall(member, MCP_TOOL);\n const argument = call?.arguments[0];\n if (argument === undefined) {\n return undefined;\n }\n return new DocumentedMcpTool(folder.tryFoldString(argument) ?? '');\n }\n\n /**\n * `@InvalidEndpointForMcp('<reason>')`'s reason, or undefined.\n *\n * A reason that will not fold is read as the EMPTY STRING rather than as \"no decorator\": the\n * method is still permanently outside MCP, and losing that fact because the argument was written\n * as a cross-module constant would silently put the endpoint back in the candidate set.\n */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static invalidForMcpOf(member: ts.Node, folder: ConstantFolder): string | undefined {\n const call = ApiDocExtractor.decoratorCall(member, MCP_INVALID);\n if (call === undefined) {\n return undefined;\n }\n const argument = call.arguments[0];\n return argument === undefined ? '' : (folder.tryFoldString(argument) ?? '');\n }\n\n /** `@MaskLog({ refreshToken: 'full' })` -> field name -> mask mode. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static maskLogOf(member: ts.Node): ReadonlyMap<string, string> {\n const fields = new Map<string, string>();\n const argument = ApiDocExtractor.decoratorCall(member, MASK_LOG)?.arguments[0];\n if (argument === undefined || !ts.isObjectLiteralExpression(argument)) {\n return fields;\n }\n for (const property of argument.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n ts.isStringLiteralLike(property.initializer)\n ) {\n fields.set(property.name.text, property.initializer.text);\n }\n }\n return fields;\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static booleanProperty(\n literal: ts.ObjectLiteralExpression | undefined,\n name: string,\n ): boolean {\n const value =\n literal === undefined ? undefined : ApiDocExtractor.findProperty(literal, name);\n return value?.kind === ts.SyntaxKind.TrueKeyword;\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static stringProperty(\n literal: ts.ObjectLiteralExpression | undefined,\n name: string,\n folder: ConstantFolder,\n ): string | undefined {\n const value =\n literal === undefined ? undefined : ApiDocExtractor.findProperty(literal, name);\n return value === undefined ? undefined : folder.tryFoldString(value);\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static findProperty(\n literal: ts.ObjectLiteralExpression,\n name: string,\n ): ts.Expression | undefined {\n for (const property of literal.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n property.name.text === name\n ) {\n return property.initializer;\n }\n }\n return undefined;\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static decoratorCall(\n node: ts.Node,\n decoratorName: string,\n ): ts.CallExpression | undefined {\n const decorators = ts.canHaveDecorators(node) ? (ts.getDecorators(node) ?? []) : [];\n for (const decorator of decorators) {\n const call = decorator.expression;\n if (\n ts.isCallExpression(call) &&\n ts.isIdentifier(call.expression) &&\n call.expression.text === decoratorName\n ) {\n return call;\n }\n }\n return undefined;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ApiDocExtractor.js","sourceRoot":"","sources":["../../../../../../packages/docs/api-doc-model/src/extract/ApiDocExtractor.ts"],"names":[],"mappings":";;;;AAAA,uDAAiC;AACjC,oDAqB8B;AAC9B,sDAU8B;AAE9B,mEAAgE;AAChE,qDAAkD;AAClD,mCAAgC;AAChC,qDAAkD;AAClD,mDAA+D;AAC/D,+DAA4D;AAC5D,mDAAgD;AAChD,iDAA8C;AAC9C,6DAA0D;AAE1D;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,QAAQ,GAAG,mBAAO,CAAC,IAAI,CAAC;AAC9B,MAAM,QAAQ,GAAG,oBAAQ,CAAC,IAAI,CAAC;AAC/B,MAAM,QAAQ,GAAG,mBAAO,CAAC,IAA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oint,\n EXTERNAL,\n GET,\n MaskLog,\n POST,\n READ,\n RPC,\n WRITE,\n WRITE_IDEMPOTENT,\n WpAuthPublic,\n WpAuth, WpAuthorization, WpLocalOnly, apiKey,\n ApiType,\n EXTERNAL_CUSTOMER,\n MCP,\n SVC_TO_SVC,\n InvalidEndpointForMcp,\n WpMcpTool,\n} from '@webpieces/core-util';\nimport {\n ApiComponentsModel,\n ApiDocModel,\n DocumentedApiKey,\n DocumentedApiKeyCredential,\n DocumentedAuth,\n DocumentedAuthMethod,\n DocumentedEndpoint,\n DocumentedEndpointOptions,\n DocumentedMcpTool,\n} from '../model/ApiDocModel';\nimport { TypeRef } from '../model/TypeRef';\nimport { ApiDocExtractionError } from './ApiDocExtractionError';\nimport { ConstantFolder } from './ConstantFolder';\nimport { JsDoc } from './JsDoc';\nimport { SourceLocation } from './SourceLocation';\nimport { assertApiTypeMatchesMcpTools } from './McpMembership';\nimport { ComponentsExtractor } from './ComponentsExtractor';\nimport { PackageOfFile } from './PackageOfFile';\nimport { TypeResolver } from './TypeResolver';\nimport { StreamingSignature } from './StreamingSignature';\n\n/**\n * The decorator names this extractor matches on, taken from the REAL SYMBOLS rather than re-typed as\n * string literals.\n *\n * ## Why `.name` and not `'Endpoint'`\n *\n * The extractor matches decorators by NAME on the syntax — it must, because it reads a contract with\n * the compiler and never executes it. The question is only where that name comes from, and a literal\n * has a silent failure mode that a symbol does not: rename `@WpMcpTool` in `core-util` and a literal\n * simply stops matching. The extractor then finds zero MCP tools, the MCP document is correctly not\n * written because it has no tools in it, and the BUILD IS GREEN. A partner-facing document silently\n * loses a section with nothing red anywhere (issue #1001).\n *\n * `Endpoint.name` makes that rename a COMPILE ERROR here, which in this repo is the delivery\n * mechanism for a migration rather than an obstacle to one: a compile break names the new spelling\n * and an agent applies it in one pass, where a green build teaches nobody anything.\n *\n * ## Why importing `@webpieces/core-util` is not the coupling it looks like\n *\n * Any contract carrying `@Endpoint` already depends on `core-util` by definition, so there is no\n * upstream project this import could shut out. It is build-time only, it creates no cycle, and it\n * costs a browser bundle nothing because nothing in a bundle imports this package. The direction that\n * WOULD be fatal is `core-util` depending on the TypeScript compiler, and that is not this.\n */\nconst API_PATH = ApiPath.name;\nconst ENDPOINT = Endpoint.name;\nconst MASK_LOG = MaskLog.name;\nconst MCP_TOOL = WpMcpTool.name;\nconst MCP_INVALID = InvalidEndpointForMcp.name;\nconst AUTHORIZATION = WpAuthorization.name;\nconst API_KEY_AUTH = apiKey.name;\nconst API_TYPE = ApiType.name;\n\n/**\n * The prefix shared by every credential decorator. A PREFIX genuinely has no symbol to take a name\n * from, so it stays a literal — but the set it selects is pinned below, which is what stops it\n * quietly matching nothing.\n */\n/** The REAL trigger kinds and side-effect contracts, so a contract cannot declare one that is not. */\nconst ENDPOINT_KINDS: readonly string[] = [RPC, CLOUDTASKS, CRON, EXTERNAL];\nconst ENDPOINT_OPERATIONS: readonly string[] = [READ, WRITE_IDEMPOTENT, WRITE];\nconst HTTP_METHODS: readonly string[] = [GET, POST];\n\n/** `@Endpoint`'s four required positions, named so a failure can say which one is missing. */\nconst ARGUMENT_NAMES = ['http method', 'path', 'operation', 'trigger kind'];\n\n/** The allowed values of each required position, in the same order, for the same failure. */\nconst ARGUMENT_VALUES: readonly (readonly string[])[] = [\n HTTP_METHODS,\n [],\n ENDPOINT_OPERATIONS,\n ENDPOINT_KINDS,\n];\n\n/** The REAL document types, so a contract cannot name a document that does not exist. */\nconst API_TYPES: readonly string[] = [SVC_TO_SVC, EXTERNAL_CUSTOMER, MCP];\n\n/** The fail-closed default: a contract that declares nothing feeds only the internal document. */\nconst DEFAULT_API_TYPES: readonly string[] = [SVC_TO_SVC];\n\n/**\n * ONE contract file -> ONE {@link ApiDocModel}. The single extraction pass both the OpenAPI documents\n * and the MCP tool list (#982) are rendered from.\n *\n * ## Why the compiler API at all\n *\n * A DTO field's TYPE IS ERASED AT RUNTIME. Reflection can see that `save` takes one argument; it\n * cannot see that the argument has a `deliveryWindow` that is a discriminated union of two shapes,\n * one of which carries an ISO timestamp. Those are precisely the shapes a partner-grade document is\n * made of, so the only place they exist is the source, and the only honest way to read the source is\n * the compiler.\n *\n * ## Why it IMPORTS `@webpieces/core-util`\n *\n * Decorators are matched BY NAME on the syntax — they must be, because this reads a contract and\n * never executes it. The NAMES come from the real symbols (`Endpoint.name`), so a rename in\n * `core-util` is a compile error here instead of a literal that quietly stops matching. The full\n * argument, and why the import is not the coupling it looks like, is at those constants.\n *\n * ## What it does NOT do\n *\n * It emits nothing. No OpenAPI, no MCP tool definitions, no file — that is #982, and keeping the\n * render out means the two renderers cannot drift apart about what the contract SAYS.\n */\nexport class ApiDocExtractor {\n /** Which package declares each file — the owner of every schema (#1058). Cached per directory. */\n private readonly packages = new PackageOfFile();\n /** A resolver whose HOME is the package declaring `source` — see {@link TypeResolver}. */\n private resolverFor(program: ts.Program, source: ts.SourceFile): TypeResolver {\n const home = this.packages.of(source.fileName)?.name;\n return new TypeResolver(program.getTypeChecker(), this.packages, home);\n }\n\n /**\n * Extract the contract in `entryFile`.\n *\n * @param entryFile absolute path to the `.ts` file holding the `@ApiPath` class.\n * @param compilerOptions handed straight to `ts.createProgram`; the caller owns them because\n * only the caller knows its own `paths` / `lib` setup.\n * @throws ApiDocExtractionError when the file holds no `@ApiPath` class, or when something that\n * must be exact (a path constant, a numeric bound) cannot be established.\n */\n extractFile(entryFile: string, compilerOptions: ts.CompilerOptions = {}): ApiDocModel {\n const program = ts.createProgram([entryFile], compilerOptions);\n const source = program.getSourceFile(entryFile);\n if (source === undefined) {\n throw new ApiDocExtractionError(\n 'entry file is not part of the program',\n entryFile,\n 'Pass an absolute path to a .ts file that exists.',\n );\n }\n return this.extract(program, source);\n }\n\n /**\n * EVERY `@ApiPath` contract in one file, in declaration order.\n *\n * {@link extractFile} answers \"what is THE contract in this file\", which is the shape a manifest\n * entry and a generated document have: one contract, one file. This answers a different question\n * — \"what does this file declare\" — and it exists because a REPO does not obey that convention.\n * `McpRemoteFixtures.ts` in `@webpieces/mcp-server` declares seven contracts, and the runtime\n * registers MCP tools from all seven; a sweep that read only the first would report green while\n * six contracts' worth of tools had never been looked at, which is the exact shape of silent miss\n * this epic exists to remove.\n *\n * A file with no contract yields an EMPTY list rather than throwing: \"this file has none\" is an\n * ordinary answer to this question, where it is a failure to answer {@link extractFile}'s.\n */\n extractAll(\n entryFile: string,\n compilerOptions: ts.CompilerOptions = {},\n ): readonly ApiDocModel[] {\n const program = ts.createProgram([entryFile], compilerOptions);\n const source = program.getSourceFile(entryFile);\n if (source === undefined) {\n throw new ApiDocExtractionError(\n 'entry file is not part of the program',\n entryFile,\n 'Pass an absolute path to a .ts file that exists.',\n );\n }\n return this.extractAllFrom(program, source);\n }\n\n /** {@link extractAll} against a program the caller already built. */\n extractAllFrom(program: ts.Program, source: ts.SourceFile): readonly ApiDocModel[] {\n // Binding establishes AST parent links used by canonical import resolution.\n program.getTypeChecker();\n const models: ApiDocModel[] = [];\n for (const statement of source.statements) {\n if (\n ts.isClassDeclaration(statement) &&\n ApiDocExtractor.decoratorCall(statement, API_PATH) !== undefined\n ) {\n models.push(this.extractContract(program, statement));\n }\n }\n return models;\n }\n\n /** The same extraction against a program the caller already built. */\n extract(program: ts.Program, source: ts.SourceFile): ApiDocModel {\n program.getTypeChecker();\n return this.extractContract(program, this.findContract(source));\n }\n\n /** ONE contract class -> ONE model. The single place the walk actually happens. */\n private extractContract(program: ts.Program, contract: ts.ClassDeclaration): ApiDocModel {\n const checker = program.getTypeChecker();\n const folder = new ConstantFolder(checker);\n const resolver = this.resolverFor(program, contract.getSourceFile());\n\n const pathDecorator = ApiDocExtractor.decoratorCall(contract, API_PATH)!;\n const basePathArgument = pathDecorator.arguments[0];\n const basePath =\n basePathArgument === undefined\n ? ''\n : folder.foldString(basePathArgument, '@ApiPath argument');\n\n const apiTypes = this.declaredApiTypes(contract, folder);\n const endpoints: DocumentedEndpoint[] = [];\n for (const member of contract.members) {\n const endpoint = this.endpointOf(member, folder, resolver);\n if (endpoint !== undefined) {\n endpoints.push(endpoint);\n }\n }\n assertApiTypeMatchesMcpTools(contract, apiTypes, endpoints);\n\n return new ApiDocModel(\n contract.name?.text ?? '<anonymous>',\n apiTypes,\n basePath,\n JsDoc.read(contract).description,\n endpoints,\n resolver.collectedTypes(),\n resolver.collectedUnmapped(),\n resolver.collectedCollisions(),\n );\n }\n\n /**\n * Extract ONE named type and everything it reaches, from a file that holds NO contract.\n *\n * This exists for a type nothing in a contract points at but a document still publishes — the\n * document-wide error body a renderer's manifest names. Reading it with the SAME resolver is the\n * point: a second reader would be a second answer to \"what shape is this type\", and the two\n * would drift the first time a field changed.\n *\n * @throws ApiDocExtractionError when the file does not declare that name.\n */\n extractType(\n entryFile: string,\n typeName: string,\n compilerOptions: ts.CompilerOptions = {},\n ): ApiDocModel {\n const program = ts.createProgram([entryFile], compilerOptions);\n const source = program.getSourceFile(entryFile);\n if (source === undefined) {\n throw new ApiDocExtractionError(\n 'entry file is not part of the program',\n entryFile,\n 'Pass an absolute path to a .ts file that exists.',\n );\n }\n const resolver = this.resolverFor(program, source);\n const declaration = ApiDocExtractor.declarationNamed(source, typeName);\n if (declaration === undefined) {\n throw new ApiDocExtractionError(\n `no type named '${typeName}' is declared in this file`,\n entryFile,\n `Declare and export '${typeName}' there, or name the file that does.`,\n );\n }\n resolver.resolveDeclaration(typeName, declaration, typeName);\n return new ApiDocModel(\n typeName,\n DEFAULT_API_TYPES,\n '',\n '',\n [],\n resolver.collectedTypes(),\n resolver.collectedUnmapped(),\n resolver.collectedCollisions(),\n );\n }\n\n /** A DTO library's exported types, for its components document (#1058). */\n extractComponents(\n entryFiles: readonly string[],\n compilerOptions: ts.CompilerOptions = {},\n ): ApiComponentsModel {\n return new ComponentsExtractor(this.packages).extract(entryFiles, compilerOptions);\n }\n\n /** The interface / class / type alias / enum declared under `name` at the file's top level. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static declarationNamed(\n source: ts.SourceFile,\n name: string,\n ): ts.Declaration | undefined {\n for (const statement of source.statements) {\n const named =\n ts.isInterfaceDeclaration(statement) ||\n ts.isClassDeclaration(statement) ||\n ts.isTypeAliasDeclaration(statement) ||\n ts.isEnumDeclaration(statement);\n if (named && statement.name?.text === name) {\n return statement;\n }\n }\n return undefined;\n }\n\n /** The one `@ApiPath` class in the file. Zero is a hard failure; the FIRST wins if there are two. */\n private findContract(source: ts.SourceFile): ts.ClassDeclaration {\n for (const statement of source.statements) {\n if (\n ts.isClassDeclaration(statement) &&\n ApiDocExtractor.decoratorCall(statement, API_PATH) !== undefined\n ) {\n return statement;\n }\n }\n throw new ApiDocExtractionError(\n 'no @ApiPath class in this file',\n source.fileName,\n 'Point the extractor at the contract file — the one whose class carries @ApiPath.',\n );\n }\n\n /** One `@Endpoint` method. Members without the decorator are not part of the contract. */\n private endpointOf(\n member: ts.ClassElement,\n folder: ConstantFolder,\n resolver: TypeResolver,\n ): DocumentedEndpoint | undefined {\n if (!ts.isMethodDeclaration(member) || !ts.isIdentifier(member.name)) {\n return undefined;\n }\n const call = ApiDocExtractor.decoratorCall(member, ENDPOINT);\n if (call === undefined) {\n return undefined;\n }\n const methodName = member.name.text;\n\n // `@Endpoint(httpMethod, path, operation, kind, options?)` — METHOD-FIRST, five positions.\n // The positions are read here and nowhere else, so the one place that has to change when the\n // decorator changes is this block plus `ARGUMENT_NAMES` beside it.\n const httpMethod = this.requiredArgument(call, methodName, 0, folder);\n const path = this.requiredArgument(call, methodName, 1, folder);\n const operation = this.requiredArgument(call, methodName, 2, folder);\n const kind = this.requiredArgument(call, methodName, 3, folder);\n\n const options = call.arguments[4];\n const literal =\n options !== undefined && ts.isObjectLiteralExpression(options) ? options : undefined;\n\n const doc = JsDoc.read(member);\n const mcpTool = ApiDocExtractor.mcpToolOf(member, folder);\n const streaming = new StreamingSignature().read(member, folder, resolver);\n return new DocumentedEndpoint(\n methodName,\n httpMethod,\n path,\n operation,\n kind,\n ApiDocExtractor.booleanProperty(literal, 'hidden'),\n ApiDocExtractor.booleanProperty(literal, 'openWorld'),\n new DocumentedEndpointOptions(\n ApiDocExtractor.booleanProperty(literal, 'formPost'),\n ApiDocExtractor.stringProperty(literal, 'calledBy', folder),\n ApiDocExtractor.stringProperty(literal, 'callerKind', folder),\n ),\n ApiDocExtractor.authOf(member, folder),\n mcpTool,\n ApiDocExtractor.invalidForMcpOf(member, folder),\n ApiDocExtractor.decoratorCall(member, AUTHORIZATION)?.arguments[0]?.getText(),\n ApiDocExtractor.maskLogOf(member),\n doc.description,\n doc.mcp,\n this.requestOf(member, methodName, resolver),\n streaming?.initialResponse ?? this.responseOf(member, methodName, resolver),\n streaming,\n ApiDocExtractor.decoratorCall(member, WpLocalOnly.name) !== undefined,\n );\n }\n\n /**\n * One REQUIRED positional argument of `@Endpoint`, folded to the string it denotes.\n *\n * Every one of the four is an enum member (`POST`, `READ`, `RPC`) as often as it is a literal,\n * and the folder resolves both — a document that printed `RPC` where the trigger goes would be\n * worse than no document. A missing one is a hard failure naming the position, because the\n * alternative is a document quietly missing a verb.\n */\n private requiredArgument(\n call: ts.CallExpression,\n methodName: string,\n index: number,\n folder: ConstantFolder,\n ): string {\n const argument = call.arguments[index];\n const what = ARGUMENT_NAMES[index];\n if (argument === undefined) {\n throw new ApiDocExtractionError(\n `@Endpoint on '${methodName}' declares no ${what}`,\n SourceLocation.of(call),\n \"Write all four: @Endpoint(POST, '/thing', READ, RPC).\",\n );\n }\n const value = folder.foldString(argument, `@Endpoint ${what} on '${methodName}'`);\n const allowed = ARGUMENT_VALUES[index]!;\n if (allowed.length > 0 && !allowed.includes(value)) {\n throw new ApiDocExtractionError(\n `@Endpoint on '${methodName}' declares ${what} '${value}', which is not one of ` +\n allowed.join(', '),\n SourceLocation.of(argument),\n `Use one of the exported constants: ${allowed.join(', ')}.`,\n );\n }\n return value;\n }\n\n /**\n * `@ApiType(...)` on the contract, folded to the real values.\n *\n * A value that is not one of the three documents is a HARD FAILURE rather than a silent drop: a\n * contract that named `CUSTOMER` by mistake would otherwise feed nothing, which looks exactly\n * like a contract somebody deliberately kept internal.\n */\n private declaredApiTypes(node: ts.Node, folder: ConstantFolder): readonly string[] {\n const call = ApiDocExtractor.decoratorCall(node, API_TYPE);\n if (call === undefined) {\n return DEFAULT_API_TYPES;\n }\n const declared = call.arguments.map((argument: ts.Expression) =>\n folder.foldString(argument, `@${API_TYPE} argument`),\n );\n for (const apiType of declared) {\n if (!API_TYPES.includes(apiType)) {\n throw new ApiDocExtractionError(\n `@${API_TYPE} names '${apiType}', which is not a generated document`,\n SourceLocation.of(call),\n `Use one of the exported constants: ${API_TYPES.join(', ')}.`,\n );\n }\n }\n return declared.length === 0 ? DEFAULT_API_TYPES : declared;\n }\n\n /** The FIRST parameter's declared type. An endpoint with no parameter has no request document. */\n private requestOf(\n member: ts.MethodDeclaration,\n methodName: string,\n resolver: TypeResolver,\n ): TypeRef | undefined {\n const parameter = member.parameters[0];\n if (parameter?.type === undefined) {\n return undefined;\n }\n return resolver.resolve(parameter.type, `${methodName}.request`);\n }\n\n /** The declared return type, unwrapped from `Promise<...>` by the resolver. */\n private responseOf(\n member: ts.MethodDeclaration,\n methodName: string,\n resolver: TypeResolver,\n ): TypeRef | undefined {\n if (member.type === undefined) {\n return undefined;\n }\n return resolver.resolve(member.type, `${methodName}.response`);\n }\n\n /** Read OR alternatives structurally rather than preserving an opaque WpAuth array. */\n // webpieces-disable no-function-outside-class -- private static declaration reader\n private static authOf(member: ts.Node, folder: ConstantFolder): DocumentedAuth | undefined {\n const publicCall = this.decoratorCall(member, WpAuthPublic.name);\n if (publicCall) {\n const reason = publicCall.arguments[0];\n if (!reason) throw new ApiDocExtractionError('Public authentication requires a reason', SourceLocation.of(publicCall), \"Declare @WpAuthPublic('reason').\");\n return new DocumentedAuth(folder.foldString(reason, 'public auth reason'), []);\n }\n const protectedCall = this.decoratorCall(member, WpAuth.name);\n if (!protectedCall) return undefined;\n const array = protectedCall.arguments[0];\n if (!array || !ts.isArrayLiteralExpression(array) || !array.elements.length) throw new ApiDocExtractionError('WpAuth requires a nonempty descriptor array', SourceLocation.of(protectedCall), 'Use @WpAuth([jwt(), oidc(...)]).');\n const methods: DocumentedAuthMethod[] = [];\n for (const element of array.elements) {\n if (!ts.isCallExpression(element)) throw new ApiDocExtractionError('Auth method is not a descriptor call', SourceLocation.of(element), 'Use canonical credential descriptors.');\n const name = this.canonicalCallName(element.expression);\n const kind = new Map([['jwt', 'jwt'], ['oidc', 'oidc'], ['sharedSecret', 'shared-secret'], ['webhook', 'webhook'], ['apiKey', 'apikey']]).get(name ?? '');\n if (!kind) throw new ApiDocExtractionError('Unknown authentication descriptor', SourceLocation.of(element), 'Import jwt/oidc/sharedSecret/webhook/apiKey from core-util.');\n methods.push(new DocumentedAuthMethod(kind, element.arguments.map((argument: ts.Expression) => argument.getText()), name === API_KEY_AUTH ? this.apiKeyOf(element, folder) : undefined));\n }\n return new DocumentedAuth(undefined, methods);\n }\n\n // webpieces-disable no-function-outside-class -- canonical import-aware AST name resolution\n static canonicalCallName(expression: ts.Expression): string | undefined {\n for (const statement of expression.getSourceFile().statements) {\n if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier)) continue;\n const module = statement.moduleSpecifier.text;\n if (!['@webpieces/core-util', '@webpieces/http-routing', '@webpieces/http-client-browser'].includes(module) && !module.endsWith('/core-util/src/http/decorators') && !module.endsWith('/core-util/src/http/auth-mode') && !module.endsWith('/core-util/src/http/authorization')) continue;\n const bindings = statement.importClause?.namedBindings;\n if (bindings && ts.isNamedImports(bindings) && ts.isIdentifier(expression)) {\n const imported = bindings.elements.find((entry: ts.ImportSpecifier) => entry.name.text === expression.text);\n if (imported) return imported.propertyName?.text ?? imported.name.text;\n }\n if (bindings && ts.isNamespaceImport(bindings) && ts.isPropertyAccessExpression(expression) && ts.isIdentifier(expression.expression) && expression.expression.text === bindings.name.text) return expression.name.text;\n }\n return undefined;\n }\n\n /**\n * `apiKey(regime, [{in: 'header', name: 'x-api-key', description: '…'}, …])`, parsed.\n *\n * A malformed declaration FAILS rather than yielding a half-parsed regime: the credentials are\n * what a published document's security block is made of, and a document that silently omitted\n * one would tell a partner they need fewer credentials than the running hook demands.\n */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static apiKeyOf(call: ts.CallExpression, folder: ConstantFolder): DocumentedApiKey {\n const regimeArgument = call.arguments[0];\n const credentialsArgument = call.arguments[1];\n if (regimeArgument === undefined || credentialsArgument === undefined) {\n throw new ApiDocExtractionError(\n 'apiKey(...) needs a regime AND its credentials',\n SourceLocation.of(call),\n \"Write both: apiKey('partner', [{ in: 'header', name: 'x-api-key' }]).\",\n );\n }\n const regime = folder.foldString(regimeArgument, 'apiKey(...) regime');\n // FOLLOW a name first: a credential list shared by every method of a contract is written\n // once as a `const` and named per method, which is better source than a copy per method.\n const credentialsLiteral = folder.follow(credentialsArgument);\n if (!ts.isArrayLiteralExpression(credentialsLiteral)) {\n throw new ApiDocExtractionError(\n 'apiKey(...) credentials is not an array literal',\n SourceLocation.of(credentialsArgument),\n 'Write the credentials as an array literal, inline or in a `const`; a value ' +\n 'assembled at runtime cannot appear in a published security scheme.',\n );\n }\n const credentials: DocumentedApiKeyCredential[] = [];\n for (const element of credentialsLiteral.elements) {\n credentials.push(ApiDocExtractor.credentialOf(element, folder));\n }\n return new DocumentedApiKey(regime, credentials);\n }\n\n /** ONE `{ in: …, name?: …, description?: … }` credential. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static credentialOf(\n expression: ts.Expression,\n folder: ConstantFolder,\n ): DocumentedApiKeyCredential {\n const element = folder.follow(expression);\n if (!ts.isObjectLiteralExpression(element)) {\n throw new ApiDocExtractionError(\n 'an apiKey(...) credential is not an object literal',\n SourceLocation.of(element),\n \"Write it inline: { in: 'header', name: 'x-api-key' }.\",\n );\n }\n const location = ApiDocExtractor.stringProperty(element, 'in', folder);\n if (location === undefined) {\n throw new ApiDocExtractionError(\n 'an apiKey(...) credential declares no `in`',\n SourceLocation.of(element),\n \"Say where it rides: `in: 'header'` with a name, or `in: 'bearer'`.\",\n );\n }\n return new DocumentedApiKeyCredential(\n location,\n ApiDocExtractor.stringProperty(element, 'name', folder),\n ApiDocExtractor.stringProperty(element, 'description', folder),\n );\n }\n\n /**\n * `@WpMcpTool('search_stores')` — the stable protocol name, which is the ONE fact the source\n * cannot otherwise state.\n *\n * Nothing else is read because nothing else is declared there any more (#984): the method's JSDoc\n * is the description for the agent and the partner alike, the three side-effect hints are computed\n * from the endpoint's `operation`, and `openWorldHint` is `@Endpoint`'s `openWorld`. See\n * {@link DocumentedMcpTool}.\n */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static mcpToolOf(\n member: ts.Node,\n folder: ConstantFolder,\n ): DocumentedMcpTool | undefined {\n const call = ApiDocExtractor.decoratorCall(member, MCP_TOOL);\n const argument = call?.arguments[0];\n if (argument === undefined) {\n return undefined;\n }\n return new DocumentedMcpTool(folder.tryFoldString(argument) ?? '');\n }\n\n /**\n * `@InvalidEndpointForMcp('<reason>')`'s reason, or undefined.\n *\n * A reason that will not fold is read as the EMPTY STRING rather than as \"no decorator\": the\n * method is still permanently outside MCP, and losing that fact because the argument was written\n * as a cross-module constant would silently put the endpoint back in the candidate set.\n */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static invalidForMcpOf(member: ts.Node, folder: ConstantFolder): string | undefined {\n const call = ApiDocExtractor.decoratorCall(member, MCP_INVALID);\n if (call === undefined) {\n return undefined;\n }\n const argument = call.arguments[0];\n return argument === undefined ? '' : (folder.tryFoldString(argument) ?? '');\n }\n\n /** `@MaskLog({ refreshToken: 'full' })` -> field name -> mask mode. */\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static maskLogOf(member: ts.Node): ReadonlyMap<string, string> {\n const fields = new Map<string, string>();\n const argument = ApiDocExtractor.decoratorCall(member, MASK_LOG)?.arguments[0];\n if (argument === undefined || !ts.isObjectLiteralExpression(argument)) {\n return fields;\n }\n for (const property of argument.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n ts.isStringLiteralLike(property.initializer)\n ) {\n fields.set(property.name.text, property.initializer.text);\n }\n }\n return fields;\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static booleanProperty(\n literal: ts.ObjectLiteralExpression | undefined,\n name: string,\n ): boolean {\n const value =\n literal === undefined ? undefined : ApiDocExtractor.findProperty(literal, name);\n return value?.kind === ts.SyntaxKind.TrueKeyword;\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static stringProperty(\n literal: ts.ObjectLiteralExpression | undefined,\n name: string,\n folder: ConstantFolder,\n ): string | undefined {\n const value =\n literal === undefined ? undefined : ApiDocExtractor.findProperty(literal, name);\n return value === undefined ? undefined : folder.tryFoldString(value);\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static findProperty(\n literal: ts.ObjectLiteralExpression,\n name: string,\n ): ts.Expression | undefined {\n for (const property of literal.properties) {\n if (\n ts.isPropertyAssignment(property) &&\n (ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)) &&\n property.name.text === name\n ) {\n return property.initializer;\n }\n }\n return undefined;\n }\n\n // webpieces-disable no-function-outside-class -- private static reader of this class\n private static decoratorCall(\n node: ts.Node,\n decoratorName: string,\n ): ts.CallExpression | undefined {\n const decorators = ts.canHaveDecorators(node) ? (ts.getDecorators(node) ?? []) : [];\n for (const decorator of decorators) {\n const call = decorator.expression;\n if (\n ts.isCallExpression(call) &&\n ApiDocExtractor.canonicalCallName(call.expression) === decoratorName\n ) {\n return call;\n }\n }\n return undefined;\n }\n}\n"]}
|
package/src/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
export { ApiDocExtractor } from './extract/ApiDocExtractor';
|
|
12
12
|
export { ApiDocExtractionError } from './extract/ApiDocExtractionError';
|
|
13
13
|
export { DeclaringPackage, PackageOfFile } from './extract/PackageOfFile';
|
|
14
|
-
export { ApiComponentsModel, ApiDocModel, DocumentedApiKey, DocumentedApiKeyCredential, DocumentedAuth, DocumentedEndpoint, DocumentedEndpointOptions, DocumentedField, DocumentedMcpTool, DocumentedType, TypeNameCollision, UnionDiscriminator, UnmappedType, } from './model/ApiDocModel';
|
|
14
|
+
export { ApiComponentsModel, ApiDocModel, DocumentedApiKey, DocumentedApiKeyCredential, DocumentedAuth, DocumentedAuthMethod, DocumentedEndpoint, DocumentedEndpointOptions, DocumentedField, DocumentedMcpTool, DocumentedType, TypeNameCollision, UnionDiscriminator, UnmappedType, } from './model/ApiDocModel';
|
|
15
15
|
export { McpRenderError } from './render/McpRenderError';
|
|
16
16
|
export { McpCatalogRender, McpSchemaRenderer, SkippedMcpTool } from './render/McpSchemaRenderer';
|
|
17
17
|
export { TypeRef } from './model/TypeRef';
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.StreamingSchemaRenderer = exports.TypeRef = exports.SkippedMcpTool = exports.McpSchemaRenderer = exports.McpCatalogRender = exports.McpRenderError = exports.UnmappedType = exports.UnionDiscriminator = exports.TypeNameCollision = exports.DocumentedType = exports.DocumentedMcpTool = exports.DocumentedField = exports.DocumentedEndpointOptions = exports.DocumentedEndpoint = exports.DocumentedAuth = exports.DocumentedApiKeyCredential = exports.DocumentedApiKey = exports.ApiDocModel = exports.ApiComponentsModel = exports.PackageOfFile = exports.DeclaringPackage = exports.ApiDocExtractionError = exports.ApiDocExtractor = void 0;
|
|
3
|
+
exports.StreamingSchemaRenderer = exports.TypeRef = exports.SkippedMcpTool = exports.McpSchemaRenderer = exports.McpCatalogRender = exports.McpRenderError = exports.UnmappedType = exports.UnionDiscriminator = exports.TypeNameCollision = exports.DocumentedType = exports.DocumentedMcpTool = exports.DocumentedField = exports.DocumentedEndpointOptions = exports.DocumentedEndpoint = exports.DocumentedAuthMethod = exports.DocumentedAuth = exports.DocumentedApiKeyCredential = exports.DocumentedApiKey = exports.ApiDocModel = exports.ApiComponentsModel = exports.PackageOfFile = exports.DeclaringPackage = exports.ApiDocExtractionError = exports.ApiDocExtractor = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* `@webpieces/api-doc-model` — read a webpieces API contract with the TypeScript compiler API and
|
|
6
6
|
* produce ONE in-memory {@link ApiDocModel}.
|
|
@@ -24,6 +24,7 @@ Object.defineProperty(exports, "ApiDocModel", { enumerable: true, get: function
|
|
|
24
24
|
Object.defineProperty(exports, "DocumentedApiKey", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedApiKey; } });
|
|
25
25
|
Object.defineProperty(exports, "DocumentedApiKeyCredential", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedApiKeyCredential; } });
|
|
26
26
|
Object.defineProperty(exports, "DocumentedAuth", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedAuth; } });
|
|
27
|
+
Object.defineProperty(exports, "DocumentedAuthMethod", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedAuthMethod; } });
|
|
27
28
|
Object.defineProperty(exports, "DocumentedEndpoint", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedEndpoint; } });
|
|
28
29
|
Object.defineProperty(exports, "DocumentedEndpointOptions", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedEndpointOptions; } });
|
|
29
30
|
Object.defineProperty(exports, "DocumentedField", { enumerable: true, get: function () { return ApiDocModel_1.DocumentedField; } });
|
package/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/docs/api-doc-model/src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,6DAA4D;AAAnD,kHAAA,eAAe,OAAA;AACxB,yEAAwE;AAA/D,8HAAA,qBAAqB,OAAA;AAC9B,yDAA0E;AAAjE,iHAAA,gBAAgB,OAAA;AAAE,8GAAA,aAAa,OAAA;AACxC,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../packages/docs/api-doc-model/src/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;GASG;AACH,6DAA4D;AAAnD,kHAAA,eAAe,OAAA;AACxB,yEAAwE;AAA/D,8HAAA,qBAAqB,OAAA;AAC9B,yDAA0E;AAAjE,iHAAA,gBAAgB,OAAA;AAAE,8GAAA,aAAa,OAAA;AACxC,mDAe6B;AAdzB,iHAAA,kBAAkB,OAAA;AAClB,0GAAA,WAAW,OAAA;AACX,+GAAA,gBAAgB,OAAA;AAChB,yHAAA,0BAA0B,OAAA;AAC1B,6GAAA,cAAc,OAAA;AACd,mHAAA,oBAAoB,OAAA;AACpB,iHAAA,kBAAkB,OAAA;AAClB,wHAAA,yBAAyB,OAAA;AACzB,8GAAA,eAAe,OAAA;AACf,gHAAA,iBAAiB,OAAA;AACjB,6GAAA,cAAc,OAAA;AACd,gHAAA,iBAAiB,OAAA;AACjB,iHAAA,kBAAkB,OAAA;AAClB,2GAAA,YAAY,OAAA;AAEhB,0DAAyD;AAAhD,gHAAA,cAAc,OAAA;AACvB,gEAAiG;AAAxF,qHAAA,gBAAgB,OAAA;AAAE,sHAAA,iBAAiB,OAAA;AAAE,mHAAA,cAAc,OAAA;AAC5D,2CAA0C;AAAjC,kGAAA,OAAO,OAAA;AAEhB,4EAA2E;AAAlE,kIAAA,uBAAuB,OAAA","sourcesContent":["/**\n * `@webpieces/api-doc-model` — read a webpieces API contract with the TypeScript compiler API and\n * produce ONE in-memory {@link ApiDocModel}.\n *\n * This is the single extraction pass both the OpenAPI documents and the MCP tool list (#982) are\n * rendered from. It emits nothing itself, and it takes every decorator NAME it matches on from the\n * real `@webpieces/core-util` symbol — so renaming a decorator is a compile error here rather than a\n * literal that quietly stops matching and empties a document (issue #1001). See\n * `responsibilities.md` for why that import is not the coupling it looks like.\n */\nexport { ApiDocExtractor } from './extract/ApiDocExtractor';\nexport { ApiDocExtractionError } from './extract/ApiDocExtractionError';\nexport { DeclaringPackage, PackageOfFile } from './extract/PackageOfFile';\nexport {\n ApiComponentsModel,\n ApiDocModel,\n DocumentedApiKey,\n DocumentedApiKeyCredential,\n DocumentedAuth,\n DocumentedAuthMethod,\n DocumentedEndpoint,\n DocumentedEndpointOptions,\n DocumentedField,\n DocumentedMcpTool,\n DocumentedType,\n TypeNameCollision,\n UnionDiscriminator,\n UnmappedType,\n} from './model/ApiDocModel';\nexport { McpRenderError } from './render/McpRenderError';\nexport { McpCatalogRender, McpSchemaRenderer, SkippedMcpTool } from './render/McpSchemaRenderer';\nexport { TypeRef } from './model/TypeRef';\nexport type { PrimitiveKind, TypeRefKind } from './model/TypeRef';\nexport { StreamingSchemaRenderer } from './render/StreamingSchemaRenderer';\n"]}
|
|
@@ -278,7 +278,7 @@ export declare class DocumentedApiKeyCredential {
|
|
|
278
278
|
/** The prose a docs site renders on its authorization card. */
|
|
279
279
|
description: string | undefined);
|
|
280
280
|
}
|
|
281
|
-
/**
|
|
281
|
+
/** `apiKey(regime, credentials)`, parsed. See {@link DocumentedApiKeyCredential}. */
|
|
282
282
|
export declare class DocumentedApiKey {
|
|
283
283
|
readonly regime: string;
|
|
284
284
|
/**
|
|
@@ -293,31 +293,17 @@ export declare class DocumentedApiKey {
|
|
|
293
293
|
*/
|
|
294
294
|
credentials: readonly DocumentedApiKeyCredential[]);
|
|
295
295
|
}
|
|
296
|
-
/**
|
|
297
|
-
export declare class
|
|
298
|
-
|
|
299
|
-
readonly decorator: string;
|
|
300
|
-
/** Every argument's text, verbatim and in order. Empty for `@WpAuthPublic()`. */
|
|
296
|
+
/** Structurally extracted credential alternatives, with OR semantics. */
|
|
297
|
+
export declare class DocumentedAuthMethod {
|
|
298
|
+
readonly kind: string;
|
|
301
299
|
readonly argumentTexts: readonly string[];
|
|
302
|
-
/**
|
|
303
|
-
* The PARSED api-key declaration, set only for `@WpAuthApiKey`. Every other decorator's
|
|
304
|
-
* argument is prose or a role list that a document quotes rather than restructures, so
|
|
305
|
-
* {@link argumentTexts} is all they need — see {@link DocumentedApiKeyCredential} for why
|
|
306
|
-
* this one is different.
|
|
307
|
-
*/
|
|
308
300
|
readonly apiKey: DocumentedApiKey | undefined;
|
|
309
|
-
constructor(
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
* The PARSED api-key declaration, set only for `@WpAuthApiKey`. Every other decorator's
|
|
316
|
-
* argument is prose or a role list that a document quotes rather than restructures, so
|
|
317
|
-
* {@link argumentTexts} is all they need — see {@link DocumentedApiKeyCredential} for why
|
|
318
|
-
* this one is different.
|
|
319
|
-
*/
|
|
320
|
-
apiKey: DocumentedApiKey | undefined);
|
|
301
|
+
constructor(kind: string, argumentTexts: readonly string[], apiKey: DocumentedApiKey | undefined);
|
|
302
|
+
}
|
|
303
|
+
export declare class DocumentedAuth {
|
|
304
|
+
readonly publicReason: string | undefined;
|
|
305
|
+
readonly methods: readonly DocumentedAuthMethod[];
|
|
306
|
+
constructor(publicReason: string | undefined, methods: readonly DocumentedAuthMethod[]);
|
|
321
307
|
}
|
|
322
308
|
/** One `@Endpoint` method of one contract. */
|
|
323
309
|
export declare class DocumentedEndpoint {
|
|
@@ -359,8 +345,8 @@ export declare class DocumentedEndpoint {
|
|
|
359
345
|
* on every run.
|
|
360
346
|
*/
|
|
361
347
|
readonly invalidForMcp: string | undefined;
|
|
362
|
-
/**
|
|
363
|
-
readonly
|
|
348
|
+
/** The common @WpAuthorization declaration, shared by every surface. */
|
|
349
|
+
readonly authorizationText: string | undefined;
|
|
364
350
|
/** `@MaskLog({...})` — field name -> mask mode. */
|
|
365
351
|
readonly maskLog: ReadonlyMap<string, string>;
|
|
366
352
|
readonly description: string;
|
|
@@ -369,6 +355,7 @@ export declare class DocumentedEndpoint {
|
|
|
369
355
|
readonly request: TypeRef | undefined;
|
|
370
356
|
readonly response: TypeRef | undefined;
|
|
371
357
|
readonly streaming?: DocumentedStreaming | undefined;
|
|
358
|
+
readonly localOnly: boolean;
|
|
372
359
|
constructor(methodName: string,
|
|
373
360
|
/**
|
|
374
361
|
* `GET` or `POST`, constant-folded from `@Endpoint`'s FIRST argument. A document cannot be
|
|
@@ -404,12 +391,12 @@ export declare class DocumentedEndpoint {
|
|
|
404
391
|
* on every run.
|
|
405
392
|
*/
|
|
406
393
|
invalidForMcp: string | undefined,
|
|
407
|
-
/**
|
|
408
|
-
|
|
394
|
+
/** The common @WpAuthorization declaration, shared by every surface. */
|
|
395
|
+
authorizationText: string | undefined,
|
|
409
396
|
/** `@MaskLog({...})` — field name -> mask mode. */
|
|
410
397
|
maskLog: ReadonlyMap<string, string>, description: string,
|
|
411
398
|
/** The `@mcp` override. See {@link DocumentedField.mcpDescription}. */
|
|
412
|
-
mcpDescription: string | undefined, request: TypeRef | undefined, response: TypeRef | undefined, streaming?: DocumentedStreaming | undefined);
|
|
399
|
+
mcpDescription: string | undefined, request: TypeRef | undefined, response: TypeRef | undefined, streaming?: DocumentedStreaming | undefined, localOnly?: boolean);
|
|
413
400
|
}
|
|
414
401
|
/** ONE extraction pass over ONE contract file. Both #982's renderers read exactly this. */
|
|
415
402
|
export declare class ApiDocModel {
|
package/src/model/ApiDocModel.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApiComponentsModel = exports.ApiDocModel = exports.DocumentedEndpoint = exports.DocumentedAuth = exports.DocumentedApiKey = exports.DocumentedApiKeyCredential = exports.DocumentedMcpTool = exports.DocumentedEndpointOptions = exports.TypeNameCollision = exports.DocumentedType = exports.DocumentedField = exports.UnionDiscriminator = exports.UnmappedType = void 0;
|
|
3
|
+
exports.ApiComponentsModel = exports.ApiDocModel = exports.DocumentedEndpoint = exports.DocumentedAuth = exports.DocumentedAuthMethod = exports.DocumentedApiKey = exports.DocumentedApiKeyCredential = exports.DocumentedMcpTool = exports.DocumentedEndpointOptions = exports.TypeNameCollision = exports.DocumentedType = exports.DocumentedField = exports.UnionDiscriminator = exports.UnmappedType = void 0;
|
|
4
4
|
/**
|
|
5
5
|
* The model classes. Every one of them is a CLASS with an explicit constructor per `CLAUDE.md` §1 —
|
|
6
6
|
* these are data-only structures, and a renderer (#982) builds nothing, it only reads.
|
|
@@ -266,7 +266,7 @@ class DocumentedApiKeyCredential {
|
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
268
|
exports.DocumentedApiKeyCredential = DocumentedApiKeyCredential;
|
|
269
|
-
/**
|
|
269
|
+
/** `apiKey(regime, credentials)`, parsed. See {@link DocumentedApiKeyCredential}. */
|
|
270
270
|
class DocumentedApiKey {
|
|
271
271
|
regime;
|
|
272
272
|
credentials;
|
|
@@ -281,28 +281,26 @@ class DocumentedApiKey {
|
|
|
281
281
|
}
|
|
282
282
|
}
|
|
283
283
|
exports.DocumentedApiKey = DocumentedApiKey;
|
|
284
|
-
/**
|
|
285
|
-
class
|
|
286
|
-
|
|
284
|
+
/** Structurally extracted credential alternatives, with OR semantics. */
|
|
285
|
+
class DocumentedAuthMethod {
|
|
286
|
+
kind;
|
|
287
287
|
argumentTexts;
|
|
288
288
|
apiKey;
|
|
289
|
-
constructor(
|
|
290
|
-
|
|
291
|
-
decorator,
|
|
292
|
-
/** Every argument's text, verbatim and in order. Empty for `@WpAuthPublic()`. */
|
|
293
|
-
argumentTexts,
|
|
294
|
-
/**
|
|
295
|
-
* The PARSED api-key declaration, set only for `@WpAuthApiKey`. Every other decorator's
|
|
296
|
-
* argument is prose or a role list that a document quotes rather than restructures, so
|
|
297
|
-
* {@link argumentTexts} is all they need — see {@link DocumentedApiKeyCredential} for why
|
|
298
|
-
* this one is different.
|
|
299
|
-
*/
|
|
300
|
-
apiKey) {
|
|
301
|
-
this.decorator = decorator;
|
|
289
|
+
constructor(kind, argumentTexts, apiKey) {
|
|
290
|
+
this.kind = kind;
|
|
302
291
|
this.argumentTexts = argumentTexts;
|
|
303
292
|
this.apiKey = apiKey;
|
|
304
293
|
}
|
|
305
294
|
}
|
|
295
|
+
exports.DocumentedAuthMethod = DocumentedAuthMethod;
|
|
296
|
+
class DocumentedAuth {
|
|
297
|
+
publicReason;
|
|
298
|
+
methods;
|
|
299
|
+
constructor(publicReason, methods) {
|
|
300
|
+
this.publicReason = publicReason;
|
|
301
|
+
this.methods = methods;
|
|
302
|
+
}
|
|
303
|
+
}
|
|
306
304
|
exports.DocumentedAuth = DocumentedAuth;
|
|
307
305
|
/** One `@Endpoint` method of one contract. */
|
|
308
306
|
class DocumentedEndpoint {
|
|
@@ -317,13 +315,14 @@ class DocumentedEndpoint {
|
|
|
317
315
|
auth;
|
|
318
316
|
mcpTool;
|
|
319
317
|
invalidForMcp;
|
|
320
|
-
|
|
318
|
+
authorizationText;
|
|
321
319
|
maskLog;
|
|
322
320
|
description;
|
|
323
321
|
mcpDescription;
|
|
324
322
|
request;
|
|
325
323
|
response;
|
|
326
324
|
streaming;
|
|
325
|
+
localOnly;
|
|
327
326
|
constructor(methodName,
|
|
328
327
|
/**
|
|
329
328
|
* `GET` or `POST`, constant-folded from `@Endpoint`'s FIRST argument. A document cannot be
|
|
@@ -359,12 +358,12 @@ class DocumentedEndpoint {
|
|
|
359
358
|
* on every run.
|
|
360
359
|
*/
|
|
361
360
|
invalidForMcp,
|
|
362
|
-
/**
|
|
363
|
-
|
|
361
|
+
/** The common @WpAuthorization declaration, shared by every surface. */
|
|
362
|
+
authorizationText,
|
|
364
363
|
/** `@MaskLog({...})` — field name -> mask mode. */
|
|
365
364
|
maskLog, description,
|
|
366
365
|
/** The `@mcp` override. See {@link DocumentedField.mcpDescription}. */
|
|
367
|
-
mcpDescription, request, response, streaming) {
|
|
366
|
+
mcpDescription, request, response, streaming, localOnly = false) {
|
|
368
367
|
this.methodName = methodName;
|
|
369
368
|
this.httpMethod = httpMethod;
|
|
370
369
|
this.path = path;
|
|
@@ -376,13 +375,14 @@ class DocumentedEndpoint {
|
|
|
376
375
|
this.auth = auth;
|
|
377
376
|
this.mcpTool = mcpTool;
|
|
378
377
|
this.invalidForMcp = invalidForMcp;
|
|
379
|
-
this.
|
|
378
|
+
this.authorizationText = authorizationText;
|
|
380
379
|
this.maskLog = maskLog;
|
|
381
380
|
this.description = description;
|
|
382
381
|
this.mcpDescription = mcpDescription;
|
|
383
382
|
this.request = request;
|
|
384
383
|
this.response = response;
|
|
385
384
|
this.streaming = streaming;
|
|
385
|
+
this.localOnly = localOnly;
|
|
386
386
|
}
|
|
387
387
|
}
|
|
388
388
|
exports.DocumentedEndpoint = DocumentedEndpoint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiDocModel.js","sourceRoot":"","sources":["../../../../../../packages/docs/api-doc-model/src/model/ApiDocModel.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;GAQG;AAEH,qGAAqG;AACrG,MAAa,YAAY;IAGR;IAEA;IAEA;IANb;IACI,qEAAqE;IAC5D,QAAgB;IACzB,sDAAsD;IAC7C,QAAgB;IACzB,wEAAwE;IAC/D,MAAc;QAJd,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,WAAM,GAAN,MAAM,CAAQ;IACxB,CAAC;CACP;AATD,oCASC;AAED,wGAAwG;AACxG,MAAa,kBAAkB;IAGd;IAQA;IAVb;IACI,yCAAyC;IAChC,YAAoB;IAC7B;;;;;;OAMG;IACM,YAAoD;QARpD,iBAAY,GAAZ,YAAY,CAAQ;QAQpB,iBAAY,GAAZ,YAAY,CAAwC;IAC9D,CAAC;CACP;AAbD,gDAaC;AAED,4BAA4B;AAC5B,MAAa,eAAe;IAEX;IACA;IAMA;IAEA;IAEA;IAMA;IAEA;IAEA;IAEA;IAUA;IAUA;IA5Cb,YACa,IAAY,EACZ,IAAa;IACtB;;;;OAIG;IACM,QAAiB;IAC1B,sFAAsF;IAC7E,QAAiB;IAC1B,uEAAuE;IAC9D,WAAmB;IAC5B;;;;OAIG;IACM,cAAkC;IAC3C,8EAA8E;IACrE,MAA0B;IACnC,2EAA2E;IAClE,GAAuB;IAChC,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AyB;QACjC,eAAU,GAAV,UAAU,CAA8B;IAClD,CAAC;CACP;AAbD,gDAaC","sourcesContent":["import { TypeRef } from './TypeRef';\nimport type { DocumentedStreaming } from './DocumentedStreaming';\n\n/**\n * The model classes. Every one of them is a CLASS with an explicit constructor per `CLAUDE.md` §1 —\n * these are data-only structures, and a renderer (#982) builds nothing, it only reads.\n *\n * Nothing in this file imports anything but {@link TypeRef}: the package depends on `typescript` and\n * NOTHING else, so it can be pointed at any upstream project's contract. One app-specific import\n * here would end that, which is why `responsibilities.md` states the constraint rather than leaving\n * it to be discovered.\n */\n\n/** A type the extractor could not represent. RECORDED, never dropped — #982's guard needs a name. */\nexport class UnmappedType {\n constructor(\n /** The verbatim TypeScript type text, e.g. `Map<string, Widget>`. */\n readonly typeText: string,\n /** Pointer-style location: `path/to/File.ts:12:5`. */\n readonly location: string,\n /** Why it could not be mapped, in one sentence a renderer can print. */\n readonly reason: string,\n ) {}\n}\n\n/** The DERIVED discriminator of a union — never invented, only observed. See {@link DocumentedType}. */\nexport class UnionDiscriminator {\n constructor(\n /** The property every branch carries. */\n readonly propertyName: string,\n /**\n * branch type name -> EVERY string value that branch's property may hold. One value for\n * `mode: 'fixed'` / `mode: VoiceMode.FIXED`; several for `mode: 'a' | 'b'` or\n * `mode: VoiceMode.A | VoiceMode.B` (#1023). No value appears under two branches — that is\n * what makes the property a discriminator, and an OpenAPI `mapping` point several values at\n * one schema.\n */\n readonly branchValues: ReadonlyMap<string, readonly string[]>,\n ) {}\n}\n\n/** One field of one DTO. */\nexport class DocumentedField {\n constructor(\n readonly name: string,\n readonly type: TypeRef,\n /**\n * OPTIONAL (`name?: string`) — the property may be ABSENT. Distinguished from\n * {@link nullable} on purpose: `{}` and `{name: null}` are different wire documents, and a\n * renderer that conflates them emits a schema that rejects one of them.\n */\n readonly optional: boolean,\n /** NULLABLE (`name: string | null`) — the property is present and may hold `null`. */\n readonly nullable: boolean,\n /** The JSDoc body, links flattened. Empty string when undocumented. */\n readonly description: string,\n /**\n * The `@mcp` block tag — an OPTIONAL agent-facing override. Undefined means \"no override\",\n * and a renderer falls back to {@link description}; the fallback is NOT applied here so a\n * renderer can tell a deliberate agent-facing sentence from a reused human one.\n */\n readonly mcpDescription: string | undefined,\n /** The `@format` tag, lifted onto the SCALAR (on an array, onto the ITEM). */\n readonly format: string | undefined,\n /** `@WpMin(n)` — numeric fields only; anything else is a build failure. */\n readonly min: number | undefined,\n /** `@WpMax(n)` — numeric fields only; anything else is a build failure. */\n readonly max: number | undefined,\n /**\n * The `@mcpHeader <token>` JSDoc tag — the MCP 2026 SEP-2243 header this PRIMITIVE field is\n * mirrored into (`Mcp-Param-{token}`). Undefined for every field that is not mirrored, which\n * is nearly all of them.\n *\n * It is documentation and therefore lives in JSDoc, next to the sentence describing the\n * field, rather than in a decorator argument — and since #984 it is the only spelling of the\n * fact at all.\n */\n readonly mcpHeader: string | undefined,\n /**\n * Pointer-style `path/to/File.ts:12:5` for the property declaration itself.\n *\n * A renderer never needs it — it publishes a schema, not a file offset. The build RULES do:\n * `api-rules-for-openapi` refuses a field whose value type is `unknown`, and a refusal that\n * cannot say WHERE costs the author a grep over every DTO the contract reaches. It is\n * carried on the FIELD rather than recomputed because only the extractor still has the\n * syntax node, and a second reader deriving it would be a second answer to \"where is this\".\n */\n readonly location: string,\n ) {}\n}\n\n/** One named type reachable from a contract: an object DTO, a string-literal enum, or a union. */\nexport class DocumentedType {\n constructor(\n readonly name: string,\n readonly description: string,\n /** Object shape. Empty for an enum or a union. */\n readonly fields: readonly DocumentedField[],\n /** Set for a string-literal union that has a name. */\n readonly enumValues: readonly string[],\n /** Set for a union of named object types. */\n readonly unionRefNames: readonly string[],\n /** Set only when EVERY branch carries the same property typed as one string literal. */\n readonly discriminator: UnionDiscriminator | undefined,\n /** An index signature (`[k: string]: X`) — the OPEN-MAP half of an object that also has fields. */\n readonly indexSignatureValue: TypeRef | undefined,\n /**\n * The npm package whose source DECLARES this type — the nearest `package.json` above the\n * declaring file (#1058). It decides which OpenAPI document OWNS the schema: a contract\n * document defines the schemas its own package declares and `$ref`s every other one into\n * that package's `components.openapi.json`. Undefined when the file belongs to no package.\n *\n * The MCP projection ignores it: a tool schema is always fully inlined.\n */\n readonly packageName: string | undefined,\n /** Pointer-style `path/to/File.ts:12:5` of the declaration, for a refusal that names it. */\n readonly location: string,\n ) {}\n\n /**\n * The key this type is registered under in {@link ApiDocModel.types} and named by every\n * {@link TypeRef.refName}: the bare name for a type its model's HOME package declares, and\n * `<package>:<name>` for every other one, so two packages' same-named types are two entries.\n */\n // webpieces-disable no-function-outside-class -- static helper on the class whose key it computes\n static keyOf(\n name: string,\n packageName: string | undefined,\n homePackage: string | undefined,\n ): string {\n return packageName === homePackage ? name : `${packageName ?? '<no package>'}:${name}`;\n }\n}\n\n/**\n * Two DIFFERENT declarations of one name in one package, both reached by one model (#1058).\n *\n * Recorded rather than thrown, because the MCP projection inlines every schema and never cared which\n * of the two it was handed — it keeps rendering exactly as before. An OpenAPI document defines each\n * schema of a package under its bare name, so it REFUSES a model carrying one of these: the second\n * declaration would be published as the first one's shape.\n */\nexport class TypeNameCollision {\n constructor(\n readonly name: string,\n readonly packageName: string | undefined,\n /** Where the declaration that won the name is. */\n readonly firstLocation: string,\n /** Where the declaration that was conflated into it is. */\n readonly secondLocation: string,\n ) {}\n}\n\n/** `@Endpoint(httpMethod, path, operation, kind, options?)`'s LAST argument, as a document sees it. */\nexport class DocumentedEndpointOptions {\n constructor(\n readonly formPost: boolean,\n /** `calledBy` — REQUIRED by the decorator for `external`, absent otherwise. */\n readonly calledBy: string | undefined,\n readonly callerKind: string | undefined,\n ) {}\n}\n\n/**\n * The `@WpMcpTool('search_stores')` declaration, when the method carries one — the ONE fact the\n * source cannot otherwise state, and nothing else.\n *\n * `description` used to sit on the decorator too. The method's JSDoc is the description, for the\n * agent and for the partner alike, byte-identical: two authored copies of one paragraph is the\n * two-spellings shim, and its failure mode is concrete — the partner reads the JSDoc in the OpenAPI\n * document while the agent reads the decorator string in `tools/list`, and they drift the first time\n * somebody edits one. #984 deleted it, which left the decorator holding one field, so it takes the\n * name as a plain string.\n *\n * The three side-effect hints are COMPUTED from the endpoint's `operation` by `mcpHintsForOperation`\n * in `@webpieces/core-util`, which is the one place that mapping lives — `READ | WRITE_IDEMPOTENT |\n * WRITE` already says whether repeating a call is safe, so a hand-declared hint would be a second\n * answer to a question the contract has answered. `openWorldHint` is `@Endpoint`'s `openWorld`.\n */\nexport class DocumentedMcpTool {\n constructor(\n /**\n * The STABLE protocol name. Deliberately independent of the method name, because renaming a\n * method must not break a saved agent workflow.\n */\n readonly name: string,\n ) {}\n}\n\n/**\n * ONE credential of an api-key regime, PARSED — `{ in: 'header', name: 'x-api-key' }` or\n * `{ in: 'bearer' }`.\n *\n * Parsed rather than left as source text because it is the one auth argument a renderer must turn\n * into a STRUCTURE: an OpenAPI `securityScheme` is `{type: apiKey, in, name}` or\n * `{type: http, scheme: bearer}`, and those are different documents. A renderer handed the string\n * `\"{ in: 'header', name: 'x-api-key' }\"` would have to parse TypeScript to emit either one, which\n * is this package's job and not a renderer's.\n */\nexport class DocumentedApiKeyCredential {\n constructor(\n /** `header` or `bearer`, verbatim from the declaration. */\n readonly location: string,\n /** The header name. Undefined for `bearer`, whose location IS `Authorization`. */\n readonly name: string | undefined,\n /** The prose a docs site renders on its authorization card. */\n readonly description: string | undefined,\n ) {}\n}\n\n/** `@WpAuthApiKey(regime, credentials)`, parsed. See {@link DocumentedApiKeyCredential}. */\nexport class DocumentedApiKey {\n constructor(\n readonly regime: string,\n /**\n * Every credential the regime requires, IN DECLARATION ORDER. They are an AND — all of them\n * are presented together — and the order is the order a published document lists them in.\n */\n readonly credentials: readonly DocumentedApiKeyCredential[],\n ) {}\n}\n\n/** WHICH credential an endpoint demands — `@WpAuthPublic`, `@WpAuthJwt`, … — verbatim from the source. */\nexport class DocumentedAuth {\n constructor(\n /** The decorator name as written, e.g. `WpAuthJwt`. */\n readonly decorator: string,\n /** Every argument's text, verbatim and in order. Empty for `@WpAuthPublic()`. */\n readonly argumentTexts: readonly string[],\n /**\n * The PARSED api-key declaration, set only for `@WpAuthApiKey`. Every other decorator's\n * argument is prose or a role list that a document quotes rather than restructures, so\n * {@link argumentTexts} is all they need — see {@link DocumentedApiKeyCredential} for why\n * this one is different.\n */\n readonly apiKey: DocumentedApiKey | undefined,\n ) {}\n}\n\n/** One `@Endpoint` method of one contract. */\nexport class DocumentedEndpoint {\n constructor(\n readonly methodName: string,\n /**\n * `GET` or `POST`, constant-folded from `@Endpoint`'s FIRST argument. A document cannot be\n * written without it — the verb is the key an operation hangs under in `paths`.\n */\n readonly httpMethod: string,\n /** The path, constant-folded. A const that cannot be folded is a HARD FAILURE, never a guess. */\n readonly path: string,\n /**\n * `read` | `write-idempotent` | `write`, verbatim. The SIDE-EFFECT contract, which is\n * independent of the verb: webpieces POSTs a read. A renderer publishes it rather than\n * inferring safety from the verb, which for this framework would be wrong.\n */\n readonly operation: string,\n /** `rpc` | `cloudtasks` | `cron` | `external`, verbatim — this package invents no taxonomy. */\n readonly kind: string,\n /**\n * `{ hidden: true }` — this method is absent from the CUSTOMER document. It stays in the\n * private one, and in the MCP one when it is a tool. WHICH documents the CONTRACT feeds at\n * all is a different, class-level decision; see {@link ApiDocModel.apiTypes}.\n */\n readonly hidden: boolean,\n /** `{ openWorld: true }` — this operation may touch systems outside this service. */\n readonly openWorld: boolean,\n readonly options: DocumentedEndpointOptions,\n readonly auth: DocumentedAuth | undefined,\n readonly mcpTool: DocumentedMcpTool | undefined,\n /**\n * `@InvalidEndpointForMcp('<reason>')`'s reason, when the method carries one — this endpoint\n * is PERMANENTLY outside MCP and was never a tool candidate.\n *\n * Distinct from \"has no `@WpMcpTool`\", which only says \"not a tool yet\". A renderer must not\n * report one of these as a SKIPPED tool, and `api-rules-for-mcp` stops asking a method with\n * one whether it could be served — the declaration is the answer. Carrying the reason rather\n * than a boolean is the point: the rule restates the list of exclusions with their arguments\n * on every run.\n */\n readonly invalidForMcp: string | undefined,\n /** `@WpMcpAuthJwt(...)`'s argument text, when present. */\n readonly mcpAuthText: string | undefined,\n /** `@MaskLog({...})` — field name -> mask mode. */\n readonly maskLog: ReadonlyMap<string, string>,\n readonly description: string,\n /** The `@mcp` override. See {@link DocumentedField.mcpDescription}. */\n readonly mcpDescription: string | undefined,\n readonly request: TypeRef | undefined,\n readonly response: TypeRef | undefined,\n readonly streaming?: DocumentedStreaming,\n ) {}\n}\n\n/** ONE extraction pass over ONE contract file. Both #982's renderers read exactly this. */\nexport class ApiDocModel {\n constructor(\n /** The contract class name, e.g. `SaveApi`. */\n readonly contractName: string,\n /**\n * WHICH generated documents this contract feeds — `svc-to-svc`, `external-customer`, `mcp`,\n * verbatim from `@ApiType(...)`, defaulting to `svc-to-svc` alone when it declares nothing.\n *\n * A named list rather than a falsy default, because the grant has to be the TOKEN: a default\n * that reached customers would publish a contract whose author typed nothing about it.\n */\n readonly apiTypes: readonly string[],\n /** `@ApiPath(...)`, constant-folded. */\n readonly basePath: string,\n /** The JSDoc on the contract class, links flattened. */\n readonly description: string,\n readonly endpoints: readonly DocumentedEndpoint[],\n /** Every named type reachable from the endpoints, by name. A `$ref` target for a renderer. */\n readonly types: ReadonlyMap<string, DocumentedType>,\n /** Everything that could not be represented — recorded, not dropped. */\n readonly unmapped: readonly UnmappedType[],\n /** Same-named, different declarations in one package — see {@link TypeNameCollision}. */\n readonly collisions: readonly TypeNameCollision[],\n ) {}\n}\n\n/**\n * ONE extraction pass over a DTO LIBRARY: every type it exports and declares, for the\n * components-only OpenAPI document it publishes (#1058). Data-only.\n *\n * A components document contains EVERY exported type the library declares — not only the ones some\n * contract reaches — so its contents are a property of the library alone and do not move when a\n * downstream contract changes.\n */\nexport class ApiComponentsModel {\n constructor(\n /** The library's package name — every type in {@link exported} is declared by it. */\n readonly packageName: string,\n /** The library's package version, published as the document's `info.version`. */\n readonly packageVersion: string,\n /** The {@link ApiDocModel.types} keys of the exported declarations, in export order. */\n readonly exported: readonly string[],\n /** Every named type reached from the exports — the library's own and other packages'. */\n readonly types: ReadonlyMap<string, DocumentedType>,\n readonly unmapped: readonly UnmappedType[],\n readonly collisions: readonly TypeNameCollision[],\n ) {}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ApiDocModel.js","sourceRoot":"","sources":["../../../../../../packages/docs/api-doc-model/src/model/ApiDocModel.ts"],"names":[],"mappings":";;;AAGA;;;;;;;;GAQG;AAEH,qGAAqG;AACrG,MAAa,YAAY;IAGR;IAEA;IAEA;IANb;IACI,qEAAqE;IAC5D,QAAgB;IACzB,sDAAsD;IAC7C,QAAgB;IACzB,wEAAwE;IAC/D,MAAc;QAJd,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,aAAQ,GAAR,QAAQ,CAAQ;QAEhB,WAAM,GAAN,MAAM,CAAQ;IACxB,CAAC;CACP;AATD,oCASC;AAED,wGAAwG;AACxG,MAAa,kBAAkB;IAGd;IAQA;IAVb;IACI,yCAAyC;IAChC,YAAoB;IAC7B;;;;;;OAMG;IACM,YAAoD;QARpD,iBAAY,GAAZ,YAAY,CAAQ;QAQpB,iBAAY,GAAZ,YAAY,CAAwC;IAC9D,CAAC;CACP;AAbD,gDAaC;AAED,4BAA4B;AAC5B,MAAa,eAAe;IAEX;IACA;IAMA;IAEA;IAEA;IAMA;IAEA;IAEA;IAEA;IAUA;IAUA;IA5Cb,YACa,IAAY,EACZ,IAAa;IACtB;;;;OAIG;IACM,QAAiB;IAC1B,sFAAsF;IAC7E,QAAiB;IAC1B,uEAAuE;IAC9D,WAAmB;IAC5B;;;;OAIG;IACM,cAAkC;IAC3C,8EAA8E;IACrE,MAA0B;IACnC,2EAA2E;IAClE,GAAuB;IAChC,2EAA2E;IAClE,GAAuB;IAChC;;;;;;;;OAQG;IACM,SAA6B;IACtC;;;;;;;;OAQG;IACM,QAAgB;QA3ChB,SAAI,GAAJ,IAAI,CAAQ;QACZ,SAAI,GAAJ,IAAI,CAAS;QAMb,aAAQ,GAAR,QAAQ,CAAS;QAE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ACjC,eAAU,GAAV,UAAU,CAA8B;IAClD,CAAC;CACP;AAbD,gDAaC","sourcesContent":["import { TypeRef } from './TypeRef';\nimport type { DocumentedStreaming } from './DocumentedStreaming';\n\n/**\n * The model classes. Every one of them is a CLASS with an explicit constructor per `CLAUDE.md` §1 —\n * these are data-only structures, and a renderer (#982) builds nothing, it only reads.\n *\n * Nothing in this file imports anything but {@link TypeRef}: the package depends on `typescript` and\n * NOTHING else, so it can be pointed at any upstream project's contract. One app-specific import\n * here would end that, which is why `responsibilities.md` states the constraint rather than leaving\n * it to be discovered.\n */\n\n/** A type the extractor could not represent. RECORDED, never dropped — #982's guard needs a name. */\nexport class UnmappedType {\n constructor(\n /** The verbatim TypeScript type text, e.g. `Map<string, Widget>`. */\n readonly typeText: string,\n /** Pointer-style location: `path/to/File.ts:12:5`. */\n readonly location: string,\n /** Why it could not be mapped, in one sentence a renderer can print. */\n readonly reason: string,\n ) {}\n}\n\n/** The DERIVED discriminator of a union — never invented, only observed. See {@link DocumentedType}. */\nexport class UnionDiscriminator {\n constructor(\n /** The property every branch carries. */\n readonly propertyName: string,\n /**\n * branch type name -> EVERY string value that branch's property may hold. One value for\n * `mode: 'fixed'` / `mode: VoiceMode.FIXED`; several for `mode: 'a' | 'b'` or\n * `mode: VoiceMode.A | VoiceMode.B` (#1023). No value appears under two branches — that is\n * what makes the property a discriminator, and an OpenAPI `mapping` point several values at\n * one schema.\n */\n readonly branchValues: ReadonlyMap<string, readonly string[]>,\n ) {}\n}\n\n/** One field of one DTO. */\nexport class DocumentedField {\n constructor(\n readonly name: string,\n readonly type: TypeRef,\n /**\n * OPTIONAL (`name?: string`) — the property may be ABSENT. Distinguished from\n * {@link nullable} on purpose: `{}` and `{name: null}` are different wire documents, and a\n * renderer that conflates them emits a schema that rejects one of them.\n */\n readonly optional: boolean,\n /** NULLABLE (`name: string | null`) — the property is present and may hold `null`. */\n readonly nullable: boolean,\n /** The JSDoc body, links flattened. Empty string when undocumented. */\n readonly description: string,\n /**\n * The `@mcp` block tag — an OPTIONAL agent-facing override. Undefined means \"no override\",\n * and a renderer falls back to {@link description}; the fallback is NOT applied here so a\n * renderer can tell a deliberate agent-facing sentence from a reused human one.\n */\n readonly mcpDescription: string | undefined,\n /** The `@format` tag, lifted onto the SCALAR (on an array, onto the ITEM). */\n readonly format: string | undefined,\n /** `@WpMin(n)` — numeric fields only; anything else is a build failure. */\n readonly min: number | undefined,\n /** `@WpMax(n)` — numeric fields only; anything else is a build failure. */\n readonly max: number | undefined,\n /**\n * The `@mcpHeader <token>` JSDoc tag — the MCP 2026 SEP-2243 header this PRIMITIVE field is\n * mirrored into (`Mcp-Param-{token}`). Undefined for every field that is not mirrored, which\n * is nearly all of them.\n *\n * It is documentation and therefore lives in JSDoc, next to the sentence describing the\n * field, rather than in a decorator argument — and since #984 it is the only spelling of the\n * fact at all.\n */\n readonly mcpHeader: string | undefined,\n /**\n * Pointer-style `path/to/File.ts:12:5` for the property declaration itself.\n *\n * A renderer never needs it — it publishes a schema, not a file offset. The build RULES do:\n * `api-rules-for-openapi` refuses a field whose value type is `unknown`, and a refusal that\n * cannot say WHERE costs the author a grep over every DTO the contract reaches. It is\n * carried on the FIELD rather than recomputed because only the extractor still has the\n * syntax node, and a second reader deriving it would be a second answer to \"where is this\".\n */\n readonly location: string,\n ) {}\n}\n\n/** One named type reachable from a contract: an object DTO, a string-literal enum, or a union. */\nexport class DocumentedType {\n constructor(\n readonly name: string,\n readonly description: string,\n /** Object shape. Empty for an enum or a union. */\n readonly fields: readonly DocumentedField[],\n /** Set for a string-literal union that has a name. */\n readonly enumValues: readonly string[],\n /** Set for a union of named object types. */\n readonly unionRefNames: readonly string[],\n /** Set only when EVERY branch carries the same property typed as one string literal. */\n readonly discriminator: UnionDiscriminator | undefined,\n /** An index signature (`[k: string]: X`) — the OPEN-MAP half of an object that also has fields. */\n readonly indexSignatureValue: TypeRef | undefined,\n /**\n * The npm package whose source DECLARES this type — the nearest `package.json` above the\n * declaring file (#1058). It decides which OpenAPI document OWNS the schema: a contract\n * document defines the schemas its own package declares and `$ref`s every other one into\n * that package's `components.openapi.json`. Undefined when the file belongs to no package.\n *\n * The MCP projection ignores it: a tool schema is always fully inlined.\n */\n readonly packageName: string | undefined,\n /** Pointer-style `path/to/File.ts:12:5` of the declaration, for a refusal that names it. */\n readonly location: string,\n ) {}\n\n /**\n * The key this type is registered under in {@link ApiDocModel.types} and named by every\n * {@link TypeRef.refName}: the bare name for a type its model's HOME package declares, and\n * `<package>:<name>` for every other one, so two packages' same-named types are two entries.\n */\n // webpieces-disable no-function-outside-class -- static helper on the class whose key it computes\n static keyOf(\n name: string,\n packageName: string | undefined,\n homePackage: string | undefined,\n ): string {\n return packageName === homePackage ? name : `${packageName ?? '<no package>'}:${name}`;\n }\n}\n\n/**\n * Two DIFFERENT declarations of one name in one package, both reached by one model (#1058).\n *\n * Recorded rather than thrown, because the MCP projection inlines every schema and never cared which\n * of the two it was handed — it keeps rendering exactly as before. An OpenAPI document defines each\n * schema of a package under its bare name, so it REFUSES a model carrying one of these: the second\n * declaration would be published as the first one's shape.\n */\nexport class TypeNameCollision {\n constructor(\n readonly name: string,\n readonly packageName: string | undefined,\n /** Where the declaration that won the name is. */\n readonly firstLocation: string,\n /** Where the declaration that was conflated into it is. */\n readonly secondLocation: string,\n ) {}\n}\n\n/** `@Endpoint(httpMethod, path, operation, kind, options?)`'s LAST argument, as a document sees it. */\nexport class DocumentedEndpointOptions {\n constructor(\n readonly formPost: boolean,\n /** `calledBy` — REQUIRED by the decorator for `external`, absent otherwise. */\n readonly calledBy: string | undefined,\n readonly callerKind: string | undefined,\n ) {}\n}\n\n/**\n * The `@WpMcpTool('search_stores')` declaration, when the method carries one — the ONE fact the\n * source cannot otherwise state, and nothing else.\n *\n * `description` used to sit on the decorator too. The method's JSDoc is the description, for the\n * agent and for the partner alike, byte-identical: two authored copies of one paragraph is the\n * two-spellings shim, and its failure mode is concrete — the partner reads the JSDoc in the OpenAPI\n * document while the agent reads the decorator string in `tools/list`, and they drift the first time\n * somebody edits one. #984 deleted it, which left the decorator holding one field, so it takes the\n * name as a plain string.\n *\n * The three side-effect hints are COMPUTED from the endpoint's `operation` by `mcpHintsForOperation`\n * in `@webpieces/core-util`, which is the one place that mapping lives — `READ | WRITE_IDEMPOTENT |\n * WRITE` already says whether repeating a call is safe, so a hand-declared hint would be a second\n * answer to a question the contract has answered. `openWorldHint` is `@Endpoint`'s `openWorld`.\n */\nexport class DocumentedMcpTool {\n constructor(\n /**\n * The STABLE protocol name. Deliberately independent of the method name, because renaming a\n * method must not break a saved agent workflow.\n */\n readonly name: string,\n ) {}\n}\n\n/**\n * ONE credential of an api-key regime, PARSED — `{ in: 'header', name: 'x-api-key' }` or\n * `{ in: 'bearer' }`.\n *\n * Parsed rather than left as source text because it is the one auth argument a renderer must turn\n * into a STRUCTURE: an OpenAPI `securityScheme` is `{type: apiKey, in, name}` or\n * `{type: http, scheme: bearer}`, and those are different documents. A renderer handed the string\n * `\"{ in: 'header', name: 'x-api-key' }\"` would have to parse TypeScript to emit either one, which\n * is this package's job and not a renderer's.\n */\nexport class DocumentedApiKeyCredential {\n constructor(\n /** `header` or `bearer`, verbatim from the declaration. */\n readonly location: string,\n /** The header name. Undefined for `bearer`, whose location IS `Authorization`. */\n readonly name: string | undefined,\n /** The prose a docs site renders on its authorization card. */\n readonly description: string | undefined,\n ) {}\n}\n\n/** `apiKey(regime, credentials)`, parsed. See {@link DocumentedApiKeyCredential}. */\nexport class DocumentedApiKey {\n constructor(\n readonly regime: string,\n /**\n * Every credential the regime requires, IN DECLARATION ORDER. They are an AND — all of them\n * are presented together — and the order is the order a published document lists them in.\n */\n readonly credentials: readonly DocumentedApiKeyCredential[],\n ) {}\n}\n\n/** Structurally extracted credential alternatives, with OR semantics. */\nexport class DocumentedAuthMethod {\n constructor(readonly kind: string, readonly argumentTexts: readonly string[], readonly apiKey: DocumentedApiKey | undefined) {}\n}\n\nexport class DocumentedAuth {\n constructor(readonly publicReason: string | undefined, readonly methods: readonly DocumentedAuthMethod[]) {}\n}\n\n/** One `@Endpoint` method of one contract. */\nexport class DocumentedEndpoint {\n constructor(\n readonly methodName: string,\n /**\n * `GET` or `POST`, constant-folded from `@Endpoint`'s FIRST argument. A document cannot be\n * written without it — the verb is the key an operation hangs under in `paths`.\n */\n readonly httpMethod: string,\n /** The path, constant-folded. A const that cannot be folded is a HARD FAILURE, never a guess. */\n readonly path: string,\n /**\n * `read` | `write-idempotent` | `write`, verbatim. The SIDE-EFFECT contract, which is\n * independent of the verb: webpieces POSTs a read. A renderer publishes it rather than\n * inferring safety from the verb, which for this framework would be wrong.\n */\n readonly operation: string,\n /** `rpc` | `cloudtasks` | `cron` | `external`, verbatim — this package invents no taxonomy. */\n readonly kind: string,\n /**\n * `{ hidden: true }` — this method is absent from the CUSTOMER document. It stays in the\n * private one, and in the MCP one when it is a tool. WHICH documents the CONTRACT feeds at\n * all is a different, class-level decision; see {@link ApiDocModel.apiTypes}.\n */\n readonly hidden: boolean,\n /** `{ openWorld: true }` — this operation may touch systems outside this service. */\n readonly openWorld: boolean,\n readonly options: DocumentedEndpointOptions,\n readonly auth: DocumentedAuth | undefined,\n readonly mcpTool: DocumentedMcpTool | undefined,\n /**\n * `@InvalidEndpointForMcp('<reason>')`'s reason, when the method carries one — this endpoint\n * is PERMANENTLY outside MCP and was never a tool candidate.\n *\n * Distinct from \"has no `@WpMcpTool`\", which only says \"not a tool yet\". A renderer must not\n * report one of these as a SKIPPED tool, and `api-rules-for-mcp` stops asking a method with\n * one whether it could be served — the declaration is the answer. Carrying the reason rather\n * than a boolean is the point: the rule restates the list of exclusions with their arguments\n * on every run.\n */\n readonly invalidForMcp: string | undefined,\n /** The common @WpAuthorization declaration, shared by every surface. */\n readonly authorizationText: string | undefined,\n /** `@MaskLog({...})` — field name -> mask mode. */\n readonly maskLog: ReadonlyMap<string, string>,\n readonly description: string,\n /** The `@mcp` override. See {@link DocumentedField.mcpDescription}. */\n readonly mcpDescription: string | undefined,\n readonly request: TypeRef | undefined,\n readonly response: TypeRef | undefined,\n readonly streaming?: DocumentedStreaming,\n readonly localOnly: boolean = false,\n ) {}\n}\n\n/** ONE extraction pass over ONE contract file. Both #982's renderers read exactly this. */\nexport class ApiDocModel {\n constructor(\n /** The contract class name, e.g. `SaveApi`. */\n readonly contractName: string,\n /**\n * WHICH generated documents this contract feeds — `svc-to-svc`, `external-customer`, `mcp`,\n * verbatim from `@ApiType(...)`, defaulting to `svc-to-svc` alone when it declares nothing.\n *\n * A named list rather than a falsy default, because the grant has to be the TOKEN: a default\n * that reached customers would publish a contract whose author typed nothing about it.\n */\n readonly apiTypes: readonly string[],\n /** `@ApiPath(...)`, constant-folded. */\n readonly basePath: string,\n /** The JSDoc on the contract class, links flattened. */\n readonly description: string,\n readonly endpoints: readonly DocumentedEndpoint[],\n /** Every named type reachable from the endpoints, by name. A `$ref` target for a renderer. */\n readonly types: ReadonlyMap<string, DocumentedType>,\n /** Everything that could not be represented — recorded, not dropped. */\n readonly unmapped: readonly UnmappedType[],\n /** Same-named, different declarations in one package — see {@link TypeNameCollision}. */\n readonly collisions: readonly TypeNameCollision[],\n ) {}\n}\n\n/**\n * ONE extraction pass over a DTO LIBRARY: every type it exports and declares, for the\n * components-only OpenAPI document it publishes (#1058). Data-only.\n *\n * A components document contains EVERY exported type the library declares — not only the ones some\n * contract reaches — so its contents are a property of the library alone and do not move when a\n * downstream contract changes.\n */\nexport class ApiComponentsModel {\n constructor(\n /** The library's package name — every type in {@link exported} is declared by it. */\n readonly packageName: string,\n /** The library's package version, published as the document's `info.version`. */\n readonly packageVersion: string,\n /** The {@link ApiDocModel.types} keys of the exported declarations, in export order. */\n readonly exported: readonly string[],\n /** Every named type reached from the exports — the library's own and other packages'. */\n readonly types: ReadonlyMap<string, DocumentedType>,\n readonly unmapped: readonly UnmappedType[],\n readonly collisions: readonly TypeNameCollision[],\n ) {}\n}\n"]}
|