@datadog/openfeature-node-server 2.7.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +220 -1
- package/cjs/configuration/client-fingerprint.d.ts +3 -0
- package/cjs/configuration/client-fingerprint.d.ts.map +1 -0
- package/cjs/configuration/client-fingerprint.js +30 -0
- package/cjs/configuration/client-fingerprint.js.map +1 -0
- package/cjs/configuration/configuration-fetch.d.ts +21 -0
- package/cjs/configuration/configuration-fetch.d.ts.map +1 -0
- package/cjs/configuration/configuration-fetch.js +125 -0
- package/cjs/configuration/configuration-fetch.js.map +1 -0
- package/cjs/configuration/evaluation.d.ts +1 -1
- package/cjs/configuration/evaluation.d.ts.map +1 -1
- package/cjs/configuration/evaluation.js +2 -2
- package/cjs/configuration/evaluation.js.map +1 -1
- package/cjs/configuration/fetch-precomputed-configuration.d.ts +28 -0
- package/cjs/configuration/fetch-precomputed-configuration.d.ts.map +1 -0
- package/cjs/configuration/fetch-precomputed-configuration.js +192 -0
- package/cjs/configuration/fetch-precomputed-configuration.js.map +1 -0
- package/cjs/configuration/fetch-rules-configuration.d.ts +3 -9
- package/cjs/configuration/fetch-rules-configuration.d.ts.map +1 -1
- package/cjs/configuration/fetch-rules-configuration.js +65 -126
- package/cjs/configuration/fetch-rules-configuration.js.map +1 -1
- package/cjs/configuration/flag-selection.d.ts +17 -0
- package/cjs/configuration/flag-selection.d.ts.map +1 -0
- package/cjs/configuration/flag-selection.js +29 -0
- package/cjs/configuration/flag-selection.js.map +1 -0
- package/cjs/configuration/precompute-configuration.d.ts +10 -0
- package/cjs/configuration/precompute-configuration.d.ts.map +1 -0
- package/cjs/configuration/precompute-configuration.js +38 -0
- package/cjs/configuration/precompute-configuration.js.map +1 -0
- package/cjs/experimentation-opt-out.d.ts +6 -0
- package/cjs/experimentation-opt-out.d.ts.map +1 -0
- package/cjs/experimentation-opt-out.js +17 -0
- package/cjs/experimentation-opt-out.js.map +1 -0
- package/cjs/index.d.ts +6 -0
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +12 -1
- package/cjs/index.js.map +1 -1
- package/cjs/provider.d.ts +58 -2
- package/cjs/provider.d.ts.map +1 -1
- package/cjs/provider.js +289 -47
- package/cjs/provider.js.map +1 -1
- package/cjs/rules-based.d.ts +4 -2
- package/cjs/rules-based.d.ts.map +1 -1
- package/cjs/rules-based.js +6 -1
- package/cjs/rules-based.js.map +1 -1
- package/cjs/sdk-diagnostics.d.ts +65 -0
- package/cjs/sdk-diagnostics.d.ts.map +1 -0
- package/cjs/sdk-diagnostics.js +123 -0
- package/cjs/sdk-diagnostics.js.map +1 -0
- package/esm/configuration/client-fingerprint.d.ts +3 -0
- package/esm/configuration/client-fingerprint.d.ts.map +1 -0
- package/esm/configuration/client-fingerprint.js +27 -0
- package/esm/configuration/client-fingerprint.js.map +1 -0
- package/esm/configuration/configuration-fetch.d.ts +21 -0
- package/esm/configuration/configuration-fetch.d.ts.map +1 -0
- package/esm/configuration/configuration-fetch.js +117 -0
- package/esm/configuration/configuration-fetch.js.map +1 -0
- package/esm/configuration/evaluation.d.ts +1 -1
- package/esm/configuration/evaluation.d.ts.map +1 -1
- package/esm/configuration/evaluation.js +1 -1
- package/esm/configuration/evaluation.js.map +1 -1
- package/esm/configuration/fetch-precomputed-configuration.d.ts +28 -0
- package/esm/configuration/fetch-precomputed-configuration.d.ts.map +1 -0
- package/esm/configuration/fetch-precomputed-configuration.js +189 -0
- package/esm/configuration/fetch-precomputed-configuration.js.map +1 -0
- package/esm/configuration/fetch-rules-configuration.d.ts +3 -9
- package/esm/configuration/fetch-rules-configuration.d.ts.map +1 -1
- package/esm/configuration/fetch-rules-configuration.js +56 -117
- package/esm/configuration/fetch-rules-configuration.js.map +1 -1
- package/esm/configuration/flag-selection.d.ts +17 -0
- package/esm/configuration/flag-selection.d.ts.map +1 -0
- package/esm/configuration/flag-selection.js +25 -0
- package/esm/configuration/flag-selection.js.map +1 -0
- package/esm/configuration/precompute-configuration.d.ts +10 -0
- package/esm/configuration/precompute-configuration.d.ts.map +1 -0
- package/esm/configuration/precompute-configuration.js +35 -0
- package/esm/configuration/precompute-configuration.js.map +1 -0
- package/esm/experimentation-opt-out.d.ts +6 -0
- package/esm/experimentation-opt-out.d.ts.map +1 -0
- package/esm/experimentation-opt-out.js +13 -0
- package/esm/experimentation-opt-out.js.map +1 -0
- package/esm/index.d.ts +6 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +5 -1
- package/esm/index.js.map +1 -1
- package/esm/provider.d.ts +58 -2
- package/esm/provider.d.ts.map +1 -1
- package/esm/provider.js +288 -47
- package/esm/provider.js.map +1 -1
- package/esm/rules-based.d.ts +4 -2
- package/esm/rules-based.d.ts.map +1 -1
- package/esm/rules-based.js +3 -1
- package/esm/rules-based.js.map +1 -1
- package/esm/sdk-diagnostics.d.ts +65 -0
- package/esm/sdk-diagnostics.d.ts.map +1 -0
- package/esm/sdk-diagnostics.js +119 -0
- package/esm/sdk-diagnostics.js.map +1 -0
- package/index.d.ts +1169 -9
- package/package.json +2 -2
- package/rules-based.d.ts +204 -8
package/README.md
CHANGED
|
@@ -17,6 +17,7 @@ const clientConfiguration = await fetchRulesConfiguration({
|
|
|
17
17
|
distributionChannel: 'client',
|
|
18
18
|
clientToken,
|
|
19
19
|
env: 'production',
|
|
20
|
+
flagSelection: { tags: ['team:checkout'], keyPatterns: ['checkout-*'] },
|
|
20
21
|
})
|
|
21
22
|
const wire = configurationToString(clientConfiguration)
|
|
22
23
|
// Pass wire through the framework's safe SSR data serializer, not raw inline HTML.
|
|
@@ -37,16 +38,234 @@ await OpenFeature.setProviderAndWait(provider, context)
|
|
|
37
38
|
|
|
38
39
|
The returned `FlagsConfiguration` is **not** the legacy UFC JSON accepted by `DatadogNodeServerProvider.setConfiguration()`. The existing Node provider is unchanged, and importing it from the root entrypoint does not load the protobuf decoder.
|
|
39
40
|
|
|
40
|
-
###
|
|
41
|
+
### Precomputed Fetching
|
|
42
|
+
|
|
43
|
+
Fetch client-distributed assignments from Datadog for one context without loading
|
|
44
|
+
the protobuf decoder, initializing a provider, or recording tracking events:
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
import { configurationToString, fetchPrecomputedConfiguration } from '@datadog/openfeature-node-server'
|
|
48
|
+
|
|
49
|
+
const configuration = await fetchPrecomputedConfiguration({
|
|
50
|
+
distributionChannel: 'client',
|
|
51
|
+
clientToken,
|
|
52
|
+
env: 'production',
|
|
53
|
+
context,
|
|
54
|
+
clientFingerprint,
|
|
55
|
+
flagSelection: { tags: ['team:checkout'], keyPatterns: ['checkout-*'] },
|
|
56
|
+
})
|
|
57
|
+
const wire = configurationToString(configuration)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The helper is also exported from `/rules-based`. Both entry points export the same
|
|
61
|
+
`ConfigurationFetchError` class, so `instanceof` works with either import.
|
|
62
|
+
The root parser and serializer handle only precomputed configurations; use
|
|
63
|
+
`/rules-based` to retain rules.
|
|
64
|
+
|
|
65
|
+
`distributionChannel: 'client'` is required in this draft. The endpoint does not
|
|
66
|
+
support server-distributed flags or API-key authentication; those are deferred.
|
|
67
|
+
|
|
68
|
+
Forward the browser's opaque `getClientFingerprint()` string unchanged as
|
|
69
|
+
`clientFingerprint`. Omission or a valid fingerprint with no supported capabilities uses the plaintext
|
|
70
|
+
baseline, not the Node SDK's capabilities. Unknown or unimplemented capabilities
|
|
71
|
+
are ignored. Datadog controls its encoding rollout: an encoding-capable client can
|
|
72
|
+
receive plaintext. A response using an encoding the target did not advertise is
|
|
73
|
+
rejected with `ConfigurationFetchError` (`decode`).
|
|
74
|
+
|
|
75
|
+
The helper decodes the SDK-owned wire internally. The target SDK fingerprint is used
|
|
76
|
+
locally to validate response compatibility. When it advertises dependent-flag support,
|
|
77
|
+
the helper adds `cap_dependent-flags-variant-key=v1` to the origin query; target
|
|
78
|
+
capabilities are not forwarded in a header. The request source still identifies the
|
|
79
|
+
requesting Node SDK.
|
|
80
|
+
|
|
81
|
+
`flagSelection` optionally requests flags matching any of the `tags` or whole-key
|
|
82
|
+
glob `keyPatterns`. The helper trims, deduplicates, and sorts each list, then sends
|
|
83
|
+
it in the JSON body's `data.attributes.flag_selection` (`tags` and `key_patterns`).
|
|
84
|
+
Each list accepts at most 31 distinct nonempty values of at most 200 UTF-8 bytes each.
|
|
85
|
+
An empty selection requests all flags. An invalid or over-limit selection is not
|
|
86
|
+
sent; the full configuration is requested and `logger.error()` reports why.
|
|
87
|
+
`logger` defaults to `console` and also reports a server-ignored selection through
|
|
88
|
+
the `DD-Flag-Selection-Ignored` response header. Logger failures do not stop fetching.
|
|
89
|
+
The rules-fetch URL size limit does not apply to this POST-body selection.
|
|
90
|
+
|
|
91
|
+
Selection is best-effort, not an access-control boundary. The helper preserves
|
|
92
|
+
the server's returned assignments without filtering them locally. When selection
|
|
93
|
+
is applied, omitted flags return the receiving provider's default value with
|
|
94
|
+
`FLAG_NOT_FOUND`; select every flag the client evaluates.
|
|
95
|
+
|
|
96
|
+
`site`, `fetch`, `timeoutMs` and `signal` follow the rules-fetch transport
|
|
97
|
+
conventions below. Optional `applicationId` maps to `dd-application-id`.
|
|
98
|
+
The helper snapshots a JSON-compatible context and binds the returned assignments
|
|
99
|
+
to it. Malformed context, fingerprints (including unsupported wire versions), or other options fail with `invalid_options`
|
|
100
|
+
before any request. Use the same context when initializing the receiving provider.
|
|
101
|
+
There is no polling, retry, tracking or automatic server fallback.
|
|
102
|
+
|
|
103
|
+
`experimentationOptOutMode` accepts `disabled` (default), `immediate`, or
|
|
104
|
+
`future_experiments_only`, matching local precomputation. For an opted-out context,
|
|
105
|
+
the helper sends the effective policy and requires the response to acknowledge it;
|
|
106
|
+
future-only mode also requires a matching cutoff timestamp. With opt-out enabled,
|
|
107
|
+
an invalid timestamp fails with `invalid_options` before fetching, and a missing or
|
|
108
|
+
mismatched acknowledgment fails with `decode`. Initialize the receiving provider with the same
|
|
109
|
+
context and opt-out mode. This option does not change the existing Node provider's
|
|
110
|
+
supported modes.
|
|
111
|
+
|
|
112
|
+
### Rules Fetch Options and Errors
|
|
41
113
|
|
|
42
114
|
- `distributionChannel` selects the configuration channel to fetch, not where the helper runs. It defaults to `server`; use `client` when preparing configuration for browser or mobile SDKs.
|
|
115
|
+
- `flagSelection` optionally requests flags matching any of the `tags` or whole-key glob `keyPatterns`. Both distribution channels support selection; omitting it requests the full configuration.
|
|
43
116
|
- `site` defaults to `datadoghq.com`.
|
|
44
117
|
- `fetch` overrides global Fetch. Custom transports must honor `signal` and `redirect: 'manual'`; redirects are rejected to protect credentials.
|
|
118
|
+
- `logger` reports dropped or server-ignored selections through `error(message)`. It defaults to `console`; provide your application's logger to route these diagnostics elsewhere.
|
|
45
119
|
- `timeoutMs` defaults to `5000` and covers the request and response-body read. `signal` supports caller cancellation and earlier deadlines.
|
|
46
120
|
- Failures throw `ConfigurationFetchError` with a `code` and, for HTTP errors, `status`. Timeouts use `timeout`; other caller cancellations use `cancelled`.
|
|
47
121
|
|
|
48
122
|
Applications own retries, polling, storage, tracking, and fallback.
|
|
49
123
|
|
|
124
|
+
### Local Precomputation
|
|
125
|
+
|
|
126
|
+
`precomputeConfiguration(configuration, context, options?)` evaluates parsed rules locally for one context and returns a precomputed-only `FlagsConfiguration`. It reuses the shared evaluator without initializing a provider or tracer, fetching, polling, or emitting tracking events. Parsing, fetching, and serialization remain separate building blocks.
|
|
127
|
+
|
|
128
|
+
```typescript
|
|
129
|
+
import {
|
|
130
|
+
configurationToString,
|
|
131
|
+
fetchRulesConfiguration,
|
|
132
|
+
precomputeConfiguration,
|
|
133
|
+
} from '@datadog/openfeature-node-server/rules-based'
|
|
134
|
+
|
|
135
|
+
const rules = await fetchRulesConfiguration({
|
|
136
|
+
distributionChannel: 'client',
|
|
137
|
+
clientToken,
|
|
138
|
+
env: 'production',
|
|
139
|
+
})
|
|
140
|
+
const context = { targetingKey: user.id, country: user.country }
|
|
141
|
+
const precomputed = precomputeConfiguration(rules, context, {
|
|
142
|
+
flagSelection: { keyPatterns: ['checkout-*'] },
|
|
143
|
+
onEvaluationError: ({ flagKey, errorCode }) => {
|
|
144
|
+
console.warn('Flag evaluation failed during precomputation', { flagKey, errorCode })
|
|
145
|
+
},
|
|
146
|
+
})
|
|
147
|
+
const wire = configurationToString(precomputed)
|
|
148
|
+
// Send wire through the framework's safe SSR serializer and use the same context in the browser.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
You can also pass rules parsed with `configurationFromString()` or `configurationFromRulesBinary()`. The existing browser initialization example above accepts the resulting wire. A configuration containing both capabilities is evaluated using its rules, not its existing precomputed assignments.
|
|
152
|
+
|
|
153
|
+
- The helper captures one evaluation time and a detached JSON-compatible context. Recompute when rules or context change; a precomputed-only provider cannot reevaluate rules for a different subject. Dates, undefined values, nonfinite numbers, custom class instances, and cycles are not portable context values and are rejected.
|
|
154
|
+
- Complete successful assignments are included in `attributes.flags`. A failed dependency graph root is retained in `attributes.flagEvaluationErrors` so receivers can return the caller's default with the original error; ordinary flag failures remain absent and are reported only through `onEvaluationError`. A flag with no matching assignment is not included in the precomputed response. This is Datadog's assignment-only format, not an OFREP bulk response.
|
|
155
|
+
- `onEvaluationError` receives the flag key and error code for each evaluation failure after the entire snapshot has been computed. It receives no context, values, or raw error messages; no-assignment outcomes do not invoke it. Exceptions thrown by the callback propagate.
|
|
156
|
+
- Missing or malformed rules, invalid contexts, and invalid options throw `ConfigurationPrecomputeError` with `invalid_configuration`, `invalid_context`, or `invalid_options`, respectively. A valid configuration with no flags produces an empty, context-bound snapshot.
|
|
157
|
+
- `flagSelection` supports only `keyPatterns` for local precomputation: source rules do not contain tag metadata. Patterns match the whole flag key, case-sensitively, with only `*` special; any matching pattern selects the flag. Patterns use the same Unicode whitespace trimming, deduplication, and limits as fetch selection (31 distinct nonempty patterns, 200 UTF-8 bytes each). Omitted selections and selections with no nonempty `keyPatterns` include all assignments; a `null` selection is also treated as absent at runtime. No matches produce an empty snapshot. Any defined `tags` value, including `[]` or `null`, malformed selections, and selections over a limit throw `invalid_options`, rather than falling back to all flags. Tags are also rejected by the TypeScript type.
|
|
158
|
+
- Selection chooses the initial root flags without modifying the source rules. Precomputation also includes the transitive configured prerequisite assignments needed by those roots, even when their keys do not match. `onEvaluationError` reports failures across the selected-root and prerequisite closure. A shared rules snapshot can be reused with different selections; local selection cannot restore flags absent from that snapshot.
|
|
159
|
+
- Values (including scalar/null JSON), variants, reasons, allocation keys, serial IDs, exposure-logging intent, raw split features, environment, and configuration consent are retained. Source rules and their ETag are not forwarded; the rules ETag is not a validator for this context-specific output. Precomputation itself does not record an exposure.
|
|
160
|
+
- The helper's `experimentationOptOutMode` accepts `disabled` (default), `immediate`, or `future_experiments_only`. Enabled modes use the context's `dd_experimentation_opt_out_at` timestamp and preserve the effective policy in `evaluation_options`. Configure a compatible receiving provider with the same policy. These helper options do not change the existing Node provider's supported modes.
|
|
161
|
+
- Pass the target SDK's opaque `clientFingerprint` to let the Node helper select a supported encoding and generate its salt. Keys in both top-level maps are hashed. Each nested prerequisite key is encrypted and authenticated using the plaintext root key; a capable receiver uses the caller's root key to decrypt it and hashes the recovered parent key for the top-level lookup. Omitting the fingerprint preserves plaintext prerequisite keys. The fingerprint is consumed locally and is not forwarded to the Datadog origin request.
|
|
162
|
+
|
|
163
|
+
To prepare output for a particular browser SDK, send the opaque string returned
|
|
164
|
+
by its `getClientFingerprint()` getter to your application server. For example,
|
|
165
|
+
in the browser:
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
import { getClientFingerprint } from '@datadog/openfeature-browser'
|
|
169
|
+
|
|
170
|
+
const requestBody = JSON.stringify({ clientFingerprint: getClientFingerprint() })
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
On the Node server, read that string from the request and pass it unchanged to the helper.
|
|
174
|
+
Using a Web `Request` with the JSON body above:
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
async function precomputeForClient(request: Request) {
|
|
178
|
+
const { clientFingerprint } = await request.json()
|
|
179
|
+
const precomputed = precomputeConfiguration(rules, context, { clientFingerprint })
|
|
180
|
+
return configurationToString(precomputed)
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Your application chooses its own client-server transport. Read compatibility from
|
|
185
|
+
the target browser SDK, not from a browser SDK installed on the Node server.
|
|
186
|
+
|
|
187
|
+
Omitting the fingerprint, or providing a valid fingerprint with no supported capabilities,
|
|
188
|
+
preserves plaintext output. With `assignment-encoding-flag-key-256-v1`, the Node
|
|
189
|
+
helper uses the shared core encoder to hash flag-map keys with a fresh random
|
|
190
|
+
salt and records `obfuscated: true` and the encoding descriptor. Values and
|
|
191
|
+
telemetry metadata are unchanged. The browser still evaluates the original keys.
|
|
192
|
+
The SDK-owned wire includes a format version, SDK name/version, and capabilities.
|
|
193
|
+
Do not parse or construct it in application code. Malformed fingerprints and
|
|
194
|
+
unsupported wire versions throw `ConfigurationPrecomputeError` with `invalid_options`.
|
|
195
|
+
Unknown capability strings and future optional wire fields are ignored. SDK identity
|
|
196
|
+
is metadata, not authentication or a substitute for capability negotiation.
|
|
197
|
+
The Node SDK's own capabilities are never substituted for the client's.
|
|
198
|
+
This option is specific to the Node helper; the runtime-agnostic core helper
|
|
199
|
+
continues to return plaintext assignments.
|
|
200
|
+
|
|
201
|
+
**Precomputation is not an access-control boundary.** For client-directed SSR output, use client-distributed rules or an explicitly reviewed client-safe policy. Do not expose server-only flags or private context attributes merely because the rules were removed. Select a context that is safe to send to that client.
|
|
202
|
+
|
|
203
|
+
### Flag Selection
|
|
204
|
+
|
|
205
|
+
Selection reduces the configuration payload fetched from the backend, including configurations prepared for SSR. Values are trimmed, deduplicated, and sorted by UTF-8 bytes using the same canonicalizer as the browser SDK. Each list accepts up to 31 distinct nonempty values, and each value can be at most 200 UTF-8 bytes. The helper sends repeated `selected_flag_tags` and `selected_flag_key_patterns` query parameters with RFC 3986 percent-encoding.
|
|
206
|
+
|
|
207
|
+
Selection is best-effort, matching the browser SDK. Malformed or over-limit selections are not sent, and the full configuration is requested instead. This also applies to errors while reading or encoding selection values and to selections that would make the URL exceed 8192 bytes. The helper logs one error per fetch explaining the reason and limit, without including selection values or credentials. Empty selections request the full configuration without logging an error.
|
|
208
|
+
|
|
209
|
+
The backend may also ignore selection and return the full configuration. When a selection was sent and a successful response includes a nonempty `DD-Flag-Selection-Ignored` header, the helper logs one error containing the server's reason before parsing the response. These fallbacks do not reject the fetch. Exceptions thrown by a custom logger do not interrupt configuration loading. No provider, tracer, or telemetry pipeline is initialized for these diagnostics.
|
|
210
|
+
|
|
211
|
+
When the backend applies a selection, flags outside it are absent from the returned configuration. A browser provider initialized from that wire returns the caller's default value for those flags, with `FLAG_NOT_FOUND` in the evaluation details. Select every flag the page evaluates.
|
|
212
|
+
|
|
213
|
+
**Selection is not an access-control boundary.** The helper returns the configuration supplied by the backend without filtering it locally. Continue to use the client distribution channel for anything forwarded to a browser or mobile SDK.
|
|
214
|
+
|
|
215
|
+
## Per-subject experimentation opt-out
|
|
216
|
+
|
|
217
|
+
Set the `experimentationOptOutMode` provider option to `ExperimentationOptOutMode.Immediate`.
|
|
218
|
+
The supported modes are `Disabled` (the default) and `Immediate`. `FutureExperimentsOnly` is not supported by this provider. Unsupported mode values throw during provider construction.
|
|
219
|
+
The provider uses the explicit option only. When using `dd-trace-js`, the tracer owns
|
|
220
|
+
`DD_FEATURE_FLAGS_EXPERIMENTATION_OPT_OUT_MODE` and passes the resolved mode to this provider.
|
|
221
|
+
|
|
222
|
+
```typescript
|
|
223
|
+
import { DatadogNodeServerProvider, ExperimentationOptOutMode } from '@datadog/openfeature-node-server'
|
|
224
|
+
|
|
225
|
+
const provider = new DatadogNodeServerProvider({
|
|
226
|
+
exposureChannel,
|
|
227
|
+
experimentationOptOutMode: ExperimentationOptOutMode.Immediate,
|
|
228
|
+
})
|
|
229
|
+
// Supply the customer's stored preference with each evaluation.
|
|
230
|
+
const context = {
|
|
231
|
+
targetingKey: athlete.id,
|
|
232
|
+
...(athlete.experimentationOptOutAt ? { dd_experimentation_opt_out_at: athlete.experimentationOptOutAt } : {}),
|
|
233
|
+
}
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
Use the shared timestamp subset: `YYYY-MM-DDTHH:mm:ss`, optionally followed by a decimal fraction, then `Z` or a numeric `±HH:mm` offset. Lowercase `t` and `z` are accepted. Fractions beyond nine digits are truncated without rounding. Calendar fields must be valid, seconds must be `00`–`59`, and both the written and normalized UTC year must be `0000`–`9999`. Whitespace, named time zones, compact offsets, Unicode signs, and leap seconds are rejected.
|
|
237
|
+
|
|
238
|
+
In immediate mode, any valid timestamp excludes the subject immediately, including a future timestamp.
|
|
239
|
+
The evaluator skips exposure-logging allocations before targeting and randomization, then tries ordinary allocations in order.
|
|
240
|
+
If none match, it returns the application's default value.
|
|
241
|
+
An invalid attribute returns `INVALID_CONTEXT` and the application default.
|
|
242
|
+
Disabled mode ignores the attribute.
|
|
243
|
+
Evaluation telemetry remains independent.
|
|
244
|
+
Immediate withdrawal can change an enrolled subject's experience; account for this in experiment analysis.
|
|
245
|
+
|
|
246
|
+
## Diagnostic observations for integrations
|
|
247
|
+
|
|
248
|
+
Pass `onDiagnostic` in the `DatadogNodeServerProvider` options to receive initialization outcomes and
|
|
249
|
+
configuration-fetch errors. Initialization timing starts when `initialize()` is called.
|
|
250
|
+
The provider measures initialization duration and configuration arrival. It reports `ready`, `failed`, or
|
|
251
|
+
`incomplete` when closed while waiting for configuration. The callback can return a promise; delivery is never
|
|
252
|
+
awaited. Synchronous errors and rejected callback promises do not affect provider behavior.
|
|
253
|
+
Without a callback, diagnostic measurement is disabled.
|
|
254
|
+
|
|
255
|
+
An integration that polls for configuration calls `reportConfigurationFetchStart()` once before each sequential
|
|
256
|
+
poll and `reportConfigurationFetchResult(success)` after the poll completes, including its retries. Do not report
|
|
257
|
+
cancellation as a failed fetch. Configuration-fetch errors are reported only after initialization finishes.
|
|
258
|
+
Startup fetch failures are covered by the initialization observation. Each later outage is reported once, with at
|
|
259
|
+
most one error report per minute per provider. If a new outage starts during the cooldown, a later failed poll
|
|
260
|
+
reports it after the cooldown ends. A successful fetch allows the next outage to be reported.
|
|
261
|
+
|
|
262
|
+
The callback receives an `SDKDiagnostic` observation with a timestamp, event type, and initialization or error
|
|
263
|
+
fields. The integration supplies SDK, service, and environment identity and handles buffering and delivery.
|
|
264
|
+
The provider does not send network requests for diagnostics. Call `onClose()` and await its result before closing
|
|
265
|
+
the delivery mechanism so an initialization result already in progress can be reported.
|
|
266
|
+
|
|
267
|
+
After `onClose()`, the provider reports no further diagnostics, even if it is initialized again.
|
|
268
|
+
|
|
50
269
|
## End-user license agreement
|
|
51
270
|
|
|
52
271
|
https://www.datadoghq.com/legal/eula
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-fingerprint.d.ts","sourceRoot":"","sources":["../../src/configuration/client-fingerprint.ts"],"names":[],"mappings":"AAEA,oHAAoH;AACpH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,MAAM,EAAE,CAmB7E"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readPrecomputedCapabilities = readPrecomputedCapabilities;
|
|
4
|
+
const flagging_core_1 = require("@datadog/flagging-core");
|
|
5
|
+
/** Decode the SDK-owned wire, then retain only response formats implemented here. Identity is not authorization. */
|
|
6
|
+
function readPrecomputedCapabilities(input) {
|
|
7
|
+
if (input === undefined)
|
|
8
|
+
return [];
|
|
9
|
+
if (typeof input !== 'string')
|
|
10
|
+
throw new Error('Invalid client fingerprint');
|
|
11
|
+
const fingerprint = JSON.parse(input);
|
|
12
|
+
if (!isObject(fingerprint) || fingerprint.version !== 1)
|
|
13
|
+
throw new Error('Invalid client fingerprint version');
|
|
14
|
+
const { sdk, capabilities } = fingerprint;
|
|
15
|
+
if (!isObject(sdk) ||
|
|
16
|
+
typeof sdk.name !== 'string' ||
|
|
17
|
+
sdk.name.length === 0 ||
|
|
18
|
+
typeof sdk.version !== 'string' ||
|
|
19
|
+
sdk.version.length === 0) {
|
|
20
|
+
throw new Error('Invalid client SDK identity');
|
|
21
|
+
}
|
|
22
|
+
if (!Array.isArray(capabilities) || !capabilities.every((value) => typeof value === 'string')) {
|
|
23
|
+
throw new Error('Invalid capabilities');
|
|
24
|
+
}
|
|
25
|
+
return flagging_core_1.SUPPORTED_FLAGS_CAPABILITIES.filter((capability) => capabilities.includes(capability)).sort();
|
|
26
|
+
}
|
|
27
|
+
function isObject(value) {
|
|
28
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=client-fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client-fingerprint.js","sourceRoot":"","sources":["../../src/configuration/client-fingerprint.ts"],"names":[],"mappings":";;AAGA,kEAmBC;AAtBD,0DAAqE;AAErE,oHAAoH;AACpH,SAAgB,2BAA2B,CAAC,KAAc;IACxD,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,EAAE,CAAA;IAClC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAA;IAC5E,MAAM,WAAW,GAAY,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IAC9C,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,WAAW,CAAC,OAAO,KAAK,CAAC;QAAE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;IAC9G,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,WAAW,CAAA;IACzC,IACE,CAAC,QAAQ,CAAC,GAAG,CAAC;QACd,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ;QAC5B,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC;QACrB,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ;QAC/B,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EACxB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAA;IAChD,CAAC;IACD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,CAAC,EAAE,CAAC;QAC9F,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;IACzC,CAAC;IACD,OAAO,4CAA4B,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,YAAY,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAA;AACtG,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;AAC7E,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { timeStampNow } from '@datadog/flagging-core';
|
|
2
|
+
export type ConfigurationFetchErrorCode = 'invalid_options' | 'http' | 'invalid_response' | 'decode' | 'transport' | 'cancelled' | 'timeout';
|
|
3
|
+
/** A configuration-loading failure, not an OpenFeature evaluation error. */
|
|
4
|
+
export declare class ConfigurationFetchError extends Error {
|
|
5
|
+
readonly code: ConfigurationFetchErrorCode;
|
|
6
|
+
readonly status?: number | undefined;
|
|
7
|
+
constructor(code: ConfigurationFetchErrorCode, message: string, status?: number | undefined);
|
|
8
|
+
}
|
|
9
|
+
export declare function transportError(message: string, error: unknown): ConfigurationFetchError;
|
|
10
|
+
export declare function invalidOption(option: string): ConfigurationFetchError;
|
|
11
|
+
export interface ConfigurationTransportOptions {
|
|
12
|
+
/** Request and response-body deadline in milliseconds. Defaults to 5000. */
|
|
13
|
+
timeoutMs?: number;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
/** Fetch-compatible transport. Must honor the supplied signal and redirect policy. */
|
|
16
|
+
fetch?: typeof globalThis.fetch;
|
|
17
|
+
}
|
|
18
|
+
export declare function validateTransportOptions(timeoutMs: number, signal: AbortSignal | undefined, requestFetch: typeof fetch): void;
|
|
19
|
+
/** Keep credentials, deadlines and response cleanup consistent across configuration endpoints. */
|
|
20
|
+
export declare function requestConfiguration<T>(url: string, init: RequestInit, options: Required<Pick<ConfigurationTransportOptions, 'fetch' | 'timeoutMs'>> & Pick<ConfigurationTransportOptions, 'signal'>, read: (response: Response, fetchedAt: ReturnType<typeof timeStampNow>, checkAborted: () => void) => Promise<T>): Promise<T>;
|
|
21
|
+
//# sourceMappingURL=configuration-fetch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-fetch.d.ts","sourceRoot":"","sources":["../../src/configuration/configuration-fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA;AAErD,MAAM,MAAM,2BAA2B,GACrC,iBAAiB,GAAG,MAAM,GAAG,kBAAkB,GAAG,QAAQ,GAAG,WAAW,GAAG,WAAW,GAAG,SAAS,CAAA;AAEpG,4EAA4E;AAC5E,qBAAa,uBAAwB,SAAQ,KAAK;IAE9C,QAAQ,CAAC,IAAI,EAAE,2BAA2B;IAE1C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM;gBAFf,IAAI,EAAE,2BAA2B,EAC1C,OAAO,EAAE,MAAM,EACN,MAAM,CAAC,EAAE,MAAM,YAAA;CAK3B;AA+BD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,uBAAuB,CAIvF;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,uBAAuB,CAErE;AAED,MAAM,WAAW,6BAA6B;IAC5C,4EAA4E;IAC5E,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,WAAW,CAAA;IACpB,sFAAsF;IACtF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC;AAED,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,YAAY,EAAE,OAAO,KAAK,GACzB,IAAI,CAWN;AAED,kGAAkG;AAClG,wBAAsB,oBAAoB,CAAC,CAAC,EAC1C,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,WAAW,EACjB,OAAO,EAAE,QAAQ,CAAC,IAAI,CAAC,6BAA6B,EAAE,OAAO,GAAG,WAAW,CAAC,CAAC,GAC3E,IAAI,CAAC,6BAA6B,EAAE,QAAQ,CAAC,EAC/C,IAAI,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,EAAE,YAAY,EAAE,MAAM,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,GAC7G,OAAO,CAAC,CAAC,CAAC,CAiDZ"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ConfigurationFetchError = void 0;
|
|
4
|
+
exports.transportError = transportError;
|
|
5
|
+
exports.invalidOption = invalidOption;
|
|
6
|
+
exports.validateTransportOptions = validateTransportOptions;
|
|
7
|
+
exports.requestConfiguration = requestConfiguration;
|
|
8
|
+
const flagging_core_1 = require("@datadog/flagging-core");
|
|
9
|
+
/** A configuration-loading failure, not an OpenFeature evaluation error. */
|
|
10
|
+
class ConfigurationFetchError extends Error {
|
|
11
|
+
constructor(code, message, status) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.code = code;
|
|
14
|
+
this.status = status;
|
|
15
|
+
this.name = 'ConfigurationFetchError';
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
exports.ConfigurationFetchError = ConfigurationFetchError;
|
|
19
|
+
function abortError(signal) {
|
|
20
|
+
var _a;
|
|
21
|
+
return ((_a = signal === null || signal === void 0 ? void 0 : signal.reason) === null || _a === void 0 ? void 0 : _a.name) === 'TimeoutError'
|
|
22
|
+
? new ConfigurationFetchError('timeout', 'Configuration fetch timed out')
|
|
23
|
+
: new ConfigurationFetchError('cancelled', 'Configuration fetch cancelled');
|
|
24
|
+
}
|
|
25
|
+
// Raw errors can contain credentials or response bytes. Copy only a fixed diagnostic code.
|
|
26
|
+
const TRANSPORT_CODES = new Set([
|
|
27
|
+
'ENOTFOUND',
|
|
28
|
+
'EAI_AGAIN',
|
|
29
|
+
'ECONNREFUSED',
|
|
30
|
+
'ECONNRESET',
|
|
31
|
+
'ETIMEDOUT',
|
|
32
|
+
'EHOSTUNREACH',
|
|
33
|
+
'ENETUNREACH',
|
|
34
|
+
'EPIPE',
|
|
35
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
36
|
+
'UND_ERR_HEADERS_TIMEOUT',
|
|
37
|
+
'UND_ERR_BODY_TIMEOUT',
|
|
38
|
+
'UND_ERR_SOCKET',
|
|
39
|
+
'UND_ERR_CLOSED',
|
|
40
|
+
'CERT_HAS_EXPIRED',
|
|
41
|
+
'DEPTH_ZERO_SELF_SIGNED_CERT',
|
|
42
|
+
'SELF_SIGNED_CERT_IN_CHAIN',
|
|
43
|
+
'UNABLE_TO_GET_ISSUER_CERT_LOCALLY',
|
|
44
|
+
'UNABLE_TO_VERIFY_LEAF_SIGNATURE',
|
|
45
|
+
'ERR_TLS_CERT_ALTNAME_INVALID',
|
|
46
|
+
]);
|
|
47
|
+
function transportError(message, error) {
|
|
48
|
+
const { code, cause } = (error !== null && error !== void 0 ? error : {});
|
|
49
|
+
const known = [cause === null || cause === void 0 ? void 0 : cause.code, code].find((value) => typeof value === 'string' && TRANSPORT_CODES.has(value));
|
|
50
|
+
return new ConfigurationFetchError('transport', known ? `${message} (${known})` : message);
|
|
51
|
+
}
|
|
52
|
+
function invalidOption(option) {
|
|
53
|
+
return new ConfigurationFetchError('invalid_options', `Invalid configuration fetch options: ${option}`);
|
|
54
|
+
}
|
|
55
|
+
function validateTransportOptions(timeoutMs, signal, requestFetch) {
|
|
56
|
+
if (!Number.isInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > 2147483647)
|
|
57
|
+
throw invalidOption('timeoutMs');
|
|
58
|
+
if (typeof requestFetch !== 'function')
|
|
59
|
+
throw invalidOption('fetch');
|
|
60
|
+
if (signal !== undefined &&
|
|
61
|
+
(signal === null ||
|
|
62
|
+
typeof signal.aborted !== 'boolean' ||
|
|
63
|
+
typeof signal.addEventListener !== 'function' ||
|
|
64
|
+
typeof signal.removeEventListener !== 'function'))
|
|
65
|
+
throw invalidOption('signal');
|
|
66
|
+
}
|
|
67
|
+
/** Keep credentials, deadlines and response cleanup consistent across configuration endpoints. */
|
|
68
|
+
async function requestConfiguration(url, init, options, read) {
|
|
69
|
+
var _a;
|
|
70
|
+
const { fetch: requestFetch, timeoutMs, signal } = options;
|
|
71
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
72
|
+
throw abortError(signal);
|
|
73
|
+
const controller = new AbortController();
|
|
74
|
+
const cancel = () => controller.abort(abortError(signal));
|
|
75
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', cancel, { once: true });
|
|
76
|
+
const timeout = setTimeout(() => controller.abort(new ConfigurationFetchError('timeout', 'Configuration fetch timed out')), timeoutMs);
|
|
77
|
+
const fetchedAt = (0, flagging_core_1.timeStampNow)();
|
|
78
|
+
let response;
|
|
79
|
+
try {
|
|
80
|
+
try {
|
|
81
|
+
response = await requestFetch(url, {
|
|
82
|
+
...init,
|
|
83
|
+
signal: controller.signal,
|
|
84
|
+
// Never forward a credential to a redirect destination.
|
|
85
|
+
redirect: 'manual',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
throw transportError('Configuration request failed', error);
|
|
90
|
+
}
|
|
91
|
+
controller.signal.throwIfAborted();
|
|
92
|
+
if (response.status !== 200) {
|
|
93
|
+
throw new ConfigurationFetchError('http', `Configuration fetch returned HTTP ${response.status}`, response.status);
|
|
94
|
+
}
|
|
95
|
+
const result = await read(response, fetchedAt, () => controller.signal.throwIfAborted());
|
|
96
|
+
controller.signal.throwIfAborted();
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (controller.signal.aborted)
|
|
101
|
+
throw controller.signal.reason;
|
|
102
|
+
if (error instanceof ConfigurationFetchError)
|
|
103
|
+
throw error;
|
|
104
|
+
throw transportError('Configuration request failed', error);
|
|
105
|
+
}
|
|
106
|
+
finally {
|
|
107
|
+
clearTimeout(timeout);
|
|
108
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', cancel);
|
|
109
|
+
controller.abort();
|
|
110
|
+
// Cleanup must not replace the result or wait for a custom transport to settle.
|
|
111
|
+
try {
|
|
112
|
+
const body = response === null || response === void 0 ? void 0 : response.body;
|
|
113
|
+
if (body && !(response === null || response === void 0 ? void 0 : response.bodyUsed)) {
|
|
114
|
+
if (typeof body.cancel === 'function')
|
|
115
|
+
void body.cancel().catch(() => { });
|
|
116
|
+
else
|
|
117
|
+
(_a = body.destroy) === null || _a === void 0 ? void 0 : _a.call(body);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (_b) {
|
|
121
|
+
// Custom transports can throw synchronously during cleanup.
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
//# sourceMappingURL=configuration-fetch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration-fetch.js","sourceRoot":"","sources":["../../src/configuration/configuration-fetch.ts"],"names":[],"mappings":";;;AA8CA,wCAIC;AAED,sCAEC;AAUD,4DAeC;AAGD,oDAuDC;AAzID,0DAAqD;AAKrD,4EAA4E;AAC5E,MAAa,uBAAwB,SAAQ,KAAK;IAChD,YACW,IAAiC,EAC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ACzD,MAAM,cAAc,CAAC,8BAA8B,EAAE,KAAK,CAAC,CAAA;IAC7D,CAAC;YAAS,CAAC;QACT,YAAY,CAAC,OAAO,CAAC,CAAA;QACrB,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,CAAA;QAC5C,UAAU,CAAC,KAAK,EAAE,CAAA;QAClB,gFAAgF;QAChF,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,IAAsE,CAAA;YAC7F,IAAI,IAAI,IAAI,CAAC,CAAA,QAAQ,aAAR,QAAQ,uBAAR,QAAQ,CAAE,QAAQ,CAAA,EAAE,CAAC;gBAChC,IAAI,OAAO,IAAI,CAAC,MAAM,KAAK,UAAU;oBAAE,KAAK,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;;oBACpE,MAAA,IAAI,CAAC,OAAO,oDAAI,CAAA;YACvB,CAAC;QACH,CAAC;QAAC,WAAM,CAAC;YACP,4DAA4D;QAC9D,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { evaluateRulesBasedConfigurationWithTrace as evaluateWithTrace } from '@datadog/flagging-core';
|
|
2
2
|
//# sourceMappingURL=evaluation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/configuration/evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"evaluation.d.ts","sourceRoot":"","sources":["../../src/configuration/evaluation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,IAAI,iBAAiB,EAAE,MAAM,wBAAwB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.evaluateWithTrace = void 0;
|
|
4
4
|
var flagging_core_1 = require("@datadog/flagging-core");
|
|
5
|
-
Object.defineProperty(exports, "
|
|
5
|
+
Object.defineProperty(exports, "evaluateWithTrace", { enumerable: true, get: function () { return flagging_core_1.evaluateRulesBasedConfigurationWithTrace; } });
|
|
6
6
|
//# sourceMappingURL=evaluation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/configuration/evaluation.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"evaluation.js","sourceRoot":"","sources":["../../src/configuration/evaluation.ts"],"names":[],"mappings":";;;AAAA,wDAAsG;AAA7F,kHAAA,wCAAwC,OAAqB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { type ClientFingerprint, type ExperimentationOptOutModeValue, type FlagsConfiguration } from '@datadog/flagging-core';
|
|
2
|
+
import type { EvaluationContext } from '@openfeature/core';
|
|
3
|
+
import { type ConfigurationTransportOptions } from './configuration-fetch';
|
|
4
|
+
import { type ConfigurationSelectionOptions } from './flag-selection';
|
|
5
|
+
export interface PrecomputedConfigurationFetchOptions extends ConfigurationTransportOptions, ConfigurationSelectionOptions {
|
|
6
|
+
/** Required for now. Only client-distributed flags are supported by this endpoint. */
|
|
7
|
+
distributionChannel: 'client';
|
|
8
|
+
clientToken: string;
|
|
9
|
+
/** Reserved. API-key authentication is not supported for client distribution. */
|
|
10
|
+
apiKey?: never;
|
|
11
|
+
env: string;
|
|
12
|
+
/** Datadog site. Defaults to datadoghq.com. */
|
|
13
|
+
site?: string;
|
|
14
|
+
applicationId?: string;
|
|
15
|
+
/**
|
|
16
|
+
* A detached snapshot is bound to the returned assignments. Only plain JSON values are accepted:
|
|
17
|
+
* no Date, undefined, non-finite numbers, class instances, or cycles, including nested values.
|
|
18
|
+
* Convert dates to strings before calling and use the same context in the receiving provider.
|
|
19
|
+
*/
|
|
20
|
+
context: EvaluationContext;
|
|
21
|
+
/** Opaque target SDK fingerprint. Forward unchanged from its getter; omission requests plaintext. */
|
|
22
|
+
clientFingerprint?: ClientFingerprint;
|
|
23
|
+
/** Defaults to disabled. The receiving provider must use the same effective opt-out policy. */
|
|
24
|
+
experimentationOptOutMode?: ExperimentationOptOutModeValue;
|
|
25
|
+
}
|
|
26
|
+
/** Fetch assignments for one client context, without initializing a provider or emitting tracking events. */
|
|
27
|
+
export declare function fetchPrecomputedConfiguration(options: PrecomputedConfigurationFetchOptions): Promise<FlagsConfiguration>;
|
|
28
|
+
//# sourceMappingURL=fetch-precomputed-configuration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetch-precomputed-configuration.d.ts","sourceRoot":"","sources":["../../src/configuration/fetch-precomputed-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,iBAAiB,EAGtB,KAAK,8BAA8B,EAGnC,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,iBAAiB,EAAa,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAEL,KAAK,6BAA6B,EAKnC,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EACL,KAAK,6BAA6B,EAGnC,MAAM,kBAAkB,CAAA;AAEzB,MAAM,WAAW,oCACf,SAAQ,6BAA6B,EAAE,6BAA6B;IACpE,sFAAsF;IACtF,mBAAmB,EAAE,QAAQ,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,iFAAiF;IACjF,MAAM,CAAC,EAAE,KAAK,CAAA;IACd,GAAG,EAAE,MAAM,CAAA;IACX,+CAA+C;IAC/C,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,OAAO,EAAE,iBAAiB,CAAA;IAC1B,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,iBAAiB,CAAA;IACrC,+FAA+F;IAC/F,yBAAyB,CAAC,EAAE,8BAA8B,CAAA;CAC3D;AAED,6GAA6G;AAC7G,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,oCAAoC,GAC5C,OAAO,CAAC,kBAAkB,CAAC,CA2F7B"}
|