@lorion-org/runtime-config-node 1.0.0-beta.1 → 1.0.0-beta.5

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 CHANGED
@@ -187,7 +187,7 @@ For adapters that resolve schema locations from scope directories, use
187
187
  `validateRuntimeConfigScopes(...)` to collect `validated` and `skipped`
188
188
  targets before the AJV validation runs.
189
189
 
190
- Runnable example files live in [`examples/`](./examples).
190
+ Runnable example files live in [`snippets/`](./snippets).
191
191
 
192
192
  ## Local commands
193
193
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lorion-org/runtime-config-node",
3
- "version": "1.0.0-beta.1",
3
+ "version": "1.0.0-beta.5",
4
4
  "description": "Node file-system helpers for runtime-config directories and files.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -38,7 +38,6 @@
38
38
  },
39
39
  "files": [
40
40
  "dist",
41
- "examples",
42
41
  "LICENSE",
43
42
  "src/**/*.ts",
44
43
  "!src/**/*.spec.ts"
@@ -54,7 +53,7 @@
54
53
  },
55
54
  "dependencies": {
56
55
  "ajv": "^8.17.1",
57
- "@lorion-org/runtime-config": "^1.0.0-beta.1"
56
+ "@lorion-org/runtime-config": "^1.0.0-beta.5"
58
57
  },
59
58
  "scripts": {
60
59
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -1,21 +0,0 @@
1
- import {
2
- loadRuntimeConfigShellAssignments,
3
- writeRuntimeConfigFragment,
4
- } from '@lorion-org/runtime-config-node';
5
-
6
- writeRuntimeConfigFragment('./var', 'checkout', {
7
- public: {
8
- successPath: '/orders/confirmed',
9
- },
10
- private: {
11
- signingSecret: 'checkout_signing_secret_demo',
12
- },
13
- });
14
-
15
- const assignments = loadRuntimeConfigShellAssignments('./var', {
16
- prefix: 'APP',
17
- });
18
-
19
- console.log(assignments);
20
- // APP_PUBLIC_CHECKOUT_SUCCESS_PATH='"/orders/confirmed"'
21
- // APP_PRIVATE_CHECKOUT_SIGNING_SECRET='"checkout_signing_secret_demo"'
@@ -1,17 +0,0 @@
1
- import { projectSectionedRuntimeConfig } from '@lorion-org/runtime-config';
2
- import { loadRuntimeConfigTree, writeRuntimeConfigFragment } from '@lorion-org/runtime-config-node';
3
-
4
- writeRuntimeConfigFragment('./var', 'checkout', {
5
- public: {
6
- successPath: '/orders/confirmed',
7
- },
8
- });
9
-
10
- const fragments = loadRuntimeConfigTree('./var');
11
- const runtimeConfig = projectSectionedRuntimeConfig(fragments);
12
-
13
- console.log(runtimeConfig.public);
14
- // { checkoutSuccessPath: '/orders/confirmed' }
15
-
16
- console.log(runtimeConfig.private);
17
- // {}
@@ -1,53 +0,0 @@
1
- import {
2
- getRuntimeConfigScopeView,
3
- getRuntimeConfigValue,
4
- listRuntimeConfigFragments,
5
- projectRuntimeConfigTree,
6
- writeRuntimeConfigFragment,
7
- } from '@lorion-org/runtime-config-node';
8
-
9
- writeRuntimeConfigFragment('./var', 'checkout', {
10
- public: {
11
- successPath: '/orders/confirmed',
12
- },
13
- private: {
14
- signingSecret: 'checkout_signing_secret_demo',
15
- },
16
- contexts: {
17
- 'eu-store': {
18
- public: {
19
- successPath: '/eu-store/orders/confirmed',
20
- },
21
- },
22
- },
23
- });
24
-
25
- const listResult = listRuntimeConfigFragments('./var');
26
- console.log(listResult.scopes);
27
- // [{ scopeId: 'checkout', publicKeys: ['successPath'], privateKeys: ['signingSecret'], contextIds: ['eu-store'], ... }]
28
-
29
- const projectResult = projectRuntimeConfigTree('./var', {
30
- contextOutputKey: '__stores',
31
- });
32
- console.log(projectResult.runtimeConfig.public);
33
- // {
34
- // checkoutSuccessPath: '/orders/confirmed',
35
- // __stores: {
36
- // 'eu-store': {
37
- // checkoutSuccessPath: '/eu-store/orders/confirmed',
38
- // },
39
- // },
40
- // }
41
-
42
- const valueResult = getRuntimeConfigValue('./var', 'checkout', 'successPath', {
43
- contextId: 'eu-store',
44
- contextOutputKey: '__stores',
45
- });
46
- console.log(valueResult.value);
47
- // /eu-store/orders/confirmed
48
-
49
- const scopeResult = getRuntimeConfigScopeView('./var', 'checkout', {
50
- visibility: 'private',
51
- });
52
- console.log(scopeResult.config);
53
- // { signingSecret: 'checkout_signing_secret_demo' }
@@ -1,24 +0,0 @@
1
- import {
2
- readRuntimeConfigScopeJson,
3
- resolveRuntimeConfigPublicFilePath,
4
- resolveRuntimeConfigSource,
5
- writeRuntimeConfigScopeJson,
6
- } from '@lorion-org/runtime-config-node';
7
-
8
- const source = resolveRuntimeConfigSource({
9
- defaultVarDir: './var',
10
- env: process.env,
11
- envKey: 'APP_VAR_DIR',
12
- });
13
-
14
- writeRuntimeConfigScopeJson(source, 'checkout', 'settings.json', {
15
- successPath: '/orders/confirmed',
16
- });
17
-
18
- const settings = readRuntimeConfigScopeJson(source, 'checkout', 'settings.json');
19
- console.log(settings);
20
- // { successPath: '/orders/confirmed' }
21
-
22
- const logoPath = resolveRuntimeConfigPublicFilePath(source, 'checkout/logo.svg');
23
- console.log(logoPath);
24
- // /absolute/project/path/var/runtime-config/public/checkout/logo.svg