@ember-data/store 4.1.0-alpha.9 → 4.2.0-alpha.2
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/addon/-private/identifiers/cache.ts +3 -5
- package/addon/-private/identifiers/utils/uuid-v4.ts +0 -13
- package/addon/-private/index.ts +0 -1
- package/addon/-private/system/core-store.ts +151 -513
- package/addon/-private/system/ds-model-store.ts +14 -65
- package/addon/-private/system/fetch-manager.ts +10 -6
- package/addon/-private/system/model/internal-model.ts +123 -360
- package/addon/-private/system/model/states.js +3 -9
- package/addon/-private/system/record-array-manager.js +5 -33
- package/addon/-private/system/record-arrays/adapter-populated-record-array.js +2 -3
- package/addon/-private/system/record-notification-manager.ts +14 -6
- package/addon/-private/system/references/{belongs-to.js → belongs-to.ts} +83 -19
- package/addon/-private/system/references/{has-many.js → has-many.ts} +126 -49
- package/addon/-private/system/references/record.ts +37 -6
- package/addon/-private/system/references/reference.ts +4 -26
- package/addon/-private/system/request-cache.ts +6 -7
- package/addon/-private/system/snapshot.ts +23 -50
- package/addon/-private/system/store/finders.js +6 -69
- package/addon/-private/system/store/record-data-store-wrapper.ts +17 -24
- package/addon/-private/ts-interfaces/ds-model.ts +1 -0
- package/addon/-private/ts-interfaces/fetch-manager.ts +4 -0
- package/addon/-private/ts-interfaces/identifier.ts +2 -3
- package/index.js +3 -0
- package/package.json +13 -12
- package/addon/-private/utils/symbol.ts +0 -33
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
@module @ember-data/store
|
|
3
3
|
*/
|
|
4
4
|
import { assert, warn } from '@ember/debug';
|
|
5
|
-
import { assign } from '@ember/polyfills';
|
|
6
5
|
import { DEBUG } from '@glimmer/env';
|
|
7
6
|
|
|
8
7
|
import coerceId from '../system/coerce-id';
|
|
@@ -23,7 +22,6 @@ import type {
|
|
|
23
22
|
import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '../ts-interfaces/identifier';
|
|
24
23
|
import type { ConfidentDict } from '../ts-interfaces/utils';
|
|
25
24
|
import isNonEmptyString from '../utils/is-non-empty-string';
|
|
26
|
-
import { addSymbol } from '../utils/symbol';
|
|
27
25
|
import isStableIdentifier, { markStableIdentifier, unmarkStableIdentifier } from './is-stable-identifier';
|
|
28
26
|
import uuidv4 from './utils/uuid-v4';
|
|
29
27
|
|
|
@@ -372,7 +370,7 @@ export class IdentifierCache {
|
|
|
372
370
|
// If the incoming type does not match the identifier type, we need to create an identifier for the incoming
|
|
373
371
|
// data so we can merge the incoming data with the existing identifier, see #7325 and #7363
|
|
374
372
|
if ('type' in data && data.type && identifier.type !== normalizeModelName(data.type)) {
|
|
375
|
-
let incomingDataResource =
|
|
373
|
+
let incomingDataResource = { ...data };
|
|
376
374
|
// Need to strip the lid from the incomingData in order force a new identifier creation
|
|
377
375
|
delete incomingDataResource.lid;
|
|
378
376
|
existingIdentifier = this.getOrCreateRecordIdentifier(incomingDataResource);
|
|
@@ -511,8 +509,8 @@ function makeStableRecordIdentifier(
|
|
|
511
509
|
return `${clientOriginated ? '[CLIENT_ORIGINATED] ' : ''}${type}:${id} (${lid})`;
|
|
512
510
|
},
|
|
513
511
|
};
|
|
514
|
-
|
|
515
|
-
|
|
512
|
+
wrapper[DEBUG_CLIENT_ORIGINATED] = clientOriginated;
|
|
513
|
+
wrapper[DEBUG_IDENTIFIER_BUCKET] = bucket;
|
|
516
514
|
wrapper = freeze(wrapper);
|
|
517
515
|
markStableIdentifier(wrapper);
|
|
518
516
|
DEBUG_MAP.set(wrapper, recordIdentifier);
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
@module @ember-data/store
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
// support IE11
|
|
6
|
-
declare global {
|
|
7
|
-
interface Window {
|
|
8
|
-
msCrypto: Crypto;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
5
|
const CRYPTO = (() => {
|
|
13
6
|
const hasWindow = typeof window !== 'undefined';
|
|
14
7
|
const isFastBoot = typeof FastBoot !== 'undefined';
|
|
@@ -27,12 +20,6 @@ const CRYPTO = (() => {
|
|
|
27
20
|
};
|
|
28
21
|
} else if (hasWindow && typeof window.crypto !== 'undefined') {
|
|
29
22
|
return window.crypto;
|
|
30
|
-
} else if (
|
|
31
|
-
hasWindow &&
|
|
32
|
-
typeof window.msCrypto !== 'undefined' &&
|
|
33
|
-
typeof window.msCrypto.getRandomValues === 'function'
|
|
34
|
-
) {
|
|
35
|
-
return window.msCrypto;
|
|
36
23
|
} else {
|
|
37
24
|
throw new Error('ember-data: Cannot find a valid way to generate local identifiers');
|
|
38
25
|
}
|
package/addon/-private/index.ts
CHANGED
|
@@ -25,7 +25,6 @@ export { default as RootState } from './system/model/states';
|
|
|
25
25
|
export { default as InternalModel } from './system/model/internal-model';
|
|
26
26
|
|
|
27
27
|
export { PromiseArray, PromiseObject } from './system/promise-proxies';
|
|
28
|
-
export { addSymbol, symbol } from './utils/symbol';
|
|
29
28
|
|
|
30
29
|
export { RecordArray, AdapterPopulatedRecordArray } from './system/record-arrays';
|
|
31
30
|
|