@venizia/ardor-kernel 0.4.2 → 0.4.3
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.
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* The preset image writes it at container start, from the environment variables that start with `VITE_`.
|
|
4
4
|
*/
|
|
5
5
|
export declare const RUNTIME_CONFIG_GLOBAL = "__APP_CONFIG__";
|
|
6
|
+
/** The `normalized.code` of the error `getRuntimeConfig` throws for a required value that is not set; the key is in its `extra.key`. */
|
|
7
|
+
export declare const RUNTIME_CONFIG_REQUIRED_CODE = "ardor.runtime_config.required";
|
|
6
8
|
interface IRuntimeConfigOptions {
|
|
7
9
|
key: string;
|
|
8
10
|
buildTimeEnv?: Record<string, unknown>;
|
|
@@ -14,7 +16,9 @@ interface IRuntimeConfigOptions {
|
|
|
14
16
|
* string counts, and a missing global is not an error.
|
|
15
17
|
*
|
|
16
18
|
* With `required: true` the result is a `string`: when all three are absent it throws, naming the
|
|
17
|
-
* key and never a value.
|
|
19
|
+
* key and never a value. The error is an `ApplicationError` with `normalized.code` equal to
|
|
20
|
+
* `RUNTIME_CONFIG_REQUIRED_CODE` and the key in `extra.key`, so a caller tells it from another error
|
|
21
|
+
* without reading the message. Without `required`, the result is `string | undefined`.
|
|
18
22
|
*/
|
|
19
23
|
export declare const getRuntimeConfig: {
|
|
20
24
|
(opts: IRuntimeConfigOptions & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-config.d.ts","sourceRoot":"","sources":["../../src/utilities/runtime-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"runtime-config.d.ts","sourceRoot":"","sources":["../../src/utilities/runtime-config.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AAEtD,wIAAwI;AACxI,eAAO,MAAM,4BAA4B,kCAAkC,CAAC;AAmB5E,UAAU,qBAAqB;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,gBAAgB,EAAE;IAC7B,CAAC,IAAI,EAAE,qBAAqB,GAAG;QAAE,QAAQ,EAAE,IAAI,CAAA;KAAE,GAAG,MAAM,CAAC;IAC3D,CAAC,IAAI,EAAE,qBAAqB,GAAG;QAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,MAAM,GAAG,SAAS,CAAC;CAkB5E,CAAC"}
|
|
@@ -4,6 +4,8 @@ import { getError } from '@venizia/ignis-inversion';
|
|
|
4
4
|
* The preset image writes it at container start, from the environment variables that start with `VITE_`.
|
|
5
5
|
*/
|
|
6
6
|
export const RUNTIME_CONFIG_GLOBAL = '__APP_CONFIG__';
|
|
7
|
+
/** The `normalized.code` of the error `getRuntimeConfig` throws for a required value that is not set; the key is in its `extra.key`. */
|
|
8
|
+
export const RUNTIME_CONFIG_REQUIRED_CODE = 'ardor.runtime_config.required';
|
|
7
9
|
const readString = (opts) => {
|
|
8
10
|
const { source, key } = opts;
|
|
9
11
|
if (typeof source !== 'object' || source === null || Array.isArray(source)) {
|
|
@@ -22,7 +24,9 @@ const readString = (opts) => {
|
|
|
22
24
|
* string counts, and a missing global is not an error.
|
|
23
25
|
*
|
|
24
26
|
* With `required: true` the result is a `string`: when all three are absent it throws, naming the
|
|
25
|
-
* key and never a value.
|
|
27
|
+
* key and never a value. The error is an `ApplicationError` with `normalized.code` equal to
|
|
28
|
+
* `RUNTIME_CONFIG_REQUIRED_CODE` and the key in `extra.key`, so a caller tells it from another error
|
|
29
|
+
* without reading the message. Without `required`, the result is `string | undefined`.
|
|
26
30
|
*/
|
|
27
31
|
export const getRuntimeConfig = (opts) => {
|
|
28
32
|
const { key, buildTimeEnv, defaultValue, required } = opts;
|
|
@@ -31,6 +35,8 @@ export const getRuntimeConfig = (opts) => {
|
|
|
31
35
|
defaultValue;
|
|
32
36
|
if (required && value === undefined) {
|
|
33
37
|
throw getError({
|
|
38
|
+
messageCode: RUNTIME_CONFIG_REQUIRED_CODE,
|
|
39
|
+
extra: { key },
|
|
34
40
|
message: `[getRuntimeConfig] '${key}' is required and not set | Write it to config.js (a VITE_ variable of the container, listed in APP_REQUIRED_ENV), or pass it in buildTimeEnv or defaultValue`,
|
|
35
41
|
});
|
|
36
42
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime-config.js","sourceRoot":"","sources":["../../src/utilities/runtime-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AAEpD;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,gBAAgB,CAAC;AAEtD,MAAM,UAAU,GAAG,CAAC,IAAsC,EAAsB,EAAE;IAChF,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IAE7B,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC3E,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,qEAAqE;IACrE,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,CAAC;QACvD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,KAAK,GAAY,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEhD,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AACvE,CAAC,CAAC;AAQF
|
|
1
|
+
{"version":3,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AG,EAAE,CAAC;QACzC,YAAY,CAAC;IAEf,IAAI,QAAQ,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACpC,MAAM,QAAQ,CAAC;YACb,WAAW,EAAE,4BAA4B;YACzC,KAAK,EAAE,EAAE,GAAG,EAAE;YACd,OAAO,EAAE,uBAAuB,GAAG,+JAA+J;SACnM,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAe,CAAC;AACzB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ardor-kernel",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "ARDOR kernel - the isomorphic core of the ARDOR frontend framework: application base on IGNIS inversion, service and CRUD bases, request/auth constants, binding keys, logger, network fetchers and socket client. No React and no react-admin.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ardor",
|
|
@@ -68,12 +68,12 @@
|
|
|
68
68
|
"devDependencies": {
|
|
69
69
|
"@size-limit/preset-small-lib": "^14.2.0",
|
|
70
70
|
"@types/bun": "^1.4.3",
|
|
71
|
-
"@venizia/dev-configs": "^0.4.
|
|
72
|
-
"@venizia/ignis-connectors": "^0.4.
|
|
73
|
-
"@venizia/ignis-filter": "^0.4.
|
|
74
|
-
"@venizia/ignis-helpers": "^0.4.
|
|
75
|
-
"@venizia/ignis-inversion": "^0.4.
|
|
76
|
-
"@venizia/ignis-kernel": "^0.4.
|
|
71
|
+
"@venizia/dev-configs": "^0.4.3",
|
|
72
|
+
"@venizia/ignis-connectors": "^0.4.3",
|
|
73
|
+
"@venizia/ignis-filter": "^0.4.3",
|
|
74
|
+
"@venizia/ignis-helpers": "^0.4.3",
|
|
75
|
+
"@venizia/ignis-inversion": "^0.4.3",
|
|
76
|
+
"@venizia/ignis-kernel": "^0.4.3",
|
|
77
77
|
"eslint": "^10.13.0",
|
|
78
78
|
"oxlint": "1.89.0",
|
|
79
79
|
"oxlint-tsgolint": "7.0.2004",
|