@ember-data/store 3.29.0-alpha.9 → 4.0.0-beta.3
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 +14 -17
- package/addon/-private/identifiers/is-stable-identifier.ts +1 -1
- package/addon/-private/system/core-store.ts +95 -56
- package/addon/-private/system/ds-model-store.ts +8 -9
- package/addon/-private/system/fetch-manager.ts +17 -12
- package/addon/-private/system/identity-map.ts +1 -2
- package/addon/-private/system/internal-model-map.ts +2 -4
- package/addon/-private/system/model/internal-model.ts +14 -16
- package/addon/-private/system/model/shim-model-class.ts +3 -5
- package/addon/-private/system/record-data-for.ts +3 -2
- package/addon/-private/system/record-notification-manager.ts +2 -4
- package/addon/-private/system/references/record.ts +3 -4
- package/addon/-private/system/references/reference.ts +8 -10
- package/addon/-private/system/request-cache.ts +8 -7
- package/addon/-private/system/schema-definition-service.ts +4 -6
- package/addon/-private/system/snapshot-record-array.ts +5 -4
- package/addon/-private/system/snapshot.ts +9 -12
- package/addon/-private/system/store/internal-model-factory.ts +10 -9
- package/addon/-private/system/store/record-data-store-wrapper.ts +11 -10
- package/addon/-private/ts-interfaces/ds-model.ts +2 -4
- package/addon/-private/ts-interfaces/ember-data-json-api.ts +3 -2
- package/addon/-private/ts-interfaces/fetch-manager.ts +2 -1
- package/addon/-private/ts-interfaces/identifier.ts +1 -3
- package/addon/-private/ts-interfaces/minimum-adapter-interface.ts +8 -7
- package/addon/-private/ts-interfaces/minimum-serializer-interface.ts +7 -7
- package/addon/-private/ts-interfaces/record-data-json-api.ts +3 -3
- package/addon/-private/ts-interfaces/record-data-record-wrapper.ts +4 -5
- package/addon/-private/ts-interfaces/record-data-schemas.ts +2 -1
- package/addon/-private/ts-interfaces/record-data-store-wrapper.ts +2 -4
- package/addon/-private/ts-interfaces/record-data.ts +3 -5
- package/addon/-private/ts-interfaces/schema-definition-service.ts +2 -3
- package/addon/-private/ts-interfaces/store.ts +1 -1
- package/addon/-private/utils/construct-resource.ts +1 -3
- package/addon/-private/utils/promise-record.ts +3 -3
- package/package.json +5 -5
|
@@ -6,30 +6,27 @@ import { assign } from '@ember/polyfills';
|
|
|
6
6
|
import { DEBUG } from '@glimmer/env';
|
|
7
7
|
|
|
8
8
|
import coerceId from '../system/coerce-id';
|
|
9
|
+
import type CoreStore from '../system/core-store';
|
|
9
10
|
import normalizeModelName from '../system/normalize-model-name';
|
|
11
|
+
import type { ExistingResourceObject, ResourceIdentifierObject } from '../ts-interfaces/ember-data-json-api';
|
|
12
|
+
import type {
|
|
13
|
+
ForgetMethod,
|
|
14
|
+
GenerationMethod,
|
|
15
|
+
Identifier,
|
|
16
|
+
IdentifierBucket,
|
|
17
|
+
RecordIdentifier,
|
|
18
|
+
ResetMethod,
|
|
19
|
+
ResourceData,
|
|
20
|
+
StableRecordIdentifier,
|
|
21
|
+
UpdateMethod,
|
|
22
|
+
} from '../ts-interfaces/identifier';
|
|
10
23
|
import { DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET } from '../ts-interfaces/identifier';
|
|
24
|
+
import type { ConfidentDict } from '../ts-interfaces/utils';
|
|
11
25
|
import isNonEmptyString from '../utils/is-non-empty-string';
|
|
12
26
|
import { addSymbol } from '../utils/symbol';
|
|
13
27
|
import isStableIdentifier, { markStableIdentifier, unmarkStableIdentifier } from './is-stable-identifier';
|
|
14
28
|
import uuidv4 from './utils/uuid-v4';
|
|
15
29
|
|
|
16
|
-
type IdentifierBucket = import('../ts-interfaces/identifier').IdentifierBucket;
|
|
17
|
-
|
|
18
|
-
type ResourceData = import('../ts-interfaces/identifier').ResourceData;
|
|
19
|
-
|
|
20
|
-
type Identifier = import('../ts-interfaces/identifier').Identifier;
|
|
21
|
-
|
|
22
|
-
type CoreStore = import('../system/core-store').default;
|
|
23
|
-
type StableRecordIdentifier = import('../ts-interfaces/identifier').StableRecordIdentifier;
|
|
24
|
-
type GenerationMethod = import('../ts-interfaces/identifier').GenerationMethod;
|
|
25
|
-
type UpdateMethod = import('../ts-interfaces/identifier').UpdateMethod;
|
|
26
|
-
type ForgetMethod = import('../ts-interfaces/identifier').ForgetMethod;
|
|
27
|
-
type ResetMethod = import('../ts-interfaces/identifier').ResetMethod;
|
|
28
|
-
type RecordIdentifier = import('../ts-interfaces/identifier').RecordIdentifier;
|
|
29
|
-
type ResourceIdentifierObject = import('../ts-interfaces/ember-data-json-api').ResourceIdentifierObject;
|
|
30
|
-
type ExistingResourceObject = import('../ts-interfaces/ember-data-json-api').ExistingResourceObject;
|
|
31
|
-
type ConfidentDict<T> = import('../ts-interfaces/utils').ConfidentDict<T>;
|
|
32
|
-
|
|
33
30
|
function freeze<T>(obj: T): T {
|
|
34
31
|
if (typeof Object.freeze === 'function') {
|
|
35
32
|
return Object.freeze(obj);
|
|
@@ -7,6 +7,7 @@ import { assert, deprecate, inspect, warn } from '@ember/debug';
|
|
|
7
7
|
import { computed, defineProperty, get, set } from '@ember/object';
|
|
8
8
|
import { assign } from '@ember/polyfills';
|
|
9
9
|
import { _backburner as emberBackburner } from '@ember/runloop';
|
|
10
|
+
import type { Backburner } from '@ember/runloop/-private/backburner';
|
|
10
11
|
import Service from '@ember/service';
|
|
11
12
|
import { registerWaiter, unregisterWaiter } from '@ember/test';
|
|
12
13
|
import { isNone, isPresent, typeOf } from '@ember/utils';
|
|
@@ -33,8 +34,38 @@ import {
|
|
|
33
34
|
DEPRECATE_DEFAULT_SERIALIZER,
|
|
34
35
|
DEPRECATE_LEGACY_TEST_REGISTRATIONS,
|
|
35
36
|
} from '@ember-data/private-build-infra/deprecations';
|
|
36
|
-
|
|
37
|
+
import type {
|
|
38
|
+
BelongsToRelationship,
|
|
39
|
+
ManyRelationship,
|
|
40
|
+
RecordData as RecordDataClass,
|
|
41
|
+
} from '@ember-data/record-data/-private';
|
|
42
|
+
import type { RelationshipState } from '@ember-data/record-data/-private/graph/-state';
|
|
43
|
+
|
|
44
|
+
import type { IdentifierCache } from '../identifiers/cache';
|
|
37
45
|
import { identifierCacheFor } from '../identifiers/cache';
|
|
46
|
+
import type { DSModel } from '../ts-interfaces/ds-model';
|
|
47
|
+
import type {
|
|
48
|
+
CollectionResourceDocument,
|
|
49
|
+
EmptyResourceDocument,
|
|
50
|
+
ExistingResourceObject,
|
|
51
|
+
JsonApiDocument,
|
|
52
|
+
ResourceIdentifierObject,
|
|
53
|
+
SingleResourceDocument,
|
|
54
|
+
} from '../ts-interfaces/ember-data-json-api';
|
|
55
|
+
import type {
|
|
56
|
+
RecordIdentifier,
|
|
57
|
+
StableExistingRecordIdentifier,
|
|
58
|
+
StableRecordIdentifier,
|
|
59
|
+
} from '../ts-interfaces/identifier';
|
|
60
|
+
import type { PromiseProxy } from '../ts-interfaces/promise-proxies';
|
|
61
|
+
import type { RecordData } from '../ts-interfaces/record-data';
|
|
62
|
+
import type { JsonApiRelationship } from '../ts-interfaces/record-data-json-api';
|
|
63
|
+
import type { RecordDataRecordWrapper } from '../ts-interfaces/record-data-record-wrapper';
|
|
64
|
+
import type { AttributesSchema } from '../ts-interfaces/record-data-schemas';
|
|
65
|
+
import type { RecordInstance } from '../ts-interfaces/record-instance';
|
|
66
|
+
import type { SchemaDefinitionService } from '../ts-interfaces/schema-definition-service';
|
|
67
|
+
import type { FindOptions } from '../ts-interfaces/store';
|
|
68
|
+
import type { Dict } from '../ts-interfaces/utils';
|
|
38
69
|
import constructResource from '../utils/construct-resource';
|
|
39
70
|
import promiseRecord from '../utils/promise-record';
|
|
40
71
|
import { addSymbol } from '../utils/symbol';
|
|
@@ -42,62 +73,36 @@ import edBackburner from './backburner';
|
|
|
42
73
|
import coerceId, { ensureStringId } from './coerce-id';
|
|
43
74
|
import { errorsArrayToHash } from './errors-utils';
|
|
44
75
|
import FetchManager, { SaveOp } from './fetch-manager';
|
|
76
|
+
import type InternalModel from './model/internal-model';
|
|
45
77
|
import {
|
|
46
78
|
assertRecordsPassedToHasMany,
|
|
47
79
|
extractRecordDataFromRecord,
|
|
48
80
|
extractRecordDatasFromRecords,
|
|
49
81
|
} from './model/internal-model';
|
|
82
|
+
import type ShimModelClass from './model/shim-model-class';
|
|
50
83
|
import { getShimClass } from './model/shim-model-class';
|
|
51
84
|
import normalizeModelName from './normalize-model-name';
|
|
52
85
|
import { promiseArray, promiseObject } from './promise-proxies';
|
|
53
86
|
import RecordArrayManager from './record-array-manager';
|
|
54
87
|
import { setRecordDataFor } from './record-data-for';
|
|
55
88
|
import NotificationManager from './record-notification-manager';
|
|
89
|
+
import type { BelongsToReference, HasManyReference } from './references';
|
|
56
90
|
import { RecordReference } from './references';
|
|
57
|
-
import
|
|
91
|
+
import type RequestCache from './request-cache';
|
|
92
|
+
import type { default as Snapshot, PrivateSnapshot } from './snapshot';
|
|
58
93
|
import { _bind, _guard, _objectIsAlive, guardDestroyedStore } from './store/common';
|
|
59
94
|
import { _find, _findAll, _findBelongsTo, _findHasMany, _findMany, _query, _queryRecord } from './store/finders';
|
|
60
|
-
import {
|
|
95
|
+
import {
|
|
96
|
+
internalModelFactoryFor,
|
|
97
|
+
peekRecordIdentifier,
|
|
98
|
+
recordIdentifierFor,
|
|
99
|
+
setRecordIdentifier,
|
|
100
|
+
} from './store/internal-model-factory';
|
|
61
101
|
import RecordDataStoreWrapper from './store/record-data-store-wrapper';
|
|
62
102
|
import { normalizeResponseHelper } from './store/serializer-response';
|
|
63
103
|
|
|
64
|
-
type
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
type RelationshipState = import('@ember-data/record-data/-private/graph/-state').RelationshipState;
|
|
68
|
-
type ShimModelClass = import('./model/shim-model-class').default;
|
|
69
|
-
type Snapshot = import('./snapshot').default;
|
|
70
|
-
type Backburner = import('@ember/runloop/-private/backburner').Backburner;
|
|
71
|
-
type RecordReference = import('./references').RecordReference;
|
|
72
|
-
type HasManyReference = import('./references').HasManyReference;
|
|
73
|
-
type BelongsToReference = import('./references').BelongsToReference;
|
|
74
|
-
type IdentifierCache = import('../identifiers/cache').IdentifierCache;
|
|
75
|
-
type InternalModel = import('./model/internal-model').default;
|
|
76
|
-
|
|
77
|
-
type JsonApiRelationship = import('../ts-interfaces/record-data-json-api').JsonApiRelationship;
|
|
78
|
-
type ResourceIdentifierObject = import('../ts-interfaces/ember-data-json-api').ResourceIdentifierObject;
|
|
79
|
-
type EmptyResourceDocument = import('../ts-interfaces/ember-data-json-api').EmptyResourceDocument;
|
|
80
|
-
type SingleResourceDocument = import('../ts-interfaces/ember-data-json-api').SingleResourceDocument;
|
|
81
|
-
type CollectionResourceDocument = import('../ts-interfaces/ember-data-json-api').CollectionResourceDocument;
|
|
82
|
-
type JsonApiDocument = import('../ts-interfaces/ember-data-json-api').JsonApiDocument;
|
|
83
|
-
type ExistingResourceObject = import('../ts-interfaces/ember-data-json-api').ExistingResourceObject;
|
|
84
|
-
type RecordIdentifier = import('../ts-interfaces/identifier').RecordIdentifier;
|
|
85
|
-
type StableRecordIdentifier = import('../ts-interfaces/identifier').StableRecordIdentifier;
|
|
86
|
-
type StableExistingRecordIdentifier = import('../ts-interfaces/identifier').StableExistingRecordIdentifier;
|
|
87
|
-
type RecordInstance = import('../ts-interfaces/record-instance').RecordInstance;
|
|
88
|
-
type RecordData = import('../ts-interfaces/record-data').RecordData;
|
|
89
|
-
type DSModel = import('../ts-interfaces/ds-model').DSModel;
|
|
90
|
-
type PromiseProxy<T> = import('../ts-interfaces/promise-proxies').PromiseProxy<T>;
|
|
91
|
-
type Dict<T> = import('../ts-interfaces/utils').Dict<T>;
|
|
92
|
-
type RecordDataRecordWrapper = import('../ts-interfaces/record-data-record-wrapper').RecordDataRecordWrapper;
|
|
93
|
-
type AttributesSchema = import('../ts-interfaces/record-data-schemas').AttributesSchema;
|
|
94
|
-
type SchemaDefinitionService = import('../ts-interfaces/schema-definition-service').SchemaDefinitionService;
|
|
95
|
-
type PrivateSnapshot = import('./snapshot').PrivateSnapshot;
|
|
96
|
-
type RecordDataClass = typeof import('@ember-data/record-data/-private').RecordData;
|
|
97
|
-
type RequestCache = import('./request-cache').default;
|
|
98
|
-
type FindOptions = import('../ts-interfaces/store').FindOptions;
|
|
99
|
-
|
|
100
|
-
let _RecordData: RecordDataClass | undefined;
|
|
104
|
+
type RecordDataConstruct = typeof RecordDataClass;
|
|
105
|
+
let _RecordData: RecordDataConstruct | undefined;
|
|
101
106
|
|
|
102
107
|
const { ENV } = Ember;
|
|
103
108
|
type AsyncTrackingToken = Readonly<{ label: string; trace: Error | string }>;
|
|
@@ -714,10 +719,27 @@ abstract class CoreStore extends Service {
|
|
|
714
719
|
}
|
|
715
720
|
this._backburner.join(() => {
|
|
716
721
|
if (CUSTOM_MODEL_CLASS) {
|
|
717
|
-
let identifier =
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
internalModel
|
|
722
|
+
let identifier = peekRecordIdentifier(record);
|
|
723
|
+
if (identifier) {
|
|
724
|
+
let internalModel = internalModelFactoryFor(this).peek(identifier);
|
|
725
|
+
if (internalModel) {
|
|
726
|
+
internalModel.deleteRecord();
|
|
727
|
+
}
|
|
728
|
+
} else {
|
|
729
|
+
deprecate(
|
|
730
|
+
`You passed a non ember-data managed record ${record} to store.deleteRecord. Ember Data store is not meant to manage non store records. This is not supported and will be removed`,
|
|
731
|
+
false,
|
|
732
|
+
{
|
|
733
|
+
id: 'ember-data:delete-record-non-store',
|
|
734
|
+
until: '4.0',
|
|
735
|
+
for: '@ember-data/store',
|
|
736
|
+
since: {
|
|
737
|
+
available: '3.28',
|
|
738
|
+
enabled: '3.28',
|
|
739
|
+
},
|
|
740
|
+
}
|
|
741
|
+
);
|
|
742
|
+
record.deleteRecord();
|
|
721
743
|
}
|
|
722
744
|
} else {
|
|
723
745
|
record.deleteRecord();
|
|
@@ -746,10 +768,27 @@ abstract class CoreStore extends Service {
|
|
|
746
768
|
assertDestroyingStore(this, 'unloadRecord');
|
|
747
769
|
}
|
|
748
770
|
if (CUSTOM_MODEL_CLASS) {
|
|
749
|
-
let identifier =
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
internalModel
|
|
771
|
+
let identifier = peekRecordIdentifier(record);
|
|
772
|
+
if (identifier) {
|
|
773
|
+
let internalModel = internalModelFactoryFor(this).peek(identifier);
|
|
774
|
+
if (internalModel) {
|
|
775
|
+
internalModel.unloadRecord();
|
|
776
|
+
}
|
|
777
|
+
} else {
|
|
778
|
+
deprecate(
|
|
779
|
+
`You passed a non ember-data managed record ${record} to store.unloadRecord. Ember Data store is not meant to manage non store records. This is not supported and will be removed`,
|
|
780
|
+
false,
|
|
781
|
+
{
|
|
782
|
+
id: 'ember-data:unload-record-non-store',
|
|
783
|
+
until: '4.0',
|
|
784
|
+
for: '@ember-data/store',
|
|
785
|
+
since: {
|
|
786
|
+
available: '3.28',
|
|
787
|
+
enabled: '3.28',
|
|
788
|
+
},
|
|
789
|
+
}
|
|
790
|
+
);
|
|
791
|
+
record.unloadRecord();
|
|
753
792
|
}
|
|
754
793
|
} else {
|
|
755
794
|
record.unloadRecord();
|
|
@@ -1268,6 +1307,10 @@ abstract class CoreStore extends Service {
|
|
|
1268
1307
|
}
|
|
1269
1308
|
} else {
|
|
1270
1309
|
if (internalModel.currentState.isLoading) {
|
|
1310
|
+
let pending = this._fetchManager.getPendingFetch(internalModel.identifier);
|
|
1311
|
+
if (pending) {
|
|
1312
|
+
return pending.then(() => Promise.resolve(internalModel));
|
|
1313
|
+
}
|
|
1271
1314
|
return this._scheduleFetch(internalModel, options);
|
|
1272
1315
|
}
|
|
1273
1316
|
}
|
|
@@ -2012,13 +2055,9 @@ abstract class CoreStore extends Service {
|
|
|
2012
2055
|
if (internalModel) {
|
|
2013
2056
|
// short circuit if we are already loading
|
|
2014
2057
|
if (REQUEST_SERVICE) {
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
.
|
|
2018
|
-
.filter((req) => req.type === 'query');
|
|
2019
|
-
|
|
2020
|
-
if (pendingRequests.length > 0) {
|
|
2021
|
-
return pendingRequests[0][RequestPromise].then(() => internalModel.getRecord());
|
|
2058
|
+
let pendingRequest = this._fetchManager.getPendingFetch(internalModel.identifier);
|
|
2059
|
+
if (pendingRequest) {
|
|
2060
|
+
return pendingRequest.then(() => internalModel.getRecord());
|
|
2022
2061
|
}
|
|
2023
2062
|
} else {
|
|
2024
2063
|
if (internalModel.currentState.isLoading) {
|
|
@@ -3387,7 +3426,7 @@ abstract class CoreStore extends Service {
|
|
|
3387
3426
|
// it can be reproduced in partner tests by running
|
|
3388
3427
|
// node ./scripts/packages-for-commit.js && yarn test-external:ember-observer
|
|
3389
3428
|
if (_RecordData === undefined) {
|
|
3390
|
-
_RecordData = require('@ember-data/record-data/-private').RecordData as
|
|
3429
|
+
_RecordData = require('@ember-data/record-data/-private').RecordData as RecordDataConstruct;
|
|
3391
3430
|
}
|
|
3392
3431
|
|
|
3393
3432
|
let identifier = identifierCacheFor(this).getOrCreateRecordIdentifier({
|
|
@@ -7,21 +7,20 @@ import { isPresent } from '@ember/utils';
|
|
|
7
7
|
import { DEBUG } from '@glimmer/env';
|
|
8
8
|
|
|
9
9
|
import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
|
|
10
|
+
import type DSModelClass from '@ember-data/model';
|
|
10
11
|
|
|
12
|
+
import type { DSModel } from '../ts-interfaces/ds-model';
|
|
13
|
+
import type { StableRecordIdentifier } from '../ts-interfaces/identifier';
|
|
14
|
+
import type { RecordDataRecordWrapper } from '../ts-interfaces/record-data-record-wrapper';
|
|
15
|
+
import type { RelationshipsSchema } from '../ts-interfaces/record-data-schemas';
|
|
16
|
+
import type { SchemaDefinitionService } from '../ts-interfaces/schema-definition-service';
|
|
11
17
|
import CoreStore from './core-store';
|
|
18
|
+
import type ShimModelClass from './model/shim-model-class';
|
|
12
19
|
import { getShimClass } from './model/shim-model-class';
|
|
13
20
|
import normalizeModelName from './normalize-model-name';
|
|
21
|
+
import type NotificationManager from './record-notification-manager';
|
|
14
22
|
import { DSModelSchemaDefinitionService, getModelFactory } from './schema-definition-service';
|
|
15
23
|
|
|
16
|
-
type RelationshipsSchema = import('../ts-interfaces/record-data-schemas').RelationshipsSchema;
|
|
17
|
-
type SchemaDefinitionService = import('../ts-interfaces/schema-definition-service').SchemaDefinitionService;
|
|
18
|
-
type RecordDataRecordWrapper = import('../ts-interfaces/record-data-record-wrapper').RecordDataRecordWrapper;
|
|
19
|
-
type StableRecordIdentifier = import('../ts-interfaces/identifier').StableRecordIdentifier;
|
|
20
|
-
type NotificationManager = import('./record-notification-manager').default;
|
|
21
|
-
type DSModel = import('../ts-interfaces/ds-model').DSModel;
|
|
22
|
-
type ShimModelClass = import('./model/shim-model-class').default;
|
|
23
|
-
type DSModelClass = import('@ember-data/model').default;
|
|
24
|
-
|
|
25
24
|
class Store extends CoreStore {
|
|
26
25
|
public _modelFactoryCache = Object.create(null);
|
|
27
26
|
private _relationshipsDefCache = Object.create(null);
|
|
@@ -8,25 +8,20 @@ import { DEBUG } from '@glimmer/env';
|
|
|
8
8
|
|
|
9
9
|
import { default as RSVP, Promise } from 'rsvp';
|
|
10
10
|
|
|
11
|
+
import type { CollectionResourceDocument, SingleResourceDocument } from '../ts-interfaces/ember-data-json-api';
|
|
12
|
+
import type { FindRecordQuery, Request, SaveRecordMutation } from '../ts-interfaces/fetch-manager';
|
|
13
|
+
import type { ExistingRecordIdentifier, RecordIdentifier, StableRecordIdentifier } from '../ts-interfaces/identifier';
|
|
14
|
+
import type { Dict } from '../ts-interfaces/utils';
|
|
11
15
|
import { symbol } from '../utils/symbol';
|
|
12
16
|
import coerceId from './coerce-id';
|
|
17
|
+
import type CoreStore from './core-store';
|
|
13
18
|
import { errorsArrayToHash } from './errors-utils';
|
|
14
|
-
import RequestCache from './request-cache';
|
|
19
|
+
import RequestCache, { RequestPromise } from './request-cache';
|
|
20
|
+
import type { PrivateSnapshot } from './snapshot';
|
|
15
21
|
import Snapshot from './snapshot';
|
|
16
22
|
import { _bind, _guard, _objectIsAlive, guardDestroyedStore } from './store/common';
|
|
17
23
|
import { normalizeResponseHelper } from './store/serializer-response';
|
|
18
24
|
|
|
19
|
-
type CoreStore = import('./core-store').default;
|
|
20
|
-
type FindRecordQuery = import('../ts-interfaces/fetch-manager').FindRecordQuery;
|
|
21
|
-
type SaveRecordMutation = import('../ts-interfaces/fetch-manager').SaveRecordMutation;
|
|
22
|
-
type Request = import('../ts-interfaces/fetch-manager').Request;
|
|
23
|
-
type CollectionResourceDocument = import('../ts-interfaces/ember-data-json-api').CollectionResourceDocument;
|
|
24
|
-
type SingleResourceDocument = import('../ts-interfaces/ember-data-json-api').SingleResourceDocument;
|
|
25
|
-
type RecordIdentifier = import('../ts-interfaces/identifier').RecordIdentifier;
|
|
26
|
-
type ExistingRecordIdentifier = import('../ts-interfaces/identifier').ExistingRecordIdentifier;
|
|
27
|
-
type Dict<T> = import('../ts-interfaces/utils').Dict<T>;
|
|
28
|
-
type PrivateSnapshot = import('./snapshot').PrivateSnapshot;
|
|
29
|
-
|
|
30
25
|
function payloadIsNotBlank(adapterPayload): boolean {
|
|
31
26
|
if (Array.isArray(adapterPayload)) {
|
|
32
27
|
return true;
|
|
@@ -507,6 +502,16 @@ export default class FetchManager {
|
|
|
507
502
|
}
|
|
508
503
|
}
|
|
509
504
|
|
|
505
|
+
getPendingFetch(identifier: StableRecordIdentifier) {
|
|
506
|
+
let pendingRequests = this.requestCache
|
|
507
|
+
.getPendingRequestsForRecord(identifier)
|
|
508
|
+
.filter((req) => req.type === 'query');
|
|
509
|
+
|
|
510
|
+
if (pendingRequests.length > 0) {
|
|
511
|
+
return pendingRequests[0][RequestPromise];
|
|
512
|
+
}
|
|
513
|
+
}
|
|
514
|
+
|
|
510
515
|
flushAllPendingFetches() {
|
|
511
516
|
if (this.isDestroyed) {
|
|
512
517
|
return;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { assert } from '@ember/debug';
|
|
2
2
|
|
|
3
|
+
import type { StableRecordIdentifier } from '../ts-interfaces/identifier';
|
|
4
|
+
import type { ConfidentDict } from '../ts-interfaces/utils';
|
|
3
5
|
import InternalModel from './model/internal-model';
|
|
4
6
|
|
|
5
|
-
type StableRecordIdentifier = import('../ts-interfaces/identifier').StableRecordIdentifier;
|
|
6
|
-
|
|
7
|
-
type ConfidentDict<T> = import('../ts-interfaces/utils').ConfidentDict<T>;
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
@module @ember-data/store
|
|
11
9
|
*/
|
|
@@ -17,9 +17,23 @@ import {
|
|
|
17
17
|
REQUEST_SERVICE,
|
|
18
18
|
} from '@ember-data/canary-features';
|
|
19
19
|
import { HAS_MODEL_PACKAGE, HAS_RECORD_DATA_PACKAGE } from '@ember-data/private-build-infra';
|
|
20
|
+
import type {
|
|
21
|
+
BelongsToRelationship,
|
|
22
|
+
ManyRelationship,
|
|
23
|
+
RecordData as DefaultRecordData,
|
|
24
|
+
} from '@ember-data/record-data/-private';
|
|
25
|
+
import type { UpgradedMeta } from '@ember-data/record-data/-private/graph/-edge-definition';
|
|
20
26
|
|
|
21
27
|
import { identifierCacheFor } from '../../identifiers/cache';
|
|
28
|
+
import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
|
|
29
|
+
import type { RecordData } from '../../ts-interfaces/record-data';
|
|
30
|
+
import type { JsonApiResource, JsonApiValidationError } from '../../ts-interfaces/record-data-json-api';
|
|
31
|
+
import type { RecordInstance } from '../../ts-interfaces/record-instance';
|
|
32
|
+
import type { FindOptions } from '../../ts-interfaces/store';
|
|
33
|
+
import type { ConfidentDict } from '../../ts-interfaces/utils';
|
|
22
34
|
import coerceId from '../coerce-id';
|
|
35
|
+
import type CoreStore from '../core-store';
|
|
36
|
+
import type Store from '../ds-model-store';
|
|
23
37
|
import { errorsHashToArray } from '../errors-utils';
|
|
24
38
|
import { recordArraysForIdentifier } from '../record-array-manager';
|
|
25
39
|
import recordDataFor from '../record-data-for';
|
|
@@ -28,22 +42,6 @@ import Snapshot from '../snapshot';
|
|
|
28
42
|
import { internalModelFactoryFor, setRecordIdentifier } from '../store/internal-model-factory';
|
|
29
43
|
import RootState from './states';
|
|
30
44
|
|
|
31
|
-
type BelongsToRelationship = import('@ember-data/record-data/-private').BelongsToRelationship;
|
|
32
|
-
type ManyRelationship = import('@ember-data/record-data/-private').ManyRelationship;
|
|
33
|
-
|
|
34
|
-
type UpgradedMeta = import('@ember-data/record-data/-private/graph/-edge-definition').UpgradedMeta;
|
|
35
|
-
|
|
36
|
-
type CoreStore = import('../core-store').default;
|
|
37
|
-
type StableRecordIdentifier = import('../../ts-interfaces/identifier').StableRecordIdentifier;
|
|
38
|
-
type ConfidentDict<T> = import('../../ts-interfaces/utils').ConfidentDict<T>;
|
|
39
|
-
type RecordInstance = import('../../ts-interfaces/record-instance').RecordInstance;
|
|
40
|
-
type JsonApiResource = import('../../ts-interfaces/record-data-json-api').JsonApiResource;
|
|
41
|
-
type JsonApiValidationError = import('../../ts-interfaces/record-data-json-api').JsonApiValidationError;
|
|
42
|
-
type RecordData = import('../../ts-interfaces/record-data').RecordData;
|
|
43
|
-
type FindOptions = import('../../ts-interfaces/store').FindOptions;
|
|
44
|
-
type Store = import('../ds-model-store').default;
|
|
45
|
-
type DefaultRecordData = import('@ember-data/record-data/-private').RecordData;
|
|
46
|
-
|
|
47
45
|
// move to TS hacks module that we can delete when this is no longer a necessary recast
|
|
48
46
|
type ManyArray = InstanceType<typeof import('@ember-data/model/-private').ManyArray>;
|
|
49
47
|
type PromiseBelongsTo = InstanceType<typeof import('@ember-data/model/-private').PromiseBelongsTo>;
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { ModelSchema } from '../../ts-interfaces/ds-model';
|
|
2
|
-
|
|
3
|
-
type Dict
|
|
4
|
-
type
|
|
5
|
-
type AttributeSchema = import('../../ts-interfaces/record-data-schemas').AttributeSchema;
|
|
6
|
-
type CoreStore = import('../core-store').default;
|
|
2
|
+
import type { AttributeSchema, RelationshipSchema } from '../../ts-interfaces/record-data-schemas';
|
|
3
|
+
import type { Dict } from '../../ts-interfaces/utils';
|
|
4
|
+
import type CoreStore from '../core-store';
|
|
7
5
|
|
|
8
6
|
const AvailableShims = new WeakMap<CoreStore, Dict<ShimModelClass>>();
|
|
9
7
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { assert } from '@ember/debug';
|
|
2
2
|
|
|
3
|
-
type StableRecordIdentifier
|
|
4
|
-
type RecordData
|
|
3
|
+
import type { StableRecordIdentifier } from '../ts-interfaces/identifier';
|
|
4
|
+
import type { RecordData } from '../ts-interfaces/record-data';
|
|
5
|
+
|
|
5
6
|
/*
|
|
6
7
|
* Returns the RecordData instance associated with a given
|
|
7
8
|
* Model or InternalModel.
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { identifierCacheFor } from '../identifiers/cache';
|
|
2
|
-
|
|
3
|
-
type CoreStore
|
|
4
|
-
type RecordIdentifier = import('../ts-interfaces/identifier').RecordIdentifier;
|
|
5
|
-
type StableRecordIdentifier = import('../ts-interfaces/identifier').StableRecordIdentifier;
|
|
2
|
+
import type { RecordIdentifier, StableRecordIdentifier } from '../ts-interfaces/identifier';
|
|
3
|
+
import type CoreStore from './core-store';
|
|
6
4
|
|
|
7
5
|
type UnsubscribeToken = Object;
|
|
8
6
|
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import RSVP, { resolve } from 'rsvp';
|
|
2
2
|
|
|
3
|
+
import type { SingleResourceDocument } from '../../ts-interfaces/ember-data-json-api';
|
|
4
|
+
import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
|
|
5
|
+
import type { RecordInstance } from '../../ts-interfaces/record-instance';
|
|
3
6
|
import Reference, { internalModelForReference, REFERENCE_CACHE } from './reference';
|
|
4
7
|
|
|
5
|
-
type SingleResourceDocument = import('../../ts-interfaces/ember-data-json-api').SingleResourceDocument;
|
|
6
|
-
type RecordInstance = import('../../ts-interfaces/record-instance').RecordInstance;
|
|
7
|
-
type StableRecordIdentifier = import('../../ts-interfaces/identifier').StableRecordIdentifier;
|
|
8
|
-
|
|
9
8
|
/**
|
|
10
9
|
@module @ember-data/store
|
|
11
10
|
*/
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
2
|
|
|
3
|
+
import type { Object as JSONObject, Value as JSONValue } from 'json-typescript';
|
|
4
|
+
|
|
3
5
|
import { DEPRECATE_REFERENCE_INTERNAL_MODEL } from '@ember-data/private-build-infra/deprecations';
|
|
4
6
|
|
|
7
|
+
import type { LinkObject, PaginationLinks } from '../../ts-interfaces/ember-data-json-api';
|
|
8
|
+
import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
|
|
9
|
+
import type { JsonApiRelationship } from '../../ts-interfaces/record-data-json-api';
|
|
10
|
+
import type { Dict } from '../../ts-interfaces/utils';
|
|
11
|
+
import type CoreStore from '../core-store';
|
|
12
|
+
import type InternalModel from '../model/internal-model';
|
|
5
13
|
import { internalModelFactoryFor } from '../store/internal-model-factory';
|
|
6
14
|
|
|
7
|
-
type Dict<T> = import('../../ts-interfaces/utils').Dict<T>;
|
|
8
|
-
type JsonApiRelationship = import('../../ts-interfaces/record-data-json-api').JsonApiRelationship;
|
|
9
|
-
type PaginationLinks = import('../../ts-interfaces/ember-data-json-api').PaginationLinks;
|
|
10
|
-
type LinkObject = import('../../ts-interfaces/ember-data-json-api').LinkObject;
|
|
11
|
-
type CoreStore = import('../core-store').default;
|
|
12
|
-
type JSONObject = import('json-typescript').Object;
|
|
13
|
-
type JSONValue = import('json-typescript').Value;
|
|
14
|
-
type InternalModel = import('../model/internal-model').default;
|
|
15
|
-
type StableRecordIdentifier = import('../../ts-interfaces/identifier').StableRecordIdentifier;
|
|
16
|
-
|
|
17
15
|
/**
|
|
18
16
|
@module @ember-data/store
|
|
19
17
|
*/
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
FindRecordQuery,
|
|
3
|
+
Operation,
|
|
4
|
+
Request,
|
|
5
|
+
RequestState,
|
|
6
|
+
SaveRecordMutation,
|
|
7
|
+
} from '../ts-interfaces/fetch-manager';
|
|
1
8
|
import { RequestStateEnum } from '../ts-interfaces/fetch-manager';
|
|
9
|
+
import type { RecordIdentifier } from '../ts-interfaces/identifier';
|
|
2
10
|
import { addSymbol, symbol } from '../utils/symbol';
|
|
3
11
|
|
|
4
|
-
type FindRecordQuery = import('../ts-interfaces/fetch-manager').FindRecordQuery;
|
|
5
|
-
type SaveRecordMutation = import('../ts-interfaces/fetch-manager').SaveRecordMutation;
|
|
6
|
-
type Request = import('../ts-interfaces/fetch-manager').Request;
|
|
7
|
-
type RequestState = import('../ts-interfaces/fetch-manager').RequestState;
|
|
8
|
-
type Operation = import('../ts-interfaces/fetch-manager').Operation;
|
|
9
|
-
type RecordIdentifier = import('../ts-interfaces/identifier').RecordIdentifier;
|
|
10
|
-
|
|
11
12
|
const Touching: unique symbol = symbol('touching');
|
|
12
13
|
export const RequestPromise: unique symbol = symbol('promise');
|
|
13
14
|
|
|
@@ -3,16 +3,14 @@ import { get } from '@ember/object';
|
|
|
3
3
|
|
|
4
4
|
import require from 'require';
|
|
5
5
|
|
|
6
|
+
import type Model from '@ember-data/model';
|
|
6
7
|
import { HAS_MODEL_PACKAGE } from '@ember-data/private-build-infra';
|
|
7
8
|
|
|
9
|
+
import type { RecordIdentifier } from '../ts-interfaces/identifier';
|
|
10
|
+
import type { AttributesSchema, RelationshipsSchema } from '../ts-interfaces/record-data-schemas';
|
|
11
|
+
import type Store from './ds-model-store';
|
|
8
12
|
import normalizeModelName from './normalize-model-name';
|
|
9
13
|
|
|
10
|
-
type RelationshipsSchema = import('../ts-interfaces/record-data-schemas').RelationshipsSchema;
|
|
11
|
-
type AttributesSchema = import('../ts-interfaces/record-data-schemas').AttributesSchema;
|
|
12
|
-
type RecordIdentifier = import('../ts-interfaces/identifier').RecordIdentifier;
|
|
13
|
-
type Store = import('./ds-model-store').default;
|
|
14
|
-
|
|
15
|
-
type Model = import('@ember-data/model').default;
|
|
16
14
|
type ModelForMixin = (store: Store, normalizedModelName: string) => Model | null;
|
|
17
15
|
|
|
18
16
|
let _modelForMixin: ModelForMixin;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
type Dict<T> = import('../ts-interfaces/utils').Dict<T>;
|
|
2
1
|
/**
|
|
3
2
|
@module @ember-data/store
|
|
4
3
|
*/
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
type
|
|
4
|
+
|
|
5
|
+
import type { ModelSchema } from '../ts-interfaces/ds-model';
|
|
6
|
+
import type { Dict } from '../ts-interfaces/utils';
|
|
7
|
+
import type RecordArray from './record-arrays/record-array';
|
|
8
|
+
import type Snapshot from './snapshot';
|
|
8
9
|
/**
|
|
9
10
|
SnapshotRecordArray is not directly instantiable.
|
|
10
11
|
Instances are provided to consuming application's
|
|
@@ -8,20 +8,17 @@ import { assign } from '@ember/polyfills';
|
|
|
8
8
|
import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
|
|
9
9
|
import { HAS_RECORD_DATA_PACKAGE } from '@ember-data/private-build-infra';
|
|
10
10
|
|
|
11
|
+
import type { DSModel, DSModelSchema, ModelSchema } from '../ts-interfaces/ds-model';
|
|
12
|
+
import type { StableRecordIdentifier } from '../ts-interfaces/identifier';
|
|
13
|
+
import type { ChangedAttributesHash } from '../ts-interfaces/record-data';
|
|
14
|
+
import type { AttributeSchema, RelationshipSchema } from '../ts-interfaces/record-data-schemas';
|
|
15
|
+
import type { RecordInstance } from '../ts-interfaces/record-instance';
|
|
16
|
+
import type { FindOptions } from '../ts-interfaces/store';
|
|
17
|
+
import type { Dict } from '../ts-interfaces/utils';
|
|
18
|
+
import type Store from './core-store';
|
|
19
|
+
import type InternalModel from './model/internal-model';
|
|
11
20
|
import recordDataFor from './record-data-for';
|
|
12
21
|
|
|
13
|
-
type InternalModel = import('./model/internal-model').default;
|
|
14
|
-
type Dict<T> = import('../ts-interfaces/utils').Dict<T>;
|
|
15
|
-
type StableRecordIdentifier = import('../ts-interfaces/identifier').StableRecordIdentifier;
|
|
16
|
-
type ChangedAttributesHash = import('../ts-interfaces/record-data').ChangedAttributesHash;
|
|
17
|
-
type RecordInstance = import('../ts-interfaces/record-instance').RecordInstance;
|
|
18
|
-
type DSModel = import('../ts-interfaces/ds-model').DSModel;
|
|
19
|
-
type DSModelSchema = import('../ts-interfaces/ds-model').DSModelSchema;
|
|
20
|
-
type ModelSchema = import('../ts-interfaces/ds-model').ModelSchema;
|
|
21
|
-
type AttributeSchema = import('../ts-interfaces/record-data-schemas').AttributeSchema;
|
|
22
|
-
type RelationshipSchema = import('../ts-interfaces/record-data-schemas').RelationshipSchema;
|
|
23
|
-
type Store = import('./core-store').default;
|
|
24
|
-
type FindOptions = import('../ts-interfaces/store').FindOptions;
|
|
25
22
|
type RecordId = string | null;
|
|
26
23
|
|
|
27
24
|
function schemaIsDSModel(schema: ModelSchema | DSModelSchema): schema is DSModelSchema {
|
|
@@ -2,20 +2,21 @@ import { assert, warn } from '@ember/debug';
|
|
|
2
2
|
import { isNone } from '@ember/utils';
|
|
3
3
|
import { DEBUG } from '@glimmer/env';
|
|
4
4
|
|
|
5
|
+
import type { IdentifierCache } from '../../identifiers/cache';
|
|
5
6
|
import { identifierCacheFor } from '../../identifiers/cache';
|
|
7
|
+
import type {
|
|
8
|
+
ExistingResourceObject,
|
|
9
|
+
NewResourceIdentifierObject,
|
|
10
|
+
ResourceIdentifierObject,
|
|
11
|
+
} from '../../ts-interfaces/ember-data-json-api';
|
|
12
|
+
import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
|
|
13
|
+
import type { RecordInstance } from '../../ts-interfaces/record-instance';
|
|
6
14
|
import constructResource from '../../utils/construct-resource';
|
|
15
|
+
import type CoreStore from '../core-store';
|
|
7
16
|
import IdentityMap from '../identity-map';
|
|
17
|
+
import type InternalModelMap from '../internal-model-map';
|
|
8
18
|
import InternalModel from '../model/internal-model';
|
|
9
19
|
|
|
10
|
-
type CoreStore = import('../core-store').default;
|
|
11
|
-
type ResourceIdentifierObject = import('../../ts-interfaces/ember-data-json-api').ResourceIdentifierObject;
|
|
12
|
-
type ExistingResourceObject = import('../../ts-interfaces/ember-data-json-api').ExistingResourceObject;
|
|
13
|
-
type NewResourceIdentifierObject = import('../../ts-interfaces/ember-data-json-api').NewResourceIdentifierObject;
|
|
14
|
-
type RecordInstance = import('../../ts-interfaces/record-instance').RecordInstance;
|
|
15
|
-
type InternalModelMap = import('../internal-model-map').default;
|
|
16
|
-
type StableRecordIdentifier = import('../../ts-interfaces/identifier').StableRecordIdentifier;
|
|
17
|
-
type IdentifierCache = import('../../identifiers/cache').IdentifierCache;
|
|
18
|
-
|
|
19
20
|
/**
|
|
20
21
|
@module @ember-data/store
|
|
21
22
|
*/
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
import { CUSTOM_MODEL_CLASS } from '@ember-data/canary-features';
|
|
2
|
+
import type { RelationshipDefinition } from '@ember-data/model/-private/system/relationships/relationship-meta';
|
|
2
3
|
import { HAS_RECORD_DATA_PACKAGE } from '@ember-data/private-build-infra';
|
|
3
4
|
|
|
5
|
+
import type { IdentifierCache } from '../../identifiers/cache';
|
|
4
6
|
import { identifierCacheFor } from '../../identifiers/cache';
|
|
7
|
+
import type { StableRecordIdentifier } from '../../ts-interfaces/identifier';
|
|
8
|
+
import type { RecordData } from '../../ts-interfaces/record-data';
|
|
9
|
+
import type {
|
|
10
|
+
AttributesSchema,
|
|
11
|
+
RelationshipSchema,
|
|
12
|
+
RelationshipsSchema,
|
|
13
|
+
} from '../../ts-interfaces/record-data-schemas';
|
|
14
|
+
import type { RecordDataStoreWrapper as StoreWrapper } from '../../ts-interfaces/record-data-store-wrapper';
|
|
5
15
|
import constructResource from '../../utils/construct-resource';
|
|
16
|
+
import type CoreStore from '../core-store';
|
|
6
17
|
import { internalModelFactoryFor } from './internal-model-factory';
|
|
7
18
|
|
|
8
|
-
type StoreWrapper = import('../../ts-interfaces/record-data-store-wrapper').RecordDataStoreWrapper;
|
|
9
|
-
type StableRecordIdentifier = import('../../ts-interfaces/identifier').StableRecordIdentifier;
|
|
10
|
-
type CoreStore = import('../core-store').default;
|
|
11
|
-
type IdentifierCache = import('../../identifiers/cache').IdentifierCache;
|
|
12
|
-
type RecordData = import('../../ts-interfaces/record-data').RecordData;
|
|
13
|
-
type AttributesSchema = import('../../ts-interfaces/record-data-schemas').AttributesSchema;
|
|
14
|
-
type RelationshipsSchema = import('../../ts-interfaces/record-data-schemas').RelationshipsSchema;
|
|
15
|
-
type RelationshipSchema = import('../../ts-interfaces/record-data-schemas').RelationshipSchema;
|
|
16
|
-
type RelationshipDefinition =
|
|
17
|
-
import('@ember-data/model/-private/system/relationships/relationship-meta').RelationshipDefinition;
|
|
18
19
|
/**
|
|
19
20
|
@module @ember-data/store
|
|
20
21
|
*/
|
|
@@ -2,12 +2,10 @@ import EmberObject from '@ember/object';
|
|
|
2
2
|
|
|
3
3
|
import RSVP from 'rsvp';
|
|
4
4
|
|
|
5
|
+
import type { JsonApiValidationError } from './record-data-json-api';
|
|
6
|
+
import type { AttributeSchema, RelationshipSchema } from './record-data-schemas';
|
|
5
7
|
import { RecordInstance } from './record-instance';
|
|
6
8
|
|
|
7
|
-
type RelationshipSchema = import('./record-data-schemas').RelationshipSchema;
|
|
8
|
-
type AttributeSchema = import('./record-data-schemas').AttributeSchema;
|
|
9
|
-
type JsonApiValidationError = import('./record-data-json-api').JsonApiValidationError;
|
|
10
|
-
|
|
11
9
|
// Placeholder until model.js is typed
|
|
12
10
|
export interface DSModel extends RecordInstance, EmberObject {
|
|
13
11
|
toString(): string;
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
@module @ember-data/store
|
|
3
3
|
*/
|
|
4
4
|
import { symbol } from '../utils/symbol';
|
|
5
|
-
|
|
6
|
-
type ExistingResourceObject = import('./ember-data-json-api').ExistingResourceObject;
|
|
7
|
-
type ResourceIdentifierObject = import('./ember-data-json-api').ResourceIdentifierObject;
|
|
5
|
+
import type { ExistingResourceObject, ResourceIdentifierObject } from './ember-data-json-api';
|
|
8
6
|
|
|
9
7
|
export type ResourceData = ResourceIdentifierObject | ExistingResourceObject;
|
|
10
8
|
export type IdentifierBucket = 'record';
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// the above eslint rule checks return types. This is an interface
|
|
3
3
|
// and we intend Promise whether it is Native or polyfilled is of
|
|
4
4
|
// no consequence.
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
type RelationshipSchema
|
|
5
|
+
|
|
6
|
+
import type Store from '../system/core-store';
|
|
7
|
+
import type AdapterPopulatedRecordArray from '../system/record-arrays/adapter-populated-record-array';
|
|
8
|
+
import type Snapshot from '../system/snapshot';
|
|
9
|
+
import type SnapshotRecordArray from '../system/snapshot-record-array';
|
|
10
|
+
import type { ModelSchema } from '../ts-interfaces/ds-model';
|
|
11
|
+
import type { RelationshipSchema } from './record-data-schemas';
|
|
12
|
+
import type { Dict } from './utils';
|
|
12
13
|
|
|
13
14
|
type Group = Snapshot[];
|
|
14
15
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
1
|
+
import type { Object as JSONObject } from 'json-typescript';
|
|
2
|
+
|
|
3
|
+
import type Store from '../system/core-store';
|
|
4
|
+
import type Snapshot from '../system/snapshot';
|
|
5
|
+
import type { ModelSchema } from './ds-model';
|
|
6
|
+
import type { JsonApiDocument, SingleResourceDocument } from './ember-data-json-api';
|
|
7
|
+
import type { Dict } from './utils';
|
|
8
8
|
|
|
9
9
|
type OptionsHash = Dict<any>;
|
|
10
10
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
type
|
|
2
|
-
type
|
|
3
|
-
|
|
1
|
+
import type { CollectionResourceRelationship, SingleResourceRelationship } from './ember-data-json-api';
|
|
2
|
+
import type { Dict } from './utils';
|
|
3
|
+
|
|
4
4
|
/**
|
|
5
5
|
@module @ember-data/store
|
|
6
6
|
*/
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
type
|
|
2
|
-
type RecordIdentifier
|
|
3
|
-
type
|
|
4
|
-
type
|
|
5
|
-
type JsonApiValidationError = import('./record-data-json-api').JsonApiValidationError;
|
|
1
|
+
import type { CollectionResourceRelationship, SingleResourceRelationship } from './ember-data-json-api';
|
|
2
|
+
import type { RecordIdentifier } from './identifier';
|
|
3
|
+
import type { ChangedAttributesHash } from './record-data';
|
|
4
|
+
import type { JsonApiValidationError } from './record-data-json-api';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
@module @ember-data/store
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
type RecordData
|
|
2
|
-
|
|
3
|
-
type RelationshipsSchema = import('./record-data-schemas').RelationshipsSchema;
|
|
4
|
-
type AttributesSchema = import('./record-data-schemas').AttributesSchema;
|
|
1
|
+
import type { RecordData } from './record-data';
|
|
2
|
+
import type { AttributesSchema, RelationshipsSchema } from './record-data-schemas';
|
|
5
3
|
|
|
6
4
|
/**
|
|
7
5
|
@module @ember-data/store
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
type
|
|
2
|
-
type
|
|
3
|
-
type
|
|
4
|
-
type JsonApiResource = import('./record-data-json-api').JsonApiResource;
|
|
5
|
-
type JsonApiValidationError = import('./record-data-json-api').JsonApiValidationError;
|
|
1
|
+
import type { CollectionResourceRelationship, SingleResourceRelationship } from './ember-data-json-api';
|
|
2
|
+
import type { RecordIdentifier } from './identifier';
|
|
3
|
+
import type { JsonApiResource, JsonApiValidationError } from './record-data-json-api';
|
|
6
4
|
|
|
7
5
|
/**
|
|
8
6
|
@module @ember-data/store
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
@module @ember-data/store
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
type
|
|
6
|
-
type RelationshipsSchema
|
|
7
|
-
type RecordIdentifier = import('./identifier').RecordIdentifier;
|
|
5
|
+
import type { RecordIdentifier } from './identifier';
|
|
6
|
+
import type { AttributesSchema, RelationshipsSchema } from './record-data-schemas';
|
|
8
7
|
|
|
9
8
|
export interface SchemaDefinitionService {
|
|
10
9
|
doesTypeExist(modelName: string): boolean;
|
|
@@ -2,11 +2,9 @@ import { assert } from '@ember/debug';
|
|
|
2
2
|
|
|
3
3
|
import isStableIdentifier from '../identifiers/is-stable-identifier';
|
|
4
4
|
import coerceId from '../system/coerce-id';
|
|
5
|
+
import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from '../ts-interfaces/ember-data-json-api';
|
|
5
6
|
import isNonEmptyString from './is-non-empty-string';
|
|
6
7
|
|
|
7
|
-
type ResourceIdentifierObject = import('../ts-interfaces/ember-data-json-api').ResourceIdentifierObject;
|
|
8
|
-
type ExistingResourceIdentifierObject = import('../ts-interfaces/ember-data-json-api').ExistingResourceIdentifierObject;
|
|
9
|
-
|
|
10
8
|
function constructResource(type: ResourceIdentifierObject): ResourceIdentifierObject;
|
|
11
9
|
function constructResource(type: string, id: string, lid: string): ExistingResourceIdentifierObject;
|
|
12
10
|
function constructResource(
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import type InternalModel from '../system/model/internal-model';
|
|
1
2
|
import { promiseObject } from '../system/promise-proxies';
|
|
3
|
+
import type { DSModel } from '../ts-interfaces/ds-model';
|
|
4
|
+
import type { PromiseProxy } from '../ts-interfaces/promise-proxies';
|
|
2
5
|
|
|
3
|
-
type DSModel = import('../ts-interfaces/ds-model').DSModel;
|
|
4
|
-
type PromiseProxy<T> = import('../ts-interfaces/promise-proxies').PromiseProxy<T>;
|
|
5
|
-
type InternalModel = import('../system/model/internal-model').default;
|
|
6
6
|
/**
|
|
7
7
|
@module @ember-data/store
|
|
8
8
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ember-data/store",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-beta.3",
|
|
4
4
|
"description": "The default blueprint for ember-cli addons.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -17,16 +17,16 @@
|
|
|
17
17
|
"start": "ember serve"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@ember-data/canary-features": "
|
|
21
|
-
"@ember-data/private-build-infra": "
|
|
22
|
-
"@ember/string": "^
|
|
20
|
+
"@ember-data/canary-features": "4.0.0-beta.3",
|
|
21
|
+
"@ember-data/private-build-infra": "4.0.0-beta.3",
|
|
22
|
+
"@ember/string": "^3.0.0",
|
|
23
23
|
"@glimmer/tracking": "^1.0.4",
|
|
24
24
|
"ember-cli-babel": "^7.26.6",
|
|
25
25
|
"ember-cli-path-utils": "^1.0.0",
|
|
26
26
|
"ember-cli-typescript": "^4.1.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"@ember-data/unpublished-test-infra": "
|
|
29
|
+
"@ember-data/unpublished-test-infra": "4.0.0-beta.3",
|
|
30
30
|
"@ember/optional-features": "^2.0.0",
|
|
31
31
|
"@ember/test-helpers": "^2.2.5",
|
|
32
32
|
"@types/ember": "^3.16.5",
|