@spine-event-engine/proto-tools 2.0.0-snapshot.10

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.
Files changed (89) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +103 -0
  3. package/REFERENCE.md +90 -0
  4. package/bin/spine-proto.mjs +2 -0
  5. package/dist/src/cli/spine-proto-bootstrap.d.ts +4 -0
  6. package/dist/src/cli/spine-proto-bootstrap.d.ts.map +1 -0
  7. package/dist/src/cli/spine-proto-bootstrap.js +52 -0
  8. package/dist/src/cli/spine-proto-bootstrap.js.map +1 -0
  9. package/dist/src/cli/spine-proto.d.ts +3 -0
  10. package/dist/src/cli/spine-proto.d.ts.map +1 -0
  11. package/dist/src/cli/spine-proto.js +32 -0
  12. package/dist/src/cli/spine-proto.js.map +1 -0
  13. package/dist/src/generation/authored-interface-provider.d.ts +28 -0
  14. package/dist/src/generation/authored-interface-provider.d.ts.map +1 -0
  15. package/dist/src/generation/authored-interface-provider.js +244 -0
  16. package/dist/src/generation/authored-interface-provider.js.map +1 -0
  17. package/dist/src/generation/build-time-handler-analyzer.d.ts +195 -0
  18. package/dist/src/generation/build-time-handler-analyzer.d.ts.map +1 -0
  19. package/dist/src/generation/build-time-handler-analyzer.js +1308 -0
  20. package/dist/src/generation/build-time-handler-analyzer.js.map +1 -0
  21. package/dist/src/generation/generated-registry-writer.d.ts +58 -0
  22. package/dist/src/generation/generated-registry-writer.d.ts.map +1 -0
  23. package/dist/src/generation/generated-registry-writer.js +465 -0
  24. package/dist/src/generation/generated-registry-writer.js.map +1 -0
  25. package/dist/src/generation/generated-source-policy.d.ts +21 -0
  26. package/dist/src/generation/generated-source-policy.d.ts.map +1 -0
  27. package/dist/src/generation/generated-source-policy.js +126 -0
  28. package/dist/src/generation/generated-source-policy.js.map +1 -0
  29. package/dist/src/generation/generation-reuse.mjs +106 -0
  30. package/dist/src/generation/generator.d.ts +195 -0
  31. package/dist/src/generation/generator.d.ts.map +1 -0
  32. package/dist/src/generation/generator.js +566 -0
  33. package/dist/src/generation/generator.js.map +1 -0
  34. package/dist/src/generation/handler-codegen.d.ts +48 -0
  35. package/dist/src/generation/handler-codegen.d.ts.map +1 -0
  36. package/dist/src/generation/handler-codegen.js +214 -0
  37. package/dist/src/generation/handler-codegen.js.map +1 -0
  38. package/dist/src/generation/handler-generator.d.ts +7 -0
  39. package/dist/src/generation/handler-generator.d.ts.map +1 -0
  40. package/dist/src/generation/handler-generator.js +55 -0
  41. package/dist/src/generation/handler-generator.js.map +1 -0
  42. package/dist/src/generation/interface-generator.d.ts +21 -0
  43. package/dist/src/generation/interface-generator.d.ts.map +1 -0
  44. package/dist/src/generation/interface-generator.js +277 -0
  45. package/dist/src/generation/interface-generator.js.map +1 -0
  46. package/dist/src/generation/interface-provider.d.ts +30 -0
  47. package/dist/src/generation/interface-provider.d.ts.map +1 -0
  48. package/dist/src/generation/interface-provider.js +15 -0
  49. package/dist/src/generation/interface-provider.js.map +1 -0
  50. package/dist/src/generation/rejection-generator.d.ts +9 -0
  51. package/dist/src/generation/rejection-generator.d.ts.map +1 -0
  52. package/dist/src/generation/rejection-generator.js +62 -0
  53. package/dist/src/generation/rejection-generator.js.map +1 -0
  54. package/dist/src/generation/source-view.d.ts +103 -0
  55. package/dist/src/generation/source-view.d.ts.map +1 -0
  56. package/dist/src/generation/source-view.js +298 -0
  57. package/dist/src/generation/source-view.js.map +1 -0
  58. package/dist/src/index.d.ts +139 -0
  59. package/dist/src/index.d.ts.map +1 -0
  60. package/dist/src/index.js +546 -0
  61. package/dist/src/index.js.map +1 -0
  62. package/dist/src/io/atomic-manifest.d.ts +32 -0
  63. package/dist/src/io/atomic-manifest.d.ts.map +1 -0
  64. package/dist/src/io/atomic-manifest.js +56 -0
  65. package/dist/src/io/atomic-manifest.js.map +1 -0
  66. package/dist/src/io/manifest-reader.d.ts +8 -0
  67. package/dist/src/io/manifest-reader.d.ts.map +1 -0
  68. package/dist/src/io/manifest-reader.js +19 -0
  69. package/dist/src/io/manifest-reader.js.map +1 -0
  70. package/dist/src/model/model-graph.d.ts +68 -0
  71. package/dist/src/model/model-graph.d.ts.map +1 -0
  72. package/dist/src/model/model-graph.js +220 -0
  73. package/dist/src/model/model-graph.js.map +1 -0
  74. package/dist/src/model/npm-package-name.d.ts +7 -0
  75. package/dist/src/model/npm-package-name.d.ts.map +1 -0
  76. package/dist/src/model/npm-package-name.js +33 -0
  77. package/dist/src/model/npm-package-name.js.map +1 -0
  78. package/dist/src/model/registry-dependency.d.ts +10 -0
  79. package/dist/src/model/registry-dependency.d.ts.map +1 -0
  80. package/dist/src/model/registry-dependency.js +66 -0
  81. package/dist/src/model/registry-dependency.js.map +1 -0
  82. package/dist/src/testing/index.d.ts +8 -0
  83. package/dist/src/testing/index.d.ts.map +1 -0
  84. package/dist/src/testing/index.js +20 -0
  85. package/dist/src/testing/index.js.map +1 -0
  86. package/dist/tsconfig.tsbuildinfo +1 -0
  87. package/package.json +54 -0
  88. package/scripts/clean-dist.mjs +7 -0
  89. package/scripts/copy-runtime-modules.mjs +23 -0
@@ -0,0 +1,244 @@
1
+ /*
2
+ * Copyright 2026, CodeMatters. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5
+ * in compliance with the License. You may obtain a copy of the License at
6
+ *
7
+ * https://www.apache.org/licenses/LICENSE-2.0
8
+ *
9
+ * Unless required by applicable law or agreed to in writing, software distributed under the License
10
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11
+ * or implied. See the License for the specific language governing permissions and limitations under
12
+ * the License.
13
+ */
14
+ import { closeSync, constants, existsSync, fstatSync, lstatSync, openSync, readFileSync, realpathSync, } from "node:fs";
15
+ import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
16
+ import ts from "typescript";
17
+ const nonRegularInputDiagnostic = "spine-proto: source view contains non-regular TypeScript input";
18
+ const SourceSnapshotFiles = Object.freeze({
19
+ read(path) {
20
+ let descriptor;
21
+ try {
22
+ descriptor = openSync(path, constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW);
23
+ if (!fstatSync(descriptor).isFile())
24
+ throw new Error(nonRegularInputDiagnostic);
25
+ return readFileSync(descriptor, "utf8");
26
+ }
27
+ catch (error) {
28
+ if (error instanceof Error && error.message === nonRegularInputDiagnostic)
29
+ throw error;
30
+ throw new Error(nonRegularInputDiagnostic, { cause: error });
31
+ }
32
+ finally {
33
+ if (descriptor !== undefined)
34
+ closeSync(descriptor);
35
+ }
36
+ },
37
+ });
38
+ /**
39
+ * Resolves authored TypeScript interfaces from the validated model source view.
40
+ */
41
+ export class AuthoredInterfaceProvider {
42
+ // prettier-ignore
43
+ programs = new WeakMap();
44
+ // prettier-ignore
45
+ /**
46
+ * Resolves one compatible authored interface from the staged model Program.
47
+ *
48
+ * @param name Requested TypeScript interface identifier.
49
+ * @param members Generated messages that must satisfy the interface.
50
+ * @param sourceView Validated authored/staged compiler input.
51
+ * @returns The authored declaration import, or undefined without a source view.
52
+ */
53
+ resolve(name, members, sourceView) {
54
+ if (sourceView === undefined)
55
+ return undefined;
56
+ const program = this.program(sourceView);
57
+ const authoredSources = new Set(sourceView.authoredFiles.map((file) => resolve(file)));
58
+ const discoveryRoots = program
59
+ .getRootFileNames()
60
+ .filter((file) => authoredSources.has(resolve(file)));
61
+ const declaration = this.declaration(program, discoveryRoots, name);
62
+ const checker = program.getTypeChecker();
63
+ this.assertNamedModuleExport(checker, declaration, name);
64
+ this.assertLocalParents(checker, declaration, name, new Set(), authoredSources);
65
+ const interfaceType = checker.getTypeAtLocation(declaration);
66
+ for (const member of members) {
67
+ const type = this.messageType(program, checker, sourceView, member);
68
+ if (!checker.isTypeAssignableTo(type, interfaceType))
69
+ throw new Error(`spine-proto: authored interface ${name}: incompatible message ${member.typeName}`);
70
+ }
71
+ return Object.freeze({
72
+ importPath: this.importPath(sourceView, name, declaration.getSourceFile().fileName),
73
+ name,
74
+ });
75
+ }
76
+ program(sourceView) {
77
+ const cached = this.programs.get(sourceView);
78
+ if (cached !== undefined)
79
+ return cached;
80
+ this.assertSourceView(sourceView);
81
+ const configFile = join(sourceView.packageRoot, "tsconfig.json");
82
+ if (!existsSync(configFile))
83
+ throw new Error("spine-proto: authored interface discovery requires tsconfig.json");
84
+ const readSourceViewText = (path) => SourceSnapshotFiles.read(path);
85
+ const config = ts.readConfigFile(configFile, readSourceViewText);
86
+ if (config.error !== undefined)
87
+ throw new Error("spine-proto: authored interface discovery could not read tsconfig.json");
88
+ const parsed = ts.parseJsonConfigFileContent(config.config, { ...ts.sys, readFile: readSourceViewText }, sourceView.packageRoot, undefined, configFile);
89
+ if (parsed.errors.length > 0)
90
+ throw new Error("spine-proto: authored interface discovery has invalid tsconfig.json");
91
+ const configuredFiles = new Set(parsed.fileNames.map((file) => resolve(file)));
92
+ const authoredFiles = sourceView.authoredFiles.filter((file) => configuredFiles.has(resolve(file)));
93
+ const compilerFiles = sourceView.compilerFiles ?? sourceView.authoredFiles;
94
+ const capturedAuthored = new Map(compilerFiles.map((file) => [resolve(file), SourceSnapshotFiles.read(file)]));
95
+ const host = ts.createCompilerHost(parsed.options);
96
+ const redirect = (path) => {
97
+ const liveRelative = relative(sourceView.liveGeneratedRoot, resolve(path));
98
+ return liveRelative === "" || (!liveRelative.startsWith("..") && !isAbsolute(liveRelative))
99
+ ? join(sourceView.stagedGeneratedRoot, liveRelative)
100
+ : path;
101
+ };
102
+ const readFile = host.readFile.bind(host);
103
+ const fileExists = host.fileExists.bind(host);
104
+ host.readFile = (path) => capturedAuthored.get(resolve(path)) ?? readFile(redirect(path));
105
+ host.fileExists = (path) => capturedAuthored.has(resolve(path)) || fileExists(redirect(path));
106
+ const program = ts.createProgram({
107
+ options: parsed.options,
108
+ ...(parsed.projectReferences === undefined
109
+ ? {}
110
+ : { projectReferences: parsed.projectReferences }),
111
+ rootNames: [...authoredFiles, ...this.stagedFiles(sourceView.stagedGeneratedRoot)],
112
+ host,
113
+ });
114
+ this.programs.set(sourceView, program);
115
+ return program;
116
+ }
117
+ stagedFiles(root) {
118
+ return ts.sys.readDirectory(root, [".cts", ".mts", ".ts", ".tsx"], undefined, ["**/*"]);
119
+ }
120
+ assertSourceView(sourceView) {
121
+ const packageRoot = realpathSync(sourceView.packageRoot);
122
+ const canonicalPath = (path) => resolve(packageRoot, relative(sourceView.packageRoot, resolve(path)));
123
+ const liveGeneratedRoot = canonicalPath(sourceView.liveGeneratedRoot);
124
+ const parent = dirname(liveGeneratedRoot);
125
+ const generatedName = basename(liveGeneratedRoot);
126
+ const stage = join(parent, `.${generatedName}.stage-`);
127
+ const backup = join(parent, `.${generatedName}.`);
128
+ const dist = join(packageRoot, "dist");
129
+ const authoredFiles = new Set(sourceView.authoredFiles.map((file) => resolve(file)));
130
+ const isDeclaration = (path) => [".d.cts", ".d.mts", ".d.ts"].some((extension) => path.endsWith(extension));
131
+ const within = (root, path) => {
132
+ const pathRelative = relative(root, path);
133
+ return pathRelative === "" || (!pathRelative.startsWith("..") && !isAbsolute(pathRelative));
134
+ };
135
+ for (const file of sourceView.compilerFiles ?? sourceView.authoredFiles) {
136
+ const candidate = canonicalPath(file);
137
+ if (candidate === dist || candidate.startsWith(`${dist}/`))
138
+ throw new Error("spine-proto: authored interface discovery source path escapes model module");
139
+ if (lstatSync(file).isSymbolicLink() ||
140
+ !within(packageRoot, realpathSync(file)) ||
141
+ candidate === liveGeneratedRoot ||
142
+ candidate.startsWith(`${liveGeneratedRoot}/`) ||
143
+ candidate.startsWith(stage) ||
144
+ (candidate.startsWith(backup) && candidate.includes(".backup")) ||
145
+ (authoredFiles.has(resolve(file)) && isDeclaration(candidate)))
146
+ throw new Error("spine-proto: authored interface discovery source path escapes model module");
147
+ }
148
+ }
149
+ declaration(program, discoveryRoots, name) {
150
+ const sources = discoveryRoots
151
+ .map((file) => program.getSourceFile(file))
152
+ .filter((source) => source !== undefined);
153
+ const candidates = discoveryRoots.flatMap((file) => {
154
+ const source = program.getSourceFile(file);
155
+ if (source === undefined)
156
+ return [];
157
+ return source.statements.filter((statement) => ts.isInterfaceDeclaration(statement) && statement.name.text === name);
158
+ });
159
+ if (candidates.length === 0) {
160
+ if (sources.some((source) => source.statements.some((statement) => ts.isTypeAliasDeclaration(statement) && statement.name.text === name)))
161
+ throw new Error(`spine-proto: authored interface ${name}: declaration is not an interface`);
162
+ if (sources.some((source) => this.nestedInterface(source, name)))
163
+ throw new Error(`spine-proto: authored interface ${name}: nested interface is not supported`);
164
+ throw new Error(`spine-proto: authored interface ${name}: missing top-level interface`);
165
+ }
166
+ if (candidates.length > 1)
167
+ throw new Error(`spine-proto: authored interface ${name}: ambiguous top-level interface`);
168
+ const declaration = candidates[0];
169
+ if (declaration === undefined)
170
+ throw new Error(`spine-proto: authored interface ${name}: missing top-level interface`);
171
+ if (declaration.typeParameters !== undefined && declaration.typeParameters.length > 0)
172
+ throw new Error(`spine-proto: authored interface ${name}: generic interface is unbound`);
173
+ return declaration;
174
+ }
175
+ nestedInterface(source, name) {
176
+ let nested = false;
177
+ const visit = (node) => {
178
+ if (node !== source && ts.isInterfaceDeclaration(node) && node.name.text === name)
179
+ nested = true;
180
+ ts.forEachChild(node, visit);
181
+ };
182
+ ts.forEachChild(source, visit);
183
+ return nested;
184
+ }
185
+ assertNamedModuleExport(checker, declaration, name) {
186
+ const module = checker.getSymbolAtLocation(declaration.getSourceFile());
187
+ if (module === undefined ||
188
+ !checker.getExportsOfModule(module).some((candidate) => candidate.name === name))
189
+ throw new Error(`spine-proto: authored interface ${name}: declaration must be a named module export`);
190
+ }
191
+ messageType(program, checker, sourceView, member) {
192
+ const proto = member.file.proto.name;
193
+ const generated = join(sourceView.stagedGeneratedRoot, `${proto.slice(0, -".proto".length)}_pb.ts`);
194
+ const source = program.getSourceFile(generated);
195
+ if (source === undefined)
196
+ throw new Error(`spine-proto: authored interface ${member.name}: missing staged generated message`);
197
+ const module = checker.getSymbolAtLocation(source);
198
+ const packagePrefix = `${member.file.proto.package}.`;
199
+ const generatedName = member.typeName.startsWith(packagePrefix)
200
+ ? member.typeName.slice(packagePrefix.length).replaceAll(".", "_")
201
+ : member.name;
202
+ const symbol = module === undefined
203
+ ? undefined
204
+ : checker.getExportsOfModule(module).find((value) => value.name === generatedName);
205
+ if (symbol === undefined)
206
+ throw new Error(`spine-proto: authored interface ${member.name}: missing staged generated message`);
207
+ return checker.getDeclaredTypeOfSymbol(symbol);
208
+ }
209
+ assertLocalParents(checker, declaration, name, active, localSources) {
210
+ const clauses = Object.getOwnPropertyDescriptor(declaration, "heritageClauses")?.value;
211
+ if (clauses === undefined)
212
+ return;
213
+ for (const clause of clauses) {
214
+ for (const parent of clause.types) {
215
+ const referenced = checker.getSymbolAtLocation(parent.expression);
216
+ const symbol = referenced !== undefined && (referenced.flags & ts.SymbolFlags.Alias) !== 0
217
+ ? checker.getAliasedSymbol(referenced)
218
+ : referenced;
219
+ if (symbol === undefined)
220
+ throw new Error(`spine-proto: authored interface ${name}: extends parent must stay in the model module`);
221
+ if (active.has(symbol))
222
+ throw new Error(`spine-proto: authored interface ${name}: cyclic extends chain`);
223
+ active.add(symbol);
224
+ const parentDeclaration = symbol.declarations?.find(ts.isInterfaceDeclaration);
225
+ if (parentDeclaration === undefined)
226
+ throw new Error(`spine-proto: authored interface ${name}: extends parent must stay in the model module`);
227
+ if (parentDeclaration.typeParameters !== undefined &&
228
+ parentDeclaration.typeParameters.length > 0)
229
+ throw new Error(`spine-proto: authored interface ${name}: generic extends parent is not supported`);
230
+ if (!localSources.has(resolve(parentDeclaration.getSourceFile().fileName)))
231
+ throw new Error(`spine-proto: authored interface ${name}: extends parent must stay in the model module`);
232
+ this.assertLocalParents(checker, parentDeclaration, name, active, localSources);
233
+ active.delete(symbol);
234
+ }
235
+ }
236
+ }
237
+ importPath(sourceView, name, source) {
238
+ const output = join(sourceView.liveGeneratedRoot, "interfaces", `${name}.ts`);
239
+ const extension = extname(source);
240
+ const path = `${relative(dirname(output), source.slice(0, -extension.length))}.js`;
241
+ return path.startsWith(".") ? path : `./${path}`;
242
+ }
243
+ }
244
+ //# sourceMappingURL=authored-interface-provider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authored-interface-provider.js","sourceRoot":"","sources":["../../../src/generation/authored-interface-provider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EACL,SAAS,EACT,SAAS,EACT,UAAU,EACV,SAAS,EACT,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG5F,OAAO,EAAE,MAAM,YAAY,CAAC;AAQ5B,MAAM,yBAAyB,GAAG,gEAAgE,CAAC;AAEnG,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC;IACxC,IAAI,CAAC,IAAY;QACf,IAAI,UAA8B,CAAC;QACnC,IAAI,CAAC;YACH,UAAU,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,QAAQ,GAAG,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,CAAC,CAAC;YAC9F,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;YAChF,OAAO,YAAY,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QAC1C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,yBAAyB;gBAAE,MAAM,KAAK,CAAC;YACvF,MAAM,IAAI,KAAK,CAAC,yBAAyB,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/D,CAAC;gBAAS,CAAC;YACT,IAAI,UAAU,KAAK,SAAS;gBAA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AY,EAAE,MAAc;QAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,CAAC,iBAAiB,EAAE,YAAY,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;QAC9E,MAAM,SAAS,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;QAClC,MAAM,IAAI,GAAG,GAAG,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC;QACnF,OAAO,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;IACnD,CAAC;CACF"}
@@ -0,0 +1,195 @@
1
+ import ts from "typescript";
2
+ type GeneratedHandlerKind = "command-assignment" | "command-substitution" | "command-reaction" | "event-subscription" | "state-subscription" | "event-reaction";
3
+ type GeneratedHandlerParameterCount = 1 | 2;
4
+ /**
5
+ * Build-time analysis result for bare decorated receiver handler methods.
6
+ */
7
+ export interface BuildHandlerAnalysis {
8
+ /**
9
+ * All generated Entity and standalone receiver declarations.
10
+ */
11
+ readonly receivers: readonly BuildReceiverHandlers[];
12
+ /**
13
+ * Deterministic diagnostics for unsupported handler declarations.
14
+ */
15
+ readonly diagnostics: readonly BuildHandlerDiagnostic[];
16
+ }
17
+ /**
18
+ * Build-time entity group shaped for later generated registry rendering.
19
+ */
20
+ export interface BuildEntityHandlers {
21
+ /**
22
+ * Entity class declaration name.
23
+ */
24
+ readonly className: string;
25
+ /**
26
+ * Whether the class is imported from a default export.
27
+ */
28
+ readonly defaultExport?: boolean;
29
+ /**
30
+ * Marks this declaration as an Entity receiver.
31
+ */
32
+ readonly receiverKind: "entity";
33
+ /**
34
+ * Source file where the entity class is declared.
35
+ */
36
+ readonly sourceFile: string;
37
+ /**
38
+ * Importable generated schema reference for entity state.
39
+ */
40
+ readonly stateSchema: SchemaReference;
41
+ /**
42
+ * Analyzed bare-decorator handler records.
43
+ */
44
+ readonly handlers: readonly BuildHandlerRecord[];
45
+ }
46
+ /**
47
+ * Build-time standalone receiver declaration.
48
+ */
49
+ export interface BuildStandaloneHandlers {
50
+ /**
51
+ * Marks this declaration as a standalone receiver.
52
+ */
53
+ readonly receiverKind: "standalone";
54
+ /**
55
+ * Standalone receiver class declaration name.
56
+ */
57
+ readonly className: string;
58
+ /**
59
+ * Indicates that the receiver class is a default export.
60
+ */
61
+ readonly defaultExport?: boolean;
62
+ /**
63
+ * Source file that declares the standalone receiver class.
64
+ */
65
+ readonly sourceFile: string;
66
+ /**
67
+ * Analyzed decorated handler records in declaration order.
68
+ */
69
+ readonly handlers: readonly BuildHandlerRecord[];
70
+ }
71
+ /**
72
+ * One generated receiver declaration.
73
+ */
74
+ export type BuildReceiverHandlers = BuildEntityHandlers | BuildStandaloneHandlers;
75
+ /**
76
+ * Importable generated schema reference used by later source rendering.
77
+ */
78
+ export interface SchemaReference {
79
+ /**
80
+ * Module specifier exactly as declared by analyzed source.
81
+ */
82
+ readonly moduleSpecifier: string;
83
+ /**
84
+ * Generated schema export name in that module.
85
+ */
86
+ readonly exportName: string;
87
+ }
88
+ /**
89
+ * Build-time handler record before generated source rendering.
90
+ */
91
+ export interface BuildHandlerRecord {
92
+ /**
93
+ * Handler role inferred from the bare decorator.
94
+ */
95
+ readonly kind: GeneratedHandlerKind;
96
+ /**
97
+ * String method name selected by the generated metadata.
98
+ */
99
+ readonly methodName: string;
100
+ /**
101
+ * Generated schema accepted by the first handler parameter.
102
+ */
103
+ readonly signalSchema: SchemaReference;
104
+ /**
105
+ * Generated schemas emitted by the handler return type.
106
+ */
107
+ readonly emittedSchemas: readonly SchemaReference[];
108
+ /**
109
+ * Public method arity: `handler(signal)` or `handler(signal, context)`.
110
+ */
111
+ readonly parameterCount: GeneratedHandlerParameterCount;
112
+ /**
113
+ * Origin declared on the first receptor parameter.
114
+ */
115
+ readonly origin: "domestic" | "external";
116
+ /**
117
+ * Optional statically declared Event field filter.
118
+ */
119
+ readonly where?: BuildWhereOptions;
120
+ }
121
+ /**
122
+ * Build-time representation of one `@Where` declaration.
123
+ */
124
+ export interface BuildWhereOptions {
125
+ /**
126
+ * Proto source-name path selected by the declaration.
127
+ */
128
+ readonly eventField: string;
129
+ /**
130
+ * Declared field value in Stringifier text form.
131
+ */
132
+ readonly equals: string;
133
+ }
134
+ /**
135
+ * Stable diagnostic codes emitted by build-time handler analysis.
136
+ */
137
+ export type BuildHandlerDiagnosticCode = "APPLY_DECORATOR" | "FRAMEWORK_ENVELOPE_RETURN" | "INVALID_EMITTED_SCHEMA" | "INVALID_HANDLER_NAME" | "INVALID_HANDLER_CONTEXT" | "INVALID_HANDLER_VISIBILITY" | "INVALID_PARAMETER_COUNT" | "INVALID_SIGNAL_TYPE" | "INVALID_EXTERNAL_ORIGIN" | "EXTERNAL_COMMAND_RECEIVER" | "INVALID_SUBSCRIBE_RETURN" | "INVALID_WHERE" | "MISSING_EMITTED_SCHEMAS" | "MISSING_ENTITY_STATE_SCHEMA" | "MISSING_RETURN_TYPE" | "MISSING_SIGNAL_TYPE" | "NON_EXPORTED_RECEIVER_CLASS" | "SCHEMA_BEARING_DECORATOR" | "TYPESCRIPT_SYNTAX_ERROR" | "UNSUPPORTED_COMMAND_HANDLER" | "UNSUPPORTED_RETURN_TYPE";
138
+ /**
139
+ * One build-time analyzer diagnostic.
140
+ */
141
+ export interface BuildHandlerDiagnostic {
142
+ /**
143
+ * Stable machine-readable diagnostic code.
144
+ */
145
+ readonly code: BuildHandlerDiagnosticCode;
146
+ /**
147
+ * Source file where the diagnostic was found.
148
+ */
149
+ readonly sourceFile: string;
150
+ /**
151
+ * One-based source line.
152
+ */
153
+ readonly line: number;
154
+ /**
155
+ * One-based source column.
156
+ */
157
+ readonly column: number;
158
+ /**
159
+ * Human-readable diagnostic message.
160
+ */
161
+ readonly message: string;
162
+ /**
163
+ * Entity class name when available.
164
+ */
165
+ readonly className?: string;
166
+ /**
167
+ * Handler method name when available.
168
+ */
169
+ readonly methodName?: string;
170
+ }
171
+ /**
172
+ * Inspects configured TypeScript source files for bare Spine handler decorators.
173
+ */
174
+ export interface BuildHandlerAnalyzer {
175
+ /**
176
+ * Inspects source files and returns receiver handler records with deterministic diagnostics.
177
+ *
178
+ * @param program TypeScript program that owns the source files and diagnostics.
179
+ * @param sourceFiles Application source files to inspect; defaults to program files.
180
+ * @returns Receiver handler records and deterministic diagnostics.
181
+ */
182
+ analyze(program: ts.Program, sourceFiles?: readonly ts.SourceFile[]): BuildHandlerAnalysis;
183
+ }
184
+ /**
185
+ * Provides build-time analysis for bare Spine handler decorators.
186
+ */
187
+ export declare const BuildHandlerAnalyzer: BuildHandlerAnalyzer;
188
+ /**
189
+ * Finds the package identity that owns an analyzed source file.
190
+ */
191
+ export declare const PackageIdentity: Readonly<{
192
+ nameFor(sourceFile: string): string | undefined;
193
+ }>;
194
+ export {};
195
+ //# sourceMappingURL=build-time-handler-analyzer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-time-handler-analyzer.d.ts","sourceRoot":"","sources":["../../../src/generation/build-time-handler-analyzer.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,MAAM,YAAY,CAAC;AAE5B,KAAK,oBAAoB,GACrB,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,GAClB,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,CAAC;AACrB,KAAK,8BAA8B,GAAG,CAAC,GAAG,CAAC,CAAC;AAE5C;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAGnC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,SAAS,qBAAqB,EAAE,CAAC;IAErD;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,SAAS,sBAAsB,EAAE,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAGlC;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAE3B;;OAEG;IACH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