@ember-data/legacy-compat 5.3.0-beta.5 → 5.3.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.
|
@@ -140,6 +140,7 @@ class SnapshotRecordArray {
|
|
|
140
140
|
if (this._snapshots !== null) {
|
|
141
141
|
return this._snapshots;
|
|
142
142
|
}
|
|
143
|
+
upgradeStore(this.__store);
|
|
143
144
|
const {
|
|
144
145
|
_fetchManager
|
|
145
146
|
} = this.__store;
|
|
@@ -148,7 +149,7 @@ class SnapshotRecordArray {
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
function assertIdentifierHasId(identifier) {
|
|
151
|
-
assert(`Attempted to schedule a fetch for a record without an id.`, identifier.id !== null);
|
|
152
|
+
assert(`Attempted to schedule a fetch for a record without an id.`, identifier && identifier.id !== null);
|
|
152
153
|
}
|
|
153
154
|
function iterateData(data, fn) {
|
|
154
155
|
if (Array.isArray(data)) {
|
|
@@ -175,7 +176,7 @@ function payloadIsNotBlank(adapterPayload) {
|
|
|
175
176
|
*/
|
|
176
177
|
function validateDocumentStructure(doc) {
|
|
177
178
|
if (macroCondition(getOwnConfig().env.DEBUG)) {
|
|
178
|
-
|
|
179
|
+
const errors = [];
|
|
179
180
|
if (!doc || typeof doc !== 'object') {
|
|
180
181
|
errors.push('Top level of a JSON API document must be an object');
|
|
181
182
|
} else {
|
|
@@ -221,7 +222,7 @@ function validateDocumentStructure(doc) {
|
|
|
221
222
|
}
|
|
222
223
|
}
|
|
223
224
|
function normalizeResponseHelper(serializer, store, modelClass, payload, id, requestType) {
|
|
224
|
-
|
|
225
|
+
const normalizedResponse = serializer ? serializer.normalizeResponse(store, modelClass, payload, id, requestType) : payload;
|
|
225
226
|
validateDocumentStructure(normalizedResponse);
|
|
226
227
|
return normalizedResponse;
|
|
227
228
|
}
|
|
@@ -333,7 +334,9 @@ class Snapshot {
|
|
|
333
334
|
@public
|
|
334
335
|
*/
|
|
335
336
|
get record() {
|
|
336
|
-
|
|
337
|
+
const record = this._store.peekRecord(this.identifier);
|
|
338
|
+
assert(`Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`, record !== null);
|
|
339
|
+
return record;
|
|
337
340
|
}
|
|
338
341
|
get _attributes() {
|
|
339
342
|
if (this.__attributes !== null) {
|
|
@@ -406,13 +409,13 @@ class Snapshot {
|
|
|
406
409
|
@public
|
|
407
410
|
*/
|
|
408
411
|
changedAttributes() {
|
|
409
|
-
|
|
412
|
+
const changedAttributes = Object.create(null);
|
|
410
413
|
if (!this._changedAttributes) {
|
|
411
414
|
return changedAttributes;
|
|
412
415
|
}
|
|
413
|
-
|
|
416
|
+
const changedAttributeKeys = Object.keys(this._changedAttributes);
|
|
414
417
|
for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {
|
|
415
|
-
|
|
418
|
+
const key = changedAttributeKeys[i];
|
|
416
419
|
changedAttributes[key] = this._changedAttributes[key].slice();
|
|
417
420
|
}
|
|
418
421
|
return changedAttributes;
|
|
@@ -447,16 +450,16 @@ class Snapshot {
|
|
|
447
450
|
will be returned if the contents of the relationship is unknown.
|
|
448
451
|
*/
|
|
449
452
|
belongsTo(keyName, options) {
|
|
450
|
-
|
|
453
|
+
const returnModeIsId = !!(options && options.id);
|
|
451
454
|
let result;
|
|
452
|
-
|
|
455
|
+
const store = this._store;
|
|
453
456
|
if (returnModeIsId === true && keyName in this._belongsToIds) {
|
|
454
457
|
return this._belongsToIds[keyName];
|
|
455
458
|
}
|
|
456
459
|
if (returnModeIsId === false && keyName in this._belongsToRelationships) {
|
|
457
460
|
return this._belongsToRelationships[keyName];
|
|
458
461
|
}
|
|
459
|
-
|
|
462
|
+
const relationshipMeta = store.getSchemaDefinitionService().relationshipsDefinitionFor({
|
|
460
463
|
type: this.modelName
|
|
461
464
|
})[keyName];
|
|
462
465
|
assert(`Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`, relationshipMeta && relationshipMeta.kind === 'belongsTo');
|
|
@@ -478,9 +481,9 @@ class Snapshot {
|
|
|
478
481
|
assert(`You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but no such relationship was found.`, relationship);
|
|
479
482
|
assert(`You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but that relationship is a hasMany.`, relationship.definition.kind === 'belongsTo');
|
|
480
483
|
}
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
+
const value = graphFor(this._store).getData(identifier, keyName);
|
|
485
|
+
const data = value && value.data;
|
|
486
|
+
const inverseIdentifier = data ? store.identifierCache.getOrCreateRecordIdentifier(data) : null;
|
|
484
487
|
if (value && value.data !== undefined) {
|
|
485
488
|
const cache = store.cache;
|
|
486
489
|
if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {
|
|
@@ -525,18 +528,18 @@ class Snapshot {
|
|
|
525
528
|
undefined will be returned if the contents of the relationship is unknown.
|
|
526
529
|
*/
|
|
527
530
|
hasMany(keyName, options) {
|
|
528
|
-
|
|
531
|
+
const returnModeIsIds = !!(options && options.ids);
|
|
529
532
|
let results;
|
|
530
|
-
|
|
531
|
-
|
|
533
|
+
const cachedIds = this._hasManyIds[keyName];
|
|
534
|
+
const cachedSnapshots = this._hasManyRelationships[keyName];
|
|
532
535
|
if (returnModeIsIds === true && keyName in this._hasManyIds) {
|
|
533
536
|
return cachedIds;
|
|
534
537
|
}
|
|
535
538
|
if (returnModeIsIds === false && keyName in this._hasManyRelationships) {
|
|
536
539
|
return cachedSnapshots;
|
|
537
540
|
}
|
|
538
|
-
|
|
539
|
-
|
|
541
|
+
const store = this._store;
|
|
542
|
+
const relationshipMeta = store.getSchemaDefinitionService().relationshipsDefinitionFor({
|
|
540
543
|
type: this.modelName
|
|
541
544
|
})[keyName];
|
|
542
545
|
assert(`Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`, relationshipMeta && relationshipMeta.kind === 'hasMany');
|
|
@@ -558,11 +561,11 @@ class Snapshot {
|
|
|
558
561
|
assert(`You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but no such relationship was found.`, relationship);
|
|
559
562
|
assert(`You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${identifier.id || ''}, lid: ${identifier.lid} but that relationship is a belongsTo.`, relationship.definition.kind === 'hasMany');
|
|
560
563
|
}
|
|
561
|
-
|
|
564
|
+
const value = graphFor(this._store).getData(identifier, keyName);
|
|
562
565
|
if (value.data) {
|
|
563
566
|
results = [];
|
|
564
567
|
value.data.forEach(member => {
|
|
565
|
-
|
|
568
|
+
const inverseIdentifier = store.identifierCache.getOrCreateRecordIdentifier(member);
|
|
566
569
|
const cache = store.cache;
|
|
567
570
|
if (!cache.isDeleted(inverseIdentifier)) {
|
|
568
571
|
if (returnModeIsIds) {
|
|
@@ -599,7 +602,7 @@ class Snapshot {
|
|
|
599
602
|
@public
|
|
600
603
|
*/
|
|
601
604
|
eachAttribute(callback, binding) {
|
|
602
|
-
|
|
605
|
+
const attrDefs = this._store.getSchemaDefinitionService().attributesDefinitionFor(this.identifier);
|
|
603
606
|
Object.keys(attrDefs).forEach(key => {
|
|
604
607
|
callback.call(binding, key, attrDefs[key]);
|
|
605
608
|
});
|
|
@@ -620,7 +623,7 @@ class Snapshot {
|
|
|
620
623
|
@public
|
|
621
624
|
*/
|
|
622
625
|
eachRelationship(callback, binding) {
|
|
623
|
-
|
|
626
|
+
const relationshipDefs = this._store.getSchemaDefinitionService().relationshipsDefinitionFor(this.identifier);
|
|
624
627
|
Object.keys(relationshipDefs).forEach(key => {
|
|
625
628
|
callback.call(binding, key, relationshipDefs[key]);
|
|
626
629
|
});
|
|
@@ -648,6 +651,7 @@ class Snapshot {
|
|
|
648
651
|
@public
|
|
649
652
|
*/
|
|
650
653
|
serialize(options) {
|
|
654
|
+
upgradeStore(this._store);
|
|
651
655
|
const serializer = this._store.serializerFor(this.modelName);
|
|
652
656
|
assert(`Cannot serialize record, no serializer found`, serializer);
|
|
653
657
|
return serializer.serialize(this, options);
|
|
@@ -675,13 +679,13 @@ class FetchManager {
|
|
|
675
679
|
@internal
|
|
676
680
|
*/
|
|
677
681
|
scheduleSave(identifier, options) {
|
|
678
|
-
|
|
679
|
-
|
|
682
|
+
const resolver = createDeferred();
|
|
683
|
+
const query = {
|
|
680
684
|
op: 'saveRecord',
|
|
681
685
|
recordIdentifier: identifier,
|
|
682
686
|
options
|
|
683
687
|
};
|
|
684
|
-
|
|
688
|
+
const queryRequest = {
|
|
685
689
|
data: [query]
|
|
686
690
|
};
|
|
687
691
|
const snapshot = this.createSnapshot(identifier, options);
|
|
@@ -697,19 +701,19 @@ class FetchManager {
|
|
|
697
701
|
return monitored;
|
|
698
702
|
}
|
|
699
703
|
scheduleFetch(identifier, options, request) {
|
|
700
|
-
|
|
704
|
+
const query = {
|
|
701
705
|
op: 'findRecord',
|
|
702
706
|
recordIdentifier: identifier,
|
|
703
707
|
options
|
|
704
708
|
};
|
|
705
|
-
|
|
709
|
+
const queryRequest = {
|
|
706
710
|
data: [query]
|
|
707
711
|
};
|
|
708
|
-
|
|
712
|
+
const pendingFetch = this.getPendingFetch(identifier, options);
|
|
709
713
|
if (pendingFetch) {
|
|
710
714
|
return pendingFetch;
|
|
711
715
|
}
|
|
712
|
-
|
|
716
|
+
const modelName = identifier.type;
|
|
713
717
|
const resolver = createDeferred();
|
|
714
718
|
const pendingFetchItem = {
|
|
715
719
|
identifier,
|
|
@@ -717,7 +721,7 @@ class FetchManager {
|
|
|
717
721
|
options,
|
|
718
722
|
queryRequest
|
|
719
723
|
};
|
|
720
|
-
|
|
724
|
+
const resolverPromise = resolver.promise;
|
|
721
725
|
const store = this._store;
|
|
722
726
|
const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request
|
|
723
727
|
|
|
@@ -730,7 +734,7 @@ class FetchManager {
|
|
|
730
734
|
|
|
731
735
|
// additional data received in the payload
|
|
732
736
|
// may result in the merging of identifiers (and thus records)
|
|
733
|
-
|
|
737
|
+
const potentiallyNewIm = store._push(payload, options.reload);
|
|
734
738
|
if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {
|
|
735
739
|
return potentiallyNewIm;
|
|
736
740
|
}
|
|
@@ -763,7 +767,7 @@ class FetchManager {
|
|
|
763
767
|
this.flushAllPendingFetches();
|
|
764
768
|
});
|
|
765
769
|
}
|
|
766
|
-
|
|
770
|
+
const fetchesByType = this._pendingFetch;
|
|
767
771
|
let fetchesById = fetchesByType.get(modelName);
|
|
768
772
|
if (!fetchesById) {
|
|
769
773
|
fetchesById = new Map();
|
|
@@ -787,11 +791,11 @@ class FetchManager {
|
|
|
787
791
|
return promise;
|
|
788
792
|
}
|
|
789
793
|
getPendingFetch(identifier, options) {
|
|
790
|
-
|
|
794
|
+
const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);
|
|
791
795
|
|
|
792
796
|
// We already have a pending fetch for this
|
|
793
797
|
if (pendingFetches) {
|
|
794
|
-
|
|
798
|
+
const matchingPendingFetch = pendingFetches.find(fetch => isSameRequest(options, fetch.options));
|
|
795
799
|
if (matchingPendingFetch) {
|
|
796
800
|
return matchingPendingFetch.promise;
|
|
797
801
|
}
|
|
@@ -887,27 +891,27 @@ function isSameRequest(options = {}, existingOptions = {}) {
|
|
|
887
891
|
return optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) && includesSatisfies(options.include, existingOptions.include);
|
|
888
892
|
}
|
|
889
893
|
function _findMany(store, adapter, modelName, snapshots) {
|
|
890
|
-
|
|
891
|
-
|
|
894
|
+
const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still
|
|
895
|
+
const promise = Promise.resolve().then(() => {
|
|
892
896
|
const ids = snapshots.map(s => s.id);
|
|
893
897
|
assert(`Cannot fetch a record without an id`, ids.every(v => v !== null));
|
|
894
898
|
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
895
899
|
assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);
|
|
896
|
-
|
|
900
|
+
const ret = adapter.findMany(store, modelClass, ids, snapshots);
|
|
897
901
|
assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);
|
|
898
902
|
return ret;
|
|
899
903
|
});
|
|
900
904
|
return promise.then(adapterPayload => {
|
|
901
905
|
assert(`You made a 'findMany' request for '${modelName}' records with ids '[${snapshots.map(s => s.id).join(',')}]', but the adapter's response did not have any data`, !!payloadIsNotBlank(adapterPayload));
|
|
902
|
-
|
|
903
|
-
|
|
906
|
+
const serializer = store.serializerFor(modelName);
|
|
907
|
+
const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');
|
|
904
908
|
return payload;
|
|
905
909
|
});
|
|
906
910
|
}
|
|
907
911
|
function rejectFetchedItems(fetchMap, snapshots, error) {
|
|
908
912
|
for (let i = 0, l = snapshots.length; i < l; i++) {
|
|
909
|
-
|
|
910
|
-
|
|
913
|
+
const snapshot = snapshots[i];
|
|
914
|
+
const pair = fetchMap.get(snapshot);
|
|
911
915
|
if (pair) {
|
|
912
916
|
pair.resolver.reject(error || new Error(`Expected: '<${snapshot.modelName}:${snapshot.id}>' to be present in the adapter provided payload, but it was not found.`));
|
|
913
917
|
}
|
|
@@ -923,9 +927,9 @@ function handleFoundRecords(store, fetchMap, snapshots, coalescedPayload) {
|
|
|
923
927
|
options object, we resolve all snapshots by id with
|
|
924
928
|
the first response we see.
|
|
925
929
|
*/
|
|
926
|
-
|
|
930
|
+
const snapshotsById = new Map();
|
|
927
931
|
for (let i = 0; i < snapshots.length; i++) {
|
|
928
|
-
|
|
932
|
+
const id = snapshots[i].id;
|
|
929
933
|
let snapshotGroup = snapshotsById.get(id);
|
|
930
934
|
if (!snapshotGroup) {
|
|
931
935
|
snapshotGroup = [];
|
|
@@ -936,18 +940,18 @@ function handleFoundRecords(store, fetchMap, snapshots, coalescedPayload) {
|
|
|
936
940
|
const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];
|
|
937
941
|
|
|
938
942
|
// resolve found records
|
|
939
|
-
|
|
943
|
+
const resources = coalescedPayload.data;
|
|
940
944
|
for (let i = 0, l = resources.length; i < l; i++) {
|
|
941
|
-
|
|
942
|
-
|
|
945
|
+
const resource = resources[i];
|
|
946
|
+
const snapshotGroup = snapshotsById.get(resource.id);
|
|
943
947
|
snapshotsById.delete(resource.id);
|
|
944
948
|
if (!snapshotGroup) {
|
|
945
949
|
// TODO consider whether this should be a deprecation/assertion
|
|
946
950
|
included.push(resource);
|
|
947
951
|
} else {
|
|
948
952
|
snapshotGroup.forEach(snapshot => {
|
|
949
|
-
|
|
950
|
-
|
|
953
|
+
const pair = fetchMap.get(snapshot);
|
|
954
|
+
const resolver = pair.resolver;
|
|
951
955
|
resolver.resolve({
|
|
952
956
|
data: resource
|
|
953
957
|
});
|
|
@@ -965,7 +969,7 @@ function handleFoundRecords(store, fetchMap, snapshots, coalescedPayload) {
|
|
|
965
969
|
}
|
|
966
970
|
|
|
967
971
|
// reject missing records
|
|
968
|
-
|
|
972
|
+
const rejected = [];
|
|
969
973
|
snapshotsById.forEach(snapshotArray => {
|
|
970
974
|
rejected.push(...snapshotArray);
|
|
971
975
|
});
|
|
@@ -975,21 +979,21 @@ function handleFoundRecords(store, fetchMap, snapshots, coalescedPayload) {
|
|
|
975
979
|
rejectFetchedItems(fetchMap, rejected);
|
|
976
980
|
}
|
|
977
981
|
function _fetchRecord(store, adapter, fetchItem) {
|
|
978
|
-
|
|
979
|
-
|
|
982
|
+
const identifier = fetchItem.identifier;
|
|
983
|
+
const modelName = identifier.type;
|
|
980
984
|
assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);
|
|
981
985
|
assert(`You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`, typeof adapter.findRecord === 'function');
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
986
|
+
const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);
|
|
987
|
+
const klass = store.modelFor(identifier.type);
|
|
988
|
+
const id = identifier.id;
|
|
985
989
|
let promise = Promise.resolve().then(() => {
|
|
986
990
|
return adapter.findRecord(store, klass, identifier.id, snapshot);
|
|
987
991
|
});
|
|
988
992
|
promise = promise.then(adapterPayload => {
|
|
989
993
|
assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));
|
|
990
994
|
assert(`You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`, !!payloadIsNotBlank(adapterPayload));
|
|
991
|
-
|
|
992
|
-
|
|
995
|
+
const serializer = store.serializerFor(modelName);
|
|
996
|
+
const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');
|
|
993
997
|
assert(`Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`, !Array.isArray(payload.data));
|
|
994
998
|
assert(`The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`, 'data' in payload && payload.data !== null && typeof payload.data === 'object');
|
|
995
999
|
warn(`You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`, coerceId(payload.data.id) === coerceId(id), {
|
|
@@ -1013,8 +1017,8 @@ function _processCoalescedGroup(store, fetchMap, group, adapter, modelName) {
|
|
|
1013
1017
|
}
|
|
1014
1018
|
}
|
|
1015
1019
|
function _flushPendingFetchForType(store, pendingFetchMap, modelName) {
|
|
1016
|
-
|
|
1017
|
-
|
|
1020
|
+
const adapter = store.adapterFor(modelName);
|
|
1021
|
+
const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;
|
|
1018
1022
|
if (shouldCoalesce) {
|
|
1019
1023
|
const pendingFetchItems = [];
|
|
1020
1024
|
pendingFetchMap.forEach((requestsForIdentifier, identifier) => {
|
|
@@ -1026,12 +1030,12 @@ function _flushPendingFetchForType(store, pendingFetchMap, modelName) {
|
|
|
1026
1030
|
pendingFetchMap.delete(identifier);
|
|
1027
1031
|
pendingFetchItems.push(requestsForIdentifier[0]);
|
|
1028
1032
|
});
|
|
1029
|
-
|
|
1033
|
+
const totalItems = pendingFetchItems.length;
|
|
1030
1034
|
if (totalItems > 1) {
|
|
1031
|
-
|
|
1032
|
-
|
|
1035
|
+
const snapshots = new Array(totalItems);
|
|
1036
|
+
const fetchMap = new Map();
|
|
1033
1037
|
for (let i = 0; i < totalItems; i++) {
|
|
1034
|
-
|
|
1038
|
+
const fetchItem = pendingFetchItems[i];
|
|
1035
1039
|
snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);
|
|
1036
1040
|
fetchMap.set(snapshots[i], fetchItem);
|
|
1037
1041
|
}
|
|
@@ -1045,12 +1049,12 @@ function _flushPendingFetchForType(store, pendingFetchMap, modelName) {
|
|
|
1045
1049
|
_processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);
|
|
1046
1050
|
}
|
|
1047
1051
|
} else if (totalItems === 1) {
|
|
1048
|
-
|
|
1052
|
+
_fetchRecord(store, adapter, pendingFetchItems[0]);
|
|
1049
1053
|
}
|
|
1050
1054
|
}
|
|
1051
1055
|
pendingFetchMap.forEach(pendingFetchItems => {
|
|
1052
1056
|
pendingFetchItems.forEach(pendingFetchItem => {
|
|
1053
|
-
|
|
1057
|
+
_fetchRecord(store, adapter, pendingFetchItem);
|
|
1054
1058
|
});
|
|
1055
1059
|
});
|
|
1056
1060
|
}
|
|
@@ -1063,12 +1067,12 @@ function _flushPendingSave(store, pending) {
|
|
|
1063
1067
|
} = pending;
|
|
1064
1068
|
const adapter = store.adapterFor(identifier.type);
|
|
1065
1069
|
const operation = options[SaveOp];
|
|
1066
|
-
|
|
1067
|
-
|
|
1070
|
+
const modelName = snapshot.modelName;
|
|
1071
|
+
const modelClass = store.modelFor(modelName);
|
|
1068
1072
|
assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);
|
|
1069
1073
|
assert(`You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`, typeof adapter[operation] === 'function');
|
|
1070
1074
|
let promise = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));
|
|
1071
|
-
|
|
1075
|
+
const serializer = store.serializerFor(modelName);
|
|
1072
1076
|
assert(`Your adapter's '${operation}' method must return a value, but it returned 'undefined'`, promise !== undefined);
|
|
1073
1077
|
promise = promise.then(adapterPayload => {
|
|
1074
1078
|
if (adapterPayload) {
|
|
@@ -1077,4 +1081,13 @@ function _flushPendingSave(store, pending) {
|
|
|
1077
1081
|
});
|
|
1078
1082
|
resolver.resolve(promise);
|
|
1079
1083
|
}
|
|
1080
|
-
|
|
1084
|
+
|
|
1085
|
+
/**
|
|
1086
|
+
* Utilities - often temporary - for maintaining backwards compatibility with
|
|
1087
|
+
* older parts of EmberData.
|
|
1088
|
+
*
|
|
1089
|
+
@module @ember-data/legacy-compat
|
|
1090
|
+
@main @ember-data/legacy-compat
|
|
1091
|
+
*/
|
|
1092
|
+
function upgradeStore(store) {}
|
|
1093
|
+
export { FetchManager as F, SaveOp as S, assertIdentifierHasId as a, SnapshotRecordArray as b, Snapshot as c, iterateData as i, normalizeResponseHelper as n, payloadIsNotBlank as p, upgradeStore as u };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"-private-1aicprWG.js","sources":["../src/legacy-network-handler/snapshot-record-array.ts","../src/legacy-network-handler/identifier-has-id.ts","../src/legacy-network-handler/legacy-data-utils.ts","../src/legacy-network-handler/serializer-response.ts","../src/legacy-network-handler/snapshot.ts","../src/legacy-network-handler/fetch-manager.ts","../src/-private.ts"],"sourcesContent":["/**\n @module @ember-data/legacy-compat\n*/\nimport type Store from '@ember-data/store';\nimport { SOURCE } from '@ember-data/store/-private';\nimport type IdentifierArray from '@ember-data/store/-private/record-arrays/identifier-array';\nimport type { ModelSchema } from '@ember-data/store/-types/q/ds-model';\nimport type { FindOptions } from '@ember-data/store/-types/q/store';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\n\nimport { upgradeStore } from '../-private';\nimport type Snapshot from './snapshot';\n/**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters for certain requests.\n\n @class SnapshotRecordArray\n @public\n*/\nexport default class SnapshotRecordArray {\n declare _snapshots: Snapshot[] | null;\n declare _type: ModelSchema | null;\n declare modelName: string;\n declare __store: Store;\n\n declare adapterOptions?: Record<string, unknown>;\n declare include?: string;\n\n /**\n SnapshotRecordArray is not directly instantiable.\n Instances are provided to consuming application's\n adapters and serializers for certain requests.\n\n @method constructor\n @private\n @constructor\n @param {Store} store\n @param {string} type\n @param options\n */\n constructor(store: Store, type: string, options: FindOptions = {}) {\n this.__store = store;\n /**\n An array of snapshots\n @private\n @property _snapshots\n @type {Array}\n */\n this._snapshots = null;\n\n /**\n The modelName of the underlying records for the snapshots in the array, as a Model\n @property modelName\n @public\n @type {Model}\n */\n this.modelName = type;\n\n /**\n A hash of adapter options passed into the store method for this request.\n\n Example\n\n ```app/adapters/post.js\n import MyCustomAdapter from './custom-adapter';\n\n export default class PostAdapter extends MyCustomAdapter {\n findAll(store, type, sinceToken, snapshotRecordArray) {\n if (snapshotRecordArray.adapterOptions.subscribe) {\n // ...\n }\n // ...\n }\n }\n ```\n\n @property adapterOptions\n @public\n @type {Object}\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n The relationships to include for this request.\n\n Example\n\n ```app/adapters/application.js\n import Adapter from '@ember-data/adapter';\n\n export default class ApplicationAdapter extends Adapter {\n findAll(store, type, snapshotRecordArray) {\n let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;\n\n return fetch(url).then((response) => response.json())\n }\n }\n ```\n\n @property include\n @public\n @type {String|Array}\n */\n this.include = options.include;\n }\n\n /**\n An array of records\n\n @property _recordArray\n @private\n @type {Array}\n */\n get _recordArray(): IdentifierArray {\n return this.__store.peekAll(this.modelName);\n }\n\n /**\n Number of records in the array\n\n Example\n\n ```app/adapters/post.js\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotRecordArray) {\n return !snapshotRecordArray.length;\n }\n });\n ```\n\n @property length\n @public\n @type {Number}\n */\n get length(): number {\n return this._recordArray.length;\n }\n\n /**\n Get snapshots of the underlying record array\n\n Example\n\n ```app/adapters/post.js\n import JSONAPIAdapter from '@ember-data/adapter/json-api';\n\n export default class PostAdapter extends JSONAPIAdapter {\n shouldReloadAll(store, snapshotArray) {\n let snapshots = snapshotArray.snapshots();\n\n return snapshots.any(function(ticketSnapshot) {\n let timeDiff = moment().diff(ticketSnapshot.attr('lastAccessedAt'), 'minutes');\n if (timeDiff > 20) {\n return true;\n } else {\n return false;\n }\n });\n }\n }\n ```\n\n @method snapshots\n @public\n @return {Array} Array of snapshots\n */\n snapshots() {\n if (this._snapshots !== null) {\n return this._snapshots;\n }\n upgradeStore(this.__store);\n\n const { _fetchManager } = this.__store;\n this._snapshots = this._recordArray[SOURCE].map((identifier: StableRecordIdentifier) =>\n _fetchManager.createSnapshot(identifier)\n );\n\n return this._snapshots;\n }\n}\n","import { assert } from '@ember/debug';\n\nimport type { StableExistingRecordIdentifier } from '@warp-drive/core-types/identifier';\n\nexport function assertIdentifierHasId(identifier: unknown): asserts identifier is StableExistingRecordIdentifier {\n assert(\n `Attempted to schedule a fetch for a record without an id.`,\n identifier && (identifier as StableExistingRecordIdentifier).id !== null\n );\n}\n","import type { AdapterPayload } from './minimum-adapter-interface';\n\nexport function iterateData<T>(data: T[] | T, fn: (o: T, index?: number) => T) {\n if (Array.isArray(data)) {\n return data.map(fn);\n } else {\n return fn(data);\n }\n}\n\nexport function payloadIsNotBlank<T>(adapterPayload: T | AdapterPayload): adapterPayload is AdapterPayload {\n if (Array.isArray(adapterPayload)) {\n return true;\n } else {\n return Object.keys(adapterPayload || {}).length !== 0;\n }\n}\n","import { assert } from '@ember/debug';\n\nimport { DEBUG } from '@ember-data/env';\nimport type Store from '@ember-data/store';\nimport type { ModelSchema } from '@ember-data/store/-types/q/ds-model';\nimport type { JsonApiDocument } from '@warp-drive/core-types/spec/raw';\n\nimport type { AdapterPayload } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface, RequestType } from './minimum-serializer-interface';\n\n/**\n This is a helper method that validates a JSON API top-level document\n\n The format of a document is described here:\n http://jsonapi.org/format/#document-top-level\n\n @internal\n*/\nfunction validateDocumentStructure(doc?: AdapterPayload | JsonApiDocument): asserts doc is JsonApiDocument {\n if (DEBUG) {\n const errors: string[] = [];\n if (!doc || typeof doc !== 'object') {\n errors.push('Top level of a JSON API document must be an object');\n } else {\n if (!('data' in doc) && !('errors' in doc) && !('meta' in doc)) {\n errors.push('One or more of the following keys must be present: \"data\", \"errors\", \"meta\".');\n } else {\n if ('data' in doc && 'errors' in doc) {\n errors.push('Top level keys \"errors\" and \"data\" cannot both be present in a JSON API document');\n }\n }\n if ('data' in doc) {\n if (!(doc.data === null || Array.isArray(doc.data) || typeof doc.data === 'object')) {\n errors.push('data must be null, an object, or an array');\n }\n }\n if ('meta' in doc) {\n if (typeof doc.meta !== 'object') {\n errors.push('meta must be an object');\n }\n }\n if ('errors' in doc) {\n if (!Array.isArray(doc.errors)) {\n errors.push('errors must be an array');\n }\n }\n if ('links' in doc) {\n if (typeof doc.links !== 'object') {\n errors.push('links must be an object');\n }\n }\n if ('jsonapi' in doc) {\n if (typeof doc.jsonapi !== 'object') {\n errors.push('jsonapi must be an object');\n }\n }\n if ('included' in doc) {\n if (typeof doc.included !== 'object') {\n errors.push('included must be an array');\n }\n }\n }\n\n assert(\n `Response must be normalized to a valid JSON API document:\\n\\t* ${errors.join('\\n\\t* ')}`,\n errors.length === 0\n );\n }\n}\n\nexport function normalizeResponseHelper(\n serializer: MinimumSerializerInterface | null,\n store: Store,\n modelClass: ModelSchema,\n payload: AdapterPayload,\n id: string | null,\n requestType: RequestType\n): JsonApiDocument {\n const normalizedResponse = serializer\n ? serializer.normalizeResponse(store, modelClass, payload, id, requestType)\n : payload;\n\n validateDocumentStructure(normalizedResponse);\n\n return normalizedResponse;\n}\n","/**\n @module @ember-data/store\n*/\nimport { assert } from '@ember/debug';\n\nimport { importSync } from '@embroider/macros';\n\nimport { DEBUG } from '@ember-data/env';\nimport type { CollectionEdge } from '@ember-data/graph/-private/edges/collection';\nimport type { ResourceEdge } from '@ember-data/graph/-private/edges/resource';\nimport { HAS_JSON_API_PACKAGE } from '@ember-data/packages';\nimport type Store from '@ember-data/store';\nimport type { RecordInstance } from '@ember-data/store/-types/q/record-instance';\nimport type { FindOptions } from '@ember-data/store/-types/q/store';\nimport type { StableRecordIdentifier } from '@warp-drive/core-types';\nimport type { ChangedAttributesHash } from '@warp-drive/core-types/cache';\nimport type { CollectionRelationship } from '@warp-drive/core-types/cache/relationship';\nimport type { Value } from '@warp-drive/core-types/json/raw';\nimport type { AttributeSchema, RelationshipSchema } from '@warp-drive/core-types/schema';\n\nimport { upgradeStore } from '../-private';\nimport type { SerializerOptions } from './minimum-serializer-interface';\n\ntype RecordId = string | null;\n\n/**\n Snapshot is not directly instantiable.\n Instances are provided to a consuming application's\n adapters and serializers for certain requests.\n\n Snapshots are only available when using `@ember-data/legacy-compat`\n for legacy compatibility with adapters and serializers.\n\n @class Snapshot\n @public\n*/\nexport default class Snapshot implements Snapshot {\n declare __attributes: Record<string, unknown> | null;\n declare _belongsToRelationships: Record<string, Snapshot>;\n declare _belongsToIds: Record<string, RecordId>;\n declare _hasManyRelationships: Record<string, Snapshot[]>;\n declare _hasManyIds: Record<string, RecordId[]>;\n declare _changedAttributes: ChangedAttributesHash;\n\n declare identifier: StableRecordIdentifier;\n declare modelName: string;\n declare id: string | null;\n declare include?: unknown;\n declare adapterOptions?: Record<string, unknown>;\n declare _store: Store;\n\n /**\n * @method constructor\n * @constructor\n * @private\n * @param options\n * @param identifier\n * @param _store\n */\n constructor(options: FindOptions, identifier: StableRecordIdentifier, store: Store) {\n this._store = store;\n\n this.__attributes = null;\n this._belongsToRelationships = Object.create(null) as Record<string, Snapshot>;\n this._belongsToIds = Object.create(null) as Record<string, RecordId>;\n this._hasManyRelationships = Object.create(null) as Record<string, Snapshot[]>;\n this._hasManyIds = Object.create(null) as Record<string, RecordId[]>;\n\n const hasRecord = !!store._instanceCache.peek(identifier);\n this.modelName = identifier.type;\n\n /**\n The unique RecordIdentifier associated with this Snapshot.\n\n @property identifier\n @public\n @type {StableRecordIdentifier}\n */\n this.identifier = identifier;\n\n /*\n If the we do not yet have a record, then we are\n likely a snapshot being provided to a find request, so we\n populate __attributes lazily. Else, to preserve the \"moment\n in time\" in which a snapshot is created, we greedily grab\n the values.\n */\n if (hasRecord) {\n this._attributes;\n }\n\n /**\n The id of the snapshot's underlying record\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.id; // => '1'\n ```\n\n @property id\n @type {String}\n @public\n */\n this.id = identifier.id;\n\n /**\n A hash of adapter options\n @property adapterOptions\n @type {Object}\n @public\n */\n this.adapterOptions = options.adapterOptions;\n\n /**\n If `include` was passed to the options hash for the request, the value\n would be available here.\n\n @property include\n @type {String|Array}\n @public\n */\n this.include = options.include;\n\n /**\n The name of the type of the underlying record for this snapshot, as a string.\n\n @property modelName\n @type {String}\n @public\n */\n this.modelName = identifier.type;\n if (hasRecord) {\n const cache = this._store.cache;\n this._changedAttributes = cache.changedAttrs(identifier);\n }\n }\n\n /**\n The underlying record for this snapshot. Can be used to access methods and\n properties defined on the record.\n\n Example\n\n ```javascript\n let json = snapshot.record.toJSON();\n ```\n\n @property record\n @type {Model}\n @public\n */\n get record(): RecordInstance | null {\n const record = this._store.peekRecord(this.identifier);\n assert(\n `Record ${this.identifier.type} ${this.identifier.id} (${this.identifier.lid}) is not yet loaded and thus cannot be accessed from the Snapshot during serialization`,\n record !== null\n );\n return record;\n }\n\n get _attributes(): Record<string, unknown> {\n if (this.__attributes !== null) {\n return this.__attributes;\n }\n const attributes = (this.__attributes = Object.create(null) as Record<string, unknown>);\n const { identifier } = this;\n const attrs = Object.keys(this._store.getSchemaDefinitionService().attributesDefinitionFor(identifier));\n const cache = this._store.cache;\n\n attrs.forEach((keyName) => {\n attributes[keyName] = cache.getAttr(identifier, keyName);\n });\n\n return attributes;\n }\n\n get isNew(): boolean {\n const cache = this._store.cache;\n return cache?.isNew(this.identifier) || false;\n }\n\n /**\n Returns the value of an attribute.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attr('author'); // => 'Tomster'\n postSnapshot.attr('title'); // => 'Ember.js rocks'\n ```\n\n Note: Values are loaded eagerly and cached when the snapshot is created.\n\n @method attr\n @param {String} keyName\n @return {Object} The attribute value or undefined\n @public\n */\n attr(keyName: string): unknown {\n if (keyName in this._attributes) {\n return this._attributes[keyName];\n }\n assert(`Model '${this.identifier.lid}' has no attribute named '${keyName}' defined.`, false);\n }\n\n /**\n Returns all attributes and their corresponding values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postSnapshot.attributes(); // => { author: 'Tomster', title: 'Ember.js rocks' }\n ```\n\n @method attributes\n @return {Object} All attributes of the current snapshot\n @public\n */\n attributes(): Record<string, unknown> {\n return { ...this._attributes };\n }\n\n /**\n Returns all changed attributes and their old and new values.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, author: 'Tomster', title: 'Ember.js rocks' });\n postModel.set('title', 'Ember.js rocks!');\n postSnapshot.changedAttributes(); // => { title: ['Ember.js rocks', 'Ember.js rocks!'] }\n ```\n\n @method changedAttributes\n @return {Object} All changed attributes of the current snapshot\n @public\n */\n changedAttributes(): ChangedAttributesHash {\n const changedAttributes = Object.create(null) as ChangedAttributesHash;\n if (!this._changedAttributes) {\n return changedAttributes;\n }\n\n const changedAttributeKeys = Object.keys(this._changedAttributes);\n\n for (let i = 0, length = changedAttributeKeys.length; i < length; i++) {\n const key = changedAttributeKeys[i];\n changedAttributes[key] = this._changedAttributes[key].slice() as [Value | undefined, Value];\n }\n\n return changedAttributes;\n }\n\n /**\n Returns the current value of a belongsTo relationship.\n\n `belongsTo` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `id`: set to `true` if you only want the ID of the related record to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World' });\n // store.createRecord('comment', { body: 'Lorem ipsum', post: post });\n commentSnapshot.belongsTo('post'); // => Snapshot\n commentSnapshot.belongsTo('post', { id: true }); // => '1'\n\n // store.push('comment', { id: 1, body: 'Lorem ipsum' });\n commentSnapshot.belongsTo('post'); // => undefined\n ```\n\n Calling `belongsTo` will return a new Snapshot as long as there's any known\n data for the relationship available, such as an ID. If the relationship is\n known but unset, `belongsTo` will return `null`. If the contents of the\n relationship is unknown `belongsTo` will return `undefined`.\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @method belongsTo\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Snapshot|String|null|undefined)} A snapshot or ID of a known\n relationship or null if the relationship is known but unset. undefined\n will be returned if the contents of the relationship is unknown.\n */\n belongsTo(keyName: string, options?: { id?: boolean }): Snapshot | RecordId | undefined {\n const returnModeIsId = !!(options && options.id);\n let result: Snapshot | RecordId | undefined;\n const store = this._store;\n\n if (returnModeIsId === true && keyName in this._belongsToIds) {\n return this._belongsToIds[keyName];\n }\n\n if (returnModeIsId === false && keyName in this._belongsToRelationships) {\n return this._belongsToRelationships[keyName];\n }\n\n const relationshipMeta = store.getSchemaDefinitionService().relationshipsDefinitionFor({ type: this.modelName })[\n keyName\n ];\n assert(\n `Model '${this.identifier.lid}' has no belongsTo relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'belongsTo'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n if (!HAS_JSON_API_PACKAGE) {\n assert(`snapshot.belongsTo only supported when using the package @ember-data/json-api`);\n }\n\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private')).graphFor;\n const { identifier } = this;\n\n if (DEBUG) {\n const relationship = graphFor(this._store).get(identifier, keyName) as ResourceEdge;\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} belongsTo relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a hasMany.`,\n relationship.definition.kind === 'belongsTo'\n );\n }\n\n const value = graphFor(this._store).getData(identifier, keyName);\n const data = value && value.data;\n upgradeStore(store);\n\n const inverseIdentifier = data ? store.identifierCache.getOrCreateRecordIdentifier(data) : null;\n\n if (value && value.data !== undefined) {\n const cache = store.cache;\n\n if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsId) {\n result = inverseIdentifier.id;\n } else {\n result = store._fetchManager.createSnapshot(inverseIdentifier);\n }\n } else {\n result = null;\n }\n }\n\n if (returnModeIsId) {\n this._belongsToIds[keyName] = result as RecordId;\n } else {\n this._belongsToRelationships[keyName] = result as Snapshot;\n }\n\n return result;\n }\n\n /**\n Returns the current value of a hasMany relationship.\n\n `hasMany` takes an optional hash of options as a second parameter,\n currently supported options are:\n\n - `ids`: set to `true` if you only want the IDs of the related records to be\n returned.\n\n Example\n\n ```javascript\n // store.push('post', { id: 1, title: 'Hello World', comments: [2, 3] });\n postSnapshot.hasMany('comments'); // => [Snapshot, Snapshot]\n postSnapshot.hasMany('comments', { ids: true }); // => ['2', '3']\n\n // store.push('post', { id: 1, title: 'Hello World' });\n postSnapshot.hasMany('comments'); // => undefined\n ```\n\n Note: Relationships are loaded lazily and cached upon first access.\n\n @method hasMany\n @param {String} keyName\n @param {Object} [options]\n @public\n @return {(Array|undefined)} An array of snapshots or IDs of a known\n relationship or an empty array if the relationship is known but unset.\n undefined will be returned if the contents of the relationship is unknown.\n */\n hasMany(keyName: string, options?: { ids?: boolean }): RecordId[] | Snapshot[] | undefined {\n const returnModeIsIds = !!(options && options.ids);\n let results: RecordId[] | Snapshot[] | undefined;\n const cachedIds: RecordId[] | undefined = this._hasManyIds[keyName];\n const cachedSnapshots: Snapshot[] | undefined = this._hasManyRelationships[keyName];\n\n if (returnModeIsIds === true && keyName in this._hasManyIds) {\n return cachedIds;\n }\n\n if (returnModeIsIds === false && keyName in this._hasManyRelationships) {\n return cachedSnapshots;\n }\n\n const store = this._store;\n upgradeStore(store);\n const relationshipMeta = store.getSchemaDefinitionService().relationshipsDefinitionFor({ type: this.modelName })[\n keyName\n ];\n assert(\n `Model '${this.identifier.lid}' has no hasMany relationship named '${keyName}' defined.`,\n relationshipMeta && relationshipMeta.kind === 'hasMany'\n );\n\n // TODO @runspired it seems this code branch would not work with CUSTOM_MODEL_CLASSes\n // this check is not a regression in behavior because relationships don't currently\n // function without access to intimate API contracts between RecordData and Model.\n // This is a requirement we should fix as soon as the relationship layer does not require\n // this intimate API usage.\n if (!HAS_JSON_API_PACKAGE) {\n assert(`snapshot.hasMany only supported when using the package @ember-data/json-api`);\n }\n\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private')).graphFor;\n const { identifier } = this;\n if (DEBUG) {\n const relationship = graphFor(this._store).get(identifier, keyName) as CollectionEdge;\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but no such relationship was found.`,\n relationship\n );\n assert(\n `You looked up the ${keyName} hasMany relationship for { type: ${identifier.type}, id: ${\n identifier.id || ''\n }, lid: ${identifier.lid} but that relationship is a belongsTo.`,\n relationship.definition.kind === 'hasMany'\n );\n }\n\n const value = graphFor(this._store).getData(identifier, keyName) as CollectionRelationship;\n\n if (value.data) {\n results = [];\n value.data.forEach((member) => {\n const inverseIdentifier = store.identifierCache.getOrCreateRecordIdentifier(member);\n const cache = store.cache;\n\n if (!cache.isDeleted(inverseIdentifier)) {\n if (returnModeIsIds) {\n (results as RecordId[]).push(inverseIdentifier.id);\n } else {\n (results as Snapshot[]).push(store._fetchManager.createSnapshot(inverseIdentifier));\n }\n }\n });\n }\n\n // we assign even if `undefined` so that we don't reprocess the relationship\n // on next access. This works with the `keyName in` checks above.\n if (returnModeIsIds) {\n this._hasManyIds[keyName] = results as RecordId[];\n } else {\n this._hasManyRelationships[keyName] = results as Snapshot[];\n }\n\n return results;\n }\n\n /**\n Iterates through all the attributes of the model, calling the passed\n function on each attribute.\n\n Example\n\n ```javascript\n snapshot.eachAttribute(function(name, meta) {\n // ...\n });\n ```\n\n @method eachAttribute\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachAttribute(callback: (key: string, meta: AttributeSchema) => void, binding?: unknown): void {\n const attrDefs = this._store.getSchemaDefinitionService().attributesDefinitionFor(this.identifier);\n Object.keys(attrDefs).forEach((key) => {\n callback.call(binding, key, attrDefs[key]);\n });\n }\n\n /**\n Iterates through all the relationships of the model, calling the passed\n function on each relationship.\n\n Example\n\n ```javascript\n snapshot.eachRelationship(function(name, relationship) {\n // ...\n });\n ```\n\n @method eachRelationship\n @param {Function} callback the callback to execute\n @param {Object} [binding] the value to which the callback's `this` should be bound\n @public\n */\n eachRelationship(callback: (key: string, meta: RelationshipSchema) => void, binding?: unknown): void {\n const relationshipDefs = this._store.getSchemaDefinitionService().relationshipsDefinitionFor(this.identifier);\n Object.keys(relationshipDefs).forEach((key) => {\n callback.call(binding, key, relationshipDefs[key]);\n });\n }\n\n /**\n Serializes the snapshot using the serializer for the model.\n\n Example\n\n ```app/adapters/application.js\n import Adapter from '@ember-data/adapter';\n\n export default Adapter.extend({\n createRecord(store, type, snapshot) {\n let data = snapshot.serialize({ includeId: true });\n let url = `/${type.modelName}`;\n\n return fetch(url, {\n method: 'POST',\n body: data,\n }).then((response) => response.json())\n }\n });\n ```\n\n @method serialize\n @param {Object} options\n @return {Object} an object whose values are primitive JSON values only\n @public\n */\n serialize(options?: SerializerOptions): unknown {\n upgradeStore(this._store);\n const serializer = this._store.serializerFor(this.modelName);\n assert(`Cannot serialize record, no serializer found`, serializer);\n return serializer.serialize(this, options);\n }\n}\n","import { assert, warn } from '@ember/debug';\n\nimport { importSync } from '@embroider/macros';\n\nimport { DEBUG, TESTING } from '@ember-data/env';\nimport { HAS_GRAPH_PACKAGE } from '@ember-data/packages';\nimport { createDeferred } from '@ember-data/request';\nimport type { Deferred } from '@ember-data/request/-private/types';\nimport type Store from '@ember-data/store';\nimport { coerceId } from '@ember-data/store/-private';\nimport type { StoreRequestInfo } from '@ember-data/store/-private/cache-handler';\nimport type { InstanceCache } from '@ember-data/store/-private/caches/instance-cache';\nimport type RequestStateService from '@ember-data/store/-private/network/request-cache';\nimport type { FindRecordQuery, Request, SaveRecordMutation } from '@ember-data/store/-private/network/request-cache';\nimport type { ModelSchema } from '@ember-data/store/-types/q/ds-model';\nimport type { FindOptions } from '@ember-data/store/-types/q/store';\nimport type { StableExistingRecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';\nimport type { CollectionResourceDocument, SingleResourceDocument } from '@warp-drive/core-types/spec/raw';\n\nimport { upgradeStore } from '../-private';\nimport { assertIdentifierHasId } from './identifier-has-id';\nimport { payloadIsNotBlank } from './legacy-data-utils';\nimport type { AdapterPayload, MinimumAdapterInterface } from './minimum-adapter-interface';\nimport type { MinimumSerializerInterface } from './minimum-serializer-interface';\nimport { normalizeResponseHelper } from './serializer-response';\nimport Snapshot from './snapshot';\n\ntype AdapterErrors = Error & { errors?: string[]; isAdapterError?: true };\ntype SerializerWithParseErrors = MinimumSerializerInterface & {\n extractErrors?(store: Store, modelClass: ModelSchema, error: AdapterErrors, recordId: string | null): unknown;\n};\n\nexport const SaveOp: unique symbol = Symbol('SaveOp');\n\nexport type FetchMutationOptions = FindOptions & { [SaveOp]: 'createRecord' | 'deleteRecord' | 'updateRecord' };\n\ninterface PendingFetchItem {\n identifier: StableExistingRecordIdentifier;\n queryRequest: Request;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n options: FindOptions;\n trace?: unknown;\n promise: Promise<StableExistingRecordIdentifier>;\n}\n\ninterface PendingSaveItem {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n resolver: Deferred<any>;\n snapshot: Snapshot;\n identifier: StableRecordIdentifier;\n options: FetchMutationOptions;\n queryRequest: Request;\n}\n\nexport default class FetchManager {\n declare isDestroyed: boolean;\n declare requestCache: RequestStateService;\n // fetches pending in the runloop, waiting to be coalesced\n declare _pendingFetch: Map<string, Map<StableExistingRecordIdentifier, PendingFetchItem[]>>;\n declare _store: Store;\n\n constructor(store: Store) {\n this._store = store;\n // used to keep track of all the find requests that need to be coalesced\n this._pendingFetch = new Map();\n this.requestCache = store.getRequestStateService();\n this.isDestroyed = false;\n }\n\n createSnapshot(identifier: StableRecordIdentifier, options: FindOptions = {}): Snapshot {\n return new Snapshot(options, identifier, this._store);\n }\n\n /**\n This method is called by `record.save`, and gets passed a\n resolver for the promise that `record.save` returns.\n\n It schedules saving to happen at the end of the run loop.\n\n @internal\n */\n scheduleSave(\n identifier: StableRecordIdentifier,\n options: FetchMutationOptions\n ): Promise<null | SingleResourceDocument> {\n const resolver = createDeferred<SingleResourceDocument | null>();\n const query: SaveRecordMutation = {\n op: 'saveRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const snapshot = this.createSnapshot(identifier, options);\n const pendingSaveItem: PendingSaveItem = {\n snapshot: snapshot,\n resolver: resolver,\n identifier,\n options,\n queryRequest,\n };\n\n const monitored = this.requestCache._enqueue(resolver.promise, pendingSaveItem.queryRequest);\n _flushPendingSave(this._store, pendingSaveItem);\n\n return monitored;\n }\n\n scheduleFetch(\n identifier: StableExistingRecordIdentifier,\n options: FindOptions,\n request: StoreRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n const query: FindRecordQuery = {\n op: 'findRecord',\n recordIdentifier: identifier,\n options,\n };\n\n const queryRequest: Request = {\n data: [query],\n };\n\n const pendingFetch = this.getPendingFetch(identifier, options);\n if (pendingFetch) {\n return pendingFetch;\n }\n\n const modelName = identifier.type;\n\n const resolver = createDeferred<SingleResourceDocument>();\n const pendingFetchItem: PendingFetchItem = {\n identifier,\n resolver,\n options,\n queryRequest,\n } as PendingFetchItem;\n\n const resolverPromise = resolver.promise;\n const store = this._store;\n const isInitialLoad = !store._instanceCache.recordIsLoaded(identifier); // we don't use isLoading directly because we are the request\n\n const monitored = this.requestCache._enqueue(resolverPromise, pendingFetchItem.queryRequest);\n let promise = monitored.then(\n (payload) => {\n // ensure that regardless of id returned we assign to the correct record\n if (payload.data && !Array.isArray(payload.data)) {\n payload.data.lid = identifier.lid;\n }\n\n // additional data received in the payload\n // may result in the merging of identifiers (and thus records)\n const potentiallyNewIm = store._push(payload, options.reload);\n if (potentiallyNewIm && !Array.isArray(potentiallyNewIm)) {\n return potentiallyNewIm;\n }\n\n return identifier;\n },\n (error) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !store.isDestroyed);\n const cache = store.cache;\n if (!cache || cache.isEmpty(identifier) || isInitialLoad) {\n let isReleasable = true;\n if (HAS_GRAPH_PACKAGE) {\n if (!cache) {\n const graphFor = (importSync('@ember-data/graph/-private') as typeof import('@ember-data/graph/-private'))\n .graphFor;\n const graph = graphFor(store);\n isReleasable = graph.isReleasable(identifier);\n if (!isReleasable) {\n graph.unload(identifier, true);\n }\n }\n }\n if (cache || isReleasable) {\n store._enableAsyncFlush = true;\n store._instanceCache.unloadRecord(identifier);\n store._enableAsyncFlush = null;\n }\n }\n throw error;\n }\n );\n\n if (this._pendingFetch.size === 0) {\n void new Promise((resolve) => setTimeout(resolve, 0)).then(() => {\n this.flushAllPendingFetches();\n });\n }\n\n const fetchesByType = this._pendingFetch;\n let fetchesById = fetchesByType.get(modelName);\n\n if (!fetchesById) {\n fetchesById = new Map();\n fetchesByType.set(modelName, fetchesById);\n }\n\n let requestsForIdentifier = fetchesById.get(identifier);\n if (!requestsForIdentifier) {\n requestsForIdentifier = [];\n fetchesById.set(identifier, requestsForIdentifier);\n }\n\n requestsForIdentifier.push(pendingFetchItem);\n\n if (TESTING) {\n if (!request.disableTestWaiter) {\n const { waitForPromise } = importSync('@ember/test-waiters') as {\n waitForPromise: <T>(promise: Promise<T>) => Promise<T>;\n };\n promise = waitForPromise(promise);\n }\n }\n\n pendingFetchItem.promise = promise;\n return promise;\n }\n\n getPendingFetch(identifier: StableExistingRecordIdentifier, options: FindOptions) {\n const pendingFetches = this._pendingFetch.get(identifier.type)?.get(identifier);\n\n // We already have a pending fetch for this\n if (pendingFetches) {\n const matchingPendingFetch = pendingFetches.find((fetch) => isSameRequest(options, fetch.options));\n if (matchingPendingFetch) {\n return matchingPendingFetch.promise;\n }\n }\n }\n\n flushAllPendingFetches() {\n if (this.isDestroyed) {\n return;\n }\n\n const store = this._store;\n this._pendingFetch.forEach((fetchItem, type) => _flushPendingFetchForType(store, fetchItem, type));\n this._pendingFetch.clear();\n }\n\n fetchDataIfNeededForIdentifier(\n identifier: StableExistingRecordIdentifier,\n options: FindOptions = {},\n request: StoreRequestInfo\n ): Promise<StableExistingRecordIdentifier> {\n // pre-loading will change the isEmpty value\n const isEmpty = _isEmpty(this._store._instanceCache, identifier);\n const isLoading = _isLoading(this._store._instanceCache, identifier);\n\n let promise: Promise<StableExistingRecordIdentifier>;\n if (isEmpty) {\n assertIdentifierHasId(identifier);\n\n if (DEBUG) {\n promise = this.scheduleFetch(identifier, Object.assign({}, options, { reload: true }), request);\n } else {\n options.reload = true;\n promise = this.scheduleFetch(identifier, options, request);\n }\n } else if (isLoading) {\n promise = this.getPendingFetch(identifier, options)!;\n assert(`Expected to find a pending request for a record in the loading state, but found none`, promise);\n } else {\n promise = Promise.resolve(identifier);\n }\n\n return promise;\n }\n\n destroy() {\n this.isDestroyed = true;\n }\n}\n\nfunction _isEmpty(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const cache = instanceCache.cache;\n if (!cache) {\n return true;\n }\n const isNew = cache.isNew(identifier);\n const isDeleted = cache.isDeleted(identifier);\n const isEmpty = cache.isEmpty(identifier);\n\n return (!isNew || isDeleted) && isEmpty;\n}\n\nfunction _isLoading(cache: InstanceCache, identifier: StableRecordIdentifier): boolean {\n const req = cache.store.getRequestStateService();\n // const fulfilled = req.getLastRequestForRecord(identifier);\n const isLoaded = cache.recordIsLoaded(identifier);\n\n return (\n !isLoaded &&\n // fulfilled === null &&\n req.getPendingRequestsForRecord(identifier).some((r) => r.type === 'query')\n );\n}\n\nfunction includesSatisfies(current: undefined | string | string[], existing: undefined | string | string[]): boolean {\n // if we have no includes we are good\n if (!current?.length) {\n return true;\n }\n\n // if we are here we have includes,\n // and if existing has no includes then we will need a new request\n if (!existing?.length) {\n return false;\n }\n\n const arrCurrent = (Array.isArray(current) ? current : current.split(',')).sort();\n const arrExisting = (Array.isArray(existing) ? existing : existing.split(',')).sort();\n\n // includes are identical\n if (arrCurrent.join(',') === arrExisting.join(',')) {\n return true;\n }\n\n // if all of current includes are in existing includes then we are good\n // so if we find one that is not in existing then we need a new request\n for (let i = 0; i < arrCurrent.length; i++) {\n if (!arrExisting.includes(arrCurrent[i])) {\n return false;\n }\n }\n\n return true;\n}\n\nfunction optionsSatisfies(current: object | undefined, existing: object | undefined): boolean {\n return !current || current === existing || Object.keys(current).length === 0;\n}\n\n// this function helps resolve whether we have a pending request that we should use instead\nfunction isSameRequest(options: FindOptions = {}, existingOptions: FindOptions = {}) {\n return (\n optionsSatisfies(options.adapterOptions, existingOptions.adapterOptions) &&\n includesSatisfies(options.include, existingOptions.include)\n );\n}\n\nfunction _findMany(\n store: Store,\n adapter: MinimumAdapterInterface,\n modelName: string,\n snapshots: Snapshot[]\n): Promise<CollectionResourceDocument> {\n const modelClass = store.modelFor(modelName); // `adapter.findMany` gets the modelClass still\n const promise = Promise.resolve().then(() => {\n const ids = snapshots.map((s) => s.id!);\n assert(\n `Cannot fetch a record without an id`,\n ids.every((v) => v !== null)\n );\n // eslint-disable-next-line @typescript-eslint/unbound-method\n assert(`Expected this adapter to implement findMany for coalescing`, adapter.findMany);\n const ret = adapter.findMany(store, modelClass, ids, snapshots);\n assert('adapter.findMany returned undefined, this was very likely a mistake', ret !== undefined);\n return ret;\n });\n upgradeStore(store);\n\n return promise.then((adapterPayload) => {\n assert(\n `You made a 'findMany' request for '${modelName}' records with ids '[${snapshots\n .map((s) => s.id!)\n .join(',')}]', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, modelClass, adapterPayload, null, 'findMany');\n return payload as CollectionResourceDocument;\n });\n}\n\nfunction rejectFetchedItems(fetchMap: Map<Snapshot, PendingFetchItem>, snapshots: Snapshot[], error?: Error) {\n for (let i = 0, l = snapshots.length; i < l; i++) {\n const snapshot = snapshots[i];\n const pair = fetchMap.get(snapshot);\n\n if (pair) {\n pair.resolver.reject(\n error ||\n new Error(\n `Expected: '<${\n snapshot.modelName\n }:${snapshot.id!}>' to be present in the adapter provided payload, but it was not found.`\n )\n );\n }\n }\n}\n\nfunction handleFoundRecords(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n snapshots: Snapshot[],\n coalescedPayload: CollectionResourceDocument\n) {\n /*\n It is possible that the same ID is included multiple times\n via multiple snapshots. This happens when more than one\n options hash was supplied, each of which must be uniquely\n accounted for.\n\n However, since we can't map from response to a specific\n options object, we resolve all snapshots by id with\n the first response we see.\n */\n const snapshotsById = new Map<string, Snapshot[]>();\n for (let i = 0; i < snapshots.length; i++) {\n const id = snapshots[i].id!;\n let snapshotGroup = snapshotsById.get(id);\n if (!snapshotGroup) {\n snapshotGroup = [];\n snapshotsById.set(id, snapshotGroup);\n }\n snapshotGroup.push(snapshots[i]);\n }\n\n const included = Array.isArray(coalescedPayload.included) ? coalescedPayload.included : [];\n\n // resolve found records\n const resources = coalescedPayload.data;\n for (let i = 0, l = resources.length; i < l; i++) {\n const resource = resources[i];\n const snapshotGroup = snapshotsById.get(resource.id);\n snapshotsById.delete(resource.id);\n\n if (!snapshotGroup) {\n // TODO consider whether this should be a deprecation/assertion\n included.push(resource);\n } else {\n snapshotGroup.forEach((snapshot) => {\n const pair = fetchMap.get(snapshot)!;\n const resolver = pair.resolver;\n resolver.resolve({ data: resource });\n });\n }\n }\n\n if (included.length > 0) {\n store._push({ data: null, included }, true);\n }\n\n if (snapshotsById.size === 0) {\n return;\n }\n\n // reject missing records\n const rejected: Snapshot[] = [];\n snapshotsById.forEach((snapshotArray) => {\n rejected.push(...snapshotArray);\n });\n warn(\n 'Ember Data expected to find records with the following ids in the adapter response from findMany but they were missing: [ \"' +\n [...snapshotsById.values()].map((r) => r[0].id).join('\", \"') +\n '\" ]',\n {\n id: 'ds.store.missing-records-from-adapter',\n }\n );\n\n rejectFetchedItems(fetchMap, rejected);\n}\n\nfunction _fetchRecord(store: Store, adapter: MinimumAdapterInterface, fetchItem: PendingFetchItem) {\n upgradeStore(store);\n const identifier = fetchItem.identifier;\n const modelName = identifier.type;\n\n assert(`You tried to find a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to find a record but your adapter (for ${modelName}) does not implement 'findRecord'`,\n typeof adapter.findRecord === 'function'\n );\n\n const snapshot = store._fetchManager.createSnapshot(identifier, fetchItem.options);\n const klass = store.modelFor(identifier.type);\n const id = identifier.id;\n\n let promise = Promise.resolve().then(() => {\n return adapter.findRecord(store, klass, identifier.id, snapshot);\n });\n\n promise = promise.then((adapterPayload) => {\n assert(`Async Leak Detected: Expected the store to not be destroyed`, !(store.isDestroyed || store.isDestroying));\n assert(\n `You made a 'findRecord' request for a '${modelName}' with id '${id}', but the adapter's response did not have any data`,\n !!payloadIsNotBlank(adapterPayload)\n );\n const serializer = store.serializerFor(modelName);\n const payload = normalizeResponseHelper(serializer, store, klass, adapterPayload, id, 'findRecord');\n assert(\n `Ember Data expected the primary data returned from a 'findRecord' response to be an object but instead it found an array.`,\n !Array.isArray(payload.data)\n );\n assert(\n `The 'findRecord' request for ${modelName}:${id} resolved indicating success but contained no primary data. To indicate a 404 not found you should either reject the promise returned by the adapter's findRecord method or throw a NotFoundError.`,\n 'data' in payload && payload.data !== null && typeof payload.data === 'object'\n );\n\n warn(\n `You requested a record of type '${modelName}' with id '${id}' but the adapter returned a payload with primary data having an id of '${payload.data.id}'. Use 'store.findRecord()' when the requested id is the same as the one returned by the adapter. In other cases use 'store.queryRecord()' instead.`,\n coerceId(payload.data.id) === coerceId(id),\n {\n id: 'ds.store.findRecord.id-mismatch',\n }\n );\n\n return payload;\n }) as Promise<AdapterPayload>;\n\n fetchItem.resolver.resolve(promise);\n}\n\nfunction _processCoalescedGroup(\n store: Store,\n fetchMap: Map<Snapshot, PendingFetchItem>,\n group: Snapshot[],\n adapter: MinimumAdapterInterface,\n modelName: string\n) {\n if (group.length > 1) {\n _findMany(store, adapter, modelName, group)\n .then((payloads: CollectionResourceDocument) => {\n handleFoundRecords(store, fetchMap, group, payloads);\n })\n .catch((error: Error) => {\n rejectFetchedItems(fetchMap, group, error);\n });\n } else if (group.length === 1) {\n _fetchRecord(store, adapter, fetchMap.get(group[0])!);\n } else {\n assert(\"You cannot return an empty array from adapter's method groupRecordsForFindMany\", false);\n }\n}\n\nfunction _flushPendingFetchForType(\n store: Store,\n pendingFetchMap: Map<StableExistingRecordIdentifier, PendingFetchItem[]>,\n modelName: string\n) {\n upgradeStore(store);\n const adapter = store.adapterFor(modelName);\n const shouldCoalesce = !!adapter.findMany && adapter.coalesceFindRequests;\n\n if (shouldCoalesce) {\n const pendingFetchItems: PendingFetchItem[] = [];\n pendingFetchMap.forEach((requestsForIdentifier, identifier) => {\n if (requestsForIdentifier.length > 1) {\n return;\n }\n\n // remove this entry from the map so it's not processed again\n pendingFetchMap.delete(identifier);\n pendingFetchItems.push(requestsForIdentifier[0]);\n });\n\n const totalItems = pendingFetchItems.length;\n\n if (totalItems > 1) {\n const snapshots = new Array<Snapshot>(totalItems);\n const fetchMap = new Map<Snapshot, PendingFetchItem>();\n for (let i = 0; i < totalItems; i++) {\n const fetchItem = pendingFetchItems[i];\n snapshots[i] = store._fetchManager.createSnapshot(fetchItem.identifier, fetchItem.options);\n fetchMap.set(snapshots[i], fetchItem);\n }\n\n let groups: Snapshot[][];\n if (adapter.groupRecordsForFindMany) {\n groups = adapter.groupRecordsForFindMany(store, snapshots);\n } else {\n groups = [snapshots];\n }\n\n for (let i = 0, l = groups.length; i < l; i++) {\n _processCoalescedGroup(store, fetchMap, groups[i], adapter, modelName);\n }\n } else if (totalItems === 1) {\n _fetchRecord(store, adapter, pendingFetchItems[0]);\n }\n }\n\n pendingFetchMap.forEach((pendingFetchItems) => {\n pendingFetchItems.forEach((pendingFetchItem) => {\n _fetchRecord(store, adapter, pendingFetchItem);\n });\n });\n}\n\nfunction _flushPendingSave(store: Store, pending: PendingSaveItem) {\n const { snapshot, resolver, identifier, options } = pending;\n upgradeStore(store);\n const adapter = store.adapterFor(identifier.type);\n const operation = options[SaveOp];\n\n const modelName = snapshot.modelName;\n const modelClass = store.modelFor(modelName);\n\n assert(`You tried to update a record but you have no adapter (for ${modelName})`, adapter);\n assert(\n `You tried to update a record but your adapter (for ${modelName}) does not implement '${operation}'`,\n typeof adapter[operation] === 'function'\n );\n\n let promise: Promise<AdapterPayload> = Promise.resolve().then(() => adapter[operation](store, modelClass, snapshot));\n const serializer: SerializerWithParseErrors | null = store.serializerFor(modelName);\n\n assert(\n `Your adapter's '${operation}' method must return a value, but it returned 'undefined'`,\n promise !== undefined\n );\n\n promise = promise.then((adapterPayload) => {\n if (adapterPayload) {\n return normalizeResponseHelper(serializer, store, modelClass, adapterPayload, snapshot.id, operation);\n }\n }) as Promise<AdapterPayload>;\n\n resolver.resolve(promise);\n}\n","import type Store from '@ember-data/store';\n\nimport type { CompatStore } from '.';\n\n/**\n * Utilities - often temporary - for maintaining backwards compatibility with\n * older parts of EmberData.\n *\n @module @ember-data/legacy-compat\n @main @ember-data/legacy-compat\n*/\nexport { default as SnapshotRecordArray } from './legacy-network-handler/snapshot-record-array';\nexport { SaveOp } from './legacy-network-handler/fetch-manager';\nexport { default as FetchManager } from './legacy-network-handler/fetch-manager';\nexport { default as Snapshot } from './legacy-network-handler/snapshot';\n\nexport function upgradeStore(store: Store): asserts store is CompatStore {}\n"],"names":["SnapshotRecordArray","constructor","store","type","options","__store","_snapshots","modelName","adapterOptions","include","_recordArray","peekAll","length","snapshots","upgradeStore","_fetchManager","SOURCE","map","identifier","createSnapshot","assertIdentifierHasId","assert","id","iterateData","data","fn","Array","isArray","payloadIsNotBlank","adapterPayload","Object","keys","validateDocumentStructure","doc","macroCondition","getOwnConfig","env","DEBUG","errors","push","meta","links","jsonapi","included","join","normalizeResponseHelper","serializer","modelClass","payload","requestType","normalizedResponse","normalizeResponse","Snapshot","_store","__attributes","_belongsToRelationships","create","_belongsToIds","_hasManyRelationships","_hasManyIds","hasRecord","_instanceCache","peek","_attributes","cache","_changedAttributes","changedAttrs","record","peekRecord","lid","attributes","attrs","getSchemaDefinitionService","attributesDefinitionFor","forEach","keyName","getAttr","isNew","attr","changedAttributes","changedAttributeKeys","i","key","slice","belongsTo","returnModeIsId","result","relationshipMeta","relationshipsDefinitionFor","kind","packages","HAS_JSON_API_PACKAGE","graphFor","importSync","relationship","get","definition","value","getData","inverseIdentifier","identifierCache","getOrCreateRecordIdentifier","undefined","isDeleted","hasMany","returnModeIsIds","ids","results","cachedIds","cachedSnapshots","member","eachAttribute","callback","binding","attrDefs","call","eachRelationship","relationshipDefs","serialize","serializerFor","SaveOp","Symbol","FetchManager","_pendingFetch","Map","requestCache","getRequestStateService","isDestroyed","scheduleSave","resolver","createDeferred","query","op","recordIdentifier","queryRequest","snapshot","pendingSaveItem","monitored","_enqueue","promise","_flushPendingSave","scheduleFetch","request","pendingFetch","getPendingFetch","pendingFetchItem","resolverPromise","isInitialLoad","recordIsLoaded","then","potentiallyNewIm","_push","reload","error","isEmpty","isReleasable","HAS_GRAPH_PACKAGE","graph","unload","_enableAsyncFlush","unloadRecord","size","Promise","resolve","setTimeout","flushAllPendingFetches","fetchesByType","fetchesById","set","requestsForIdentifier","TESTING","disableTestWaiter","waitForPromise","pendingFetches","matchingPendingFetch","find","fetch","isSameRequest","fetchItem","_flushPendingFetchForType","clear","fetchDataIfNeededForIdentifier","_isEmpty","isLoading","_isLoading","assign","destroy","instanceCache","req","isLoaded","getPendingRequestsForRecord","some","r","includesSatisfies","current","existing","arrCurrent","split","sort","arrExisting","includes","optionsSatisfies","existingOptions","_findMany","adapter","modelFor","s","every","v","findMany","ret","rejectFetchedItems","fetchMap","l","pair","reject","Error","handleFoundRecords","coalescedPayload","snapshotsById","snapshotGroup","resources","resource","delete","rejected","snapshotArray","warn","values","_fetchRecord","findRecord","klass","isDestroying","coerceId","_processCoalescedGroup","group","payloads","catch","pendingFetchMap","adapterFor","shouldCoalesce","coalesceFindRequests","pendingFetchItems","totalItems","groups","groupRecordsForFindMany","pending","operation"],"mappings":";;;;;AAAA;AACA;AACA;;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACe,MAAMA,mBAAmB,CAAC;AASvC;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAEEC,WAAWA,CAACC,KAAY,EAAEC,IAAY,EAAEC,OAAoB,GAAG,EAAE,EAAE;IACjE,IAAI,CAACC,OAAO,GAAGH,KAAK,CAAA;AACpB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACI,UAAU,GAAG,IAAI,CAAA;;AAEtB;AACJ;AACA;AACA;AACA;AACA;IACI,IAAI,CAACC,SAAS,GAAGJ,IAAI,CAAA;;AAErB;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKI,IAAA,IAAI,CAACK,cAAc,GAAGJ,OAAO,CAACI,cAAc,CAAA;;AAE5C;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMI,IAAA,IAAI,CAACC,OAAO,GAAGL,OAAO,CAACK,OAAO,CAAA;AAChC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;EAEE,IAAIC,YAAYA,GAAoB;IAClC,OAAO,IAAI,CAACL,OAAO,CAACM,OAAO,CAAC,IAAI,CAACJ,SAAS,CAAC,CAAA;AAC7C,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EAKE,IAAIK,MAAMA,GAAW;AACnB,IAAA,OAAO,IAAI,CAACF,YAAY,CAACE,MAAM,CAAA;AACjC,GAAA;;AAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMEC,EAAAA,SAASA,GAAG;AACV,IAAA,IAAI,IAAI,CAACP,UAAU,KAAK,IAAI,EAAE;MAC5B,OAAO,IAAI,CAACA,UAAU,CAAA;AACxB,KAAA;AACAQ,IAAAA,YAAY,CAAC,IAAI,CAACT,OAAO,CAAC,CAAA;IAE1B,MAAM;AAAEU,MAAAA,aAAAA;KAAe,GAAG,IAAI,CAACV,OAAO,CAAA;IACtC,IAAI,CAACC,UAAU,GAAG,IAAI,CAACI,YAAY,CAACM,MAAM,CAAC,CAACC,GAAG,CAAEC,UAAkC,IACjFH,aAAa,CAACI,cAAc,CAACD,UAAU,CACzC,CAAC,CAAA;IAED,OAAO,IAAI,CAACZ,UAAU,CAAA;AACxB,GAAA;AACF;;AClLO,SAASc,qBAAqBA,CAACF,UAAmB,EAAwD;EAC/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U,CAAA,yDAAA,CAA0D,EACvF3G,OAAO,KAAKrC,SACd,CAAC,CAAA;AAEDqC,EAAAA,OAAO,GAAGA,OAAO,CAACU,IAAI,CAAExH,cAAc,IAAK;AACzC,IAAA,IAAIA,cAAc,EAAE;AAClB,MAAA,OAAOgB,uBAAuB,CAACC,UAAU,EAAE5C,KAAK,EAAE6C,UAAU,EAAElB,cAAc,EAAE0G,QAAQ,CAACjH,EAAE,EAAEgO,SAAS,CAAC,CAAA;AACvG,KAAA;AACF,GAAC,CAA4B,CAAA;AAE7BrH,EAAAA,QAAQ,CAACkC,OAAO,CAACxB,OAAO,CAAC,CAAA;AAC3B;;AChnBA;AACA;AACA;AACA;AACA;AACA;AACA;AAMO,SAAS7H,YAAYA,CAACZ,KAAY,EAAgC;;;;"}
|
package/addon/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as FetchManager,
|
|
1
|
+
export { F as FetchManager, S as SaveOp, c as Snapshot, b as SnapshotRecordArray, u as upgradeStore } from "./-private-1aicprWG";
|