@fireweaveai/web-sdk 2.1.0 → 2.1.1-staging.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 (89) hide show
  1. package/README.md +105 -0
  2. package/dist/application/client.d.ts +120 -0
  3. package/dist/application/client.d.ts.map +1 -0
  4. package/dist/application/client.js +160 -0
  5. package/dist/application/client.js.map +1 -0
  6. package/dist/application/mode.d.ts +100 -0
  7. package/dist/application/mode.d.ts.map +1 -0
  8. package/dist/application/mode.js +99 -0
  9. package/dist/application/mode.js.map +1 -0
  10. package/dist/{adapter.d.ts → application/ports.d.ts} +19 -4
  11. package/dist/application/ports.d.ts.map +1 -0
  12. package/dist/application/ports.js +2 -0
  13. package/dist/application/ports.js.map +1 -0
  14. package/dist/{runtime.d.ts → application/runtime.d.ts} +15 -6
  15. package/dist/application/runtime.d.ts.map +1 -0
  16. package/dist/{runtime.js → application/runtime.js} +80 -27
  17. package/dist/application/runtime.js.map +1 -0
  18. package/dist/domain/context.d.ts +52 -0
  19. package/dist/domain/context.d.ts.map +1 -0
  20. package/dist/domain/context.js +68 -0
  21. package/dist/domain/context.js.map +1 -0
  22. package/dist/domain/errors.d.ts.map +1 -0
  23. package/dist/domain/errors.js.map +1 -0
  24. package/dist/domain/target.d.ts +3 -0
  25. package/dist/domain/target.d.ts.map +1 -0
  26. package/dist/domain/target.js +2 -0
  27. package/dist/domain/target.js.map +1 -0
  28. package/dist/domain/types.d.ts.map +1 -0
  29. package/dist/domain/types.js.map +1 -0
  30. package/dist/domain/validation.d.ts +129 -0
  31. package/dist/domain/validation.d.ts.map +1 -0
  32. package/dist/domain/validation.js +350 -0
  33. package/dist/domain/validation.js.map +1 -0
  34. package/dist/index.d.ts +37 -31
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +25 -21
  37. package/dist/index.js.map +1 -1
  38. package/dist/{adapters → infrastructure/adapters}/inmemory.d.ts +3 -3
  39. package/dist/infrastructure/adapters/inmemory.d.ts.map +1 -0
  40. package/dist/{adapters → infrastructure/adapters}/inmemory.js +1 -1
  41. package/dist/infrastructure/adapters/inmemory.js.map +1 -0
  42. package/dist/infrastructure/adapters/local.d.ts +80 -0
  43. package/dist/infrastructure/adapters/local.d.ts.map +1 -0
  44. package/dist/infrastructure/adapters/local.js +95 -0
  45. package/dist/infrastructure/adapters/local.js.map +1 -0
  46. package/dist/{adapters → infrastructure/adapters}/remote.d.ts +2 -2
  47. package/dist/infrastructure/adapters/remote.d.ts.map +1 -0
  48. package/dist/{adapters → infrastructure/adapters}/remote.js +9 -15
  49. package/dist/infrastructure/adapters/remote.js.map +1 -0
  50. package/dist/infrastructure/hosts.d.ts.map +1 -0
  51. package/dist/{hosts.js → infrastructure/hosts.js} +1 -1
  52. package/dist/infrastructure/hosts.js.map +1 -0
  53. package/package.json +16 -11
  54. package/dist/adapter.d.ts.map +0 -1
  55. package/dist/adapter.js +0 -2
  56. package/dist/adapter.js.map +0 -1
  57. package/dist/adapters/inmemory.d.ts.map +0 -1
  58. package/dist/adapters/inmemory.js.map +0 -1
  59. package/dist/adapters/local.d.ts +0 -38
  60. package/dist/adapters/local.d.ts.map +0 -1
  61. package/dist/adapters/local.js +0 -51
  62. package/dist/adapters/local.js.map +0 -1
  63. package/dist/adapters/remote.d.ts.map +0 -1
  64. package/dist/adapters/remote.js.map +0 -1
  65. package/dist/client.d.ts +0 -134
  66. package/dist/client.d.ts.map +0 -1
  67. package/dist/client.js +0 -0
  68. package/dist/client.js.map +0 -1
  69. package/dist/context.d.ts +0 -26
  70. package/dist/context.d.ts.map +0 -1
  71. package/dist/context.js +0 -106
  72. package/dist/context.js.map +0 -1
  73. package/dist/errors.d.ts.map +0 -1
  74. package/dist/errors.js.map +0 -1
  75. package/dist/hosts.d.ts.map +0 -1
  76. package/dist/hosts.js.map +0 -1
  77. package/dist/provider.d.ts +0 -39
  78. package/dist/provider.d.ts.map +0 -1
  79. package/dist/provider.js +0 -93
  80. package/dist/provider.js.map +0 -1
  81. package/dist/runtime.d.ts.map +0 -1
  82. package/dist/runtime.js.map +0 -1
  83. package/dist/types.d.ts.map +0 -1
  84. package/dist/types.js.map +0 -1
  85. /package/dist/{errors.d.ts → domain/errors.d.ts} +0 -0
  86. /package/dist/{errors.js → domain/errors.js} +0 -0
  87. /package/dist/{types.d.ts → domain/types.d.ts} +0 -0
  88. /package/dist/{types.js → domain/types.js} +0 -0
  89. /package/dist/{hosts.d.ts → infrastructure/hosts.d.ts} +0 -0
@@ -0,0 +1,350 @@
1
+ /**
2
+ * Fireweave web SDK validation — pure, total functions per
3
+ * spec/control-points.md "Validation, before any I/O" and spec/modes.md
4
+ * "Initialisation validation".
5
+ *
6
+ * Ported from sdks/node/src/domain/validation.ts (the reference
7
+ * implementation) — same five validators, same `Validated<T>` discipline,
8
+ * same malformed-key → FlagNotFound mapping. Reimplemented here rather than
9
+ * shared so the browser package keeps zero cross-package dependency to
10
+ * audit — the same reasoning ADR-0009 gives for duplicating types.ts/errors.ts
11
+ * extends to this module.
12
+ *
13
+ * Every read-path validator here (`validateControlPointKey`,
14
+ * `validateDefaultValue`, `validateContext`) returns `Validated<T>` instead
15
+ * of throwing. `FireweaveWebRuntime.evaluateSync` runs them, in the fixed
16
+ * order the spec names — key, default-vs-type, context, lifecycle — and
17
+ * degrades to the caller's default on the first failure; it NEVER throws
18
+ * (spec/control-points.md "Return discipline — never throw into a read
19
+ * path"). `validateInitOptions` is the one exception (spec/modes.md
20
+ * "Initialisation validation"): it still returns `Validated<T>` — mode.ts is
21
+ * what converts a failed result into the throw spec/modes.md requires.
22
+ *
23
+ * Note: unlike node, web's `FireweaveError` has no custom-message support —
24
+ * messages are FIXED per kind by design, because a browser error is visible
25
+ * in a devtools console on a machine this package does not control
26
+ * (errors.ts's own doc comment). So every branch below that would carry a
27
+ * distinct node message instead just uses the taxonomy's fixed message for
28
+ * its kind.
29
+ */
30
+ import { FireweaveError } from './errors.js';
31
+ const ok = (value) => ({ ok: true, value });
32
+ const fail = (error) => ({ ok: false, error });
33
+ // ---------------------------------------------------------------------------
34
+ // Rule 1 — validateControlPointKey (spec/control-points.md "Validation,
35
+ // before any I/O": "key — non-empty, ≤256 characters, no control characters")
36
+ // ---------------------------------------------------------------------------
37
+ /** C0 + C1 control characters (U+0000-U+001F, U+007F-U+009F). */
38
+ const CONTROL_CHARACTERS = new RegExp('[' + String.fromCharCode(0x00) + '-' + String.fromCharCode(0x1f) +
39
+ String.fromCharCode(0x7f) + '-' + String.fromCharCode(0x9f) + ']');
40
+ const MAX_CONTROL_POINT_KEY_LENGTH = 256;
41
+ /**
42
+ * key — non-empty, ≤256 characters, no control characters
43
+ * (spec/control-points.md rule 1, the first check in the fixed order).
44
+ *
45
+ * No taxonomy kind names "malformed key" explicitly (the return-discipline
46
+ * table's closest row is "key unknown to the backend" → FlagNotFound):
47
+ * controller-ruled interim mapping (mirrors node's domain/validation.ts
48
+ * verbatim) — the 15-kind taxonomy in errors.schema.json is frozen at
49
+ * exactly 15 entries, `InvalidContext` is textually scoped to the evaluation
50
+ * *context* (not the key), and the schema already maps another non-literal
51
+ * case — quota-limited responses — onto `FlagNotFound` rather than adding a
52
+ * kind for it. `FlagNotFound` is therefore the least-wrong existing kind,
53
+ * not a literal fit. Other-language implementations copying node as the
54
+ * reference SHOULD use the same mapping rather than each independently
55
+ * guessing a different one.
56
+ */
57
+ export function validateControlPointKey(key) {
58
+ if (typeof key !== 'string' || key.length === 0) {
59
+ return fail(new FireweaveError('FlagNotFound'));
60
+ }
61
+ if (key.length > MAX_CONTROL_POINT_KEY_LENGTH) {
62
+ return fail(new FireweaveError('FlagNotFound'));
63
+ }
64
+ if (CONTROL_CHARACTERS.test(key)) {
65
+ return fail(new FireweaveError('FlagNotFound'));
66
+ }
67
+ return ok(key);
68
+ }
69
+ /**
70
+ * Whether `value` matches the shape `expected` names. Shared by
71
+ * {@link validateDefaultValue} (the caller's default, before any read) and
72
+ * `FireweaveWebRuntime.evaluateSync`'s post-cache-lookup check (the backend's
73
+ * resolved value, from the prefetched cache) — same predicate, two different
74
+ * inputs.
75
+ */
76
+ export function matchesExpectedType(value, expected) {
77
+ switch (expected) {
78
+ case 'boolean':
79
+ return typeof value === 'boolean';
80
+ case 'string':
81
+ return typeof value === 'string';
82
+ case 'number':
83
+ return typeof value === 'number';
84
+ case 'object':
85
+ return typeof value === 'object' && value !== null;
86
+ }
87
+ }
88
+ /**
89
+ * default vs type — e.g. `getBooleanValue` with a non-boolean default is
90
+ * TypeMismatch (spec/control-points.md rule 2, checked before any read).
91
+ */
92
+ export function validateDefaultValue(expectedType, defaultValue) {
93
+ if (!matchesExpectedType(defaultValue, expectedType)) {
94
+ return fail(new FireweaveError('TypeMismatch'));
95
+ }
96
+ return ok(defaultValue);
97
+ }
98
+ // ---------------------------------------------------------------------------
99
+ // validateTargetingKey (spec/control-points.md "Context": targetingKey)
100
+ // ---------------------------------------------------------------------------
101
+ /**
102
+ * targetingKey: "An SDK MUST NOT invent one: a missing targeting key is
103
+ * InvalidContext where the evaluation needs it, never a generated anonymous
104
+ * id" (spec/control-points.md "Context"). `required` is call-site policy —
105
+ * the remote adapter always requires one for `prefetch`/`registerTarget`; the
106
+ * generic context pipeline ({@link validateContext}) only does when
107
+ * `ContextPolicy.requireTargetingKey` opts in (unset by default here — web's
108
+ * targetingKey requirement is enforced at the remote adapter, not the
109
+ * general-purpose context validator every read runs).
110
+ */
111
+ export function validateTargetingKey(targetingKey, required) {
112
+ if (required && (targetingKey === undefined || targetingKey === '')) {
113
+ return fail(new FireweaveError('InvalidContext', { openFeatureErrorCode: 'TARGETING_KEY_MISSING' }));
114
+ }
115
+ return ok(targetingKey);
116
+ }
117
+ // ---------------------------------------------------------------------------
118
+ // Rule 3 — validateContext (spec/control-points.md rule 3: "context — depth,
119
+ // key count, value size, reserved keys (evaluation-context.schema.json)")
120
+ // ---------------------------------------------------------------------------
121
+ /**
122
+ * UTF-8 byte length. `TextEncoder` rather than `Buffer.byteLength` — `Buffer`
123
+ * does not exist in a browser at all (browser-portability.test.ts pins this).
124
+ */
125
+ const utf8Encoder = new TextEncoder();
126
+ const byteLength = (s) => utf8Encoder.encode(s).length;
127
+ /**
128
+ * Sentinel returned (never thrown) when `deepCopyJson` walks back into an
129
+ * object already on the current recursion path — an actual reference cycle,
130
+ * not merely the same object shared by two sibling branches (which is legal
131
+ * and handled by backtracking `seen.delete(...)` below). Untyped caller
132
+ * input is `unknown`, so a circular attribute value is reachable from a
133
+ * caller today; without this, recursion never terminates and crashes with
134
+ * `RangeError: Maximum call stack size exceeded` — exactly the kind of throw
135
+ * a "before any I/O" validator must not allow (spec/control-points.md
136
+ * "Return discipline — never throw into a read path"). Module-local: never
137
+ * returned across this file's public surface, only used to fail
138
+ * `validateContext` closed as `InvalidContext`.
139
+ */
140
+ const CYCLIC = Symbol('fireweave.cyclicJson');
141
+ function deepCopyJson(value, seen = new WeakSet()) {
142
+ if (value === null || typeof value === 'string' || typeof value === 'boolean' || typeof value === 'number') {
143
+ return value;
144
+ }
145
+ if (Array.isArray(value)) {
146
+ if (seen.has(value))
147
+ return CYCLIC;
148
+ seen.add(value);
149
+ const out = [];
150
+ for (const v of value) {
151
+ const copied = deepCopyJson(v, seen);
152
+ if (copied === CYCLIC)
153
+ return CYCLIC;
154
+ out.push(copied);
155
+ }
156
+ seen.delete(value);
157
+ return out;
158
+ }
159
+ if (typeof value === 'object') {
160
+ if (seen.has(value))
161
+ return CYCLIC;
162
+ seen.add(value);
163
+ const out = {};
164
+ for (const [k, v] of Object.entries(value)) {
165
+ if (v !== undefined) {
166
+ const copied = deepCopyJson(v, seen);
167
+ if (copied === CYCLIC)
168
+ return CYCLIC;
169
+ out[k] = copied;
170
+ }
171
+ }
172
+ seen.delete(value);
173
+ return out;
174
+ }
175
+ return null;
176
+ }
177
+ /**
178
+ * Cycle-safe defensively: `nestingDepth` only ever runs on `deepCopyJson`'s
179
+ * own output today, which is guaranteed acyclic by construction (it builds
180
+ * fresh containers, never back-references). Guarded anyway per the same
181
+ * "must be genuinely total" reasoning as `deepCopyJson`. A detected cycle
182
+ * returns `Infinity`, which always exceeds `limits.maxNestingDepth` and fails
183
+ * closed through the existing bound check below — no new failure path.
184
+ */
185
+ function nestingDepth(value, seen = new WeakSet()) {
186
+ if (value === null || typeof value !== 'object')
187
+ return 0;
188
+ if (seen.has(value))
189
+ return Infinity;
190
+ seen.add(value);
191
+ let max = 0;
192
+ const children = Array.isArray(value) ? value : Object.values(value);
193
+ for (const child of children) {
194
+ const d = nestingDepth(child, seen);
195
+ if (d > max)
196
+ max = d;
197
+ }
198
+ seen.delete(value);
199
+ return max + 1;
200
+ }
201
+ const invalidContext = () => new FireweaveError('InvalidContext');
202
+ /** groups/groupProperties carriers: canonical fireweave.* spelling first, then the plain alias. */
203
+ function extractSpecialKey(attributes, canonicalKey, aliasKey) {
204
+ if (canonicalKey in attributes)
205
+ return attributes[canonicalKey];
206
+ if (aliasKey in attributes)
207
+ return attributes[aliasKey];
208
+ return undefined;
209
+ }
210
+ /**
211
+ * context — depth, key count, value size, reserved keys
212
+ * (evaluation-context.schema.json) (spec/control-points.md rule 3). Also
213
+ * enforces `policy.requireTargetingKey` via {@link validateTargetingKey}, and
214
+ * — on success — extracts `groups`/`groupProperties` the same way the former
215
+ * `canonicalizeContext` did.
216
+ *
217
+ * `groups`/`groupProperties` (and their `fireweave.*` aliases) are pulled out
218
+ * BEFORE the attribute-count/size limit checks run, matching the pre-existing
219
+ * behaviour this module replaces: they are not ordinary attributes and were
220
+ * never counted against those limits.
221
+ *
222
+ * `merged` is the already-merged (global → invocation) raw input; merging
223
+ * itself (`mergeContexts`) lives in context.ts and carries no validation
224
+ * concerns of its own.
225
+ */
226
+ export function validateContext(merged, policy) {
227
+ const { limits } = policy;
228
+ const rawAttributes = { ...merged.attributes };
229
+ const rawGroups = extractSpecialKey(rawAttributes, 'fireweave.groups', 'groups');
230
+ const rawGroupProperties = extractSpecialKey(rawAttributes, 'fireweave.groupProperties', 'groupProperties');
231
+ delete rawAttributes['fireweave.groups'];
232
+ delete rawAttributes['groups'];
233
+ delete rawAttributes['fireweave.groupProperties'];
234
+ delete rawAttributes['groupProperties'];
235
+ const copied = deepCopyJson(rawAttributes);
236
+ if (copied === CYCLIC) {
237
+ return fail(invalidContext());
238
+ }
239
+ const attributes = copied;
240
+ const keys = Object.keys(attributes);
241
+ if (keys.length > limits.maxAttributeCount) {
242
+ return fail(invalidContext());
243
+ }
244
+ for (const key of keys) {
245
+ if (byteLength(key) > limits.maxKeyBytes) {
246
+ return fail(invalidContext());
247
+ }
248
+ }
249
+ for (const key of keys) {
250
+ const value = attributes[key];
251
+ if (byteLength(JSON.stringify(value ?? null)) > limits.maxValueBytes) {
252
+ return fail(invalidContext());
253
+ }
254
+ }
255
+ for (const key of keys) {
256
+ const value = attributes[key];
257
+ if (value !== undefined && nestingDepth(value) > limits.maxNestingDepth) {
258
+ return fail(invalidContext());
259
+ }
260
+ }
261
+ const serialized = JSON.stringify({ targetingKey: merged.targetingKey, attributes });
262
+ if (byteLength(serialized) > limits.maxSerializedBytes) {
263
+ return fail(invalidContext());
264
+ }
265
+ for (const key of keys) {
266
+ if (policy.reservedAttributeKeys.includes(key)) {
267
+ return fail(invalidContext());
268
+ }
269
+ }
270
+ const targetingKeyResult = validateTargetingKey(merged.targetingKey, policy.requireTargetingKey);
271
+ if (!targetingKeyResult.ok)
272
+ return targetingKeyResult;
273
+ let groups;
274
+ if (rawGroups !== undefined) {
275
+ const g = deepCopyJson(rawGroups);
276
+ if (g !== CYCLIC && g !== null && typeof g === 'object' && !Array.isArray(g)) {
277
+ const entries = Object.entries(g);
278
+ if (entries.every(([, v]) => typeof v === 'string')) {
279
+ groups = Object.fromEntries(entries);
280
+ }
281
+ }
282
+ }
283
+ let groupProperties;
284
+ if (rawGroupProperties !== undefined) {
285
+ const gp = deepCopyJson(rawGroupProperties);
286
+ if (gp !== CYCLIC && gp !== null && typeof gp === 'object' && !Array.isArray(gp)) {
287
+ groupProperties = gp;
288
+ }
289
+ }
290
+ const canonical = {
291
+ attributes,
292
+ ...(merged.targetingKey !== undefined ? { targetingKey: merged.targetingKey } : {}),
293
+ ...(groups !== undefined ? { groups } : {}),
294
+ ...(groupProperties !== undefined ? { groupProperties } : {}),
295
+ };
296
+ return ok(canonical);
297
+ }
298
+ /**
299
+ * Throwing wrapper around {@link validateContext}, kept for callers that
300
+ * genuinely want a throw (`FireweaveWebRuntime.refresh`, which is already
301
+ * inside its own try/catch feeding lifecycle state — see runtime.ts). Read
302
+ * paths do not use this — they call {@link validateContext} directly so a
303
+ * failure degrades instead of throwing.
304
+ */
305
+ export function canonicalizeContext(merged, policy) {
306
+ const result = validateContext(merged, policy);
307
+ if (!result.ok)
308
+ throw result.error;
309
+ return result.value;
310
+ }
311
+ // ---------------------------------------------------------------------------
312
+ // validateInitOptions (spec/modes.md "Initialisation validation")
313
+ // ---------------------------------------------------------------------------
314
+ /** "missing" and "blank" collapse to one check: not a non-empty string. */
315
+ const isBlank = (value) => typeof value !== 'string' || value.trim().length === 0;
316
+ const configError = () => new FireweaveError('Configuration');
317
+ /**
318
+ * Initialisation-validation table (spec/modes.md), rows 1, 2 and 4:
319
+ * - `mode` absent or unrecognised
320
+ * - `mode: 'remote'` with `apiKey` or `apiUrl` missing/blank
321
+ * - `mode: 'local'` with credentials supplied (a config half-migrated from
322
+ * remote to local reads as neither, silently — reject it instead)
323
+ *
324
+ * Row 3 ("apiUrl fails the host allowlist") is intentionally NOT checked
325
+ * here — mode.ts validates it directly via `assertHostAllowed` before
326
+ * calling into the (deliberately non-throwing) runtime; see mode.ts's module
327
+ * doc comment for why web cannot rely on the runtime the way node does.
328
+ */
329
+ export function validateInitOptions(options) {
330
+ const mode = options?.mode;
331
+ if (mode !== 'local' && mode !== 'remote') {
332
+ return fail(configError());
333
+ }
334
+ // Runtime-only guard: a config object half-migrated from remote to local
335
+ // can carry apiKey/apiUrl even though the local-mode type declares
336
+ // neither — TypeScript's excess-property check only fires on a fresh
337
+ // object literal, not on a variable assembled elsewhere and passed in.
338
+ const credentials = options;
339
+ if (mode === 'remote') {
340
+ if (isBlank(credentials.apiKey) || isBlank(credentials.apiUrl)) {
341
+ return fail(configError());
342
+ }
343
+ return ok(options);
344
+ }
345
+ if (!isBlank(credentials.apiKey) || !isBlank(credentials.apiUrl)) {
346
+ return fail(configError());
347
+ }
348
+ return ok(options);
349
+ }
350
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/domain/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAO7C,MAAM,EAAE,GAAG,CAAI,KAAQ,EAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AAChE,MAAM,IAAI,GAAG,CAAI,KAAqB,EAAgB,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;AAEhF,8EAA8E;AAC9E,wEAAwE;AACxE,8EAA8E;AAC9E,8EAA8E;AAE9E,iEAAiE;AACjE,MAAM,kBAAkB,GAAG,IAAI,MAAM,CACnC,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC;IACjE,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,GAAG,CAClE,CAAC;AAEF,MAAM,4BAA4B,GAAG,GAAG,CAAC;AAEzC;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAW;IACjD,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChD,OAAO,IAAI,CAAC,IAAI,cAAc,CAA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,CAAC,CAAC;IAC7B,CAAC;IACD,yEAAyE;IACzE,mEAAmE;IACnE,qEAAqE;IACrE,uEAAuE;IACvE,MAAM,WAAW,GAAG,OAA4D,CAAC;IACjF,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;QAC7B,CAAC;QACD,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IACD,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,CAAC;QACjE,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC;IAC7B,CAAC;IACD,OAAO,EAAE,CAAC,OAAO,CAAC,CAAC;AACrB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,40 +6,46 @@
6
6
  * shapes at the door. Credentials are passed in explicitly by the embedding app.
7
7
  *
8
8
  * ```ts
9
- * import { OpenFeature } from '@openfeature/web-sdk';
10
- * import {
11
- * FireweaveRemoteWebAdapter,
12
- * FireweaveWebProvider,
13
- * FireweaveWebRuntime,
14
- * } from '@fireweaveai/web-sdk';
9
+ * import { initFireweave } from '@fireweaveai/web-sdk';
15
10
  *
16
- * const runtime = new FireweaveWebRuntime(
17
- * new FireweaveRemoteWebAdapter({ apiUrl, apiKey }),
18
- * { globalContext: { targetingKey: 'anonymous' } }
19
- * );
20
- * await OpenFeature.setProviderAndWait(new FireweaveWebProvider(runtime));
11
+ * const fw = await initFireweave({
12
+ * mode: 'remote',
13
+ * apiKey,
14
+ * apiUrl,
15
+ * context: { targetingKey: 'anonymous' },
16
+ * });
21
17
  *
22
18
  * // Reads are SYNCHRONOUS — no await, safe inside render.
23
- * const on = OpenFeature.getClient().getBooleanValue('new-checkout', false);
19
+ * const on = fw.controlPoints.getBooleanValue('new-checkout', false);
24
20
  * ```
21
+ *
22
+ * `src/` is layered domain/ · application/ · infrastructure/
23
+ * (test/unit/architecture-layers.test.ts guards the boundary): `domain/` is
24
+ * pure data + validation with no outward imports; `application/` wires
25
+ * domain types into the runtime/client surface, with `mode.ts` as the sole
26
+ * composition root allowed to reach into `infrastructure/`; `infrastructure/`
27
+ * holds the concrete adapters and the host allowlist.
25
28
  */
26
- export { FireweaveError, ERROR_TAXONOMY, isFireweaveError, } from './errors.js';
27
- export type { FireweaveErrorKind, FireweaveErrorOptions, OpenFeatureErrorCode, ErrorKindSpec, } from './errors.js';
28
- export type { JsonValue, FlagValueType, Decision, DecisionReason, CanonicalContext, LifecycleState, Signal, SignalKind, Exposure, ReleaseContext, ReleaseState, Capabilities, } from './types.js';
29
- export { DEFAULT_CONTEXT_LIMITS, DEFAULT_RESERVED_ATTRIBUTE_KEYS, canonicalizeContext, mergeContexts, } from './context.js';
30
- export type { ContextInput, ContextLimits } from './context.js';
31
- export { DEFAULT_ALLOWED_HOSTS, assertHostAllowed, assertNotSecretKey, isLoopbackHostname, } from './hosts.js';
32
- export type { WebBackendAdapter, AdapterResolution, AdapterRuntimeFeatures, PrefetchOptions, PrefetchResult, RegisterTargetOptions, RegisterTargetResult, TargetKind, } from './adapter.js';
33
- export { FireweaveRemoteWebAdapter } from './adapters/remote.js';
34
- export type { FireweaveRemoteWebAdapterOptions, FireweaveFetchLike, } from './adapters/remote.js';
35
- export { InMemoryWebAdapter } from './adapters/inmemory.js';
36
- export type { InMemoryWebAdapterOptions, InMemoryFlagDefinition, InMemoryFault, } from './adapters/inmemory.js';
37
- export { FireweaveLocalWebAdapter } from './adapters/local.js';
38
- export type { FireweaveLocalWebAdapterOptions } from './adapters/local.js';
39
- export { FireweaveWebRuntime, DEFAULT_FLAGS_READY_TIMEOUT_MS } from './runtime.js';
40
- export type { FireweaveWebRuntimeConfig, ExpectedFlagType } from './runtime.js';
41
- export { FireweaveWebProvider } from './provider.js';
42
- export type { FireweaveWebProviderOptions } from './provider.js';
43
- export { FireweaveWebClient, WebControlPointsApi, WebExposuresApi, WebSignalsApi, WebReleasesApi, DEFAULT_SIGNAL_ATTRIBUTE_ALLOWLIST, } from './client.js';
44
- export type { FireweaveWebClientOptions, ExtensionResult, ReleaseResult } from './client.js';
29
+ export { FireweaveError, ERROR_TAXONOMY, isFireweaveError } from './domain/errors.js';
30
+ export type { FireweaveErrorKind, FireweaveErrorOptions, OpenFeatureErrorCode, ErrorKindSpec } from './domain/errors.js';
31
+ export type { JsonValue, FlagValueType, Decision, DecisionReason, CanonicalContext, LifecycleState, Signal, SignalKind, Exposure, ReleaseContext, ReleaseState, Capabilities, } from './domain/types.js';
32
+ export { DEFAULT_CONTEXT_LIMITS, DEFAULT_RESERVED_ATTRIBUTE_KEYS, mergeContexts } from './domain/context.js';
33
+ export type { ContextInput, ContextLimits, ContextPolicy } from './domain/context.js';
34
+ export { canonicalizeContext, matchesExpectedType, validateContext, validateControlPointKey, validateDefaultValue, validateTargetingKey, validateInitOptions, } from './domain/validation.js';
35
+ export type { Validated } from './domain/validation.js';
36
+ export type { TargetKind } from './domain/target.js';
37
+ export { DEFAULT_ALLOWED_HOSTS, assertHostAllowed, assertNotSecretKey, isLoopbackHostname } from './infrastructure/hosts.js';
38
+ export type { WebBackendAdapter, AdapterResolution, AdapterRuntimeFeatures, PrefetchOptions, PrefetchResult, RegisterTargetOptions, RegisterTargetResult, } from './application/ports.js';
39
+ export { FireweaveRemoteWebAdapter } from './infrastructure/adapters/remote.js';
40
+ export type { FireweaveRemoteWebAdapterOptions, FireweaveFetchLike } from './infrastructure/adapters/remote.js';
41
+ export { InMemoryWebAdapter } from './infrastructure/adapters/inmemory.js';
42
+ export type { InMemoryWebAdapterOptions, InMemoryFlagDefinition, InMemoryFault } from './infrastructure/adapters/inmemory.js';
43
+ export { FireweaveLocalWebAdapter } from './infrastructure/adapters/local.js';
44
+ export type { FireweaveLocalWebAdapterOptions, LocalRegisteredTarget } from './infrastructure/adapters/local.js';
45
+ export { FireweaveWebRuntime, DEFAULT_FLAGS_READY_TIMEOUT_MS } from './application/runtime.js';
46
+ export type { FireweaveWebRuntimeConfig, ExpectedFlagType } from './application/runtime.js';
47
+ export { FireweaveWebClient, WebControlPointsApi } from './application/client.js';
48
+ export type { FireweaveWebClientOptions, ExtensionResult, EvaluateOptions } from './application/client.js';
49
+ export { initFireweave } from './application/mode.js';
50
+ export type { InitFireweaveOptions, InitFireweaveLocalOptions, InitFireweaveRemoteOptions } from './application/mode.js';
45
51
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,SAAS,EACT,aAAa,EACb,QAAQ,EACR,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,MAAM,EACN,UAAU,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,sBAAsB,EACtB,+BAA+B,EAC/B,mBAAmB,EACnB,aAAa,GACd,MAAM,cAAc,CAAC;AACtB,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAEhE,OAAO,EACL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,GACnB,MAAM,YAAY,CAAC;AAEpB,YAAY,EACV,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,UAAU,GACX,MAAM,cAAc,CAAC;AAEtB,OAAO,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eAAe,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE3G,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,YAAY,EAAE,oBAAoB,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -6,30 +6,34 @@
6
6
  * shapes at the door. Credentials are passed in explicitly by the embedding app.
7
7
  *
8
8
  * ```ts
9
- * import { OpenFeature } from '@openfeature/web-sdk';
10
- * import {
11
- * FireweaveRemoteWebAdapter,
12
- * FireweaveWebProvider,
13
- * FireweaveWebRuntime,
14
- * } from '@fireweaveai/web-sdk';
9
+ * import { initFireweave } from '@fireweaveai/web-sdk';
15
10
  *
16
- * const runtime = new FireweaveWebRuntime(
17
- * new FireweaveRemoteWebAdapter({ apiUrl, apiKey }),
18
- * { globalContext: { targetingKey: 'anonymous' } }
19
- * );
20
- * await OpenFeature.setProviderAndWait(new FireweaveWebProvider(runtime));
11
+ * const fw = await initFireweave({
12
+ * mode: 'remote',
13
+ * apiKey,
14
+ * apiUrl,
15
+ * context: { targetingKey: 'anonymous' },
16
+ * });
21
17
  *
22
18
  * // Reads are SYNCHRONOUS — no await, safe inside render.
23
- * const on = OpenFeature.getClient().getBooleanValue('new-checkout', false);
19
+ * const on = fw.controlPoints.getBooleanValue('new-checkout', false);
24
20
  * ```
21
+ *
22
+ * `src/` is layered domain/ · application/ · infrastructure/
23
+ * (test/unit/architecture-layers.test.ts guards the boundary): `domain/` is
24
+ * pure data + validation with no outward imports; `application/` wires
25
+ * domain types into the runtime/client surface, with `mode.ts` as the sole
26
+ * composition root allowed to reach into `infrastructure/`; `infrastructure/`
27
+ * holds the concrete adapters and the host allowlist.
25
28
  */
26
- export { FireweaveError, ERROR_TAXONOMY, isFireweaveError, } from './errors.js';
27
- export { DEFAULT_CONTEXT_LIMITS, DEFAULT_RESERVED_ATTRIBUTE_KEYS, canonicalizeContext, mergeContexts, } from './context.js';
28
- export { DEFAULT_ALLOWED_HOSTS, assertHostAllowed, assertNotSecretKey, isLoopbackHostname, } from './hosts.js';
29
- export { FireweaveRemoteWebAdapter } from './adapters/remote.js';
30
- export { InMemoryWebAdapter } from './adapters/inmemory.js';
31
- export { FireweaveLocalWebAdapter } from './adapters/local.js';
32
- export { FireweaveWebRuntime, DEFAULT_FLAGS_READY_TIMEOUT_MS } from './runtime.js';
33
- export { FireweaveWebProvider } from './provider.js';
34
- export { FireweaveWebClient, WebControlPointsApi, WebExposuresApi, WebSignalsApi, WebReleasesApi, DEFAULT_SIGNAL_ATTRIBUTE_ALLOWLIST, } from './client.js';
29
+ export { FireweaveError, ERROR_TAXONOMY, isFireweaveError } from './domain/errors.js';
30
+ export { DEFAULT_CONTEXT_LIMITS, DEFAULT_RESERVED_ATTRIBUTE_KEYS, mergeContexts } from './domain/context.js';
31
+ export { canonicalizeContext, matchesExpectedType, validateContext, validateControlPointKey, validateDefaultValue, validateTargetingKey, validateInitOptions, } from './domain/validation.js';
32
+ export { DEFAULT_ALLOWED_HOSTS, assertHostAllowed, assertNotSecretKey, isLoopbackHostname } from './infrastructure/hosts.js';
33
+ export { FireweaveRemoteWebAdapter } from './infrastructure/adapters/remote.js';
34
+ export { InMemoryWebAdapter } from './infrastructure/adapters/inmemory.js';
35
+ export { FireweaveLocalWebAdapter } from './infrastructure/adapters/local.js';
36
+ export { FireweaveWebRuntime, DEFAULT_FLAGS_READY_TIMEOUT_MS } from './application/runtime.js';
37
+ export { FireweaveWebClient, WebControlPointsApi } from './application/client.js';
38
+ export { initFireweave } from './application/mode.js';
35
39
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,OAAO,EACL,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAuBrB,OAAO,EACL,sBA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AE,mBAAmB,EAAE,8BAA8B,EAAE,MAAM,0BAA0B,CAAC;AAG/F,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAGlF,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC"}
@@ -5,9 +5,9 @@
5
5
  * injection exists so the conformance suite can drive the error taxonomy
6
6
  * without a network or a stub server.
7
7
  */
8
- import { type FireweaveErrorKind } from '../errors.js';
9
- import type { AdapterResolution, AdapterRuntimeFeatures, PrefetchOptions, PrefetchResult, WebBackendAdapter } from '../adapter.js';
10
- import type { CanonicalContext, Exposure, FlagValueType, JsonValue, Signal } from '../types.js';
8
+ import { type FireweaveErrorKind } from '../../domain/errors.js';
9
+ import type { AdapterResolution, AdapterRuntimeFeatures, PrefetchOptions, PrefetchResult, WebBackendAdapter } from '../../application/ports.js';
10
+ import type { CanonicalContext, Exposure, FlagValueType, JsonValue, Signal } from '../../domain/types.js';
11
11
  export interface InMemoryFlagDefinition {
12
12
  readonly type: FlagValueType;
13
13
  readonly enabled: boolean;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inmemory.d.ts","sourceRoot":"","sources":["../../../src/infrastructure/adapters/inmemory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAkB,KAAK,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACjF,OAAO,KAAK,EACV,iBAAiB,EACjB,sBAAsB,EACtB,eAAe,EACf,cAAc,EACd,iBAAiB,EAClB,MAAM,4BAA4B,CAAC;AACpC,OAAO,KAAK,EAAE,gBAAgB,EAAE,QAAQ,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAE1G,MAAM,WAAW,sBAAsB;IACrC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QA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Q,EAAE;IAInC,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAIlC,UAAU,IAAI,SAAS,MAAM,EAAE;IAIzB,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAItB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B,QAAQ,IAAI,OAAO;IAInB,QAAQ,IAAI,sBAAsB;CAUnC"}
@@ -5,7 +5,7 @@
5
5
  * injection exists so the conformance suite can drive the error taxonomy
6
6
  * without a network or a stub server.
7
7
  */
8
- import { FireweaveError } from '../errors.js';
8
+ import { FireweaveError } from '../../domain/errors.js';
9
9
  export class InMemoryWebAdapter {
10
10
  name = 'inmemory';
11
11
  flags;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inmemory.js","sourceRoot":"","sources":["../../../src/infrastructure/adapters/inmemory.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,cAAc,EAA2B,MAAM,wBAAwB,CAAC;AAgCjF,MAAM,OAAO,kBAAkB;IACpB,IAAI,GAAG,UAAmB,CAAC;IAE5B,KAAK,CAAsC;IAC3C,KAAK,CAA4B;IACxB,SAAS,GAAe,EAAE,CAAC;IAC3B,OAAO,GAAa,EAAE,CAAC;IAChC,MAAM,GAAG,KAAK,CAAC;IAEvB,YAAY,UAAqC,EAAE;QACjD,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAC7B,CAAC;IAED,QAAQ,CAAC,KAA6C;QACpD,IAAI,CAAC,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAC9C,CAAC;IAED,QAAQ,CAAC,KAAgC;QACvC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED,K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