@cobol-ts/validation-execution 0.0.0-stage → 0.0.59

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 (174) hide show
  1. package/README.md +256 -3
  2. package/dist/index.d.ts +41 -0
  3. package/dist/index.js +59 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/src/compaction.prepare.d.ts +10 -0
  6. package/dist/src/compaction.prepare.js +60 -0
  7. package/dist/src/compaction.prepare.js.map +1 -0
  8. package/dist/src/compaction.project.d.ts +28 -0
  9. package/dist/src/compaction.project.js +81 -0
  10. package/dist/src/compaction.project.js.map +1 -0
  11. package/dist/src/compaction.project.memory.d.ts +12 -0
  12. package/dist/src/compaction.project.memory.js +70 -0
  13. package/dist/src/compaction.project.memory.js.map +1 -0
  14. package/dist/src/compaction.project.spec.d.ts +1 -0
  15. package/dist/src/compaction.project.spec.js +44 -0
  16. package/dist/src/compaction.project.spec.js.map +1 -0
  17. package/dist/src/compaction.project.storage.d.ts +21 -0
  18. package/dist/src/compaction.project.storage.js +3 -0
  19. package/dist/src/compaction.project.storage.js.map +1 -0
  20. package/dist/src/identification.candidate.d.ts +16 -0
  21. package/dist/src/identification.candidate.js +40 -0
  22. package/dist/src/identification.candidate.js.map +1 -0
  23. package/dist/src/identification.context.d.ts +8 -0
  24. package/dist/src/identification.context.js +3 -0
  25. package/dist/src/identification.context.js.map +1 -0
  26. package/dist/src/identification.selection.d.ts +4 -0
  27. package/dist/src/identification.selection.js +3 -0
  28. package/dist/src/identification.selection.js.map +1 -0
  29. package/dist/src/identified.state.publication.d.ts +14 -0
  30. package/dist/src/identified.state.publication.js +3 -0
  31. package/dist/src/identified.state.publication.js.map +1 -0
  32. package/dist/src/identified.state.reader.spec.d.ts +1 -0
  33. package/dist/src/identified.state.reader.spec.js +101 -0
  34. package/dist/src/identified.state.reader.spec.js.map +1 -0
  35. package/dist/src/identified.state.source.d.ts +20 -0
  36. package/dist/src/identified.state.source.js +5 -0
  37. package/dist/src/identified.state.source.js.map +1 -0
  38. package/dist/src/projected.entity.d.ts +8 -0
  39. package/dist/src/projected.entity.js +55 -0
  40. package/dist/src/projected.entity.js.map +1 -0
  41. package/dist/src/validation.candidate.execution.d.ts +6 -0
  42. package/dist/src/validation.candidate.execution.js +31 -0
  43. package/dist/src/validation.candidate.execution.js.map +1 -0
  44. package/dist/src/validation.candidate.failure.d.ts +5 -0
  45. package/dist/src/validation.candidate.failure.js +22 -0
  46. package/dist/src/validation.candidate.failure.js.map +1 -0
  47. package/dist/src/validation.candidate.policy.d.ts +16 -0
  48. package/dist/src/validation.candidate.policy.js +43 -0
  49. package/dist/src/validation.candidate.policy.js.map +1 -0
  50. package/dist/src/validation.candidate.policy.spec.d.ts +1 -0
  51. package/dist/src/validation.candidate.policy.spec.js +32 -0
  52. package/dist/src/validation.candidate.policy.spec.js.map +1 -0
  53. package/dist/src/validation.cursors.d.ts +23 -0
  54. package/dist/src/validation.cursors.js +117 -0
  55. package/dist/src/validation.cursors.js.map +1 -0
  56. package/dist/src/validation.display.d.ts +13 -0
  57. package/dist/src/validation.display.js +45 -0
  58. package/dist/src/validation.display.js.map +1 -0
  59. package/dist/src/validation.display.project.d.ts +4 -0
  60. package/dist/src/validation.display.project.js +20 -0
  61. package/dist/src/validation.display.project.js.map +1 -0
  62. package/dist/src/validation.identification.cutoffs.spec.d.ts +1 -0
  63. package/dist/src/validation.identification.cutoffs.spec.js +124 -0
  64. package/dist/src/validation.identification.cutoffs.spec.js.map +1 -0
  65. package/dist/src/validation.identification.execution.d.ts +11 -0
  66. package/dist/src/validation.identification.execution.js +36 -0
  67. package/dist/src/validation.identification.execution.js.map +1 -0
  68. package/dist/src/validation.identification.inspect.recovered.d.ts +9 -0
  69. package/dist/src/validation.identification.inspect.recovered.js +101 -0
  70. package/dist/src/validation.identification.inspect.recovered.js.map +1 -0
  71. package/dist/src/validation.identification.materialise.d.ts +26 -0
  72. package/dist/src/validation.identification.materialise.js +67 -0
  73. package/dist/src/validation.identification.materialise.js.map +1 -0
  74. package/dist/src/validation.identification.observation.d.ts +15 -0
  75. package/dist/src/validation.identification.observation.js +51 -0
  76. package/dist/src/validation.identification.observation.js.map +1 -0
  77. package/dist/src/validation.identification.observation.spec.d.ts +1 -0
  78. package/dist/src/validation.identification.observation.spec.js +29 -0
  79. package/dist/src/validation.identification.observation.spec.js.map +1 -0
  80. package/dist/src/validation.identification.physical.d.ts +26 -0
  81. package/dist/src/validation.identification.physical.js +79 -0
  82. package/dist/src/validation.identification.physical.js.map +1 -0
  83. package/dist/src/validation.identification.prefix.d.ts +27 -0
  84. package/dist/src/validation.identification.prefix.js +62 -0
  85. package/dist/src/validation.identification.prefix.js.map +1 -0
  86. package/dist/src/validation.identification.prefix.spec.d.ts +1 -0
  87. package/dist/src/validation.identification.prefix.spec.js +76 -0
  88. package/dist/src/validation.identification.prefix.spec.js.map +1 -0
  89. package/dist/src/validation.identification.projection.d.ts +6 -0
  90. package/dist/src/validation.identification.projection.js +21 -0
  91. package/dist/src/validation.identification.projection.js.map +1 -0
  92. package/dist/src/validation.identification.replay.d.ts +18 -0
  93. package/dist/src/validation.identification.replay.js +110 -0
  94. package/dist/src/validation.identification.replay.js.map +1 -0
  95. package/dist/src/validation.identification.satisfaction.d.ts +49 -0
  96. package/dist/src/validation.identification.satisfaction.js +116 -0
  97. package/dist/src/validation.identification.satisfaction.js.map +1 -0
  98. package/dist/src/validation.identification.scope.d.ts +7 -0
  99. package/dist/src/validation.identification.scope.js +60 -0
  100. package/dist/src/validation.identification.scope.js.map +1 -0
  101. package/dist/src/validation.identification.shard.d.ts +23 -0
  102. package/dist/src/validation.identification.shard.js +56 -0
  103. package/dist/src/validation.identification.shard.js.map +1 -0
  104. package/dist/src/validation.identification.strategy.d.ts +6 -0
  105. package/dist/src/validation.identification.strategy.js +26 -0
  106. package/dist/src/validation.identification.strategy.js.map +1 -0
  107. package/dist/src/validation.identification.strategy.spec.d.ts +1 -0
  108. package/dist/src/validation.identification.strategy.spec.js +31 -0
  109. package/dist/src/validation.identification.strategy.spec.js.map +1 -0
  110. package/dist/src/validation.identified.state.d.ts +34 -0
  111. package/dist/src/validation.identified.state.js +90 -0
  112. package/dist/src/validation.identified.state.js.map +1 -0
  113. package/dist/src/validation.investigation.d.ts +32 -0
  114. package/dist/src/validation.investigation.js +57 -0
  115. package/dist/src/validation.investigation.js.map +1 -0
  116. package/dist/src/validation.layouts.d.ts +26 -0
  117. package/dist/src/validation.layouts.js +78 -0
  118. package/dist/src/validation.layouts.js.map +1 -0
  119. package/dist/src/validation.manifest.reader.d.ts +16 -0
  120. package/dist/src/validation.manifest.reader.js +37 -0
  121. package/dist/src/validation.manifest.reader.js.map +1 -0
  122. package/dist/src/validation.observation.d.ts +58 -0
  123. package/dist/src/validation.observation.js +234 -0
  124. package/dist/src/validation.observation.js.map +1 -0
  125. package/dist/src/validation.oracle.dependencies.d.ts +29 -0
  126. package/dist/src/validation.oracle.dependencies.js +108 -0
  127. package/dist/src/validation.oracle.dependencies.js.map +1 -0
  128. package/dist/src/validation.oracle.dependencies.spec.d.ts +1 -0
  129. package/dist/src/validation.oracle.dependencies.spec.js +40 -0
  130. package/dist/src/validation.oracle.dependencies.spec.js.map +1 -0
  131. package/dist/src/validation.project.access.d.ts +23 -0
  132. package/dist/src/validation.project.access.js +13 -0
  133. package/dist/src/validation.project.access.js.map +1 -0
  134. package/dist/src/validation.reader.d.ts +17 -0
  135. package/dist/src/validation.reader.js +181 -0
  136. package/dist/src/validation.reader.js.map +1 -0
  137. package/dist/src/validation.reader.types.d.ts +23 -0
  138. package/dist/src/validation.reader.types.js +3 -0
  139. package/dist/src/validation.reader.types.js.map +1 -0
  140. package/dist/src/validation.recovered.shard.d.ts +8 -0
  141. package/dist/src/validation.recovered.shard.js +3 -0
  142. package/dist/src/validation.recovered.shard.js.map +1 -0
  143. package/dist/src/validation.reference.d.ts +5 -0
  144. package/dist/src/validation.reference.js +3 -0
  145. package/dist/src/validation.reference.js.map +1 -0
  146. package/dist/src/validation.replay.d.ts +27 -0
  147. package/dist/src/validation.replay.js +137 -0
  148. package/dist/src/validation.replay.js.map +1 -0
  149. package/dist/src/validation.report.d.ts +59 -0
  150. package/dist/src/validation.report.js +118 -0
  151. package/dist/src/validation.report.js.map +1 -0
  152. package/dist/src/validation.report.spec.d.ts +1 -0
  153. package/dist/src/validation.report.spec.js +75 -0
  154. package/dist/src/validation.report.spec.js.map +1 -0
  155. package/dist/src/validation.run.d.ts +10 -0
  156. package/dist/src/validation.run.js +20 -0
  157. package/dist/src/validation.run.js.map +1 -0
  158. package/dist/src/validation.run.project.d.ts +5 -0
  159. package/dist/src/validation.run.project.js +57 -0
  160. package/dist/src/validation.run.project.js.map +1 -0
  161. package/dist/src/validation.sequence.d.ts +11 -0
  162. package/dist/src/validation.sequence.js +59 -0
  163. package/dist/src/validation.sequence.js.map +1 -0
  164. package/dist/src/validation.sources.d.ts +11 -0
  165. package/dist/src/validation.sources.js +3 -0
  166. package/dist/src/validation.sources.js.map +1 -0
  167. package/dist/src/validation.sources.spec.d.ts +1 -0
  168. package/dist/src/validation.sources.spec.js +36 -0
  169. package/dist/src/validation.sources.spec.js.map +1 -0
  170. package/dist/src/validation.synchronous.spec.d.ts +1 -0
  171. package/dist/src/validation.synchronous.spec.js +173 -0
  172. package/dist/src/validation.synchronous.spec.js.map +1 -0
  173. package/index.ts +48 -0
  174. package/package.json +79 -3
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fullHistory = exports.identificationExecutionPolicy = void 0;
4
+ exports.identificationCutoffs = identificationCutoffs;
5
+ var validation_policy_1 = require("@cobol-ts/validation-policy");
6
+ Object.defineProperty(exports, "identificationExecutionPolicy", { enumerable: true, get: function () { return validation_policy_1.identificationExecutionPolicy; } });
7
+ Object.defineProperty(exports, "fullHistory", { enumerable: true, get: function () { return validation_policy_1.fullHistory; } });
8
+ /** Return increasing, inclusive prefix lengths. Never filter the evidence itself. */
9
+ function identificationCutoffs(strategy, observations) {
10
+ const n = observations.length;
11
+ if (!n)
12
+ return [];
13
+ switch (strategy.type) {
14
+ case 'full': return [n];
15
+ case 'all-prefixes': return Array.from({ length: n }, (_, i) => i + 1);
16
+ case 'periodicity': {
17
+ const labels = new Set(strategy.periodicities);
18
+ return observations.flatMap((observation, i) => i === n - 1 || labels.has(observation.periodicity) ? [i + 1] : []);
19
+ }
20
+ case 'sample': {
21
+ const size = Math.min(strategy.size, n);
22
+ return size === 1 ? [n] : Array.from({ length: size }, (_, i) => 1 + Math.round(i * (n - 1) / (size - 1)));
23
+ }
24
+ }
25
+ }
26
+ //# sourceMappingURL=validation.identification.strategy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.strategy.js","sourceRoot":"","sources":["../../src/validation.identification.strategy.ts"],"names":[],"mappings":";;;AAIA,sDAeC;AAlBD,iEAAmH;AAA3G,kIAAA,6BAA6B,OAAA;AAAE,gHAAA,WAAW,OAAA;AAElD,qFAAqF;AACrF,SAAgB,qBAAqB,CAAC,QAAgC,EAAE,YAAuD;IAC3H,MAAM,CAAC,GAAG,YAAY,CAAC,MAAM,CAAA;IAC7B,IAAI,CAAC,CAAC;QAAE,OAAO,EAAE,CAAA;IACjB,QAAQ,QAAQ,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;QACvB,KAAK,cAAc,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,CAAC,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAA;QACpE,KAAK,aAAa,CAAC,CAAC,CAAC;YACjB,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAA;YAC9C,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;QACtH,CAAC;QACD,KAAK,QAAQ,CAAC,CAAC,CAAC;YACZ,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC,CAAA;YACvC,OAAO,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QAC5G,CAAC;IACL,CAAC;AACL,CAAC"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const validation_identification_strategy_1 = require("./validation.identification.strategy");
4
+ const observations = ['event', 'event', 'close', 'event', 'event', 'close', 'event', 'event'].map(periodicity => ({ periodicity }));
5
+ test('selects inclusive cutoffs without assuming business periodicities', () => {
6
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'full' }, observations)).toEqual([8]);
7
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'all-prefixes' }, observations)).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
8
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'periodicity', periodicities: ['close'] }, observations)).toEqual([3, 6, 8]);
9
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'periodicity', periodicities: ['unknown'] }, observations)).toEqual([8]);
10
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'periodicity', periodicities: ['event', 'close'] }, observations)).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
11
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'sample', size: 4 }, observations)).toEqual([1, 3, 6, 8]);
12
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'sample', size: 1 }, observations)).toEqual([8]);
13
+ expect((0, validation_identification_strategy_1.identificationCutoffs)({ type: 'sample', size: 100 }, observations)).toEqual([1, 2, 3, 4, 5, 6, 7, 8]);
14
+ for (const strategy of [{ type: 'full' }, { type: 'all-prefixes' }, { type: 'periodicity', periodicities: ['close'] }, { type: 'sample', size: 4 }]) {
15
+ expect((0, validation_identification_strategy_1.identificationCutoffs)(strategy, [])).toEqual([]);
16
+ expect((0, validation_identification_strategy_1.identificationCutoffs)(strategy, observations.slice(0, 1))).toEqual([1]);
17
+ }
18
+ });
19
+ test('sample is bounded, deterministic, ordered and always includes the complete history', () => {
20
+ for (let n = 1; n <= 50; n++)
21
+ for (let size = 1; size <= 55; size++) {
22
+ const history = Array.from({ length: n }, () => ({ periodicity: 'arbitrary' }));
23
+ const cutoffs = (0, validation_identification_strategy_1.identificationCutoffs)({ type: 'sample', size }, history);
24
+ expect(cutoffs.length).toBe(Math.min(n, size));
25
+ expect(cutoffs.at(-1)).toBe(n);
26
+ expect([...new Set(cutoffs)].sort((a, b) => a - b)).toEqual(cutoffs);
27
+ if (size > 1)
28
+ expect(cutoffs[0]).toBe(1);
29
+ }
30
+ });
31
+ //# sourceMappingURL=validation.identification.strategy.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identification.strategy.spec.js","sourceRoot":"","sources":["../../src/validation.identification.strategy.spec.ts"],"names":[],"mappings":";;AAAA,6FAAuG;AAEvG,MAAM,YAAY,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,GAAG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I,GAAG,CAAC,EAAE,IAAI,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;YAClE,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAC,CAAC,EAAC,EAAE,GAAG,EAAE,CAAC,CAAC,EAAC,WAAW,EAAC,WAAW,EAAC,CAAC,CAAC,CAAA;YACzE,MAAM,OAAO,GAAG,IAAA,0DAAqB,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,IAAI,EAAC,EAAE,OAAO,CAAC,CAAA;YACpE,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,CAAC,CAAC,CAAA;YAC7C,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;YAC9B,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,CAAC,EAAC,EAAE,CAAA,CAAC,GAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;YAC/D,IAAI,IAAI,GAAG,CAAC;gBAAE,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;QAC5C,CAAC;AACL,CAAC,CAAC,CAAA"}
@@ -0,0 +1,34 @@
1
+ import { type IndexedGraphSchema } from '@cobol-ts/cursor-loader-indexed-graph-state';
2
+ import type { AuthoringGraph, NamedAccumulatorValues } from '@cobol-ts/cel-graph-runtime';
3
+ import { type IdentifiedStateStorage } from './identified.state.source';
4
+ export declare function identifiedSchema(business: AuthoringGraph): IndexedGraphSchema;
5
+ export declare const graphDigest: (graph: AuthoringGraph) => string;
6
+ export interface IdentifiedShard {
7
+ generation: string;
8
+ entities: number;
9
+ sha256: string;
10
+ firstDate: string | null;
11
+ }
12
+ export interface IdentifiedManifest {
13
+ format: 'cobolts-identified-state';
14
+ version: 1;
15
+ graphSha256: string;
16
+ schema: IndexedGraphSchema;
17
+ sources: readonly {
18
+ target: string;
19
+ id: string;
20
+ runner: string;
21
+ status: string;
22
+ }[];
23
+ shards: Record<string, IdentifiedShard>;
24
+ satisfaction: string;
25
+ }
26
+ export declare function readIdentifiedManifestFrom(storage: IdentifiedStateStorage, location: string, business: AuthoringGraph): Promise<IdentifiedManifest>;
27
+ /** Strict sorted merge for one shard: exactly one seed per entity, no defaults
28
+ * for a missing identified entity, no silently unused records. The cursor owns
29
+ * the decoded ring until the caller constructs its private execution state. */
30
+ export declare function openIdentifiedShardFrom(storage: IdentifiedStateStorage, location: string, id: string, manifest: IdentifiedManifest, generation: string): Promise<{
31
+ read(customerId: string, schema: IndexedGraphSchema): NamedAccumulatorValues;
32
+ finish(): void;
33
+ close(): Promise<void>;
34
+ }>;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.graphDigest = void 0;
4
+ exports.identifiedSchema = identifiedSchema;
5
+ exports.readIdentifiedManifestFrom = readIdentifiedManifestFrom;
6
+ exports.openIdentifiedShardFrom = openIdentifiedShardFrom;
7
+ const node_crypto_1 = require("node:crypto");
8
+ const node_util_1 = require("node:util");
9
+ const cursor_loader_indexed_graph_state_1 = require("@cobol-ts/cursor-loader-indexed-graph-state");
10
+ const system_identification_1 = require("@cobol-ts/system-identification");
11
+ const errors_1 = require("@cobol-ts/errors");
12
+ const project_execution_1 = require("@cobol-ts/project-execution");
13
+ function identifiedSchema(business) {
14
+ return (0, cursor_loader_indexed_graph_state_1.indexedGraphSchemaFromValueTypes)((0, errors_1.valueOrThrow)((0, system_identification_1.discoverIdentificationRequirements)(business)).map(({ name, valueType }) => ({ name, valueType, nullable: valueType.kind === 'scalar' })));
15
+ }
16
+ /** Object member ordering is not significant to provenance. Array ordering is. */
17
+ function stable(value) {
18
+ if (Array.isArray(value))
19
+ return value.map(stable);
20
+ if (value !== null && typeof value === 'object')
21
+ return Object.fromEntries(Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([k, v]) => [k, stable(v)]));
22
+ return value;
23
+ }
24
+ const graphDigest = (graph) => (0, node_crypto_1.createHash)('sha256').update(JSON.stringify(stable(graph))).digest('hex');
25
+ exports.graphDigest = graphDigest;
26
+ async function readIdentifiedManifestFrom(storage, location, business) {
27
+ const manifest = JSON.parse(await storage.readManifest(location));
28
+ if (manifest?.format !== 'cobolts-identified-state' || manifest.version !== 1 || manifest.graphSha256 !== (0, exports.graphDigest)(business) ||
29
+ !(0, node_util_1.isDeepStrictEqual)(manifest.schema, identifiedSchema(business)) || !manifest.shards || typeof manifest.shards !== 'object')
30
+ throw new Error('Identified state is incompatible with the selected business graph');
31
+ return manifest;
32
+ }
33
+ /** Strict sorted merge for one shard: exactly one seed per entity, no defaults
34
+ * for a missing identified entity, no silently unused records. The cursor owns
35
+ * the decoded ring until the caller constructs its private execution state. */
36
+ async function openIdentifiedShardFrom(storage, location, id, manifest, generation) {
37
+ if (!/^shard-\d{4}$/.test(id))
38
+ throw new Error('Invalid identified shard name');
39
+ const entry = manifest.shards[id];
40
+ if (!entry || entry.generation !== generation || !Number.isSafeInteger(entry.entities) || entry.entities < 0)
41
+ throw new Error(`Identified state does not match validation generation: ${id}`);
42
+ const source = storage.shard(location, id);
43
+ if (await source.digest() !== entry.sha256)
44
+ throw new Error(`Identified state checksum mismatch: ${id}`);
45
+ const storedSchema = await source.schema();
46
+ // The physical header deliberately omits JavaScript integer representation.
47
+ // Bind the authoritative active schema on decode, exactly as the normal join does.
48
+ const physical = { ...manifest.schema, nodes: manifest.schema.nodes.map(({ javascriptType, ...field }) => field) };
49
+ if (!(0, node_util_1.isDeepStrictEqual)(storedSchema, physical))
50
+ throw new Error(`Identified state schema mismatch: ${id}`);
51
+ const cursor = await source.openCursor(manifest.schema);
52
+ let count = 0, previous;
53
+ const checkedSchemas = new WeakSet();
54
+ let lease;
55
+ return {
56
+ read(customerId, schema) {
57
+ lease?.close();
58
+ lease = undefined;
59
+ // Bind only identified slots; other fields retain ordinary configured defaults.
60
+ if (!checkedSchemas.has(schema)) {
61
+ for (const field of manifest.schema.nodes)
62
+ if (!(0, node_util_1.isDeepStrictEqual)(field, schema.nodes.find(n => n.name === field.name)))
63
+ throw new Error(`Identified state field is incompatible with replay: ${field.name}`);
64
+ checkedSchemas.add(schema);
65
+ }
66
+ if (!/^(?:0|-?[1-9]\d*)$/.test(customerId))
67
+ throw new Error('Identified state requires integer customer identities');
68
+ const key = BigInt(customerId);
69
+ lease = cursor.take();
70
+ if (!lease || lease.representation.customerId !== key || previous !== undefined && key <= previous)
71
+ throw new Error('Identified state is missing, duplicated or out of order for a validation entity');
72
+ count++;
73
+ previous = key;
74
+ return (0, project_execution_1.indexedStateObject)(manifest.schema, lease.representation);
75
+ },
76
+ finish() {
77
+ lease?.close();
78
+ lease = undefined;
79
+ const extra = cursor.take();
80
+ if (extra) {
81
+ extra.close();
82
+ throw new Error('Identified state has unused entities');
83
+ }
84
+ if (count !== entry.entities)
85
+ throw new Error('Identified state entity count mismatch');
86
+ },
87
+ async close() { lease?.close(); lease = undefined; await cursor.close(); }
88
+ };
89
+ }
90
+ //# sourceMappingURL=validation.identified.state.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.identified.state.js","sourceRoot":"","sources":["../../src/validation.identified.state.ts"],"names":[],"mappings":";;;AAUA,4CAEC;AAcD,gEAMC;AAID,0DAoCC;AAxED,6CAAsC;AACtC,yCAA2C;AAC3C,mGAC+E;AAC/E,2EAAkF;AAClF,6CAA6C;AAE7C,mEAA8D;AAG9D,SAAgB,gBAAgB,CAAC,QAAwB;IACrD,OAAO,IAAA,oEAAgC,EAAC,IAAA,qBAAY,EAAC,IAAA,0DAAkC,EAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAC,IAAI,EAAC,SAAS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AAA;YAC5B,KAAK,GAAC,MAAM,CAAC,IAAI,EAAE,CAAA;YACnB,IAAG,CAAC,KAAK,IAAE,KAAK,CAAC,cAAc,CAAC,UAAU,KAAG,GAAG,IAAE,QAAQ,KAAG,SAAS,IAAE,GAAG,IAAE,QAAQ;gBACjF,MAAM,IAAI,KAAK,CAAC,iFAAiF,CAAC,CAAA;YACtG,KAAK,EAAE,CAAC;YAAA,QAAQ,GAAC,GAAG,CAAA;YACpB,OAAO,IAAA,sCAAkB,EAAC,QAAQ,CAAC,MAAM,EAAC,KAAK,CAAC,cAAc,CAAC,CAAA;QACnE,CAAC;QACD,MAAM;YAAG,KAAK,EAAE,KAAK,EAAE,CAAC;YAAA,KAAK,GAAC,SAAS,CAAC;YAAA,MAAM,KAAK,GAAC,MAAM,CAAC,IAAI,EAAE,CAAC;YAAA,IAAG,KAAK,EAAC,CAAC;gBAAA,KAAK,CAAC,KAAK,EAAE,CAAC;gBAAA,MAAM,IAAI,KAAK,CAAC,sCAAsC,CAAC,CAAA;YAAA,CAAC;YAC9I,IAAG,KAAK,KAAG,KAAK,CAAC,QAAQ;gBAAC,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAA;QAAA,CAAC;QACxF,KAAK,CAAC,KAAK,KAAG,KAAK,EAAE,KAAK,EAAE,CAAC,CAAA,KAAK,GAAC,SAAS,CAAC,CAAA,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA,CAAA,CAAC;KACrE,CAAA;AACL,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { IdentificationFragment } from '@cobol-ts/system-identification';
2
+ import type { ErrorsOr } from '@cobol-ts/errors';
3
+ import type { IdentificationCandidate } from './identification.candidate';
4
+ import type { IdentificationSelection } from './identification.selection';
5
+ import type { IdentificationStrategy } from './validation.identification.strategy';
6
+ import { type IdentificationSatisfactionReport } from './validation.identification.satisfaction';
7
+ export interface InvestigationPolicy {
8
+ readonly maxEntities: number;
9
+ readonly strategy: IdentificationStrategy;
10
+ }
11
+ export interface InvestigationCheck {
12
+ readonly target: string;
13
+ readonly experiment?: string;
14
+ readonly compilation: 'passed' | 'failed' | 'missing' | 'skipped';
15
+ readonly satisfaction: 'passed' | 'failed' | 'skipped';
16
+ readonly report?: IdentificationSatisfactionReport;
17
+ readonly errors?: readonly string[];
18
+ }
19
+ export interface InvestigationReport extends InvestigationPolicy {
20
+ readonly passed: boolean;
21
+ readonly targets: readonly InvestigationCheck[];
22
+ readonly composed: InvestigationCheck;
23
+ }
24
+ export interface InvestigationChecks {
25
+ load(selection: IdentificationSelection): Promise<IdentificationFragment>;
26
+ compile(fragment: IdentificationFragment): ErrorsOr<string>;
27
+ compose(fragments: readonly IdentificationFragment[]): IdentificationCandidate;
28
+ execute(candidate: IdentificationCandidate, targets: readonly string[]): Promise<ErrorsOr<IdentificationSatisfactionReport>>;
29
+ }
30
+ /** Deterministic read-only orchestration. Never reinterpret a recorded success
31
+ * as proof of present satisfaction, and never update its historical status. */
32
+ export declare function checkInvestigation(targets: readonly string[], selections: readonly IdentificationSelection[], policy: InvestigationPolicy, checks: InvestigationChecks): Promise<InvestigationReport>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.checkInvestigation = checkInvestigation;
4
+ const validation_identification_satisfaction_1 = require("./validation.identification.satisfaction");
5
+ const message = (error) => error instanceof Error ? error.message : String(error);
6
+ /** Deterministic read-only orchestration. Never reinterpret a recorded success
7
+ * as proof of present satisfaction, and never update its historical status. */
8
+ async function checkInvestigation(targets, selections, policy, checks) {
9
+ const results = [], fragments = [];
10
+ async function execute(row, candidate, names) {
11
+ try {
12
+ const result = await checks.execute(candidate, names);
13
+ if ('errors' in result)
14
+ return { ...row, satisfaction: 'failed', errors: result.errors };
15
+ return { ...row, satisfaction: (0, validation_identification_satisfaction_1.identificationSatisfactionPassed)(result.value) ? 'passed' : 'failed', report: result.value };
16
+ }
17
+ catch {
18
+ // A cursor/engine exception can contain customer values. No raw errors
19
+ // or counterexamples in this aggregate report.
20
+ return { ...row, satisfaction: 'failed', errors: ['Execution could not complete. Check the current data, reference and graph configuration.'] };
21
+ }
22
+ }
23
+ for (const target of targets) {
24
+ const selection = selections.find(s => s.target === target);
25
+ if (!selection) {
26
+ results.push({ target, compilation: 'missing', satisfaction: 'skipped', errors: ['No successful experiment'] });
27
+ continue;
28
+ }
29
+ const row = { target, experiment: selection.id, compilation: 'failed', satisfaction: 'skipped' };
30
+ try {
31
+ const fragment = await checks.load(selection);
32
+ const compiled = checks.compile(fragment);
33
+ if ('errors' in compiled) {
34
+ results.push({ ...row, errors: compiled.errors });
35
+ continue;
36
+ }
37
+ fragments.push(fragment);
38
+ results.push(await execute({ ...row, compilation: 'passed' }, fragment, [target]));
39
+ }
40
+ catch (error) {
41
+ results.push({ ...row, errors: [message(error)] });
42
+ }
43
+ }
44
+ let composed = { target: 'Composed graph', compilation: 'skipped', satisfaction: 'skipped',
45
+ errors: [targets.length ? 'All required entries must pass before joint validation' : 'No identification targets'] };
46
+ if (targets.length && results.every(row => row.satisfaction === 'passed')) {
47
+ try {
48
+ const candidate = checks.compose(fragments);
49
+ composed = await execute({ target: 'Composed graph', compilation: 'passed', satisfaction: 'skipped' }, candidate, targets);
50
+ }
51
+ catch (error) {
52
+ composed = { target: 'Composed graph', compilation: 'failed', satisfaction: 'skipped', errors: [message(error)] };
53
+ }
54
+ }
55
+ return { ...policy, passed: composed.satisfaction === 'passed', targets: results, composed };
56
+ }
57
+ //# sourceMappingURL=validation.investigation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.investigation.js","sourceRoot":"","sources":["../../src/validation.investigation.ts"],"names":[],"mappings":";;AA+BA,gDAsCC;AAhED,qGAAgI;AAsBhI,MAAM,OAAO,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAE1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OAAO,CAAC,SAAS,CAAC,CAAA;YAC3C,QAAQ,GAAG,MAAM,OAAO,CAAC,EAAC,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAA;QAC5H,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAAA,QAAQ,GAAG,EAAC,MAAM,EAAE,gBAAgB,EAAE,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAC,CAAA;QAAA,CAAC;IACrI,CAAC;IACD,OAAO,EAAC,GAAG,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,YAAY,KAAK,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAC,CAAA;AAC9F,CAAC"}
@@ -0,0 +1,26 @@
1
+ import type { CompositionDefinition, ValidationManifestEvent } from '@cobol-ts/composition-definition';
2
+ import { type FileCatalogue } from '@cobol-ts/file-catalogue';
3
+ import { type ConfiguredFileSource } from '@cobol-ts/cursor-loader-source';
4
+ import type { PreparedSource, ReferenceData } from '@cobol-ts/cursor-composition';
5
+ export type KeyType = 'integer' | 'string';
6
+ export interface Layout {
7
+ readonly definition: CompositionDefinition;
8
+ readonly name: string;
9
+ readonly periodicity: string;
10
+ readonly inputs: readonly {
11
+ filename: string;
12
+ source: PreparedSource;
13
+ }[];
14
+ readonly keyType: KeyType;
15
+ readonly sources: readonly PreparedSource[];
16
+ referenceData?: ReferenceData;
17
+ }
18
+ export declare function prepareLayouts(definitions: readonly CompositionDefinition[], catalogue: FileCatalogue, physical: ReadonlyMap<string, ConfiguredFileSource>): Layout[];
19
+ /** Index once by periodicity and participating file count. The ordinal arrays
20
+ * are prepared before traversal, so no filename lookup is needed per event. */
21
+ export declare function createLayoutResolver<T extends {
22
+ readonly periodicity: string;
23
+ readonly inputs: readonly {
24
+ filename: string;
25
+ }[];
26
+ }>(layouts: readonly T[], declared: readonly number[], ordinals: ReadonlyMap<string, number>): (event: ValidationManifestEvent, counts: Float64Array) => T;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.prepareLayouts = prepareLayouts;
4
+ exports.createLayoutResolver = createLayoutResolver;
5
+ const composition_definition_1 = require("@cobol-ts/composition-definition");
6
+ const file_catalogue_1 = require("@cobol-ts/file-catalogue");
7
+ const errors_1 = require("@cobol-ts/errors");
8
+ const cursor_loader_source_1 = require("@cobol-ts/cursor-loader-source");
9
+ function prepareLayouts(definitions, catalogue, physical) {
10
+ const layouts = [];
11
+ for (const definition of definitions) {
12
+ const members = Object.entries(definition.composition.files).map(([logical, member]) => ({ logical, member, filename: (0, file_catalogue_1.physicalFileName)(logical, catalogue.files[logical]) }));
13
+ if (members.some(m => !physical.has(m.filename)))
14
+ continue;
15
+ const inputs = members.map(({ logical, member, filename }) => {
16
+ const file = physical.get(filename), definitionFile = definition.files[logical];
17
+ const source = (0, cursor_loader_source_1.withPreparedFileSource)(file, typed => (0, cursor_loader_source_1.asCompositionSource)(typed, { name: logical, cardinality: member.cardinality,
18
+ keyPath: (0, composition_definition_1.resolveEntityKeyPath)(typed.projection, definitionFile.key, definitionFile.keyPath) }));
19
+ return { filename, source };
20
+ });
21
+ const master = inputs.find(i => i.source.name === definition.composition.master).source;
22
+ const key = (0, errors_1.valueOrThrow)(master.access.compileScalar(definition.files[master.name].keyPath.split('.')));
23
+ if (key.type !== 'string' && key.type !== 'integer')
24
+ throw new Error(`Invalid master key type for ${definition.name}`);
25
+ layouts.push({ definition, name: definition.name, periodicity: definition.periodicity, inputs, keyType: key.type, sources: inputs.map(i => i.source) });
26
+ }
27
+ return layouts;
28
+ }
29
+ /** Index once by periodicity and participating file count. The ordinal arrays
30
+ * are prepared before traversal, so no filename lookup is needed per event. */
31
+ function createLayoutResolver(layouts, declared, ordinals) {
32
+ const byPeriod = new Map();
33
+ for (const layout of layouts) {
34
+ const indexes = layout.inputs.map(input => ordinals.get(input.filename));
35
+ if (new Set(indexes).size !== indexes.length)
36
+ continue;
37
+ let byCount = byPeriod.get(layout.periodicity);
38
+ if (!byCount) {
39
+ byCount = new Map();
40
+ byPeriod.set(layout.periodicity, byCount);
41
+ }
42
+ let candidates = byCount.get(indexes.length);
43
+ if (!candidates) {
44
+ candidates = [];
45
+ byCount.set(indexes.length, candidates);
46
+ }
47
+ candidates.push({ layout, ordinals: indexes });
48
+ }
49
+ return (event, counts) => {
50
+ let count = 0;
51
+ for (let i = 0; i < declared.length; i++)
52
+ if (counts[declared[i]] !== -1)
53
+ count++;
54
+ const candidates = byPeriod.get(event.periodicity)?.get(count);
55
+ let found;
56
+ if (candidates)
57
+ for (let i = 0; i < candidates.length; i++) {
58
+ const candidate = candidates[i];
59
+ if (!matches(candidate.ordinals, counts))
60
+ continue;
61
+ if (found) {
62
+ found = undefined;
63
+ break;
64
+ }
65
+ found = candidate.layout;
66
+ }
67
+ if (!found)
68
+ throw new Error(`Cannot uniquely resolve composition for ${event.date}/${event.periodicity} and participating files`);
69
+ return found;
70
+ };
71
+ }
72
+ function matches(ordinals, counts) {
73
+ for (let i = 0; i < ordinals.length; i++)
74
+ if (counts[ordinals[i]] === -1)
75
+ return false;
76
+ return true;
77
+ }
78
+ //# sourceMappingURL=validation.layouts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.layouts.js","sourceRoot":"","sources":["../../src/validation.layouts.ts"],"names":[],"mappings":";;AAkBA,wCAkBC;AAID,oDA0BC;AAjED,6EAAqE;AACrE,6DAA4E;AAC5E,6CAA6C;AAC7C,yEAAmH;AAcnH,SAAgB,cAAc,CAAC,WAA4C,EAAC,SAAuB,EAC/F,QAAiD;IACjD,MAAM,OAAO,GAAU,EAAE,CAAA;IACzB,KAAI,MAAM,UAAU,IAAI,WAAW,EAAC,CAAC;QACjC,MAAM,OAAO,GAAC,MAAM,CAAC,OAAO,CAAC,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,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,WAAW,0BAA0B,CAAC,CAAA;QAC/H,OAAO,KAAK,CAAA;IAChB,CAAC,CAAA;AACL,CAAC;AACD,SAAS,OAAO,CAAC,QAA0B,EAAC,MAAmB;IAC3D,KAAI,IAAI,CAAC,GAAC,CAAC,EAAC,CAAC,GAAC,QAAQ,CAAC,MAAM,EAAC,CAAC,EAAE;QAAC,IAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAE,CAAC,KAAG,CAAC,CAAC;YAAC,OAAO,KAAK,CAAA;IAC3E,OAAO,IAAI,CAAA;AACf,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { type ValidationManifestEvent, type ValidationManifestHeader } from '@cobol-ts/composition-definition';
2
+ import type { SnapshotCursor } from './validation.cursors';
3
+ /** Scan-local storage. The selector borrows event; retained observations use snapshot().
4
+ * Count ordinals follow header.files, with -1 meaning absent and 0 meaning empty. */
5
+ export declare function compileManifestReader(manifest: SnapshotCursor, header: ValidationManifestHeader): {
6
+ event: {
7
+ customerId: string;
8
+ date: string;
9
+ periodicity: string;
10
+ counts: Record<string, number | null>;
11
+ };
12
+ counts: Float64Array<ArrayBuffer>;
13
+ next(): boolean;
14
+ check(): void;
15
+ snapshot(): ValidationManifestEvent;
16
+ };
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.compileManifestReader = compileManifestReader;
4
+ const composition_definition_1 = require("@cobol-ts/composition-definition");
5
+ /** Scan-local storage. The selector borrows event; retained observations use snapshot().
6
+ * Count ordinals follow header.files, with -1 meaning absent and 0 meaning empty. */
7
+ function compileManifestReader(manifest, header) {
8
+ const names = header.files.map(file => file.filename);
9
+ const text = new Array(3), counts = new Float64Array(names.length);
10
+ const named = {};
11
+ const event = { customerId: '', date: '', periodicity: '', counts: named };
12
+ for (const name of names)
13
+ named[name] = null;
14
+ return { event, counts,
15
+ next() {
16
+ if (!manifest.takeManifestFields(text, counts))
17
+ return false;
18
+ event.customerId = text[0];
19
+ event.date = text[1];
20
+ event.periodicity = text[2];
21
+ return true;
22
+ },
23
+ check() {
24
+ (0, composition_definition_1.checkValidationManifestIdentity)(event.customerId, event.date, event.periodicity);
25
+ for (let i = 0; i < counts.length; i++) {
26
+ const count = counts[i];
27
+ if (count !== -1 && (!Number.isSafeInteger(count) || count < 0))
28
+ throw new Error(`Validation manifest row.${names[i]}: Expected a nonnegative safe integer or blank`);
29
+ named[names[i]] = count === -1 ? null : count;
30
+ }
31
+ },
32
+ snapshot() {
33
+ return { customerId: event.customerId, date: event.date, periodicity: event.periodicity, counts: { ...named } };
34
+ }
35
+ };
36
+ }
37
+ //# sourceMappingURL=validation.manifest.reader.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.manifest.reader.js","sourceRoot":"","sources":["../../src/validation.manifest.reader.ts"],"names":[],"mappings":";;AAKA,sDAyBC;AA9BD,6EAA2I;AAG3I;qFACqF;AACrF,SAAgB,qBAAqB,CAAC,QAAuB,EAAC,MAA+B;IACzF,MAAM,KAAK,GAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAA,EAAE,CAAA,IAAI,CAAC,QAAQ,CAAC,CAAA;IACjD,MAAM,IAAI,GAAC,IAAI,KAAK,CAAS,CAAC,CAAC,EAAC,MAAM,GAAC,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IACrE,MAAM,KAAK,GAA4B,EAAE,CAAA;IACzC,MAAM,KAAK,GAAC,EAAC,UAAU,EAAC,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,WAAW,EAAC,EAAE,EAAC,MAAM,EAAC,KAAK,EAAC,CAAA;IAC/D,KAAI,MAAM,IAAI,IAAI,KAAK;QAAC,KAAK,CAAC,IAAI,CAAC,GAAC,IAAI,CAAA;IACxC,OAAO,EAAC,KAAK,EAAC,MAAM;QAChB,IAAI;YACA,IAAG,CAAC,QAAQ,CAAC,kBAAkB,CAAC,IAAI,EAAC,MAAM,CAAC;gBAAC,OAAO,KAAK,CAAA;YACzD,KAAK,CAAC,UAAU,GAAC,IAAI,CAAC,CAAC,CAAE,CAAC;YAAA,KAAK,CAAC,IAAI,GAAC,IAAI,CAAC,CAAC,CAAE,CAAC;YAAA,KAAK,CAAC,WAAW,GAAC,IAAI,CAAC,CAAC,CAAE,CAAA;YACxE,OAAO,IAAI,CAAA;QACf,CAAC;QACD,KAAK;YACD,IAAA,wDAA+B,EAAC,KAAK,CAAC,UAAU,EAAC,KAAK,CAAC,IAAI,EAAC,KAAK,CAAC,WAAW,CAAC,CAAA;YAC9E,KAAI,IAAI,CAAC,GAAC,CAAC,EAAC,CAAC,GAAC,MAAM,CAAC,MAAM,EAAC,CAAC,EAAE,EAAC,CAAC;gBAC7B,MAAM,KAAK,GAAC,MAAM,CAAC,CAAC,CAAE,CAAA;gBACtB,IAAG,KAAK,KAAG,CAAC,CAAC,IAAE,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,KAAK,CAAC,IAAE,KAAK,GAAC,CAAC,CAAC;oBAClD,MAAM,IAAI,KAAK,CAAC,2BAA2B,KAAK,CAAC,CAAC,CAAC,gDAAgD,CAAC,CAAA;gBACxG,KAAK,CAAC,KAAK,CAAC,CAAC,CAAE,CAAC,GAAC,KAAK,KAAG,CAAC,CAAC,CAAA,CAAC,CAAA,IAAI,CAAA,CAAC,CAAA,KAAK,CAAA;YAC1C,CAAC;QACL,CAAC;QACD,QAAQ;YACJ,OAAO,EAAC,UAAU,EAAC,KAAK,CAAC,UAAU,EAAC,IAAI,EAAC,KAAK,CAAC,IAAI,EAAC,WAAW,EAAC,KAAK,CAAC,WAAW,EAAC,MAAM,EAAC,EAAC,GAAG,KAAK,EAAC,EAAC,CAAA;QACxG,CAAC;KACJ,CAAA;AACL,CAAC"}
@@ -0,0 +1,58 @@
1
+ import type { ValidationManifestEvent } from '@cobol-ts/composition-definition';
2
+ import type { CompositeRecord, CompositeSlot, ReferenceData } from '@cobol-ts/cursor-composition';
3
+ import type { ValidationObservation, ValidationVisitor } from './validation.reader.types';
4
+ import type { Layout } from './validation.layouts';
5
+ import type { InputCursor, SnapshotCursor } from './validation.cursors';
6
+ export interface ScanInput {
7
+ readonly filename: string;
8
+ readonly ordinal: number;
9
+ readonly cursor: InputCursor;
10
+ readonly source: Layout['inputs'][number]['source'];
11
+ }
12
+ export interface ScanResult {
13
+ readonly filename: string;
14
+ readonly ordinal: number;
15
+ readonly cursor: SnapshotCursor;
16
+ }
17
+ export interface ScanLayout extends Layout {
18
+ readonly inputSlots: readonly ScanInput[];
19
+ }
20
+ export declare function checkTrailingInputs(inputs: ReadonlyMap<string, InputCursor>, results: ReadonlyMap<string, SnapshotCursor>): void;
21
+ /** Skip never constructs a row, slot, expected-results object or lease array. */
22
+ export declare function skipObservation(counts: Float64Array, layout: ScanLayout, results: readonly ScanResult[]): void;
23
+ export declare function combinedFailure(primary: unknown, cleanup: unknown): Error;
24
+ /** Shared prototype methods; never reactivate a released public row. */
25
+ declare class SlotPool {
26
+ private readonly width;
27
+ private readonly available;
28
+ constructor(width: number);
29
+ acquire(): CompositeSlot[];
30
+ release(slots: CompositeSlot[]): void;
31
+ }
32
+ declare class BorrowedRow implements CompositeRecord {
33
+ readonly key: CompositeRecord['key'];
34
+ private storage;
35
+ readonly referenceData: ReferenceData | undefined;
36
+ private pool;
37
+ active: boolean;
38
+ acc?: unknown;
39
+ variables?: unknown;
40
+ constructor(key: CompositeRecord['key'], storage: CompositeSlot[] | undefined, referenceData: ReferenceData | undefined, pool: SlotPool | undefined);
41
+ get slots(): readonly CompositeSlot[];
42
+ entry(slot: number, index: number): import("@cobol-ts/cursor-file").PreparedFileCursorResult<unknown, unknown>;
43
+ count(slot: number): number;
44
+ close(): void;
45
+ }
46
+ interface LeasedObservation extends ValidationObservation {
47
+ readonly row: BorrowedRow;
48
+ }
49
+ /** One pool per prepared layout; public row handles are never recycled. */
50
+ export declare function createObservationReader(layouts: readonly ScanLayout[]): (event: ValidationManifestEvent, counts: Float64Array, layout: ScanLayout, results: readonly ScanResult[]) => LeasedObservation;
51
+ interface Delivery {
52
+ /** Accept owns the observation even if delivery fails. */
53
+ accept(observation: LeasedObservation): void;
54
+ finishCustomer(): void;
55
+ discard(): void;
56
+ }
57
+ export declare function createDelivery(visitor: ValidationVisitor): Delivery;
58
+ export {};