@voxgig/station 0.0.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.
Files changed (67) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +88 -0
  3. package/dist/src/Station.d.ts +238 -0
  4. package/dist/src/Station.js +1213 -0
  5. package/dist/src/Station.js.map +1 -0
  6. package/dist/src/adapter.d.ts +9 -0
  7. package/dist/src/adapter.js +171 -0
  8. package/dist/src/adapter.js.map +1 -0
  9. package/dist/src/config-shape.d.ts +1 -0
  10. package/dist/src/config-shape.js +329 -0
  11. package/dist/src/config-shape.js.map +1 -0
  12. package/dist/src/descriptor.d.ts +8 -0
  13. package/dist/src/descriptor.js +170 -0
  14. package/dist/src/descriptor.js.map +1 -0
  15. package/dist/src/error.d.ts +8 -0
  16. package/dist/src/error.js +60 -0
  17. package/dist/src/error.js.map +1 -0
  18. package/dist/src/events.d.ts +15 -0
  19. package/dist/src/events.js +46 -0
  20. package/dist/src/events.js.map +1 -0
  21. package/dist/src/factory.d.ts +24 -0
  22. package/dist/src/factory.js +79 -0
  23. package/dist/src/factory.js.map +1 -0
  24. package/dist/src/feature.d.ts +106 -0
  25. package/dist/src/feature.js +324 -0
  26. package/dist/src/feature.js.map +1 -0
  27. package/dist/src/index.browser.d.ts +14 -0
  28. package/dist/src/index.browser.js +64 -0
  29. package/dist/src/index.browser.js.map +1 -0
  30. package/dist/src/index.d.ts +14 -0
  31. package/dist/src/index.js +56 -0
  32. package/dist/src/index.js.map +1 -0
  33. package/dist/src/loader.d.ts +45 -0
  34. package/dist/src/loader.js +181 -0
  35. package/dist/src/loader.js.map +1 -0
  36. package/dist/src/profile.d.ts +6 -0
  37. package/dist/src/profile.js +77 -0
  38. package/dist/src/profile.js.map +1 -0
  39. package/dist/src/profilecore.d.ts +10 -0
  40. package/dist/src/profilecore.js +180 -0
  41. package/dist/src/profilecore.js.map +1 -0
  42. package/dist/src/secrets.d.ts +12 -0
  43. package/dist/src/secrets.js +93 -0
  44. package/dist/src/secrets.js.map +1 -0
  45. package/dist/src/shape.d.ts +42 -0
  46. package/dist/src/shape.js +444 -0
  47. package/dist/src/shape.js.map +1 -0
  48. package/dist/src/types.d.ts +138 -0
  49. package/dist/src/types.js +5 -0
  50. package/dist/src/types.js.map +1 -0
  51. package/package.json +60 -0
  52. package/src/Station.ts +1310 -0
  53. package/src/adapter.ts +183 -0
  54. package/src/config-shape.ts +326 -0
  55. package/src/descriptor.ts +179 -0
  56. package/src/error.ts +64 -0
  57. package/src/events.ts +45 -0
  58. package/src/factory.ts +93 -0
  59. package/src/feature.ts +321 -0
  60. package/src/index.browser.ts +56 -0
  61. package/src/index.ts +50 -0
  62. package/src/loader.ts +188 -0
  63. package/src/profile.ts +67 -0
  64. package/src/profilecore.ts +201 -0
  65. package/src/secrets.ts +96 -0
  66. package/src/shape.ts +435 -0
  67. package/src/types.ts +185 -0
@@ -0,0 +1,324 @@
1
+ "use strict";
2
+ /* Feature management (design §8): the three-level merge, the
3
+ * constraint-and-band resolver, and the descriptor-derived checker.
4
+ *
5
+ * The resolver is written to voxgig/plugin's §7 semantics so plugin can
6
+ * extract it — this is one of the pieces the joint plan means by
7
+ * "station builds natively to plugin's semantics". Keeping the two
8
+ * spellings identical is what C4 holds station to. */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.BAND_TEST = exports.BAND_STATION = exports.BAND_DEFAULT = exports.RESERVED_KEYS = void 0;
11
+ exports.mergefeatures = mergefeatures;
12
+ exports.featuresources = featuresources;
13
+ exports.defaultband = defaultband;
14
+ exports.resolveorder = resolveorder;
15
+ exports.checkpin = checkpin;
16
+ exports.checkfeatures = checkfeatures;
17
+ exports.composefeatures = composefeatures;
18
+ const error_1 = require("./error");
19
+ // ---------------------------------------------------------------------
20
+ // §8.3 — the merge
21
+ // ---------------------------------------------------------------------
22
+ /** Reserved on a feature entry: not options, and never passed through
23
+ * to the SDK's own option map. */
24
+ exports.RESERVED_KEYS = ['active', 'order'];
25
+ /** The six sources, in §3.3's order extended by the profile level:
26
+ *
27
+ * 1 base.feature 4 overlay.feature
28
+ * 2 base.api[<api>].feature 5 overlay.api[<api>].feature
29
+ * 3 base.sdk[<ref>].feature 6 overlay.sdk[<ref>].feature
30
+ *
31
+ * PROFILE SPECIFICITY OUTRANKS BLOCK SPECIFICITY, and within a profile
32
+ * the narrower block wins — the same principle as §3.3, one level down.
33
+ *
34
+ * `feature` is the ONE key where §3.3's shallow-per-key rule is wrong:
35
+ * composition is the entire point, a fleet default plus a per-instance
36
+ * tweak. So it is a TWO-LEVEL merge — per feature name, then per option
37
+ * key — and no deeper. A map-valued option REPLACES wholesale, which is
38
+ * what `{"$MERGE": {"deep": 2}}` states and what a port defaulting to a
39
+ * deep merge would silently get wrong.
40
+ *
41
+ * Same defaults-after-merge rule as §3.3, one level down: an entry
42
+ * mentioned at one level with only a tuning key must NOT synthesize
43
+ * `active` and switch on a feature a broader level turned off. That is
44
+ * the §3.3 defect one level down, and it is why the caller passes RAW
45
+ * blocks here. */
46
+ function mergefeatures(sources) {
47
+ const out = {};
48
+ for (const src of sources) {
49
+ if (!ismap(src)) {
50
+ continue;
51
+ }
52
+ for (const name of Object.keys(src)) {
53
+ const entry = src[name];
54
+ if (!ismap(entry)) {
55
+ out[name] = entry;
56
+ continue;
57
+ }
58
+ // Per option key, and NOT deeper.
59
+ out[name] = { ...(ismap(out[name]) ? out[name] : {}), ...entry };
60
+ }
61
+ }
62
+ return out;
63
+ }
64
+ /** The six sources for one instance, in order. Assembled here rather
65
+ * than at the call site so the order lives in exactly one place. */
66
+ function featuresources(base, overlay, api, ref) {
67
+ return [
68
+ base?.feature,
69
+ base?.api?.[api]?.feature,
70
+ base?.sdk?.[ref]?.feature,
71
+ overlay?.feature,
72
+ overlay?.api?.[api]?.feature,
73
+ overlay?.sdk?.[ref]?.feature,
74
+ ];
75
+ }
76
+ // ---------------------------------------------------------------------
77
+ // §8.4 — activation and order
78
+ // ---------------------------------------------------------------------
79
+ /** `test` substitutes the base transport, so it takes the innermost
80
+ * band; `station` sits immediately outside it, pinned; everything else
81
+ * is band 0, outside station.
82
+ *
83
+ * THE DEFAULT IS TODAY'S BEHAVIOUR EXPRESSED IN THE NEW MODEL rather
84
+ * than as a special case: a project that writes no `order` anywhere
85
+ * sees exactly today's nesting, and sdkgen's two `makeOptions` special
86
+ * cases become two band values rather than two branches. */
87
+ exports.BAND_DEFAULT = 0;
88
+ exports.BAND_STATION = 100;
89
+ exports.BAND_TEST = 200;
90
+ /** Higher is further IN. */
91
+ function defaultband(name) {
92
+ if ('test' === name) {
93
+ return exports.BAND_TEST;
94
+ }
95
+ if ('station' === name) {
96
+ return exports.BAND_STATION;
97
+ }
98
+ return exports.BAND_DEFAULT;
99
+ }
100
+ /** Resolve the activation order: constraints, then bands, then the
101
+ * feature's position in the merged map.
102
+ *
103
+ * `before`/`after` take a feature name or a list of them and are
104
+ * SATISFIED VACUOUSLY when the named feature is absent — `after: 'test'`
105
+ * loads fine in a project with no test feature, which is sdkgen's
106
+ * `__after__` behaviour kept rather than reinvented.
107
+ *
108
+ * Constraints beat bands; bands break ties no constraint decides;
109
+ * remaining ties break by declaration position, so the result is a
110
+ * stable topological sort with no alphabetical accident in it.
111
+ *
112
+ * Returns OUTERMOST FIRST, which is the array form the constructor
113
+ * takes and the direction plugin's chain composes in. */
114
+ function resolveorder(merged) {
115
+ const names = Object.keys(merged).filter((n) => active(merged[n]));
116
+ const pos = new Map();
117
+ names.forEach((n, i) => pos.set(n, i));
118
+ const band = new Map();
119
+ for (const n of names) {
120
+ const o = ismap(merged[n]) ? merged[n].order : undefined;
121
+ const b = ismap(o) && 'number' === typeof o.band ? o.band : defaultband(n);
122
+ band.set(n, b);
123
+ }
124
+ // edges: from OUTER to INNER. `after: X` means "further in than X".
125
+ const inner = new Map();
126
+ for (const n of names) {
127
+ inner.set(n, new Set());
128
+ }
129
+ const listof = (v) => null == v ? [] : (Array.isArray(v) ? v : [v]).map(String);
130
+ for (const n of names) {
131
+ const o = ismap(merged[n]) ? merged[n].order : undefined;
132
+ if (!ismap(o)) {
133
+ continue;
134
+ }
135
+ // Vacuous when absent: an unknown name is not an error here.
136
+ for (const other of listof(o.after)) {
137
+ if (inner.has(other)) {
138
+ inner.get(other).add(n);
139
+ }
140
+ }
141
+ for (const other of listof(o.before)) {
142
+ if (inner.has(other)) {
143
+ inner.get(n).add(other);
144
+ }
145
+ }
146
+ }
147
+ const indeg = new Map();
148
+ for (const n of names) {
149
+ indeg.set(n, 0);
150
+ }
151
+ for (const n of names) {
152
+ for (const m of inner.get(n)) {
153
+ indeg.set(m, (indeg.get(m) || 0) + 1);
154
+ }
155
+ }
156
+ // Kahn, picking the lowest band first (outermost), then declaration
157
+ // position — so ties break the same way in every port.
158
+ const ready = names.filter((n) => 0 === indeg.get(n));
159
+ const out = [];
160
+ const pick = () => {
161
+ ready.sort((a, b) => {
162
+ const d = band.get(a) - band.get(b);
163
+ return 0 !== d ? d : pos.get(a) - pos.get(b);
164
+ });
165
+ return ready.shift();
166
+ };
167
+ while (0 < ready.length) {
168
+ const n = pick();
169
+ out.push({ name: n, band: band.get(n), entry: merged[n] });
170
+ for (const m of inner.get(n)) {
171
+ indeg.set(m, indeg.get(m) - 1);
172
+ if (0 === indeg.get(m)) {
173
+ ready.push(m);
174
+ }
175
+ }
176
+ }
177
+ if (out.length !== names.length) {
178
+ const stuck = names.filter((n) => !out.some((o) => o.name === n)).sort();
179
+ throw new error_1.StationError('station_feature_order', 'feature ordering constraints form a cycle among [' +
180
+ stuck.join(', ') + ']');
181
+ }
182
+ return out;
183
+ }
184
+ /** A feature named in the config is one you are ASKING for, so an entry
185
+ * with no `active` is active. */
186
+ function active(entry) {
187
+ if (!ismap(entry)) {
188
+ return false !== entry;
189
+ }
190
+ return false !== entry.active;
191
+ }
192
+ /** Station's own position is PINNED and not orderable (§8.4): an order
193
+ * that moves `station` away from immediately-outside-the-base is
194
+ * REJECTED, not honoured.
195
+ *
196
+ * The pin is `innermost`, and the spelling matters. A chain composes
197
+ * with the FIRST binding outermost, so a pin written in sort terms —
198
+ * "station first" — would place every other wrapper between the adapter
199
+ * and the base: the exact inversion of the invariant, and one that
200
+ * would leave station's wire-truth events observing the wrong boundary
201
+ * while still looking ordered. */
202
+ function checkpin(ordered) {
203
+ const i = ordered.findIndex((o) => 'station' === o.name);
204
+ if (-1 === i) {
205
+ return;
206
+ }
207
+ const base = ordered.findIndex((o) => 'test' === o.name);
208
+ // station must be the innermost wrapper: last, or immediately
209
+ // outside the base-transport feature when one is active.
210
+ const want = -1 === base ? ordered.length - 1 : base - 1;
211
+ if (i !== want) {
212
+ throw new error_1.StationError('station_feature_order', 'an ordering would move `station` away from immediately outside ' +
213
+ 'the base transport; its position is pinned innermost and is not ' +
214
+ 'orderable (§8.4)');
215
+ }
216
+ }
217
+ /** Check a merged feature map against the SDK'S OWN DECLARATION.
218
+ *
219
+ * The schema arrives with the FACTORY rather than with a live client
220
+ * (§6.2), so this needs no construction and no network — which is what
221
+ * lets `check()` run it for every instance in CI.
222
+ *
223
+ * Derived from the descriptor, never hand-written, so it cannot drift:
224
+ * when a feature gains an option, the next regeneration teaches station
225
+ * about it with no station change.
226
+ *
227
+ * SCALARS AGREE BY CONSTRUCTION; COMPOUND OPTIONS ARE KIND-CHECKED, and
228
+ * that limit is real. An empty list default says nothing reliable about
229
+ * its element type and a nested map default says nothing about its
230
+ * value shapes, so `methods: [{}]` against a `['GET']` default is
231
+ * caught while `noProxy: []` accepts anything list-shaped. Closing that
232
+ * needs the feature model to declare an explicit option schema rather
233
+ * than only a default. */
234
+ function checkfeatures(merged, descriptor) {
235
+ const faults = [];
236
+ const declared = descriptor?.features || [];
237
+ const byname = new Map();
238
+ for (const f of declared) {
239
+ byname.set(String(f.name), f);
240
+ }
241
+ for (const name of Object.keys(merged).sort()) {
242
+ const spec = byname.get(name);
243
+ if (null == spec) {
244
+ faults.push({
245
+ code: 'station_feature_unknown',
246
+ feature: name,
247
+ message: 'the SDK has no feature "' + name + '"; it declares [' +
248
+ Array.from(byname.keys()).sort().join(', ') + ']',
249
+ });
250
+ continue;
251
+ }
252
+ const entry = merged[name];
253
+ if (!ismap(entry)) {
254
+ continue;
255
+ }
256
+ const defaults = ismap(spec.options) ? spec.options : {};
257
+ for (const key of Object.keys(entry).sort()) {
258
+ if (-1 !== exports.RESERVED_KEYS.indexOf(key)) {
259
+ continue;
260
+ }
261
+ if (!(key in defaults)) {
262
+ // THE CASE THAT ACTUALLY BITES: `retry.retires: 5` is accepted
263
+ // and silently ignored today, because makeOptions' feature spec
264
+ // is `$OPEN` per feature so the SDK cannot catch it and nothing
265
+ // else looks.
266
+ faults.push({
267
+ code: 'station_feature_option',
268
+ feature: name,
269
+ key,
270
+ message: 'feature "' + name + '" declares no option "' + key +
271
+ '"; it declares [' + Object.keys(defaults).sort().join(', ') + ']',
272
+ });
273
+ continue;
274
+ }
275
+ const want = kindof(defaults[key]);
276
+ const got = kindof(entry[key]);
277
+ if (want !== got) {
278
+ faults.push({
279
+ code: 'station_feature_option',
280
+ feature: name,
281
+ key,
282
+ message: 'feature "' + name + '" option "' + key + '" expects ' +
283
+ want + ', but found ' + got + ': ' + JSON.stringify(entry[key]),
284
+ });
285
+ }
286
+ }
287
+ }
288
+ return faults;
289
+ }
290
+ /** Compose the merged map into the ORDERED ARRAY FORM the constructor
291
+ * takes. No new seam: it is what `connect()` already does for station's
292
+ * own placement, with more in it. */
293
+ function composefeatures(ordered) {
294
+ return ordered.map((o) => {
295
+ const entry = ismap(o.entry) ? o.entry : {};
296
+ const out = { name: o.name, active: true };
297
+ for (const k of Object.keys(entry)) {
298
+ if (-1 !== exports.RESERVED_KEYS.indexOf(k)) {
299
+ continue;
300
+ }
301
+ out[k] = entry[k];
302
+ }
303
+ return out;
304
+ });
305
+ }
306
+ function kindof(v) {
307
+ if (null === v || undefined === v) {
308
+ return 'null';
309
+ }
310
+ if (Array.isArray(v)) {
311
+ return 'list';
312
+ }
313
+ if ('number' === typeof v) {
314
+ return 'number';
315
+ }
316
+ if ('object' === typeof v) {
317
+ return 'map';
318
+ }
319
+ return typeof v;
320
+ }
321
+ function ismap(v) {
322
+ return null != v && 'object' === typeof v && !Array.isArray(v);
323
+ }
324
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sourceRoot":"","sources":["../../src/feature.ts"],"names":[],"mappings":";AAAA;;;;;;sDAMsD;;;AAiCtD,sCAYC;AAID,wCAWC;AAmBD,kCAIC;AAkBD,oCAkEC;AAmBD,4BAcC;AA8BD,sCAyDC;AAKD,0CAUC;AA5SD,mCAAsC;AAEtC,wEAAwE;AACxE,mBAAmB;AACnB,wEAAwE;AAExE;kCACkC;AACrB,QAAA,aAAa,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;AAEhD;;;;;;;;;;;;;;;;;;;;kBAoBkB;AAClB,SAAgB,aAAa,CAAC,OAAc;IAC1C,MAAM,GAAG,GAA4B,EAAE,CAAA;IACvC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YAAC,SAAQ;QAAC,CAAC;QAC7B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;YACpC,MAAM,KAAK,GAAG,GAAG,CAAC,IAAI,CAAC,CAAA;YACvB,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;gBAAC,SAAQ;YAAC,CAAC;YAClD,kCAAkC;YAClC,GAAG,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,KAAK,EAAE,CAAA;QAClE,CAAC;IACH,CAAC;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CAAC,EAAE,CAAA;QAC3C,MAAM,GAAG,GAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAA;QAC/C,KAAK,MAAM,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACnC,IAAI,CAAC,CAAC,KAAK,qBAAa,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;gBAAC,SAAQ;YAAC,CAAC;YACjD,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAA;QACnB,CAAC;QACD,OAAO,GAAG,CAAA;IACZ,CAAC,CAAC,CAAA;AACJ,CAAC;AAED,SAAS,MAAM,CAAC,CAAM;IACpB,IAAI,IAAI,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QAAC,OAAO,MAAM,CAAA;IAAC,CAAC;IACpD,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC;QAAC,OAAO,MAAM,CAAA;IAAC,CAAC;IACvC,IAAI,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC;QAAC,OAAO,QAAQ,CAAA;IAAC,CAAC;IAC9C,IAAI,QAAQ,KAAK,OAAO,CAAC,EAAE,CAAC;QAAC,OAAO,KAAK,CAAA;IAAC,CAAC;IAC3C,OAAO,OAAO,CAAC,CAAA;AACjB,CAAC;AAED,SAAS,KAAK,CAAC,CAAM;IACnB,OAAO,IAAI,IAAI,CAAC,IAAI,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAA;AAChE,CAAC"}
@@ -0,0 +1,14 @@
1
+ export { Station, instanceRef, setConfigFileIO } from './Station';
2
+ export type { ConfigFileIO } from './Station';
3
+ export { provide, factoryFor, provided, resetFactories } from './factory';
4
+ export type { Factory, FactoryEntry } from './factory';
5
+ export { DEFAULT_EXPORT, camelify, checkPackage, factoryFromModule, loadAsync, loadSync, } from './loader';
6
+ export { adapterFeature, featureBinding } from './adapter';
7
+ export type { FeatureBinding } from './adapter';
8
+ export { StationError } from './error';
9
+ export { canonicalSerialize, envtoken, normalizeDescriptor, secretnameDefault, } from './descriptor';
10
+ export { placeholderFor } from './secrets';
11
+ export { refapi, resolveProfile, selectProfile } from './profilecore';
12
+ export type { ResolvedProfile } from './profilecore';
13
+ export { BLOCK_DEFAULTS, MERGE_SENSITIVE, PROFILE_DEFAULTS, configShape, normalizeConfig, validateConfig, } from './shape';
14
+ export type { Binding, Descriptor, PolicyBlock, Profile, ResolvedInstance, SdkBlock, StationConfig, StationEvent, StationOptions, } from './types';
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ // @voxgig/station - one control surface for outbound integrations.
3
+ //
4
+ // THE BROWSER ENTRY (§2.2, §17 Phase 1), selected by the `browser`
5
+ // condition in package.json `exports`. The same surface as `index.ts`
6
+ // MINUS the file-loading half - `loadConfig`, `findConfigFile` and
7
+ // `configScope` are node-only (`profile.ts`, the one module in this
8
+ // package with top-level `node:` imports) and are simply not here, so
9
+ // this entry's module graph pulls no `node:` builtin
10
+ // (`test/browser.test.ts` walks the compiled graph and asserts it).
11
+ //
12
+ // `Station.open()` on this entry takes `config` as an OBJECT - the
13
+ // pre-existing explicit-config path, which skips file loading entirely.
14
+ // With no `config` at all it behaves exactly as node does when no
15
+ // station.json exists: null config, repo-scoped. The ConfigFileIO seam
16
+ // stays unregistered here; a host that genuinely has a config store can
17
+ // register its own through `setConfigFileIO`.
18
+ //
19
+ // §2.2's honesty note stands: in the browser R1/R2 isolation does not
20
+ // exist - an injected credential is readable by page code and DevTools
21
+ // - so browser station is observability-only with app-held credentials
22
+ // until a same-origin proxy endpoint exists.
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.validateConfig = exports.normalizeConfig = exports.configShape = exports.PROFILE_DEFAULTS = exports.MERGE_SENSITIVE = exports.BLOCK_DEFAULTS = exports.selectProfile = exports.resolveProfile = exports.refapi = exports.placeholderFor = exports.secretnameDefault = exports.normalizeDescriptor = exports.envtoken = exports.canonicalSerialize = exports.StationError = exports.featureBinding = exports.adapterFeature = exports.loadSync = exports.loadAsync = exports.factoryFromModule = exports.checkPackage = exports.camelify = exports.DEFAULT_EXPORT = exports.resetFactories = exports.provided = exports.factoryFor = exports.provide = exports.setConfigFileIO = exports.instanceRef = exports.Station = void 0;
25
+ var Station_1 = require("./Station");
26
+ Object.defineProperty(exports, "Station", { enumerable: true, get: function () { return Station_1.Station; } });
27
+ Object.defineProperty(exports, "instanceRef", { enumerable: true, get: function () { return Station_1.instanceRef; } });
28
+ Object.defineProperty(exports, "setConfigFileIO", { enumerable: true, get: function () { return Station_1.setConfigFileIO; } });
29
+ var factory_1 = require("./factory");
30
+ Object.defineProperty(exports, "provide", { enumerable: true, get: function () { return factory_1.provide; } });
31
+ Object.defineProperty(exports, "factoryFor", { enumerable: true, get: function () { return factory_1.factoryFor; } });
32
+ Object.defineProperty(exports, "provided", { enumerable: true, get: function () { return factory_1.provided; } });
33
+ Object.defineProperty(exports, "resetFactories", { enumerable: true, get: function () { return factory_1.resetFactories; } });
34
+ var loader_1 = require("./loader");
35
+ Object.defineProperty(exports, "DEFAULT_EXPORT", { enumerable: true, get: function () { return loader_1.DEFAULT_EXPORT; } });
36
+ Object.defineProperty(exports, "camelify", { enumerable: true, get: function () { return loader_1.camelify; } });
37
+ Object.defineProperty(exports, "checkPackage", { enumerable: true, get: function () { return loader_1.checkPackage; } });
38
+ Object.defineProperty(exports, "factoryFromModule", { enumerable: true, get: function () { return loader_1.factoryFromModule; } });
39
+ Object.defineProperty(exports, "loadAsync", { enumerable: true, get: function () { return loader_1.loadAsync; } });
40
+ Object.defineProperty(exports, "loadSync", { enumerable: true, get: function () { return loader_1.loadSync; } });
41
+ var adapter_1 = require("./adapter");
42
+ Object.defineProperty(exports, "adapterFeature", { enumerable: true, get: function () { return adapter_1.adapterFeature; } });
43
+ Object.defineProperty(exports, "featureBinding", { enumerable: true, get: function () { return adapter_1.featureBinding; } });
44
+ var error_1 = require("./error");
45
+ Object.defineProperty(exports, "StationError", { enumerable: true, get: function () { return error_1.StationError; } });
46
+ var descriptor_1 = require("./descriptor");
47
+ Object.defineProperty(exports, "canonicalSerialize", { enumerable: true, get: function () { return descriptor_1.canonicalSerialize; } });
48
+ Object.defineProperty(exports, "envtoken", { enumerable: true, get: function () { return descriptor_1.envtoken; } });
49
+ Object.defineProperty(exports, "normalizeDescriptor", { enumerable: true, get: function () { return descriptor_1.normalizeDescriptor; } });
50
+ Object.defineProperty(exports, "secretnameDefault", { enumerable: true, get: function () { return descriptor_1.secretnameDefault; } });
51
+ var secrets_1 = require("./secrets");
52
+ Object.defineProperty(exports, "placeholderFor", { enumerable: true, get: function () { return secrets_1.placeholderFor; } });
53
+ var profilecore_1 = require("./profilecore");
54
+ Object.defineProperty(exports, "refapi", { enumerable: true, get: function () { return profilecore_1.refapi; } });
55
+ Object.defineProperty(exports, "resolveProfile", { enumerable: true, get: function () { return profilecore_1.resolveProfile; } });
56
+ Object.defineProperty(exports, "selectProfile", { enumerable: true, get: function () { return profilecore_1.selectProfile; } });
57
+ var shape_1 = require("./shape");
58
+ Object.defineProperty(exports, "BLOCK_DEFAULTS", { enumerable: true, get: function () { return shape_1.BLOCK_DEFAULTS; } });
59
+ Object.defineProperty(exports, "MERGE_SENSITIVE", { enumerable: true, get: function () { return shape_1.MERGE_SENSITIVE; } });
60
+ Object.defineProperty(exports, "PROFILE_DEFAULTS", { enumerable: true, get: function () { return shape_1.PROFILE_DEFAULTS; } });
61
+ Object.defineProperty(exports, "configShape", { enumerable: true, get: function () { return shape_1.configShape; } });
62
+ Object.defineProperty(exports, "normalizeConfig", { enumerable: true, get: function () { return shape_1.normalizeConfig; } });
63
+ Object.defineProperty(exports, "validateConfig", { enumerable: true, get: function () { return shape_1.validateConfig; } });
64
+ //# sourceMappingURL=index.browser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.browser.js","s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;AAAE,uGAAA,cAAc,OAAA"}
@@ -0,0 +1,14 @@
1
+ export { Station, instanceRef, setConfigFileIO } from './Station';
2
+ export type { ConfigFileIO } from './Station';
3
+ export { provide, factoryFor, provided, resetFactories } from './factory';
4
+ export type { Factory, FactoryEntry } from './factory';
5
+ export { DEFAULT_EXPORT, camelify, checkPackage, factoryFromModule, loadAsync, loadSync, } from './loader';
6
+ export { adapterFeature, featureBinding } from './adapter';
7
+ export type { FeatureBinding } from './adapter';
8
+ export { StationError } from './error';
9
+ export { canonicalSerialize, envtoken, normalizeDescriptor, secretnameDefault, } from './descriptor';
10
+ export { placeholderFor } from './secrets';
11
+ export { configScope, findConfigFile, loadConfig, refapi, resolveProfile, selectProfile, } from './profile';
12
+ export type { ResolvedProfile } from './profile';
13
+ export { BLOCK_DEFAULTS, MERGE_SENSITIVE, PROFILE_DEFAULTS, configShape, normalizeConfig, validateConfig, } from './shape';
14
+ export type { Binding, Descriptor, PolicyBlock, Profile, ResolvedInstance, SdkBlock, StationConfig, StationEvent, StationOptions, } from './types';
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ // @voxgig/station - one control surface for outbound integrations.
3
+ //
4
+ // THE NODE ENTRY. `index.browser.ts` is the browser condition's entry
5
+ // (§2.2, §17 Phase 1): same surface MINUS the file-loading half
6
+ // (loadConfig/findConfigFile/configScope) and this registration, which
7
+ // is what hands Station the node-only file half without Station itself
8
+ // importing a `node:` module.
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.validateConfig = exports.normalizeConfig = exports.configShape = exports.PROFILE_DEFAULTS = exports.MERGE_SENSITIVE = exports.BLOCK_DEFAULTS = exports.selectProfile = exports.resolveProfile = exports.refapi = exports.loadConfig = exports.findConfigFile = exports.configScope = exports.placeholderFor = exports.secretnameDefault = exports.normalizeDescriptor = exports.envtoken = exports.canonicalSerialize = exports.StationError = exports.featureBinding = exports.adapterFeature = exports.loadSync = exports.loadAsync = exports.factoryFromModule = exports.checkPackage = exports.camelify = exports.DEFAULT_EXPORT = exports.resetFactories = exports.provided = exports.factoryFor = exports.provide = exports.setConfigFileIO = exports.instanceRef = exports.Station = void 0;
11
+ const profile_1 = require("./profile");
12
+ const Station_1 = require("./Station");
13
+ (0, Station_1.setConfigFileIO)({ loadConfig: profile_1.loadConfig, configScope: profile_1.configScope });
14
+ var Station_2 = require("./Station");
15
+ Object.defineProperty(exports, "Station", { enumerable: true, get: function () { return Station_2.Station; } });
16
+ Object.defineProperty(exports, "instanceRef", { enumerable: true, get: function () { return Station_2.instanceRef; } });
17
+ Object.defineProperty(exports, "setConfigFileIO", { enumerable: true, get: function () { return Station_2.setConfigFileIO; } });
18
+ var factory_1 = require("./factory");
19
+ Object.defineProperty(exports, "provide", { enumerable: true, get: function () { return factory_1.provide; } });
20
+ Object.defineProperty(exports, "factoryFor", { enumerable: true, get: function () { return factory_1.factoryFor; } });
21
+ Object.defineProperty(exports, "provided", { enumerable: true, get: function () { return factory_1.provided; } });
22
+ Object.defineProperty(exports, "resetFactories", { enumerable: true, get: function () { return factory_1.resetFactories; } });
23
+ var loader_1 = require("./loader");
24
+ Object.defineProperty(exports, "DEFAULT_EXPORT", { enumerable: true, get: function () { return loader_1.DEFAULT_EXPORT; } });
25
+ Object.defineProperty(exports, "camelify", { enumerable: true, get: function () { return loader_1.camelify; } });
26
+ Object.defineProperty(exports, "checkPackage", { enumerable: true, get: function () { return loader_1.checkPackage; } });
27
+ Object.defineProperty(exports, "factoryFromModule", { enumerable: true, get: function () { return loader_1.factoryFromModule; } });
28
+ Object.defineProperty(exports, "loadAsync", { enumerable: true, get: function () { return loader_1.loadAsync; } });
29
+ Object.defineProperty(exports, "loadSync", { enumerable: true, get: function () { return loader_1.loadSync; } });
30
+ var adapter_1 = require("./adapter");
31
+ Object.defineProperty(exports, "adapterFeature", { enumerable: true, get: function () { return adapter_1.adapterFeature; } });
32
+ Object.defineProperty(exports, "featureBinding", { enumerable: true, get: function () { return adapter_1.featureBinding; } });
33
+ var error_1 = require("./error");
34
+ Object.defineProperty(exports, "StationError", { enumerable: true, get: function () { return error_1.StationError; } });
35
+ var descriptor_1 = require("./descriptor");
36
+ Object.defineProperty(exports, "canonicalSerialize", { enumerable: true, get: function () { return descriptor_1.canonicalSerialize; } });
37
+ Object.defineProperty(exports, "envtoken", { enumerable: true, get: function () { return descriptor_1.envtoken; } });
38
+ Object.defineProperty(exports, "normalizeDescriptor", { enumerable: true, get: function () { return descriptor_1.normalizeDescriptor; } });
39
+ Object.defineProperty(exports, "secretnameDefault", { enumerable: true, get: function () { return descriptor_1.secretnameDefault; } });
40
+ var secrets_1 = require("./secrets");
41
+ Object.defineProperty(exports, "placeholderFor", { enumerable: true, get: function () { return secrets_1.placeholderFor; } });
42
+ var profile_2 = require("./profile");
43
+ Object.defineProperty(exports, "configScope", { enumerable: true, get: function () { return profile_2.configScope; } });
44
+ Object.defineProperty(exports, "findConfigFile", { enumerable: true, get: function () { return profile_2.findConfigFile; } });
45
+ Object.defineProperty(exports, "loadConfig", { enumerable: true, get: function () { return profile_2.loadConfig; } });
46
+ Object.defineProperty(exports, "refapi", { enumerable: true, get: function () { return profile_2.refapi; } });
47
+ Object.defineProperty(exports, "resolveProfile", { enumerable: true, get: function () { return profile_2.resolveProfile; } });
48
+ Object.defineProperty(exports, "selectProfile", { enumerable: true, get: function () { return profile_2.selectProfile; } });
49
+ var shape_1 = require("./shape");
50
+ Object.defineProperty(exports, "BLOCK_DEFAULTS", { enumerable: true, get: function () { return shape_1.BLOCK_DEFAULTS; } });
51
+ Object.defineProperty(exports, "MERGE_SENSITIVE", { enumerable: true, get: function () { return shape_1.MERGE_SENSITIVE; } });
52
+ Object.defineProperty(exports, "PROFILE_DEFAULTS", { enumerable: true, get: function () { return shape_1.PROFILE_DEFAULTS; } });
53
+ Object.defineProperty(exports, "configShape", { enumerable: true, get: function () { return shape_1.configShape; } });
54
+ Object.defineProperty(exports, "normalizeConfig", { enumerable: true, get: function () { return shape_1.normalizeConfig; } });
55
+ Object.defineProperty(exports, "validateConfig", { enumerable: true, get: function () { return shape_1.validateConfig; } });
56
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";AAAA,mEAAmE;AACnE,EAAE;AACF,sEAAsE;AACtE,gEAAgE;AAChE,uEAAuE;AACvE,uEAAuE;AACvE,8BAA8B;;;AAE9B,uCAAmD;AACnD,uCAA2C;AAE3C,IAAA,yBAAe,EAAC,EAAE,UAAU,EAAV,oBAAU,EAAE,WAAW,EAAX,qBAAW,EAAE,CAAC,CAAA;AAE5C,qCAAiE;AAAxD,kGAAA,OAAO,OAAA;AAAE,sGAAA,WAAW,OAAA;AAAE,0GAAA,eAAe,OAAA;AAE9C,qCAAyE;AAAhE,kGAAA,OAAO,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,mGAAA,QAAQ,OAAA;AAAE,yGAAA,cAAc,OAAA;AAEtD,mCAEiB;AADf,wGAAA,cAAc,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAAE,sGAAA,YAAY,OAAA;AAAE,2GAAA,iBAAiB,OAAA;AAAE,mGAAA,SAAS,OAAA;AAAE,kGAAA,QAAQ,OAAA;AAEhF,qCAA0D;AAAjD,yGAAA,cAAc,OAAA;AAAE,yGAAA,cAAc,OAAA;AAEvC,iCAAsC;AAA7B,qGAAA,YAAY,OAAA;AACrB,2CAKqB;AAJnB,gHAAA,kBAAkB,OAAA;AAClB,sGAAA,QAAQ,OAAA;AACR,iHAAA,mBAAmB,OAAA;AACnB,+GAAA,iBAAiB,OAAA;AAEnB,qCAA0C;AAAjC,yGAAA,cAAc,OAAA;AACvB,qCAGkB;AAFhB,sGAAA,WAAW,OAAA;AAAE,yGAAA,cAAc,OAAA;AAAE,qGAAA,UAAU,OAAA;AAAE,iGAAA,MAAM,OAAA;AAAE,yGAAA,cAAc,OAAA;AAC/D,wGAAA,aAAa,OAAA;AAGf,iCAGgB;AAFd,uGAAA,cAAc,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,yGAAA,gBAAgB,OAAA;AACjD,oGAAA,WAAW,OAAA;AAAE,wGAAA,eAAe,OAAA;AAAE,uGAAA,cAAc,OAAA"}
@@ -0,0 +1,45 @@
1
+ import { Factory } from './factory';
2
+ /** The fixed alias every generated package exports.
3
+ *
4
+ * `export` defaults to this rather than to a derived class name because
5
+ * it is the same identifier in every generated package, where
6
+ * `camelify(slug) + 'SDK'` is a rule that has to be recomputed and can
7
+ * be wrong. The derived name is the SECOND attempt and an explicit
8
+ * `export` the third. */
9
+ export declare const DEFAULT_EXPORT = "SDK";
10
+ /** `stripe-eu` -> `StripeEu`, for the second-attempt export name. */
11
+ export declare function camelify(slug: string): string;
12
+ /** Only MODULE NAMES, resolved by the host language's ordinary
13
+ * resolution from the application root. Never a filesystem path, never
14
+ * a URL, never anything relative — a config file naming a path is a
15
+ * config file reaching outside the dependency graph it is allowed to
16
+ * name. */
17
+ export declare function checkPackage(api: string, pkg: string): string;
18
+ /** Build a `{construct, config}` pair from a module that self-registered
19
+ * nothing — the retrofit path for a package whose SDK predates the
20
+ * station feature. It is not descriptor-blind: a generated main module
21
+ * exports its constructor AND the `config` singleton beside it. */
22
+ export declare function factoryFromModule(api: string, mod: any, exportName?: string): Factory;
23
+ /** Synchronous load, for CommonJS. Returns true when the api has a
24
+ * factory afterwards — either because importing the package triggered
25
+ * self-registration, or because one was built from its exports. */
26
+ export declare function loadSync(api: string, pkg: string, exportName?: string): boolean;
27
+ /** The ESM preload behind `await station.load()`. Imports the package
28
+ * and fills the SAME table the synchronous path fills. */
29
+ /** A dynamic `import()` that SURVIVES THE COMMONJS EMIT.
30
+ *
31
+ * This package compiles with `module: "commonjs"`, and TypeScript
32
+ * rewrites a literal `import(pkg)` into a promise around `require(pkg)`
33
+ * — so `await station.load()` threw `ERR_REQUIRE_ESM` for exactly the
34
+ * ESM-only packages it exists to preload, leaving no working path to
35
+ * those SDKs at all. Verified against the emitted `dist/src/loader.js`,
36
+ * which read `mod = require(pkg)`.
37
+ *
38
+ * `new Function` is the seam the compiler does not look inside. It is
39
+ * deliberately the only one in this file, and it takes no caller input:
40
+ * `pkg` has already been through `checkPackage`, and the body is a
41
+ * constant. Changing the package to `module: "node16"` would fix it
42
+ * more cleanly and is a whole-package decision rather than a defect
43
+ * fix. */
44
+ export declare const nativeImport: (p: string) => Promise<any>;
45
+ export declare function loadAsync(api: string, pkg: string, exportName?: string): Promise<boolean>;