@bitblit/ratchet-epsilon-common 4.0.86-alpha → 4.0.87-alpha
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/dist/cjs/build/ratchet-epsilon-common-info.js +5 -5
- package/dist/cjs/cli-bootstrap/ratchet-cli-handler.js +21 -0
- package/dist/cjs/cli-bootstrap/run-background-process-from-command-line.js +26 -0
- package/dist/cjs/index.js +2 -2
- package/dist/cjs/local-container-server.js +14 -16
- package/dist/cjs/test-error-server.js +6 -8
- package/dist/es/build/ratchet-epsilon-common-info.js +5 -5
- package/dist/es/cli-bootstrap/ratchet-cli-handler.js +17 -0
- package/dist/es/cli-bootstrap/run-background-process-from-command-line.js +22 -0
- package/dist/es/index.js +2 -2
- package/dist/es/local-container-server.js +14 -16
- package/dist/es/test-error-server.js +5 -7
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.es.tsbuildinfo +1 -1
- package/dist/tsconfig.types.tsbuildinfo +1 -1
- package/dist/types/cli-bootstrap/ratchet-cli-handler.d.ts +6 -0
- package/dist/types/{run-background-process-from-command-line.d.ts → cli-bootstrap/run-background-process-from-command-line.d.ts} +1 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/local-container-server.d.ts +1 -0
- package/dist/types/test-error-server.d.ts +1 -0
- package/includes/cli.js +12 -0
- package/package.json +4 -3
- package/dist/cjs/cli-bootstrap/epsilon-run-background-process-from-command-line-dry-run.js +0 -21
- package/dist/cjs/run-background-process-from-command-line.js +0 -37
- package/dist/es/cli-bootstrap/epsilon-run-background-process-from-command-line-dry-run.js +0 -18
- package/dist/es/run-background-process-from-command-line.js +0 -32
- package/dist/types/cli-bootstrap/epsilon-run-background-process-from-command-line-dry-run.d.ts +0 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { AbstractRatchetCliHandler } from '@bitblit/ratchet-node-only';
|
|
2
|
+
import { BuildInformation } from '@bitblit/ratchet-common/dist/types/build/build-information';
|
|
3
|
+
export declare class RatchetCliHandler extends AbstractRatchetCliHandler {
|
|
4
|
+
fetchHandlerMap(): Record<string, any>;
|
|
5
|
+
fetchVersionInfo(): BuildInformation;
|
|
6
|
+
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { EpsilonGlobalHandler } from './epsilon-global-handler';
|
|
2
1
|
/**
|
|
3
2
|
* IMPORTANT NOTE
|
|
4
3
|
* This file is part of the bootstrapper to bridge from the Epsilon Background processor
|
|
@@ -9,5 +8,5 @@ import { EpsilonGlobalHandler } from './epsilon-global-handler';
|
|
|
9
8
|
* You are likely to mess it up otherwise.
|
|
10
9
|
*/
|
|
11
10
|
export declare class RunBackgroundProcessFromCommandLine {
|
|
12
|
-
static
|
|
11
|
+
static runFromCliArgs(args: string[]): Promise<void>;
|
|
13
12
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export * from './inter-api-manager';
|
|
|
10
10
|
export * from './local-container-server';
|
|
11
11
|
export * from './local-server-cert';
|
|
12
12
|
export * from './local-server';
|
|
13
|
-
export * from './run-background-process-from-command-line';
|
|
14
13
|
export * from './test-error-server';
|
|
15
14
|
export * from './background/background-dynamo-log-table-handler';
|
|
16
15
|
export * from './background/background-entry';
|
|
@@ -53,7 +52,8 @@ export * from './built-in/http/built-in-filters';
|
|
|
53
52
|
export * from './built-in/http/built-in-handlers';
|
|
54
53
|
export * from './built-in/http/log-level-manipulation-filter';
|
|
55
54
|
export * from './built-in/http/run-handler-as-filter';
|
|
56
|
-
export * from './cli-bootstrap/
|
|
55
|
+
export * from './cli-bootstrap/ratchet-cli-handler';
|
|
56
|
+
export * from './cli-bootstrap/run-background-process-from-command-line';
|
|
57
57
|
export * from './config/dynamo-db-config';
|
|
58
58
|
export * from './config/epsilon-config';
|
|
59
59
|
export * from './config/epsilon-lambda-event-handler';
|
package/includes/cli.js
ADDED
package/package.json
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-epsilon-common",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.87-alpha",
|
|
4
4
|
"description": "Tiny adapter to simplify building API gateway Lambda APIS",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {
|
|
7
|
-
"epsilon-
|
|
7
|
+
"epsilon-cli": "./includes/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"main": "./dist/cjs/index.js",
|
|
10
10
|
"module": "./dist/esm/index.js",
|
|
11
11
|
"types": "./dist/types/index.d.ts",
|
|
12
12
|
"files": [
|
|
13
|
-
"dist/*"
|
|
13
|
+
"dist/*",
|
|
14
|
+
"includes/*"
|
|
14
15
|
],
|
|
15
16
|
"contributors": [
|
|
16
17
|
"Christopher Weiss <bitblit@gmail.com>",
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
"use strict";
|
|
3
|
-
var _a;
|
|
4
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
const run_background_process_from_command_line_1 = require("../run-background-process-from-command-line");
|
|
6
|
-
const ratchet_node_only_1 = require("@bitblit/ratchet-node-only");
|
|
7
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
8
|
-
if (((_a = process === null || process === void 0 ? void 0 : process.argv) === null || _a === void 0 ? void 0 : _a.length) &&
|
|
9
|
-
ratchet_node_only_1.CliRatchet.isCalledFromCLI([
|
|
10
|
-
'epsilon-run-background-process-from-command-line-dry-run.js',
|
|
11
|
-
'epsilon-run-background-process-from-command-line-dry-run',
|
|
12
|
-
])) {
|
|
13
|
-
ratchet_common_1.Logger.info('RunBackgroundProcessFromCommandLine requested (cli is %s) - starting', process === null || process === void 0 ? void 0 : process.argv);
|
|
14
|
-
run_background_process_from_command_line_1.RunBackgroundProcessFromCommandLine.processBackgroundCliRequest(null, true)
|
|
15
|
-
.then((out) => {
|
|
16
|
-
ratchet_common_1.Logger.info('Result : %s', out);
|
|
17
|
-
})
|
|
18
|
-
.catch((err) => ratchet_common_1.Logger.error('Failed : %s', err));
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RunBackgroundProcessFromCommandLine = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
6
|
-
const commander_1 = require("commander");
|
|
7
|
-
const clear_1 = tslib_1.__importDefault(require("clear"));
|
|
8
|
-
class RunBackgroundProcessFromCommandLine {
|
|
9
|
-
static async processBackgroundCliRequest(epsilon, dryRun) {
|
|
10
|
-
let rval = false;
|
|
11
|
-
(0, clear_1.default)();
|
|
12
|
-
ratchet_common_1.Logger.info('Bootstrapping batch processor, args : %j', process.argv);
|
|
13
|
-
commander_1.program
|
|
14
|
-
.version('0.0.1')
|
|
15
|
-
.requiredOption('-p --process <processKey>', 'Background process key')
|
|
16
|
-
.option('-d --data <data>', 'Background data block, JSON encoded')
|
|
17
|
-
.option('-m --metadata <metadata>', 'Background metadata block, JSON encoded')
|
|
18
|
-
.parse(process.argv);
|
|
19
|
-
ratchet_common_1.Logger.info('Program definition : %s : %s : %s', commander_1.program.opts().process, commander_1.program.opts().data, commander_1.program.opts().meta);
|
|
20
|
-
let data = {};
|
|
21
|
-
if (ratchet_common_1.StringRatchet.trimToNull(commander_1.program.opts().data)) {
|
|
22
|
-
data = JSON.parse(commander_1.program.opts().data);
|
|
23
|
-
}
|
|
24
|
-
if (dryRun) {
|
|
25
|
-
ratchet_common_1.Logger.info('Dry run specified - not executing');
|
|
26
|
-
rval = false;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
if (!epsilon) {
|
|
30
|
-
ratchet_common_1.ErrorRatchet.throwFormattedErr('Cannot run background cli because epsilon global handler is null');
|
|
31
|
-
}
|
|
32
|
-
rval = await epsilon.processSingleBackgroundByParts(commander_1.program.opts().process, data);
|
|
33
|
-
}
|
|
34
|
-
return rval;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
exports.RunBackgroundProcessFromCommandLine = RunBackgroundProcessFromCommandLine;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { RunBackgroundProcessFromCommandLine } from '../run-background-process-from-command-line';
|
|
3
|
-
import { CliRatchet } from '@bitblit/ratchet-node-only';
|
|
4
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
5
|
-
if (process?.argv?.length &&
|
|
6
|
-
CliRatchet.isCalledFromCLI([
|
|
7
|
-
'epsilon-run-background-process-from-command-line-dry-run.js',
|
|
8
|
-
'epsilon-run-background-process-from-command-line-dry-run',
|
|
9
|
-
])) {
|
|
10
|
-
Logger.info('RunBackgroundProcessFromCommandLine requested (cli is %s) - starting', process?.argv);
|
|
11
|
-
RunBackgroundProcessFromCommandLine.processBackgroundCliRequest(null, true)
|
|
12
|
-
.then((out) => {
|
|
13
|
-
Logger.info('Result : %s', out);
|
|
14
|
-
})
|
|
15
|
-
.catch((err) => Logger.error('Failed : %s', err));
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { ErrorRatchet, Logger, StringRatchet } from '@bitblit/ratchet-common';
|
|
2
|
-
import { program } from 'commander';
|
|
3
|
-
import clear from 'clear';
|
|
4
|
-
export class RunBackgroundProcessFromCommandLine {
|
|
5
|
-
static async processBackgroundCliRequest(epsilon, dryRun) {
|
|
6
|
-
let rval = false;
|
|
7
|
-
clear();
|
|
8
|
-
Logger.info('Bootstrapping batch processor, args : %j', process.argv);
|
|
9
|
-
program
|
|
10
|
-
.version('0.0.1')
|
|
11
|
-
.requiredOption('-p --process <processKey>', 'Background process key')
|
|
12
|
-
.option('-d --data <data>', 'Background data block, JSON encoded')
|
|
13
|
-
.option('-m --metadata <metadata>', 'Background metadata block, JSON encoded')
|
|
14
|
-
.parse(process.argv);
|
|
15
|
-
Logger.info('Program definition : %s : %s : %s', program.opts().process, program.opts().data, program.opts().meta);
|
|
16
|
-
let data = {};
|
|
17
|
-
if (StringRatchet.trimToNull(program.opts().data)) {
|
|
18
|
-
data = JSON.parse(program.opts().data);
|
|
19
|
-
}
|
|
20
|
-
if (dryRun) {
|
|
21
|
-
Logger.info('Dry run specified - not executing');
|
|
22
|
-
rval = false;
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
if (!epsilon) {
|
|
26
|
-
ErrorRatchet.throwFormattedErr('Cannot run background cli because epsilon global handler is null');
|
|
27
|
-
}
|
|
28
|
-
rval = await epsilon.processSingleBackgroundByParts(program.opts().process, data);
|
|
29
|
-
}
|
|
30
|
-
return rval;
|
|
31
|
-
}
|
|
32
|
-
}
|