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

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 (73) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +102 -0
  3. package/REFERENCE.md +80 -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/generated-source-policy.d.ts +21 -0
  18. package/dist/src/generation/generated-source-policy.d.ts.map +1 -0
  19. package/dist/src/generation/generated-source-policy.js +126 -0
  20. package/dist/src/generation/generated-source-policy.js.map +1 -0
  21. package/dist/src/generation/generation-reuse.mjs +84 -0
  22. package/dist/src/generation/generator.d.ts +195 -0
  23. package/dist/src/generation/generator.d.ts.map +1 -0
  24. package/dist/src/generation/generator.js +566 -0
  25. package/dist/src/generation/generator.js.map +1 -0
  26. package/dist/src/generation/handler-generator.d.ts +7 -0
  27. package/dist/src/generation/handler-generator.d.ts.map +1 -0
  28. package/dist/src/generation/handler-generator.js +55 -0
  29. package/dist/src/generation/handler-generator.js.map +1 -0
  30. package/dist/src/generation/interface-generator.d.ts +21 -0
  31. package/dist/src/generation/interface-generator.d.ts.map +1 -0
  32. package/dist/src/generation/interface-generator.js +277 -0
  33. package/dist/src/generation/interface-generator.js.map +1 -0
  34. package/dist/src/generation/interface-provider.d.ts +30 -0
  35. package/dist/src/generation/interface-provider.d.ts.map +1 -0
  36. package/dist/src/generation/interface-provider.js +15 -0
  37. package/dist/src/generation/interface-provider.js.map +1 -0
  38. package/dist/src/generation/rejection-generator.d.ts +9 -0
  39. package/dist/src/generation/rejection-generator.d.ts.map +1 -0
  40. package/dist/src/generation/rejection-generator.js +62 -0
  41. package/dist/src/generation/rejection-generator.js.map +1 -0
  42. package/dist/src/generation/source-view.d.ts +103 -0
  43. package/dist/src/generation/source-view.d.ts.map +1 -0
  44. package/dist/src/generation/source-view.js +298 -0
  45. package/dist/src/generation/source-view.js.map +1 -0
  46. package/dist/src/index.d.ts +139 -0
  47. package/dist/src/index.d.ts.map +1 -0
  48. package/dist/src/index.js +546 -0
  49. package/dist/src/index.js.map +1 -0
  50. package/dist/src/io/atomic-manifest.d.ts +32 -0
  51. package/dist/src/io/atomic-manifest.d.ts.map +1 -0
  52. package/dist/src/io/atomic-manifest.js +56 -0
  53. package/dist/src/io/atomic-manifest.js.map +1 -0
  54. package/dist/src/io/manifest-reader.d.ts +8 -0
  55. package/dist/src/io/manifest-reader.d.ts.map +1 -0
  56. package/dist/src/io/manifest-reader.js +19 -0
  57. package/dist/src/io/manifest-reader.js.map +1 -0
  58. package/dist/src/model/model-graph.d.ts +68 -0
  59. package/dist/src/model/model-graph.d.ts.map +1 -0
  60. package/dist/src/model/model-graph.js +220 -0
  61. package/dist/src/model/model-graph.js.map +1 -0
  62. package/dist/src/model/npm-package-name.d.ts +7 -0
  63. package/dist/src/model/npm-package-name.d.ts.map +1 -0
  64. package/dist/src/model/npm-package-name.js +33 -0
  65. package/dist/src/model/npm-package-name.js.map +1 -0
  66. package/dist/src/model/registry-dependency.d.ts +10 -0
  67. package/dist/src/model/registry-dependency.d.ts.map +1 -0
  68. package/dist/src/model/registry-dependency.js +66 -0
  69. package/dist/src/model/registry-dependency.js.map +1 -0
  70. package/dist/tsconfig.tsbuildinfo +1 -0
  71. package/package.json +51 -0
  72. package/scripts/clean-dist.mjs +7 -0
  73. package/scripts/copy-runtime-modules.mjs +23 -0
@@ -0,0 +1,195 @@
1
+ import type { SpawnSyncReturns } from "node:child_process";
2
+ import { type ManifestFileOperations } from "../io/atomic-manifest.js";
3
+ import type { ModelSourceView } from "./source-view.js";
4
+ /**
5
+ * Bounded seams used to test failure handling while retaining real Buf integration.
6
+ */
7
+ export interface GenerationOperations {
8
+ /**
9
+ * Canonical live model root used only by the root transaction bootstrap.
10
+ */
11
+ readonly livePackageRoot?: string;
12
+ /**
13
+ * Executes Buf for the staged model sources.
14
+ *
15
+ * @param moduleRoot The temporary Buf module root.
16
+ * @param output The temporary generated-output directory.
17
+ * @param owned The package-relative Proto paths to generate.
18
+ * @param packageName The owning model package name.
19
+ * @param runner The optional subprocess runner.
20
+ */
21
+ readonly runBuf?: (moduleRoot: string, output: string, owned: readonly string[], packageName: string, runner?: SubprocessRunner) => void;
22
+ /**
23
+ * Executes interface companion generation after primary Buf generation succeeds.
24
+ *
25
+ * @param moduleRoot The temporary Buf module root.
26
+ * @param output The temporary generated-output directory.
27
+ * @param owned The package-relative Proto paths to generate.
28
+ * @param packageName The owning model package name.
29
+ * @param sourceView The bounded authored-source and staged-output compiler view.
30
+ * @param runner The optional subprocess runner.
31
+ */
32
+ readonly runInterfacePhase?: (moduleRoot: string, output: string, owned: readonly string[], packageName: string, sourceView: ModelSourceView, runner?: SubprocessRunner) => void;
33
+ /**
34
+ * Updates generated imports that belong to direct model dependencies.
35
+ *
36
+ * @param output The generated-output directory.
37
+ * @param owners The package that owns each Proto path.
38
+ * @param currentPackage The model package being generated.
39
+ */
40
+ readonly rewriteImports?: (output: string, owners: Readonly<Record<string, {
41
+ readonly packageName: string;
42
+ readonly generatedExport: string;
43
+ }>>, currentPackage: string) => void;
44
+ /**
45
+ * Writes the generated module descriptor.
46
+ *
47
+ * @param output The generated-output directory.
48
+ * @param exportName The generated module export name.
49
+ * @param packageName The owning model package name.
50
+ * @param dependencies The direct model-module dependencies.
51
+ */
52
+ readonly writeModule?: (output: string, exportName: string, packageName: string, dependencies: readonly {
53
+ readonly name: string;
54
+ readonly moduleExport: string;
55
+ }[]) => void;
56
+ /**
57
+ * Applies a filesystem rename during publication, backup, or rollback.
58
+ *
59
+ * @param from The current source path.
60
+ * @param to The destination path.
61
+ */
62
+ readonly rename?: (from: string, to: string) => void;
63
+ /**
64
+ * Overrides manifest publication filesystem operations for tests.
65
+ */
66
+ readonly manifestOperations?: Partial<ManifestFileOperations>;
67
+ /**
68
+ * Runs a subprocess for Buf generation or validation.
69
+ */
70
+ readonly runProcess?: SubprocessRunner;
71
+ /**
72
+ * Overrides generation-claim filesystem operations for tests.
73
+ */
74
+ readonly lockOperations?: Partial<GenerationLockOperations>;
75
+ }
76
+ /**
77
+ * Bounded lock seams for deterministic ownership and cleanup tests.
78
+ */
79
+ export interface GenerationLockOperations {
80
+ /**
81
+ * Creates a lock file with its owner content.
82
+ *
83
+ * @param path The unique lock-file path.
84
+ * @param content The serialized owner metadata.
85
+ */
86
+ readonly create: (path: string, content: string) => void;
87
+ /**
88
+ * Lists the entries in a package directory.
89
+ *
90
+ * @param directory The package directory to inspect.
91
+ * @returns The directory entry names.
92
+ */
93
+ readonly list: (directory: string) => readonly string[];
94
+ /**
95
+ * Reads the content of a lock file.
96
+ *
97
+ * @param path The lock-file path.
98
+ * @returns The serialized owner metadata.
99
+ */
100
+ readonly read: (path: string) => string;
101
+ /**
102
+ * Reads a regular lock through a no-follow descriptor with stable identity.
103
+ *
104
+ * @param path The lock-file path.
105
+ * @returns The owner content and opened-file identity.
106
+ */
107
+ readonly snapshot?: (path: string) => ClaimSnapshot;
108
+ /**
109
+ * Inspects the kind of a lock-file entry.
110
+ *
111
+ * @param path The lock-file path.
112
+ * @returns Whether the entry is regular, symbolic, or another kind.
113
+ */
114
+ readonly inspect: (path: string) => "regular" | "symlink" | "other";
115
+ /**
116
+ * Removes a lock file.
117
+ *
118
+ * @param path The lock-file path.
119
+ */
120
+ readonly remove: (path: string) => void;
121
+ /**
122
+ * Updates a claim path by atomically moving it within its package directory.
123
+ *
124
+ * @param from The current claim path.
125
+ * @param to The same-directory quarantine path.
126
+ */
127
+ readonly move?: (from: string, to: string) => void;
128
+ /**
129
+ * Determines whether a lock owner is still running.
130
+ *
131
+ * @param pid The candidate process identifier.
132
+ * @returns The liveness result for the candidate process.
133
+ */
134
+ readonly liveness: (pid: number) => ClaimLiveness;
135
+ }
136
+ /**
137
+ * Result of a bounded generation-claim liveness probe.
138
+ */
139
+ export type ClaimLiveness = "alive" | "dead" | "indeterminate";
140
+ /**
141
+ * Executes the packaged Buf executable in a synchronous subprocess.
142
+ *
143
+ * @param command The executable path.
144
+ * @param arguments_ The command-line arguments.
145
+ * @param options The working-directory, encoding, timeout, and buffer options.
146
+ * @returns The synchronous subprocess result.
147
+ */
148
+ export type SubprocessRunner = (command: string, arguments_: readonly string[], options: {
149
+ readonly cwd: string;
150
+ readonly encoding: "utf8";
151
+ readonly timeout: number;
152
+ readonly maxBuffer: number;
153
+ }) => SpawnSyncReturns<string>;
154
+ /**
155
+ * Bounded seams for atomic application-registry publication failures.
156
+ */
157
+ export interface CompositionOperations {
158
+ /**
159
+ * Overrides registry publication filesystem operations for tests.
160
+ */
161
+ readonly registryOperations?: Partial<ManifestFileOperations>;
162
+ }
163
+ interface ClaimSnapshot {
164
+ readonly content: string;
165
+ readonly identity: string;
166
+ }
167
+ /**
168
+ * Generates and composes deterministic Protobuf package artifacts.
169
+ */
170
+ export declare const ProtoGeneration: Readonly<{
171
+ /**
172
+ * Generates a model package's Protobuf-ES sources and module descriptor.
173
+ *
174
+ * @param packageRoot The root of the model package to generate.
175
+ * @param operations Optional bounded filesystem and process seams for tests.
176
+ */
177
+ generate(packageRoot: string, operations?: GenerationOperations): void;
178
+ /**
179
+ * Determines the liveness of a generation-claim owner.
180
+ *
181
+ * @param pid The process identifier to probe.
182
+ * @param probe The optional signal-zero probe to run.
183
+ * @returns Whether the claim owner is alive, dead, or indeterminate.
184
+ */
185
+ claimLiveness(pid: number, probe?: (candidate: number) => unknown): ClaimLiveness;
186
+ /**
187
+ * Composes an application's deterministic model registry.
188
+ *
189
+ * @param packageRoot The root of the application package to compose.
190
+ * @param operations Optional bounded manifest publication seams for tests.
191
+ */
192
+ compose(packageRoot: string, operations?: CompositionOperations): void;
193
+ }>;
194
+ export {};
195
+ //# sourceMappingURL=generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../src/generation/generator.ts"],"names":[],"mappings":"AAmCA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAM3D,OAAO,EAAgB,KAAK,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAGrF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IAGnC;;OAEG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC;IAElC;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,CAChB,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,WAAW,EAAE,MAAM,EACnB,MAAM,CAAC,EAAE,gBAAgB,KACtB,IAAI,CAAC;IAEV;;;;;;;;;OASG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAC3B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,eAAe,EAC3B,MAAM,CAAC,EAAE,gBAAgB,KACtB,IAAI,CAAC;IAEV;;;;;;OAMG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,QAAQ,CACd,MAAM,CAAC,MAA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