@ember-data/store 4.10.0-alpha.2 → 4.10.0-alpha.21

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 (39) hide show
  1. package/addon/-private.js +1 -0
  2. package/addon/-private.js.map +1 -0
  3. package/addon/index-12e1fcb9.js +7660 -0
  4. package/addon/index-12e1fcb9.js.map +1 -0
  5. package/addon/index.js +1 -0
  6. package/addon/index.js.map +1 -0
  7. package/addon-main.js +90 -0
  8. package/package.json +44 -15
  9. package/addon/-private/caches/identifier-cache.ts +0 -686
  10. package/addon/-private/caches/instance-cache.ts +0 -695
  11. package/addon/-private/caches/record-data-for.ts +0 -34
  12. package/addon/-private/index.ts +0 -59
  13. package/addon/-private/legacy-model-support/record-reference.ts +0 -240
  14. package/addon/-private/legacy-model-support/schema-definition-service.ts +0 -148
  15. package/addon/-private/legacy-model-support/shim-model-class.ts +0 -97
  16. package/addon/-private/managers/record-array-manager.ts +0 -379
  17. package/addon/-private/managers/record-data-manager.ts +0 -845
  18. package/addon/-private/managers/record-data-store-wrapper.ts +0 -425
  19. package/addon/-private/managers/record-notification-manager.ts +0 -111
  20. package/addon/-private/network/fetch-manager.ts +0 -567
  21. package/addon/-private/network/finders.js +0 -104
  22. package/addon/-private/network/request-cache.ts +0 -132
  23. package/addon/-private/network/snapshot-record-array.ts +0 -209
  24. package/addon/-private/network/snapshot.ts +0 -563
  25. package/addon/-private/proxies/promise-proxies.ts +0 -228
  26. package/addon/-private/proxies/promise-proxy-base.js +0 -7
  27. package/addon/-private/record-arrays/identifier-array.ts +0 -929
  28. package/addon/-private/store-service.ts +0 -2896
  29. package/addon/-private/utils/coerce-id.ts +0 -41
  30. package/addon/-private/utils/common.js +0 -65
  31. package/addon/-private/utils/construct-resource.ts +0 -61
  32. package/addon/-private/utils/identifer-debug-consts.ts +0 -3
  33. package/addon/-private/utils/is-non-empty-string.ts +0 -3
  34. package/addon/-private/utils/normalize-model-name.ts +0 -21
  35. package/addon/-private/utils/promise-record.ts +0 -15
  36. package/addon/-private/utils/serializer-response.ts +0 -86
  37. package/addon/-private/utils/uuid-polyfill.ts +0 -73
  38. package/addon/index.ts +0 -14
  39. package/index.js +0 -49
@@ -1,425 +0,0 @@
1
- import { assert, deprecate } from '@ember/debug';
2
-
3
- import { DEPRECATE_V1CACHE_STORE_APIS } from '@ember-data/private-build-infra/deprecations';
4
- import type { RecordIdentifier, StableRecordIdentifier } from '@ember-data/types/q/identifier';
5
- import type { RecordData } from '@ember-data/types/q/record-data';
6
- import type { AttributesSchema, RelationshipsSchema } from '@ember-data/types/q/record-data-schemas';
7
- import type {
8
- LegacyRecordDataStoreWrapper,
9
- V2RecordDataStoreWrapper as StoreWrapper,
10
- } from '@ember-data/types/q/record-data-store-wrapper';
11
- import { SchemaDefinitionService } from '@ember-data/types/q/schema-definition-service';
12
-
13
- import { IdentifierCache, isStableIdentifier } from '../caches/identifier-cache';
14
- import type Store from '../store-service';
15
- import coerceId from '../utils/coerce-id';
16
- import constructResource from '../utils/construct-resource';
17
- import normalizeModelName from '../utils/normalize-model-name';
18
- import { NotificationType } from './record-notification-manager';
19
-
20
- /**
21
- @module @ember-data/store
22
- */
23
-
24
- class LegacyWrapper implements LegacyRecordDataStoreWrapper {
25
- declare _willNotify: boolean;
26
- declare _pendingNotifies: Map<StableRecordIdentifier, Set<string>>;
27
- declare _store: Store;
28
-
29
- constructor(_store: Store) {
30
- this._store = _store;
31
- this._willNotify = false;
32
- this._pendingNotifies = new Map();
33
- }
34
-
35
- get identifierCache(): IdentifierCache {
36
- return this._store.identifierCache;
37
- }
38
-
39
- _scheduleNotification(identifier: StableRecordIdentifier, key: string) {
40
- let pending = this._pendingNotifies.get(identifier);
41
-
42
- if (!pending) {
43
- pending = new Set();
44
- this._pendingNotifies.set(identifier, pending);
45
- }
46
- pending.add(key);
47
-
48
- if (this._willNotify === true) {
49
- return;
50
- }
51
-
52
- this._willNotify = true;
53
- // it's possible a RecordData adhoc notifies us,
54
- // in which case we sync flush
55
- if (this._store._cbs) {
56
- this._store._schedule('notify', () => this._flushNotifications());
57
- } else {
58
- this._flushNotifications();
59
- }
60
- }
61
-
62
- _flushNotifications(): void {
63
- if (this._willNotify === false) {
64
- return;
65
- }
66
-
67
- let pending = this._pendingNotifies;
68
- this._pendingNotifies = new Map();
69
- this._willNotify = false;
70
-
71
- pending.forEach((set, identifier) => {
72
- set.forEach((key) => {
73
- this._store._notificationManager.notify(identifier, 'relationships', key);
74
- });
75
- });
76
- }
77
-
78
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key?: string): void {
79
- assert(`Expected a stable identifier`, isStableIdentifier(identifier));
80
-
81
- // TODO do we still get value from this?
82
- if (namespace === 'relationships' && key) {
83
- this._scheduleNotification(identifier, key);
84
- return;
85
- }
86
-
87
- this._store._notificationManager.notify(identifier, namespace, key);
88
-
89
- if (namespace === 'state') {
90
- this._store.recordArrayManager.identifierChanged(identifier);
91
- }
92
- }
93
-
94
- notifyErrorsChange(type: string, id: string, lid: string | null): void;
95
- notifyErrorsChange(type: string, id: string | null, lid: string): void;
96
- notifyErrorsChange(type: string, id: string | null, lid: string | null): void {
97
- if (DEPRECATE_V1CACHE_STORE_APIS) {
98
- deprecate(`StoreWrapper.notifyErrorsChange has been deprecated in favor of StoreWrapper.notifyChange`, false, {
99
- id: 'ember-data:deprecate-v1cache-store-apis',
100
- for: 'ember-data',
101
- until: '5.0',
102
- since: { enabled: '4.7', available: '4.7' },
103
- });
104
- }
105
- const resource = constructResource(type, id, lid);
106
- const identifier = this.identifierCache.getOrCreateRecordIdentifier(resource);
107
-
108
- this._store._notificationManager.notify(identifier, 'errors');
109
- }
110
-
111
- attributesDefinitionFor(type: string): AttributesSchema {
112
- if (DEPRECATE_V1CACHE_STORE_APIS) {
113
- deprecate(
114
- `StoreWrapper.attributesDefinitionFor has been deprecated in favor of StoreWrapper.getSchemaDefinitionService().attributesDefinitionFor`,
115
- false,
116
- {
117
- id: 'ember-data:deprecate-v1cache-store-apis',
118
- for: 'ember-data',
119
- until: '5.0',
120
- since: { enabled: '4.7', available: '4.7' },
121
- }
122
- );
123
- }
124
- return this._store.getSchemaDefinitionService().attributesDefinitionFor({ type });
125
- }
126
-
127
- relationshipsDefinitionFor(type: string): RelationshipsSchema {
128
- if (DEPRECATE_V1CACHE_STORE_APIS) {
129
- deprecate(
130
- `StoreWrapper.relationshipsDefinitionFor has been deprecated in favor of StoreWrapper.getSchemaDefinitionService().relationshipsDefinitionFor`,
131
- false,
132
- {
133
- id: 'ember-data:deprecate-v1cache-store-apis',
134
- for: 'ember-data',
135
- until: '5.0',
136
- since: { enabled: '4.7', available: '4.7' },
137
- }
138
- );
139
- }
140
- return this._store.getSchemaDefinitionService().relationshipsDefinitionFor({ type });
141
- }
142
-
143
- getSchemaDefinitionService(): SchemaDefinitionService {
144
- return this._store.getSchemaDefinitionService();
145
- }
146
-
147
- notifyPropertyChange(type: string, id: string | null, lid: string, key?: string): void;
148
- notifyPropertyChange(type: string, id: string, lid: string | null | undefined, key?: string): void;
149
- notifyPropertyChange(type: string, id: string | null, lid: string | null | undefined, key?: string): void {
150
- if (DEPRECATE_V1CACHE_STORE_APIS) {
151
- deprecate(`StoreWrapper.notifyPropertyChange has been deprecated in favor of StoreWrapper.notifyChange`, false, {
152
- id: 'ember-data:deprecate-v1cache-store-apis',
153
- for: 'ember-data',
154
- until: '5.0',
155
- since: { enabled: '4.7', available: '4.7' },
156
- });
157
- }
158
- const resource = constructResource(type, id, lid);
159
- const identifier = this.identifierCache.getOrCreateRecordIdentifier(resource);
160
-
161
- this._store._notificationManager.notify(identifier, 'attributes', key);
162
- }
163
-
164
- notifyHasManyChange(type: string, id: string | null, lid: string, key: string): void;
165
- notifyHasManyChange(type: string, id: string, lid: string | null | undefined, key: string): void;
166
- notifyHasManyChange(type: string, id: string | null, lid: string | null | undefined, key: string): void {
167
- if (DEPRECATE_V1CACHE_STORE_APIS) {
168
- deprecate(`StoreWrapper.notifyHasManyChange has been deprecated in favor of StoreWrapper.notifyChange`, false, {
169
- id: 'ember-data:deprecate-v1cache-store-apis',
170
- for: 'ember-data',
171
- until: '5.0',
172
- since: { enabled: '4.7', available: '4.7' },
173
- });
174
- }
175
- const resource = constructResource(type, id, lid);
176
- const identifier = this.identifierCache.getOrCreateRecordIdentifier(resource);
177
- this._scheduleNotification(identifier, key);
178
- }
179
-
180
- notifyBelongsToChange(type: string, id: string | null, lid: string, key: string): void;
181
- notifyBelongsToChange(type: string, id: string, lid: string | null | undefined, key: string): void;
182
- notifyBelongsToChange(type: string, id: string | null, lid: string | null | undefined, key: string): void {
183
- if (DEPRECATE_V1CACHE_STORE_APIS) {
184
- deprecate(`StoreWrapper.notifyBelongsToChange has been deprecated in favor of StoreWrapper.notifyChange`, false, {
185
- id: 'ember-data:deprecate-v1cache-store-apis',
186
- for: 'ember-data',
187
- until: '5.0',
188
- since: { enabled: '4.7', available: '4.7' },
189
- });
190
- }
191
- const resource = constructResource(type, id, lid);
192
- const identifier = this.identifierCache.getOrCreateRecordIdentifier(resource);
193
-
194
- this._scheduleNotification(identifier, key);
195
- }
196
-
197
- notifyStateChange(type: string, id: string, lid: string | null, key?: string): void;
198
- notifyStateChange(type: string, id: string | null, lid: string, key?: string): void;
199
- notifyStateChange(type: string, id: string | null, lid: string | null, key?: string): void {
200
- if (DEPRECATE_V1CACHE_STORE_APIS) {
201
- deprecate(`StoreWrapper.notifyStateChange has been deprecated in favor of StoreWrapper.notifyChange`, false, {
202
- id: 'ember-data:deprecate-v1cache-store-apis',
203
- for: 'ember-data',
204
- until: '5.0',
205
- since: { enabled: '4.7', available: '4.7' },
206
- });
207
- }
208
- const resource = constructResource(type, id, lid);
209
- const identifier = this.identifierCache.getOrCreateRecordIdentifier(resource);
210
-
211
- this._store._notificationManager.notify(identifier, 'state');
212
- this._store.recordArrayManager.identifierChanged(identifier);
213
- }
214
-
215
- recordDataFor(type: string, id: string, lid?: string | null): RecordData;
216
- recordDataFor(type: string, id: string | null, lid: string): RecordData;
217
- recordDataFor(type: string): RecordData;
218
- recordDataFor(type: StableRecordIdentifier): RecordData;
219
- recordDataFor(type: string | StableRecordIdentifier, id?: string | null, lid?: string | null): RecordData {
220
- let identifier: StableRecordIdentifier;
221
- if (DEPRECATE_V1CACHE_STORE_APIS) {
222
- if (!isStableIdentifier(type)) {
223
- // we also deprecate create capability. This behavior was problematic because
224
- // there's no outside association between this RecordData and an Identifier.
225
- // It's likely a mistake when we hit this codepath, but we said in an early
226
- // RFC we'd allow this.
227
- // With V2 we are enforcing someone to use the record-data and identifier-cache APIs to
228
- // create a new identifier and then call clientDidCreate on the RecordData
229
- // instead.
230
- identifier =
231
- !id && !lid
232
- ? this.identifierCache.createIdentifierForNewRecord({ type: type })
233
- : this.identifierCache.getOrCreateRecordIdentifier(constructResource(type, id, lid));
234
- } else {
235
- identifier = type;
236
- }
237
- } else {
238
- assert(`Expected a stable identifier`, isStableIdentifier(type));
239
- identifier = type;
240
- }
241
-
242
- const recordData = this._store._instanceCache.getRecordData(identifier);
243
-
244
- if (!id && !lid) {
245
- recordData.clientDidCreate(identifier);
246
- this._store.recordArrayManager.identifierAdded(identifier);
247
- }
248
-
249
- return recordData;
250
- }
251
-
252
- setRecordId(type: string | StableRecordIdentifier, id: string, lid?: string) {
253
- let identifier: StableRecordIdentifier | undefined;
254
- if (DEPRECATE_V1CACHE_STORE_APIS) {
255
- if (!isStableIdentifier(type)) {
256
- const modelName = normalizeModelName(type);
257
- const resource = constructResource(modelName, null, coerceId(lid));
258
- identifier = this.identifierCache.peekRecordIdentifier(resource);
259
- } else {
260
- identifier = type;
261
- }
262
- } else {
263
- assert(`Expected a stable identifier`, isStableIdentifier(type));
264
- identifier = type;
265
- }
266
-
267
- assert(`Unable to find an identifier to update the ID for for ${lid}`, identifier);
268
-
269
- this._store._instanceCache.setRecordId(identifier, id);
270
- }
271
-
272
- isRecordInUse(type: string, id: string | null, lid: string): boolean;
273
- isRecordInUse(type: string, id: string, lid?: string | null): boolean;
274
- isRecordInUse(type: string, id: string | null, lid?: string | null): boolean {
275
- if (DEPRECATE_V1CACHE_STORE_APIS) {
276
- deprecate(`StoreWrapper.isRecordInUSe has been deprecated in favor of StoreWrapper.hasRecord`, false, {
277
- id: 'ember-data:deprecate-v1cache-store-apis',
278
- for: 'ember-data',
279
- until: '5.0',
280
- since: { enabled: '4.7', available: '4.7' },
281
- });
282
- }
283
- const resource = constructResource(type, id, lid);
284
- const identifier = this.identifierCache.peekRecordIdentifier(resource);
285
-
286
- const record = identifier && this._store._instanceCache.peek({ identifier, bucket: 'record' });
287
-
288
- return record ? !(record.isDestroyed || record.isDestroying) : false;
289
- }
290
-
291
- hasRecord(identifier: StableRecordIdentifier): boolean {
292
- return Boolean(this._store._instanceCache.peek({ identifier, bucket: 'record' }));
293
- }
294
-
295
- disconnectRecord(type: string, id: string | null, lid: string): void;
296
- disconnectRecord(type: string, id: string, lid?: string | null): void;
297
- disconnectRecord(type: StableRecordIdentifier): void;
298
- disconnectRecord(type: string | StableRecordIdentifier, id?: string | null, lid?: string | null): void {
299
- let identifier: StableRecordIdentifier;
300
- if (DEPRECATE_V1CACHE_STORE_APIS) {
301
- if (typeof type === 'string') {
302
- deprecate(
303
- `StoreWrapper.disconnectRecord(<type>) has been deprecated in favor of StoreWrapper.disconnectRecord(<identifier>)`,
304
- false,
305
- {
306
- id: 'ember-data:deprecate-v1cache-store-apis',
307
- for: 'ember-data',
308
- until: '5.0',
309
- since: { enabled: '4.7', available: '4.7' },
310
- }
311
- );
312
- let resource = constructResource(type, id, lid) as RecordIdentifier;
313
- identifier = this.identifierCache.peekRecordIdentifier(resource)!;
314
- } else {
315
- identifier = type as StableRecordIdentifier;
316
- }
317
- } else {
318
- identifier = type as StableRecordIdentifier;
319
- }
320
-
321
- assert(`Expected a stable identifier`, isStableIdentifier(identifier));
322
-
323
- this._store._instanceCache.disconnect(identifier);
324
- this._pendingNotifies.delete(identifier);
325
- }
326
- }
327
-
328
- class V2RecordDataStoreWrapper implements StoreWrapper {
329
- declare _willNotify: boolean;
330
- declare _pendingNotifies: Map<StableRecordIdentifier, Set<string>>;
331
- declare _store: Store;
332
-
333
- constructor(_store: Store) {
334
- this._store = _store;
335
- this._willNotify = false;
336
- this._pendingNotifies = new Map();
337
- }
338
-
339
- get identifierCache(): IdentifierCache {
340
- return this._store.identifierCache;
341
- }
342
-
343
- _scheduleNotification(identifier: StableRecordIdentifier, key: string) {
344
- let pending = this._pendingNotifies.get(identifier);
345
-
346
- if (!pending) {
347
- pending = new Set();
348
- this._pendingNotifies.set(identifier, pending);
349
- }
350
- pending.add(key);
351
-
352
- if (this._willNotify === true) {
353
- return;
354
- }
355
-
356
- this._willNotify = true;
357
- // it's possible a RecordData adhoc notifies us,
358
- // in which case we sync flush
359
- if (this._store._cbs) {
360
- this._store._schedule('notify', () => this._flushNotifications());
361
- } else {
362
- this._flushNotifications();
363
- }
364
- }
365
-
366
- _flushNotifications(): void {
367
- if (this._willNotify === false) {
368
- return;
369
- }
370
-
371
- let pending = this._pendingNotifies;
372
- this._pendingNotifies = new Map();
373
- this._willNotify = false;
374
-
375
- pending.forEach((set, identifier) => {
376
- set.forEach((key) => {
377
- this._store._notificationManager.notify(identifier, 'relationships', key);
378
- });
379
- });
380
- }
381
-
382
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key?: string): void {
383
- assert(`Expected a stable identifier`, isStableIdentifier(identifier));
384
-
385
- // TODO do we still get value from this?
386
- if (namespace === 'relationships' && key) {
387
- this._scheduleNotification(identifier, key);
388
- return;
389
- }
390
-
391
- this._store._notificationManager.notify(identifier, namespace, key);
392
-
393
- if (namespace === 'state') {
394
- this._store.recordArrayManager.identifierChanged(identifier);
395
- }
396
- }
397
-
398
- getSchemaDefinitionService(): SchemaDefinitionService {
399
- return this._store.getSchemaDefinitionService();
400
- }
401
-
402
- recordDataFor(identifier: StableRecordIdentifier): RecordData {
403
- assert(`Expected a stable identifier`, isStableIdentifier(identifier));
404
-
405
- return this._store._instanceCache.getRecordData(identifier);
406
- }
407
-
408
- setRecordId(identifier: StableRecordIdentifier, id: string) {
409
- assert(`Expected a stable identifier`, isStableIdentifier(identifier));
410
- this._store._instanceCache.setRecordId(identifier, id);
411
- }
412
-
413
- hasRecord(identifier: StableRecordIdentifier): boolean {
414
- return Boolean(this._store._instanceCache.peek({ identifier, bucket: 'record' }));
415
- }
416
-
417
- disconnectRecord(identifier: StableRecordIdentifier): void {
418
- assert(`Expected a stable identifier`, isStableIdentifier(identifier));
419
- this._store._instanceCache.disconnect(identifier);
420
- this._pendingNotifies.delete(identifier);
421
- }
422
- }
423
- export type RecordDataStoreWrapper = LegacyWrapper | V2RecordDataStoreWrapper;
424
-
425
- export const RecordDataStoreWrapper = DEPRECATE_V1CACHE_STORE_APIS ? LegacyWrapper : V2RecordDataStoreWrapper;
@@ -1,111 +0,0 @@
1
- import { assert } from '@ember/debug';
2
- import { DEBUG } from '@glimmer/env';
3
-
4
- import { LOG_NOTIFICATIONS } from '@ember-data/private-build-infra/debugging';
5
- import type { StableRecordIdentifier } from '@ember-data/types/q/identifier';
6
-
7
- import { isStableIdentifier } from '../caches/identifier-cache';
8
- import type Store from '../store-service';
9
-
10
- type UnsubscribeToken = object;
11
- let tokenId = 0;
12
-
13
- const Cache = new Map<StableRecordIdentifier, Map<UnsubscribeToken, NotificationCallback>>();
14
- const Tokens = new Map<UnsubscribeToken, StableRecordIdentifier>();
15
-
16
- export type NotificationType = 'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state';
17
-
18
- export interface NotificationCallback {
19
- (identifier: StableRecordIdentifier, notificationType: 'attributes' | 'relationships', key?: string): void;
20
- (identifier: StableRecordIdentifier, notificationType: 'errors' | 'meta' | 'identity' | 'state'): void;
21
- (identifier: StableRecordIdentifier, notificationType: NotificationType, key?: string): void;
22
- }
23
-
24
- // TODO this isn't importable anyway, remove and use a map on the manager?
25
- export function unsubscribe(token: UnsubscribeToken) {
26
- let identifier = Tokens.get(token);
27
- if (LOG_NOTIFICATIONS) {
28
- if (!identifier) {
29
- // eslint-disable-next-line no-console
30
- console.log('Passed unknown unsubscribe token to unsubscribe', identifier);
31
- }
32
- }
33
- if (identifier) {
34
- Tokens.delete(token);
35
- const map = Cache.get(identifier);
36
- map?.delete(token);
37
- }
38
- }
39
- /*
40
- Currently only support a single callback per identifier
41
- */
42
- export default class NotificationManager {
43
- declare store: Store;
44
- declare isDestroyed: boolean;
45
- constructor(store: Store) {
46
- this.store = store;
47
- this.isDestroyed = false;
48
- }
49
-
50
- subscribe(identifier: StableRecordIdentifier, callback: NotificationCallback): UnsubscribeToken {
51
- assert(`Expected to receive a stable Identifier to subscribe to`, isStableIdentifier(identifier));
52
- let map = Cache.get(identifier);
53
-
54
- if (!map) {
55
- map = new Map();
56
- Cache.set(identifier, map);
57
- }
58
-
59
- let unsubToken = DEBUG ? { _tokenRef: tokenId++ } : {};
60
- map.set(unsubToken, callback);
61
- Tokens.set(unsubToken, identifier);
62
- return unsubToken;
63
- }
64
-
65
- unsubscribe(token: UnsubscribeToken) {
66
- if (!this.isDestroyed) {
67
- unsubscribe(token);
68
- }
69
- }
70
-
71
- // deactivated type signature overloads because pass-through was failing to match any. Bring back if possible.
72
- // notify(identifier: StableRecordIdentifier, value: 'attributes' | 'relationships', key?: string): boolean;
73
- // notify(identifier: StableRecordIdentifier, value: 'errors' | 'meta' | 'identity' | 'state'): boolean;
74
- notify(identifier: StableRecordIdentifier, value: NotificationType, key?: string): boolean {
75
- assert(
76
- `Notify does not accept a key argument for the namespace '${value}'. Received key '${key}'.`,
77
- !key || value === 'attributes' || value === 'relationships'
78
- );
79
- if (!isStableIdentifier(identifier)) {
80
- if (LOG_NOTIFICATIONS) {
81
- // eslint-disable-next-line no-console
82
- console.log(
83
- `Notifying: Expected to receive a stable Identifier to notify '${value}' '${key}' with, but ${String(
84
- identifier
85
- )} is not in the cache`,
86
- identifier
87
- );
88
- }
89
- return false;
90
- }
91
-
92
- if (LOG_NOTIFICATIONS) {
93
- // eslint-disable-next-line no-console
94
- console.log(`Notifying: ${String(identifier)}\t${value}\t${key}`);
95
- }
96
- let callbackMap = Cache.get(identifier);
97
- if (!callbackMap || !callbackMap.size) {
98
- return false;
99
- }
100
- callbackMap.forEach((cb) => {
101
- cb(identifier, value, key);
102
- });
103
- return true;
104
- }
105
-
106
- destroy() {
107
- this.isDestroyed = true;
108
- Tokens.clear();
109
- Cache.clear();
110
- }
111
- }