@webpieces/nx-webpieces-rules 0.4.994 → 0.4.996
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 +7 -7
- package/src/lib/api-usage/api-ast.d.ts +7 -1
- package/src/lib/api-usage/api-ast.js +21 -0
- package/src/lib/api-usage/api-ast.js.map +1 -1
- package/src/lib/api-usage/api-contract-errors.d.ts +6 -1
- package/src/lib/api-usage/api-contract-errors.js +17 -1
- package/src/lib/api-usage/api-contract-errors.js.map +1 -1
- package/src/lib/api-usage/api-contract-evidence.js +1 -0
- package/src/lib/api-usage/api-contract-evidence.js.map +1 -1
- package/src/lib/api-usage/api-relations.d.ts +20 -0
- package/src/lib/api-usage/api-relations.js +23 -1
- package/src/lib/api-usage/api-relations.js.map +1 -1
- package/src/lib/api-usage/api-scanner.d.ts +5 -2
- package/src/lib/api-usage/api-scanner.js +5 -1
- package/src/lib/api-usage/api-scanner.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webpieces/nx-webpieces-rules",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.996",
|
|
4
4
|
"description": "Nx-specific webpieces validation rules, graph tooling, executors, and inference plugin.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@webpieces/api-doc-model": "0.4.
|
|
24
|
-
"@webpieces/core-util": "0.4.
|
|
25
|
-
"@webpieces/eslint-rules": "0.4.
|
|
26
|
-
"@webpieces/rules-config": "0.4.
|
|
23
|
+
"@webpieces/api-doc-model": "0.4.996",
|
|
24
|
+
"@webpieces/core-util": "0.4.996",
|
|
25
|
+
"@webpieces/eslint-rules": "0.4.996",
|
|
26
|
+
"@webpieces/rules-config": "0.4.996",
|
|
27
27
|
"madge": "8.0.0",
|
|
28
|
-
"@webpieces/rules-sdk": "0.4.
|
|
28
|
+
"@webpieces/rules-sdk": "0.4.996"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@nx/devkit": ">=18.0.0"
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@webpieces/tooling-testkit": "0.4.
|
|
44
|
+
"@webpieces/tooling-testkit": "0.4.996"
|
|
45
45
|
},
|
|
46
46
|
"types": "./src/index.d.ts",
|
|
47
47
|
"bin": {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Parser-only API contract AST accessors; deliberately avoids module resolution and erased d.ts. */
|
|
2
2
|
import * as ts from 'typescript';
|
|
3
|
-
import { ApiClassInfo, ApiMethodMeta, ApiParameterMeta, ContractHttpMethod, ApiTransport, EmptiedApiContract, EndpointKind, EndpointOperation, ExternalSystemDeclaration, NonLiteralDecoratorArg, UndeclaredExternalCaller, UndeclaredEndpointOperation, UnresolvedEndpointPath, VoidResponseMismatch, VoidResponseProblem } from './api-relations';
|
|
3
|
+
import { ApiClassInfo, ApiMethodMeta, ApiParameterMeta, ContractHttpMethod, AdditiveReadEndpoint, ApiTransport, EmptiedApiContract, EndpointKind, EndpointOperation, ExternalSystemDeclaration, NonLiteralDecoratorArg, UndeclaredExternalCaller, UndeclaredEndpointOperation, UnresolvedEndpointPath, VoidResponseMismatch, VoidResponseProblem } from './api-relations';
|
|
4
4
|
/** Same-module string constants that parser-only decorator scanning can safely resolve. */
|
|
5
5
|
export declare class ModuleStringConstants {
|
|
6
6
|
private readonly byName;
|
|
@@ -28,6 +28,7 @@ export declare class DecoratorArgDiagnostics {
|
|
|
28
28
|
private readonly undeclaredCallers;
|
|
29
29
|
private readonly undeclaredOperations;
|
|
30
30
|
private readonly voidMismatches;
|
|
31
|
+
private readonly additiveReadList;
|
|
31
32
|
constructor(workspaceRoot: string);
|
|
32
33
|
/** Record `argument` (as written) as unresolvable at `node`'s location. */
|
|
33
34
|
record(api: string, decorator: string, method: string | null, argument: string, node: ts.Node): void;
|
|
@@ -41,6 +42,9 @@ export declare class DecoratorArgDiagnostics {
|
|
|
41
42
|
recordUndeclaredOperation(api: string, method: string, argument: string, node: ts.Node): void;
|
|
42
43
|
/** Record an `@Endpoint` whose response-body declaration disagrees with its kind or signature. */
|
|
43
44
|
recordVoidMismatch(api: string, method: string, problem: VoidResponseProblem, kind: EndpointKind, node: ts.Node): void;
|
|
45
|
+
/** Record a READ `@Endpoint` declaring `{ additive }` — fatal, see AdditiveReadEndpointError. */
|
|
46
|
+
recordAdditiveRead(api: string, method: string, node: ts.Node): void;
|
|
47
|
+
additiveReads(): AdditiveReadEndpoint[];
|
|
44
48
|
voidResponseMismatches(): VoidResponseMismatch[];
|
|
45
49
|
all(): NonLiteralDecoratorArg[];
|
|
46
50
|
unresolvedEndpointPaths(): UnresolvedEndpointPath[];
|
|
@@ -54,6 +58,8 @@ export declare function apiClassInfoFrom(cls: ts.ClassDeclaration, project: stri
|
|
|
54
58
|
export declare function apiTransport(cls: ts.ClassDeclaration): ApiTransport;
|
|
55
59
|
/** Reads required `(method, path, operation, kind, options?)` endpoint declarations in order. */
|
|
56
60
|
export declare function endpointMethodsOf(cls: ts.ClassDeclaration, api: string, constants?: ModuleStringConstants, diagnostics?: DecoratorArgDiagnostics | null): ApiMethodMeta[];
|
|
61
|
+
/** `additive` written at all in `@Endpoint`'s options (#1423) — any value, since a READ may state none. */
|
|
62
|
+
export declare function declaresAdditive(options: ts.Expression | undefined): boolean;
|
|
57
63
|
/** Required side-effect declaration; no inference from GET/POST is permitted. */
|
|
58
64
|
export declare function endpointOperationOf(operationArgument: ts.Expression | undefined, constants: ModuleStringConstants, diagnostics: DecoratorArgDiagnostics | null, api: string, method: string, node: ts.Node): EndpointOperation | null;
|
|
59
65
|
/** Required first positional HTTP method. */
|
|
@@ -8,6 +8,7 @@ exports.decoratorArgValue = decoratorArgValue;
|
|
|
8
8
|
exports.apiClassInfoFrom = apiClassInfoFrom;
|
|
9
9
|
exports.apiTransport = apiTransport;
|
|
10
10
|
exports.endpointMethodsOf = endpointMethodsOf;
|
|
11
|
+
exports.declaresAdditive = declaresAdditive;
|
|
11
12
|
exports.endpointOperationOf = endpointOperationOf;
|
|
12
13
|
exports.httpMethodOf = httpMethodOf;
|
|
13
14
|
exports.endpointResponseTypeOf = endpointResponseTypeOf;
|
|
@@ -172,6 +173,7 @@ class DecoratorArgDiagnostics {
|
|
|
172
173
|
undeclaredCallers = [];
|
|
173
174
|
undeclaredOperations = [];
|
|
174
175
|
voidMismatches = [];
|
|
176
|
+
additiveReadList = [];
|
|
175
177
|
constructor(workspaceRoot) {
|
|
176
178
|
this.workspaceRoot = workspaceRoot;
|
|
177
179
|
}
|
|
@@ -199,6 +201,13 @@ class DecoratorArgDiagnostics {
|
|
|
199
201
|
recordVoidMismatch(api, method, problem, kind, node) {
|
|
200
202
|
this.voidMismatches.push(new api_relations_1.VoidResponseMismatch(api, method, problem, kind, this.locate(node)));
|
|
201
203
|
}
|
|
204
|
+
/** Record a READ `@Endpoint` declaring `{ additive }` — fatal, see AdditiveReadEndpointError. */
|
|
205
|
+
recordAdditiveRead(api, method, node) {
|
|
206
|
+
this.additiveReadList.push(new api_relations_1.AdditiveReadEndpoint(api, method, this.locate(node)));
|
|
207
|
+
}
|
|
208
|
+
additiveReads() {
|
|
209
|
+
return this.additiveReadList;
|
|
210
|
+
}
|
|
202
211
|
voidResponseMismatches() {
|
|
203
212
|
return this.voidMismatches;
|
|
204
213
|
}
|
|
@@ -307,6 +316,9 @@ function endpointMethodsOf(cls, api, constants = new ModuleStringConstants(new M
|
|
|
307
316
|
if (parameters.length > 0)
|
|
308
317
|
method.parameters = parameters;
|
|
309
318
|
readResponseShape(method, member, args[4], constants, diagnostics, api, endpoint);
|
|
319
|
+
if (diagnostics !== null && operation === 'read' && declaresAdditive(args[4])) {
|
|
320
|
+
diagnostics.recordAdditiveRead(api, name, endpoint);
|
|
321
|
+
}
|
|
310
322
|
if (QUEUED_KINDS.includes(method.kind)) {
|
|
311
323
|
method.queueName = queueNameOf(member, api, name, constants, diagnostics);
|
|
312
324
|
}
|
|
@@ -381,6 +393,15 @@ function declaredVoidProblem(declaresNone, returnsVoid) {
|
|
|
381
393
|
return api_relations_1.VoidResponseProblem.VOID_WITHOUT_NONE;
|
|
382
394
|
return null;
|
|
383
395
|
}
|
|
396
|
+
/** `additive` written at all in `@Endpoint`'s options (#1423) — any value, since a READ may state none. */
|
|
397
|
+
// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers
|
|
398
|
+
function declaresAdditive(options) {
|
|
399
|
+
if (options === undefined || !ts.isObjectLiteralExpression(options))
|
|
400
|
+
return false;
|
|
401
|
+
return options.properties.some((property) => (ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)) &&
|
|
402
|
+
ts.isIdentifier(property.name) &&
|
|
403
|
+
property.name.text === 'additive');
|
|
404
|
+
}
|
|
384
405
|
/** Required side-effect declaration; no inference from GET/POST is permitted. */
|
|
385
406
|
// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers
|
|
386
407
|
function endpointOperationOf(operationArgument, constants, diagnostics, api, method, node) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api-ast.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/nx-webpieces-rules/src/lib/api-usage/api-ast.ts"],"names":[],"mappings":";AAAA,qGAAqG;;;AAmFrG,8CAgBC;AAID,sCAMC;AAYD,8CAaC;AA6GD,4CA8BC;AAGD,oCAEC;AAOD,8CAgEC;AA0ED,kDAgCC;AAID,oCAcC;AAID,wDAQC;AAID,gEAaC;AAID,oDAUC;AAID,4CA6BC;AAgBD,4CAiBC;AAID,kDAeC;AAID,kCAYC;AAID,4CAUC;AAID,sCAIC;AAID,0CAGC;AAID,kCAGC;AAOD,gDAYC;AAID,kDAKC;AASD,8CA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C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["/** Parser-only API contract AST accessors; deliberately avoids module resolution and erased d.ts. */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { classDecorators, decoratorName } from '../di-graph/bindings';\nimport {\n ApiClassInfo,\n ApiMethodMeta,\n ApiParameterMeta,\n CONTRACT_HTTP_METHODS,\n ContractHttpMethod,\n contractVerbCarriesBody,\n ApiTransport,\n EmptiedApiContract,\n EndpointKind,\n EndpointOperation,\n ExternalSystemDeclaration,\n isExternalSystemKind,\n NonLiteralDecoratorArg,\n UndeclaredExternalCaller,\n UndeclaredEndpointOperation,\n UnresolvedEndpointPath,\n VoidResponseMismatch,\n VoidResponseProblem,\n} from './api-relations';\n\n/** Legal enum-backed `@Endpoint` symbols; tooling reads source without importing application code. */\nconst ENDPOINT_KINDS: readonly EndpointKind[] = [\n 'rpc',\n 'cloudtasks',\n 'cron',\n 'external-inbound',\n 'external-outbound',\n];\nconst ENDPOINT_OPERATIONS: readonly EndpointOperation[] = ['read', 'write-idempotent', 'write'];\nconst ENDPOINT_SYMBOLS: Readonly<Record<string, string>> = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n PATCH: 'PATCH',\n DELETE: 'DELETE',\n READ: 'read',\n WRITE_IDEMPOTENT: 'write-idempotent',\n WRITE: 'write',\n RPC: 'rpc',\n CLOUDTASKS: 'cloudtasks',\n CRON: 'cron',\n EXTERNAL_INBOUND: 'external-inbound',\n EXTERNAL_OUTBOUND: 'external-outbound',\n};\n\n/**\n * Name suffix that marks an exported type in an `externalApiPaths` project as a vendor CONTRACT\n * (`GmailApi`, `StorageApi`) rather than one of the DTOs, configs or clients sitting beside it.\n * The same convention the in-repo contracts already follow, applied where no decorator can be read.\n */\nconst EXTERNAL_CONTRACT_SUFFIX = 'Api';\n\n/** JSDoc tag a vendor contract uses to declare WHAT it is a seam to: `@externalSystem database Firestore`. */\nconst EXTERNAL_SYSTEM_TAG = 'externalSystem';\n\n/**\n * Client-config class-name suffix whose FIRST constructor argument is the target service name —\n * `ClientConfig('helper-fsdb')` (rpc) and `TaskClientConfig('helper-fsdb')` (pubsub) both take\n * `svcName` first, and a consumer's own `XxxClientConfig` follows the same shape.\n */\nconst CLIENT_CONFIG_SUFFIX = 'ClientConfig';\n\n/** Same-module string constants that parser-only decorator scanning can safely resolve. */\nexport class ModuleStringConstants {\n constructor(private readonly byName: Map<string, string>) {}\n\n lookup(name: string): string | null {\n return this.byName.get(name) ?? null;\n }\n}\n\n/** Parsed constants per source file — every class in a file shares one table. */\nconst CONSTANTS_BY_FILE = new WeakMap<ts.SourceFile, ModuleStringConstants>();\n\n/** The module-scope string constants of `sourceFile`, parsed once per file. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function stringConstantsOf(sourceFile: ts.SourceFile): ModuleStringConstants {\n const cached = CONSTANTS_BY_FILE.get(sourceFile);\n if (cached !== undefined) return cached;\n const byName = new Map<string, string>();\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0) continue;\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name)) continue;\n const text = stringValueOf(declaration.initializer);\n if (text !== null) byName.set(declaration.name.text, text);\n }\n }\n const constants = new ModuleStringConstants(byName);\n CONSTANTS_BY_FILE.set(sourceFile, constants);\n return constants;\n}\n\n/** The string an initializer denotes, unwrapping `as const` / parentheses, else null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function stringValueOf(expr: ts.Expression | undefined): string | null {\n if (expr === undefined) return null;\n if (ts.isStringLiteral(expr) || ts.isNoSubstitutionTemplateLiteral(expr)) return expr.text;\n if (ts.isAsExpression(expr) || ts.isParenthesizedExpression(expr))\n return stringValueOf(expr.expression);\n return null;\n}\n\n/** A resolved decorator string, or the source spelling that could not be reduced. */\nexport class DecoratorArgValue {\n constructor(\n public readonly value: string | null,\n public readonly unresolvedName: string | null,\n ) {}\n}\n\n/** Read one decorator argument as a string, resolving same-module constants. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function decoratorArgValue(\n expr: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): DecoratorArgValue {\n if (expr === undefined) return new DecoratorArgValue(null, null);\n const literal = stringValueOf(expr);\n if (literal !== null) return new DecoratorArgValue(literal, null);\n if (ts.isIdentifier(expr)) {\n const resolved = constants.lookup(expr.text);\n if (resolved !== null) return new DecoratorArgValue(resolved, null);\n return new DecoratorArgValue(null, expr.text);\n }\n return new DecoratorArgValue(null, expr.getText());\n}\n\n/** Resolve the enum-backed constants intentionally allowed in @Endpoint positional arguments. */\n// webpieces-disable no-function-outside-class -- pure AST accessor for decorator source\nfunction endpointSymbolArgValue(\n expr: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): DecoratorArgValue {\n if (expr && ts.isIdentifier(expr)) {\n const builtin = ENDPOINT_SYMBOLS[expr.text];\n if (builtin !== undefined) return new DecoratorArgValue(builtin, null);\n }\n return decoratorArgValue(expr, constants);\n}\n\n/** Aggregates parser-only scan losses so generation can fail loudly instead of dropping routes. */\nexport class DecoratorArgDiagnostics {\n private readonly found: NonLiteralDecoratorArg[] = [];\n private readonly unresolvedPaths: UnresolvedEndpointPath[] = [];\n private readonly emptied: EmptiedApiContract[] = [];\n private readonly undeclaredCallers: UndeclaredExternalCaller[] = [];\n private readonly undeclaredOperations: UndeclaredEndpointOperation[] = [];\n private readonly voidMismatches: VoidResponseMismatch[] = [];\n\n constructor(private readonly workspaceRoot: string) {}\n\n /** Record `argument` (as written) as unresolvable at `node`'s location. */\n record(\n api: string,\n decorator: string,\n method: string | null,\n argument: string,\n node: ts.Node,\n ): void {\n this.found.push(\n new NonLiteralDecoratorArg(api, decorator, method, argument, this.locate(node)),\n );\n }\n\n /** Record an `@Endpoint` whose path argument is unreadable — fatal, see UnresolvedEndpointPathError. */\n recordUnresolvedPath(api: string, method: string, argument: string, node: ts.Node): void {\n this.unresolvedPaths.push(\n new UnresolvedEndpointPath(api, method, argument, this.locate(node)),\n );\n }\n\n /** Record a class that declared `declared` `@Endpoint` methods and kept none of them. */\n recordEmptiedContract(api: string, declared: number, node: ts.Node): void {\n this.emptied.push(new EmptiedApiContract(api, declared, this.locate(node)));\n }\n\n /** Record an `external` `@Endpoint` whose caller is unreadable — fatal, see UndeclaredExternalCallerError. */\n recordUndeclaredCaller(api: string, method: string, argument: string, node: ts.Node): void {\n this.undeclaredCallers.push(\n new UndeclaredExternalCaller(api, method, argument, this.locate(node)),\n );\n }\n\n /** Record an `@Endpoint` whose required operation is missing or unreadable. */\n recordUndeclaredOperation(api: string, method: string, argument: string, node: ts.Node): void {\n this.undeclaredOperations.push(\n new UndeclaredEndpointOperation(api, method, argument, this.locate(node)),\n );\n }\n\n /** Record an `@Endpoint` whose response-body declaration disagrees with its kind or signature. */\n recordVoidMismatch(\n api: string,\n method: string,\n problem: VoidResponseProblem,\n kind: EndpointKind,\n node: ts.Node,\n ): void {\n this.voidMismatches.push(new VoidResponseMismatch(api, method, problem, kind, this.locate(node)));\n }\n\n voidResponseMismatches(): VoidResponseMismatch[] {\n return this.voidMismatches;\n }\n\n all(): NonLiteralDecoratorArg[] {\n return this.found;\n }\n\n unresolvedEndpointPaths(): UnresolvedEndpointPath[] {\n return this.unresolvedPaths;\n }\n\n emptiedContracts(): EmptiedApiContract[] {\n return this.emptied;\n }\n\n undeclaredExternalCallers(): UndeclaredExternalCaller[] {\n return this.undeclaredCallers;\n }\n\n undeclaredEndpointOperations(): UndeclaredEndpointOperation[] {\n return this.undeclaredOperations;\n }\n\n private locate(node: ts.Node): string {\n const sourceFile = node.getSourceFile();\n const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n return `${path.relative(this.workspaceRoot, sourceFile.fileName)}:${position.line + 1}`;\n }\n}\n\n/** {api, owner: `project`, type} when `cls` is an `abstract class` carrying `@ApiPath`, else null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function apiClassInfoFrom(\n cls: ts.ClassDeclaration,\n project: string,\n diagnostics: DecoratorArgDiagnostics | null = null,\n): ApiClassInfo | null {\n if (!isAbstractClass(cls) || !hasClassDecorator(cls, 'ApiPath') || !cls.name) return null;\n const api = cls.name.text;\n const constants = stringConstantsOf(cls.getSourceFile());\n const methods = endpointMethodsOf(cls, api, constants, diagnostics);\n const outbound =\n methods.length > 0 &&\n methods.every((method: ApiMethodMeta) => method.kind === 'external-outbound');\n const info: ApiClassInfo = {\n api,\n owner: project,\n type: outbound ? 'external' : apiTransport(cls),\n methods,\n };\n // An EXTERNAL_OUTBOUND contract is an outside system's API: it is a VENDOR node on the runtime\n // graph, named by its `@externalSystem <kind> [label]` JSDoc tag or, without one, a `saas` box\n // labelled with the contract name minus `Api`.\n if (outbound) {\n info.externalSystem = externalSystemTagFrom(cls, api) ?? {\n kind: 'saas',\n label: api.replace(/Api$/, ''),\n };\n }\n const basePath = decoratorStringArg(cls, 'ApiPath', constants, diagnostics, api);\n if (basePath !== null) info.basePath = basePath;\n return info;\n}\n\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function apiTransport(cls: ts.ClassDeclaration): ApiTransport {\n return hasClassDecorator(cls, 'PubSub') ? 'pubsub' : 'rpc';\n}\n\n/** The @Endpoint kinds that are actually DELIVERED through a named queue or schedule. */\nconst QUEUED_KINDS: readonly EndpointKind[] = ['cloudtasks', 'cron'];\n\n/** Reads required `(method, path, operation, kind, options?)` endpoint declarations in order. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function endpointMethodsOf(\n cls: ts.ClassDeclaration,\n api: string,\n constants: ModuleStringConstants = new ModuleStringConstants(new Map<string, string>()),\n diagnostics: DecoratorArgDiagnostics | null = null,\n): ApiMethodMeta[] {\n const methods: ApiMethodMeta[] = [];\n let declared = 0;\n for (const member of cls.members) {\n if (!ts.isMethodDeclaration(member) || !ts.isIdentifier(member.name)) continue;\n const endpoint = memberDecorator(member, 'Endpoint');\n if (endpoint === null) continue;\n declared++;\n const name = member.name.text;\n const args = decoratorArgs(endpoint);\n const methodArg = endpointSymbolArgValue(args[0], constants);\n const pathArg = decoratorArgValue(args[1], constants);\n const operationArg = endpointSymbolArgValue(args[2], constants);\n const kindArg = endpointSymbolArgValue(args[3], constants);\n reportUnresolved(diagnostics, api, 'Endpoint', name, methodArg, endpoint);\n reportUnresolved(diagnostics, api, 'Endpoint', name, pathArg, endpoint);\n reportUnresolved(diagnostics, api, 'Endpoint', name, operationArg, endpoint);\n reportUnresolved(diagnostics, api, 'Endpoint', name, kindArg, endpoint);\n if (diagnostics !== null && pathArg.unresolvedName !== null) {\n diagnostics.recordUnresolvedPath(api, name, pathArg.unresolvedName, endpoint);\n }\n const httpMethod = methodArg.value;\n reportUnknownVerb(diagnostics, api, name, httpMethod, endpoint);\n const operation = endpointOperationOf(args[2], constants, diagnostics, api, name, endpoint);\n const kind = kindArg.value;\n if (\n httpMethod === null ||\n !CONTRACT_HTTP_METHODS.includes(httpMethod as ContractHttpMethod) ||\n pathArg.value === null ||\n operation === null ||\n kind === null ||\n !ENDPOINT_KINDS.includes(kind as EndpointKind)\n )\n continue;\n const method: ApiMethodMeta = {\n name,\n path: pathArg.value,\n kind: kind as EndpointKind,\n operation,\n httpMethod: httpMethod as ContractHttpMethod,\n };\n const parameters = httpParametersOf(member, httpMethod as ContractHttpMethod, constants, diagnostics, api, name);\n if (parameters.length > 0) method.parameters = parameters;\n readResponseShape(method, member, args[4], constants, diagnostics, api, endpoint);\n if (QUEUED_KINDS.includes(method.kind)) {\n method.queueName = queueNameOf(member, api, name, constants, diagnostics);\n }\n if (method.kind === 'external-inbound') {\n const caller = externalCallerOf(args[4], constants);\n if (caller.declaration !== null) method.caller = caller.declaration;\n else if (diagnostics !== null)\n diagnostics.recordUndeclaredCaller(api, name, caller.problem!, endpoint);\n }\n methods.push(method);\n }\n if (diagnostics !== null && declared > 0 && methods.length === 0) {\n diagnostics.recordEmptiedContract(api, declared, cls);\n }\n return methods;\n}\n\n/** An unknown verb must fail generation, never silently drop the endpoint from the graph. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction reportUnknownVerb(\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n name: string,\n httpMethod: string | null,\n endpoint: ts.Node,\n): void {\n if (diagnostics === null || httpMethod === null) return;\n if (CONTRACT_HTTP_METHODS.includes(httpMethod as ContractHttpMethod)) return;\n diagnostics.record(api, 'Endpoint.httpMethod', name, httpMethod, endpoint);\n}\n\n/**\n * The response-shape options: `responseType: 'full'`, and the response body (a mismatch is a fatal\n * diagnostic). A CLOUDTASKS / CRON endpoint has no response body BY KIND (#1348): it must return\n * `Promise<void>`, and an explicit `responseBody: NONE` on it is a redundant second spelling. An\n * EXTERNAL_OUTBOUND endpoint's response is shaped by the VENDOR, so NONE (what OUR server sends) is\n * refused there and not required on `Promise<void>`. RPC and EXTERNAL_INBOUND declare\n * `responseBody: NONE`, which must agree with a `Promise<void>` signature in both directions.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction readResponseShape(\n method: ApiMethodMeta,\n member: ts.MethodDeclaration,\n options: ts.Expression | undefined,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n endpoint: ts.Node,\n): void {\n if (endpointResponseTypeOf(options, constants) === 'full') method.responseType = 'full';\n const declaresNone = endpointResponseBodyIsNone(options, constants);\n const returnsVoid = returnsPromiseOfVoid(member);\n const problem = responseBodyProblem(method.kind, declaresNone, returnsVoid);\n if (declaresNone && problem === null) method.responseBody = 'none';\n if (diagnostics !== null && problem !== null) {\n diagnostics.recordVoidMismatch(api, method.name, problem, method.kind, endpoint);\n }\n}\n\n/** The one response-body rule per kind (#1348). */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction responseBodyProblem(\n kind: EndpointKind,\n declaresNone: boolean,\n returnsVoid: boolean,\n): VoidResponseProblem | null {\n if (QUEUED_KINDS.includes(kind)) return triggerVoidProblem(declaresNone, returnsVoid);\n if (kind === 'external-outbound') return declaresNone ? VoidResponseProblem.OUTBOUND_NONE : null;\n return declaredVoidProblem(declaresNone, returnsVoid);\n}\n\n/** CLOUDTASKS / CRON: void by kind, so NONE is redundant and a non-void signature is refused. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction triggerVoidProblem(declaresNone: boolean, returnsVoid: boolean): VoidResponseProblem | null {\n if (declaresNone) return VoidResponseProblem.REDUNDANT_NONE;\n if (!returnsVoid) return VoidResponseProblem.TRIGGER_NOT_VOID;\n return null;\n}\n\n/** RPC / EXTERNAL_INBOUND: `responseBody: NONE` and `Promise<void>` must agree in both directions. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction declaredVoidProblem(declaresNone: boolean, returnsVoid: boolean): VoidResponseProblem | null {\n if (declaresNone && !returnsVoid) return VoidResponseProblem.NONE_WITHOUT_VOID;\n if (!declaresNone && returnsVoid) return VoidResponseProblem.VOID_WITHOUT_NONE;\n return null;\n}\n\n/** Required side-effect declaration; no inference from GET/POST is permitted. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function endpointOperationOf(\n operationArgument: ts.Expression | undefined,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n method: string,\n node: ts.Node,\n): EndpointOperation | null {\n const declared = endpointSymbolArgValue(operationArgument, constants);\n if (declared.value === null) {\n diagnostics?.recordUndeclaredOperation(\n api,\n method,\n declared.unresolvedName ?? '<missing>',\n node,\n );\n return null;\n }\n reportUnresolved(diagnostics, api, 'Endpoint.operation', method, declared, node);\n if (\n declared.value !== null &&\n ENDPOINT_OPERATIONS.includes(declared.value as EndpointOperation)\n ) {\n return declared.value as EndpointOperation;\n }\n diagnostics?.recordUndeclaredOperation(\n api,\n method,\n declared.unresolvedName ?? declared.value ?? '<missing>',\n node,\n );\n return null;\n}\n\n/** Required first positional HTTP method. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function httpMethodOf(\n methodArgument: ts.Expression | undefined,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n method: string,\n node: ts.Node,\n): ContractHttpMethod | null {\n const declared = endpointSymbolArgValue(methodArgument, constants);\n reportUnresolved(diagnostics, api, 'Endpoint.httpMethod', method, declared, node);\n if (CONTRACT_HTTP_METHODS.includes(declared.value as ContractHttpMethod)) {\n return declared.value as ContractHttpMethod;\n }\n return null;\n}\n\n/** Only the non-default full-response marker needs an architecture field. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function endpointResponseTypeOf(\n options: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): 'body' | 'full' {\n if (options === undefined || !ts.isObjectLiteralExpression(options)) return 'body';\n return objectPropertyValue(options, 'responseType', constants).value === 'full'\n ? 'full'\n : 'body';\n}\n\n/** `{ responseBody: NONE }` (the enum member, or its `'none'` value) in `@Endpoint`'s options. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function endpointResponseBodyIsNone(\n options: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): boolean {\n if (options === undefined || !ts.isObjectLiteralExpression(options)) return false;\n for (const property of options.properties) {\n if (!ts.isPropertyAssignment(property) || !ts.isIdentifier(property.name)) continue;\n if (property.name.text !== 'responseBody') continue;\n const value = property.initializer;\n if (ts.isIdentifier(value) && value.text === 'NONE') return true;\n return decoratorArgValue(value, constants).value === 'none';\n }\n return false;\n}\n\n/** True when the method is declared `Promise<void>` (or `Promise<undefined>`). */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function returnsPromiseOfVoid(member: ts.MethodDeclaration): boolean {\n const type = member.type;\n if (type === undefined || !ts.isTypeReferenceNode(type)) return false;\n if (!ts.isIdentifier(type.typeName) || type.typeName.text !== 'Promise') return false;\n const argument = type.typeArguments?.[0];\n if (argument === undefined) return false;\n if (argument.kind === ts.SyntaxKind.VoidKeyword || argument.kind === ts.SyntaxKind.UndefinedKeyword) {\n return true;\n }\n return false;\n}\n\n/** Explicit `@PathParam` / `@QueryParam` / `@QueryString` mappings in source declaration order. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function httpParametersOf(\n member: ts.MethodDeclaration,\n httpMethod: ContractHttpMethod,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n method: string,\n): ApiParameterMeta[] {\n const parameters: ApiParameterMeta[] = [];\n member.parameters.forEach((parameter: ts.ParameterDeclaration, index: number) => {\n let mapped = false;\n if (decoratorOn(parameter, 'QueryString') !== null) {\n parameters.push({ index, source: 'query-map' });\n return;\n }\n for (const source of ['path', 'query'] as const) {\n const decoratorNameWanted = source === 'path' ? 'PathParam' : 'QueryParam';\n const decorator = decoratorOn(parameter, decoratorNameWanted);\n if (decorator === null) continue;\n mapped = true;\n const wireName = decoratorArgValue(decoratorArgs(decorator)[0], constants);\n reportUnresolved(diagnostics, api, decoratorNameWanted, method, wireName, decorator);\n if (wireName.value !== null) {\n parameters.push({ index, source, wireName: wireName.value });\n }\n }\n if (!mapped && contractVerbCarriesBody(httpMethod)) parameters.push({ index, source: 'body' });\n });\n return parameters;\n}\n\n/** Default `callerKind` when an `external-inbound` endpoint declares `calledBy` alone — mirrors core-util. */\nconst DEFAULT_CALLER_KIND = 'saas';\n\n/** Resolved EXTERNAL_INBOUND caller declaration, or the source problem that prevented resolution. */\nexport class ExternalCallerRead {\n constructor(\n public readonly declaration: ExternalSystemDeclaration | null,\n /** What was wrong, as written, for the diagnostic. Null exactly when `declaration` is set. */\n public readonly problem: string | null,\n ) {}\n}\n\n/** Reads `calledBy` and optional `callerKind` from the fifth positional options argument. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function externalCallerOf(\n arg: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): ExternalCallerRead {\n if (arg === undefined) return new ExternalCallerRead(null, '<no options argument>');\n if (!ts.isObjectLiteralExpression(arg)) return new ExternalCallerRead(null, arg.getText());\n const calledBy = objectPropertyValue(arg, 'calledBy', constants);\n if (calledBy.value === null || calledBy.value === '') {\n return new ExternalCallerRead(null, calledBy.unresolvedName ?? '<no calledBy>');\n }\n const callerKind = objectPropertyValue(arg, 'callerKind', constants);\n if (callerKind.value === null && callerKind.unresolvedName !== null) {\n return new ExternalCallerRead(null, `callerKind: ${callerKind.unresolvedName}`);\n }\n const kind = callerKind.value ?? DEFAULT_CALLER_KIND;\n if (!isExternalSystemKind(kind)) return new ExternalCallerRead(null, `callerKind: '${kind}'`);\n return new ExternalCallerRead({ kind, label: calledBy.value }, null);\n}\n\n/** One property of an object literal, read as a string through the same constant folding as an argument. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function objectPropertyValue(\n literal: ts.ObjectLiteralExpression,\n name: string,\n constants: ModuleStringConstants,\n): DecoratorArgValue {\n for (const property of literal.properties) {\n if (!ts.isPropertyAssignment(property) || property.name === undefined) continue;\n const key =\n ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)\n ? property.name.text\n : null;\n if (key !== name) continue;\n return decoratorArgValue(property.initializer, constants);\n }\n return new DecoratorArgValue(null, null);\n}\n\n/** `@Queue('...')` override when present and resolvable, else the derived `${Api}-${method}`. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function queueNameOf(\n member: ts.MethodDeclaration,\n api: string,\n name: string,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n): string {\n const override = memberDecorator(member, 'Queue');\n if (override === null) return `${api}-${name}`;\n const queueArg = decoratorArgValue(decoratorArgs(override)[0], constants);\n reportUnresolved(diagnostics, api, 'Queue', name, queueArg, override);\n return queueArg.value ?? `${api}-${name}`;\n}\n\n/** Record an argument that is present but unresolvable; a resolved or absent one is silent. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function reportUnresolved(\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n decorator: string,\n method: string | null,\n arg: DecoratorArgValue,\n node: ts.Node,\n): void {\n if (diagnostics === null || arg.unresolvedName === null) return;\n diagnostics.record(api, decorator, method, arg.unresolvedName, node);\n}\n\n/** The arguments of a decorator's call expression, or [] when it is a bare `@Foo` reference. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function decoratorArgs(\n decorator: ts.Decorator,\n): ts.NodeArray<ts.Expression> | ts.Expression[] {\n return ts.isCallExpression(decorator.expression) ? decorator.expression.arguments : [];\n}\n\n/** The named decorator on a class member, or null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function memberDecorator(member: ts.ClassElement, name: string): ts.Decorator | null {\n const decorators = ts.getDecorators(member as ts.HasDecorators) ?? [];\n return decorators.find((d: ts.Decorator) => decoratorName(d) === name) ?? null;\n}\n\n/** The named decorator on any decorator-capable AST node (notably a method parameter). */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching memberDecorator\nexport function decoratorOn(node: ts.HasDecorators, name: string): ts.Decorator | null {\n const decorators = ts.getDecorators(node) ?? [];\n return decorators.find((decorator: ts.Decorator) => decoratorName(decorator) === name) ?? null;\n}\n\n/**\n * The first argument of a class decorator as a string (`@ApiPath('/x')`, `@ApiPath(X_PATH)`), else\n * null. A same-module constant resolves; anything else is recorded on `diagnostics`.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function decoratorStringArg(\n cls: ts.ClassDeclaration,\n name: string,\n constants: ModuleStringConstants = new ModuleStringConstants(new Map<string, string>()),\n diagnostics: DecoratorArgDiagnostics | null = null,\n api: string = name,\n): string | null {\n const decorator = classDecorators(cls).find((d: ts.Decorator) => decoratorName(d) === name);\n if (decorator === undefined) return null;\n const arg = decoratorArgValue(decoratorArgs(decorator)[0], constants);\n reportUnresolved(diagnostics, api, name, null, arg, decorator);\n return arg.value;\n}\n\n/** The constructor's parameters, or [] when the class declares no constructor. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function constructorParamsOf(cls: ts.ClassDeclaration): readonly ts.ParameterDeclaration[] {\n for (const member of cls.members) {\n if (ts.isConstructorDeclaration(member)) return member.parameters;\n }\n return [];\n}\n\n/**\n * The bare name of a type reference (`GmailApi`, or `gmail.GmailApi` -> `GmailApi`), else null.\n * Generic wrappers are deliberately NOT unwrapped: `Provider<GmailApi>` hands out the contract\n * lazily, which is still a use, but it is not the shape any of these seams take today and guessing\n * at type arguments would start matching things that merely mention a contract.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function typeReferenceName(type: ts.TypeNode | undefined): string | null {\n if (type === undefined || !ts.isTypeReferenceNode(type)) return null;\n const name = type.typeName;\n if (ts.isIdentifier(name)) return name.text;\n return ts.isQualifiedName(name) && ts.isIdentifier(name.right) ? name.right.text : null;\n}\n\n/** Every type name in the class's `implements` clause — the contracts this class IS, not ones it calls. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function implementedTypeNames(cls: ts.ClassDeclaration): Set<string> {\n const names = new Set<string>();\n for (const clause of cls.heritageClauses ?? []) {\n if (clause.token !== ts.SyntaxKind.ImplementsKeyword) continue;\n for (const type of clause.types) {\n if (ts.isIdentifier(type.expression)) names.add(type.expression.text);\n }\n }\n return names;\n}\n\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function isAbstractClass(cls: ts.ClassDeclaration): boolean {\n return (ts.getModifiers(cls) ?? []).some(\n (m: ts.Modifier) => m.kind === ts.SyntaxKind.AbstractKeyword,\n );\n}\n\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function hasClassDecorator(cls: ts.ClassDeclaration, name: string): boolean {\n return classDecorators(cls).some((d: ts.Decorator) => decoratorName(d) === name);\n}\n\n/**\n * The service a client-factory call aims at, from its config argument:\n * `createRpcClient(WarmupApi, new ClientConfig('helper-fsdb'))` → `'helper-fsdb'`.\n *\n * Only a `new <Xxx>ClientConfig('<string literal>')` yields a name. A variable, a template string\n * or a computed expression yields null — the target is genuinely unknown at scan time, and the\n * runtime graph must fall back to fan-out (loudly) rather than guess.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function targetServiceOf(call: ts.CallExpression): string | null {\n if (call.arguments.length < 2) return null;\n const config = call.arguments[1];\n if (!ts.isNewExpression(config) || !ts.isIdentifier(config.expression)) return null;\n if (!config.expression.text.endsWith(CLIENT_CONFIG_SUFFIX)) return null;\n const first = config.arguments?.[0];\n if (first === undefined || !ts.isStringLiteral(first)) return null;\n return first.text.length > 0 ? first.text : null;\n}\n\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function calleeMethodName(call: ts.CallExpression): string | null {\n const callee = call.expression;\n if (ts.isPropertyAccessExpression(callee)) return callee.name.text;\n if (ts.isIdentifier(callee)) return callee.text;\n return null;\n}\n\n// webpieces-disable no-function-outside-class -- pure path predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function isTestFile(fileName: string): boolean {\n return (\n fileName.includes('/__tests__/') ||\n fileName.includes('.spec.') ||\n fileName.includes('.test.')\n );\n}\n\n/** {api, owner, type:'rpc'|'pubsub'} for an in-repo contract class, else null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function apiClassInfoFromNode(\n node: ts.Node,\n project: string,\n diagnostics: DecoratorArgDiagnostics | null = null,\n): ApiClassInfo | null {\n return ts.isClassDeclaration(node) ? apiClassInfoFrom(node, project, diagnostics) : null;\n}\n\n/**\n * {api, owner, type:'external'} for a VENDOR contract, else null.\n *\n * A vendor contract cannot be detected the way an in-repo one is. It carries no @ApiPath (there is\n * no route — the call leaves through a vendor SDK), and it is usually a plain `interface` bound to a\n * Symbol token, which is not even a class. So inside a project the workspace has DECLARED external\n * (`runtime-architecture.externalApiPaths`) the signal is structural instead: an exported\n * `interface`/`abstract class` whose name ends in `Api`. That deliberately picks up `GmailApi` and\n * `StorageApi` while leaving their DTOs, `*Config` types and `*Client` implementations alone.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function externalApiInfoFrom(node: ts.Node, project: string): ApiClassInfo | null {\n const named =\n ts.isInterfaceDeclaration(node) || (ts.isClassDeclaration(node) && isAbstractClass(node));\n if (!named || !node.name || !isExported(node)) return null;\n const api = node.name.text;\n if (!api.endsWith(EXTERNAL_CONTRACT_SUFFIX)) return null;\n const externalSystem = externalSystemTagFrom(node, api);\n return externalSystem === null\n ? { api, owner: project, type: 'external', methods: [] }\n : { api, owner: project, type: 'external', methods: [], externalSystem };\n}\n\n/**\n * The `@externalSystem <kind> [label]` JSDoc tag on a vendor contract, or null when absent.\n *\n * JSDoc rather than a decorator is not a style choice: these seams are TS `interface`s, and TS has\n * no interface decorators. Without the tag the contract still renders — as the generic dashed box it\n * always was — so this is purely additive and nothing needs migrating.\n *\n * The label defaults to the contract name minus its `Api` suffix (`FirestoreAdminApi` →\n * `FirestoreAdmin`), because the label is the node IDENTITY: two contracts that mean the same system\n * must be given the SAME explicit label to converge on one node.\n *\n * An unrecognised kind is ignored rather than defaulted. Silently drawing a `@externalSystem\n * databse` typo as a generic box is recoverable; drawing it as the wrong shape teaches the reader\n * something false about the architecture.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function externalSystemTagFrom(\n node: ts.Node,\n api: string,\n): ExternalSystemDeclaration | null {\n for (const tag of ts.getJSDocTags(node)) {\n if (tag.tagName.text !== EXTERNAL_SYSTEM_TAG) continue;\n const comment = typeof tag.comment === 'string' ? tag.comment : '';\n const parts = comment\n .trim()\n .split(/\\s+/)\n .filter((part: string) => part !== '');\n if (parts.length === 0) continue;\n const kind = parts[0].toLowerCase();\n if (!isExternalSystemKind(kind)) continue;\n const label = parts.slice(1).join(' ').trim();\n return { kind, label: label === '' ? api.replace(/Api$/, '') : label };\n }\n return null;\n}\n\n/** True when the declaration carries an `export` modifier. */\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function isExported(node: ts.InterfaceDeclaration | ts.ClassDeclaration): boolean {\n return (ts.getModifiers(node) ?? []).some(\n (m: ts.Modifier) => m.kind === ts.SyntaxKind.ExportKeyword,\n );\n}\n\n// webpieces-disable no-function-outside-class -- recursive fs walker, matching the AST-helper style here\nexport function collectTsFiles(dir: string): string[] {\n const out: string[] = [];\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (entry.name !== 'node_modules') out.push(...collectTsFiles(full));\n } else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) {\n out.push(full);\n }\n }\n return out;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"api-ast.js","sourceRoot":"","sources":["../../../../../../../packages/tooling/nx-webpieces-rules/src/lib/api-usage/api-ast.ts"],"names":[],"mappings":";AAAA,qGAAqG;;;AAoFrG,8CAgBC;AAID,sCAMC;AAYD,8CAaC;AAuHD,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AAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;IACL,CAAC;IACD,OAAO,GAAG,CAAC;AACf,CAAC","sourcesContent":["/** Parser-only API contract AST accessors; deliberately avoids module resolution and erased d.ts. */\n\nimport * as ts from 'typescript';\nimport * as fs from 'fs';\nimport * as path from 'path';\nimport { classDecorators, decoratorName } from '../di-graph/bindings';\nimport {\n ApiClassInfo,\n ApiMethodMeta,\n ApiParameterMeta,\n CONTRACT_HTTP_METHODS,\n ContractHttpMethod,\n contractVerbCarriesBody,\n AdditiveReadEndpoint,\n ApiTransport,\n EmptiedApiContract,\n EndpointKind,\n EndpointOperation,\n ExternalSystemDeclaration,\n isExternalSystemKind,\n NonLiteralDecoratorArg,\n UndeclaredExternalCaller,\n UndeclaredEndpointOperation,\n UnresolvedEndpointPath,\n VoidResponseMismatch,\n VoidResponseProblem,\n} from './api-relations';\n\n/** Legal enum-backed `@Endpoint` symbols; tooling reads source without importing application code. */\nconst ENDPOINT_KINDS: readonly EndpointKind[] = [\n 'rpc',\n 'cloudtasks',\n 'cron',\n 'external-inbound',\n 'external-outbound',\n];\nconst ENDPOINT_OPERATIONS: readonly EndpointOperation[] = ['read', 'write-idempotent', 'write'];\nconst ENDPOINT_SYMBOLS: Readonly<Record<string, string>> = {\n GET: 'GET',\n POST: 'POST',\n PUT: 'PUT',\n PATCH: 'PATCH',\n DELETE: 'DELETE',\n READ: 'read',\n WRITE_IDEMPOTENT: 'write-idempotent',\n WRITE: 'write',\n RPC: 'rpc',\n CLOUDTASKS: 'cloudtasks',\n CRON: 'cron',\n EXTERNAL_INBOUND: 'external-inbound',\n EXTERNAL_OUTBOUND: 'external-outbound',\n};\n\n/**\n * Name suffix that marks an exported type in an `externalApiPaths` project as a vendor CONTRACT\n * (`GmailApi`, `StorageApi`) rather than one of the DTOs, configs or clients sitting beside it.\n * The same convention the in-repo contracts already follow, applied where no decorator can be read.\n */\nconst EXTERNAL_CONTRACT_SUFFIX = 'Api';\n\n/** JSDoc tag a vendor contract uses to declare WHAT it is a seam to: `@externalSystem database Firestore`. */\nconst EXTERNAL_SYSTEM_TAG = 'externalSystem';\n\n/**\n * Client-config class-name suffix whose FIRST constructor argument is the target service name —\n * `ClientConfig('helper-fsdb')` (rpc) and `TaskClientConfig('helper-fsdb')` (pubsub) both take\n * `svcName` first, and a consumer's own `XxxClientConfig` follows the same shape.\n */\nconst CLIENT_CONFIG_SUFFIX = 'ClientConfig';\n\n/** Same-module string constants that parser-only decorator scanning can safely resolve. */\nexport class ModuleStringConstants {\n constructor(private readonly byName: Map<string, string>) {}\n\n lookup(name: string): string | null {\n return this.byName.get(name) ?? null;\n }\n}\n\n/** Parsed constants per source file — every class in a file shares one table. */\nconst CONSTANTS_BY_FILE = new WeakMap<ts.SourceFile, ModuleStringConstants>();\n\n/** The module-scope string constants of `sourceFile`, parsed once per file. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function stringConstantsOf(sourceFile: ts.SourceFile): ModuleStringConstants {\n const cached = CONSTANTS_BY_FILE.get(sourceFile);\n if (cached !== undefined) return cached;\n const byName = new Map<string, string>();\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n if ((statement.declarationList.flags & ts.NodeFlags.Const) === 0) continue;\n for (const declaration of statement.declarationList.declarations) {\n if (!ts.isIdentifier(declaration.name)) continue;\n const text = stringValueOf(declaration.initializer);\n if (text !== null) byName.set(declaration.name.text, text);\n }\n }\n const constants = new ModuleStringConstants(byName);\n CONSTANTS_BY_FILE.set(sourceFile, constants);\n return constants;\n}\n\n/** The string an initializer denotes, unwrapping `as const` / parentheses, else null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function stringValueOf(expr: ts.Expression | undefined): string | null {\n if (expr === undefined) return null;\n if (ts.isStringLiteral(expr) || ts.isNoSubstitutionTemplateLiteral(expr)) return expr.text;\n if (ts.isAsExpression(expr) || ts.isParenthesizedExpression(expr))\n return stringValueOf(expr.expression);\n return null;\n}\n\n/** A resolved decorator string, or the source spelling that could not be reduced. */\nexport class DecoratorArgValue {\n constructor(\n public readonly value: string | null,\n public readonly unresolvedName: string | null,\n ) {}\n}\n\n/** Read one decorator argument as a string, resolving same-module constants. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function decoratorArgValue(\n expr: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): DecoratorArgValue {\n if (expr === undefined) return new DecoratorArgValue(null, null);\n const literal = stringValueOf(expr);\n if (literal !== null) return new DecoratorArgValue(literal, null);\n if (ts.isIdentifier(expr)) {\n const resolved = constants.lookup(expr.text);\n if (resolved !== null) return new DecoratorArgValue(resolved, null);\n return new DecoratorArgValue(null, expr.text);\n }\n return new DecoratorArgValue(null, expr.getText());\n}\n\n/** Resolve the enum-backed constants intentionally allowed in @Endpoint positional arguments. */\n// webpieces-disable no-function-outside-class -- pure AST accessor for decorator source\nfunction endpointSymbolArgValue(\n expr: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): DecoratorArgValue {\n if (expr && ts.isIdentifier(expr)) {\n const builtin = ENDPOINT_SYMBOLS[expr.text];\n if (builtin !== undefined) return new DecoratorArgValue(builtin, null);\n }\n return decoratorArgValue(expr, constants);\n}\n\n/** Aggregates parser-only scan losses so generation can fail loudly instead of dropping routes. */\nexport class DecoratorArgDiagnostics {\n private readonly found: NonLiteralDecoratorArg[] = [];\n private readonly unresolvedPaths: UnresolvedEndpointPath[] = [];\n private readonly emptied: EmptiedApiContract[] = [];\n private readonly undeclaredCallers: UndeclaredExternalCaller[] = [];\n private readonly undeclaredOperations: UndeclaredEndpointOperation[] = [];\n private readonly voidMismatches: VoidResponseMismatch[] = [];\n private readonly additiveReadList: AdditiveReadEndpoint[] = [];\n\n constructor(private readonly workspaceRoot: string) {}\n\n /** Record `argument` (as written) as unresolvable at `node`'s location. */\n record(\n api: string,\n decorator: string,\n method: string | null,\n argument: string,\n node: ts.Node,\n ): void {\n this.found.push(\n new NonLiteralDecoratorArg(api, decorator, method, argument, this.locate(node)),\n );\n }\n\n /** Record an `@Endpoint` whose path argument is unreadable — fatal, see UnresolvedEndpointPathError. */\n recordUnresolvedPath(api: string, method: string, argument: string, node: ts.Node): void {\n this.unresolvedPaths.push(\n new UnresolvedEndpointPath(api, method, argument, this.locate(node)),\n );\n }\n\n /** Record a class that declared `declared` `@Endpoint` methods and kept none of them. */\n recordEmptiedContract(api: string, declared: number, node: ts.Node): void {\n this.emptied.push(new EmptiedApiContract(api, declared, this.locate(node)));\n }\n\n /** Record an `external` `@Endpoint` whose caller is unreadable — fatal, see UndeclaredExternalCallerError. */\n recordUndeclaredCaller(api: string, method: string, argument: string, node: ts.Node): void {\n this.undeclaredCallers.push(\n new UndeclaredExternalCaller(api, method, argument, this.locate(node)),\n );\n }\n\n /** Record an `@Endpoint` whose required operation is missing or unreadable. */\n recordUndeclaredOperation(api: string, method: string, argument: string, node: ts.Node): void {\n this.undeclaredOperations.push(\n new UndeclaredEndpointOperation(api, method, argument, this.locate(node)),\n );\n }\n\n /** Record an `@Endpoint` whose response-body declaration disagrees with its kind or signature. */\n recordVoidMismatch(\n api: string,\n method: string,\n problem: VoidResponseProblem,\n kind: EndpointKind,\n node: ts.Node,\n ): void {\n this.voidMismatches.push(new VoidResponseMismatch(api, method, problem, kind, this.locate(node)));\n }\n\n /** Record a READ `@Endpoint` declaring `{ additive }` — fatal, see AdditiveReadEndpointError. */\n recordAdditiveRead(api: string, method: string, node: ts.Node): void {\n this.additiveReadList.push(new AdditiveReadEndpoint(api, method, this.locate(node)));\n }\n\n additiveReads(): AdditiveReadEndpoint[] {\n return this.additiveReadList;\n }\n\n voidResponseMismatches(): VoidResponseMismatch[] {\n return this.voidMismatches;\n }\n\n all(): NonLiteralDecoratorArg[] {\n return this.found;\n }\n\n unresolvedEndpointPaths(): UnresolvedEndpointPath[] {\n return this.unresolvedPaths;\n }\n\n emptiedContracts(): EmptiedApiContract[] {\n return this.emptied;\n }\n\n undeclaredExternalCallers(): UndeclaredExternalCaller[] {\n return this.undeclaredCallers;\n }\n\n undeclaredEndpointOperations(): UndeclaredEndpointOperation[] {\n return this.undeclaredOperations;\n }\n\n private locate(node: ts.Node): string {\n const sourceFile = node.getSourceFile();\n const position = sourceFile.getLineAndCharacterOfPosition(node.getStart());\n return `${path.relative(this.workspaceRoot, sourceFile.fileName)}:${position.line + 1}`;\n }\n}\n\n/** {api, owner: `project`, type} when `cls` is an `abstract class` carrying `@ApiPath`, else null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function apiClassInfoFrom(\n cls: ts.ClassDeclaration,\n project: string,\n diagnostics: DecoratorArgDiagnostics | null = null,\n): ApiClassInfo | null {\n if (!isAbstractClass(cls) || !hasClassDecorator(cls, 'ApiPath') || !cls.name) return null;\n const api = cls.name.text;\n const constants = stringConstantsOf(cls.getSourceFile());\n const methods = endpointMethodsOf(cls, api, constants, diagnostics);\n const outbound =\n methods.length > 0 &&\n methods.every((method: ApiMethodMeta) => method.kind === 'external-outbound');\n const info: ApiClassInfo = {\n api,\n owner: project,\n type: outbound ? 'external' : apiTransport(cls),\n methods,\n };\n // An EXTERNAL_OUTBOUND contract is an outside system's API: it is a VENDOR node on the runtime\n // graph, named by its `@externalSystem <kind> [label]` JSDoc tag or, without one, a `saas` box\n // labelled with the contract name minus `Api`.\n if (outbound) {\n info.externalSystem = externalSystemTagFrom(cls, api) ?? {\n kind: 'saas',\n label: api.replace(/Api$/, ''),\n };\n }\n const basePath = decoratorStringArg(cls, 'ApiPath', constants, diagnostics, api);\n if (basePath !== null) info.basePath = basePath;\n return info;\n}\n\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function apiTransport(cls: ts.ClassDeclaration): ApiTransport {\n return hasClassDecorator(cls, 'PubSub') ? 'pubsub' : 'rpc';\n}\n\n/** The @Endpoint kinds that are actually DELIVERED through a named queue or schedule. */\nconst QUEUED_KINDS: readonly EndpointKind[] = ['cloudtasks', 'cron'];\n\n/** Reads required `(method, path, operation, kind, options?)` endpoint declarations in order. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function endpointMethodsOf(\n cls: ts.ClassDeclaration,\n api: string,\n constants: ModuleStringConstants = new ModuleStringConstants(new Map<string, string>()),\n diagnostics: DecoratorArgDiagnostics | null = null,\n): ApiMethodMeta[] {\n const methods: ApiMethodMeta[] = [];\n let declared = 0;\n for (const member of cls.members) {\n if (!ts.isMethodDeclaration(member) || !ts.isIdentifier(member.name)) continue;\n const endpoint = memberDecorator(member, 'Endpoint');\n if (endpoint === null) continue;\n declared++;\n const name = member.name.text;\n const args = decoratorArgs(endpoint);\n const methodArg = endpointSymbolArgValue(args[0], constants);\n const pathArg = decoratorArgValue(args[1], constants);\n const operationArg = endpointSymbolArgValue(args[2], constants);\n const kindArg = endpointSymbolArgValue(args[3], constants);\n reportUnresolved(diagnostics, api, 'Endpoint', name, methodArg, endpoint);\n reportUnresolved(diagnostics, api, 'Endpoint', name, pathArg, endpoint);\n reportUnresolved(diagnostics, api, 'Endpoint', name, operationArg, endpoint);\n reportUnresolved(diagnostics, api, 'Endpoint', name, kindArg, endpoint);\n if (diagnostics !== null && pathArg.unresolvedName !== null) {\n diagnostics.recordUnresolvedPath(api, name, pathArg.unresolvedName, endpoint);\n }\n const httpMethod = methodArg.value;\n reportUnknownVerb(diagnostics, api, name, httpMethod, endpoint);\n const operation = endpointOperationOf(args[2], constants, diagnostics, api, name, endpoint);\n const kind = kindArg.value;\n if (\n httpMethod === null ||\n !CONTRACT_HTTP_METHODS.includes(httpMethod as ContractHttpMethod) ||\n pathArg.value === null ||\n operation === null ||\n kind === null ||\n !ENDPOINT_KINDS.includes(kind as EndpointKind)\n )\n continue;\n const method: ApiMethodMeta = {\n name,\n path: pathArg.value,\n kind: kind as EndpointKind,\n operation,\n httpMethod: httpMethod as ContractHttpMethod,\n };\n const parameters = httpParametersOf(member, httpMethod as ContractHttpMethod, constants, diagnostics, api, name);\n if (parameters.length > 0) method.parameters = parameters;\n readResponseShape(method, member, args[4], constants, diagnostics, api, endpoint);\n if (diagnostics !== null && operation === 'read' && declaresAdditive(args[4])) {\n diagnostics.recordAdditiveRead(api, name, endpoint);\n }\n if (QUEUED_KINDS.includes(method.kind)) {\n method.queueName = queueNameOf(member, api, name, constants, diagnostics);\n }\n if (method.kind === 'external-inbound') {\n const caller = externalCallerOf(args[4], constants);\n if (caller.declaration !== null) method.caller = caller.declaration;\n else if (diagnostics !== null)\n diagnostics.recordUndeclaredCaller(api, name, caller.problem!, endpoint);\n }\n methods.push(method);\n }\n if (diagnostics !== null && declared > 0 && methods.length === 0) {\n diagnostics.recordEmptiedContract(api, declared, cls);\n }\n return methods;\n}\n\n/** An unknown verb must fail generation, never silently drop the endpoint from the graph. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction reportUnknownVerb(\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n name: string,\n httpMethod: string | null,\n endpoint: ts.Node,\n): void {\n if (diagnostics === null || httpMethod === null) return;\n if (CONTRACT_HTTP_METHODS.includes(httpMethod as ContractHttpMethod)) return;\n diagnostics.record(api, 'Endpoint.httpMethod', name, httpMethod, endpoint);\n}\n\n/**\n * The response-shape options: `responseType: 'full'`, and the response body (a mismatch is a fatal\n * diagnostic). A CLOUDTASKS / CRON endpoint has no response body BY KIND (#1348): it must return\n * `Promise<void>`, and an explicit `responseBody: NONE` on it is a redundant second spelling. An\n * EXTERNAL_OUTBOUND endpoint's response is shaped by the VENDOR, so NONE (what OUR server sends) is\n * refused there and not required on `Promise<void>`. RPC and EXTERNAL_INBOUND declare\n * `responseBody: NONE`, which must agree with a `Promise<void>` signature in both directions.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction readResponseShape(\n method: ApiMethodMeta,\n member: ts.MethodDeclaration,\n options: ts.Expression | undefined,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n endpoint: ts.Node,\n): void {\n if (endpointResponseTypeOf(options, constants) === 'full') method.responseType = 'full';\n const declaresNone = endpointResponseBodyIsNone(options, constants);\n const returnsVoid = returnsPromiseOfVoid(member);\n const problem = responseBodyProblem(method.kind, declaresNone, returnsVoid);\n if (declaresNone && problem === null) method.responseBody = 'none';\n if (diagnostics !== null && problem !== null) {\n diagnostics.recordVoidMismatch(api, method.name, problem, method.kind, endpoint);\n }\n}\n\n/** The one response-body rule per kind (#1348). */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction responseBodyProblem(\n kind: EndpointKind,\n declaresNone: boolean,\n returnsVoid: boolean,\n): VoidResponseProblem | null {\n if (QUEUED_KINDS.includes(kind)) return triggerVoidProblem(declaresNone, returnsVoid);\n if (kind === 'external-outbound') return declaresNone ? VoidResponseProblem.OUTBOUND_NONE : null;\n return declaredVoidProblem(declaresNone, returnsVoid);\n}\n\n/** CLOUDTASKS / CRON: void by kind, so NONE is redundant and a non-void signature is refused. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction triggerVoidProblem(declaresNone: boolean, returnsVoid: boolean): VoidResponseProblem | null {\n if (declaresNone) return VoidResponseProblem.REDUNDANT_NONE;\n if (!returnsVoid) return VoidResponseProblem.TRIGGER_NOT_VOID;\n return null;\n}\n\n/** RPC / EXTERNAL_INBOUND: `responseBody: NONE` and `Promise<void>` must agree in both directions. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nfunction declaredVoidProblem(declaresNone: boolean, returnsVoid: boolean): VoidResponseProblem | null {\n if (declaresNone && !returnsVoid) return VoidResponseProblem.NONE_WITHOUT_VOID;\n if (!declaresNone && returnsVoid) return VoidResponseProblem.VOID_WITHOUT_NONE;\n return null;\n}\n\n/** `additive` written at all in `@Endpoint`'s options (#1423) — any value, since a READ may state none. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function declaresAdditive(options: ts.Expression | undefined): boolean {\n if (options === undefined || !ts.isObjectLiteralExpression(options)) return false;\n return options.properties.some(\n (property: ts.ObjectLiteralElementLike) =>\n (ts.isPropertyAssignment(property) || ts.isShorthandPropertyAssignment(property)) &&\n ts.isIdentifier(property.name) &&\n property.name.text === 'additive',\n );\n}\n\n/** Required side-effect declaration; no inference from GET/POST is permitted. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function endpointOperationOf(\n operationArgument: ts.Expression | undefined,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n method: string,\n node: ts.Node,\n): EndpointOperation | null {\n const declared = endpointSymbolArgValue(operationArgument, constants);\n if (declared.value === null) {\n diagnostics?.recordUndeclaredOperation(\n api,\n method,\n declared.unresolvedName ?? '<missing>',\n node,\n );\n return null;\n }\n reportUnresolved(diagnostics, api, 'Endpoint.operation', method, declared, node);\n if (\n declared.value !== null &&\n ENDPOINT_OPERATIONS.includes(declared.value as EndpointOperation)\n ) {\n return declared.value as EndpointOperation;\n }\n diagnostics?.recordUndeclaredOperation(\n api,\n method,\n declared.unresolvedName ?? declared.value ?? '<missing>',\n node,\n );\n return null;\n}\n\n/** Required first positional HTTP method. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function httpMethodOf(\n methodArgument: ts.Expression | undefined,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n method: string,\n node: ts.Node,\n): ContractHttpMethod | null {\n const declared = endpointSymbolArgValue(methodArgument, constants);\n reportUnresolved(diagnostics, api, 'Endpoint.httpMethod', method, declared, node);\n if (CONTRACT_HTTP_METHODS.includes(declared.value as ContractHttpMethod)) {\n return declared.value as ContractHttpMethod;\n }\n return null;\n}\n\n/** Only the non-default full-response marker needs an architecture field. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function endpointResponseTypeOf(\n options: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): 'body' | 'full' {\n if (options === undefined || !ts.isObjectLiteralExpression(options)) return 'body';\n return objectPropertyValue(options, 'responseType', constants).value === 'full'\n ? 'full'\n : 'body';\n}\n\n/** `{ responseBody: NONE }` (the enum member, or its `'none'` value) in `@Endpoint`'s options. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function endpointResponseBodyIsNone(\n options: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): boolean {\n if (options === undefined || !ts.isObjectLiteralExpression(options)) return false;\n for (const property of options.properties) {\n if (!ts.isPropertyAssignment(property) || !ts.isIdentifier(property.name)) continue;\n if (property.name.text !== 'responseBody') continue;\n const value = property.initializer;\n if (ts.isIdentifier(value) && value.text === 'NONE') return true;\n return decoratorArgValue(value, constants).value === 'none';\n }\n return false;\n}\n\n/** True when the method is declared `Promise<void>` (or `Promise<undefined>`). */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function returnsPromiseOfVoid(member: ts.MethodDeclaration): boolean {\n const type = member.type;\n if (type === undefined || !ts.isTypeReferenceNode(type)) return false;\n if (!ts.isIdentifier(type.typeName) || type.typeName.text !== 'Promise') return false;\n const argument = type.typeArguments?.[0];\n if (argument === undefined) return false;\n if (argument.kind === ts.SyntaxKind.VoidKeyword || argument.kind === ts.SyntaxKind.UndefinedKeyword) {\n return true;\n }\n return false;\n}\n\n/** Explicit `@PathParam` / `@QueryParam` / `@QueryString` mappings in source declaration order. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers\nexport function httpParametersOf(\n member: ts.MethodDeclaration,\n httpMethod: ContractHttpMethod,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n method: string,\n): ApiParameterMeta[] {\n const parameters: ApiParameterMeta[] = [];\n member.parameters.forEach((parameter: ts.ParameterDeclaration, index: number) => {\n let mapped = false;\n if (decoratorOn(parameter, 'QueryString') !== null) {\n parameters.push({ index, source: 'query-map' });\n return;\n }\n for (const source of ['path', 'query'] as const) {\n const decoratorNameWanted = source === 'path' ? 'PathParam' : 'QueryParam';\n const decorator = decoratorOn(parameter, decoratorNameWanted);\n if (decorator === null) continue;\n mapped = true;\n const wireName = decoratorArgValue(decoratorArgs(decorator)[0], constants);\n reportUnresolved(diagnostics, api, decoratorNameWanted, method, wireName, decorator);\n if (wireName.value !== null) {\n parameters.push({ index, source, wireName: wireName.value });\n }\n }\n if (!mapped && contractVerbCarriesBody(httpMethod)) parameters.push({ index, source: 'body' });\n });\n return parameters;\n}\n\n/** Default `callerKind` when an `external-inbound` endpoint declares `calledBy` alone — mirrors core-util. */\nconst DEFAULT_CALLER_KIND = 'saas';\n\n/** Resolved EXTERNAL_INBOUND caller declaration, or the source problem that prevented resolution. */\nexport class ExternalCallerRead {\n constructor(\n public readonly declaration: ExternalSystemDeclaration | null,\n /** What was wrong, as written, for the diagnostic. Null exactly when `declaration` is set. */\n public readonly problem: string | null,\n ) {}\n}\n\n/** Reads `calledBy` and optional `callerKind` from the fifth positional options argument. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function externalCallerOf(\n arg: ts.Expression | undefined,\n constants: ModuleStringConstants,\n): ExternalCallerRead {\n if (arg === undefined) return new ExternalCallerRead(null, '<no options argument>');\n if (!ts.isObjectLiteralExpression(arg)) return new ExternalCallerRead(null, arg.getText());\n const calledBy = objectPropertyValue(arg, 'calledBy', constants);\n if (calledBy.value === null || calledBy.value === '') {\n return new ExternalCallerRead(null, calledBy.unresolvedName ?? '<no calledBy>');\n }\n const callerKind = objectPropertyValue(arg, 'callerKind', constants);\n if (callerKind.value === null && callerKind.unresolvedName !== null) {\n return new ExternalCallerRead(null, `callerKind: ${callerKind.unresolvedName}`);\n }\n const kind = callerKind.value ?? DEFAULT_CALLER_KIND;\n if (!isExternalSystemKind(kind)) return new ExternalCallerRead(null, `callerKind: '${kind}'`);\n return new ExternalCallerRead({ kind, label: calledBy.value }, null);\n}\n\n/** One property of an object literal, read as a string through the same constant folding as an argument. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function objectPropertyValue(\n literal: ts.ObjectLiteralExpression,\n name: string,\n constants: ModuleStringConstants,\n): DecoratorArgValue {\n for (const property of literal.properties) {\n if (!ts.isPropertyAssignment(property) || property.name === undefined) continue;\n const key =\n ts.isIdentifier(property.name) || ts.isStringLiteral(property.name)\n ? property.name.text\n : null;\n if (key !== name) continue;\n return decoratorArgValue(property.initializer, constants);\n }\n return new DecoratorArgValue(null, null);\n}\n\n/** `@Queue('...')` override when present and resolvable, else the derived `${Api}-${method}`. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function queueNameOf(\n member: ts.MethodDeclaration,\n api: string,\n name: string,\n constants: ModuleStringConstants,\n diagnostics: DecoratorArgDiagnostics | null,\n): string {\n const override = memberDecorator(member, 'Queue');\n if (override === null) return `${api}-${name}`;\n const queueArg = decoratorArgValue(decoratorArgs(override)[0], constants);\n reportUnresolved(diagnostics, api, 'Queue', name, queueArg, override);\n return queueArg.value ?? `${api}-${name}`;\n}\n\n/** Record an argument that is present but unresolvable; a resolved or absent one is silent. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function reportUnresolved(\n diagnostics: DecoratorArgDiagnostics | null,\n api: string,\n decorator: string,\n method: string | null,\n arg: DecoratorArgValue,\n node: ts.Node,\n): void {\n if (diagnostics === null || arg.unresolvedName === null) return;\n diagnostics.record(api, decorator, method, arg.unresolvedName, node);\n}\n\n/** The arguments of a decorator's call expression, or [] when it is a bare `@Foo` reference. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function decoratorArgs(\n decorator: ts.Decorator,\n): ts.NodeArray<ts.Expression> | ts.Expression[] {\n return ts.isCallExpression(decorator.expression) ? decorator.expression.arguments : [];\n}\n\n/** The named decorator on a class member, or null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function memberDecorator(member: ts.ClassElement, name: string): ts.Decorator | null {\n const decorators = ts.getDecorators(member as ts.HasDecorators) ?? [];\n return decorators.find((d: ts.Decorator) => decoratorName(d) === name) ?? null;\n}\n\n/** The named decorator on any decorator-capable AST node (notably a method parameter). */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching memberDecorator\nexport function decoratorOn(node: ts.HasDecorators, name: string): ts.Decorator | null {\n const decorators = ts.getDecorators(node) ?? [];\n return decorators.find((decorator: ts.Decorator) => decoratorName(decorator) === name) ?? null;\n}\n\n/**\n * The first argument of a class decorator as a string (`@ApiPath('/x')`, `@ApiPath(X_PATH)`), else\n * null. A same-module constant resolves; anything else is recorded on `diagnostics`.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function decoratorStringArg(\n cls: ts.ClassDeclaration,\n name: string,\n constants: ModuleStringConstants = new ModuleStringConstants(new Map<string, string>()),\n diagnostics: DecoratorArgDiagnostics | null = null,\n api: string = name,\n): string | null {\n const decorator = classDecorators(cls).find((d: ts.Decorator) => decoratorName(d) === name);\n if (decorator === undefined) return null;\n const arg = decoratorArgValue(decoratorArgs(decorator)[0], constants);\n reportUnresolved(diagnostics, api, name, null, arg, decorator);\n return arg.value;\n}\n\n/** The constructor's parameters, or [] when the class declares no constructor. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function constructorParamsOf(cls: ts.ClassDeclaration): readonly ts.ParameterDeclaration[] {\n for (const member of cls.members) {\n if (ts.isConstructorDeclaration(member)) return member.parameters;\n }\n return [];\n}\n\n/**\n * The bare name of a type reference (`GmailApi`, or `gmail.GmailApi` -> `GmailApi`), else null.\n * Generic wrappers are deliberately NOT unwrapped: `Provider<GmailApi>` hands out the contract\n * lazily, which is still a use, but it is not the shape any of these seams take today and guessing\n * at type arguments would start matching things that merely mention a contract.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function typeReferenceName(type: ts.TypeNode | undefined): string | null {\n if (type === undefined || !ts.isTypeReferenceNode(type)) return null;\n const name = type.typeName;\n if (ts.isIdentifier(name)) return name.text;\n return ts.isQualifiedName(name) && ts.isIdentifier(name.right) ? name.right.text : null;\n}\n\n/** Every type name in the class's `implements` clause — the contracts this class IS, not ones it calls. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function implementedTypeNames(cls: ts.ClassDeclaration): Set<string> {\n const names = new Set<string>();\n for (const clause of cls.heritageClauses ?? []) {\n if (clause.token !== ts.SyntaxKind.ImplementsKeyword) continue;\n for (const type of clause.types) {\n if (ts.isIdentifier(type.expression)) names.add(type.expression.text);\n }\n }\n return names;\n}\n\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function isAbstractClass(cls: ts.ClassDeclaration): boolean {\n return (ts.getModifiers(cls) ?? []).some(\n (m: ts.Modifier) => m.kind === ts.SyntaxKind.AbstractKeyword,\n );\n}\n\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function hasClassDecorator(cls: ts.ClassDeclaration, name: string): boolean {\n return classDecorators(cls).some((d: ts.Decorator) => decoratorName(d) === name);\n}\n\n/**\n * The service a client-factory call aims at, from its config argument:\n * `createRpcClient(WarmupApi, new ClientConfig('helper-fsdb'))` → `'helper-fsdb'`.\n *\n * Only a `new <Xxx>ClientConfig('<string literal>')` yields a name. A variable, a template string\n * or a computed expression yields null — the target is genuinely unknown at scan time, and the\n * runtime graph must fall back to fan-out (loudly) rather than guess.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function targetServiceOf(call: ts.CallExpression): string | null {\n if (call.arguments.length < 2) return null;\n const config = call.arguments[1];\n if (!ts.isNewExpression(config) || !ts.isIdentifier(config.expression)) return null;\n if (!config.expression.text.endsWith(CLIENT_CONFIG_SUFFIX)) return null;\n const first = config.arguments?.[0];\n if (first === undefined || !ts.isStringLiteral(first)) return null;\n return first.text.length > 0 ? first.text : null;\n}\n\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function calleeMethodName(call: ts.CallExpression): string | null {\n const callee = call.expression;\n if (ts.isPropertyAccessExpression(callee)) return callee.name.text;\n if (ts.isIdentifier(callee)) return callee.text;\n return null;\n}\n\n// webpieces-disable no-function-outside-class -- pure path predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function isTestFile(fileName: string): boolean {\n return (\n fileName.includes('/__tests__/') ||\n fileName.includes('.spec.') ||\n fileName.includes('.test.')\n );\n}\n\n/** {api, owner, type:'rpc'|'pubsub'} for an in-repo contract class, else null. */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function apiClassInfoFromNode(\n node: ts.Node,\n project: string,\n diagnostics: DecoratorArgDiagnostics | null = null,\n): ApiClassInfo | null {\n return ts.isClassDeclaration(node) ? apiClassInfoFrom(node, project, diagnostics) : null;\n}\n\n/**\n * {api, owner, type:'external'} for a VENDOR contract, else null.\n *\n * A vendor contract cannot be detected the way an in-repo one is. It carries no @ApiPath (there is\n * no route — the call leaves through a vendor SDK), and it is usually a plain `interface` bound to a\n * Symbol token, which is not even a class. So inside a project the workspace has DECLARED external\n * (`runtime-architecture.externalApiPaths`) the signal is structural instead: an exported\n * `interface`/`abstract class` whose name ends in `Api`. That deliberately picks up `GmailApi` and\n * `StorageApi` while leaving their DTOs, `*Config` types and `*Client` implementations alone.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function externalApiInfoFrom(node: ts.Node, project: string): ApiClassInfo | null {\n const named =\n ts.isInterfaceDeclaration(node) || (ts.isClassDeclaration(node) && isAbstractClass(node));\n if (!named || !node.name || !isExported(node)) return null;\n const api = node.name.text;\n if (!api.endsWith(EXTERNAL_CONTRACT_SUFFIX)) return null;\n const externalSystem = externalSystemTagFrom(node, api);\n return externalSystem === null\n ? { api, owner: project, type: 'external', methods: [] }\n : { api, owner: project, type: 'external', methods: [], externalSystem };\n}\n\n/**\n * The `@externalSystem <kind> [label]` JSDoc tag on a vendor contract, or null when absent.\n *\n * JSDoc rather than a decorator is not a style choice: these seams are TS `interface`s, and TS has\n * no interface decorators. Without the tag the contract still renders — as the generic dashed box it\n * always was — so this is purely additive and nothing needs migrating.\n *\n * The label defaults to the contract name minus its `Api` suffix (`FirestoreAdminApi` →\n * `FirestoreAdmin`), because the label is the node IDENTITY: two contracts that mean the same system\n * must be given the SAME explicit label to converge on one node.\n *\n * An unrecognised kind is ignored rather than defaulted. Silently drawing a `@externalSystem\n * databse` typo as a generic box is recoverable; drawing it as the wrong shape teaches the reader\n * something false about the architecture.\n */\n// webpieces-disable no-function-outside-class -- pure AST accessor, matching the sibling helpers in di-graph/bindings.ts\nexport function externalSystemTagFrom(\n node: ts.Node,\n api: string,\n): ExternalSystemDeclaration | null {\n for (const tag of ts.getJSDocTags(node)) {\n if (tag.tagName.text !== EXTERNAL_SYSTEM_TAG) continue;\n const comment = typeof tag.comment === 'string' ? tag.comment : '';\n const parts = comment\n .trim()\n .split(/\\s+/)\n .filter((part: string) => part !== '');\n if (parts.length === 0) continue;\n const kind = parts[0].toLowerCase();\n if (!isExternalSystemKind(kind)) continue;\n const label = parts.slice(1).join(' ').trim();\n return { kind, label: label === '' ? api.replace(/Api$/, '') : label };\n }\n return null;\n}\n\n/** True when the declaration carries an `export` modifier. */\n// webpieces-disable no-function-outside-class -- pure AST predicate, matching the sibling helpers in di-graph/bindings.ts\nexport function isExported(node: ts.InterfaceDeclaration | ts.ClassDeclaration): boolean {\n return (ts.getModifiers(node) ?? []).some(\n (m: ts.Modifier) => m.kind === ts.SyntaxKind.ExportKeyword,\n );\n}\n\n// webpieces-disable no-function-outside-class -- recursive fs walker, matching the AST-helper style here\nexport function collectTsFiles(dir: string): string[] {\n const out: string[] = [];\n for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {\n const full = path.join(dir, entry.name);\n if (entry.isDirectory()) {\n if (entry.name !== 'node_modules') out.push(...collectTsFiles(full));\n } else if (entry.name.endsWith('.ts') && !entry.name.endsWith('.d.ts')) {\n out.push(full);\n }\n }\n return out;\n}\n"]}
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
*
|
|
11
11
|
* Split out of api-scanner.ts, which owns the scan itself and is at its file-size limit.
|
|
12
12
|
*/
|
|
13
|
-
import { EmptiedApiContract, UndeclaredEndpointOperation, UndeclaredExternalCaller, UnresolvedApiCall, UnresolvedEndpointPath, VoidResponseMismatch } from './api-relations';
|
|
13
|
+
import { AdditiveReadEndpoint, EmptiedApiContract, UndeclaredEndpointOperation, UndeclaredExternalCaller, UnresolvedApiCall, UnresolvedEndpointPath, VoidResponseMismatch } from './api-relations';
|
|
14
14
|
import { RootUnionFindings } from './root-union-scan';
|
|
15
15
|
import { ApiRuleFindings, McpExclusion } from './api-doc-rules';
|
|
16
16
|
/**
|
|
@@ -109,6 +109,11 @@ export declare class UndeclaredEndpointOperationError extends Error {
|
|
|
109
109
|
readonly endpoints: readonly UndeclaredEndpointOperation[];
|
|
110
110
|
constructor(endpoints: readonly UndeclaredEndpointOperation[]);
|
|
111
111
|
}
|
|
112
|
+
/** READ endpoints declaring `{ additive }` (#1423): a read changes nothing to be additive about. */
|
|
113
|
+
export declare class AdditiveReadEndpointError extends Error {
|
|
114
|
+
readonly endpoints: readonly AdditiveReadEndpoint[];
|
|
115
|
+
constructor(endpoints: readonly AdditiveReadEndpoint[]);
|
|
116
|
+
}
|
|
112
117
|
/**
|
|
113
118
|
* A routed contract whose `@ApiPath` argument the scan could not read. Fatal on purpose: shipping the
|
|
114
119
|
* entry without its basePath is what made `/whatsapp/test` render as `/test` in a downstream runbook.
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Split out of api-scanner.ts, which owns the scan itself and is at its file-size limit.
|
|
13
13
|
*/
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.EmptiedApiContractError = exports.UndeclaredExternalCallerError = exports.UnresolvedEndpointPathError = exports.MissingBasePathError = exports.UndeclaredEndpointOperationError = exports.VoidResponseMismatchError = exports.RootUnionApiTypeError = exports.ApiRulesForMcpError = exports.ApiRulesForOpenApiError = void 0;
|
|
15
|
+
exports.EmptiedApiContractError = exports.UndeclaredExternalCallerError = exports.UnresolvedEndpointPathError = exports.MissingBasePathError = exports.AdditiveReadEndpointError = exports.UndeclaredEndpointOperationError = exports.VoidResponseMismatchError = exports.RootUnionApiTypeError = exports.ApiRulesForMcpError = exports.ApiRulesForOpenApiError = void 0;
|
|
16
16
|
exports.describeMcpExclusions = describeMcpExclusions;
|
|
17
17
|
exports.describeUnresolvedApiCalls = describeUnresolvedApiCalls;
|
|
18
18
|
const api_relations_1 = require("./api-relations");
|
|
@@ -274,6 +274,22 @@ class UndeclaredEndpointOperationError extends Error {
|
|
|
274
274
|
}
|
|
275
275
|
}
|
|
276
276
|
exports.UndeclaredEndpointOperationError = UndeclaredEndpointOperationError;
|
|
277
|
+
/** READ endpoints declaring `{ additive }` (#1423): a read changes nothing to be additive about. */
|
|
278
|
+
class AdditiveReadEndpointError extends Error {
|
|
279
|
+
endpoints;
|
|
280
|
+
constructor(endpoints) {
|
|
281
|
+
super(`${endpoints.length} READ @Endpoint(s) declare { additive }:\n` +
|
|
282
|
+
endpoints
|
|
283
|
+
.map((e) => ` • ${e.api}.${e.method} at ${e.at}`)
|
|
284
|
+
.join('\n') +
|
|
285
|
+
`\n A read changes nothing, so it has nothing to be additive about, and @Endpoint's\n` +
|
|
286
|
+
` types already refuse it. Remove \`additive\` from the READ endpoint, or declare the\n` +
|
|
287
|
+
` operation WRITE / WRITE_IDEMPOTENT if the endpoint really adds state.`);
|
|
288
|
+
this.endpoints = endpoints;
|
|
289
|
+
this.name = 'AdditiveReadEndpointError';
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
exports.AdditiveReadEndpointError = AdditiveReadEndpointError;
|
|
277
293
|
/**
|
|
278
294
|
* A routed contract whose `@ApiPath` argument the scan could not read. Fatal on purpose: shipping the
|
|
279
295
|
* entry without its basePath is what made `/whatsapp/test` render as `/test` in a downstream runbook.
|