terafoundation 0.64.1 → 1.0.0
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/src/api/index.d.ts +2 -2
- package/dist/src/api/index.d.ts.map +1 -1
- package/dist/src/api/index.js +17 -74
- package/dist/src/api/index.js.map +1 -1
- package/dist/src/api/prom-metrics/exporter.js +10 -14
- package/dist/src/api/prom-metrics/exporter.js.map +1 -1
- package/dist/src/api/prom-metrics/prom-metrics-api.d.ts.map +1 -1
- package/dist/src/api/prom-metrics/prom-metrics-api.js +22 -21
- package/dist/src/api/prom-metrics/prom-metrics-api.js.map +1 -1
- package/dist/src/api/utils.d.ts +3 -3
- package/dist/src/api/utils.d.ts.map +1 -1
- package/dist/src/api/utils.js +13 -43
- package/dist/src/api/utils.js.map +1 -1
- package/dist/src/cluster-context.d.ts +4 -3
- package/dist/src/cluster-context.d.ts.map +1 -1
- package/dist/src/cluster-context.js +19 -46
- package/dist/src/cluster-context.js.map +1 -1
- package/dist/src/connector-utils.d.ts +4 -5
- package/dist/src/connector-utils.d.ts.map +1 -1
- package/dist/src/connector-utils.js +39 -45
- package/dist/src/connector-utils.js.map +1 -1
- package/dist/src/connectors/elasticsearch-next.d.ts +3 -10
- package/dist/src/connectors/elasticsearch-next.d.ts.map +1 -1
- package/dist/src/connectors/elasticsearch-next.js +5 -8
- package/dist/src/connectors/elasticsearch-next.js.map +1 -1
- package/dist/src/connectors/hdfs.d.ts +3 -9
- package/dist/src/connectors/hdfs.d.ts.map +1 -1
- package/dist/src/connectors/hdfs.js +13 -13
- package/dist/src/connectors/hdfs.js.map +1 -1
- package/dist/src/connectors/hdfs_ha.d.ts +3 -9
- package/dist/src/connectors/hdfs_ha.d.ts.map +1 -1
- package/dist/src/connectors/hdfs_ha.js +25 -24
- package/dist/src/connectors/hdfs_ha.js.map +1 -1
- package/dist/src/connectors/s3.d.ts +3 -13
- package/dist/src/connectors/s3.d.ts.map +1 -1
- package/dist/src/connectors/s3.js +9 -14
- package/dist/src/connectors/s3.js.map +1 -1
- package/dist/src/core-context.d.ts +8 -9
- package/dist/src/core-context.d.ts.map +1 -1
- package/dist/src/core-context.js +16 -40
- package/dist/src/core-context.js.map +1 -1
- package/dist/src/index.d.ts +5 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +5 -21
- package/dist/src/index.js.map +1 -1
- package/dist/src/interfaces.d.ts +2 -107
- package/dist/src/interfaces.d.ts.map +1 -1
- package/dist/src/interfaces.js +1 -2
- package/dist/src/master.d.ts +2 -2
- package/dist/src/master.d.ts.map +1 -1
- package/dist/src/master.js +7 -10
- package/dist/src/master.js.map +1 -1
- package/dist/src/process-context.d.ts +4 -3
- package/dist/src/process-context.d.ts.map +1 -1
- package/dist/src/process-context.js +10 -17
- package/dist/src/process-context.js.map +1 -1
- package/dist/src/schema.d.ts +0 -2
- package/dist/src/schema.d.ts.map +1 -1
- package/dist/src/schema.js +3 -56
- package/dist/src/schema.js.map +1 -1
- package/dist/src/sysconfig.d.ts +3 -3
- package/dist/src/sysconfig.d.ts.map +1 -1
- package/dist/src/sysconfig.js +28 -34
- package/dist/src/sysconfig.js.map +1 -1
- package/dist/src/test-context.d.ts +7 -7
- package/dist/src/test-context.d.ts.map +1 -1
- package/dist/src/test-context.js +33 -80
- package/dist/src/test-context.js.map +1 -1
- package/dist/src/validate-configs.d.ts +2 -2
- package/dist/src/validate-configs.d.ts.map +1 -1
- package/dist/src/validate-configs.js +31 -60
- package/dist/src/validate-configs.js.map +1 -1
- package/dist/src/worker.d.ts +2 -2
- package/dist/src/worker.d.ts.map +1 -1
- package/dist/src/worker.js +1 -4
- package/dist/src/worker.js.map +1 -1
- package/package.json +6 -5
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import
|
|
3
|
-
import
|
|
2
|
+
import { Logger } from '@terascope/utils';
|
|
3
|
+
import type { Terafoundation } from '@terascope/types';
|
|
4
4
|
/**
|
|
5
5
|
* CoreContext
|
|
6
6
|
*/
|
|
7
|
-
export declare class CoreContext<S = Record<string, any>, A = Record<string, any>, D extends string = string> implements
|
|
8
|
-
readonly cluster:
|
|
9
|
-
readonly sysconfig:
|
|
10
|
-
readonly apis:
|
|
11
|
-
readonly
|
|
12
|
-
readonly logger: ts.Logger;
|
|
7
|
+
export declare class CoreContext<S = Record<string, any>, A = Record<string, any>, D extends string = string> implements Terafoundation.Context<S, A, D> {
|
|
8
|
+
readonly cluster: Terafoundation.Cluster;
|
|
9
|
+
readonly sysconfig: Terafoundation.SysConfig<S>;
|
|
10
|
+
readonly apis: Terafoundation.ContextAPIs & A;
|
|
11
|
+
readonly logger: Logger;
|
|
13
12
|
readonly name: string;
|
|
14
13
|
readonly arch: NodeJS.Architecture;
|
|
15
14
|
readonly platform: NodeJS.Platform;
|
|
16
15
|
assignment: D;
|
|
17
16
|
cluster_name?: string;
|
|
18
|
-
constructor(config:
|
|
17
|
+
constructor(config: Terafoundation.Config<S, A, D>, cluster: Terafoundation.Cluster, sysconfig: Terafoundation.SysConfig<S>, assignment?: D);
|
|
19
18
|
}
|
|
20
19
|
export declare function handleStdStreams(): void;
|
|
21
20
|
//# sourceMappingURL=core-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-context.d.ts","sourceRoot":"","sources":["../../src/core-context.ts"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"core-context.d.ts","sourceRoot":"","sources":["../../src/core-context.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAwB,MAAM,kBAAkB,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD;;EAEE;AACF,qBAAa,WAAW,CACpB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,SAAS,MAAM,GAAG,MAAM,CAC3B,YAAW,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC;IACzC,QAAQ,CAAC,SAAS,EAAG,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IACjD,QAAQ,CAAC,IAAI,EAAG,cAAc,CAAC,WAAW,GAAG,CAAC,CAAC;IAC/C,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,sBAAgB;IAC7B,QAAQ,CAAC,QAAQ,kBAAoB;IACrC,UAAU,EAAE,CAAC,CAAC;IACd,YAAY,CAAC,EAAE,MAAM,CAAC;gBAGlB,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACtC,OAAO,EAAE,cAAc,CAAC,OAAO,EAC/B,SAAS,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,EACtC,UAAU,CAAC,EAAE,CAAC;CA6BrB;AAED,wBAAgB,gBAAgB,IAAI,IAAI,CAYvC"}
|
package/dist/src/core-context.js
CHANGED
|
@@ -1,41 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
-
};
|
|
28
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.handleStdStreams = exports.CoreContext = void 0;
|
|
30
|
-
const ts = __importStar(require("@terascope/utils"));
|
|
31
|
-
const api_1 = __importDefault(require("./api"));
|
|
1
|
+
import { isString, isFunction } from '@terascope/utils';
|
|
2
|
+
import registerApis from './api/index.js';
|
|
32
3
|
/**
|
|
33
4
|
* CoreContext
|
|
34
5
|
*/
|
|
35
|
-
class CoreContext {
|
|
6
|
+
export class CoreContext {
|
|
7
|
+
cluster;
|
|
8
|
+
sysconfig;
|
|
9
|
+
apis;
|
|
10
|
+
logger;
|
|
11
|
+
name;
|
|
12
|
+
arch = process.arch;
|
|
13
|
+
platform = process.platform;
|
|
14
|
+
assignment;
|
|
15
|
+
cluster_name;
|
|
36
16
|
constructor(config, cluster, sysconfig, assignment) {
|
|
37
|
-
this.arch = process.arch;
|
|
38
|
-
this.platform = process.platform;
|
|
39
17
|
this.sysconfig = sysconfig;
|
|
40
18
|
this.cluster = cluster;
|
|
41
19
|
this.name = config.name || 'terafoundation';
|
|
@@ -50,17 +28,16 @@ class CoreContext {
|
|
|
50
28
|
else if (config.name) {
|
|
51
29
|
process.title = config.name;
|
|
52
30
|
}
|
|
53
|
-
if (
|
|
31
|
+
if (isFunction(config.cluster_name)) {
|
|
54
32
|
this.cluster_name = config.cluster_name(this.sysconfig);
|
|
55
33
|
}
|
|
56
|
-
if (
|
|
34
|
+
if (isString(config.cluster_name)) {
|
|
57
35
|
this.cluster_name = config.cluster_name;
|
|
58
36
|
}
|
|
59
|
-
(
|
|
37
|
+
registerApis(this);
|
|
60
38
|
}
|
|
61
39
|
}
|
|
62
|
-
|
|
63
|
-
function handleStdStreams() {
|
|
40
|
+
export function handleStdStreams() {
|
|
64
41
|
// See https://github.com/trentm/node-bunyan/issues/246
|
|
65
42
|
function handleStdError(err) {
|
|
66
43
|
if (err.code === 'EPIPE' || err.code === 'ERR_STREAM_DESTROYED') {
|
|
@@ -73,5 +50,4 @@ function handleStdStreams() {
|
|
|
73
50
|
process.stdout.on('error', handleStdError);
|
|
74
51
|
process.stderr.on('error', handleStdError);
|
|
75
52
|
}
|
|
76
|
-
exports.handleStdStreams = handleStdStreams;
|
|
77
53
|
//# sourceMappingURL=core-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"core-context.js","sourceRoot":"","sources":["../../src/core-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"core-context.js","sourceRoot":"","sources":["../../src/core-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEhE,OAAO,YAAY,MAAM,gBAAgB,CAAC;AAE1C;;EAEE;AACF,MAAM,OAAO,WAAW;IAKX,OAAO,CAAyB;IAChC,SAAS,CAA+B;IACxC,IAAI,CAAkC;IACtC,MAAM,CAAU;IAChB,IAAI,CAAS;IACb,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IACpB,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IACrC,UAAU,CAAI;IACd,YAAY,CAAU;IAEtB,YACI,MAAsC,EACtC,OAA+B,EAC/B,SAAsC,EACtC,UAAc;QAEd,IAAI,CAAC,SAAS,GAAG,SAAS,CA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,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;IAC3C,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC;AAC/C,CAAC"}
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './process-context';
|
|
2
|
-
export * from './cluster-context';
|
|
3
|
-
export * from './core-context';
|
|
4
|
-
export * from './interfaces';
|
|
5
|
-
export * from './test-context';
|
|
1
|
+
export * from './process-context.js';
|
|
2
|
+
export * from './cluster-context.js';
|
|
3
|
+
export * from './core-context.js';
|
|
4
|
+
export * from './interfaces.js';
|
|
5
|
+
export * from './test-context.js';
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/src/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -1,22 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
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("./process-context"), exports);
|
|
18
|
-
__exportStar(require("./cluster-context"), exports);
|
|
19
|
-
__exportStar(require("./core-context"), exports);
|
|
20
|
-
__exportStar(require("./interfaces"), exports);
|
|
21
|
-
__exportStar(require("./test-context"), exports);
|
|
1
|
+
export * from './process-context.js';
|
|
2
|
+
export * from './cluster-context.js';
|
|
3
|
+
export * from './core-context.js';
|
|
4
|
+
export * from './interfaces.js';
|
|
5
|
+
export * from './test-context.js';
|
|
22
6
|
//# sourceMappingURL=index.js.map
|
package/dist/src/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC"}
|
package/dist/src/interfaces.d.ts
CHANGED
|
@@ -1,110 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
/// <reference types="node" />
|
|
3
|
-
import { Format } from 'convict';
|
|
4
|
-
import { EventEmitter } from 'events';
|
|
5
|
-
import { Logger, Overwrite } from '@terascope/utils';
|
|
6
|
-
import { Cluster as NodeJSCluster, Worker as NodeJSWorker } from 'cluster';
|
|
7
|
-
import { Terafoundation as tf } from '@terascope/types';
|
|
8
|
-
export type FoundationConfig<S = Record<string, any>, A = Record<string, any>, D extends string = string> = {
|
|
9
|
-
name: string;
|
|
10
|
-
config_schema?: any;
|
|
11
|
-
schema_formats?: Format[];
|
|
12
|
-
default_config_file?: string;
|
|
13
|
-
cluster_name?: string | ((sysconfig: FoundationSysConfig<S>) => string);
|
|
14
|
-
script?: (context: FoundationContext<S, A, D>) => void | Promise<void>;
|
|
15
|
-
descriptors?: Record<D, string>;
|
|
16
|
-
master?: (context: FoundationContext<S, A, D>, config: FoundationConfig<S, A, D>) => void | Promise<void>;
|
|
17
|
-
worker?: (context: FoundationContext<S, A, D>) => void | Promise<void>;
|
|
18
|
-
start_workers?: boolean;
|
|
19
|
-
shutdownMessaging?: boolean;
|
|
20
|
-
};
|
|
21
|
-
export interface ConnectionConfig {
|
|
22
|
-
endpoint: string;
|
|
23
|
-
cached?: boolean;
|
|
24
|
-
type: string;
|
|
25
|
-
}
|
|
26
|
-
export type ClientFactoryFn = (config: Record<string, any>, logger: Logger, options: ConnectionConfig) => {
|
|
27
|
-
client: any;
|
|
28
|
-
};
|
|
29
|
-
export type CreateClientFactoryFn = (config: Record<string, any>, logger: Logger, options: ConnectionConfig) => Promise<{
|
|
30
|
-
client: any;
|
|
31
|
-
}>;
|
|
32
|
-
export interface FoundationAPIs {
|
|
33
|
-
/** Create a child logger */
|
|
34
|
-
makeLogger(metadata?: Record<string, string>): Logger;
|
|
35
|
-
/** Create the root logger (usually done automatically) */
|
|
36
|
-
makeLogger(name: string, filename: string): Logger;
|
|
37
|
-
getSystemEvents(): EventEmitter;
|
|
38
|
-
getConnection(config: ConnectionConfig): {
|
|
39
|
-
client: any;
|
|
40
|
-
};
|
|
41
|
-
createClient(config: ConnectionConfig): Promise<{
|
|
42
|
-
client: any;
|
|
43
|
-
}>;
|
|
44
|
-
startWorkers(num: number, envOptions: Record<string, string>): void;
|
|
45
|
-
promMetrics: tf.PromMetrics;
|
|
46
|
-
}
|
|
47
|
-
export interface LegacyFoundationApis {
|
|
48
|
-
/** Create a child logger */
|
|
49
|
-
makeLogger(metadata?: Record<string, string>): Logger;
|
|
50
|
-
/** Create the root logger (usually done automatically) */
|
|
51
|
-
makeLogger(name: string, filename: string): Logger;
|
|
52
|
-
getEventEmitter(): EventEmitter;
|
|
53
|
-
getConnection(config: ConnectionConfig): {
|
|
54
|
-
client: any;
|
|
55
|
-
};
|
|
56
|
-
startWorkers(num: number, envOptions: Record<string, string>): void;
|
|
57
|
-
}
|
|
58
|
-
export type ContextAPIs = {
|
|
59
|
-
readonly foundation: FoundationAPIs;
|
|
60
|
-
registerAPI(namespace: string, apis: any): void;
|
|
61
|
-
};
|
|
62
|
-
export type LogType = 'console' | 'file';
|
|
63
|
-
export type LogLevelType = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
64
|
-
export type LogLevelConfig = string | ({
|
|
65
|
-
[type in LogType]: LogLevelType;
|
|
66
|
-
}[]);
|
|
67
|
-
export interface FoundationWorker extends NodeJSWorker {
|
|
68
|
-
__process_restart?: boolean;
|
|
69
|
-
service_context: any;
|
|
70
|
-
assignment: string;
|
|
71
|
-
}
|
|
72
|
-
export type Cluster = Overwrite<NodeJSCluster, {
|
|
73
|
-
fork(env?: any): FoundationWorker;
|
|
74
|
-
workers: {
|
|
75
|
-
[id: string]: FoundationWorker;
|
|
76
|
-
};
|
|
77
|
-
}>;
|
|
78
|
-
export type FoundationSysConfig<S> = {
|
|
79
|
-
_nodeName: string;
|
|
80
|
-
terafoundation: {
|
|
81
|
-
workers: number;
|
|
82
|
-
environment: 'production' | 'development' | 'test' | string;
|
|
83
|
-
connectors: Record<string, any>;
|
|
84
|
-
log_path: string;
|
|
85
|
-
log_level: LogLevelConfig;
|
|
86
|
-
logging: LogType[];
|
|
87
|
-
asset_storage_connection_type: string;
|
|
88
|
-
asset_storage_connection: string;
|
|
89
|
-
asset_storage_bucket?: string;
|
|
90
|
-
prom_metrics_enabled: boolean;
|
|
91
|
-
prom_metrics_port: number;
|
|
92
|
-
prom_metrics_add_default: boolean;
|
|
93
|
-
};
|
|
94
|
-
} & S;
|
|
95
|
-
export type FoundationContext<S = Record<string, any>, A = Record<string, any>, D extends string = string> = {
|
|
96
|
-
sysconfig: FoundationSysConfig<S>;
|
|
97
|
-
apis: ContextAPIs & A;
|
|
98
|
-
foundation: LegacyFoundationApis;
|
|
99
|
-
logger: Logger;
|
|
100
|
-
name: string;
|
|
101
|
-
arch: string;
|
|
102
|
-
platform: string;
|
|
103
|
-
assignment: D;
|
|
104
|
-
cluster_name?: string;
|
|
105
|
-
cluster: Cluster;
|
|
106
|
-
};
|
|
1
|
+
import { Terafoundation } from '@terascope/types';
|
|
107
2
|
export type ParsedArgs<S> = {
|
|
108
|
-
configfile:
|
|
3
|
+
configfile: Terafoundation.SysConfig<S>;
|
|
109
4
|
};
|
|
110
5
|
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,MAAM,MAAM,UAAU,CAAC,CAAC,IAAI;IACxB,UAAU,EAAE,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC3C,CAAC"}
|
package/dist/src/interfaces.js
CHANGED
package/dist/src/master.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export default function masterModule<S = Record<string, any>, A = Record<string, any>, D extends string = string>(context:
|
|
1
|
+
import type { Terafoundation } from '@terascope/types';
|
|
2
|
+
export default function masterModule<S = Record<string, any>, A = Record<string, any>, D extends string = string>(context: Terafoundation.Context<S, A, D>, config: Terafoundation.Config<S, A, D>): void;
|
|
3
3
|
//# sourceMappingURL=master.d.ts.map
|
package/dist/src/master.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"master.d.ts","sourceRoot":"","sources":["../../src/master.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"master.d.ts","sourceRoot":"","sources":["../../src/master.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEvD,MAAM,CAAC,OAAO,UAAU,YAAY,CAChC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,SAAS,MAAM,GAAG,MAAM,EAEzB,OAAO,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACxC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GACvC,IAAI,CAiIN"}
|
package/dist/src/master.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("@terascope/utils");
|
|
5
|
-
function masterModule(context, config) {
|
|
1
|
+
import { cpus } from 'node:os';
|
|
2
|
+
import { times, once } from '@terascope/utils';
|
|
3
|
+
export default function masterModule(context, config) {
|
|
6
4
|
const { logger } = context;
|
|
7
5
|
const cluster = context.cluster;
|
|
8
6
|
const configWorkers = context.sysconfig.terafoundation.workers;
|
|
9
7
|
let startWorkers = true;
|
|
10
|
-
const events = context.foundation.
|
|
8
|
+
const events = context.apis.foundation.getSystemEvents();
|
|
11
9
|
if (config.start_workers === false) {
|
|
12
10
|
startWorkers = false;
|
|
13
11
|
}
|
|
14
12
|
let shuttingDown = false;
|
|
15
|
-
const workerCount = configWorkers ||
|
|
13
|
+
const workerCount = configWorkers || cpus().length;
|
|
16
14
|
function shutdown() {
|
|
17
15
|
logger.info('Shutting down.');
|
|
18
16
|
shuttingDown = true;
|
|
@@ -23,7 +21,7 @@ function masterModule(context, config) {
|
|
|
23
21
|
let workersAlive = 0;
|
|
24
22
|
let funcRun = 0;
|
|
25
23
|
let shutdownInterval;
|
|
26
|
-
const emitShutdown =
|
|
24
|
+
const emitShutdown = once(() => {
|
|
27
25
|
// optional hook for shutdown sequences
|
|
28
26
|
events.emit('terafoundation:shutdown');
|
|
29
27
|
});
|
|
@@ -67,7 +65,7 @@ function masterModule(context, config) {
|
|
|
67
65
|
// default starting workers will use context.worker for code source;
|
|
68
66
|
if (startWorkers) {
|
|
69
67
|
logger.info(`Starting ${workerCount} workers.`);
|
|
70
|
-
|
|
68
|
+
times(workerCount, () => cluster.fork());
|
|
71
69
|
}
|
|
72
70
|
// assignment is set at /lib/api/start_workers
|
|
73
71
|
function determineWorkerENV(worker) {
|
|
@@ -107,5 +105,4 @@ function masterModule(context, config) {
|
|
|
107
105
|
// Put a friendly message on the terminal of the server.
|
|
108
106
|
logger.info('Service starting');
|
|
109
107
|
}
|
|
110
|
-
exports.default = masterModule;
|
|
111
108
|
//# sourceMappingURL=master.js.map
|
package/dist/src/master.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"master.js","sourceRoot":"","sources":["../../src/master.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"master.js","sourceRoot":"","sources":["../../src/master.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAG/C,MAAM,CAAC,OAAO,UAAU,YAAY,CAKhC,OAAwC,EACxC,MAAsC;IAEtC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAC3B,MAAM,OAAO,GAAG,OAAO,CAAC,OAAiC,CAAC;IAC1D,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,OAAO,CAAC;IAC/D,IAAI,YAAY,GAAG,IAAI,CAAC;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC;IAEzD,IAAI,MAAM,CAAC,aAAa,KAAK,KAAK,EAAE;QAChC,YAAY,GAAG,KAAK,CAAC;KACx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C,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC,CAAC;SAC3D;IACL,CAAC,CAAC,CAAC;IAEH,wDAAwD;IACxD,MAAM,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import type { Terafoundation } from '@terascope/types';
|
|
2
|
+
import { CoreContext } from './core-context.js';
|
|
3
|
+
import { ParsedArgs } from './interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* A Single Process Context, this should be used when running
|
|
5
6
|
* in a single process instance/container. This context doesn't
|
|
@@ -10,6 +11,6 @@ import * as i from './interfaces';
|
|
|
10
11
|
* @todo add shutdown handler logic with shutdown method
|
|
11
12
|
*/
|
|
12
13
|
export declare class ProcessContext<S = Record<string, any>, A = Record<string, any>, D extends string = string> extends CoreContext<S, A, D> {
|
|
13
|
-
|
|
14
|
+
static createContext<S = Record<string, any>, A = Record<string, any>, D extends string = string>(config: Terafoundation.Config<S, A, D>, overrideArgs?: ParsedArgs<S>): Promise<ProcessContext<S, A, D>>;
|
|
14
15
|
}
|
|
15
16
|
//# sourceMappingURL=process-context.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-context.d.ts","sourceRoot":"","sources":["../../src/process-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-context.d.ts","sourceRoot":"","sources":["../../src/process-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;;;;EAQE;AACF,qBAAa,cAAc,CACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,SAAS,MAAM,GAAG,MAAM,CAC3B,SAAQ,WAAW,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;WACb,aAAa,CACtB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EACvB,CAAC,SAAS,MAAM,GAAG,MAAM,EAEzB,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,EACtC,YAAY,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;CAqBnC"}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.ProcessContext = void 0;
|
|
7
|
-
const nanoid_1 = require("nanoid");
|
|
8
|
-
const validate_configs_1 = __importDefault(require("./validate-configs"));
|
|
9
|
-
const core_context_1 = require("./core-context");
|
|
10
|
-
const sysconfig_1 = require("./sysconfig");
|
|
1
|
+
import { nanoid } from 'nanoid';
|
|
2
|
+
import validateConfigs from './validate-configs.js';
|
|
3
|
+
import { CoreContext } from './core-context.js';
|
|
4
|
+
import { getArgs } from './sysconfig.js';
|
|
11
5
|
/**
|
|
12
6
|
* A Single Process Context, this should be used when running
|
|
13
7
|
* in a single process instance/container. This context doesn't
|
|
@@ -17,18 +11,17 @@ const sysconfig_1 = require("./sysconfig");
|
|
|
17
11
|
* @todo add process event handler listeners in initialize method
|
|
18
12
|
* @todo add shutdown handler logic with shutdown method
|
|
19
13
|
*/
|
|
20
|
-
class ProcessContext extends
|
|
21
|
-
|
|
14
|
+
export class ProcessContext extends CoreContext {
|
|
15
|
+
static async createContext(config, overrideArgs) {
|
|
22
16
|
const cluster = {
|
|
23
17
|
isMaster: false,
|
|
24
18
|
worker: {
|
|
25
|
-
id:
|
|
19
|
+
id: nanoid(8),
|
|
26
20
|
}
|
|
27
21
|
};
|
|
28
|
-
const parsedArgs = overrideArgs ||
|
|
29
|
-
const sysconfig =
|
|
30
|
-
|
|
22
|
+
const parsedArgs = overrideArgs || await getArgs(config.default_config_file);
|
|
23
|
+
const sysconfig = await validateConfigs(cluster, config, parsedArgs.configfile);
|
|
24
|
+
return new ProcessContext(config, cluster, sysconfig);
|
|
31
25
|
}
|
|
32
26
|
}
|
|
33
|
-
exports.ProcessContext = ProcessContext;
|
|
34
27
|
//# sourceMappingURL=process-context.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-context.js","sourceRoot":"","sources":["../../src/process-context.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"process-context.js","sourceRoot":"","sources":["../../src/process-context.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,eAAe,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGzC;;;;;;;;EAQE;AACF,MAAM,OAAO,cAIX,SAAQ,WAAoB;IAC1B,MAAM,CAAC,KAAK,CAAC,aAAa,CAKtB,MAAsC,EACtC,YAA4B;QAE5B,MAAM,OAAO,GAA2B;YACpC,QAAQ,EAAE,KAAK;YACf,MAAM,EAAE;gBACJ,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC;aAChB;SACG,CAAC;QAET,MAAM,UAAU,GAAG,YAAY,IAAI,MAAM,OAAO,CAC5C,MAAM,CAAC,mBAAmB,CAC7B,CAAC;QAEF,MAAM,SAAS,GAAG,MAAM,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;QAEhF,OAAO,IAAI,cAAc,CACrB,MAAM,EACN,OAAO,EACP,SAAS,CACZ,CAAC;IACN,CAAC;CACJ"}
|
package/dist/src/schema.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import convict from 'convict';
|
|
2
|
-
import { Terafoundation } from '@terascope/types';
|
|
3
2
|
export declare function foundationSchema(): convict.Schema<Record<string, any>>;
|
|
4
|
-
export declare function foundationValidatorFn<S>(subconfig: Record<string, any>, _sysconfig: Terafoundation.SysConfig<S>): void;
|
|
5
3
|
//# sourceMappingURL=schema.d.ts.map
|
package/dist/src/schema.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAK9B,wBAAgB,gBAAgB,wCAoF/B"}
|
package/dist/src/schema.js
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const os_1 = require("os");
|
|
5
|
-
const workerCount = (0, os_1.cpus)().length;
|
|
6
|
-
const DEFAULT_ASSET_STORAGE_CONNECTION_TYPE = 'elasticsearch-next';
|
|
7
|
-
function foundationSchema() {
|
|
1
|
+
import { cpus } from 'node:os';
|
|
2
|
+
const workerCount = cpus().length;
|
|
3
|
+
export function foundationSchema() {
|
|
8
4
|
const schema = {
|
|
9
5
|
environment: {
|
|
10
6
|
doc: 'If set to `production`, console logging will be disabled and logs will be sent to a file',
|
|
@@ -70,21 +66,6 @@ function foundationSchema() {
|
|
|
70
66
|
doc: 'Number of workers per server',
|
|
71
67
|
default: workerCount
|
|
72
68
|
},
|
|
73
|
-
asset_storage_connection_type: {
|
|
74
|
-
doc: '[Deprecated] Name of the connection type used to store assets',
|
|
75
|
-
default: DEFAULT_ASSET_STORAGE_CONNECTION_TYPE,
|
|
76
|
-
format: String
|
|
77
|
-
},
|
|
78
|
-
asset_storage_connection: {
|
|
79
|
-
doc: '[Deprecated] Name of the connection used to store assets.',
|
|
80
|
-
default: 'default',
|
|
81
|
-
format: String
|
|
82
|
-
},
|
|
83
|
-
asset_storage_bucket: {
|
|
84
|
-
doc: '[Deprecated] Name of S3 bucket used to store assets. Can only be used if "asset_storage_connection_type" is "s3".',
|
|
85
|
-
default: undefined,
|
|
86
|
-
format: String
|
|
87
|
-
},
|
|
88
69
|
prom_metrics_enabled: {
|
|
89
70
|
doc: 'Create prometheus exporters',
|
|
90
71
|
default: false,
|
|
@@ -103,38 +84,4 @@ function foundationSchema() {
|
|
|
103
84
|
};
|
|
104
85
|
return schema;
|
|
105
86
|
}
|
|
106
|
-
exports.foundationSchema = foundationSchema;
|
|
107
|
-
function foundationValidatorFn(subconfig, _sysconfig) {
|
|
108
|
-
/// Everything related to asset storage connection is Deprecated
|
|
109
|
-
/// Remove for teraslice 2.0
|
|
110
|
-
const typedSubconfig = subconfig;
|
|
111
|
-
const connectionType = typedSubconfig.asset_storage_connection_type
|
|
112
|
-
|| DEFAULT_ASSET_STORAGE_CONNECTION_TYPE;
|
|
113
|
-
const connectionTypesPresent = Object.keys(typedSubconfig.connectors);
|
|
114
|
-
const validConnectionTypes = ['elasticsearch-next', 's3'];
|
|
115
|
-
// checks on asset_storage_connection_type
|
|
116
|
-
if (!validConnectionTypes
|
|
117
|
-
.includes(connectionType)) {
|
|
118
|
-
throw new Error(`Invalid asset_storage_connection_type. Valid types: ${validConnectionTypes.toString()}`);
|
|
119
|
-
}
|
|
120
|
-
if (!connectionTypesPresent
|
|
121
|
-
.includes(connectionType)) {
|
|
122
|
-
throw new Error('asset_storage_connection_type not found in terafoundation.connectors');
|
|
123
|
-
}
|
|
124
|
-
// checks on asset_storage_connection
|
|
125
|
-
const connectionsPresent = Object.keys(typedSubconfig.connectors[`${connectionType}`]);
|
|
126
|
-
/// Check to make sure the asset_storage_connection exists inside the connector
|
|
127
|
-
/// Exclude elasticsearch as this connection type does not utilize this value
|
|
128
|
-
if (connectionType !== 'elasticsearch-next'
|
|
129
|
-
&& typedSubconfig.asset_storage_connection
|
|
130
|
-
&& !connectionsPresent.includes(typedSubconfig.asset_storage_connection)) {
|
|
131
|
-
throw new Error(`${typedSubconfig.asset_storage_connection} not found in terafoundation.connectors.${connectionType}`);
|
|
132
|
-
}
|
|
133
|
-
// checks on asset_storage_bucket
|
|
134
|
-
if (typedSubconfig.asset_storage_bucket && connectionType !== 's3') {
|
|
135
|
-
throw new Error('asset_storage_bucket can only be used if asset_storage_connection_type is set to "s3"');
|
|
136
|
-
}
|
|
137
|
-
// TODO: add regex to check if valid bucket name
|
|
138
|
-
}
|
|
139
|
-
exports.foundationValidatorFn = foundationValidatorFn;
|
|
140
87
|
//# sourceMappingURL=schema.js.map
|
package/dist/src/schema.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAE/B,MAAM,WAAW,GAAG,IAAI,EAAE,CAAC,MAAM,CAAC;AAElC,MAAM,UAAU,gBAAgB;IAC5B,MAAM,MAAM,GAAwC;QAChD,WAAW,EAAE;YACT,GAAG,EAAE,0FAA0F;YAC/F,OAAO,EAAE,aAAa;YACtB,GAAG,EAAE,UAAU;SAClB;QACD,QAAQ,EAAE;YACN,GAAG,EAAE,qEAAqE;YAC1E,OAAO,EAAE,OAAO,CAAC,GAAG,EAAE;YACtB,MAAM,EAAE,MAAM;SACjB;QACD,OAAO,EAAE;YACL,GAAG,EAAE,2DAA2D;YAChE,OAAO,EAAE,CAAC,SAAS,CAAC;YACpB,MAAM,CAAC,MAAe;gBAClB,MAAM,MAAM,GAAG,EAAE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AAC,IAAI,CAAC,IAAI,CAAC,CAAC;6BACnB;4BACD,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE;gCACnB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;6BACnB;wBACL,CAAC,CAAC,CAAC;wBACH,OAAO,IAAI,CAAC;oBAChB,CAAC,EAAE,EAAE,CAAC,CAAC;oBAEP,IAAI,aAAa,CAAC,MAAM,GAAG,CAAC,EAAE;wBAC1B,MAAM,IAAI,KAAK,CAAC,0EAA0E,CAAC,CAAC;qBAC/F;iBACJ;qBAAM;oBACH,MAAM,IAAI,KAAK,CAAC,0GAA0G,CAAC,CAAC;iBAC/H;YACL,CAAC;SACJ;QACD,OAAO,EAAE;YACL,GAAG,EAAE,8BAA8B;YACnC,OAAO,EAAE,WAAW;SACvB;QACD,oBAAoB,EAAE;YAClB,GAAG,EAAE,6BAA6B;YAClC,OAAO,EAAE,KAAK;YACd,MAAM,EAAE,OAAO;SAClB;QACD,iBAAiB,EAAE;YACf,GAAG,EAAE,oCAAoC;YACzC,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,MAAM;SACjB;QACD,wBAAwB,EAAE;YACtB,GAAG,EAAE,+CAA+C;YACpD,OAAO,EAAE,IAAI;YACb,MAAM,EAAE,OAAO;SAClB;KACJ,CAAC;IAEF,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
package/dist/src/sysconfig.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { ParsedArgs } from './interfaces.js';
|
|
2
2
|
export declare function getDefaultConfigFile(): string | undefined;
|
|
3
|
-
export declare function getArgs<S = Record<string, unknown>>(defaultConfigFile?: string):
|
|
4
|
-
export declare function parseConfigFile(file: string):
|
|
3
|
+
export declare function getArgs<S = Record<string, unknown>>(defaultConfigFile?: string): Promise<ParsedArgs<S>>;
|
|
4
|
+
export declare function parseConfigFile<D = Record<string, any>>(file: string): Promise<D>;
|
|
5
5
|
//# sourceMappingURL=sysconfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sysconfig.d.ts","sourceRoot":"","sources":["../../src/sysconfig.ts"],"names":[],"mappings":"AAKA,OAAO,
|
|
1
|
+
{"version":3,"file":"sysconfig.d.ts","sourceRoot":"","sources":["../../src/sysconfig.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C,wBAAgB,oBAAoB,IAAI,MAAM,GAAC,SAAS,CAgCvD;AAED,wBAAsB,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACrD,iBAAiB,CAAC,EAAE,MAAM,GAC3B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAqBxB;AAED,wBAAsB,eAAe,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAcvF"}
|