@uns-kit/core 2.0.20 → 2.0.22

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.
Files changed (80) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +130 -130
  3. package/dist/app-config.d.ts.map +1 -0
  4. package/dist/app-config.js.map +1 -0
  5. package/dist/base-path.js.map +1 -1
  6. package/dist/config/app-config.d.ts +140 -135
  7. package/dist/config/app-config.d.ts.map +1 -1
  8. package/dist/config/app-config.js.map +1 -1
  9. package/dist/config/project.config.extension.js.map +1 -1
  10. package/dist/config-file.js.map +1 -1
  11. package/dist/graphql/schema.js.map +1 -1
  12. package/dist/index.d.ts +7 -6
  13. package/dist/index.d.ts.map +1 -1
  14. package/dist/index.js +6 -5
  15. package/dist/index.js.map +1 -1
  16. package/dist/logger.d.ts +3 -2
  17. package/dist/logger.d.ts.map +1 -1
  18. package/dist/logger.js +80 -18
  19. package/dist/logger.js.map +1 -1
  20. package/dist/tools/auth/auth-client.js.map +1 -1
  21. package/dist/tools/auth/index.js.map +1 -1
  22. package/dist/tools/auth/secure-store.js.map +1 -1
  23. package/dist/tools/base-path.js.map +1 -1
  24. package/dist/tools/file-utils.js.map +1 -1
  25. package/dist/tools/generate-config-schema.js.map +1 -1
  26. package/dist/tools/generate-uns-dictionary.js +7 -7
  27. package/dist/tools/generate-uns-dictionary.js.map +1 -1
  28. package/dist/tools/generate-uns-measurements.js +7 -7
  29. package/dist/tools/generate-uns-measurements.js.map +1 -1
  30. package/dist/tools/generate-uns-reference.js +9 -9
  31. package/dist/tools/generate-uns-reference.js.map +1 -1
  32. package/dist/tools/pull-request.js.map +1 -1
  33. package/dist/tools/refresh-uns.js +50 -50
  34. package/dist/tools/refresh-uns.js.map +1 -1
  35. package/dist/tools/schema.js.map +1 -1
  36. package/dist/tools/sync-uns-schema.js +14 -14
  37. package/dist/tools/sync-uns-schema.js.map +1 -1
  38. package/dist/uns/handover-manager-event-emitter.js.map +1 -1
  39. package/dist/uns/handover-manager.js.map +1 -1
  40. package/dist/uns/process-config.js.map +1 -1
  41. package/dist/uns/process-name-service.js.map +1 -1
  42. package/dist/uns/status-monitor.js.map +1 -1
  43. package/dist/uns/uns-asset.js.map +1 -1
  44. package/dist/uns/uns-attributes.js.map +1 -1
  45. package/dist/uns/uns-dictionary-registry.js.map +1 -1
  46. package/dist/uns/uns-dictionary.generated.js.map +1 -1
  47. package/dist/uns/uns-event-emitter.js.map +1 -1
  48. package/dist/uns/uns-interfaces.js.map +1 -1
  49. package/dist/uns/uns-measurements.generated.js.map +1 -1
  50. package/dist/uns/uns-measurements.js.map +1 -1
  51. package/dist/uns/uns-object.js.map +1 -1
  52. package/dist/uns/uns-packet.js.map +1 -1
  53. package/dist/uns/uns-path.js.map +1 -1
  54. package/dist/uns/uns-proxy-process.js.map +1 -1
  55. package/dist/uns/uns-proxy.js.map +1 -1
  56. package/dist/uns/uns-tags.js.map +1 -1
  57. package/dist/uns/uns-topic-matcher.js.map +1 -1
  58. package/dist/uns/uns-topics.js.map +1 -1
  59. package/dist/uns-config/config-schema.js.map +1 -1
  60. package/dist/uns-config/host-placeholders.js.map +1 -1
  61. package/dist/uns-config/schema-tolls.js.map +1 -1
  62. package/dist/uns-config/schema-tools.js.map +1 -1
  63. package/dist/uns-config/secret-placeholders.js.map +1 -1
  64. package/dist/uns-config/secret-resolver.js.map +1 -1
  65. package/dist/uns-config/uns-core-schema.d.ts +3271 -3150
  66. package/dist/uns-config/uns-core-schema.d.ts.map +1 -1
  67. package/dist/uns-config/uns-core-schema.js +76 -71
  68. package/dist/uns-config/uns-core-schema.js.map +1 -1
  69. package/dist/uns-grpc/uns-gateway-cli.js.map +1 -1
  70. package/dist/uns-grpc/uns-gateway-server.js.map +1 -1
  71. package/dist/uns-grpc/uns-gateway.proto +104 -104
  72. package/dist/uns-mqtt/mqtt-interfaces.js.map +1 -1
  73. package/dist/uns-mqtt/mqtt-proxy.js.map +1 -1
  74. package/dist/uns-mqtt/mqtt-topic-builder.js.map +1 -1
  75. package/dist/uns-mqtt/mqtt-worker-init.js.map +1 -1
  76. package/dist/uns-mqtt/mqtt-worker.js.map +1 -1
  77. package/dist/uns-mqtt/throttled-queue.js.map +1 -1
  78. package/dist/uns-mqtt/uns-mqtt-proxy.js.map +1 -1
  79. package/dist/uns-mqtt/ws-proxy.js.map +1 -1
  80. package/package.json +9 -8
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 Aljoša Vister
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2023 Aljoša Vister
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,130 +1,130 @@
1
- # @uns-kit/core
2
-
3
- Core utilities and runtime building blocks for building Unified Namespace (UNS) realtime transformers. The package bundles the process lifecycle manager, MQTT integrations, gRPC gateway helpers, configuration tooling, and shared type definitions that power the UNS ecosystem.
4
-
5
- Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
6
-
7
- ## uns-kit in context
8
-
9
- uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so teams can focus on domain logic instead of boilerplate. This package is the foundation; the full toolkit includes:
10
-
11
- | Package | Description |
12
- | --- | --- |
13
- | [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
14
- | [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
15
- | [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
16
- | [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
17
- | [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
18
-
19
- ## Installation
20
-
21
- ```bash
22
- pnpm add @uns-kit/core
23
- # or
24
- npm install @uns-kit/core
25
- ```
26
-
27
- ## Key Features
28
-
29
- - **UnsProxyProcess** – plugin-ready runtime for managing UNS proxy instances and MQTT wiring.
30
- - **MQTT helpers** – resilient publishers, topic builders, throttled queues, and handover support.
31
- - **Configuration utilities** – Zod-powered config schema generation and secret resolution helpers.
32
- - **gRPC gateway helpers** – infrastructure to bridge Python workers into the UNS message fabric.
33
- - **GraphQL tooling** – utilities such as `refresh-uns` that rebuild UNS topic/tag unions from your environment.
34
-
35
- ## Usage
36
-
37
- Most projects start by creating an `UnsProxyProcess` and registering plugins:
38
-
39
- ```ts
40
- import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
41
-
42
- const process = new UnsProxyProcess("mqtt-broker.svc:1883", { processName: "my-rtt" });
43
- ```
44
-
45
- See the individual plugin packages (`@uns-kit/cron`, `@uns-kit/api`, `@uns-kit/temporal`) for examples on extending the process with runtime capabilities.
46
- For a list of topics published by core (and the API plugin), see `../../docs/uns-topics.md`.
47
-
48
- ### Refresh UNS topic/tag/attribute unions
49
-
50
- The package ships a CLI tool that regenerates strongly-typed UNS topics and tags based on the live GraphQL schema:
51
-
52
- ```bash
53
- pnpm run refresh-uns
54
- ```
55
-
56
- When configured via `uns-kit configure-codegen`, this script lives in your project `package.json` and writes into `src/uns/` (topics, tags, and attribute summaries for IntelliSense).
57
-
58
- ### Generate UNS dictionary (object types & attributes with descriptions)
59
-
60
- Use `packages/uns-core/src/tools/generate-uns-dictionary.ts` to turn a JSON dictionary into a TypeScript helper. No network or GraphQL calls are involved.
61
-
62
- ```bash
63
- pnpm tsx packages/uns-core/src/tools/generate-uns-dictionary.ts \
64
- --input uns-dictionary.json \ # base JSON
65
- --output src/uns/uns-dictionary.generated.ts \
66
- --lang sl # pick language code from descriptions
67
- ```
68
-
69
- - Reads the provided JSON and emits TypeScript constants, description maps, and helper getters for IntelliSense and metadata emission.
70
-
71
- To generate both dictionary and measurements in one step, use the wrapper:
72
-
73
- ```bash
74
- pnpm tsx packages/uns-core/src/tools/generate-uns-reference.ts \
75
- --dictionary uns-dictionary.json \
76
- --dictionary-output src/uns/uns-dictionary.generated.ts \
77
- --measurements uns-measurements.json \
78
- --measurements-output src/uns/uns-measurements.generated.ts \
79
- --lang sl
80
- ```
81
-
82
- ### Sync canonical UNS schema from the controller
83
-
84
- Use `sync-uns-schema` when you need to refresh the repo-maintained schema files from
85
- the controller’s REST export endpoints.
86
-
87
- ```bash
88
- pnpm run sync-uns-schema -- \
89
- --controller-url http://localhost:3200 \
90
- --token <bearer-token>
91
- ```
92
-
93
- - Uses `GET /api/schema/export/uns-dictionary?status=...` and `GET /api/schema/export/uns-measurements`.
94
- - Sends `Authorization: Bearer <token>`.
95
- - Preserves the full exported JSON document when updating:
96
- - `packages/uns-cli/templates/uns-dictionary/uns-dictionary.json`
97
- - `packages/uns-cli/templates/uns-measurements/uns-measurements.json`
98
- - Regenerates the local TS artifacts unless you pass `--skip-generate`.
99
- - Defaults dictionary sync to `--status active`.
100
- - Supports environment fallbacks: `UNS_CONTROLLER_URL`, `UNS_CONTROLLER_TOKEN`, `UNS_SCHEMA_STATUS`.
101
-
102
- Useful variants:
103
-
104
- ```bash
105
- pnpm run sync-uns-schema -- --dry-run
106
- pnpm run sync-uns-schema -- --dictionary-only
107
- pnpm run sync-uns-schema -- --measurements-only --skip-generate
108
- ```
109
-
110
- ### Infisical secret resolution in development
111
-
112
- - The resolver looks for `SecretResolverOptions.infisical.fetchSecret`, then `INFISICAL_TOKEN`/`INFISICAL_PERSONAL_TOKEN`, then `/run/secrets/infisical_token` (or `/var/lib/uns/secrets/infisical_token`).
113
- - If no fetcher/token is available, the resolver now logs a warning and returns the placeholder `default`, or `undefined` when `optional: true`; required secrets still trigger `onMissingSecret` before throwing.
114
- - If Infisical is configured but the host is unreachable (e.g., DNS/network failure), the resolver warns and falls back to the same `default`/`optional` handling, reusing a cached value when present; required secrets throw with the original error message.
115
- - To inspect what would be used, call `resolveInfisicalConfig()` to get `{ token, projectId, siteUrl }` via the same lookup rules.
116
- - Use this to run locally without Infisical: mark dev-only secrets as `optional` or give `default` values, and provide real tokens only in production.
117
-
118
- ## Development
119
-
120
- ```bash
121
- # Lint and type-check the sources
122
- pnpm run typecheck
123
-
124
- # Emit JavaScript and declaration files to dist/
125
- pnpm run build
126
- ```
127
-
128
- ## License
129
-
130
- MIT © Aljoša Vister
1
+ # @uns-kit/core
2
+
3
+ Core utilities and runtime building blocks for building Unified Namespace (UNS) realtime transformers. The package bundles the process lifecycle manager, MQTT integrations, gRPC gateway helpers, configuration tooling, and shared type definitions that power the UNS ecosystem.
4
+
5
+ Note: Apps built with uns-kit are intended to be managed by the **UNS Datahub controller**.
6
+
7
+ ## uns-kit in context
8
+
9
+ uns-kit is a batteries-included toolkit for Unified Namespace applications. It standardizes MQTT wiring, auth, config schemas, and scaffolding so teams can focus on domain logic instead of boilerplate. This package is the foundation; the full toolkit includes:
10
+
11
+ | Package | Description |
12
+ | --- | --- |
13
+ | [`@uns-kit/core`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-core) | Base runtime utilities (UnsProxyProcess, MQTT helpers, configuration tooling, gRPC gateway support). |
14
+ | [`@uns-kit/api`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-api) | Express plugin that exposes HTTP endpoints, handles JWT/JWKS auth, and republishes API metadata to UNS. |
15
+ | [`@uns-kit/cron`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cron) | Cron-driven scheduler that emits UNS events on a fixed cadence. |
16
+ | [`@uns-kit/temporal`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-temporal) | Temporal.io integration that wires workflows into UnsProxyProcess. |
17
+ | [`@uns-kit/cli`](https://github.com/uns-datahub/uns-kit/tree/main/packages/uns-cli) | Command line tool for scaffolding new UNS applications. |
18
+
19
+ ## Installation
20
+
21
+ ```bash
22
+ pnpm add @uns-kit/core
23
+ # or
24
+ npm install @uns-kit/core
25
+ ```
26
+
27
+ ## Key Features
28
+
29
+ - **UnsProxyProcess** – plugin-ready runtime for managing UNS proxy instances and MQTT wiring.
30
+ - **MQTT helpers** – resilient publishers, topic builders, throttled queues, and handover support.
31
+ - **Configuration utilities** – Zod-powered config schema generation and secret resolution helpers.
32
+ - **gRPC gateway helpers** – infrastructure to bridge Python workers into the UNS message fabric.
33
+ - **GraphQL tooling** – utilities such as `refresh-uns` that rebuild UNS topic/tag unions from your environment.
34
+
35
+ ## Usage
36
+
37
+ Most projects start by creating an `UnsProxyProcess` and registering plugins:
38
+
39
+ ```ts
40
+ import UnsProxyProcess from "@uns-kit/core/uns/uns-proxy-process";
41
+
42
+ const process = new UnsProxyProcess("mqtt-broker.svc:1883", { processName: "my-rtt" });
43
+ ```
44
+
45
+ See the individual plugin packages (`@uns-kit/cron`, `@uns-kit/api`, `@uns-kit/temporal`) for examples on extending the process with runtime capabilities.
46
+ For a list of topics published by core (and the API plugin), see `../../docs/uns-topics.md`.
47
+
48
+ ### Refresh UNS topic/tag/attribute unions
49
+
50
+ The package ships a CLI tool that regenerates strongly-typed UNS topics and tags based on the live GraphQL schema:
51
+
52
+ ```bash
53
+ pnpm run refresh-uns
54
+ ```
55
+
56
+ When configured via `uns-kit configure-codegen`, this script lives in your project `package.json` and writes into `src/uns/` (topics, tags, and attribute summaries for IntelliSense).
57
+
58
+ ### Generate UNS dictionary (object types & attributes with descriptions)
59
+
60
+ Use `packages/uns-core/src/tools/generate-uns-dictionary.ts` to turn a JSON dictionary into a TypeScript helper. No network or GraphQL calls are involved.
61
+
62
+ ```bash
63
+ pnpm tsx packages/uns-core/src/tools/generate-uns-dictionary.ts \
64
+ --input uns-dictionary.json \ # base JSON
65
+ --output src/uns/uns-dictionary.generated.ts \
66
+ --lang sl # pick language code from descriptions
67
+ ```
68
+
69
+ - Reads the provided JSON and emits TypeScript constants, description maps, and helper getters for IntelliSense and metadata emission.
70
+
71
+ To generate both dictionary and measurements in one step, use the wrapper:
72
+
73
+ ```bash
74
+ pnpm tsx packages/uns-core/src/tools/generate-uns-reference.ts \
75
+ --dictionary uns-dictionary.json \
76
+ --dictionary-output src/uns/uns-dictionary.generated.ts \
77
+ --measurements uns-measurements.json \
78
+ --measurements-output src/uns/uns-measurements.generated.ts \
79
+ --lang sl
80
+ ```
81
+
82
+ ### Sync canonical UNS schema from the controller
83
+
84
+ Use `sync-uns-schema` when you need to refresh the repo-maintained schema files from
85
+ the controller’s REST export endpoints.
86
+
87
+ ```bash
88
+ pnpm run sync-uns-schema -- \
89
+ --controller-url http://localhost:3200 \
90
+ --token <bearer-token>
91
+ ```
92
+
93
+ - Uses `GET /api/schema/export/uns-dictionary?status=...` and `GET /api/schema/export/uns-measurements`.
94
+ - Sends `Authorization: Bearer <token>`.
95
+ - Preserves the full exported JSON document when updating:
96
+ - `packages/uns-cli/templates/uns-dictionary/uns-dictionary.json`
97
+ - `packages/uns-cli/templates/uns-measurements/uns-measurements.json`
98
+ - Regenerates the local TS artifacts unless you pass `--skip-generate`.
99
+ - Defaults dictionary sync to `--status active`.
100
+ - Supports environment fallbacks: `UNS_CONTROLLER_URL`, `UNS_CONTROLLER_TOKEN`, `UNS_SCHEMA_STATUS`.
101
+
102
+ Useful variants:
103
+
104
+ ```bash
105
+ pnpm run sync-uns-schema -- --dry-run
106
+ pnpm run sync-uns-schema -- --dictionary-only
107
+ pnpm run sync-uns-schema -- --measurements-only --skip-generate
108
+ ```
109
+
110
+ ### Infisical secret resolution in development
111
+
112
+ - The resolver looks for `SecretResolverOptions.infisical.fetchSecret`, then `INFISICAL_TOKEN`/`INFISICAL_PERSONAL_TOKEN`, then `/run/secrets/infisical_token` (or `/var/lib/uns/secrets/infisical_token`).
113
+ - If no fetcher/token is available, the resolver now logs a warning and returns the placeholder `default`, or `undefined` when `optional: true`; required secrets still trigger `onMissingSecret` before throwing.
114
+ - If Infisical is configured but the host is unreachable (e.g., DNS/network failure), the resolver warns and falls back to the same `default`/`optional` handling, reusing a cached value when present; required secrets throw with the original error message.
115
+ - To inspect what would be used, call `resolveInfisicalConfig()` to get `{ token, projectId, siteUrl }` via the same lookup rules.
116
+ - Use this to run locally without Infisical: mark dev-only secrets as `optional` or give `default` values, and provide real tokens only in production.
117
+
118
+ ## Development
119
+
120
+ ```bash
121
+ # Lint and type-check the sources
122
+ pnpm run typecheck
123
+
124
+ # Emit JavaScript and declaration files to dist/
125
+ pnpm run build
126
+ ```
127
+
128
+ ## License
129
+
130
+ MIT © Aljoša Vister
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config.d.ts","sourceRoot":"","sources":["../src/app-config.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,SAAS,GAAG;IACpB,GAAG,EAAE;QACD,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,CAAC;QACb,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,CAAC;QAC7C,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACtC,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QACrC,GAAG,CAAC,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;KAC7C,CAAC;IACF,KAAK,CAAC,EAAE;QACJ,IAAI,EAAE,MAAM,GAAG,CAAC;YACZ,2CAA2C;YAC3C,QAAQ,EAAE,QAAQ,CAAC;YACnB,uDAAuD;YACvD,KAAK,EAAE,MAAM,CAAC;SACjB,GAAG;YACA,iDAAiD;YACjD,QAAQ,EAAE,UAAU,CAAC;YACrB,wEAAwE;YACxE,GAAG,EAAE,MAAM,CAAC;YACZ,gFAAgF;YAChF,QAAQ,CAAC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0EAA0E;YAC1E,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;YAC/B,wEAAwE;YACxE,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;SAChC,GAAG;YACA,sCAAsC;YACtC,QAAQ,EAAE,WAAW,CAAC;YACtB,6DAA6D;YAC7D,IAAI,EAAE,MAAM,CAAC;YACb,6CAA6C;YAC7C,GAAG,EAAE,MAAM,CAAC;YACZ,wEAAwE;YACxE,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;YAC/B,4EAA4E;YAC5E,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;YACjC,wEAAwE;YACxE,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;YAC/B,oFAAoF;YACpF,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;SAChC,CAAC,CAAC,GAAG,SAAS,CAAC;QAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KACjC,CAAC;IACF,MAAM,CAAC,EAAE;QACL,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAC9B,YAAY,EAAE,MAAM,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;KAChC,GAAG,SAAS,CAAC;CACjB,CAAA"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-config.js","sourceRoot":"","sources":["../src/app-config.ts"],"names":[],"mappings":"","sourcesContent":["/* Auto-generated. Do not edit by hand. */\r\nexport type AppConfig = {\r\n uns: {\r\n graphql: string;\r\n rest: string;\r\n instanceMode?: \"wait\" | \"force\" | \"handover\";\r\n processName?: string | undefined;\r\n handover?: boolean;\r\n jwksWellKnownUrl?: string | undefined;\r\n kidWellKnownUrl?: string | undefined;\r\n env?: \"dev\" | \"staging\" | \"test\" | \"prod\";\r\n };\r\n input?: {\r\n host: string | ({\r\n /** Use the supplied host or IP address. */\r\n provider: \"inline\";\r\n /** Host or IP address that should be used directly. */\r\n value: string;\r\n } | {\r\n /** Resolve the host from an external mapping. */\r\n provider: \"external\";\r\n /** Identifier used when resolving the host from HostResolverOptions. */\r\n key: string;\r\n /** Allow the external host to be missing without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback host when optional is true and the external entry is missing. */\r\n default?: string | undefined;\r\n } | {\r\n /** Resolve the host from local network interfaces. */\r\n provider: \"system\";\r\n /** Address family to return when scanning interfaces. */\r\n family?: \"IPv4\" | \"IPv6\";\r\n /** Specific interface to read (falls back to the first match when omitted). */\r\n interfaceName?: string | undefined;\r\n /** Allow the interface lookup to fail without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback host/IP when optional is true and no interface matches. */\r\n default?: string | undefined;\r\n });\r\n username?: string | undefined;\r\n password?: (string | ({\r\n /** Load the secret from an environment variable. */\r\n provider: \"env\";\r\n /** Name of the environment variable to read. */\r\n key: string;\r\n /** Allow the variable to be absent without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback value when optional is true and the variable is missing. */\r\n default?: string | undefined;\r\n } | {\r\n /** Load the secret from Infisical. */\r\n provider: \"infisical\";\r\n /** Secret folder path in Infisical, e.g. '/app/database'. */\r\n path: string;\r\n /** Secret key/name inside the given path. */\r\n key: string;\r\n /** Allow the secret to be absent without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Infisical environment override (defaults to current mode if omitted). */\r\n environment?: string | undefined;\r\n /** Optional Infisical project identifier when not using the default. */\r\n projectId?: string | undefined;\r\n /** Fallback value when the secret is missing and optional resolution is allowed. */\r\n default?: string | undefined;\r\n })) | undefined;\r\n clientId?: string | undefined;\r\n } | undefined;\r\n output?: {\r\n host: string | ({\r\n /** Use the supplied host or IP address. */\r\n provider: \"inline\";\r\n /** Host or IP address that should be used directly. */\r\n value: string;\r\n } | {\r\n /** Resolve the host from an external mapping. */\r\n provider: \"external\";\r\n /** Identifier used when resolving the host from HostResolverOptions. */\r\n key: string;\r\n /** Allow the external host to be missing without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback host when optional is true and the external entry is missing. */\r\n default?: string | undefined;\r\n } | {\r\n /** Resolve the host from local network interfaces. */\r\n provider: \"system\";\r\n /** Address family to return when scanning interfaces. */\r\n family?: \"IPv4\" | \"IPv6\";\r\n /** Specific interface to read (falls back to the first match when omitted). */\r\n interfaceName?: string | undefined;\r\n /** Allow the interface lookup to fail without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback host/IP when optional is true and no interface matches. */\r\n default?: string | undefined;\r\n });\r\n username?: string | undefined;\r\n password?: (string | ({\r\n /** Load the secret from an environment variable. */\r\n provider: \"env\";\r\n /** Name of the environment variable to read. */\r\n key: string;\r\n /** Allow the variable to be absent without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback value when optional is true and the variable is missing. */\r\n default?: string | undefined;\r\n } | {\r\n /** Load the secret from Infisical. */\r\n provider: \"infisical\";\r\n /** Secret folder path in Infisical, e.g. '/app/database'. */\r\n path: string;\r\n /** Secret key/name inside the given path. */\r\n key: string;\r\n /** Allow the secret to be absent without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Infisical environment override (defaults to current mode if omitted). */\r\n environment?: string | undefined;\r\n /** Optional Infisical project identifier when not using the default. */\r\n projectId?: string | undefined;\r\n /** Fallback value when the secret is missing and optional resolution is allowed. */\r\n default?: string | undefined;\r\n })) | undefined;\r\n clientId?: string | undefined;\r\n } | undefined;\r\n infra: {\r\n host: string | ({\r\n /** Use the supplied host or IP address. */\r\n provider: \"inline\";\r\n /** Host or IP address that should be used directly. */\r\n value: string;\r\n } | {\r\n /** Resolve the host from an external mapping. */\r\n provider: \"external\";\r\n /** Identifier used when resolving the host from HostResolverOptions. */\r\n key: string;\r\n /** Allow the external host to be missing without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback host when optional is true and the external entry is missing. */\r\n default?: string | undefined;\r\n } | {\r\n /** Resolve the host from local network interfaces. */\r\n provider: \"system\";\r\n /** Address family to return when scanning interfaces. */\r\n family?: \"IPv4\" | \"IPv6\";\r\n /** Specific interface to read (falls back to the first match when omitted). */\r\n interfaceName?: string | undefined;\r\n /** Allow the interface lookup to fail without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback host/IP when optional is true and no interface matches. */\r\n default?: string | undefined;\r\n });\r\n username?: string | undefined;\r\n password?: (string | ({\r\n /** Load the secret from an environment variable. */\r\n provider: \"env\";\r\n /** Name of the environment variable to read. */\r\n key: string;\r\n /** Allow the variable to be absent without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Fallback value when optional is true and the variable is missing. */\r\n default?: string | undefined;\r\n } | {\r\n /** Load the secret from Infisical. */\r\n provider: \"infisical\";\r\n /** Secret folder path in Infisical, e.g. '/app/database'. */\r\n path: string;\r\n /** Secret key/name inside the given path. */\r\n key: string;\r\n /** Allow the secret to be absent without throwing during resolution. */\r\n optional?: boolean | undefined;\r\n /** Infisical environment override (defaults to current mode if omitted). */\r\n environment?: string | undefined;\r\n /** Optional Infisical project identifier when not using the default. */\r\n projectId?: string | undefined;\r\n /** Fallback value when the secret is missing and optional resolution is allowed. */\r\n default?: string | undefined;\r\n })) | undefined;\r\n clientId?: string | undefined;\r\n };\r\n devops?: {\r\n provider?: string | undefined;\r\n organization: string;\r\n project?: string | undefined;\r\n } | undefined;\r\n}\r\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"base-path.js","sourceRoot":"","sources":["../src/base-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,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;AAQF,MAAM,UAAU,eAAe,CAAC,UAAkC,EAAE;IAClE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,SAAS,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC;IAErG,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,WAAW,IAAI,SAAS,EAAE,GAAG,EAAE,eAAe,CAAC,CAAC;IAE3E,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;QACnC,MAAM,QAAQ,GAAG,gBAAgB,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC","sourcesContent":["import { fileURLToPath } from \"url\";\nimport { dirname, resolve, join } from \"path\";\nimport { existsSync } from \"fs\";\nimport { packageDirectorySync } from \"pkg-dir\";\n\nconst moduleDirectory = dirname(fileURLToPath(import.meta.url));\n\nconst packageDirectorySyncAny = packageDirectorySync as unknown as ((arg?: unknown) => string | undefined) | undefined;\n\nconst fallbackFind = (start: string): string | undefined => {\n let current = resolve(start);\n\n while (true) {\n if (existsSync(join(current, \"package.json\"))) {\n return current;\n }\n\n const parent = dirname(current);\n if (parent === current) {\n return undefined;\n }\n\n current = parent;\n }\n};\n\nconst resolveCandidate = (candidate?: string): string | undefined => {\n if (!candidate) return undefined;\n\n const directory = resolve(candidate);\n\n if (typeof packageDirectorySyncAny === \"function\") {\n try {\n const result = packageDirectorySyncAny({ cwd: directory });\n if (typeof result === \"string\") {\n return result;\n }\n } catch {\n // ignore – fall back to alternate invocation style\n }\n\n try {\n const result = packageDirectorySyncAny(directory);\n if (typeof result === \"string\") {\n return result;\n }\n } catch {\n // ignore – fall back to manual search\n }\n }\n\n return fallbackFind(directory) ?? directory;\n};\n\nexport interface ResolveBasePathOptions {\n start?: string;\n envBasePath?: string | null;\n cwd?: string;\n}\n\nexport function resolveBasePath(options: ResolveBasePathOptions = {}): string {\n const { start, envBasePath = process.env.UNS_BASE_PATH ?? undefined, cwd = process.cwd() } = options;\n\n const candidates = [start, envBasePath ?? undefined, cwd, moduleDirectory];\n\n for (const candidate of candidates) {\n const resolved = resolveCandidate(candidate);\n if (resolved) {\n return resolved;\n }\n }\n\n return resolve(moduleDirectory, \"..\");\n}\n\nexport const basePath = resolveBasePath();\n"]}
1
+ {"version":3,"file":"base-path.js","sourceRoot":"","sources":["../src/base-path.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,eAAe,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAEhE,MAAM,uBAAuB,GAAG,oBAAsF,CAAC;AAEvH,MAAM,YAAY,GAAG,CAAC,KAAa,EAAsB,EAAE;IACzD,IAAI,OAAO,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC;IAE7B,OAAO,IAAI,EAAE,CAAC;QACZ,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,EAAE,CAAC;YAC9C,OAAO,OAAO,CAAC;QACjB,CAAC;QAED,MAAM,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;QAChC,IAAI,MAAM,KAAK,OAAO,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QAED,OAAO,GAAG,MAAM,CAAC;IACnB,CAAC;AACH,CAA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ED,OAAO,OAAO,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG,eAAe,EAAE,CAAC","sourcesContent":["import { fileURLToPath } from \"url\";\r\nimport { dirname, resolve, join } from \"path\";\r\nimport { existsSync } from \"fs\";\r\nimport { packageDirectorySync } from \"pkg-dir\";\r\n\r\nconst moduleDirectory = dirname(fileURLToPath(import.meta.url));\r\n\r\nconst packageDirectorySyncAny = packageDirectorySync as unknown as ((arg?: unknown) => string | undefined) | undefined;\r\n\r\nconst fallbackFind = (start: string): string | undefined => {\r\n let current = resolve(start);\r\n\r\n while (true) {\r\n if (existsSync(join(current, \"package.json\"))) {\r\n return current;\r\n }\r\n\r\n const parent = dirname(current);\r\n if (parent === current) {\r\n return undefined;\r\n }\r\n\r\n current = parent;\r\n }\r\n};\r\n\r\nconst resolveCandidate = (candidate?: string): string | undefined => {\r\n if (!candidate) return undefined;\r\n\r\n const directory = resolve(candidate);\r\n\r\n if (typeof packageDirectorySyncAny === \"function\") {\r\n try {\r\n const result = packageDirectorySyncAny({ cwd: directory });\r\n if (typeof result === \"string\") {\r\n return result;\r\n }\r\n } catch {\r\n // ignore – fall back to alternate invocation style\r\n }\r\n\r\n try {\r\n const result = packageDirectorySyncAny(directory);\r\n if (typeof result === \"string\") {\r\n return result;\r\n }\r\n } catch {\r\n // ignore – fall back to manual search\r\n }\r\n }\r\n\r\n return fallbackFind(directory) ?? directory;\r\n};\r\n\r\nexport interface ResolveBasePathOptions {\r\n start?: string;\r\n envBasePath?: string | null;\r\n cwd?: string;\r\n}\r\n\r\nexport function resolveBasePath(options: ResolveBasePathOptions = {}): string {\r\n const { start, envBasePath = process.env.UNS_BASE_PATH ?? undefined, cwd = process.cwd() } = options;\r\n\r\n const candidates = [start, envBasePath ?? undefined, cwd, moduleDirectory];\r\n\r\n for (const candidate of candidates) {\r\n const resolved = resolveCandidate(candidate);\r\n if (resolved) {\r\n return resolved;\r\n }\r\n }\r\n\r\n return resolve(moduleDirectory, \"..\");\r\n}\r\n\r\nexport const basePath = resolveBasePath();\r\n"]}