@grafctory/gear 0.0.0-stage → 0.6.1
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/LICENSE +201 -0
- package/README.md +57 -2
- package/dist/cache/file.d.ts +44 -0
- package/dist/cache/file.d.ts.map +1 -0
- package/dist/cache/file.js +182 -0
- package/dist/cache/file.js.map +1 -0
- package/dist/cache/index.d.ts +22 -0
- package/dist/cache/index.d.ts.map +1 -0
- package/dist/cache/index.js +28 -0
- package/dist/cache/index.js.map +1 -0
- package/dist/cache/memory.d.ts +27 -0
- package/dist/cache/memory.d.ts.map +1 -0
- package/dist/cache/memory.js +42 -0
- package/dist/cache/memory.js.map +1 -0
- package/dist/index.core.d.ts +43 -0
- package/dist/index.core.d.ts.map +1 -0
- package/dist/index.core.js +71 -0
- package/dist/index.core.js.map +1 -0
- package/dist/index.d.ts +217 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +241 -0
- package/dist/index.js.map +1 -0
- package/dist/space/index.d.ts +45 -0
- package/dist/space/index.d.ts.map +1 -0
- package/dist/space/index.js +82 -0
- package/dist/space/index.js.map +1 -0
- package/dist/vault/dot.d.ts +27 -0
- package/dist/vault/dot.d.ts.map +1 -0
- package/dist/vault/dot.js +59 -0
- package/dist/vault/dot.js.map +1 -0
- package/dist/vault/env.d.ts +23 -0
- package/dist/vault/env.d.ts.map +1 -0
- package/dist/vault/env.js +47 -0
- package/dist/vault/env.js.map +1 -0
- package/dist/vault/index.d.ts +43 -0
- package/dist/vault/index.d.ts.map +1 -0
- package/dist/vault/index.js +29 -0
- package/dist/vault/index.js.map +1 -0
- package/package.json +67 -4
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { isString, memo } from "@grafctory/core";
|
|
17
|
+
import { existsSync } from "node:fs";
|
|
18
|
+
import { readFile } from "node:fs/promises";
|
|
19
|
+
import { dirname, join, sep } from "node:path";
|
|
20
|
+
/**
|
|
21
|
+
* The name of the file marking the base folder of a package.
|
|
22
|
+
*/
|
|
23
|
+
const Manifest = "package.json";
|
|
24
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
25
|
+
/**
|
|
26
|
+
* The process-wide cache of resource contents, keyed by absolute URL.
|
|
27
|
+
*/
|
|
28
|
+
const resources = memo((href) => readFile(new URL(href), "utf-8"));
|
|
29
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
30
|
+
/**
|
|
31
|
+
* Retrieves the default base path.
|
|
32
|
+
*
|
|
33
|
+
* @returns The absolute path of the working directory of the process
|
|
34
|
+
*/
|
|
35
|
+
export function getPath() {
|
|
36
|
+
return process.cwd();
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Retrieves the base path of an enclosing package.
|
|
40
|
+
*
|
|
41
|
+
* Locates the package a path belongs to by its manifest, rather than by the folder the process happens to be started
|
|
42
|
+
* from, so that a path anchored to it is the same however the code is launched, whether from a shell, an IDE run
|
|
43
|
+
* configuration or a deployed workload.
|
|
44
|
+
*
|
|
45
|
+
* @param path The absolute path the package is looked up from, typically the folder of the calling module, as given
|
|
46
|
+
* by `import.meta.dirname`
|
|
47
|
+
*
|
|
48
|
+
* @returns The absolute path of the closest folder holding a `package.json` file, at or above `path`
|
|
49
|
+
*
|
|
50
|
+
* @throws {@link !Error Error} If neither `path` nor any folder above it holds a `package.json` file
|
|
51
|
+
*/
|
|
52
|
+
export function getPackage(path) {
|
|
53
|
+
const base = path.split(sep)
|
|
54
|
+
.reduce(chain => [...chain, dirname(chain[chain.length - 1])], [path])
|
|
55
|
+
.find(folder => existsSync(join(folder, Manifest)));
|
|
56
|
+
if (base === undefined) {
|
|
57
|
+
throw new Error(`missing <${Manifest}> above <${path}>`);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
return base;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Retrieves the text of a resource file.
|
|
65
|
+
*
|
|
66
|
+
* Reads a file shipped beside the calling module, such as a prompt or template, wherever the code is launched from.
|
|
67
|
+
*
|
|
68
|
+
* @param url The URL of the file, or a path resolved against `base`; a path made only of extensions, such as `.sys.md`,
|
|
69
|
+
* replaces the trailing extensions of `base`, so that `module.js` can name its companion `module.sys.md`
|
|
70
|
+
* @param base The URL `url` is resolved against, typically the URL of the calling module, as given by `import.meta.url`
|
|
71
|
+
*
|
|
72
|
+
* @returns A promise resolving to the UTF-8 text of the file, rejected if the file can't be read
|
|
73
|
+
*
|
|
74
|
+
* @throws {@link !TypeError TypeError} If `url` is a path and `base` is missing or isn't a valid URL
|
|
75
|
+
*/
|
|
76
|
+
export function getResource(url, base) {
|
|
77
|
+
const target = base && isString(url) && /^(\.[a-z0-9]+)+$/i.test(url)
|
|
78
|
+
? new URL(new URL(base).href.replace(/(\.[a-z0-9]+)+$/i, url), base)
|
|
79
|
+
: new URL(url, base);
|
|
80
|
+
return resources(target.href);
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/space/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAYH,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAG/C;;GAEG;AACH,MAAM,QAAQ,GAAG,cAAc,CAAC;AAGhC,wHAAwH;AAExH;;GAEG;AACH,MAAM,SAAS,GAAG,IAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;AAG3E,wHAAwH;AAExH;;;;GAIG;AACH,MAAM,UAAU,OAAO;IAEtB,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;AAEtB,CAAC;AAGD;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC;SAC1B,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,GAAG,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,GAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC;SACnE,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAErD,IAAK,IAAI,KAAK,SAAS,EAAG,CAAC;QAE1B,MAAM,IAAI,KAAK,CAAC,YAAY,QAAQ,YAAY,IAAI,GAAG,CAAC,CAAC;IAE1D,CAAC;SAAM,CAAC;QAEP,OAAO,IAAI,CAAC;IAEb,CAAC;AAEF,CAAC;AAGD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,WAAW,CAAC,GAAY,EAAE,IAAc;IAEvD,MAAM,MAAM,GAAG,IAAI,IAAI,QAAQ,CAAC,GAAG,CAAC,IAAI,mBAAmB,CAAC,IAAI,CAAC,GAAG,CAAC;QACpE,CAAC,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,GAAG,CAAC,EAAE,IAAI,CAAC;QACpE,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;IAEtB,OAAO,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAE/B,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Vault } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a dotenv vault.
|
|
4
|
+
*
|
|
5
|
+
* Parameters are read from `file` and parsed as a dotenv document.
|
|
6
|
+
*
|
|
7
|
+
* The document is read as the first request is served and the following ones are served from what it held then, so
|
|
8
|
+
* that edits made while the vault is in use are not seen for its lifetime.
|
|
9
|
+
*
|
|
10
|
+
* @param file The path of the dotenv document to be read, resolved against the base path of the execution the vault
|
|
11
|
+
* is created in, as {@link getPath} defines; defaults to `.env`
|
|
12
|
+
*
|
|
13
|
+
* @returns A {@link Vault} retrieving parameters from `file`
|
|
14
|
+
*
|
|
15
|
+
* @throws {@link !Error Error} If created outside an execution, as {@link service} defines
|
|
16
|
+
*
|
|
17
|
+
* @throws {@link !Error Error} While retrieving a parameter, if the document defines no value under its key
|
|
18
|
+
*
|
|
19
|
+
* @throws {@link !Error Error} While retrieving a parameter, whatever reading `file` reports, a missing document
|
|
20
|
+
* included
|
|
21
|
+
*
|
|
22
|
+
* @see {@link https://nodejs.org/api/util.html#utilparseenvcontent Node.js `util.parseEnv()`}
|
|
23
|
+
*
|
|
24
|
+
* @group Implementations
|
|
25
|
+
*/
|
|
26
|
+
export declare function createDotVault(file?: string): Vault;
|
|
27
|
+
//# sourceMappingURL=dot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot.d.ts","sourceRoot":"","sources":["../../src/vault/dot.ts"],"names":[],"mappings":"AAsBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,cAAc,CAAC,IAAI,GAAE,MAAe,GAAG,KAAK,CAsB3D"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { lazy } from "@grafctory/core";
|
|
17
|
+
import { readFile } from "node:fs/promises";
|
|
18
|
+
import { resolve } from "node:path";
|
|
19
|
+
import { parseEnv } from "node:util";
|
|
20
|
+
import { service } from "../index.js";
|
|
21
|
+
import { getPath } from "../space/index.js";
|
|
22
|
+
/**
|
|
23
|
+
* Creates a dotenv vault.
|
|
24
|
+
*
|
|
25
|
+
* Parameters are read from `file` and parsed as a dotenv document.
|
|
26
|
+
*
|
|
27
|
+
* The document is read as the first request is served and the following ones are served from what it held then, so
|
|
28
|
+
* that edits made while the vault is in use are not seen for its lifetime.
|
|
29
|
+
*
|
|
30
|
+
* @param file The path of the dotenv document to be read, resolved against the base path of the execution the vault
|
|
31
|
+
* is created in, as {@link getPath} defines; defaults to `.env`
|
|
32
|
+
*
|
|
33
|
+
* @returns A {@link Vault} retrieving parameters from `file`
|
|
34
|
+
*
|
|
35
|
+
* @throws {@link !Error Error} If created outside an execution, as {@link service} defines
|
|
36
|
+
*
|
|
37
|
+
* @throws {@link !Error Error} While retrieving a parameter, if the document defines no value under its key
|
|
38
|
+
*
|
|
39
|
+
* @throws {@link !Error Error} While retrieving a parameter, whatever reading `file` reports, a missing document
|
|
40
|
+
* included
|
|
41
|
+
*
|
|
42
|
+
* @see {@link https://nodejs.org/api/util.html#utilparseenvcontent Node.js `util.parseEnv()`}
|
|
43
|
+
*
|
|
44
|
+
* @group Implementations
|
|
45
|
+
*/
|
|
46
|
+
export function createDotVault(file = ".env") {
|
|
47
|
+
const path = service(getPath);
|
|
48
|
+
const parameters = lazy(async () => parseEnv(await readFile(resolve(path, file), "utf-8")));
|
|
49
|
+
return async (key) => {
|
|
50
|
+
const value = (await parameters())[key];
|
|
51
|
+
if (value === undefined) {
|
|
52
|
+
throw new Error(`undefined secret <${key}>`);
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=dot.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dot.js","sourceRoot":"","sources":["../../src/vault/dot.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,cAAc,CAAC,OAAe,MAAM;IAEnD,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAE9B,MAAM,UAAU,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,QAAQ,CAAC,MAAM,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IAE5F,OAAO,KAAK,EAAC,GAAG,EAAC,EAAE;QAElB,MAAM,KAAK,GAAG,CAAC,MAAM,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;QAExC,IAAK,KAAK,KAAK,SAAS,EAAG,CAAC;YAE3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,GAAG,CAAC,CAAC;QAE9C,CAAC;aAAM,CAAC;YAEP,OAAO,KAAK,CAAC;QAEd,CAAC;IAEF,CAAC,CAAC;AAEH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Vault } from "./index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates an environment vault.
|
|
4
|
+
*
|
|
5
|
+
* Parameters are looked up among the environment variables of the process as each request is served, so that a
|
|
6
|
+
* variable defined after the vault was constructed is retrieved as well.
|
|
7
|
+
*
|
|
8
|
+
* Keys may be prefixed, so that parameters are namespaced within a shared environment: `prefix` is prepended as
|
|
9
|
+
* given, without a separator of its own.
|
|
10
|
+
*
|
|
11
|
+
* @param prefix The string to be prepended to the key of each parameter to be retrieved; defaults to the empty string,
|
|
12
|
+
* looking keys up as they are given
|
|
13
|
+
*
|
|
14
|
+
* @returns A {@link Vault} retrieving parameters from the environment variables of the process
|
|
15
|
+
*
|
|
16
|
+
* @throws {@link !Error Error} While retrieving a parameter, if no variable is defined under its key
|
|
17
|
+
*
|
|
18
|
+
* @see {@link https://nodejs.org/api/process.html#processenv Node.js `process.env`}
|
|
19
|
+
*
|
|
20
|
+
* @group Implementations
|
|
21
|
+
*/
|
|
22
|
+
export declare function createEnvVault(prefix?: string): Vault;
|
|
23
|
+
//# sourceMappingURL=env.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.ts","sourceRoot":"","sources":["../../src/vault/env.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAGxC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,cAAc,CAAC,MAAM,GAAE,MAAW,GAAG,KAAK,CAkBzD"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Creates an environment vault.
|
|
18
|
+
*
|
|
19
|
+
* Parameters are looked up among the environment variables of the process as each request is served, so that a
|
|
20
|
+
* variable defined after the vault was constructed is retrieved as well.
|
|
21
|
+
*
|
|
22
|
+
* Keys may be prefixed, so that parameters are namespaced within a shared environment: `prefix` is prepended as
|
|
23
|
+
* given, without a separator of its own.
|
|
24
|
+
*
|
|
25
|
+
* @param prefix The string to be prepended to the key of each parameter to be retrieved; defaults to the empty string,
|
|
26
|
+
* looking keys up as they are given
|
|
27
|
+
*
|
|
28
|
+
* @returns A {@link Vault} retrieving parameters from the environment variables of the process
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link !Error Error} While retrieving a parameter, if no variable is defined under its key
|
|
31
|
+
*
|
|
32
|
+
* @see {@link https://nodejs.org/api/process.html#processenv Node.js `process.env`}
|
|
33
|
+
*
|
|
34
|
+
* @group Implementations
|
|
35
|
+
*/
|
|
36
|
+
export function createEnvVault(prefix = "") {
|
|
37
|
+
return key => {
|
|
38
|
+
const value = process.env[`${prefix}${key}`];
|
|
39
|
+
if (value === undefined) {
|
|
40
|
+
throw new Error(`undefined secret <${key}>`);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return value;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=env.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.js","sourceRoot":"","sources":["../../src/vault/env.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,cAAc,CAAC,SAAiB,EAAE;IAEjD,OAAO,GAAG,CAAC,EAAE;QAEZ,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,MAAM,GAAG,GAAG,EAAE,CAAC,CAAC;QAE7C,IAAK,KAAK,KAAK,SAAS,EAAG,CAAC;YAE3B,MAAM,IAAI,KAAK,CAAC,qBAAqB,GAAG,GAAG,CAAC,CAAC;QAE9C,CAAC;aAAM,CAAC;YAEP,OAAO,KAAK,CAAC;QAEd,CAAC;IAEF,CAAC,CAAC;AAEH,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sensitive parameter lookup.
|
|
3
|
+
*
|
|
4
|
+
* Looks up credentials, API keys and other sensitive configuration parameters by name, so that they never appear in
|
|
5
|
+
* source code or in the configuration a job carries with it.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*
|
|
9
|
+
* @groupDescription Implementations
|
|
10
|
+
*
|
|
11
|
+
* Ready-made vaults to be {@link index.bind bound} to {@link createVault} in place of the default one.
|
|
12
|
+
*/
|
|
13
|
+
import { Awaitable } from "@grafctory/core/async";
|
|
14
|
+
/**
|
|
15
|
+
* Secret vault.
|
|
16
|
+
*
|
|
17
|
+
* Retrieves sensitive configuration parameters from safe storage.
|
|
18
|
+
*/
|
|
19
|
+
export type Vault = {
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves a sensitive configuration parameter.
|
|
22
|
+
*
|
|
23
|
+
* A parameter defined as empty yields an empty value.
|
|
24
|
+
*
|
|
25
|
+
* @param key The unique key identifying the parameter to be retrieved
|
|
26
|
+
*
|
|
27
|
+
* @returns The value of the parameter identified by `key`, possibly resolved asynchronously, as remote storage
|
|
28
|
+
* requires
|
|
29
|
+
*
|
|
30
|
+
* @throws {@link !Error Error} If no parameter is identified by `key`; vaults resolving lookups asynchronously
|
|
31
|
+
* report the failure as a rejected promise
|
|
32
|
+
*/
|
|
33
|
+
(key: string): Awaitable<string>;
|
|
34
|
+
};
|
|
35
|
+
/**
|
|
36
|
+
* Creates the default vault.
|
|
37
|
+
*
|
|
38
|
+
* @returns A vault retrieving parameters from the environment of the process, as {@link createEnvVault} defines
|
|
39
|
+
*/
|
|
40
|
+
export declare function createVault(): Vault;
|
|
41
|
+
export * from "./env.js";
|
|
42
|
+
export * from "./dot.js";
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/vault/index.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAIlD;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG;IAEnB;;;;;;;;;;;;OAYG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAA;CAEhC,CAAA;AAKD;;;;GAIG;AACH,wBAAgB,WAAW,IAAI,KAAK,CAInC;AAKD,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright © 2026 Metreeca srl
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { createEnvVault } from "./env.js";
|
|
17
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
18
|
+
/**
|
|
19
|
+
* Creates the default vault.
|
|
20
|
+
*
|
|
21
|
+
* @returns A vault retrieving parameters from the environment of the process, as {@link createEnvVault} defines
|
|
22
|
+
*/
|
|
23
|
+
export function createVault() {
|
|
24
|
+
return createEnvVault();
|
|
25
|
+
}
|
|
26
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
27
|
+
export * from "./env.js";
|
|
28
|
+
export * from "./dot.js";
|
|
29
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/vault/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAgBH,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AA4B1C,wHAAwH;AAExH;;;;GAIG;AACH,MAAM,UAAU,WAAW;IAE1B,OAAO,cAAc,EAAE,CAAC;AAEzB,CAAC;AAGD,wHAAwH;AAExH,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@grafctory/gear",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.6.1",
|
|
4
|
+
"description": "Job executor and shared services for @grafctory/gear.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"typescript",
|
|
7
|
+
"pipeline",
|
|
8
|
+
"etl",
|
|
9
|
+
"extraction"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://grafctory.github.io/gear/",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/grafctory/gear/issues",
|
|
14
|
+
"email": "info@metreeca.com"
|
|
15
|
+
},
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"author": {
|
|
18
|
+
"name": "Metreeca",
|
|
19
|
+
"email": "info@metreeca.com",
|
|
20
|
+
"url": "https://www.metreeca.com/"
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/grafctory/gear.git",
|
|
25
|
+
"directory": "packages/gear"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"@grafctory/source": "./src/index.ts",
|
|
32
|
+
"default": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./space": {
|
|
35
|
+
"@grafctory/source": "./src/space/index.ts",
|
|
36
|
+
"default": "./dist/space/index.js"
|
|
37
|
+
},
|
|
38
|
+
"./vault": {
|
|
39
|
+
"@grafctory/source": "./src/vault/index.ts",
|
|
40
|
+
"default": "./dist/vault/index.js"
|
|
41
|
+
},
|
|
42
|
+
"./cache": {
|
|
43
|
+
"@grafctory/source": "./src/cache/index.ts",
|
|
44
|
+
"default": "./dist/cache/index.js"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
"files": [
|
|
48
|
+
"README.md",
|
|
49
|
+
"LICENSE",
|
|
50
|
+
"dist"
|
|
51
|
+
],
|
|
52
|
+
"engines": {
|
|
53
|
+
"node": ">=22.22.0"
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"clean": "ush rm dist docs node_modules",
|
|
57
|
+
"build": "ush rm dist && tsc -p tsconfig.build.json",
|
|
58
|
+
"check": "npx vitest --typecheck run"
|
|
59
|
+
},
|
|
60
|
+
"dependencies": {
|
|
61
|
+
"@grafctory/core": "^0.14.0",
|
|
62
|
+
"@grafctory/tape": "^0.13.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"@types/node": "^25.9.3",
|
|
66
|
+
"typescript": "^6.0.3",
|
|
67
|
+
"vitest": "^4.0.13"
|
|
68
|
+
}
|
|
69
|
+
}
|