@cobol-ts/cli-display 0.0.0-stage → 0.0.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/src/display.command.spec.d.ts +1 -0
- package/dist/src/display.command.spec.js +30 -0
- package/dist/src/display.command.spec.js.map +1 -0
- package/dist/src/display.d.ts +5 -0
- package/dist/src/display.js +28 -0
- package/dist/src/display.js.map +1 -0
- package/dist/src/display.services.d.ts +48 -0
- package/dist/src/display.services.js +3 -0
- package/dist/src/display.services.js.map +1 -0
- package/dist/src/display.workflow.d.ts +4 -0
- package/dist/src/display.workflow.js +45 -0
- package/dist/src/display.workflow.js.map +1 -0
- package/dist/src/display.workflow.spec.d.ts +1 -0
- package/dist/src/display.workflow.spec.js +26 -0
- package/dist/src/display.workflow.spec.js.map +1 -0
- package/index.ts +3 -0
- package/package.json +67 -3
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# @cobol-ts/cli-display
|
|
2
|
+
|
|
3
|
+
Display command and streaming physical file display.
|
|
4
|
+
|
|
5
|
+
Exports addDisplay and the reusable display workflow. The composition root binds shared data-source flags, configured bindings, protected oracle recovery and publication labels. Scratch data is acquired only on iteration and released on early termination or failure, as before. No dependency on the root CLI or another command module.
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./src/display"), exports);
|
|
18
|
+
__exportStar(require("./src/display.services"), exports);
|
|
19
|
+
__exportStar(require("./src/display.workflow"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B;AAC7B,yDAAsC;AACtC,yDAAsC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const commander_1 = require("commander");
|
|
4
|
+
const display_1 = require("./display");
|
|
5
|
+
const paths = { projectRoot: 'project', directory: 'project/.cobolts', catalogue: 'files.yaml',
|
|
6
|
+
policy: 'generation.yaml', data: 'data.yaml', accumulator: 'accumulator.yaml' };
|
|
7
|
+
test.each([false, true])('display streams lines and delegates source selection (raw=%s)', async (raw) => {
|
|
8
|
+
const seen = [], output = [];
|
|
9
|
+
const root = new commander_1.Command();
|
|
10
|
+
const sourceOptions = {
|
|
11
|
+
addDataSourceOptions: command => command.option('--composition <name>').option('--date <date>').option('-f, --file <filename>'),
|
|
12
|
+
dataSourceSelection: flags => {
|
|
13
|
+
expect(flags).toMatchObject({ composition: 'productionDaily', date: '2026-01-01', file: 'local.fb' });
|
|
14
|
+
return { composition: flags.composition, date: flags.date, input: flags.file };
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
(0, display_1.addDisplay)(root, {
|
|
18
|
+
paths: async () => paths, output: line => { output.push(line); },
|
|
19
|
+
display: async (selectedPaths, options) => {
|
|
20
|
+
expect(selectedPaths).toBe(paths);
|
|
21
|
+
seen.push(options);
|
|
22
|
+
return { filename: 'local.fb', lines: (async function* () { yield '{"id":1}'; yield '{"id":2}'; })() };
|
|
23
|
+
}
|
|
24
|
+
}, () => ({}), sourceOptions);
|
|
25
|
+
await root.parseAsync(['display', 'customers', '--count', '2', '--skip', '1', '--composition', 'productionDaily',
|
|
26
|
+
'--date', '2026-01-01', '--file', 'local.fb', ...(raw ? ['--raw'] : [])], { from: 'user' });
|
|
27
|
+
expect(seen).toEqual([{ logicalName: 'customers', count: 2, skip: 1, composition: 'productionDaily', date: '2026-01-01', input: 'local.fb' }]);
|
|
28
|
+
expect(output).toEqual([...(raw ? [] : ['# local.fb']), '{"id":1}', '{"id":2}']);
|
|
29
|
+
});
|
|
30
|
+
//# sourceMappingURL=display.command.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.command.spec.js","sourceRoot":"","sources":["../../src/display.command.spec.ts"],"names":[],"mappings":";;AAAA,yCAAiC;AAEjC,uCAAoC;AAGpC,MAAM,KAAK,GAAa,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY;IACnG,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAC,CAAA;AAElF,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,CAAC,+DAA+D,EAAE,KAAK,EAAC,GAAG,EAAC,EAAE;IAClG,MAAM,IAAI,GAAwB,EAAE,EAAE,MAAM,GAAa,EAAE,CAAA;IAC3D,MAAM,IAAI,GAAG,IAAI,mBA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GAAG,EAAE,eAAe,EAAE,iBAAiB;QAC5G,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAC,IAAI,EAAE,MAAM,EAAC,CAAC,CAAA;IAC7F,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,EAAC,WAAW,EAAE,WAAW,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,WAAW,EAAE,iBAAiB,EAAE,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,UAAU,EAAC,CAAC,CAAC,CAAA;IAC5I,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAA;AACpF,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliOptions } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { DisplayServices, DisplaySourceOptions } from './display.services';
|
|
4
|
+
/** Print one optional filename header followed by one JSON value per line. */
|
|
5
|
+
export declare function addDisplay(root: Command, services: DisplayServices, options: () => CliOptions, sourceOptions: DisplaySourceOptions): void;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addDisplay = addDisplay;
|
|
4
|
+
/** Print one optional filename header followed by one JSON value per line. */
|
|
5
|
+
function addDisplay(root, services, options, sourceOptions) {
|
|
6
|
+
sourceOptions.addDataSourceOptions(root.command('display')
|
|
7
|
+
.description('Stream a configured physical COBOL file as JSONL')
|
|
8
|
+
.argument('<logical-name>', 'Logical filename from files.yaml')
|
|
9
|
+
.option('-n, --count <number>', 'Maximum number of records to display (default 10)')
|
|
10
|
+
.option('-a, --all', 'Display all records')
|
|
11
|
+
.option('-s, --skip <number>', 'Skip the first N records (default 0)')
|
|
12
|
+
.option('-r, --raw', 'Omit the filename header; stdout is strict JSONL'))
|
|
13
|
+
.action(async (logicalName, flags) => {
|
|
14
|
+
const paths = await services.paths(options());
|
|
15
|
+
const result = await services.display(paths, {
|
|
16
|
+
logicalName,
|
|
17
|
+
...(flags.count !== undefined ? { count: Number(flags.count) } : {}),
|
|
18
|
+
...(flags.skip !== undefined ? { skip: Number(flags.skip) } : {}),
|
|
19
|
+
...(flags.all ? { all: true } : {}),
|
|
20
|
+
...sourceOptions.dataSourceSelection(flags)
|
|
21
|
+
});
|
|
22
|
+
if (!flags.raw)
|
|
23
|
+
services.output(`# ${result.filename}`);
|
|
24
|
+
for await (const line of result.lines)
|
|
25
|
+
services.output(line);
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/display.ts"],"names":[],"mappings":";;AAYA,gCAoBC;AArBD,8EAA8E;AAC9E,SAAgB,UAAU,CAAC,IAAa,EAAE,QAAyB,EAAE,OAAyB,EAAE,aAAmC;IAC/H,aAAa,CAAC,oBAAoB,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;SACrD,WAAW,CAAC,kDAAkD,CAAC;SAC/D,QAAQ,CAAC,gBAAgB,EAAE,kCAAkC,CAAC;SAC9D,MAAM,CAAC,sBAAsB,EAAE,mDAAmD,CAAC;SACnF,MAAM,CAAC,WAAW,EAAE,qBAAqB,CAAC;SAC1C,MAAM,CAAC,qBAAqB,EAAE,sCAAsC,CAAC;SACrE,MAAM,CAAC,WAAW,EAAE,kDAAkD,CAAC,CAAC;SACxE,MAAM,CAAC,KAAK,EAAE,WAAmB,EAAE,KAA4B,EAAE,EAAE;QAChE,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QAC7C,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE;YACzC,WAAW;YACX,GAAG,CAAC,KAAK,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClE,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC/D,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAC,GAAG,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACjC,GAAG,aAAa,CAAC,mBAAmB,CAAC,KAAK,CAAC;SAC9C,CAAC,CAAA;QACF,IAAI,CAAC,KAAK,CAAC,GAAG;YAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;QACvD,IAAI,KAAK,EAAE,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK;YAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IAChE,CAAC,CAAC,CAAA;AACV,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
|
+
import type { CliPaths, Output, Paths } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { DisplayOptions, DisplayStream } from '@cobol-ts/file-display';
|
|
4
|
+
import type { CanonicalPublishedDataBinding, ResolvedDataFile } from '@cobol-ts/file-catalogue';
|
|
5
|
+
/** The subset of project source selection that display consumes. */
|
|
6
|
+
export interface DisplaySourceSelection {
|
|
7
|
+
readonly composition?: string;
|
|
8
|
+
readonly date?: string;
|
|
9
|
+
readonly input?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface DisplaySourceFlags {
|
|
12
|
+
readonly composition?: string;
|
|
13
|
+
readonly date?: string;
|
|
14
|
+
readonly file?: string;
|
|
15
|
+
}
|
|
16
|
+
export type CliDisplayOptions = Omit<DisplayOptions, 'configDirectory' | 'catalogue' | 'data'> & DisplaySourceSelection;
|
|
17
|
+
export type Display = (paths: CliPaths, options: CliDisplayOptions) => Promise<DisplayStream>;
|
|
18
|
+
export interface DisplayServices {
|
|
19
|
+
readonly display: Display;
|
|
20
|
+
readonly output: Output;
|
|
21
|
+
readonly paths: Paths;
|
|
22
|
+
}
|
|
23
|
+
/** Share CLI source flags with the other commands without depending on them. */
|
|
24
|
+
export interface DisplaySourceOptions {
|
|
25
|
+
readonly addDataSourceOptions: (command: Command) => Command;
|
|
26
|
+
readonly dataSourceSelection: (flags: DisplaySourceFlags) => DisplaySourceSelection;
|
|
27
|
+
}
|
|
28
|
+
/** The protected project source lifecycle remains the responsibility of the host. */
|
|
29
|
+
export interface DisplayDependencies {
|
|
30
|
+
readonly configuredBindings: (paths: CliPaths) => Promise<{
|
|
31
|
+
readonly bindings: readonly ResolvedDataFile[];
|
|
32
|
+
}>;
|
|
33
|
+
readonly publishedLabel: (binding: CanonicalPublishedDataBinding) => string;
|
|
34
|
+
readonly usesOracle: (selection: DisplaySourceSelection) => selection is DisplaySourceSelection & {
|
|
35
|
+
readonly composition: string;
|
|
36
|
+
readonly date: string;
|
|
37
|
+
readonly input?: undefined;
|
|
38
|
+
};
|
|
39
|
+
readonly expectedSources: (directory: string, composition: string) => Promise<readonly {
|
|
40
|
+
readonly logical: string;
|
|
41
|
+
readonly name: string;
|
|
42
|
+
}[]>;
|
|
43
|
+
readonly productionRunId: (composition: string, date: string) => string;
|
|
44
|
+
readonly openDataSources: (paths: CliPaths, selection: DisplaySourceSelection) => Promise<{
|
|
45
|
+
readonly input: (logicalName: string) => Promise<string | undefined>;
|
|
46
|
+
close(): Promise<void>;
|
|
47
|
+
}>;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.services.js","sourceRoot":"","sources":["../../src/display.services.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type DisplayStream } from '@cobol-ts/file-display';
|
|
2
|
+
import type { CliPaths } from '@cobol-ts/cli-common';
|
|
3
|
+
import type { CliDisplayOptions, DisplayDependencies } from './display.services';
|
|
4
|
+
export declare function display(dependencies: DisplayDependencies, paths: CliPaths, options: CliDisplayOptions): Promise<DisplayStream>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.display = display;
|
|
4
|
+
const files_node_1 = require("@cobol-ts/files-node");
|
|
5
|
+
const file_display_node_1 = require("@cobol-ts/file-display-node");
|
|
6
|
+
const errors_1 = require("@cobol-ts/errors");
|
|
7
|
+
async function display(dependencies, paths, options) {
|
|
8
|
+
const open = async (input) => (0, errors_1.valueOrThrow)(await (0, file_display_node_1.openFileDisplay)({
|
|
9
|
+
...options, configDirectory: paths.directory,
|
|
10
|
+
catalogue: paths.catalogue, data: paths.data,
|
|
11
|
+
...(input !== undefined ? { input } : {})
|
|
12
|
+
}, files_node_1.nodeTextFiles));
|
|
13
|
+
const oracle = dependencies.usesOracle(options);
|
|
14
|
+
const composition = options.composition;
|
|
15
|
+
const source = composition === undefined ? undefined :
|
|
16
|
+
(await dependencies.expectedSources(paths.directory, composition)).find(s => s.logical === options.logicalName);
|
|
17
|
+
if (composition !== undefined && !source)
|
|
18
|
+
throw new Error(`Composition ${composition}: No source ${options.logicalName}`);
|
|
19
|
+
if (options.input !== undefined)
|
|
20
|
+
return open(options.input);
|
|
21
|
+
let label = options.logicalName;
|
|
22
|
+
if (!oracle) {
|
|
23
|
+
const { bindings } = await dependencies.configuredBindings(paths);
|
|
24
|
+
const binding = bindings.find(row => row.logicalName === options.logicalName);
|
|
25
|
+
if (!binding)
|
|
26
|
+
return open();
|
|
27
|
+
if (binding.type === 'file')
|
|
28
|
+
return open(binding.filename);
|
|
29
|
+
label = `${dependencies.publishedLabel(binding)} (${options.logicalName})`;
|
|
30
|
+
}
|
|
31
|
+
const id = oracle ? dependencies.productionRunId(options.composition, options.date) : undefined;
|
|
32
|
+
// Acquire scratch only on iteration; early exit and errors both release it.
|
|
33
|
+
async function* lines() {
|
|
34
|
+
const sources = await dependencies.openDataSources(paths, options);
|
|
35
|
+
try {
|
|
36
|
+
const displayed = await open(await sources.input(options.logicalName));
|
|
37
|
+
yield* displayed.lines;
|
|
38
|
+
}
|
|
39
|
+
finally {
|
|
40
|
+
await sources.close();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return { filename: oracle ? `oracle:${id}/${source.name}` : label, lines: lines() };
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=display.workflow.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.workflow.js","sourceRoot":"","sources":["../../src/display.workflow.ts"],"names":[],"mappings":";;AAOA,0BA8BC;AArCD,qDAAkD;AAElD,mEAA2D;AAC3D,6CAA6C;AAItC,KAAK,UAAU,OAAO,CAAC,YAAiC,EAAE,KAAe,EAAE,OAA0B;IACxG,MAAM,IAAI,GAAG,KAAK,EAAE,KAAc,EAAE,EAAE,CAAC,IAAA,qBAAY,EAAC,MAAM,IAAA,mCAAe,EAAC;QACtE,GAAG,OAAO,EAAE,eAAe,EAAE,KAAK,CAAC,SAAS;QAC5C,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI;QAC5C,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC1C,EAAE,0BAAa,CAAC,CAAC,CAAA;IAClB,MAAM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AO,CAAC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC/F,4EAA4E;IAC5E,KAAK,SAAS,CAAC,CAAC,KAAK;QACjB,MAAM,OAAO,GAAG,MAAM,YAAY,CAAC,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAA;QAClE,IAAI,CAAC;YACD,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,MAAM,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAA;YACtE,KAAK,CAAC,CAAC,SAAS,CAAC,KAAK,CAAA;QAC1B,CAAC;gBAAS,CAAC;YAAA,MAAM,OAAO,CAAC,KAAK,EAAE,CAAA;QAAA,CAAC;IACrC,CAAC;IACD,OAAO,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,MAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,EAAC,CAAA;AACtF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const display_workflow_1 = require("./display.workflow");
|
|
4
|
+
const paths = { projectRoot: 'project', directory: 'project/.cobolts', catalogue: 'files.yaml',
|
|
5
|
+
policy: 'generation.yaml', data: 'data.yaml', accumulator: 'accumulator.yaml' };
|
|
6
|
+
test('protected display acquires sources lazily and releases them when input recovery fails', async () => {
|
|
7
|
+
const calls = [];
|
|
8
|
+
const dependencies = {
|
|
9
|
+
configuredBindings: async () => { throw new Error('Unexpected local binding'); },
|
|
10
|
+
publishedLabel: () => { throw new Error('Unexpected published binding'); },
|
|
11
|
+
usesOracle: (selection) => selection.input === undefined && selection.composition !== undefined && selection.date !== undefined,
|
|
12
|
+
expectedSources: async () => [{ logical: 'customers', name: 'customers.fb' }],
|
|
13
|
+
productionRunId: (composition, date) => `${composition}/${date}`,
|
|
14
|
+
openDataSources: async () => {
|
|
15
|
+
calls.push('open');
|
|
16
|
+
return { input: async (logical) => { calls.push(logical); throw new Error('Recovery failed'); },
|
|
17
|
+
close: async () => { calls.push('close'); } };
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
const result = await (0, display_workflow_1.display)(dependencies, paths, { logicalName: 'customers', composition: 'productionDaily', date: '2026-01-01' });
|
|
21
|
+
expect(result.filename).toBe('oracle:productionDaily/2026-01-01/customers.fb');
|
|
22
|
+
expect(calls).toEqual([]);
|
|
23
|
+
await expect(result.lines[Symbol.asyncIterator]().next()).rejects.toThrow('Recovery failed');
|
|
24
|
+
expect(calls).toEqual(['open', 'customers', 'close']);
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=display.workflow.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.workflow.spec.js","sourceRoot":"","sources":["../../src/display.workflow.spec.ts"],"names":[],"mappings":";;AACA,yDAA0C;AAG1C,MAAM,KAAK,GAAa,EAAC,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,kBAAkB,EAAE,SAAS,EAAE,YAAY;IACnG,MAAM,EAAE,iBAAiB,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,kBAAkB,EAAC,CAAA;AAElF,IAAI,CAAC,uFAAuF,EAAE,KAAK,IAAI,EAAE;IACrG,MAAM,KAAK,GAAa,EAAE,CAAA;IAC1B,MAAM,YAAY,GAAwB;QACtC,kBAAkB,EAAE,KAAK,IAAI,EAAE,GAAE,MAAM,IAAI,KAAK,CAAC,0BAA0B,CAAC,CAAA,CAAA,CAAC;QAC7E,cAAc,EAAE,GAAG,EAAE,GAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAA,CAAA,CAAC;QACvE,UAAU,EAAE,CAAC,SAAS,EAA0F,EAAE,CAC9G,SAAS,CAAC,KAAK,K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AC,CAAA;AACzD,CAAC,CAAC,CAAA"}
|
package/index.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cobol-ts/cli-display",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
3
|
+
"description": "Physical record display command",
|
|
4
|
+
"version": "0.0.57",
|
|
5
|
+
"main": "dist/index",
|
|
6
|
+
"types": "dist/index",
|
|
7
|
+
"browserslist": {
|
|
8
|
+
"development": [
|
|
9
|
+
"last 1 chrome version",
|
|
10
|
+
"last 1 firefox version",
|
|
11
|
+
"last 1 safari version"
|
|
12
|
+
],
|
|
13
|
+
"production": [
|
|
14
|
+
">0.2%",
|
|
15
|
+
"not dead",
|
|
16
|
+
"not op_mini all"
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"commander": "^12.1.0",
|
|
21
|
+
"@cobol-ts/cli-common": "0.0.57",
|
|
22
|
+
"@cobol-ts/errors": "0.0.57",
|
|
23
|
+
"@cobol-ts/file-catalogue": "0.0.57",
|
|
24
|
+
"@cobol-ts/file-display": "0.0.57",
|
|
25
|
+
"@cobol-ts/files": "0.0.57",
|
|
26
|
+
"@cobol-ts/files-node": "0.0.57",
|
|
27
|
+
"@cobol-ts/file-display-node": "0.0.57"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^5.2.2",
|
|
31
|
+
"@testing-library/jest-dom": "^6.1.4",
|
|
32
|
+
"@types/jest": "^29.0.0",
|
|
33
|
+
"@types/node": "^20.0.0",
|
|
34
|
+
"jest": "^29.0.0",
|
|
35
|
+
"ts-jest": "^29.0.0"
|
|
36
|
+
},
|
|
37
|
+
"eslintConfig": {
|
|
38
|
+
"extends": [
|
|
39
|
+
"react-app",
|
|
40
|
+
"react-app/jest"
|
|
41
|
+
],
|
|
42
|
+
"overrides": [
|
|
43
|
+
{
|
|
44
|
+
"files": [
|
|
45
|
+
"**/*.stories.*"
|
|
46
|
+
],
|
|
47
|
+
"rules": {
|
|
48
|
+
"import/no-anonymous-default-export": "off"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist/index.js",
|
|
55
|
+
"dist/index.d.ts",
|
|
56
|
+
"dist/src/",
|
|
57
|
+
"dist/",
|
|
58
|
+
"dist/**/*"
|
|
59
|
+
],
|
|
60
|
+
"keywords": [
|
|
61
|
+
"indexing"
|
|
62
|
+
],
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"module": "./index.ts",
|
|
65
|
+
"repository": "git@github.com:intellimaintain/intellimaintain.git",
|
|
66
|
+
"scripts": {
|
|
67
|
+
"test": "jest --config jest.config.json --env node",
|
|
68
|
+
"test:watch": "npm run test -- --watch"
|
|
69
|
+
}
|
|
6
70
|
}
|