@digital-alchemy/core 26.2.17 → 26.5.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/CLAUDE.md +302 -0
- package/README.md +19 -3
- package/dist/helpers/async.d.mts +37 -0
- package/dist/helpers/async.mjs +50 -15
- package/dist/helpers/async.mjs.map +1 -1
- package/dist/helpers/config-environment-loader.d.mts +39 -0
- package/dist/helpers/config-environment-loader.mjs +51 -11
- package/dist/helpers/config-environment-loader.mjs.map +1 -1
- package/dist/helpers/config-file-loader.d.mts +65 -0
- package/dist/helpers/config-file-loader.mjs +80 -4
- package/dist/helpers/config-file-loader.mjs.map +1 -1
- package/dist/helpers/config.d.mts +202 -5
- package/dist/helpers/config.mjs +60 -0
- package/dist/helpers/config.mjs.map +1 -1
- package/dist/helpers/context.d.mts +12 -1
- package/dist/helpers/cron.d.mts +154 -7
- package/dist/helpers/cron.mjs +47 -4
- package/dist/helpers/cron.mjs.map +1 -1
- package/dist/helpers/errors.d.mts +45 -0
- package/dist/helpers/errors.mjs +45 -0
- package/dist/helpers/errors.mjs.map +1 -1
- package/dist/helpers/events.d.mts +23 -0
- package/dist/helpers/events.mjs +23 -0
- package/dist/helpers/events.mjs.map +1 -1
- package/dist/helpers/extend.d.mts +50 -0
- package/dist/helpers/extend.mjs +63 -0
- package/dist/helpers/extend.mjs.map +1 -1
- package/dist/helpers/index.d.mts +9 -0
- package/dist/helpers/index.mjs +9 -0
- package/dist/helpers/index.mjs.map +1 -1
- package/dist/helpers/lifecycle.d.mts +102 -16
- package/dist/helpers/lifecycle.mjs +19 -1
- package/dist/helpers/lifecycle.mjs.map +1 -1
- package/dist/helpers/logger.d.mts +178 -17
- package/dist/helpers/logger.mjs +41 -1
- package/dist/helpers/logger.mjs.map +1 -1
- package/dist/helpers/module.d.mts +110 -0
- package/dist/helpers/module.mjs +55 -6
- package/dist/helpers/module.mjs.map +1 -1
- package/dist/helpers/service-runner.d.mts +27 -1
- package/dist/helpers/service-runner.mjs +27 -1
- package/dist/helpers/service-runner.mjs.map +1 -1
- package/dist/helpers/utilities.d.mts +123 -3
- package/dist/helpers/utilities.mjs +110 -3
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/wiring.d.mts +385 -0
- package/dist/helpers/wiring.mjs +120 -0
- package/dist/helpers/wiring.mjs.map +1 -1
- package/dist/services/als.service.d.mts +10 -0
- package/dist/services/als.service.mjs +49 -0
- package/dist/services/als.service.mjs.map +1 -1
- package/dist/services/configuration.service.d.mts +22 -0
- package/dist/services/configuration.service.mjs +140 -12
- package/dist/services/configuration.service.mjs.map +1 -1
- package/dist/services/index.d.mts +8 -0
- package/dist/services/index.mjs +8 -0
- package/dist/services/index.mjs.map +1 -1
- package/dist/services/internal.service.d.mts +98 -19
- package/dist/services/internal.service.mjs +91 -9
- package/dist/services/internal.service.mjs.map +1 -1
- package/dist/services/is.service.d.mts +64 -4
- package/dist/services/is.service.mjs +67 -4
- package/dist/services/is.service.mjs.map +1 -1
- package/dist/services/lifecycle.service.d.mts +26 -0
- package/dist/services/lifecycle.service.mjs +67 -9
- package/dist/services/lifecycle.service.mjs.map +1 -1
- package/dist/services/logger.service.d.mts +27 -0
- package/dist/services/logger.service.mjs +133 -9
- package/dist/services/logger.service.mjs.map +1 -1
- package/dist/services/scheduler.service.d.mts +19 -0
- package/dist/services/scheduler.service.mjs +87 -4
- package/dist/services/scheduler.service.mjs.map +1 -1
- package/dist/services/wiring.service.d.mts +28 -0
- package/dist/services/wiring.service.mjs +152 -19
- package/dist/services/wiring.service.mjs.map +1 -1
- package/dist/testing/index.d.mts +4 -0
- package/dist/testing/index.mjs +4 -0
- package/dist/testing/index.mjs.map +1 -1
- package/dist/testing/mock-logger.d.mts +8 -0
- package/dist/testing/mock-logger.mjs +9 -0
- package/dist/testing/mock-logger.mjs.map +1 -1
- package/dist/testing/test-module.d.mts +107 -27
- package/dist/testing/test-module.mjs +58 -1
- package/dist/testing/test-module.mjs.map +1 -1
- package/package.json +33 -31
package/dist/helpers/wiring.mjs
CHANGED
|
@@ -1,9 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file helpers/wiring.mts — types and pure functions for the DI wiring engine.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This file is the **type backbone** of `@digital-alchemy/core`. It owns
|
|
6
|
+
* `TServiceParams`, `CreateLibrary`, `buildSortOrder`, `wireOrder`, and the
|
|
7
|
+
* two wiring-boundary symbols (`COERCE_CONTEXT`, `WIRE_PROJECT`). Every
|
|
8
|
+
* downstream `@digital-alchemy` library depends on these types.
|
|
9
|
+
*
|
|
10
|
+
* **Split rationale.** This file was deliberately separated from
|
|
11
|
+
* `services/wiring.service.mts` to break a circular module reference that
|
|
12
|
+
* would form if types and the runtime bootstrap logic lived together. Do not
|
|
13
|
+
* merge them. Runtime orchestration (`CreateApplication`, `bootstrap`,
|
|
14
|
+
* `wireService`, `teardown`) lives in `services/wiring.service.mts`; pure
|
|
15
|
+
* types and pure functions live here.
|
|
16
|
+
*
|
|
17
|
+
* **Downstream impact.** Changes to `TServiceParams` shape or to any exported
|
|
18
|
+
* type here ripple into every library. Treat all public exports as breaking
|
|
19
|
+
* surface.
|
|
20
|
+
*/
|
|
1
21
|
import { is, LOAD_PROJECT } from "../index.mjs";
|
|
2
22
|
import { eachSeries } from "./async.mjs";
|
|
3
23
|
import { BootstrapException } from "./errors.mjs";
|
|
24
|
+
// --- Wiring boundary symbols --------------------------------------------------
|
|
25
|
+
/**
|
|
26
|
+
* Symbol used as the key for the `[WIRE_PROJECT]` method on library and
|
|
27
|
+
* application definitions.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This symbol is the wiring boundary between a module definition and the
|
|
31
|
+
* bootstrap engine. `wiring.service.mts` calls `[WIRE_PROJECT]` on each
|
|
32
|
+
* module to initialise its lifecycle, load its configuration, and wire each
|
|
33
|
+
* service in priority order. Do not call `[WIRE_PROJECT]` outside of the
|
|
34
|
+
* bootstrap process.
|
|
35
|
+
*
|
|
36
|
+
* @internal
|
|
37
|
+
*/
|
|
4
38
|
export const WIRE_PROJECT = Symbol.for("wire-project");
|
|
5
39
|
// #MARK: buildSortOrder
|
|
40
|
+
/**
|
|
41
|
+
* Topologically sort the libraries declared by an application so that each
|
|
42
|
+
* library's dependencies are wired before it.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Uses a simple iterative approach: on each pass, pick the first library whose
|
|
46
|
+
* required dependencies have all already been placed in `out`, then remove it
|
|
47
|
+
* from the working set. Optional dependencies that are not present in the
|
|
48
|
+
* application's library list are skipped rather than causing a failure.
|
|
49
|
+
*
|
|
50
|
+
* Version mismatches (same name, different object reference) emit a warning
|
|
51
|
+
* but do not block boot — the application-declared version wins.
|
|
52
|
+
*
|
|
53
|
+
* @throws {BootstrapException} `MISSING_DEPENDENCY` when a required dependency
|
|
54
|
+
* is not listed in the application's `libraries` array.
|
|
55
|
+
* @throws {BootstrapException} `BAD_SORT` when no progress can be made —
|
|
56
|
+
* usually indicates a circular dependency.
|
|
57
|
+
*/
|
|
6
58
|
export function buildSortOrder(app, logger) {
|
|
59
|
+
// fast path — nothing to sort when no libraries are declared
|
|
7
60
|
if (is.empty(app.libraries)) {
|
|
8
61
|
return [];
|
|
9
62
|
}
|
|
@@ -41,6 +94,7 @@ export function buildSortOrder(app, logger) {
|
|
|
41
94
|
...(library?.depends ?? []),
|
|
42
95
|
...(library?.optionalDepends?.filter(i => app.libraries.some(index => i.name === index.name)) ?? []),
|
|
43
96
|
];
|
|
97
|
+
// a library with no remaining unsatisfied dependencies can go next
|
|
44
98
|
if (is.empty(depends)) {
|
|
45
99
|
return true;
|
|
46
100
|
}
|
|
@@ -55,9 +109,40 @@ export function buildSortOrder(app, logger) {
|
|
|
55
109
|
}
|
|
56
110
|
return out;
|
|
57
111
|
}
|
|
112
|
+
/**
|
|
113
|
+
* Cast a plain string to the branded `TContext` type.
|
|
114
|
+
*
|
|
115
|
+
* @remarks
|
|
116
|
+
* Used at the wiring boundary to produce context strings without importing the
|
|
117
|
+
* `TContext` brand into every caller. Prefer descriptive names like
|
|
118
|
+
* `"boilerplate:wiring"` over opaque identifiers so logs are readable.
|
|
119
|
+
*
|
|
120
|
+
* @internal
|
|
121
|
+
*/
|
|
58
122
|
export const COERCE_CONTEXT = (context) => context;
|
|
123
|
+
/**
|
|
124
|
+
* Fixed context string used for all errors and log messages emitted during the
|
|
125
|
+
* wiring phase itself.
|
|
126
|
+
*
|
|
127
|
+
* @internal
|
|
128
|
+
*/
|
|
59
129
|
export const WIRING_CONTEXT = COERCE_CONTEXT("boilerplate:wiring");
|
|
60
130
|
// #MARK: validateLibrary
|
|
131
|
+
/**
|
|
132
|
+
* Assert that a library name and service map meet the minimum requirements to
|
|
133
|
+
* be wired.
|
|
134
|
+
*
|
|
135
|
+
* @remarks
|
|
136
|
+
* Called by `CreateLibrary` before any other work. Throws immediately if the
|
|
137
|
+
* name is empty or if any entry in `serviceList` is not a function, so
|
|
138
|
+
* misconfiguration surfaces at library-construction time rather than at wire
|
|
139
|
+
* time.
|
|
140
|
+
*
|
|
141
|
+
* @throws {BootstrapException} `MISSING_LIBRARY_NAME` when `project` is empty.
|
|
142
|
+
* @throws {BootstrapException} `INVALID_SERVICE_DEFINITION` when any service is not a function.
|
|
143
|
+
*
|
|
144
|
+
* @internal
|
|
145
|
+
*/
|
|
61
146
|
export function validateLibrary(project, serviceList) {
|
|
62
147
|
if (is.empty(project)) {
|
|
63
148
|
throw new BootstrapException(COERCE_CONTEXT("CreateLibrary"), "MISSING_LIBRARY_NAME", "Library name is required");
|
|
@@ -71,10 +156,23 @@ export function validateLibrary(project, serviceList) {
|
|
|
71
156
|
}
|
|
72
157
|
}
|
|
73
158
|
// #MARK: wireOrder
|
|
159
|
+
/**
|
|
160
|
+
* Produce a wiring order for a service list, hoisting `priority` items to the
|
|
161
|
+
* front and appending the remainder in their original order.
|
|
162
|
+
*
|
|
163
|
+
* @remarks
|
|
164
|
+
* Validates that `priority` contains no duplicates before merging, since a
|
|
165
|
+
* service wired twice would produce subtle bugs that are hard to diagnose at
|
|
166
|
+
* runtime.
|
|
167
|
+
*
|
|
168
|
+
* @throws {BootstrapException} `DOUBLE_PRIORITY` when `priority` contains
|
|
169
|
+
* duplicate service names.
|
|
170
|
+
*/
|
|
74
171
|
export function wireOrder(priority, list) {
|
|
75
172
|
const out = [...(priority || [])];
|
|
76
173
|
if (!is.empty(priority)) {
|
|
77
174
|
const check = is.unique(priority);
|
|
175
|
+
// duplicate entries in priorityInit would wire the same service twice
|
|
78
176
|
if (check.length !== out.length) {
|
|
79
177
|
throw new BootstrapException(WIRING_CONTEXT, "DOUBLE_PRIORITY", "There are duplicate items in the priority load list");
|
|
80
178
|
}
|
|
@@ -83,12 +181,34 @@ export function wireOrder(priority, list) {
|
|
|
83
181
|
return temporary;
|
|
84
182
|
}
|
|
85
183
|
// #MARK: CreateLibrary
|
|
184
|
+
/**
|
|
185
|
+
* Construct a `LibraryDefinition` from a configuration options object.
|
|
186
|
+
*
|
|
187
|
+
* @remarks
|
|
188
|
+
* `CreateLibrary` is the public factory for all non-application modules. It
|
|
189
|
+
* validates the name and service map, then builds the `[WIRE_PROJECT]`
|
|
190
|
+
* implementation that the bootstrap engine calls to wire each service in order.
|
|
191
|
+
*
|
|
192
|
+
* **Lifecycle hook timing.** Services should attach all lifecycle hooks at the
|
|
193
|
+
* top level of their factory function. Hooks attached after the
|
|
194
|
+
* `[WIRE_PROJECT]` call completes will be silently lost (worst case) or cause
|
|
195
|
+
* a fatal error (best case).
|
|
196
|
+
*
|
|
197
|
+
* **Priority init.** `priorityInit` services are wired before all others in
|
|
198
|
+
* declaration order. The remaining services wire in no guaranteed order.
|
|
199
|
+
*
|
|
200
|
+
* @throws {BootstrapException} `MISSING_LIBRARY_NAME` — via `validateLibrary`.
|
|
201
|
+
* @throws {BootstrapException} `INVALID_SERVICE_DEFINITION` — via `validateLibrary`.
|
|
202
|
+
* @throws {BootstrapException} `MISSING_PRIORITY_SERVICE` when a name listed in
|
|
203
|
+
* `priorityInit` does not correspond to a service in the `services` map.
|
|
204
|
+
*/
|
|
86
205
|
export function CreateLibrary({ name: libraryName, configuration = {}, priorityInit, services, depends, optionalDepends, ...extra }) {
|
|
87
206
|
validateLibrary(libraryName, services);
|
|
88
207
|
const serviceApis = {};
|
|
89
208
|
if (!is.empty(priorityInit)) {
|
|
90
209
|
priorityInit.forEach(name => {
|
|
91
210
|
if (!is.function(services[name])) {
|
|
211
|
+
// fail fast at library-construction time; catching this at wire time is much harder to debug
|
|
92
212
|
throw new BootstrapException(WIRING_CONTEXT, "MISSING_PRIORITY_SERVICE", `${name} was listed as priority init, but was not found in services`);
|
|
93
213
|
}
|
|
94
214
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wiring.mjs","sourceRoot":"","sources":["../../src/helpers/wiring.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"wiring.mjs","sourceRoot":"","sources":["../../src/helpers/wiring.mts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAaH,OAAO,EAAE,EAAE,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAazC,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAkrBlD,iFAAiF;AAEjF;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAqEvD,wBAAwB;AACxB;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,cAAc,CAC5B,GAAgC,EAChC,MAAiB;IAEjB,6DAA6D;IAC7D,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,GAAG,C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,IAAI,6DAA6D,CACrE,CAAC;YACJ,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,MAAM,OAAO,GAAG;QACd,gEAAgE;QAChE,GAAG,KAAK;QACR,CAAC,YAAY,CAAC,EAAE,KAAK,EACnB,QAA4B,EAC5B,WAMoC,EACpC,EAAE;YACF,8CAA8C;YAC9C,8CAA8C;YAC9C,MAAM,MAAM,GAAG,QAAQ,EAAE,WAAW,CAAC,aAA8B,CAAC;YACpE,MAAM,EAAE,CAAC,YAAY,CAAC,CAAC,WAAkC,EAAE,aAAa,CAAC,CAAC;YAC1E,MAAM,UAAU,CAAC,SAAS,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE,KAAK,EAAC,OAAO,EAAC,EAAE;gBAC/E,WAAW,CAAC,OAAO,CAAC,GAAG,MAAM,WAAW,CACtC,WAAW,EACX,OAAO,EACP,QAAQ,CAAC,OAAO,CAAC,EACjB,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAC9B,QAAQ,CACT,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,QAAQ,CAAC,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;YACjD,oGAAoG;YACpG,qHAAqH;QACvH,CAAC;QACD,aAAa;QACb,OAAO;QACP,IAAI,EAAE,WAAW;QACjB,eAAe;QACf,YAAY;QACZ,WAAW;QACX,QAAQ;QACR,IAAI,EAAE,SAAS;KACsB,CAAC;IACxC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
import type { AlsExtension } from "../index.mts";
|
|
2
|
+
/**
|
|
3
|
+
* AsyncLocalStorage wrapper for request-scoped context propagation.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Creates and owns a single AsyncLocalStorage instance that holds
|
|
7
|
+
* request-scoped data across async boundaries. Provides methods to enter
|
|
8
|
+
* context, retrieve store, and run callbacks within a specific data context.
|
|
9
|
+
* The logger uses this to merge per-request fields into every log line
|
|
10
|
+
* without explicit parameter passing through the call chain.
|
|
11
|
+
*/
|
|
2
12
|
export declare function ALS(): AlsExtension;
|
|
@@ -1,14 +1,63 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
/**
|
|
3
|
+
* AsyncLocalStorage wrapper for request-scoped context propagation.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* Creates and owns a single AsyncLocalStorage instance that holds
|
|
7
|
+
* request-scoped data across async boundaries. Provides methods to enter
|
|
8
|
+
* context, retrieve store, and run callbacks within a specific data context.
|
|
9
|
+
* The logger uses this to merge per-request fields into every log line
|
|
10
|
+
* without explicit parameter passing through the call chain.
|
|
11
|
+
*/
|
|
2
12
|
export function ALS() {
|
|
3
13
|
const storage = new AsyncLocalStorage();
|
|
4
14
|
return {
|
|
15
|
+
/**
|
|
16
|
+
* Retrieve the internal AsyncLocalStorage instance.
|
|
17
|
+
*/
|
|
5
18
|
asyncStorage: () => storage,
|
|
19
|
+
/**
|
|
20
|
+
* Enter context with data; data persists for synchronously-executed callbacks.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* Sets the async local context to the provided data object. All code running
|
|
24
|
+
* on the same async task will see this data when calling `getStore()`.
|
|
25
|
+
* Unlike `run()`, this does not execute a callback; the context persists
|
|
26
|
+
* until changed by another `enterWith()` or cleared by the async context.
|
|
27
|
+
*/
|
|
6
28
|
enterWith(data) {
|
|
29
|
+
// establish context for the current async task
|
|
7
30
|
storage.enterWith(data);
|
|
8
31
|
},
|
|
32
|
+
/**
|
|
33
|
+
* Extract log-scoped fields from current context.
|
|
34
|
+
*
|
|
35
|
+
* @remarks
|
|
36
|
+
* Retrieves the `logs` sub-object from the async local store, defaulting to
|
|
37
|
+
* an empty object if no context is set. Used by logger to inject context
|
|
38
|
+
* fields into every log entry automatically without requiring per-call passing.
|
|
39
|
+
*/
|
|
9
40
|
getLogData: () => storage.getStore()?.logs ?? {},
|
|
41
|
+
/**
|
|
42
|
+
* Retrieve the full async local store.
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Returns the complete data object set by `enterWith()` or `run()`, or
|
|
46
|
+
* undefined if no context is active. The returned object is read-only to
|
|
47
|
+
* callers; mutation must go through `enterWith()` or `run()`.
|
|
48
|
+
*/
|
|
10
49
|
getStore: () => storage.getStore(),
|
|
50
|
+
/**
|
|
51
|
+
* Execute a callback within a specific data context.
|
|
52
|
+
*
|
|
53
|
+
* @remarks
|
|
54
|
+
* Runs the callback with the provided data visible to `getStore()` for the
|
|
55
|
+
* duration of the callback and all async operations it spawns. The context
|
|
56
|
+
* is automatically cleared when the callback completes (or earlier if an
|
|
57
|
+
* async boundary is crossed outside the callback).
|
|
58
|
+
*/
|
|
11
59
|
run(data, callback) {
|
|
60
|
+
// wrap the callback to establish and maintain context for its duration
|
|
12
61
|
storage.run(data, () => {
|
|
13
62
|
callback();
|
|
14
63
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"als.service.mjs","sourceRoot":"","sources":["../../src/services/als.service.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD,MAAM,UAAU,GAAG;IACjB,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAkB,CAAC;IACxD,OAAO;QACL,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO;QAC3B,SAAS,CAAC,IAAI;YACZ,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,IAAK,EAAmB;QAClE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;QAClC,GAAG,CAAC,IAAoB,EAAE,QAA0B;YAClD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE;gBACrB,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"als.service.mjs","sourceRoot":"","sources":["../../src/services/als.service.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAIrD;;;;;;;;;GASG;AACH,MAAM,UAAU,GAAG;IACjB,MAAM,OAAO,GAAG,IAAI,iBAAiB,EAAkB,CAAC;IACxD,OAAO;QACL;;WAEG;QACH,YAAY,EAAE,GAAG,EAAE,CAAC,OAAO;QAC3B;;;;;;;;WAQG;QACH,SAAS,CAAC,IAAI;YACZ,+CAA+C;YAC/C,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD;;;;;;;WAOG;QACH,UAAU,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,IAAK,EAAmB;QAClE;;;;;;;WAOG;QACH,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,QAAQ,EAAE;QAClC;;;;;;;;WAQG;QACH,GAAG,CAAC,IAAoB,EAAE,QAA0B;YAClD,uEAAuE;YACvE,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,EAAE;gBACrB,QAAQ,EAAE,CAAC;YACb,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -4,4 +4,26 @@ export declare const LOAD_PROJECT: unique symbol;
|
|
|
4
4
|
export declare const EVENT_CONFIGURATION_UPDATED = "event_configuration_updated";
|
|
5
5
|
export declare const INJECTED_DEFINITIONS: unique symbol;
|
|
6
6
|
export type ConfigManager = ReturnType<typeof Configuration>;
|
|
7
|
+
/**
|
|
8
|
+
* Central configuration state manager for the entire application.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Owns two things: the `configuration` plain-object store (all live config
|
|
12
|
+
* values keyed by `module.key`) and the `configDefinitions` map (the schema
|
|
13
|
+
* metadata declared by each library/application via `CreateLibrary`).
|
|
14
|
+
*
|
|
15
|
+
* Exposed to other services through the `config` proxy injected into every
|
|
16
|
+
* `TServiceParams`. The proxy makes `config.boilerplate.LOG_LEVEL` feel like
|
|
17
|
+
* a plain property read but actually calls `object.get(configuration, path)`
|
|
18
|
+
* on each access so reads always reflect the current value.
|
|
19
|
+
*
|
|
20
|
+
* The initialization sequence (`INITIALIZE`) is called once during bootstrap,
|
|
21
|
+
* between `PreInit` and `PostConfig`, and runs all registered config loaders
|
|
22
|
+
* in priority order: env/argv first, then file (if enabled), then any
|
|
23
|
+
* custom loaders registered via `registerLoader`.
|
|
24
|
+
*
|
|
25
|
+
* Config values can be updated at runtime via `setConfig` or `merge`; any
|
|
26
|
+
* update emits `EVENT_CONFIGURATION_UPDATED` so downstream code (e.g. the
|
|
27
|
+
* logger's level filter) can react via `onUpdate` subscriptions.
|
|
28
|
+
*/
|
|
7
29
|
export declare function Configuration({ context, event, lifecycle, internal, }: TServiceParams): DigitalAlchemyConfiguration;
|
|
@@ -4,19 +4,46 @@ export const LOAD_PROJECT = Symbol.for("load-project");
|
|
|
4
4
|
export const EVENT_CONFIGURATION_UPDATED = "event_configuration_updated";
|
|
5
5
|
export const INJECTED_DEFINITIONS = Symbol.for("injected-config");
|
|
6
6
|
const DECIMALS = 2;
|
|
7
|
+
/**
|
|
8
|
+
* Central configuration state manager for the entire application.
|
|
9
|
+
*
|
|
10
|
+
* @remarks
|
|
11
|
+
* Owns two things: the `configuration` plain-object store (all live config
|
|
12
|
+
* values keyed by `module.key`) and the `configDefinitions` map (the schema
|
|
13
|
+
* metadata declared by each library/application via `CreateLibrary`).
|
|
14
|
+
*
|
|
15
|
+
* Exposed to other services through the `config` proxy injected into every
|
|
16
|
+
* `TServiceParams`. The proxy makes `config.boilerplate.LOG_LEVEL` feel like
|
|
17
|
+
* a plain property read but actually calls `object.get(configuration, path)`
|
|
18
|
+
* on each access so reads always reflect the current value.
|
|
19
|
+
*
|
|
20
|
+
* The initialization sequence (`INITIALIZE`) is called once during bootstrap,
|
|
21
|
+
* between `PreInit` and `PostConfig`, and runs all registered config loaders
|
|
22
|
+
* in priority order: env/argv first, then file (if enabled), then any
|
|
23
|
+
* custom loaders registered via `registerLoader`.
|
|
24
|
+
*
|
|
25
|
+
* Config values can be updated at runtime via `setConfig` or `merge`; any
|
|
26
|
+
* update emits `EVENT_CONFIGURATION_UPDATED` so downstream code (e.g. the
|
|
27
|
+
* logger's level filter) can react via `onUpdate` subscriptions.
|
|
28
|
+
*/
|
|
7
29
|
export function Configuration({ context, event, lifecycle, internal, }) {
|
|
8
30
|
const { is } = internal.utils;
|
|
9
|
-
//
|
|
31
|
+
// logger is not yet available at construction time (chicken-and-egg with
|
|
32
|
+
// boilerplate wiring order), so we grab it on the first lifecycle hook
|
|
10
33
|
let logger;
|
|
11
34
|
lifecycle.onPreInit(() => (logger = internal.boilerplate.logger.context(context)));
|
|
12
35
|
const configDefinitions = new Map();
|
|
13
36
|
const configuration = {};
|
|
14
37
|
const loaded = new Set();
|
|
15
38
|
const loaders = new Map([]);
|
|
16
|
-
// #MARK:
|
|
39
|
+
// #MARK: configValueProxy
|
|
40
|
+
// proxyData exists only to satisfy Proxy's ownKeys/has contract which requires
|
|
41
|
+
// the target object to have enumerable keys for spread operations to work;
|
|
42
|
+
// actual reads are always routed through object.get(configuration, path)
|
|
17
43
|
const proxyData = {};
|
|
18
44
|
const configValueProxy = new Proxy(proxyData, {
|
|
19
45
|
get(_, project) {
|
|
46
|
+
// always read live from configuration so callers see post-load values
|
|
20
47
|
return { ...internal.utils.object.get(configuration, project) };
|
|
21
48
|
},
|
|
22
49
|
has(_, key) {
|
|
@@ -28,37 +55,73 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
28
55
|
return Object.keys(configuration);
|
|
29
56
|
},
|
|
30
57
|
set() {
|
|
58
|
+
// configuration is read-only via the proxy; use setConfig() to mutate
|
|
31
59
|
return false;
|
|
32
60
|
},
|
|
33
61
|
});
|
|
34
62
|
// #MARK: setConfig
|
|
63
|
+
/**
|
|
64
|
+
* Set a single config property and emit an update event.
|
|
65
|
+
*
|
|
66
|
+
* @remarks
|
|
67
|
+
* Writes directly into the live `configuration` store and fires
|
|
68
|
+
* `EVENT_CONFIGURATION_UPDATED` so any `onUpdate` listeners react
|
|
69
|
+
* immediately. Prefer `merge` for bulk updates.
|
|
70
|
+
*/
|
|
35
71
|
function setConfig(project, property, value) {
|
|
72
|
+
// logger may not be available if called during early wiring (before onPreInit)
|
|
73
|
+
logger?.trace({ name: setConfig, property: String(property), project }, "setting config");
|
|
36
74
|
internal.utils.object.set(configuration, [project, property].join("."), value);
|
|
37
|
-
//
|
|
75
|
+
// notify any onUpdate listeners so they can react to the changed value
|
|
38
76
|
event.emit(EVENT_CONFIGURATION_UPDATED, project, property);
|
|
77
|
+
logger?.debug({ name: setConfig, property: String(property), project }, "config set");
|
|
39
78
|
}
|
|
40
79
|
// #MARK: validateConfig
|
|
80
|
+
/**
|
|
81
|
+
* Assert that every `required: true` config property has been given a value.
|
|
82
|
+
*
|
|
83
|
+
* @throws {BootstrapException} `REQUIRED_CONFIGURATION_MISSING` if any
|
|
84
|
+
* required property is still `undefined` after all loaders have run.
|
|
85
|
+
*/
|
|
41
86
|
function validateConfig() {
|
|
42
|
-
// * validate
|
|
43
|
-
// - ensure all required properties have been defined
|
|
44
87
|
configDefinitions.forEach((definitions, project) => {
|
|
45
88
|
Object.keys(definitions).forEach(key => {
|
|
46
89
|
const config = [project, key].join(".");
|
|
47
90
|
if (definitions[key].required &&
|
|
48
91
|
is.undefined(internal.utils.object.get(configuration, config))) {
|
|
49
|
-
//
|
|
92
|
+
// required property was never populated by any loader or bootstrap config;
|
|
93
|
+
// treat as a fatal wiring error so the app does not silently start broken
|
|
50
94
|
throw new BootstrapException(context, "REQUIRED_CONFIGURATION_MISSING", `Configuration property ${config} is not defined`);
|
|
51
95
|
}
|
|
52
96
|
});
|
|
53
97
|
});
|
|
54
98
|
}
|
|
55
99
|
// #MARK: registerLoader
|
|
100
|
+
/**
|
|
101
|
+
* Register a custom config loader for a given `DataTypes` key.
|
|
102
|
+
*
|
|
103
|
+
* @remarks
|
|
104
|
+
* Loaders run during `initialize`, after the built-in env/file loaders,
|
|
105
|
+
* in the order they were registered. Only one loader per `DataTypes` key
|
|
106
|
+
* is retained — registering twice replaces the first.
|
|
107
|
+
*/
|
|
56
108
|
function registerLoader(loader, name) {
|
|
109
|
+
// logger may not be available if called during early wiring (before onPreInit)
|
|
110
|
+
logger?.trace({ name: registerLoader, type: name }, "registering config loader");
|
|
57
111
|
loaders.set(name, loader);
|
|
58
112
|
}
|
|
59
113
|
// #MARK: mergeConfig
|
|
114
|
+
/**
|
|
115
|
+
* Merge raw loader output into the live config store, respecting source restrictions.
|
|
116
|
+
*
|
|
117
|
+
* @remarks
|
|
118
|
+
* Each config property can declare a `source` allow-list (e.g. `["argv"]`).
|
|
119
|
+
* Properties whose source list does not include any of the `type` values
|
|
120
|
+
* passed here are silently skipped, preventing e.g. a file loader from
|
|
121
|
+
* overwriting an argv-only value.
|
|
122
|
+
*/
|
|
60
123
|
function mergeConfig(data, type) {
|
|
61
|
-
//
|
|
124
|
+
// skip properties whose declared source list excludes every type in this batch
|
|
62
125
|
configDefinitions.forEach((project, name) => {
|
|
63
126
|
const keys = Object.keys(project);
|
|
64
127
|
keys.forEach(key => {
|
|
@@ -74,9 +137,21 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
74
137
|
});
|
|
75
138
|
}
|
|
76
139
|
// #MARK: initialize
|
|
140
|
+
/**
|
|
141
|
+
* Run all config loaders and validate required properties.
|
|
142
|
+
*
|
|
143
|
+
* @remarks
|
|
144
|
+
* Called exactly once by `wiring.service.mts` between `PreInit` and
|
|
145
|
+
* `PostConfig`. Order: env/argv → file (if `configSources.file` is truthy)
|
|
146
|
+
* → any custom loaders registered via `registerLoader`. Returns a formatted
|
|
147
|
+
* duration string that is included in bootstrap timing stats.
|
|
148
|
+
*
|
|
149
|
+
* @internal
|
|
150
|
+
*/
|
|
77
151
|
async function initialize(application) {
|
|
78
152
|
const start = performance.now();
|
|
79
153
|
const configTimings = {};
|
|
154
|
+
logger.trace({ name: initialize }, "loading configuration");
|
|
80
155
|
// ConfigLoaderEnvironment handles both env and argv and tracks timings internally
|
|
81
156
|
mergeConfig(await ConfigLoaderEnvironment({
|
|
82
157
|
application,
|
|
@@ -86,7 +161,9 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
86
161
|
timings: configTimings,
|
|
87
162
|
}), ["env", "argv"]);
|
|
88
163
|
const canFile = internal.boot.options?.configSources?.file ?? false;
|
|
164
|
+
// file loading is opt-in; default-off avoids unexpected file reads in tests
|
|
89
165
|
if (canFile) {
|
|
166
|
+
logger.trace({ name: initialize }, "loading file config");
|
|
90
167
|
const fileStart = performance.now();
|
|
91
168
|
mergeConfig(await configLoaderFile({
|
|
92
169
|
application,
|
|
@@ -96,12 +173,15 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
96
173
|
}), ["file"]);
|
|
97
174
|
configTimings.file = `${(performance.now() - fileStart).toFixed(DECIMALS)}ms`;
|
|
98
175
|
}
|
|
99
|
-
//
|
|
176
|
+
// run any additional loaders registered by library code
|
|
100
177
|
const configSources = internal.boot.options.configSources ?? {};
|
|
101
178
|
await eachSeries([...loaders.entries()], async ([type, loader]) => {
|
|
179
|
+
// configSources[type] === false is an explicit opt-out; absence defaults to enabled
|
|
102
180
|
if (configSources[type] === false) {
|
|
181
|
+
logger.trace({ name: initialize, type }, "loader disabled via configSources, skipping");
|
|
103
182
|
return;
|
|
104
183
|
}
|
|
184
|
+
logger.trace({ name: initialize, type }, "running loader");
|
|
105
185
|
const loaderStart = performance.now();
|
|
106
186
|
mergeConfig(await loader({ application, configs: configDefinitions, internal, logger }), [
|
|
107
187
|
type,
|
|
@@ -110,14 +190,37 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
110
190
|
});
|
|
111
191
|
validateConfig();
|
|
112
192
|
internal.boot.configTimings = configTimings;
|
|
113
|
-
|
|
193
|
+
const total = `${(performance.now() - start).toFixed(DECIMALS)}ms`;
|
|
194
|
+
logger.debug({ name: initialize, timings: configTimings, total }, "configuration loaded");
|
|
195
|
+
return total;
|
|
114
196
|
}
|
|
115
197
|
// #MARK: merge
|
|
198
|
+
/**
|
|
199
|
+
* Deep-merge a partial configuration object into the live store.
|
|
200
|
+
*
|
|
201
|
+
* @remarks
|
|
202
|
+
* Does not emit `EVENT_CONFIGURATION_UPDATED`; intended for bulk
|
|
203
|
+
* pre-boot merges (e.g. bootstrap `options.configuration`).
|
|
204
|
+
* Use `setConfig` for individual runtime updates that need listeners notified.
|
|
205
|
+
*/
|
|
116
206
|
function merge(merge) {
|
|
117
207
|
return deepExtend(configuration, merge);
|
|
118
208
|
}
|
|
119
209
|
// #MARK: loadProject
|
|
210
|
+
/**
|
|
211
|
+
* Register a module's config schema and populate default values.
|
|
212
|
+
*
|
|
213
|
+
* @remarks
|
|
214
|
+
* Called once per library/application during wiring. Idempotent — a second
|
|
215
|
+
* call for the same library name is silently ignored to prevent re-initialisation
|
|
216
|
+
* during test re-runs. After registering defaults, any values already present
|
|
217
|
+
* in `options.configuration` for this project are applied immediately so they
|
|
218
|
+
* take effect before any loader runs.
|
|
219
|
+
*
|
|
220
|
+
* @internal
|
|
221
|
+
*/
|
|
120
222
|
function loadProject(library, definitions) {
|
|
223
|
+
// guard against double-registration (e.g. test re-runs, appendLibrary replacing)
|
|
121
224
|
if (loaded.has(library)) {
|
|
122
225
|
return;
|
|
123
226
|
}
|
|
@@ -127,6 +230,8 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
127
230
|
internal.utils.object.set(configuration, [library, key].join("."), definitions[key].default);
|
|
128
231
|
});
|
|
129
232
|
configDefinitions.set(library, definitions);
|
|
233
|
+
// apply any values that were baked into bootstrap options for this project;
|
|
234
|
+
// these take priority over schema defaults but lose to loader-sourced values
|
|
130
235
|
const bootConfig = internal.boot.options?.configuration ?? {};
|
|
131
236
|
if (library in bootConfig) {
|
|
132
237
|
const project = library;
|
|
@@ -137,8 +242,18 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
137
242
|
}
|
|
138
243
|
}
|
|
139
244
|
// #MARK: onUpdate
|
|
245
|
+
/**
|
|
246
|
+
* Subscribe to configuration change events.
|
|
247
|
+
*
|
|
248
|
+
* @remarks
|
|
249
|
+
* When `project` and/or `property` are provided the callback is only
|
|
250
|
+
* invoked for changes to that specific path. Omitting both subscribes to
|
|
251
|
+
* all configuration changes. The callback receives `(project, property)`
|
|
252
|
+
* matching the changed key.
|
|
253
|
+
*/
|
|
140
254
|
function onUpdate(callback, project, property) {
|
|
141
255
|
event.on(EVENT_CONFIGURATION_UPDATED, (updatedProject, updatedProperty) => {
|
|
256
|
+
// filter to the specific project/property if the caller narrowed the subscription
|
|
142
257
|
if (!is.empty(project) && project !== updatedProject) {
|
|
143
258
|
return;
|
|
144
259
|
}
|
|
@@ -163,17 +278,30 @@ export function Configuration({ context, event, lifecycle, internal, }) {
|
|
|
163
278
|
*/
|
|
164
279
|
[LOAD_PROJECT]: loadProject,
|
|
165
280
|
/**
|
|
166
|
-
*
|
|
281
|
+
* Retrieve the metadata that was originally used to define the configs.
|
|
167
282
|
*/
|
|
168
283
|
getDefinitions: () => configDefinitions,
|
|
169
284
|
/**
|
|
170
|
-
*
|
|
285
|
+
* Deep-merge a partial configuration object into the live store.
|
|
171
286
|
*
|
|
172
|
-
*
|
|
287
|
+
* @remarks
|
|
288
|
+
* Intended for initial loading workflows. Does not fire `EVENT_CONFIGURATION_UPDATED`.
|
|
173
289
|
*/
|
|
174
290
|
merge,
|
|
291
|
+
/**
|
|
292
|
+
* Subscribe to configuration change events.
|
|
293
|
+
*
|
|
294
|
+
* @remarks
|
|
295
|
+
* Narrow to a specific project and/or property, or omit both to receive all updates.
|
|
296
|
+
*/
|
|
175
297
|
onUpdate,
|
|
298
|
+
/**
|
|
299
|
+
* Register a custom config loader for a given `DataTypes` key.
|
|
300
|
+
*/
|
|
176
301
|
registerLoader,
|
|
302
|
+
/**
|
|
303
|
+
* Set a single config property and notify all `onUpdate` subscribers.
|
|
304
|
+
*/
|
|
177
305
|
set: setConfig,
|
|
178
306
|
};
|
|
179
307
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"configuration.service.mjs","sourceRoot":"","sources":["../../src/services/configuration.service.mts"],"names":[],"mappings":"AAiBA,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AACvD,MAAM,CAAC,MAAM,2BAA2B,GAAG,6BAA6B,CAAC;AACzE,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAGlE,MAAM,QAAQ,GAAG,CAAC,CAAC;AAEnB,MAAM,UAAU,aAAa,CAAC,EAC5B,OAAO,EACP,KAAK,EACL,SAAS,EACT,QAAQ,GACO;IACf,MAAM,EAAE,EAAE,EAAE,GAAG,QAAQ,CAAC,KAAK,CAAC;IAE9B,
|
|
1
|
+
{"version":3,"file":"configuration.service.mjs","sourceRoot":"","sources":["../../src/services/configuration.service.mts"],"names":[],"mappings":"AAiBA,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,gBAAgB,EAChB,UAAU,EACV,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;AACnD,MAAM,CAAC,MAAM,YAAY,G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Ed;;WAEG;QACH,GAAG,EAAE,SAAuB;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service factories and utilities for @digital-alchemy/core.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Exports all service-level APIs: lifecycle event registry, async local storage
|
|
6
|
+
* wrapper, type guards, configuration, logger, scheduler, wiring, and internal utilities.
|
|
7
|
+
* Each service is a factory function that receives TServiceParams and returns its API.
|
|
8
|
+
*/
|
|
1
9
|
export * from "./als.service.mts";
|
|
2
10
|
export * from "./configuration.service.mts";
|
|
3
11
|
export * from "./internal.service.mts";
|
package/dist/services/index.mjs
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service factories and utilities for @digital-alchemy/core.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Exports all service-level APIs: lifecycle event registry, async local storage
|
|
6
|
+
* wrapper, type guards, configuration, logger, scheduler, wiring, and internal utilities.
|
|
7
|
+
* Each service is a factory function that receives TServiceParams and returns its API.
|
|
8
|
+
*/
|
|
1
9
|
export * from "./als.service.mjs";
|
|
2
10
|
export * from "./configuration.service.mjs";
|
|
3
11
|
export * from "./internal.service.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/services/index.mts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/services/index.mts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,wBAAwB,CAAC;AACvC,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,sBAAsB,CAAC"}
|