@datadog/mobile-react-native 3.5.3 → 3.5.4

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 (72) hide show
  1. package/android/build.gradle +8 -7
  2. package/android/src/main/kotlin/com/datadog/reactnative/SdkVersion.kt +1 -1
  3. package/android/src/test/kotlin/com/datadog/reactnative/DdSdkTest.kt +94 -49
  4. package/ios/Sources/SdkVersion.swift +1 -1
  5. package/lib/commonjs/flags/FlagsClient.js +268 -3
  6. package/lib/commonjs/flags/FlagsClient.js.map +1 -1
  7. package/lib/commonjs/flags/configuration/context.js +70 -0
  8. package/lib/commonjs/flags/configuration/context.js.map +1 -0
  9. package/lib/commonjs/flags/configuration/index.js +39 -0
  10. package/lib/commonjs/flags/configuration/index.js.map +1 -0
  11. package/lib/commonjs/flags/configuration/precomputed.js +172 -0
  12. package/lib/commonjs/flags/configuration/precomputed.js.map +1 -0
  13. package/lib/commonjs/flags/configuration/types.js +33 -0
  14. package/lib/commonjs/flags/configuration/types.js.map +1 -0
  15. package/lib/commonjs/flags/configuration/wire.js +19 -0
  16. package/lib/commonjs/flags/configuration/wire.js.map +1 -0
  17. package/lib/commonjs/flags/internal.js +7 -3
  18. package/lib/commonjs/flags/internal.js.map +1 -1
  19. package/lib/commonjs/index.js +13 -0
  20. package/lib/commonjs/index.js.map +1 -1
  21. package/lib/commonjs/version.js +1 -1
  22. package/lib/module/flags/FlagsClient.js +268 -3
  23. package/lib/module/flags/FlagsClient.js.map +1 -1
  24. package/lib/module/flags/configuration/context.js +62 -0
  25. package/lib/module/flags/configuration/context.js.map +1 -0
  26. package/lib/module/flags/configuration/index.js +18 -0
  27. package/lib/module/flags/configuration/index.js.map +1 -0
  28. package/lib/module/flags/configuration/precomputed.js +165 -0
  29. package/lib/module/flags/configuration/precomputed.js.map +1 -0
  30. package/lib/module/flags/configuration/types.js +27 -0
  31. package/lib/module/flags/configuration/types.js.map +1 -0
  32. package/lib/module/flags/configuration/wire.js +13 -0
  33. package/lib/module/flags/configuration/wire.js.map +1 -0
  34. package/lib/module/flags/internal.js +7 -3
  35. package/lib/module/flags/internal.js.map +1 -1
  36. package/lib/module/index.js +2 -1
  37. package/lib/module/index.js.map +1 -1
  38. package/lib/module/version.js +1 -1
  39. package/lib/typescript/flags/FlagsClient.d.ts +96 -0
  40. package/lib/typescript/flags/FlagsClient.d.ts.map +1 -1
  41. package/lib/typescript/flags/configuration/context.d.ts +20 -0
  42. package/lib/typescript/flags/configuration/context.d.ts.map +1 -0
  43. package/lib/typescript/flags/configuration/index.d.ts +5 -0
  44. package/lib/typescript/flags/configuration/index.d.ts.map +1 -0
  45. package/lib/typescript/flags/configuration/precomputed.d.ts +25 -0
  46. package/lib/typescript/flags/configuration/precomputed.d.ts.map +1 -0
  47. package/lib/typescript/flags/configuration/types.d.ts +24 -0
  48. package/lib/typescript/flags/configuration/types.d.ts.map +1 -0
  49. package/lib/typescript/flags/configuration/wire.d.ts +2 -0
  50. package/lib/typescript/flags/configuration/wire.d.ts.map +1 -0
  51. package/lib/typescript/flags/internal.d.ts.map +1 -1
  52. package/lib/typescript/flags/types.d.ts +1 -1
  53. package/lib/typescript/flags/types.d.ts.map +1 -1
  54. package/lib/typescript/index.d.ts +4 -2
  55. package/lib/typescript/index.d.ts.map +1 -1
  56. package/lib/typescript/version.d.ts +1 -1
  57. package/package.json +3 -2
  58. package/src/flags/FlagsClient.ts +305 -3
  59. package/src/flags/__tests__/FlagsClient.test.ts +596 -0
  60. package/src/flags/__tests__/internal.test.ts +45 -0
  61. package/src/flags/configuration/__tests__/context.test.ts +120 -0
  62. package/src/flags/configuration/__tests__/precomputed.test.ts +301 -0
  63. package/src/flags/configuration/__tests__/wire.test.ts +127 -0
  64. package/src/flags/configuration/context.ts +76 -0
  65. package/src/flags/configuration/index.ts +27 -0
  66. package/src/flags/configuration/precomputed.ts +215 -0
  67. package/src/flags/configuration/types.ts +47 -0
  68. package/src/flags/configuration/wire.ts +15 -0
  69. package/src/flags/internal.ts +6 -3
  70. package/src/flags/types.ts +3 -1
  71. package/src/index.tsx +8 -0
  72. package/src/version.ts +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_internal","require","normalizeWireContext","wireContext","targetingKey","attributes","processEvaluationContext","exports","contextMatchesConfiguration","activeContext","contextsEqual","a","b","attributesEqual","aKeys","Object","keys","bKeys","length","every","key"],"sourceRoot":"../../../../src","sources":["flags/configuration/context.ts"],"mappings":";;;;;;AAMA,IAAAA,SAAA,GAAAC,OAAA;AANA;AACA;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMC,oBAAoB,GAC7BC,WAAkC,IACd;EACpB,MAAM;IAAEC,YAAY;IAAE,GAAGC;EAAW,CAAC,GAAGF,WAAW;EAEnD,OAAO,IAAAG,kCAAwB,EAAC;IAC5B;IACAF,YAAY,EAAE,OAAOA,YAAY,KAAK,QAAQ,GAAGA,YAAY,GAAG,EAAE;IAClE;IACA;IACAC,UAAU,EAAEA;EAChB,CAAC,CAAC;AACN,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARAE,OAAA,CAAAL,oBAAA,GAAAA,oBAAA;AASO,MAAMM,2BAA2B,GAAGA,CACvCL,WAA8C,EAC9CM,aAAgC,KACtB;EACV,IAAI,CAACN,WAAW,EAAE;IACd,OAAO,IAAI;EACf;EAEA,OAAOO,aAAa,CAACR,oBAAoB,CAACC,WAAW,CAAC,EAAEM,aAAa,CAAC;AAC1E,CAAC;AAACF,OAAA,CAAAC,2BAAA,GAAAA,2BAAA;AAEF,MAAME,aAAa,GAAGA,CAACC,CAAoB,EAAEC,CAAoB,KAAc;EAC3E,IAAID,CAAC,CAACP,YAAY,KAAKQ,CAAC,CAACR,YAAY,EAAE;IACnC,OAAO,KAAK;EAChB;EAEA,OAAOS,eAAe,CAACF,CAAC,CAACN,UAAU,IAAI,CAAC,CAAC,EAAEO,CAAC,CAACP,UAAU,IAAI,CAAC,CAAC,CAAC;AAClE,CAAC;;AAED;AACA;AACA;AACA;AACA,MAAMQ,eAAe,GAAGA,CACpBF,CAAiC,EACjCC,CAAiC,KACvB;EACV,MAAME,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACL,CAAC,CAAC;EAC5B,MAAMM,KAAK,GAAGF,MAAM,CAACC,IAAI,CAACJ,CAAC,CAAC;EAE5B,IAAIE,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAE;IAC/B,OAAO,KAAK;EAChB;EAEA,OAAOJ,KAAK,CAACK,KAAK,CAACC,GAAG,IAAIT,CAAC,CAACS,GAAG,CAAC,KAAKR,CAAC,CAACQ,GAAG,CAAC,CAAC;AAChD,CAAC","ignoreList":[]}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "UnsupportedConfigurationError", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _precomputed.UnsupportedConfigurationError;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "configurationFromString", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _wire.configurationFromString;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "configurationToString", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _wire.configurationToString;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "decodePrecomputedFlags", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _precomputed.decodePrecomputedFlags;
28
+ }
29
+ });
30
+ Object.defineProperty(exports, "normalizeWireContext", {
31
+ enumerable: true,
32
+ get: function () {
33
+ return _context.normalizeWireContext;
34
+ }
35
+ });
36
+ var _wire = require("./wire");
37
+ var _precomputed = require("./precomputed");
38
+ var _context = require("./context");
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_wire","require","_precomputed","_context"],"sourceRoot":"../../../../src","sources":["flags/configuration/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAMA,IAAAE,QAAA,GAAAF,OAAA","ignoreList":[]}
@@ -0,0 +1,172 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.decodePrecomputedFlags = exports.UnsupportedConfigurationError = void 0;
7
+ var _InternalLog = require("../../InternalLog");
8
+ var _SdkVerbosity = require("../../config/types/SdkVerbosity");
9
+ var _types = require("./types");
10
+ /*
11
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
12
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
13
+ * Copyright 2016-Present Datadog, Inc.
14
+ */
15
+
16
+ /**
17
+ * Thrown when a configuration cannot be supported by this SDK (e.g. an obfuscated
18
+ * precomputed payload). Callers translate this into a provider error state rather
19
+ * than silently serving wrong data.
20
+ */
21
+ class UnsupportedConfigurationError extends Error {
22
+ constructor(message) {
23
+ super(message);
24
+ this.name = 'UnsupportedConfigurationError';
25
+ }
26
+ }
27
+
28
+ /**
29
+ * Decode a precomputed CDN response into the `FlagCacheEntry` map that `FlagsClient`
30
+ * caches and evaluates against — the same shape the native CDN fetch returns today.
31
+ *
32
+ * The mapping is ~1:1. Two transforms are applied per flag:
33
+ * - `value` is the typed `variationValue` as-is (`integer`/`float` are JS `number`s);
34
+ * - a string `variationValue` is derived (JSON for objects, `"true"/"false"` for
35
+ * booleans, `String(...)` otherwise) because native Android exposure tracking
36
+ * rebuilds the flag from the string form.
37
+ *
38
+ * @throws {UnsupportedConfigurationError} if the response is obfuscated, or its envelope is
39
+ * structurally malformed (missing/non-object `data.attributes.flags`).
40
+ */
41
+ exports.UnsupportedConfigurationError = UnsupportedConfigurationError;
42
+ const decodePrecomputedFlags = response => {
43
+ const attributes = response?.data?.attributes;
44
+
45
+ // `obfuscated` is not part of flagging-core's response type, but the CDN payload
46
+ // carries it. Read it defensively so obfuscated payloads are still rejected:
47
+ // de-hashing keys / decoding values is not implemented here, so fail predictably
48
+ // instead of mis-mapping hashed keys.
49
+ if (attributes?.obfuscated) {
50
+ throw new UnsupportedConfigurationError('Obfuscated precomputed configurations are not supported.');
51
+ }
52
+
53
+ // Validate the response envelope before trusting it. An untrusted wire can be JSON-valid yet
54
+ // structurally malformed (a null/non-object envelope, or a `flags` that is null or an array).
55
+ // Fail predictably so the caller classifies it as an error instead of silently decoding it to
56
+ // an empty — but "ready" — configuration. A genuinely empty `flags: {}` is still accepted.
57
+ const flags = attributes?.flags;
58
+ if (!isFlagsMap(flags)) {
59
+ throw new UnsupportedConfigurationError("Malformed precomputed configuration: 'data.attributes.flags' must be an object.");
60
+ }
61
+
62
+ // A Map (returned as-is) so a pathological flag keyed "__proto__" is stored as data
63
+ // and later looked up via `.get()` — never hitting the `Object.prototype` "__proto__"
64
+ // setter (on write) or the prototype chain (on read) the way a plain object would.
65
+ const cache = new Map();
66
+ for (const [key, flag] of Object.entries(flags)) {
67
+ const entry = toFlagCacheEntry(key, flag);
68
+ if (entry) {
69
+ cache.set(key, entry);
70
+ }
71
+ }
72
+ return cache;
73
+ };
74
+
75
+ // A well-formed flags container is a plain object (a possibly-empty map of flag key -> flag).
76
+ // `null`, arrays, and primitives are malformed envelopes.
77
+ exports.decodePrecomputedFlags = decodePrecomputedFlags;
78
+ const isFlagsMap = value => typeof value === 'object' && value !== null && !Array.isArray(value);
79
+ const toFlagCacheEntry = (key, flag) => {
80
+ // A malformed payload can carry a non-object flag (e.g. `flags: { "k": null }`).
81
+ // Skip the bad entry with a warning instead of throwing and aborting decoding of
82
+ // the whole configuration.
83
+ if (typeof flag !== 'object' || flag === null) {
84
+ _InternalLog.InternalLog.log(`Flag "${key}" is not an object. Omitting it from the configuration.`, _SdkVerbosity.SdkVerbosity.WARN);
85
+ return null;
86
+ }
87
+ const {
88
+ variationType,
89
+ variationValue,
90
+ variationKey,
91
+ allocationKey,
92
+ reason,
93
+ doLog,
94
+ extraLogging
95
+ } = flag;
96
+ if (typeof variationType !== 'string' || !_types.SUPPORTED_VARIATION_TYPES.has(variationType)) {
97
+ _InternalLog.InternalLog.log(`Flag "${key}" has an unsupported variation type "${String(variationType)}". Omitting it from the configuration.`, _SdkVerbosity.SdkVerbosity.WARN);
98
+ return null;
99
+ }
100
+ if (!valueMatchesVariationType(variationValue, variationType)) {
101
+ _InternalLog.InternalLog.log(`Flag "${key}" value does not match its variation type "${variationType}". Omitting it from the configuration.`, _SdkVerbosity.SdkVerbosity.WARN);
102
+ return null;
103
+ }
104
+
105
+ // The remaining fields feed evaluation and native exposure tracking. A corrupt
106
+ // payload could carry wrong types here, so validate before forwarding them.
107
+ if (typeof allocationKey !== 'string' || typeof variationKey !== 'string' || typeof reason !== 'string' || typeof doLog !== 'boolean' ||
108
+ // `extraLogging` must be a key/value map; an array (also `typeof === 'object'`) would
109
+ // break native exposure tracking that expects an object, so treat it as malformed.
110
+ extraLogging !== undefined && (typeof extraLogging !== 'object' || extraLogging === null || Array.isArray(extraLogging))) {
111
+ _InternalLog.InternalLog.log(`Flag "${key}" has malformed metadata. Omitting it from the configuration.`, _SdkVerbosity.SdkVerbosity.WARN);
112
+ return null;
113
+ }
114
+
115
+ // `serialId` is intentionally not propagated: `FlagCacheEntry` has no slot for it
116
+ // and the native CDN-fetched snapshot omits it too, so dropping it keeps
117
+ // offline/online parity.
118
+ return {
119
+ key,
120
+ value: variationValue,
121
+ allocationKey,
122
+ variationKey,
123
+ variationType,
124
+ variationValue: stringifyValue(variationValue),
125
+ reason,
126
+ doLog,
127
+ extraLogging: extraLogging ?? {}
128
+ };
129
+ };
130
+ const valueMatchesVariationType = (value, variationType) => {
131
+ switch (variationType) {
132
+ case 'boolean':
133
+ return typeof value === 'boolean';
134
+ case 'string':
135
+ return typeof value === 'string';
136
+ case 'number':
137
+ case 'float':
138
+ // Reject NaN/Infinity: native parsers can't round-trip them.
139
+ return typeof value === 'number' && Number.isFinite(value);
140
+ case 'integer':
141
+ // A fractional value under an integer flag would be truncated/mis-parsed
142
+ // natively, so require a whole number.
143
+ return Number.isInteger(value);
144
+ case 'object':
145
+ // The `object` variation type carries JSON. ffe-service enforces a top-level object at
146
+ // the API layer, so in practice the value is an object; that is not a storage
147
+ // constraint, so a malformed or hand-crafted payload could still carry any JSON value
148
+ // here. Accept it at decode (and stringify it for native tracking); a non-object value
149
+ // is then served the coded default with TYPE_MISMATCH at evaluation — see
150
+ // `FlagsClient.getObjectDetails`. So this only affects malformed wires, never the
151
+ // guaranteed-object values from a real Datadog config.
152
+ return true;
153
+ default:
154
+ return false;
155
+ }
156
+ };
157
+
158
+ /**
159
+ * Derive the string form of a flag value expected by native Android exposure tracking.
160
+ * Objects/arrays are JSON-encoded; everything else uses `String(...)`, which yields
161
+ * lowercase `"true"/"false"` for booleans.
162
+ */
163
+ const stringifyValue = value => {
164
+ if (value === null) {
165
+ return 'null';
166
+ }
167
+ if (typeof value === 'object') {
168
+ return JSON.stringify(value);
169
+ }
170
+ return String(value);
171
+ };
172
+ //# sourceMappingURL=precomputed.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_InternalLog","require","_SdkVerbosity","_types","UnsupportedConfigurationError","Error","constructor","message","name","exports","decodePrecomputedFlags","response","attributes","data","obfuscated","flags","isFlagsMap","cache","Map","key","flag","Object","entries","entry","toFlagCacheEntry","set","value","Array","isArray","InternalLog","log","SdkVerbosity","WARN","variationType","variationValue","variationKey","allocationKey","reason","doLog","extraLogging","SUPPORTED_VARIATION_TYPES","has","String","valueMatchesVariationType","undefined","stringifyValue","Number","isFinite","isInteger","JSON","stringify"],"sourceRoot":"../../../../src","sources":["flags/configuration/precomputed.ts"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAOA,IAAAE,MAAA,GAAAF,OAAA;AAdA;AACA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;AACA;AACO,MAAMG,6BAA6B,SAAS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F,aAAa;IACbC,cAAc,EAAEW,cAAc,CAACX,cAAc,CAAC;IAC9CG,MAAM;IACNC,KAAK;IACLC,YAAY,EAAEA,YAAY,IAAI,CAAC;EACnC,CAAC;AACL,CAAC;AAED,MAAMI,yBAAyB,GAAGA,CAC9BjB,KAAc,EACdO,aAAqB,KACX;EACV,QAAQA,aAAa;IACjB,KAAK,SAAS;MACV,OAAO,OAAOP,KAAK,KAAK,SAAS;IACrC,KAAK,QAAQ;MACT,OAAO,OAAOA,KAAK,KAAK,QAAQ;IACpC,KAAK,QAAQ;IACb,KAAK,OAAO;MACR;MACA,OAAO,OAAOA,KAAK,KAAK,QAAQ,IAAIoB,MAAM,CAACC,QAAQ,CAACrB,KAAK,CAAC;IAC9D,KAAK,SAAS;MACV;MACA;MACA,OAAOoB,MAAM,CAACE,SAAS,CAACtB,KAAK,CAAC;IAClC,KAAK,QAAQ;MACT;MACA;MACA;MACA;MACA;MACA;MACA;MACA,OAAO,IAAI;IACf;MACI,OAAO,KAAK;EACpB;AACJ,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA,MAAMmB,cAAc,GAAInB,KAAc,IAAa;EAC/C,IAAIA,KAAK,KAAK,IAAI,EAAE;IAChB,OAAO,MAAM;EACjB;EACA,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;IAC3B,OAAOuB,IAAI,CAACC,SAAS,CAACxB,KAAK,CAAC;EAChC;EACA,OAAOgB,MAAM,CAAChB,KAAK,CAAC;AACxB,CAAC","ignoreList":[]}
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SUPPORTED_VARIATION_TYPES = void 0;
7
+ /*
8
+ * Unless explicitly stated otherwise all files in this repository are licensed under the Apache License Version 2.0.
9
+ * This product includes software developed at Datadog (https://www.datadoghq.com/).
10
+ * Copyright 2016-Present Datadog, Inc.
11
+ */
12
+
13
+ /**
14
+ * The flag `variationType`s the decoder accepts. `@datadog/flagging-core` models the
15
+ * type as OpenFeature's `boolean | string | number | object`, and the CDN confirms only
16
+ * those are emitted. `integer`/`float` are kept here defensively — the decoder validates
17
+ * untrusted payloads and treats both as JavaScript `number`s.
18
+ */
19
+ const SUPPORTED_VARIATION_TYPES = exports.SUPPORTED_VARIATION_TYPES = new Set(['boolean', 'string', 'number', 'integer', 'float', 'object']);
20
+
21
+ /**
22
+ * The context an evaluation is performed against, as it appears **on the wire**.
23
+ *
24
+ * This is the OpenFeature-shaped context: a flat object with an optional
25
+ * `targetingKey` and arbitrary sibling attributes. It is intentionally different
26
+ * from the SDK's internal `EvaluationContext` (`{ targetingKey, attributes }`);
27
+ * callers must normalize before comparing the two.
28
+ */
29
+
30
+ // The wire/precomputed types are re-exported from `@datadog/flagging-core` so this SDK
31
+ // shares the canonical shapes instead of maintaining its own copies. Local names are
32
+ // kept so the rest of the SDK is insulated from the upstream naming.
33
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["SUPPORTED_VARIATION_TYPES","exports","Set"],"sourceRoot":"../../../../src","sources":["flags/configuration/types.ts"],"mappings":";;;;;;AAAA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMA,yBAA8C,GAAAC,OAAA,CAAAD,yBAAA,GAAG,IAAIE,GAAG,CAAC,CAClE,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,CACX,CAAC;;AAEF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA","ignoreList":[]}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "configurationFromString", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _flaggingCore.configurationFromString;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "configurationToString", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _flaggingCore.configurationToString;
16
+ }
17
+ });
18
+ var _flaggingCore = require("@datadog/flagging-core");
19
+ //# sourceMappingURL=wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_flaggingCore","require"],"sourceRoot":"../../../../src","sources":["flags/configuration/wire.ts"],"mappings":";;;;;;;;;;;;;;;;;AAWA,IAAAA,aAAA,GAAAC,OAAA","ignoreList":[]}
@@ -19,7 +19,11 @@ const processEvaluationContext = context => {
19
19
 
20
20
  // We should ignore non-primitive values in the context as per FFE SDK requirements OF.3.
21
21
  const providedAttributes = context.attributes ?? {};
22
- const attributes = {};
22
+
23
+ // Accumulate in a Map so reserved keys such as "__proto__" are handled as data
24
+ // instead of hitting the Object.prototype setter (which would silently drop them or
25
+ // pollute the prototype). Object.fromEntries then materializes own properties safely.
26
+ const attributes = new Map();
23
27
  for (const [key, value] of Object.entries(providedAttributes)) {
24
28
  const isPrimitiveValue = typeof value === 'boolean' || typeof value === 'string' || typeof value === 'number' || value === undefined || value === null;
25
29
  if (!isPrimitiveValue) {
@@ -29,11 +33,11 @@ const processEvaluationContext = context => {
29
33
  if (value === undefined) {
30
34
  continue;
31
35
  }
32
- attributes[key] = value;
36
+ attributes.set(key, value);
33
37
  }
34
38
  return {
35
39
  targetingKey,
36
- attributes
40
+ attributes: Object.fromEntries(attributes)
37
41
  };
38
42
  };
39
43
  exports.processEvaluationContext = processEvaluationContext;
@@ -1 +1 @@
1
- {"version":3,"names":["_InternalLog","require","_SdkVerbosity","processEvaluationContext","context","targetingKey","providedAttributes","attributes","key","value","Object","entries","isPrimitiveValue","undefined","InternalLog","log","SdkVerbosity","WARN","exports"],"sourceRoot":"../../../src","sources":["flags/internal.ts"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAPA;AACA;AACA;AACA;AACA;;AAmBO,MAAME,wBAAwB,GACjCC,OAA0B,IACN;EACpB,MAAM;IAAEC;EAAa,CAAC,GAAGD,OAAO;;EAEhC;EACA,MAAME,kBAA2C,GAC7CF,OAAO,CAACG,UAAU,IAAI,CAAC,CAAC;EAE5B,MAAMA,UAA0C,GAAG,CAAC,CAAC;EAErD,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACL,kBAAkB,CAAC,EAAE;IAC3D,MAAMM,gBAAgB,GAClB,OAAOH,KAAK,KAAK,SAAS,IAC1B,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAKI,SAAS,IACnBJ,KAAK,KAAK,IAAI;IAElB,IAAI,CAACG,gBAAgB,EAAE;MACnBE,wBAAW,CAACC,GAAG,CACX,sCAAsCP,GAAG,0EAA0E,EACnHQ,0BAAY,CAACC,IACjB,CAAC;MAED;IACJ;IAEA,IAAIR,KAAK,KAAKI,SAAS,EAAE;MACrB;IACJ;IAEAN,UAAU,CAACC,GAAG,CAAC,GAAGC,KAAK;EAC3B;EAEA,OAAO;IACHJ,YAAY;IACZE;EACJ,CAAC;AACL,CAAC;AAACW,OAAA,CAAAf,wBAAA,GAAAA,wBAAA","ignoreList":[]}
1
+ {"version":3,"names":["_InternalLog","require","_SdkVerbosity","processEvaluationContext","context","targetingKey","providedAttributes","attributes","Map","key","value","Object","entries","isPrimitiveValue","undefined","InternalLog","log","SdkVerbosity","WARN","set","fromEntries","exports"],"sourceRoot":"../../../src","sources":["flags/internal.ts"],"mappings":";;;;;;AAMA,IAAAA,YAAA,GAAAC,OAAA;AACA,IAAAC,aAAA,GAAAD,OAAA;AAPA;AACA;AACA;AACA;AACA;;AAmBO,MAAME,wBAAwB,GACjCC,OAA0B,IACN;EACpB,MAAM;IAAEC;EAAa,CAAC,GAAGD,OAAO;;EAEhC;EACA,MAAME,kBAA2C,GAC7CF,OAAO,CAACG,UAAU,IAAI,CAAC,CAAC;;EAE5B;EACA;EACA;EACA,MAAMA,UAAU,GAAG,IAAIC,GAAG,CAAyB,CAAC;EAEpD,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACN,kBAAkB,CAAC,EAAE;IAC3D,MAAMO,gBAAgB,GAClB,OAAOH,KAAK,KAAK,SAAS,IAC1B,OAAOA,KAAK,KAAK,QAAQ,IACzB,OAAOA,KAAK,KAAK,QAAQ,IACzBA,KAAK,KAAKI,SAAS,IACnBJ,KAAK,KAAK,IAAI;IAElB,IAAI,CAACG,gBAAgB,EAAE;MACnBE,wBAAW,CAACC,GAAG,CACX,sCAAsCP,GAAG,0EAA0E,EACnHQ,0BAAY,CAACC,IACjB,CAAC;MAED;IACJ;IAEA,IAAIR,KAAK,KAAKI,SAAS,EAAE;MACrB;IACJ;IAEAP,UAAU,CAACY,GAAG,CAACV,GAAG,EAAEC,KAAuB,CAAC;EAChD;EAEA,OAAO;IACHL,YAAY;IACZE,UAAU,EAAEI,MAAM,CAACS,WAAW,CAACb,UAAU;EAC7C,CAAC;AACL,CAAC;AAACc,OAAA,CAAAlB,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -243,6 +243,18 @@ Object.defineProperty(exports, "__ddExtractText", {
243
243
  return _ddBabelUtils.__ddExtractText;
244
244
  }
245
245
  });
246
+ Object.defineProperty(exports, "configurationFromString", {
247
+ enumerable: true,
248
+ get: function () {
249
+ return _configuration.configurationFromString;
250
+ }
251
+ });
252
+ Object.defineProperty(exports, "configurationToString", {
253
+ enumerable: true,
254
+ get: function () {
255
+ return _configuration.configurationToString;
256
+ }
257
+ });
246
258
  var _DdSdkReactNative = require("./DdSdkReactNative");
247
259
  var _InternalLog = require("./InternalLog");
248
260
  var _DatadogProviderConfiguration = require("./config/DatadogProviderConfiguration");
@@ -256,6 +268,7 @@ var _SdkVerbosity = require("./config/types/SdkVerbosity");
256
268
  var _TrackingConsent = require("./config/types/TrackingConsent");
257
269
  var _types = require("./config/types");
258
270
  var _DdFlags = require("./flags/DdFlags");
271
+ var _configuration = require("./flags/configuration");
259
272
  var _DdLogs = require("./logs/DdLogs");
260
273
  var _DdRum = require("./rum/DdRum");
261
274
  var _DdBabelInteractionTracking = require("./rum/instrumentation/interactionTracking/DdBabelInteractionTracking");
@@ -1 +1 @@
1
- {"version":3,"names":["_DdSdkReactNative","require","_InternalLog","_DatadogProviderConfiguration","_FileBasedConfiguration","_CoreConfiguration","_LogsConfiguration","_RumConfiguration","_TraceConfiguration","_ProxyConfiguration","_SdkVerbosity","_TrackingConsent","_types","_DdFlags","_DdLogs","_DdRum","_DdBabelInteractionTracking","_ddBabelUtils","_DatadogTracingContext","_DatadogTracingIdentifier","_TracingIdentifier","_graphqlHeaders","_types2","_DatadogProvider","_DdSdk","_DdTrace","_types3","_DefaultTimeProvider","_TimeProvider"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAIA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,kBAAA,GAAAL,OAAA;AAEA,IAAAM,iBAAA,GAAAN,OAAA;AAEA,IAAAO,mBAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AAIA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAOA,IAAAY,QAAA,GAAAZ,OAAA;AAQA,IAAAa,OAAA,GAAAb,OAAA;AACA,IAAAc,MAAA,GAAAd,OAAA;AACA,IAAAe,2BAAA,GAAAf,OAAA;AACA,IAAAgB,aAAA,GAAAhB,OAAA;AACA,IAAAiB,sBAAA,GAAAjB,OAAA;AACA,IAAAkB,yBAAA,GAAAlB,OAAA;AACA,IAAAmB,kBAAA,GAAAnB,OAAA;AAIA,IAAAoB,eAAA,GAAApB,OAAA;AAQA,IAAAqB,OAAA,GAAArB,OAAA;AACA,IAAAsB,gBAAA,GAAAtB,OAAA;AACA,IAAAuB,MAAA,GAAAvB,OAAA;AACA,IAAAwB,QAAA,GAAAxB,OAAA;AACA,IAAAyB,OAAA,GAAAzB,OAAA;AACA,IAAA0B,oBAAA,GAAA1B,OAAA;AAEA,IAAA2B,aAAA,GAAA3B,OAAA","ignoreList":[]}
1
+ {"version":3,"names":["_DdSdkReactNative","require","_InternalLog","_DatadogProviderConfiguration","_FileBasedConfiguration","_CoreConfiguration","_LogsConfiguration","_RumConfiguration","_TraceConfiguration","_ProxyConfiguration","_SdkVerbosity","_TrackingConsent","_types","_DdFlags","_configuration","_DdLogs","_DdRum","_DdBabelInteractionTracking","_ddBabelUtils","_DatadogTracingContext","_DatadogTracingIdentifier","_TracingIdentifier","_graphqlHeaders","_types2","_DatadogProvider","_DdSdk","_DdTrace","_types3","_DefaultTimeProvider","_TimeProvider"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,IAAAA,iBAAA,GAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,6BAAA,GAAAF,OAAA;AACA,IAAAG,uBAAA,GAAAH,OAAA;AAIA,IAAAI,kBAAA,GAAAJ,OAAA;AAEA,IAAAK,kBAAA,GAAAL,OAAA;AAEA,IAAAM,iBAAA,GAAAN,OAAA;AAEA,IAAAO,mBAAA,GAAAP,OAAA;AACA,IAAAQ,mBAAA,GAAAR,OAAA;AAIA,IAAAS,aAAA,GAAAT,OAAA;AACA,IAAAU,gBAAA,GAAAV,OAAA;AACA,IAAAW,MAAA,GAAAX,OAAA;AAOA,IAAAY,QAAA,GAAAZ,OAAA;AAEA,IAAAa,cAAA,GAAAb,OAAA;AAWA,IAAAc,OAAA,GAAAd,OAAA;AACA,IAAAe,MAAA,GAAAf,OAAA;AACA,IAAAgB,2BAAA,GAAAhB,OAAA;AACA,IAAAiB,aAAA,GAAAjB,OAAA;AACA,IAAAkB,sBAAA,GAAAlB,OAAA;AACA,IAAAmB,yBAAA,GAAAnB,OAAA;AACA,IAAAoB,kBAAA,GAAApB,OAAA;AAIA,IAAAqB,eAAA,GAAArB,OAAA;AAQA,IAAAsB,OAAA,GAAAtB,OAAA;AACA,IAAAuB,gBAAA,GAAAvB,OAAA;AACA,IAAAwB,MAAA,GAAAxB,OAAA;AACA,IAAAyB,QAAA,GAAAzB,OAAA;AACA,IAAA0B,OAAA,GAAA1B,OAAA;AACA,IAAA2B,oBAAA,GAAA3B,OAAA;AAEA,IAAA4B,aAAA,GAAA5B,OAAA","ignoreList":[]}
@@ -5,5 +5,5 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = void 0;
7
7
  // generated by genversion
8
- const version = exports.version = '3.5.3';
8
+ const version = exports.version = '3.5.4';
9
9
  //# sourceMappingURL=version.js.map