@datadog/openfeature-node-server 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/configuration/evaluateForSubject.d.ts +1 -6
- package/cjs/configuration/evaluateForSubject.d.ts.map +1 -1
- package/cjs/configuration/evaluateForSubject.js +4 -164
- package/cjs/configuration/evaluateForSubject.js.map +1 -1
- package/cjs/configuration/evaluation.d.ts +1 -4
- package/cjs/configuration/evaluation.d.ts.map +1 -1
- package/cjs/configuration/evaluation.js +3 -46
- package/cjs/configuration/evaluation.js.map +1 -1
- package/cjs/configuration/evaluationMetadata.d.ts +2 -0
- package/cjs/configuration/evaluationMetadata.d.ts.map +1 -0
- package/cjs/configuration/evaluationMetadata.js +6 -0
- package/cjs/configuration/evaluationMetadata.js.map +1 -0
- package/cjs/configuration/ufc-v1.d.ts +2 -53
- package/cjs/configuration/ufc-v1.d.ts.map +1 -1
- package/cjs/configuration/ufc-v1.js +3 -16
- package/cjs/configuration/ufc-v1.js.map +1 -1
- package/cjs/provider.d.ts.map +1 -1
- package/cjs/provider.js +2 -1
- package/cjs/provider.js.map +1 -1
- package/cjs/rules/rules.d.ts +2 -50
- package/cjs/rules/rules.d.ts.map +1 -1
- package/cjs/rules/rules.js +4 -68
- package/cjs/rules/rules.js.map +1 -1
- package/cjs/shards/matchesShard.d.ts +1 -3
- package/cjs/shards/matchesShard.d.ts.map +1 -1
- package/cjs/shards/matchesShard.js +3 -13
- package/cjs/shards/matchesShard.js.map +1 -1
- package/cjs/shards/sharders.d.ts +1 -11
- package/cjs/shards/sharders.d.ts.map +1 -1
- package/cjs/shards/sharders.js +5 -27
- package/cjs/shards/sharders.js.map +1 -1
- package/esm/configuration/evaluateForSubject.d.ts +1 -6
- package/esm/configuration/evaluateForSubject.d.ts.map +1 -1
- package/esm/configuration/evaluateForSubject.js +1 -162
- package/esm/configuration/evaluateForSubject.js.map +1 -1
- package/esm/configuration/evaluation.d.ts +1 -4
- package/esm/configuration/evaluation.d.ts.map +1 -1
- package/esm/configuration/evaluation.js +1 -45
- package/esm/configuration/evaluation.js.map +1 -1
- package/esm/configuration/evaluationMetadata.d.ts +2 -0
- package/esm/configuration/evaluationMetadata.d.ts.map +1 -0
- package/esm/configuration/evaluationMetadata.js +2 -0
- package/esm/configuration/evaluationMetadata.js.map +1 -0
- package/esm/configuration/ufc-v1.d.ts +2 -53
- package/esm/configuration/ufc-v1.d.ts.map +1 -1
- package/esm/configuration/ufc-v1.js +1 -15
- package/esm/configuration/ufc-v1.js.map +1 -1
- package/esm/provider.d.ts.map +1 -1
- package/esm/provider.js +2 -1
- package/esm/provider.js.map +1 -1
- package/esm/rules/rules.d.ts +2 -50
- package/esm/rules/rules.d.ts.map +1 -1
- package/esm/rules/rules.js +1 -66
- package/esm/rules/rules.js.map +1 -1
- package/esm/shards/matchesShard.d.ts +1 -3
- package/esm/shards/matchesShard.d.ts.map +1 -1
- package/esm/shards/matchesShard.js +1 -12
- package/esm/shards/matchesShard.js.map +1 -1
- package/esm/shards/sharders.d.ts +1 -11
- package/esm/shards/sharders.d.ts.map +1 -1
- package/esm/shards/sharders.js +1 -23
- package/esm/shards/sharders.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export function matchesShard(shard, subjectKey, customSharder) {
|
|
3
|
-
const sharder = customSharder !== null && customSharder !== void 0 ? customSharder : new MD5Sharder();
|
|
4
|
-
const assignedShard = sharder.getShard(hashKey(shard.salt, subjectKey), shard.totalShards);
|
|
5
|
-
return shard.ranges.some((range) => isInShardRange(assignedShard, range));
|
|
6
|
-
}
|
|
7
|
-
function isInShardRange(shard, range) {
|
|
8
|
-
return range.start <= shard && shard < range.end;
|
|
9
|
-
}
|
|
10
|
-
function hashKey(salt, subjectKey) {
|
|
11
|
-
return `${salt}-${subjectKey}`;
|
|
12
|
-
}
|
|
1
|
+
export { matchesShard } from '@datadog/flagging-core';
|
|
13
2
|
//# sourceMappingURL=matchesShard.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"matchesShard.js","sourceRoot":"","sources":["../../src/shards/matchesShard.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"matchesShard.js","sourceRoot":"","sources":["../../src/shards/matchesShard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAA"}
|
package/esm/shards/sharders.d.ts
CHANGED
|
@@ -1,12 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
abstract getShard(input: string, totalShards: number): number;
|
|
3
|
-
}
|
|
4
|
-
export declare class MD5Sharder extends Sharder {
|
|
5
|
-
getShard(input: string, totalShards: number): number;
|
|
6
|
-
}
|
|
7
|
-
export declare class DeterministicSharder extends Sharder {
|
|
8
|
-
private lookup;
|
|
9
|
-
constructor(lookup: Record<string, number>);
|
|
10
|
-
getShard(input: string, _totalShards: number): number;
|
|
11
|
-
}
|
|
1
|
+
export { DeterministicSharder, MD5Sharder, Sharder } from '@datadog/flagging-core';
|
|
12
2
|
//# sourceMappingURL=sharders.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharders.d.ts","sourceRoot":"","sources":["../../src/shards/sharders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sharders.d.ts","sourceRoot":"","sources":["../../src/shards/sharders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA"}
|
package/esm/shards/sharders.js
CHANGED
|
@@ -1,24 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export class Sharder {
|
|
3
|
-
}
|
|
4
|
-
export class MD5Sharder extends Sharder {
|
|
5
|
-
getShard(input, totalShards) {
|
|
6
|
-
const hashOutput = getMD5Hash(input);
|
|
7
|
-
// get the first 4 bytes of the md5 hex string and parse it using base 16
|
|
8
|
-
// (8 hex characters represent 4 bytes, e.g. 0xffffffff represents the max 4-byte integer)
|
|
9
|
-
const intFromHash = parseInt(hashOutput.slice(0, 8), 16);
|
|
10
|
-
return intFromHash % totalShards;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export class DeterministicSharder extends Sharder {
|
|
14
|
-
constructor(lookup) {
|
|
15
|
-
super();
|
|
16
|
-
this.lookup = lookup;
|
|
17
|
-
}
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
19
|
-
getShard(input, _totalShards) {
|
|
20
|
-
var _a;
|
|
21
|
-
return (_a = this.lookup[input]) !== null && _a !== void 0 ? _a : 0;
|
|
22
|
-
}
|
|
23
|
-
}
|
|
1
|
+
export { DeterministicSharder, MD5Sharder, Sharder } from '@datadog/flagging-core';
|
|
24
2
|
//# sourceMappingURL=sharders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharders.js","sourceRoot":"","sources":["../../src/shards/sharders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"sharders.js","sourceRoot":"","sources":["../../src/shards/sharders.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@datadog/openfeature-node-server",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Node.js server bindings for OpenFeature (wraps @datadog/flagging-core)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://github.com/DataDog/openfeature-js-client#readme",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
"typecheck": "tsc --noEmit"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@datadog/flagging-core": "
|
|
39
|
+
"@datadog/flagging-core": "2.0.1",
|
|
40
|
+
"@datadog/js-core": "0.0.3"
|
|
40
41
|
},
|
|
41
42
|
"peerDependencies": {
|
|
42
43
|
"@openfeature/server-sdk": ">=1.15.1"
|