@cobol-ts/cobolts 0.0.18 → 0.0.19

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 (96) hide show
  1. package/README.benchmark.md +21 -21
  2. package/README.cel.md +19 -11
  3. package/README.crypto.md +105 -0
  4. package/README.md +31 -19
  5. package/README.oracle.md +110 -0
  6. package/README.periodic-verification.md +84 -83
  7. package/dist/src/benchmark.aggregate.fixture.spec.js +2 -2
  8. package/dist/src/benchmark.aggregate.fixture.spec.js.map +1 -1
  9. package/dist/src/benchmark.cli.functional.spec.js +15 -5
  10. package/dist/src/benchmark.cli.functional.spec.js.map +1 -1
  11. package/dist/src/benchmark.cli.golden.spec.js +6 -4
  12. package/dist/src/benchmark.cli.golden.spec.js.map +1 -1
  13. package/dist/src/benchmark.composed.execution.spec.js +1 -1
  14. package/dist/src/benchmark.composed.execution.spec.js.map +1 -1
  15. package/dist/src/benchmark.composed.fixture.js +2 -2
  16. package/dist/src/benchmark.composed.fixture.js.map +1 -1
  17. package/dist/src/benchmark.composed.fixture.spec.js +3 -1
  18. package/dist/src/benchmark.composed.fixture.spec.js.map +1 -1
  19. package/dist/src/benchmark.composed.runner.js +14 -4
  20. package/dist/src/benchmark.composed.runner.js.map +1 -1
  21. package/dist/src/benchmark.composed.two.fixture.js +9 -5
  22. package/dist/src/benchmark.composed.two.fixture.js.map +1 -1
  23. package/dist/src/benchmark.composed.two.spec.js +3 -1
  24. package/dist/src/benchmark.composed.two.spec.js.map +1 -1
  25. package/dist/src/benchmark.format.composition.spec.js +16 -11
  26. package/dist/src/benchmark.format.composition.spec.js.map +1 -1
  27. package/dist/src/benchmark.format.fixture.js +2 -2
  28. package/dist/src/benchmark.format.fixture.js.map +1 -1
  29. package/dist/src/benchmark.format.runner.js +2 -2
  30. package/dist/src/benchmark.format.runner.js.map +1 -1
  31. package/dist/src/benchmark.format.spec.js +1 -1
  32. package/dist/src/benchmark.format.spec.js.map +1 -1
  33. package/dist/src/benchmark.periodic.execution.spec.js +6 -6
  34. package/dist/src/benchmark.periodic.execution.spec.js.map +1 -1
  35. package/dist/src/benchmark.runner.d.ts +2 -1
  36. package/dist/src/benchmark.runner.js +10 -2
  37. package/dist/src/benchmark.runner.js.map +1 -1
  38. package/dist/src/benchmark.runner.spec.js +10 -4
  39. package/dist/src/benchmark.runner.spec.js.map +1 -1
  40. package/dist/src/benchmark.strategy.spec.js +3 -1
  41. package/dist/src/benchmark.strategy.spec.js.map +1 -1
  42. package/dist/src/cel.composition.integration.spec.js +15 -12
  43. package/dist/src/cel.composition.integration.spec.js.map +1 -1
  44. package/dist/src/cel.evaluate.integration.spec.js +18 -15
  45. package/dist/src/cel.evaluate.integration.spec.js.map +1 -1
  46. package/dist/src/cel.shared.execution.d.ts +3 -3
  47. package/dist/src/cel.shared.execution.js +4 -4
  48. package/dist/src/cel.shared.execution.js.map +1 -1
  49. package/dist/src/cli.integration.spec.js +2 -2
  50. package/dist/src/cli.integration.spec.js.map +1 -1
  51. package/dist/src/cli.js +6 -0
  52. package/dist/src/cli.js.map +1 -1
  53. package/dist/src/cli.spec.js +18 -0
  54. package/dist/src/cli.spec.js.map +1 -1
  55. package/dist/src/commands/ai.demo.spec.js +22 -2
  56. package/dist/src/commands/ai.demo.spec.js.map +1 -1
  57. package/dist/src/commands/ai.spec.js +1 -1
  58. package/dist/src/commands/ai.spec.js.map +1 -1
  59. package/dist/src/commands/benchmark.js +3 -4
  60. package/dist/src/commands/benchmark.js.map +1 -1
  61. package/dist/src/commands/cel.js +10 -4
  62. package/dist/src/commands/cel.js.map +1 -1
  63. package/dist/src/commands/characteristics.spec.js +41 -41
  64. package/dist/src/commands/characteristics.spec.js.map +1 -1
  65. package/dist/src/commands/config.compositions.d.ts +4 -0
  66. package/dist/src/commands/config.compositions.js +15 -0
  67. package/dist/src/commands/config.compositions.js.map +1 -0
  68. package/dist/src/commands/config.validate.js +1 -0
  69. package/dist/src/commands/config.validate.js.map +1 -1
  70. package/dist/src/commands/crypto.d.ts +41 -0
  71. package/dist/src/commands/crypto.js +196 -0
  72. package/dist/src/commands/crypto.js.map +1 -0
  73. package/dist/src/commands/crypto.spec.d.ts +1 -0
  74. package/dist/src/commands/crypto.spec.js +32 -0
  75. package/dist/src/commands/crypto.spec.js.map +1 -0
  76. package/dist/src/commands/extract.spec.js +1 -1
  77. package/dist/src/commands/extract.spec.js.map +1 -1
  78. package/dist/src/commands/graph.spec.js +9 -1
  79. package/dist/src/commands/graph.spec.js.map +1 -1
  80. package/dist/src/commands/oracle.d.ts +3 -0
  81. package/dist/src/commands/oracle.js +96 -0
  82. package/dist/src/commands/oracle.js.map +1 -0
  83. package/dist/src/commands/validate.all.js +12 -3
  84. package/dist/src/commands/validate.all.js.map +1 -1
  85. package/dist/src/commands/validate.all.spec.js +22 -0
  86. package/dist/src/commands/validate.all.spec.js.map +1 -1
  87. package/dist/src/context.d.ts +5 -1
  88. package/dist/src/context.js +29 -9
  89. package/dist/src/context.js.map +1 -1
  90. package/dist/src/oracle.repository.d.ts +28 -0
  91. package/dist/src/oracle.repository.js +205 -0
  92. package/dist/src/oracle.repository.js.map +1 -0
  93. package/dist/src/oracle.repository.spec.d.ts +1 -0
  94. package/dist/src/oracle.repository.spec.js +118 -0
  95. package/dist/src/oracle.repository.spec.js.map +1 -0
  96. package/package.json +28 -27
@@ -0,0 +1,28 @@
1
+ import type { CliOptions, CliServices } from './context';
2
+ import type { CryptoManifest, StreamingCryptoPackager } from '@cobol-ts/crypto-packager';
3
+ import { FileSystemObjectStore } from '@cobol-ts/crypto-packager';
4
+ export interface OracleConfig {
5
+ readonly version: 1;
6
+ readonly cryptoConfig: string;
7
+ readonly repository: {
8
+ readonly type: 'filesystem';
9
+ readonly root: string;
10
+ };
11
+ }
12
+ export declare function parseOracleConfig(input: unknown): OracleConfig;
13
+ /** Date names are observed production execution dates, not period-derived schedules. */
14
+ export declare function productionRunId(composition: string, date: string): string;
15
+ export interface OracleContext {
16
+ readonly store: FileSystemObjectStore;
17
+ readonly packager: StreamingCryptoPackager;
18
+ readonly directory: string;
19
+ readonly root: string;
20
+ }
21
+ export declare function initializeOracle(services: CliServices, options: CliOptions, configurationName?: string): Promise<OracleContext>;
22
+ /** Validate by using original directory/single-file paths in place. ZIP entries must be
23
+ * extracted to private scratch to let the existing typed COBOL/CSV/JSONL readers seek the files.
24
+ * Neither path buffers a whole production file in memory, and no original bytes are transformed.
25
+ */
26
+ export declare function importProduction(ctx: OracleContext, composition: string, date: string, source: string, force: boolean): Promise<CryptoManifest>;
27
+ export declare function verifyProduction(ctx: OracleContext, composition: string, date: string, full?: boolean): Promise<CryptoManifest>;
28
+ export declare function listProduction(ctx: OracleContext): Promise<readonly string[]>;
@@ -0,0 +1,205 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseOracleConfig = parseOracleConfig;
4
+ exports.productionRunId = productionRunId;
5
+ exports.initializeOracle = initializeOracle;
6
+ exports.importProduction = importProduction;
7
+ exports.verifyProduction = verifyProduction;
8
+ exports.listProduction = listProduction;
9
+ const node_fs_1 = require("node:fs");
10
+ const promises_1 = require("node:fs/promises");
11
+ const node_path_1 = require("node:path");
12
+ const node_os_1 = require("node:os");
13
+ const promises_2 = require("node:stream/promises");
14
+ const file_catalogue_1 = require("@cobol-ts/file-catalogue");
15
+ const file_catalogue_2 = require("@cobol-ts/file-catalogue");
16
+ const composition_definition_1 = require("@cobol-ts/composition-definition");
17
+ const cursor_loader_source_1 = require("@cobol-ts/cursor-loader-source");
18
+ const files_1 = require("@cobol-ts/files");
19
+ const errors_1 = require("@cobol-ts/errors");
20
+ const yaml_jsyaml_1 = require("@cobol-ts/yaml-jsyaml");
21
+ const crypto_packager_1 = require("@cobol-ts/crypto-packager");
22
+ const crypto_1 = require("./commands/crypto");
23
+ function mapping(value, label, allowed) {
24
+ if (!value || typeof value !== 'object' || Array.isArray(value))
25
+ throw new Error(`${label}: Expected mapping`);
26
+ const result = value;
27
+ for (const key of Object.keys(result))
28
+ if (!allowed.includes(key))
29
+ throw new Error(`${label}.${key}: Unknown property`);
30
+ return result;
31
+ }
32
+ function requiredString(value, label) {
33
+ if (typeof value !== 'string' || !value.trim())
34
+ throw new Error(`${label}: Expected nonempty string`);
35
+ return value;
36
+ }
37
+ function parseOracleConfig(input) {
38
+ const root = mapping(input, 'oracle', ['version', 'cryptoConfig', 'repository']);
39
+ if (root.version !== 1)
40
+ throw new Error('oracle.version: Expected 1');
41
+ const repo = mapping(root.repository, 'oracle.repository', ['type', 'root']);
42
+ if (repo.type !== 'filesystem')
43
+ throw new Error('oracle.repository.type: Only filesystem is implemented');
44
+ return { version: 1, cryptoConfig: requiredString(root.cryptoConfig, 'oracle.cryptoConfig'),
45
+ repository: { type: 'filesystem', root: requiredString(repo.root, 'oracle.repository.root') } };
46
+ }
47
+ /** Date names are observed production execution dates, not period-derived schedules. */
48
+ function productionRunId(composition, date) {
49
+ if (!/^[A-Za-z][A-Za-z0-9_-]*$/.test(composition))
50
+ throw new Error('Invalid production composition name');
51
+ if (!/^\d{4}-\d{2}-\d{2}$/.test(date) ||
52
+ Number.isNaN(Date.parse(date + 'T00:00:00Z')) ||
53
+ new Date(date + 'T00:00:00Z').toISOString().slice(0, 10) !== date)
54
+ throw new Error(`Invalid production execution date: ${date}`);
55
+ return (0, crypto_packager_1.safeRelativePath)(`${composition}/${date}`);
56
+ }
57
+ /** Import source membership comes from the named relational composition, not oracle result declarations. */
58
+ async function expectedSources(directory, composition) {
59
+ const selected = (0, errors_1.valueOrThrow)(await (0, composition_definition_1.readCompositionDefinition)(directory, 'files.yaml', composition));
60
+ if (selected.type !== 'relational')
61
+ throw new Error(`Composition ${composition}: Expected a production relational composition`);
62
+ const catalogue = (0, errors_1.valueOrThrow)(await (0, file_catalogue_2.readFileCatalogue)(files_1.nodeTextFiles, (0, node_path_1.join)(directory, 'files.yaml'), yaml_jsyaml_1.jsYamlParser));
63
+ const names = new Set(Object.keys(selected.composition.files));
64
+ for (const member of Object.values(selected.composition.files))
65
+ if (member.mapping)
66
+ names.add(member.mapping);
67
+ return [...names].map(logical => {
68
+ const definition = catalogue.files[logical];
69
+ const configured = selected.files[logical] ?? selected.mappings[logical];
70
+ if (!definition || !configured)
71
+ throw new Error(`Composition ${composition}: Unknown source ${logical}`);
72
+ return { logical, name: (0, file_catalogue_1.physicalFileName)(logical, definition), keyPath: configured.keyPath };
73
+ });
74
+ }
75
+ /** Verify the original key order using the existing configured typed readers, not a second COBOL/CSV parser. */
76
+ async function checkOrder(configDirectory, source, filename) {
77
+ const prepared = await (0, cursor_loader_source_1.prepareConfiguredFileSource)({ configDirectory, logicalName: source.logical, input: filename });
78
+ await (0, cursor_loader_source_1.withPreparedFileSource)(prepared, async (typed) => {
79
+ const key = (0, errors_1.valueOrThrow)(typed.access.compileScalar(source.keyPath.split('.')));
80
+ let previous;
81
+ let count = 0;
82
+ await typed.scan(record => {
83
+ const current = key.read(record, []);
84
+ if (typeof current !== 'string' && typeof current !== 'bigint' && typeof current !== 'number')
85
+ throw new Error(`File ${source.name}: Unsupported customer key type`);
86
+ if (typeof current === 'number' && !Number.isSafeInteger(current))
87
+ throw new Error(`File ${source.name}: Customer key must be an exact integer`);
88
+ if (previous !== undefined && (typeof previous !== typeof current || current < previous))
89
+ throw new Error(`File ${source.name}: Customer key out of order at record ${count + 1}`);
90
+ previous = current;
91
+ count++;
92
+ return true;
93
+ });
94
+ });
95
+ }
96
+ async function initializeOracle(services, options, configurationName = 'oracle.yaml') {
97
+ const paths = await services.paths(options);
98
+ const filename = (0, node_path_1.resolve)(paths.directory, configurationName);
99
+ const loaded = yaml_jsyaml_1.jsYamlParser.parse(await (0, promises_1.readFile)(filename, 'utf8'));
100
+ const config = parseOracleConfig((0, errors_1.valueOrThrow)(loaded));
101
+ const root = (0, node_path_1.resolve)(paths.directory, config.repository.root);
102
+ const crypto = await (0, crypto_1.initializeCrypto)(services, options, config.cryptoConfig, root);
103
+ return { packager: crypto.packager, store: crypto.packager.store,
104
+ directory: paths.directory, root };
105
+ }
106
+ /** Validate by using original directory/single-file paths in place. ZIP entries must be
107
+ * extracted to private scratch to let the existing typed COBOL/CSV/JSONL readers seek the files.
108
+ * Neither path buffers a whole production file in memory, and no original bytes are transformed.
109
+ */
110
+ async function importProduction(ctx, composition, date, source, force) {
111
+ const packageId = productionRunId(composition, date);
112
+ const expected = await expectedSources(ctx.directory, composition);
113
+ const required = new Map(expected.map(entry => [entry.name, entry]));
114
+ const existing = await ctx.store.list(packageId);
115
+ if (existing.length !== 0 && !force)
116
+ throw new Error(`Production run already exists: ${packageId} (use --force)`);
117
+ const stat = await (0, promises_1.lstat)(source);
118
+ if (stat.isSymbolicLink() || (!stat.isFile() && !stat.isDirectory()))
119
+ throw new Error(`Production delivery must be a regular file, directory or ZIP: ${source}`);
120
+ const isZip = stat.isFile() && source.toLowerCase().endsWith('.zip');
121
+ const staging = isZip ? await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'cobolts-oracle-import-')) : undefined;
122
+ try {
123
+ let sourceRoot;
124
+ let received;
125
+ if (isZip) {
126
+ const names = [];
127
+ for await (const file of (0, crypto_packager_1.sourceFiles)(source)) {
128
+ const name = (0, crypto_packager_1.safeRelativePath)(file.path);
129
+ if (name.includes('/'))
130
+ throw new Error(`Production run sources must be flat files: ${name}`);
131
+ if (names.includes(name))
132
+ throw new Error(`Duplicate production file: ${name}`);
133
+ names.push(name);
134
+ await (0, promises_2.pipeline)(file.stream, (0, node_fs_1.createWriteStream)((0, node_path_1.join)(staging, name), { flags: 'wx', mode: 0o600 }));
135
+ }
136
+ sourceRoot = staging;
137
+ received = names;
138
+ }
139
+ else if (stat.isDirectory()) {
140
+ const entries = await (0, promises_1.readdir)(source, { withFileTypes: true });
141
+ for (const entry of entries)
142
+ if (!entry.isFile())
143
+ throw new Error(`Production run sources must be ordinary flat files: ${entry.name}`);
144
+ sourceRoot = source;
145
+ received = entries.map(entry => entry.name);
146
+ }
147
+ else {
148
+ sourceRoot = (0, node_path_1.resolve)(source, '..');
149
+ received = [(0, node_path_1.basename)(source)];
150
+ }
151
+ for (const name of received) {
152
+ (0, crypto_packager_1.safeRelativePath)(name);
153
+ if (name.includes('/'))
154
+ throw new Error(`Production run sources must be flat files: ${name}`);
155
+ if (!required.has(name) && !/^[A-Za-z][A-Za-z0-9_-]*\.(jsonl|csv)$/.test(name))
156
+ throw new Error(`Unknown production file: ${name}`);
157
+ }
158
+ for (const requirement of expected) {
159
+ if (!received.includes(requirement.name))
160
+ throw new Error(`Missing required production file: ${requirement.name}`);
161
+ await checkOrder(ctx.directory, requirement, (0, node_path_1.join)(sourceRoot, requirement.name));
162
+ }
163
+ if (force)
164
+ await ctx.packager.remove(packageId);
165
+ return await ctx.packager.publish(packageId, (0, crypto_packager_1.sourceFiles)(isZip ? staging : source), 'production');
166
+ }
167
+ finally {
168
+ if (staging)
169
+ await (0, promises_1.rm)(staging, { recursive: true, force: true });
170
+ }
171
+ }
172
+ async function verifyProduction(ctx, composition, date, full = true) {
173
+ const id = productionRunId(composition, date);
174
+ const manifest = await ctx.packager.manifest(id);
175
+ if (manifest.packageKind !== 'production')
176
+ throw new Error(`Not a production oracle package: ${id}`);
177
+ return full ? ctx.packager.verify(id) : manifest;
178
+ }
179
+ async function listProduction(ctx) {
180
+ const result = [];
181
+ for (const comp of await (0, promises_1.readdir)(ctx.root, { withFileTypes: true }).catch(error => {
182
+ if (error.code === 'ENOENT')
183
+ return [];
184
+ throw error;
185
+ })) {
186
+ if (!comp.isDirectory() || !/^[A-Za-z][A-Za-z0-9_-]*$/.test(comp.name))
187
+ continue;
188
+ const runs = await (0, promises_1.readdir)((0, node_path_1.join)(ctx.root, comp.name), { withFileTypes: true });
189
+ for (const run of runs) {
190
+ if (!run.isDirectory())
191
+ continue;
192
+ try {
193
+ const id = productionRunId(comp.name, run.name);
194
+ if (!(await ctx.store.exists(`${id}/crypto.manifest.json.sig`)))
195
+ continue;
196
+ const manifest = await ctx.packager.manifest(id);
197
+ if (manifest.packageKind === 'production')
198
+ result.push(id);
199
+ }
200
+ catch { /* invalid/unpublished packages are not discoverable as production runs */ }
201
+ }
202
+ }
203
+ return result.sort();
204
+ }
205
+ //# sourceMappingURL=oracle.repository.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oracle.repository.js","sourceRoot":"","sources":["../../src/oracle.repository.ts"],"names":[],"mappings":";;AAiCA,8CAOC;AAGD,0CAOC;AAgDD,4CAUC;AAMD,4CAkDC;AAED,4CAMC;AAED,wCAmBC;AAjMD,qCAAyC;AACzC,+CAAsE;AACtE,yCAAiD;AACjD,qCAA8B;AAC9B,mDAA6C;AAG7C,6DAAyD;AACzD,6DAA0D;AAC1D,6EAA0E;AAC1E,yEAAkG;AAClG,2CAA6C;AAC7C,6CAA6C;AAC7C,uDAAkD;AAClD,+DAA8F;AAC9F,8CAAkD;AAQlD,SAAS,OAAO,CAAC,KAAc,EAAE,KAAa,EAAE,OAA0B;IACtE,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,oBAAoB,CAAC,CAAA;IAC9G,MAAM,MAAM,GAAG,KAAgC,CAAA;IAC/C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;QAAE,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,IAAI,GAAG,oBAAoB,CAAC,CAAA;IACvH,OAAO,MAAM,CAAA;AACjB,CAAC;AACD,SAAS,cAAc,CAAC,KAAc,EAAE,KAAa;IACjD,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,KAAK,4BAA4B,CAAC,CAAA;IACrG,OAAO,KAAK,CAAA;AAChB,CAAC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C,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;oBAAE,SAAQ;gBACzE,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAA;gBAChD,IAAI,QAAQ,CAAC,WAAW,KAAK,YAAY;oBAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAA;YAC9D,CAAC;YAAC,MAAM,CAAC,CAAC,0EAA0E,CAAC,CAAC;QAC1F,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAA;AACxB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const promises_1 = require("node:fs/promises");
4
+ const node_path_1 = require("node:path");
5
+ const node_os_1 = require("node:os");
6
+ const crypto_packager_1 = require("@cobol-ts/crypto-packager");
7
+ const oracle_repository_1 = require("./oracle.repository");
8
+ describe('oracle.yaml and production execution identity', () => {
9
+ it('accepts one repository root and one shared crypto configuration', () => {
10
+ expect((0, oracle_repository_1.parseOracleConfig)({ version: 1, cryptoConfig: 'crypto.yaml',
11
+ repository: { type: 'filesystem', root: '../oracle' } })).toEqual({
12
+ version: 1, cryptoConfig: 'crypto.yaml', repository: { type: 'filesystem', root: '../oracle' }
13
+ });
14
+ });
15
+ it('rejects unknown fields and unsupported storage adapters', () => {
16
+ expect(() => (0, oracle_repository_1.parseOracleConfig)({ version: 1, cryptoConfig: 'crypto.yaml', repository: {
17
+ type: 'filesystem', root: '../oracle', extensions: { csv: '.csv' }
18
+ } })).toThrow('oracle.repository.extensions: Unknown property');
19
+ expect(() => (0, oracle_repository_1.parseOracleConfig)({ version: 1, cryptoConfig: 'crypto.yaml', repository: {
20
+ type: 'google', root: '../oracle'
21
+ } })).toThrow('oracle.repository.type: Only filesystem is implemented');
22
+ });
23
+ it('uses composition and actual execution date, not a schedule or abbreviation', () => {
24
+ expect((0, oracle_repository_1.productionRunId)('productionDaily', '2026-05-31')).toEqual('productionDaily/2026-05-31');
25
+ expect((0, oracle_repository_1.productionRunId)('productionMonthly', '2026-06-03')).toEqual('productionMonthly/2026-06-03');
26
+ expect(() => (0, oracle_repository_1.productionRunId)('../production', '2026-05-31')).toThrow('Invalid production composition name');
27
+ expect(() => (0, oracle_repository_1.productionRunId)('productionDaily', '2026-02-30')).toThrow('Invalid production execution date');
28
+ });
29
+ });
30
+ describe('production oracle import, verification and recovery', () => {
31
+ let temporary = '';
32
+ let context;
33
+ let source;
34
+ beforeEach(async () => {
35
+ temporary = await (0, promises_1.mkdtemp)((0, node_path_1.join)((0, node_os_1.tmpdir)(), 'cobolts-oracle-spec-'));
36
+ const directory = (0, node_path_1.join)(temporary, '.cobolts');
37
+ await (0, promises_1.mkdir)(directory);
38
+ await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'files.yaml'), [
39
+ 'root: ../copybooks',
40
+ 'entities:',
41
+ ' - customer',
42
+ 'files:',
43
+ ' customers:',
44
+ ' type: csv',
45
+ ' key: customer',
46
+ ' keyPath: customerId',
47
+ ' projection:',
48
+ ' customerId: {type: string}',
49
+ 'mappings: {}',
50
+ 'compositions:',
51
+ ' productionDaily:',
52
+ ' type: relational',
53
+ ' periodicity: daily',
54
+ ' master: customers',
55
+ ' files: {customers: one}',
56
+ ' validation:',
57
+ ' type: validationDataSet',
58
+ ' location: ../validation/shard-0000',
59
+ ''
60
+ ].join('\n'));
61
+ await (0, promises_1.writeFile)((0, node_path_1.join)(directory, 'data.yaml'), 'root: ../data\nfiles:\n customers: customers.csv\n');
62
+ source = (0, node_path_1.join)(temporary, 'incoming');
63
+ await (0, promises_1.mkdir)(source);
64
+ await (0, promises_1.writeFile)((0, node_path_1.join)(source, 'customers.csv'), 'customerId,name\n1001,Alice\n1002,Bob\n');
65
+ await (0, promises_1.writeFile)((0, node_path_1.join)(source, 'oracleDaily.jsonl'), '{"customerId":"1001","value":1}\n');
66
+ const keys = { recipientPublic: (0, node_path_1.join)(temporary, 'keys', 'recipient.pub'),
67
+ recipientPrivate: (0, node_path_1.join)(temporary, 'keys', 'recipient.key'),
68
+ signerPublic: (0, node_path_1.join)(temporary, 'keys', 'signer.pub'),
69
+ signerPrivate: (0, node_path_1.join)(temporary, 'keys', 'signer.key') };
70
+ await (0, crypto_packager_1.generateLocalKeys)(keys);
71
+ const root = (0, node_path_1.join)(temporary, 'oracle');
72
+ const store = new crypto_packager_1.FileSystemObjectStore(root);
73
+ const packager = new crypto_packager_1.StreamingCryptoPackager(store, new crypto_packager_1.LocalSealedBoxFileKeyProvider(keys.recipientPublic, keys.recipientPrivate, 'test-recipient'), new crypto_packager_1.LocalEd25519ManifestSigner('test-signer', keys.signerPublic, keys.signerPrivate));
74
+ context = { root, directory, store, packager };
75
+ });
76
+ afterEach(async () => { await (0, promises_1.rm)(temporary, { recursive: true, force: true }); });
77
+ it('imports into the composition/date directory, signs as production and restores exact bytes', async () => {
78
+ const before = await (0, promises_1.readFile)((0, node_path_1.join)(source, 'customers.csv'));
79
+ const result = await (0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, false);
80
+ expect(result.packageKind).toEqual('production');
81
+ expect(result.packageId).toEqual('productionDaily/2026-05-31');
82
+ expect(result.files.map(f => f.path)).toEqual(['customers.csv', 'oracleDaily.jsonl']);
83
+ expect((await (0, oracle_repository_1.listProduction)(context))).toEqual(['productionDaily/2026-05-31']);
84
+ await (0, oracle_repository_1.verifyProduction)(context, 'productionDaily', '2026-05-31');
85
+ const destination = (0, node_path_1.join)(temporary, 'recovered.csv');
86
+ await context.packager.view(result.packageId, 'customers.csv', destination);
87
+ expect(await (0, promises_1.readFile)(destination)).toEqual(before);
88
+ await expect((0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, false))
89
+ .rejects.toThrow('already exists');
90
+ });
91
+ it('checks source ordering and mandatory files before publishing', async () => {
92
+ await (0, promises_1.writeFile)((0, node_path_1.join)(source, 'customers.csv'), 'customerId,name\n1002,Bob\n1001,Alice\n');
93
+ await expect((0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, false))
94
+ .rejects.toThrow('out of order');
95
+ expect(await (0, oracle_repository_1.listProduction)(context)).toEqual([]);
96
+ await (0, promises_1.rm)((0, node_path_1.join)(source, 'customers.csv'));
97
+ await expect((0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, false))
98
+ .rejects.toThrow('Missing required production file: customers.csv');
99
+ });
100
+ it('validates replacement before invalidating a run; --force removes the old package and publishes a new one', async () => {
101
+ const original = await (0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, false);
102
+ await (0, promises_1.writeFile)((0, node_path_1.join)(source, 'customers.csv'), 'customerId,name\n1002,Bob\n1001,Alice\n');
103
+ await expect((0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, true))
104
+ .rejects.toThrow('out of order');
105
+ expect((await (0, oracle_repository_1.verifyProduction)(context, 'productionDaily', '2026-05-31')).generation)
106
+ .toEqual(original.generation);
107
+ await (0, promises_1.writeFile)((0, node_path_1.join)(source, 'customers.csv'), 'customerId,name\n1001,Alice II\n');
108
+ const updated = await (0, oracle_repository_1.importProduction)(context, 'productionDaily', '2026-05-31', source, true);
109
+ expect(updated.generation).not.toEqual(original.generation);
110
+ expect((await (0, oracle_repository_1.verifyProduction)(context, 'productionDaily', '2026-05-31')).generation)
111
+ .toEqual(updated.generation);
112
+ });
113
+ it('does not accept the validationDataSet composition as a production import', async () => {
114
+ await expect((0, oracle_repository_1.importProduction)(context, 'validation', '2026-05-31', source, false))
115
+ .rejects.toThrow('Expected a production relational composition');
116
+ });
117
+ });
118
+ //# sourceMappingURL=oracle.repository.spec.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"oracle.repository.spec.js","sourceRoot":"","sources":["../../src/oracle.repository.spec.ts"],"names":[],"mappings":";;AAAA,+CAAw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CAAA;QACzF,MAAM,MAAM,CAAC,IAAA,oCAAgB,EAAC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;aACjF,OAAO,CAAC,OAAO,CAAC,cAAc,CAAC,CAAA;QACpC,MAAM,CAAC,CAAC,MAAM,IAAA,oCAAgB,EAAC,OAAO,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;aAChF,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QACjC,MAAM,IAAA,oBAAS,EAAC,IAAA,gBAAI,EAAC,MAAM,EAAE,eAAe,CAAC,EAAE,kCAAkC,CAAC,CAAA;QAClF,MAAM,OAAO,GAAG,MAAM,IAAA,oCAAgB,EAAC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;QAC9F,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;QAC3D,MAAM,CAAC,CAAC,MAAM,IAAA,oCAAgB,EAAC,OAAO,EAAE,iBAAiB,EAAE,YAAY,CAAC,CAAC,CAAC,UAAU,CAAC;aAChF,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IACpC,CAAC,CAAC,CAAA;IACF,EAAE,CAAC,0EAA0E,EAAE,KAAK,IAAI,EAAE;QACtF,MAAM,MAAM,CAAC,IAAA,oCAAgB,EAAC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;aAC7E,OAAO,CAAC,OAAO,CAAC,8CAA8C,CAAC,CAAA;IACxE,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@cobol-ts/cobolts",
3
3
  "description": "Commander CLI for COBOL file catalogues and source generation",
4
- "version": "0.0.18",
4
+ "version": "0.0.19",
5
5
  "main": "dist/index",
6
6
  "types": "dist/index",
7
7
  "bin": {
@@ -22,37 +22,38 @@
22
22
  "dependencies": {
23
23
  "commander": "^12.1.0",
24
24
  "@bufbuild/protobuf": "^2",
25
- "@cobol-ts/files": "0.0.18",
26
- "@cobol-ts/file-catalogue": "0.0.18",
27
- "@cobol-ts/codegen": "0.0.18",
28
- "@cobol-ts/file-display": "0.0.18",
29
- "@cobol-ts/errors": "0.0.18",
30
- "@cobol-ts/yaml": "0.0.18",
31
- "@cobol-ts/yaml-jsyaml": "0.0.18",
32
- "@cobol-ts/cel-access": "0.0.18",
33
- "@cobol-ts/cel-graph-runtime": "0.0.18",
34
- "@cobol-ts/cursor-loader-cobol": "0.0.18",
35
- "@cobol-ts/cursor-loader-benchmark": "0.0.18",
36
- "@cobol-ts/dependency_node": "0.0.18",
37
- "@cobol-ts/cursor-loader-source": "0.0.18",
38
- "@cobol-ts/cursor-composition": "0.0.18",
39
- "@cobol-ts/cel-implementation": "0.0.18",
40
- "@cobol-ts/cursor-loader-indexed-graph-state": "0.0.18",
41
- "@cobol-ts/planned_graph": "0.0.18",
42
- "@cobol-ts/composition-definition": "0.0.18",
43
- "@cobol-ts/spreadsheet": "0.0.18",
44
- "@cobol-ts/spreadsheet-excel": "0.0.18",
45
- "@cobol-ts/characteristics": "0.0.18",
46
- "@cobol-ts/characteristics-yaml": "0.0.18",
47
- "@cobol-ts/characteristics-express": "0.0.18",
48
- "@cobol-ts/ai-mock": "0.0.18",
49
- "@cobol-ts/ai-experiments": "0.0.18"
25
+ "@cobol-ts/files": "0.0.19",
26
+ "@cobol-ts/file-catalogue": "0.0.19",
27
+ "@cobol-ts/codegen": "0.0.19",
28
+ "@cobol-ts/file-display": "0.0.19",
29
+ "@cobol-ts/errors": "0.0.19",
30
+ "@cobol-ts/yaml": "0.0.19",
31
+ "@cobol-ts/yaml-jsyaml": "0.0.19",
32
+ "@cobol-ts/cel-access": "0.0.19",
33
+ "@cobol-ts/cel-graph-runtime": "0.0.19",
34
+ "@cobol-ts/cursor-loader-cobol": "0.0.19",
35
+ "@cobol-ts/cursor-loader-benchmark": "0.0.19",
36
+ "@cobol-ts/dependency_node": "0.0.19",
37
+ "@cobol-ts/cursor-loader-source": "0.0.19",
38
+ "@cobol-ts/cursor-composition": "0.0.19",
39
+ "@cobol-ts/crypto-packager": "0.0.19",
40
+ "@cobol-ts/cel-implementation": "0.0.19",
41
+ "@cobol-ts/cursor-loader-indexed-graph-state": "0.0.19",
42
+ "@cobol-ts/planned_graph": "0.0.19",
43
+ "@cobol-ts/composition-definition": "0.0.19",
44
+ "@cobol-ts/spreadsheet": "0.0.19",
45
+ "@cobol-ts/spreadsheet-excel": "0.0.19",
46
+ "@cobol-ts/characteristics": "0.0.19",
47
+ "@cobol-ts/characteristics-yaml": "0.0.19",
48
+ "@cobol-ts/characteristics-express": "0.0.19",
49
+ "@cobol-ts/ai-mock": "0.0.19",
50
+ "@cobol-ts/ai-experiments": "0.0.19"
50
51
  },
51
52
  "devDependencies": {
52
53
  "typescript": "^5.2.2",
53
54
  "@testing-library/jest-dom": "^6.1.4",
54
55
  "@types/jest": "^29.0.0",
55
- "@types/node": "^14.0.0",
56
+ "@types/node": "^20.0.0",
56
57
  "jest": "^29.0.0",
57
58
  "ts-jest": "^29.0.0"
58
59
  },