@datadog/flagging-core 0.1.0-preview.9 → 0.2.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/LICENSE +201 -0
- package/README.md +5 -0
- package/cjs/cache/abstract-assignment-cache.d.ts +39 -0
- package/cjs/cache/abstract-assignment-cache.d.ts.map +1 -0
- package/cjs/cache/abstract-assignment-cache.js +59 -0
- package/cjs/cache/abstract-assignment-cache.js.map +1 -0
- package/cjs/cache/index.d.ts +4 -0
- package/cjs/cache/index.d.ts.map +1 -0
- package/cjs/cache/index.js +20 -0
- package/cjs/cache/index.js.map +1 -0
- package/cjs/cache/lru-cache.d.ts +31 -0
- package/cjs/cache/lru-cache.d.ts.map +1 -0
- package/cjs/cache/lru-cache.js +85 -0
- package/cjs/cache/lru-cache.js.map +1 -0
- package/cjs/cache/lru-in-memory-assignment-cache.d.ts +16 -0
- package/cjs/cache/lru-in-memory-assignment-cache.d.ts.map +1 -0
- package/cjs/cache/lru-in-memory-assignment-cache.js +22 -0
- package/cjs/cache/lru-in-memory-assignment-cache.js.map +1 -0
- package/cjs/cache/non-expiring-in-memory-cache-assignment.d.ts +11 -0
- package/cjs/cache/non-expiring-in-memory-cache-assignment.d.ts.map +1 -0
- package/cjs/cache/non-expiring-in-memory-cache-assignment.js +17 -0
- package/cjs/cache/non-expiring-in-memory-cache-assignment.js.map +1 -0
- package/cjs/configuration/configuration.d.ts +1 -1
- package/cjs/configuration/exposureEvent.d.ts.map +1 -1
- package/cjs/configuration/exposureEvent.js +0 -1
- package/cjs/configuration/exposureEvent.js.map +1 -1
- package/cjs/configuration/exposureEvent.types.d.ts +13 -2
- package/cjs/configuration/exposureEvent.types.d.ts.map +1 -1
- package/cjs/index.d.ts +2 -0
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +2 -0
- package/cjs/index.js.map +1 -1
- package/cjs/obfuscation.d.ts +9 -0
- package/cjs/obfuscation.d.ts.map +1 -0
- package/cjs/obfuscation.js +23 -0
- package/cjs/obfuscation.js.map +1 -0
- package/esm/cache/abstract-assignment-cache.d.ts +39 -0
- package/esm/cache/abstract-assignment-cache.d.ts.map +1 -0
- package/esm/cache/abstract-assignment-cache.js +53 -0
- package/esm/cache/abstract-assignment-cache.js.map +1 -0
- package/esm/cache/index.d.ts +4 -0
- package/esm/cache/index.d.ts.map +1 -0
- package/esm/cache/index.js +4 -0
- package/esm/cache/index.js.map +1 -0
- package/esm/cache/lru-cache.d.ts +31 -0
- package/esm/cache/lru-cache.d.ts.map +1 -0
- package/esm/cache/lru-cache.js +81 -0
- package/esm/cache/lru-cache.js.map +1 -0
- package/esm/cache/lru-in-memory-assignment-cache.d.ts +16 -0
- package/esm/cache/lru-in-memory-assignment-cache.d.ts.map +1 -0
- package/esm/cache/lru-in-memory-assignment-cache.js +18 -0
- package/esm/cache/lru-in-memory-assignment-cache.js.map +1 -0
- package/esm/cache/non-expiring-in-memory-cache-assignment.d.ts +11 -0
- package/esm/cache/non-expiring-in-memory-cache-assignment.d.ts.map +1 -0
- package/esm/cache/non-expiring-in-memory-cache-assignment.js +13 -0
- package/esm/cache/non-expiring-in-memory-cache-assignment.js.map +1 -0
- package/esm/configuration/configuration.d.ts +1 -1
- package/esm/configuration/exposureEvent.d.ts.map +1 -1
- package/esm/configuration/exposureEvent.js +0 -1
- package/esm/configuration/exposureEvent.js.map +1 -1
- package/esm/configuration/exposureEvent.types.d.ts +13 -2
- package/esm/configuration/exposureEvent.types.d.ts.map +1 -1
- package/esm/index.d.ts +2 -0
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +2 -0
- package/esm/index.js.map +1 -1
- package/esm/obfuscation.d.ts +9 -0
- package/esm/obfuscation.d.ts.map +1 -0
- package/esm/obfuscation.js +16 -0
- package/esm/obfuscation.js.map +1 -0
- package/package.json +15 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Datadog, Inc.
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ExposureEvent } from '../configuration';
|
|
2
|
+
export type AssignmentCacheKey = Pick<ExposureEvent, 'flag' | 'subject'>;
|
|
3
|
+
export type AssignmentCacheEntry = ExposureEvent;
|
|
4
|
+
/** Converts an {@link AssignmentCacheKey} to a string. */
|
|
5
|
+
export declare function assignmentCacheKeyToString(exposureEvent: AssignmentCacheKey | ExposureEvent): string;
|
|
6
|
+
/** Converts an {@link AssignmentCacheValue} to a string. */
|
|
7
|
+
export declare function assignmentCacheValueToString(cacheValue: AssignmentCacheEntry): string;
|
|
8
|
+
export interface AsyncMap<K, V> {
|
|
9
|
+
get(key: K): Promise<V | undefined>;
|
|
10
|
+
set(key: K, value: V): Promise<void>;
|
|
11
|
+
has(key: K): Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
export interface AssignmentCache {
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
set(key: AssignmentCacheEntry): void;
|
|
16
|
+
has(key: AssignmentCacheEntry): boolean;
|
|
17
|
+
clear(): Promise<void> | void;
|
|
18
|
+
}
|
|
19
|
+
export declare abstract class AbstractAssignmentCache<T extends Map<string, string>> implements AssignmentCache {
|
|
20
|
+
protected readonly delegate: T;
|
|
21
|
+
protected constructor(delegate: T);
|
|
22
|
+
init(): Promise<void>;
|
|
23
|
+
/** Returns whether the provided {@link AssignmentCacheEntry} is present in the cache. */
|
|
24
|
+
has(entry: AssignmentCacheEntry): boolean;
|
|
25
|
+
get(key: AssignmentCacheKey): string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Stores the provided {@link AssignmentCacheEntry} in the cache. If the key already exists, it
|
|
28
|
+
* will be overwritten.
|
|
29
|
+
*/
|
|
30
|
+
set(entry: AssignmentCacheEntry): void;
|
|
31
|
+
/**
|
|
32
|
+
* Returns an array with all {@link AssignmentCacheEntry} entries in the cache as an array of
|
|
33
|
+
* {@link string}s.
|
|
34
|
+
*/
|
|
35
|
+
entries(): IterableIterator<[string, string]>;
|
|
36
|
+
/** Clears all entries from the cache. */
|
|
37
|
+
clear(): void;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=abstract-assignment-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-assignment-cache.d.ts","sourceRoot":"","sources":["../../src/cache/abstract-assignment-cache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAGrD,MAAM,MAAM,kBAAkB,GAAG,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;AACxE,MAAM,MAAM,oBAAoB,GAAG,aAAa,CAAA;AAEhD,0DAA0D;AAC1D,wBAAgB,0BAA0B,CAAC,aAAa,EAAE,kBAAkB,GAAG,aAAa,GAAG,MAAM,CAWpG;AAED,4DAA4D;AAC5D,wBAAgB,4BAA4B,CAAC,UAAU,EAAE,oBAAoB,GAAG,MAAM,CAErF;AAED,MAAM,WAAW,QAAQ,CAAC,CAAC,EAAE,CAAC;IAC5B,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC,CAAA;IAEnC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;IAEpC,GAAG,CAAC,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAA;IAErB,GAAG,CAAC,GAAG,EAAE,oBAAoB,GAAG,IAAI,CAAA;IAEpC,GAAG,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAA;IAEvC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAA;CAC9B;AAED,8BAAsB,uBAAuB,CAAC,CAAC,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAE,YAAW,eAAe;IAE/E,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,CAAC;IAApD,SAAS,aAAgC,QAAQ,EAAE,CAAC;IAEpD,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAIrB,yFAAyF;IACzF,GAAG,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO;IAIzC,GAAG,CAAC,GAAG,EAAE,kBAAkB,GAAG,MAAM,GAAG,SAAS;IAIhD;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,oBAAoB,GAAG,IAAI;IAItC;;;OAGG;IACH,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI7C,yCAAyC;IACzC,KAAK,IAAI,IAAI;CAGd"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AbstractAssignmentCache = void 0;
|
|
4
|
+
exports.assignmentCacheKeyToString = assignmentCacheKeyToString;
|
|
5
|
+
exports.assignmentCacheValueToString = assignmentCacheValueToString;
|
|
6
|
+
const obfuscation_1 = require("../obfuscation");
|
|
7
|
+
/** Converts an {@link AssignmentCacheKey} to a string. */
|
|
8
|
+
function assignmentCacheKeyToString(exposureEvent) {
|
|
9
|
+
const key = {
|
|
10
|
+
flag: {
|
|
11
|
+
key: exposureEvent.flag.key,
|
|
12
|
+
},
|
|
13
|
+
subject: {
|
|
14
|
+
id: exposureEvent.subject.id,
|
|
15
|
+
attributes: exposureEvent.subject.attributes,
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
return (0, obfuscation_1.getMD5Hash)(JSON.stringify(key));
|
|
19
|
+
}
|
|
20
|
+
/** Converts an {@link AssignmentCacheValue} to a string. */
|
|
21
|
+
function assignmentCacheValueToString(cacheValue) {
|
|
22
|
+
return (0, obfuscation_1.getMD5Hash)(JSON.stringify(cacheValue));
|
|
23
|
+
}
|
|
24
|
+
class AbstractAssignmentCache {
|
|
25
|
+
// key -> variation value hash
|
|
26
|
+
constructor(delegate) {
|
|
27
|
+
this.delegate = delegate;
|
|
28
|
+
}
|
|
29
|
+
init() {
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
/** Returns whether the provided {@link AssignmentCacheEntry} is present in the cache. */
|
|
33
|
+
has(entry) {
|
|
34
|
+
return this.get(entry) === assignmentCacheValueToString(entry);
|
|
35
|
+
}
|
|
36
|
+
get(key) {
|
|
37
|
+
return this.delegate.get(assignmentCacheKeyToString(key));
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stores the provided {@link AssignmentCacheEntry} in the cache. If the key already exists, it
|
|
41
|
+
* will be overwritten.
|
|
42
|
+
*/
|
|
43
|
+
set(entry) {
|
|
44
|
+
this.delegate.set(assignmentCacheKeyToString(entry), assignmentCacheValueToString(entry));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Returns an array with all {@link AssignmentCacheEntry} entries in the cache as an array of
|
|
48
|
+
* {@link string}s.
|
|
49
|
+
*/
|
|
50
|
+
entries() {
|
|
51
|
+
return this.delegate.entries();
|
|
52
|
+
}
|
|
53
|
+
/** Clears all entries from the cache. */
|
|
54
|
+
clear() {
|
|
55
|
+
this.delegate.clear();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
exports.AbstractAssignmentCache = AbstractAssignmentCache;
|
|
59
|
+
//# sourceMappingURL=abstract-assignment-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"abstract-assignment-cache.js","sourceRoot":"","sources":["../../src/cache/abstract-assignment-cache.ts"],"names":[],"mappings":";;;AAOA,gEAWC;AAGD,oEAEC;AAtBD,gDAA2C;AAK3C,0DAA0D;AAC1D,SAAgB,0BAA0B,CAAC,aAAiD;IAC1F,MAAM,GAAG,GAAuB;QAC9B,IAAI,EAAE;YACJ,GAAG,EAAE,aAAa,CAAC,IAAI,CAAC,GAAG;SAC5B;QACD,OAAO,EAAE;YACP,EAAE,EAAE,aAAa,CAAC,OAAO,CAAC,EAAE;YAC5B,UAAU,EAAE,aAAa,CAAC,OAAO,CAAC,UAAU;SAC7C;KACF,CAAA;IACD,OAAO,IAAA,wBAAU,EAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAA;AACxC,CAAC;AAED,4DAA4D;AAC5D,SAAgB,4BAA4B,CAAC,UAAgC;IAC3E,OAAO,IAAA,wBAAU,EAAC,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAA;AAC/C,CAAC;AAoBD,MAAsB,uBAAuB;IAC3C,8BAA8B;IAC9B,YAAyC,QAAW;QAAX,aAAQ,GAAR,QAAQ,CAAG;IAAG,CAAC;IAExD,IAAI;QACF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;IAC1B,CAAC;IAED,yFAAyF;IACzF,GAAG,CAAC,KAA2B;QAC7B,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,4BAA4B,CAAC,KAAK,CAAC,CAAA;IAChE,CAAC;IAED,GAAG,CAAC,GAAuB;QACzB,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC,CAAA;IAC3D,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,KAA2B;QAC7B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,0BAA0B,CAAC,KAAK,CAAC,EAAE,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAA;IAC3F,CAAC;IAED;;;OAGG;IACH,OAAO;QACL,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAA;IAChC,CAAC;IAED,yCAAyC;IACzC,KAAK;QACH,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAA;IACvB,CAAC;CACF;AArCD,0DAqCC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kCAAkC,CAAA;AAChD,cAAc,2CAA2C,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./abstract-assignment-cache"), exports);
|
|
18
|
+
__exportStar(require("./lru-in-memory-assignment-cache"), exports);
|
|
19
|
+
__exportStar(require("./non-expiring-in-memory-cache-assignment"), exports);
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA2C;AAC3C,mEAAgD;AAChD,4EAAyD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LRUCache is a simple implementation of a Least Recently Used (LRU) cache.
|
|
3
|
+
*
|
|
4
|
+
* Old items are evicted when the cache reaches its capacity.
|
|
5
|
+
*
|
|
6
|
+
* The cache is implemented as a Map, which maintains insertion order:
|
|
7
|
+
* ```
|
|
8
|
+
* Iteration happens in insertion order, which corresponds to the order in which each key-value pair
|
|
9
|
+
* was first inserted into the map by the set() method (that is, there wasn't a key with the same
|
|
10
|
+
* value already in the map when set() was called).
|
|
11
|
+
* ```
|
|
12
|
+
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
|
|
13
|
+
*/
|
|
14
|
+
export declare class LRUCache implements Map<string, string> {
|
|
15
|
+
protected readonly capacity: number;
|
|
16
|
+
protected readonly cache: Map<string, string>;
|
|
17
|
+
[Symbol.toStringTag]: string;
|
|
18
|
+
constructor(capacity: number);
|
|
19
|
+
[Symbol.iterator](): IterableIterator<[string, string]>;
|
|
20
|
+
forEach(callbackFn: (value: string, key: string, map: Map<string, string>) => void): void;
|
|
21
|
+
readonly size: number;
|
|
22
|
+
entries(): IterableIterator<[string, string]>;
|
|
23
|
+
clear(): void;
|
|
24
|
+
delete(key: string): boolean;
|
|
25
|
+
keys(): IterableIterator<string>;
|
|
26
|
+
values(): IterableIterator<string>;
|
|
27
|
+
has(key: string): boolean;
|
|
28
|
+
get(key: string): string | undefined;
|
|
29
|
+
set(key: string, value: string): this;
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=lru-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.d.ts","sourceRoot":"","sources":["../../src/cache/lru-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,qBAAa,QAAS,YAAW,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC;IAMtC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM;IAL/C,SAAS,CAAC,QAAQ,CAAC,KAAK,sBAA6B;IAGrD,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;gBAEG,QAAQ,EAAE,MAAM;IAE/C,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAIvD,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,IAAI,GAAG,IAAI;IAIzF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAkB;IAEvC,OAAO,IAAI,gBAAgB,CAAC,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAI7C,KAAK;IAIL,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAI5B,IAAI,IAAI,gBAAgB,CAAC,MAAM,CAAC;IAIhC,MAAM,IAAI,gBAAgB,CAAC,MAAM,CAAC;IAIlC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO;IAIzB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAoBpC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI;CAqBtC"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LRUCache = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* LRUCache is a simple implementation of a Least Recently Used (LRU) cache.
|
|
6
|
+
*
|
|
7
|
+
* Old items are evicted when the cache reaches its capacity.
|
|
8
|
+
*
|
|
9
|
+
* The cache is implemented as a Map, which maintains insertion order:
|
|
10
|
+
* ```
|
|
11
|
+
* Iteration happens in insertion order, which corresponds to the order in which each key-value pair
|
|
12
|
+
* was first inserted into the map by the set() method (that is, there wasn't a key with the same
|
|
13
|
+
* value already in the map when set() was called).
|
|
14
|
+
* ```
|
|
15
|
+
* Source: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map
|
|
16
|
+
*/
|
|
17
|
+
class LRUCache {
|
|
18
|
+
constructor(capacity) {
|
|
19
|
+
this.capacity = capacity;
|
|
20
|
+
this.cache = new Map();
|
|
21
|
+
this.size = this.cache.size;
|
|
22
|
+
}
|
|
23
|
+
[(Symbol.toStringTag, Symbol.iterator)]() {
|
|
24
|
+
return this.cache[Symbol.iterator]();
|
|
25
|
+
}
|
|
26
|
+
forEach(callbackFn) {
|
|
27
|
+
this.cache.forEach(callbackFn);
|
|
28
|
+
}
|
|
29
|
+
entries() {
|
|
30
|
+
return this.cache.entries();
|
|
31
|
+
}
|
|
32
|
+
clear() {
|
|
33
|
+
this.cache.clear();
|
|
34
|
+
}
|
|
35
|
+
delete(key) {
|
|
36
|
+
return this.cache.delete(key);
|
|
37
|
+
}
|
|
38
|
+
keys() {
|
|
39
|
+
return this.cache.keys();
|
|
40
|
+
}
|
|
41
|
+
values() {
|
|
42
|
+
return this.cache.values();
|
|
43
|
+
}
|
|
44
|
+
has(key) {
|
|
45
|
+
return this.cache.has(key);
|
|
46
|
+
}
|
|
47
|
+
get(key) {
|
|
48
|
+
if (!this.has(key)) {
|
|
49
|
+
return undefined;
|
|
50
|
+
}
|
|
51
|
+
const value = this.cache.get(key);
|
|
52
|
+
if (value !== undefined) {
|
|
53
|
+
// the delete and set operations are used together to ensure that the most recently accessed
|
|
54
|
+
// or added item is always considered the "newest" in terms of access order.
|
|
55
|
+
// This is crucial for maintaining the correct order of elements in the cache,
|
|
56
|
+
// which directly impacts which item is considered the least recently used (LRU) and
|
|
57
|
+
// thus eligible for eviction when the cache reaches its capacity.
|
|
58
|
+
this.delete(key);
|
|
59
|
+
this.cache.set(key, value);
|
|
60
|
+
}
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
set(key, value) {
|
|
64
|
+
if (this.capacity === 0) {
|
|
65
|
+
return this;
|
|
66
|
+
}
|
|
67
|
+
if (this.cache.has(key)) {
|
|
68
|
+
this.cache.delete(key);
|
|
69
|
+
}
|
|
70
|
+
else if (this.cache.size >= this.capacity) {
|
|
71
|
+
// To evict the least recently used (LRU) item, we retrieve the first key in the Map.
|
|
72
|
+
// This is possible because the Map object in JavaScript maintains the insertion order of the keys.
|
|
73
|
+
// Therefore, the first key represents the oldest entry, which is the least recently used item in our cache.
|
|
74
|
+
// We use Map.prototype.keys().next().value to obtain this oldest key and then delete it from the cache.
|
|
75
|
+
const oldestKey = this.cache.keys().next().value;
|
|
76
|
+
if (oldestKey) {
|
|
77
|
+
this.delete(oldestKey);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
this.cache.set(key, value);
|
|
81
|
+
return this;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
exports.LRUCache = LRUCache;
|
|
85
|
+
//# sourceMappingURL=lru-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-cache.js","sourceRoot":"","sources":["../../src/cache/lru-cache.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;GAYG;AACH,MAAa,QAAQ;IAMnB,YAA+B,QAAgB;QAAhB,aAAQ,GAAR,QAAQ,CAAQ;QAL5B,UAAK,GAAG,IAAI,GAAG,EAAkB,CAAC;QAe5C,SAAI,GAAW,IAAI,CAAC,KAAK,CAAC,IAAI,CAAA;IAVW,CAAC;IAEnD,EAJC,MAAM,CAAC,WAAW,EAIlB,MAAM,CAAC,QAAQ,EAAC;QACf,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAA;IACtC,CAAC;IAED,OAAO,CAAC,UAA0E;QAChF,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;IAChC,CAAC;IAID,OAAO;QACL,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAA;IAC7B,CAAC;IAED,KAAK;QACH,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAA;IACpB,CAAC;IAED,MAAM,CAAC,GAAW;QAChB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;IAC/B,CAAC;IAED,IAAI;QACF,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAA;IAC1B,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,CAAA;IAC5B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;IAC5B,CAAC;IAED,GAAG,CAAC,GAAW;QACb,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACnB,OAAO,SAAS,CAAA;QAClB,CAAC;QAED,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;QAEjC,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;YACxB,4FAA4F;YAC5F,4EAA4E;YAC5E,8EAA8E;YAC9E,oFAAoF;YACpF,kEAAkE;YAClE,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;YAChB,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAC5B,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAa;QAC5B,IAAI,IAAI,CAAC,QAAQ,KAAK,CAAC,EAAE,CAAC;YACxB,OAAO,IAAI,CAAA;QACb,CAAC;QAED,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;YACxB,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAA;QACxB,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,IAAI,CAAC,QAAQ,EAAE,CAAC;YAC5C,qFAAqF;YACrF,mGAAmG;YACnG,4GAA4G;YAC5G,wGAAwG;YACxG,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,CAAA;YAChD,IAAI,SAAS,EAAE,CAAC;gBACd,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,CAAA;YACxB,CAAC;QACH,CAAC;QAED,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAA;QAC1B,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AAnFD,4BAmFC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AbstractAssignmentCache } from './abstract-assignment-cache';
|
|
2
|
+
import { LRUCache } from './lru-cache';
|
|
3
|
+
/**
|
|
4
|
+
* A cache that uses the LRU algorithm to evict the least recently used items.
|
|
5
|
+
*
|
|
6
|
+
* It is used to limit the size of the cache.
|
|
7
|
+
*
|
|
8
|
+
* The primary use case is for server-side SDKs, where the cache is shared across
|
|
9
|
+
* multiple users. In this case, the cache size should be set to the maximum number
|
|
10
|
+
* of users that can be active at the same time.
|
|
11
|
+
* @param {number} maxSize - Maximum cache size
|
|
12
|
+
*/
|
|
13
|
+
export declare class LRUInMemoryAssignmentCache extends AbstractAssignmentCache<LRUCache> {
|
|
14
|
+
constructor(maxSize: number);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=lru-in-memory-assignment-cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-in-memory-assignment-cache.d.ts","sourceRoot":"","sources":["../../src/cache/lru-in-memory-assignment-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AACrE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAEtC;;;;;;;;;GASG;AACH,qBAAa,0BAA2B,SAAQ,uBAAuB,CAAC,QAAQ,CAAC;gBACnE,OAAO,EAAE,MAAM;CAG5B"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LRUInMemoryAssignmentCache = void 0;
|
|
4
|
+
const abstract_assignment_cache_1 = require("./abstract-assignment-cache");
|
|
5
|
+
const lru_cache_1 = require("./lru-cache");
|
|
6
|
+
/**
|
|
7
|
+
* A cache that uses the LRU algorithm to evict the least recently used items.
|
|
8
|
+
*
|
|
9
|
+
* It is used to limit the size of the cache.
|
|
10
|
+
*
|
|
11
|
+
* The primary use case is for server-side SDKs, where the cache is shared across
|
|
12
|
+
* multiple users. In this case, the cache size should be set to the maximum number
|
|
13
|
+
* of users that can be active at the same time.
|
|
14
|
+
* @param {number} maxSize - Maximum cache size
|
|
15
|
+
*/
|
|
16
|
+
class LRUInMemoryAssignmentCache extends abstract_assignment_cache_1.AbstractAssignmentCache {
|
|
17
|
+
constructor(maxSize) {
|
|
18
|
+
super(new lru_cache_1.LRUCache(maxSize));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.LRUInMemoryAssignmentCache = LRUInMemoryAssignmentCache;
|
|
22
|
+
//# sourceMappingURL=lru-in-memory-assignment-cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lru-in-memory-assignment-cache.js","sourceRoot":"","sources":["../../src/cache/lru-in-memory-assignment-cache.ts"],"names":[],"mappings":";;;AAAA,2EAAqE;AACrE,2CAAsC;AAEtC;;;;;;;;;GASG;AACH,MAAa,0BAA2B,SAAQ,mDAAiC;IAC/E,YAAY,OAAe;QACzB,KAAK,CAAC,IAAI,oBAAQ,CAAC,OAAO,CAAC,CAAC,CAAA;IAC9B,CAAC;CACF;AAJD,gEAIC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractAssignmentCache } from './abstract-assignment-cache';
|
|
2
|
+
/**
|
|
3
|
+
* A cache that never expires.
|
|
4
|
+
*
|
|
5
|
+
* The primary use case is for client-side SDKs, where the cache is only used
|
|
6
|
+
* for a single user.
|
|
7
|
+
*/
|
|
8
|
+
export declare class NonExpiringInMemoryAssignmentCache extends AbstractAssignmentCache<Map<string, string>> {
|
|
9
|
+
constructor(store?: Map<string, string>);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=non-expiring-in-memory-cache-assignment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-expiring-in-memory-cache-assignment.d.ts","sourceRoot":"","sources":["../../src/cache/non-expiring-in-memory-cache-assignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAErE;;;;;GAKG;AACH,qBAAa,kCAAmC,SAAQ,uBAAuB,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBACtF,KAAK,sBAA4B;CAG9C"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NonExpiringInMemoryAssignmentCache = void 0;
|
|
4
|
+
const abstract_assignment_cache_1 = require("./abstract-assignment-cache");
|
|
5
|
+
/**
|
|
6
|
+
* A cache that never expires.
|
|
7
|
+
*
|
|
8
|
+
* The primary use case is for client-side SDKs, where the cache is only used
|
|
9
|
+
* for a single user.
|
|
10
|
+
*/
|
|
11
|
+
class NonExpiringInMemoryAssignmentCache extends abstract_assignment_cache_1.AbstractAssignmentCache {
|
|
12
|
+
constructor(store = new Map()) {
|
|
13
|
+
super(store);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
exports.NonExpiringInMemoryAssignmentCache = NonExpiringInMemoryAssignmentCache;
|
|
17
|
+
//# sourceMappingURL=non-expiring-in-memory-cache-assignment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"non-expiring-in-memory-cache-assignment.js","sourceRoot":"","sources":["../../src/cache/non-expiring-in-memory-cache-assignment.ts"],"names":[],"mappings":";;;AAAA,2EAAqE;AAErE;;;;;GAKG;AACH,MAAa,kCAAmC,SAAQ,mDAA4C;IAClG,YAAY,QAAQ,IAAI,GAAG,EAAkB;QAC3C,KAAK,CAAC,KAAK,CAAC,CAAA;IACd,CAAC;CACF;AAJD,gFAIC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposureEvent.d.ts","sourceRoot":"","sources":["../../src/configuration/exposureEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EACrD,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC5B,aAAa,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"exposureEvent.d.ts","sourceRoot":"","sources":["../../src/configuration/exposureEvent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AACxF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1D,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,SAAS,EACrD,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAC5B,aAAa,GAAG,SAAS,CA8B3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposureEvent.js","sourceRoot":"","sources":["../../src/configuration/exposureEvent.ts"],"names":[],"mappings":";;AAGA,
|
|
1
|
+
{"version":3,"file":"exposureEvent.js","sourceRoot":"","sources":["../../src/configuration/exposureEvent.ts"],"names":[],"mappings":";;AAGA,kDAiCC;AAjCD,SAAgB,mBAAmB,CACjC,OAA0B,EAC1B,OAA6B;;IAE7B,iCAAiC;IACjC,IAAI,CAAC,CAAA,MAAA,OAAO,CAAC,YAAY,0CAAE,KAAK,CAAA,EAAE,CAAC;QACjC,OAAM;IACR,CAAC;IAED,kFAAkF;IAClF,MAAM,aAAa,GAAG,MAAA,OAAO,CAAC,YAAY,0CAAE,aAAuB,CAAA;IACnE,MAAM,UAAU,GAAG,OAAO,CAAC,OAAO,CAAA;IAClC,IAAI,CAAC,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC,OAAM;IACR,CAAC;IAED,MAAM,EAAE,YAAY,EAAE,EAAE,GAAG,EAAE,EAAE,GAAG,UAAU,EAAE,GAAG,OAAO,CAAA;IAExD,OAAO;QACL,UAAU,EAAE;YACV,GAAG,EAAE,aAAa;SACnB;QACD,IAAI,EAAE;YACJ,GAAG,EAAE,OAAO,CAAC,OAAO;SACrB;QACD,OAAO,EAAE;YACP,GAAG,EAAE,UAAU;SAChB;QACD,OAAO,EAAE;YACP,EAAE;YACF,UAAU;SACX;KACsB,CAAA;AAC3B,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import type { EvaluationContext } from '@openfeature/core';
|
|
2
2
|
export interface ExposureEvent {
|
|
3
|
-
/** Unix timestamp in milliseconds */
|
|
4
|
-
timestamp: number;
|
|
5
3
|
allocation: {
|
|
6
4
|
key: string;
|
|
7
5
|
};
|
|
@@ -15,5 +13,18 @@ export interface ExposureEvent {
|
|
|
15
13
|
id: string;
|
|
16
14
|
attributes: EvaluationContext;
|
|
17
15
|
};
|
|
16
|
+
service?: string;
|
|
17
|
+
rum?: {
|
|
18
|
+
application?: {
|
|
19
|
+
id?: string;
|
|
20
|
+
};
|
|
21
|
+
view?: {
|
|
22
|
+
url?: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export interface ExposureEventWithTimestamp extends ExposureEvent {
|
|
27
|
+
/** Unix timestamp in milliseconds */
|
|
28
|
+
timestamp: number;
|
|
18
29
|
}
|
|
19
30
|
//# sourceMappingURL=exposureEvent.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exposureEvent.types.d.ts","sourceRoot":"","sources":["../../src/configuration/exposureEvent.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,
|
|
1
|
+
{"version":3,"file":"exposureEvent.types.d.ts","sourceRoot":"","sources":["../../src/configuration/exposureEvent.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,MAAM,WAAW,aAAa;IAC5B,UAAU,EAAE;QACV,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,IAAI,EAAE;QACJ,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,OAAO,EAAE;QACP,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,OAAO,EAAE;QACP,EAAE,EAAE,MAAM,CAAA;QACV,UAAU,EAAE,iBAAiB,CAAA;KAC9B,CAAA;IACD,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,GAAG,CAAC,EAAE;QACJ,WAAW,CAAC,EAAE;YACZ,EAAE,CAAC,EAAE,MAAM,CAAA;SACZ,CAAA;QACD,IAAI,CAAC,EAAE;YACL,GAAG,CAAC,EAAE,MAAM,CAAA;SACb,CAAA;KACF,CAAA;CACF;AAED,MAAM,WAAW,0BAA2B,SAAQ,aAAa;IAC/D,qCAAqC;IACrC,SAAS,EAAE,MAAM,CAAA;CAClB"}
|
package/cjs/index.d.ts
CHANGED
package/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA"}
|