@warp-drive/legacy 5.7.0-alpha.27 → 5.7.0-alpha.28
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/declarations/adapter/-private/utils/continue-on-reject.d.ts +1 -7
- package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +15 -7
- package/declarations/compat/legacy-network-handler/snapshot-record-array.d.ts +40 -18
- package/declarations/compat/legacy-network-handler/snapshot.d.ts +0 -2
- package/declarations/compat.d.ts +3 -3
- package/declarations/model/-private/legacy-relationships-support.d.ts +8 -13
- package/declarations/model/-private/model-methods.d.ts +0 -4
- package/declarations/model/-private/model.d.ts +9 -26
- package/declarations/model/-private/promise-many-array.d.ts +0 -3
- package/declarations/model/-private/record-state.d.ts +2 -25
- package/declarations/model/-private/references/has-many.d.ts +0 -6
- package/declarations/model/migration-support.d.ts +0 -24
- package/declarations/store/-private.d.ts +0 -11
- package/dist/{-private-CVsFOW1k.js → -private-HaYCdCCm.js} +63 -47
- package/dist/adapter/-private.js +1 -1
- package/dist/adapter/json-api.js +1 -1
- package/dist/adapter/rest.js +1 -1
- package/dist/compat/-private.js +1 -1
- package/dist/compat/builders.js +2 -1
- package/dist/compat.js +6 -2
- package/dist/{errors-VSxXZooE.js → errors-BMZPmFxm.js} +16 -3
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +5 -3
- package/dist/model.js +7 -4
- package/dist/{schema-provider-BgBPZFfc.js → schema-provider-Dhk-879f.js} +38 -13
- package/dist/{serialize-into-hash-B59laYa4.js → serialize-into-hash-Ceon-MrI.js} +2 -1
- package/dist/store.js +5 -3
- package/package.json +6 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import { createDeferred } from "@warp-drive/core/request";
|
|
3
|
-
import type { Request
|
|
3
|
+
import type { Request } from "@warp-drive/core/store/-private";
|
|
4
4
|
import type { FindRecordOptions } from "@warp-drive/core/types";
|
|
5
5
|
import type { PersistedResourceKey, ResourceKey } from "@warp-drive/core/types/identifier";
|
|
6
6
|
import type { TypeFromInstance } from "@warp-drive/core/types/record";
|
|
@@ -21,12 +21,10 @@ interface PendingFetchItem {
|
|
|
21
21
|
trace?: unknown;
|
|
22
22
|
promise: Promise<PersistedResourceKey>;
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* @private
|
|
26
|
+
*/
|
|
24
27
|
export declare class FetchManager {
|
|
25
|
-
isDestroyed: boolean;
|
|
26
|
-
requestCache: RequestStateService;
|
|
27
|
-
// fetches pending in the runloop, waiting to be coalesced
|
|
28
|
-
_pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;
|
|
29
|
-
_store: Store;
|
|
30
28
|
constructor(store: Store);
|
|
31
29
|
createSnapshot<T>(identifier: ResourceKey<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;
|
|
32
30
|
createSnapshot(identifier: ResourceKey, options?: FindRecordOptions): Snapshot;
|
|
@@ -36,7 +34,7 @@ export declare class FetchManager {
|
|
|
36
34
|
|
|
37
35
|
It schedules saving to happen at the end of the run loop.
|
|
38
36
|
|
|
39
|
-
@
|
|
37
|
+
@private
|
|
40
38
|
*/
|
|
41
39
|
scheduleSave(identifier: ResourceKey, options: FetchMutationOptions): Promise<null | SingleResourceDocument>;
|
|
42
40
|
scheduleFetch(identifier: PersistedResourceKey, options: FindRecordOptions, request: ImmutableRequestInfo): Promise<PersistedResourceKey>;
|
|
@@ -45,4 +43,14 @@ export declare class FetchManager {
|
|
|
45
43
|
fetchDataIfNeededForIdentifier(identifier: PersistedResourceKey, options: FindRecordOptions | undefined, request: ImmutableRequestInfo): Promise<PersistedResourceKey>;
|
|
46
44
|
destroy(): void;
|
|
47
45
|
}
|
|
46
|
+
/**
|
|
47
|
+
* This type exists for internal use only for
|
|
48
|
+
* where intimate contracts still exist either for
|
|
49
|
+
* the Test Suite or for Legacy code.
|
|
50
|
+
*
|
|
51
|
+
* @private
|
|
52
|
+
*/
|
|
53
|
+
export interface PrivateFetchManager extends FetchManager {
|
|
54
|
+
_pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;
|
|
55
|
+
}
|
|
48
56
|
export {};
|
|
@@ -1,21 +1,55 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
|
-
import type {
|
|
3
|
-
import type { FindAllOptions, ModelSchema } from "@warp-drive/core/types";
|
|
2
|
+
import type { FindAllOptions } from "@warp-drive/core/types";
|
|
4
3
|
import type { Snapshot } from "./snapshot.js";
|
|
5
4
|
/**
|
|
6
5
|
SnapshotRecordArray is not directly instantiable.
|
|
7
6
|
Instances are provided to consuming application's
|
|
8
7
|
adapters for certain `findAll` requests.
|
|
9
8
|
|
|
10
|
-
@
|
|
9
|
+
@hideconstructor
|
|
11
10
|
@public
|
|
12
11
|
*/
|
|
13
12
|
export declare class SnapshotRecordArray {
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The ResourceType of the underlying records for the {@link Snapshot | Snapshots} in the array
|
|
15
|
+
*/
|
|
16
16
|
modelName: string;
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A hash of adapter options passed into the store method for this request.
|
|
19
|
+
|
|
20
|
+
Example
|
|
21
|
+
|
|
22
|
+
```js [app/adapters/post.js]
|
|
23
|
+
import MyCustomAdapter from './custom-adapter';
|
|
24
|
+
|
|
25
|
+
export default class PostAdapter extends MyCustomAdapter {
|
|
26
|
+
findAll(store, type, sinceToken, snapshotRecordArray) {
|
|
27
|
+
if (snapshotRecordArray.adapterOptions.subscribe) {
|
|
28
|
+
// ...
|
|
29
|
+
}
|
|
30
|
+
// ...
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
*/
|
|
18
35
|
adapterOptions?: Record<string, unknown>;
|
|
36
|
+
/**
|
|
37
|
+
* The relationships to include for this request.
|
|
38
|
+
|
|
39
|
+
Example
|
|
40
|
+
|
|
41
|
+
```js [app/adapters/application.js]
|
|
42
|
+
import Adapter from '@ember-data/adapter';
|
|
43
|
+
|
|
44
|
+
export default class ApplicationAdapter extends Adapter {
|
|
45
|
+
findAll(store, type, snapshotRecordArray) {
|
|
46
|
+
let url = `/${type.modelName}?include=${encodeURIComponent(snapshotRecordArray.include)}`;
|
|
47
|
+
|
|
48
|
+
return fetch(url).then((response) => response.json())
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
```
|
|
52
|
+
*/
|
|
19
53
|
include?: string | string[];
|
|
20
54
|
/**
|
|
21
55
|
SnapshotRecordArray is not directly instantiable.
|
|
@@ -30,14 +64,6 @@ export declare class SnapshotRecordArray {
|
|
|
30
64
|
*/
|
|
31
65
|
constructor(store: Store, type: string, options?: FindAllOptions);
|
|
32
66
|
/**
|
|
33
|
-
An array of records
|
|
34
|
-
|
|
35
|
-
@property _recordArray
|
|
36
|
-
@private
|
|
37
|
-
@type {Array}
|
|
38
|
-
*/
|
|
39
|
-
get _recordArray(): LegacyLiveArray;
|
|
40
|
-
/**
|
|
41
67
|
Number of records in the array
|
|
42
68
|
|
|
43
69
|
Example
|
|
@@ -51,10 +77,6 @@ export declare class SnapshotRecordArray {
|
|
|
51
77
|
}
|
|
52
78
|
});
|
|
53
79
|
```
|
|
54
|
-
|
|
55
|
-
@property length
|
|
56
|
-
@public
|
|
57
|
-
@type {Number}
|
|
58
80
|
*/
|
|
59
81
|
get length(): number;
|
|
60
82
|
/**
|
package/declarations/compat.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import type { AdapterPayload, MinimumAdapterInterface } from "./compat/legacy-ne
|
|
|
6
6
|
import type { MinimumSerializerInterface, SerializerOptions } from "./compat/legacy-network-handler/minimum-serializer-interface.js";
|
|
7
7
|
export { LegacyNetworkHandler } from "./compat/legacy-network-handler/legacy-network-handler.js";
|
|
8
8
|
export type { MinimumAdapterInterface, MinimumSerializerInterface, SerializerOptions, AdapterPayload };
|
|
9
|
-
export
|
|
9
|
+
export interface LegacyStoreCompat extends Store {
|
|
10
10
|
_fetchManager: FetchManager;
|
|
11
11
|
adapterFor(this: Store, modelName: string): MinimumAdapterInterface;
|
|
12
12
|
adapterFor(this: Store, modelName: string, _allowMissing: true): MinimumAdapterInterface | undefined;
|
|
@@ -20,8 +20,8 @@ export type LegacyStoreCompat = {
|
|
|
20
20
|
_serializerCache: Record<string, MinimumSerializerInterface & {
|
|
21
21
|
store: Store;
|
|
22
22
|
}>;
|
|
23
|
-
}
|
|
24
|
-
export type CompatStore =
|
|
23
|
+
}
|
|
24
|
+
export type CompatStore = LegacyStoreCompat;
|
|
25
25
|
/**
|
|
26
26
|
Returns an instance of the adapter for a given type. For
|
|
27
27
|
example, `adapterFor('person')` will return an instance of
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
|
-
import type { CollectionEdge,
|
|
2
|
+
import type { CollectionEdge, ResourceEdge, UpgradedMeta } from "@warp-drive/core/graph/-private";
|
|
3
3
|
import type { LegacyManyArray } from "@warp-drive/core/store/-private";
|
|
4
4
|
import type { BaseFinderOptions, ResourceKey } from "@warp-drive/core/types";
|
|
5
|
-
import type { Cache } from "@warp-drive/core/types/cache";
|
|
6
5
|
import type { CollectionRelationship } from "@warp-drive/core/types/cache/relationship";
|
|
7
6
|
import type { LocalRelationshipOperation } from "@warp-drive/core/types/graph";
|
|
8
7
|
import type { OpaqueRecordInstance, TypeFromInstanceOrString } from "@warp-drive/core/types/record";
|
|
@@ -17,18 +16,14 @@ import HasManyReference from "./references/has-many.js";
|
|
|
17
16
|
export declare const LEGACY_SUPPORT: Map<ResourceKey | MinimalLegacyRecord, LegacySupport>;
|
|
18
17
|
export declare function lookupLegacySupport(record: MinimalLegacyRecord): LegacySupport;
|
|
19
18
|
export declare class LegacySupport {
|
|
20
|
-
record
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
references: Record<string, BelongsToReference | HasManyReference>;
|
|
19
|
+
private record;
|
|
20
|
+
private graph;
|
|
21
|
+
private cache;
|
|
22
|
+
private references;
|
|
25
23
|
identifier: ResourceKey;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
_pending: Record<string, Promise<ResourceKey | null> | undefined>;
|
|
30
|
-
isDestroying: boolean;
|
|
31
|
-
isDestroyed: boolean;
|
|
24
|
+
private _pending;
|
|
25
|
+
private isDestroying;
|
|
26
|
+
private isDestroyed;
|
|
32
27
|
constructor(record: MinimalLegacyRecord, identifier: ResourceKey);
|
|
33
28
|
_syncArray(array: LegacyManyArray): void;
|
|
34
29
|
mutate(mutation: LocalRelationshipOperation): void;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type { Store } from "@warp-drive/core";
|
|
2
1
|
import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
|
|
3
|
-
import { RecordStore } from "@warp-drive/core/types/symbols";
|
|
4
2
|
import type { Snapshot } from "../../compat/-private.js";
|
|
5
3
|
import type { Errors } from "./errors.js";
|
|
6
4
|
import type RecordState from "./record-state.js";
|
|
@@ -9,13 +7,11 @@ import type HasManyReference from "./references/has-many.js";
|
|
|
9
7
|
import type { MaybeBelongsToFields, MaybeHasManyFields } from "./type-utils.js";
|
|
10
8
|
export interface MinimalLegacyRecord {
|
|
11
9
|
errors: Errors;
|
|
12
|
-
___recordState: RecordState;
|
|
13
10
|
currentState: RecordState;
|
|
14
11
|
isDestroyed: boolean;
|
|
15
12
|
isDestroying: boolean;
|
|
16
13
|
isReloading: boolean;
|
|
17
14
|
isValid: boolean;
|
|
18
|
-
[RecordStore]: Store;
|
|
19
15
|
deleteRecord(): void;
|
|
20
16
|
unloadRecord(): void;
|
|
21
17
|
save<T extends MinimalLegacyRecord>(this: T, options?: Record<string, unknown>): Promise<this>;
|
|
@@ -3,7 +3,6 @@ import type { Store } from "@warp-drive/core";
|
|
|
3
3
|
import type { ModelSchema, ResourceKey } from "@warp-drive/core/types";
|
|
4
4
|
import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
|
|
5
5
|
import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
|
|
6
|
-
import { RecordStore } from "@warp-drive/core/types/symbols";
|
|
7
6
|
import type { Snapshot } from "../../compat/-private.js";
|
|
8
7
|
import { Errors } from "./errors.js";
|
|
9
8
|
import type { MinimalLegacyRecord } from "./model-methods.js";
|
|
@@ -41,14 +40,6 @@ interface Model {
|
|
|
41
40
|
* The store service instance which created this record instance
|
|
42
41
|
*/
|
|
43
42
|
store: Store;
|
|
44
|
-
/** @internal */
|
|
45
|
-
___recordState: RecordState;
|
|
46
|
-
/** @internal */
|
|
47
|
-
___private_notifications: object;
|
|
48
|
-
/** @internal */
|
|
49
|
-
_isReloading: boolean;
|
|
50
|
-
/** @internal */
|
|
51
|
-
[RecordStore]: Store;
|
|
52
43
|
/**
|
|
53
44
|
Create a JSON representation of the record, using the serialization
|
|
54
45
|
strategy of the store's adapter.
|
|
@@ -435,9 +426,7 @@ interface Model {
|
|
|
435
426
|
* @noInheritDoc
|
|
436
427
|
*/
|
|
437
428
|
declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
438
|
-
/** @
|
|
439
|
-
init(options: ModelCreateArgs): void;
|
|
440
|
-
/** @internal */
|
|
429
|
+
/** @private */
|
|
441
430
|
// @ts-expect-error destroy should not return a value, but ember's types force it to
|
|
442
431
|
destroy(): this;
|
|
443
432
|
/**
|
|
@@ -769,8 +758,6 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
769
758
|
*/
|
|
770
759
|
// @ts-expect-error no return is necessary, but Ember's types are forcing it
|
|
771
760
|
notifyPropertyChange(prop: string): this;
|
|
772
|
-
/** @internal */
|
|
773
|
-
attr(): void;
|
|
774
761
|
/**
|
|
775
762
|
Given a callback, iterates over each of the relationships in the model,
|
|
776
763
|
invoking the callback with the name of each relationship and its relationship
|
|
@@ -820,18 +807,14 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
820
807
|
```
|
|
821
808
|
|
|
822
809
|
@public
|
|
823
|
-
@param
|
|
824
|
-
@param
|
|
810
|
+
@param callback the callback to invoke
|
|
811
|
+
@param binding the value to which the callback's `this` should be bound
|
|
825
812
|
*/
|
|
826
813
|
eachRelationship<T>(callback: (this: NoInfer<T> | undefined, key: MaybeRelationshipFields<this>, meta: LegacyRelationshipField) => void, binding?: T): void;
|
|
827
814
|
relationshipFor(name: string): LegacyRelationshipField | undefined;
|
|
828
815
|
inverseFor(name: string): LegacyRelationshipField | null;
|
|
829
816
|
eachAttribute<T>(callback: (this: NoInfer<T> | undefined, key: isSubClass<this> extends true ? MaybeAttrFields<this> : string, meta: LegacyAttributeField) => void, binding?: T): void;
|
|
830
817
|
/**
|
|
831
|
-
* @internal
|
|
832
|
-
*/
|
|
833
|
-
static isModel: boolean;
|
|
834
|
-
/**
|
|
835
818
|
Represents the model's class name as a string. This can be used to look up the model's class name through
|
|
836
819
|
`Store`'s modelFor method.
|
|
837
820
|
|
|
@@ -893,9 +876,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
893
876
|
Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.
|
|
894
877
|
|
|
895
878
|
@public
|
|
896
|
-
@param
|
|
897
|
-
@param
|
|
898
|
-
@return
|
|
879
|
+
@param name the name of the relationship
|
|
880
|
+
@param store an instance of Store
|
|
881
|
+
@return the type of the relationship, or undefined
|
|
899
882
|
*/
|
|
900
883
|
static typeForRelationship(name: string, store: Store): ModelSchema | undefined;
|
|
901
884
|
static get inverseMap(): Record<string, LegacyRelationshipField | null>;
|
|
@@ -926,9 +909,9 @@ declare class Model extends EmberObject implements MinimalLegacyRecord {
|
|
|
926
909
|
```
|
|
927
910
|
|
|
928
911
|
@public
|
|
929
|
-
@param
|
|
930
|
-
@param
|
|
931
|
-
@return
|
|
912
|
+
@param name the name of the relationship
|
|
913
|
+
@param store
|
|
914
|
+
@return the inverse relationship, or null
|
|
932
915
|
*/
|
|
933
916
|
static inverseFor(name: string, store: Store): LegacyRelationshipField | null;
|
|
934
917
|
//Calculate the inverse, ignoring the cache
|
|
@@ -128,8 +128,5 @@ export declare class PromiseManyArray<T = unknown> {
|
|
|
128
128
|
* @public
|
|
129
129
|
*/
|
|
130
130
|
get meta(): Record<string, unknown> | null | undefined;
|
|
131
|
-
//---- Our own stuff
|
|
132
|
-
/** @internal */
|
|
133
|
-
_update(promise: Promise<ManyArray<T>>, content?: ManyArray<T>): void;
|
|
134
131
|
static create<T>({ promise, content }: HasManyProxyCreateArgs<T>): PromiseManyArray<T>;
|
|
135
132
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import type { Store } from "@warp-drive/core";
|
|
2
|
-
import type { RequestCacheRequestState, RequestStateService } from "@warp-drive/core/store/-private";
|
|
3
|
-
import type { Cache } from "@warp-drive/core/types/cache";
|
|
4
|
-
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
5
|
-
import type { Errors } from "./errors.js";
|
|
6
1
|
import type { MinimalLegacyRecord } from "./model-methods.js";
|
|
7
2
|
/**
|
|
8
3
|
Historically EmberData managed a state machine
|
|
@@ -41,29 +36,11 @@ uncommitted
|
|
|
41
36
|
invalid
|
|
42
37
|
inFlight
|
|
43
38
|
|
|
44
|
-
@
|
|
39
|
+
@hideconstructor
|
|
40
|
+
@private
|
|
45
41
|
*/
|
|
46
42
|
export default class RecordState {
|
|
47
|
-
store: Store;
|
|
48
|
-
identifier: ResourceKey;
|
|
49
|
-
record: MinimalLegacyRecord;
|
|
50
|
-
rs: RequestStateService;
|
|
51
|
-
pendingCount: number;
|
|
52
|
-
fulfilledCount: number;
|
|
53
|
-
rejectedCount: number;
|
|
54
|
-
cache: Cache;
|
|
55
|
-
_errorRequests: RequestCacheRequestState[];
|
|
56
|
-
_lastError: RequestCacheRequestState | null;
|
|
57
|
-
handler: object;
|
|
58
43
|
constructor(record: MinimalLegacyRecord);
|
|
59
|
-
/** @internal */
|
|
60
|
-
destroy(): void;
|
|
61
|
-
/** @internal */
|
|
62
|
-
notify(key: keyof this & string): void;
|
|
63
|
-
/** @internal */
|
|
64
|
-
updateInvalidErrors(errors: Errors): void;
|
|
65
|
-
/** @internal */
|
|
66
|
-
cleanErrorRequests(): void;
|
|
67
44
|
isSaving: boolean;
|
|
68
45
|
get isLoading(): boolean;
|
|
69
46
|
get isLoaded(): boolean;
|
|
@@ -73,12 +73,6 @@ export default class HasManyReference<
|
|
|
73
73
|
_ref: number;
|
|
74
74
|
constructor(store: Store, graph: Graph, parentIdentifier: ResourceKey<TypeFromInstanceOrString<T>>, hasManyRelationship: CollectionEdge, key: K);
|
|
75
75
|
/**
|
|
76
|
-
* This method should never be called by user code.
|
|
77
|
-
*
|
|
78
|
-
* @internal
|
|
79
|
-
*/
|
|
80
|
-
destroy(): void;
|
|
81
|
-
/**
|
|
82
76
|
* An array of identifiers for the records that this reference refers to.
|
|
83
77
|
*
|
|
84
78
|
* @property identifiers
|
|
@@ -251,29 +251,5 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
251
251
|
}): null | ProcessedExtension["features"];
|
|
252
252
|
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
253
253
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
254
|
-
/**
|
|
255
|
-
* This is an internal method used to register behaviors for legacy mode.
|
|
256
|
-
* It is not intended for public use.
|
|
257
|
-
*
|
|
258
|
-
* We do think a generalized `kind` registration system would be useful,
|
|
259
|
-
* but we have not yet designed it.
|
|
260
|
-
*
|
|
261
|
-
* See https://github.com/emberjs/data/issues/9534
|
|
262
|
-
*
|
|
263
|
-
* @internal
|
|
264
|
-
*/
|
|
265
|
-
_registerMode(mode: string, kinds: unknown): void;
|
|
266
|
-
/**
|
|
267
|
-
* This is an internal method used to enable legacy behaviors for legacy mode.
|
|
268
|
-
* It is not intended for public use.
|
|
269
|
-
*
|
|
270
|
-
* We do think a generalized `kind` registration system would be useful,
|
|
271
|
-
* but we have not yet designed it.
|
|
272
|
-
*
|
|
273
|
-
* See https://github.com/emberjs/data/issues/9534
|
|
274
|
-
*
|
|
275
|
-
* @internal
|
|
276
|
-
*/
|
|
277
|
-
_kind(mode: string, kind: "belongsTo" | "hasMany"): () => unknown;
|
|
278
254
|
}
|
|
279
255
|
export {};
|
|
@@ -64,18 +64,7 @@ addon authors to perform meta-operations on a record.
|
|
|
64
64
|
@public
|
|
65
65
|
*/
|
|
66
66
|
export declare class RecordReference {
|
|
67
|
-
/** @internal */
|
|
68
|
-
private store;
|
|
69
|
-
/** @internal */
|
|
70
|
-
// unsubscribe token given to us by the notification manager
|
|
71
|
-
private ___token;
|
|
72
|
-
/** @internal */
|
|
73
|
-
private ___identifier;
|
|
74
|
-
/** @internal */
|
|
75
|
-
private _ref;
|
|
76
67
|
constructor(store: Store, identifier: ResourceKey);
|
|
77
|
-
/** @internal */
|
|
78
|
-
destroy(): void;
|
|
79
68
|
get type(): string;
|
|
80
69
|
/**
|
|
81
70
|
The `id` of the record that this reference refers to.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
2
2
|
import { warn } from '@ember/debug';
|
|
3
3
|
import { createDeferred } from '@warp-drive/core/request';
|
|
4
|
-
import { waitFor, coerceId } from '@warp-drive/core/store/-private';
|
|
4
|
+
import { assertPrivateStore, waitFor, coerceId } from '@warp-drive/core/store/-private';
|
|
5
5
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
6
6
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
7
7
|
|
|
@@ -10,40 +10,26 @@ import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
|
10
10
|
Instances are provided to consuming application's
|
|
11
11
|
adapters for certain `findAll` requests.
|
|
12
12
|
|
|
13
|
-
@
|
|
13
|
+
@hideconstructor
|
|
14
14
|
@public
|
|
15
15
|
*/
|
|
16
16
|
class SnapshotRecordArray {
|
|
17
17
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@private
|
|
22
|
-
@constructor
|
|
23
|
-
@param {Store} store
|
|
24
|
-
@param {String} type
|
|
25
|
-
@param options
|
|
18
|
+
* An array of snapshots
|
|
19
|
+
*
|
|
20
|
+
* @internal
|
|
26
21
|
*/
|
|
27
|
-
constructor(store, type, options = {}) {
|
|
28
|
-
this.__store = store;
|
|
29
|
-
/**
|
|
30
|
-
An array of snapshots
|
|
31
|
-
@private
|
|
32
|
-
@property _snapshots
|
|
33
|
-
@type {Array}
|
|
34
|
-
*/
|
|
35
|
-
this._snapshots = null;
|
|
36
22
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
*/
|
|
43
|
-
this.modelName = type;
|
|
23
|
+
/** @internal */
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* The ResourceType of the underlying records for the {@link Snapshot | Snapshots} in the array
|
|
27
|
+
*/
|
|
44
28
|
|
|
45
|
-
|
|
46
|
-
|
|
29
|
+
/** @internal */
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A hash of adapter options passed into the store method for this request.
|
|
47
33
|
Example
|
|
48
34
|
```js [app/adapters/post.js]
|
|
49
35
|
import MyCustomAdapter from './custom-adapter';
|
|
@@ -56,14 +42,10 @@ class SnapshotRecordArray {
|
|
|
56
42
|
}
|
|
57
43
|
}
|
|
58
44
|
```
|
|
59
|
-
|
|
60
|
-
@public
|
|
61
|
-
@type {Object}
|
|
62
|
-
*/
|
|
63
|
-
this.adapterOptions = options.adapterOptions;
|
|
45
|
+
*/
|
|
64
46
|
|
|
65
|
-
|
|
66
|
-
|
|
47
|
+
/**
|
|
48
|
+
* The relationships to include for this request.
|
|
67
49
|
Example
|
|
68
50
|
```js [app/adapters/application.js]
|
|
69
51
|
import Adapter from '@ember-data/adapter';
|
|
@@ -74,18 +56,29 @@ class SnapshotRecordArray {
|
|
|
74
56
|
}
|
|
75
57
|
}
|
|
76
58
|
```
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
SnapshotRecordArray is not directly instantiable.
|
|
63
|
+
Instances are provided to consuming application's
|
|
64
|
+
adapters and serializers for certain requests.
|
|
65
|
+
@private
|
|
66
|
+
@constructor
|
|
67
|
+
@param {Store} store
|
|
68
|
+
@param {String} type
|
|
69
|
+
@param options
|
|
70
|
+
*/
|
|
71
|
+
constructor(store, type, options = {}) {
|
|
72
|
+
this.__store = store;
|
|
73
|
+
this._snapshots = null;
|
|
74
|
+
this.modelName = type;
|
|
75
|
+
this.adapterOptions = options.adapterOptions;
|
|
81
76
|
this.include = options.include;
|
|
82
77
|
}
|
|
83
78
|
|
|
84
79
|
/**
|
|
85
80
|
An array of records
|
|
86
|
-
@
|
|
87
|
-
@private
|
|
88
|
-
@type {Array}
|
|
81
|
+
@internal
|
|
89
82
|
*/
|
|
90
83
|
get _recordArray() {
|
|
91
84
|
return this.__store.peekAll(this.modelName);
|
|
@@ -102,9 +95,6 @@ class SnapshotRecordArray {
|
|
|
102
95
|
}
|
|
103
96
|
});
|
|
104
97
|
```
|
|
105
|
-
@property length
|
|
106
|
-
@public
|
|
107
|
-
@type {Number}
|
|
108
98
|
*/
|
|
109
99
|
get length() {
|
|
110
100
|
return this._recordArray.length;
|
|
@@ -140,7 +130,8 @@ class SnapshotRecordArray {
|
|
|
140
130
|
const {
|
|
141
131
|
_fetchManager
|
|
142
132
|
} = this.__store;
|
|
143
|
-
|
|
133
|
+
const LiveArrayContext = this._recordArray[Context];
|
|
134
|
+
this._snapshots = LiveArrayContext.source.map(identifier => _fetchManager.createSnapshot(identifier));
|
|
144
135
|
return this._snapshots;
|
|
145
136
|
}
|
|
146
137
|
}
|
|
@@ -284,6 +275,7 @@ class Snapshot {
|
|
|
284
275
|
this._belongsToIds = Object.create(null);
|
|
285
276
|
this._hasManyRelationships = Object.create(null);
|
|
286
277
|
this._hasManyIds = Object.create(null);
|
|
278
|
+
assertPrivateStore(store);
|
|
287
279
|
const hasRecord = !!store._instanceCache.peek(identifier);
|
|
288
280
|
this.modelName = identifier.type;
|
|
289
281
|
this.identifier = identifier;
|
|
@@ -686,10 +678,25 @@ class Snapshot {
|
|
|
686
678
|
}
|
|
687
679
|
}
|
|
688
680
|
const SaveOp = getOrSetGlobal('SaveOp', Symbol('SaveOp'));
|
|
681
|
+
/**
|
|
682
|
+
* @private
|
|
683
|
+
*/
|
|
689
684
|
class FetchManager {
|
|
685
|
+
/**
|
|
686
|
+
* @internal
|
|
687
|
+
*/
|
|
688
|
+
|
|
689
|
+
/** @internal */
|
|
690
|
+
|
|
690
691
|
// fetches pending in the runloop, waiting to be coalesced
|
|
692
|
+
/**
|
|
693
|
+
* @internal
|
|
694
|
+
*/
|
|
695
|
+
|
|
696
|
+
/** @internal */
|
|
691
697
|
|
|
692
698
|
constructor(store) {
|
|
699
|
+
assertPrivateStore(store);
|
|
693
700
|
this._store = store;
|
|
694
701
|
// used to keep track of all the find requests that need to be coalesced
|
|
695
702
|
this._pendingFetch = new Map();
|
|
@@ -704,7 +711,7 @@ class FetchManager {
|
|
|
704
711
|
This method is called by `record.save`, and gets passed a
|
|
705
712
|
resolver for the promise that `record.save` returns.
|
|
706
713
|
It schedules saving to happen at the end of the run loop.
|
|
707
|
-
@
|
|
714
|
+
@private
|
|
708
715
|
*/
|
|
709
716
|
scheduleSave(identifier, options) {
|
|
710
717
|
const resolver = createDeferred();
|
|
@@ -868,6 +875,15 @@ class FetchManager {
|
|
|
868
875
|
this.isDestroyed = true;
|
|
869
876
|
}
|
|
870
877
|
}
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
|
+
* This type exists for internal use only for
|
|
881
|
+
* where intimate contracts still exist either for
|
|
882
|
+
* the Test Suite or for Legacy code.
|
|
883
|
+
*
|
|
884
|
+
* @private
|
|
885
|
+
*/
|
|
886
|
+
|
|
871
887
|
function _isEmpty(instanceCache, identifier) {
|
|
872
888
|
const cache = instanceCache.cache;
|
|
873
889
|
if (!cache) {
|
package/dist/adapter/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-
|
|
1
|
+
export { d as determineBodyPromise, g as fetch, p as parseResponseHeaders, b as serializeIntoHash, s as serializeQueryParams, a as setupFastboot } from "../serialize-into-hash-Ceon-MrI.js";
|
package/dist/adapter/json-api.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { dasherize, pluralize } from '@warp-drive/utilities/string';
|
|
2
2
|
import '@ember/debug';
|
|
3
3
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
4
|
-
import { b as serializeIntoHash } from "../serialize-into-hash-
|
|
4
|
+
import { b as serializeIntoHash } from "../serialize-into-hash-Ceon-MrI.js";
|
|
5
5
|
import { RESTAdapter } from './rest.js';
|
|
6
6
|
class JSONAPIAdapter extends RESTAdapter {
|
|
7
7
|
_defaultContentType = 'application/vnd.api+json';
|
package/dist/adapter/rest.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { warn } from '@ember/debug';
|
|
3
3
|
import { computed } from '@ember/object';
|
|
4
4
|
import { Adapter, BuildURLMixin } from '../adapter.js';
|
|
5
|
-
import { b as serializeIntoHash, d as determineBodyPromise, g as getFetchFunction, s as serializeQueryParams, p as parseResponseHeaders } from "../serialize-into-hash-
|
|
5
|
+
import { b as serializeIntoHash, d as determineBodyPromise, g as getFetchFunction, s as serializeQueryParams, p as parseResponseHeaders } from "../serialize-into-hash-Ceon-MrI.js";
|
|
6
6
|
import { InvalidError, ServerError, ConflictError, NotFoundError, ForbiddenError, UnauthorizedError, AdapterError, TimeoutError, AbortError } from './error.js';
|
|
7
7
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
8
8
|
import { d as decorateMethodV2 } from "../runtime-BPCpkOf1-BKOwiRJp.js";
|
package/dist/compat/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as FetchManager, S as SaveOp, c as Snapshot, b as SnapshotRecordArray, u as upgradeStore } from "../-private-
|
|
1
|
+
export { F as FetchManager, S as SaveOp, c as Snapshot, b as SnapshotRecordArray, u as upgradeStore } from "../-private-HaYCdCCm.js";
|
package/dist/compat/builders.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SkipCache } from '@warp-drive/core/types/request';
|
|
2
2
|
import { n as normalizeModelName, i as isMaybeIdentifier } from "../utils-Cqw9eRj5.js";
|
|
3
3
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
4
|
-
import { ensureStringId, constructResource } from '@warp-drive/core/store/-private';
|
|
4
|
+
import { ensureStringId, constructResource, assertPrivateStore } from '@warp-drive/core/store/-private';
|
|
5
5
|
import { storeFor, recordIdentifierFor } from '@warp-drive/core';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -228,6 +228,7 @@ function resourceIsFullyDeleted(instanceCache, identifier) {
|
|
|
228
228
|
*/
|
|
229
229
|
function saveRecordBuilder(record, options = {}) {
|
|
230
230
|
const store = storeFor(record, true);
|
|
231
|
+
assertPrivateStore(store);
|
|
231
232
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
232
233
|
if (!test) {
|
|
233
234
|
throw new Error(`Unable to initiate save for a record in a disconnected state`);
|
package/dist/compat.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { getOwner } from '@ember/application';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
|
-
import { waitFor, _deprecatingNormalize } from '@warp-drive/core/store/-private';
|
|
3
|
+
import { assertPrivateStore, waitFor, _deprecatingNormalize } from '@warp-drive/core/store/-private';
|
|
4
4
|
import '@warp-drive/core/reactive/-private';
|
|
5
|
-
import { p as payloadIsNotBlank, n as normalizeResponseHelper, i as iterateData, F as FetchManager, S as SaveOp, a as assertIdentifierHasId, b as SnapshotRecordArray } from "./-private-
|
|
5
|
+
import { p as payloadIsNotBlank, n as normalizeResponseHelper, i as iterateData, F as FetchManager, S as SaveOp, a as assertIdentifierHasId, b as SnapshotRecordArray } from "./-private-HaYCdCCm.js";
|
|
6
6
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
7
7
|
function _findHasMany(adapter, store, identifier, link, relationship, options) {
|
|
8
8
|
const promise = Promise.resolve().then(() => {
|
|
@@ -425,6 +425,7 @@ function saveRecord(context) {
|
|
|
425
425
|
options,
|
|
426
426
|
record: identifier
|
|
427
427
|
} = data;
|
|
428
|
+
assertPrivateStore(store);
|
|
428
429
|
store.cache.willCommit(identifier, context);
|
|
429
430
|
const saveOptions = Object.assign({
|
|
430
431
|
[SaveOp]: operation
|
|
@@ -530,6 +531,7 @@ function findRecord(context) {
|
|
|
530
531
|
record: identifier,
|
|
531
532
|
options
|
|
532
533
|
} = data;
|
|
534
|
+
assertPrivateStore(store);
|
|
533
535
|
let promise;
|
|
534
536
|
|
|
535
537
|
// if not loaded start loading
|
|
@@ -584,6 +586,7 @@ function findAll(context) {
|
|
|
584
586
|
type,
|
|
585
587
|
options
|
|
586
588
|
} = data;
|
|
589
|
+
assertPrivateStore(store);
|
|
587
590
|
const adapter = store.adapterFor(type);
|
|
588
591
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
589
592
|
if (!test) {
|
|
@@ -648,6 +651,7 @@ function query(context) {
|
|
|
648
651
|
store,
|
|
649
652
|
data
|
|
650
653
|
} = context.request;
|
|
654
|
+
assertPrivateStore(store);
|
|
651
655
|
let {
|
|
652
656
|
options
|
|
653
657
|
} = data;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
2
|
-
import { memoized, defineSignal, defineNonEnumerableSignal, isResourceKey, recordIdentifierFor, storeFor, fastPush, createLegacyManyArray, notifyInternalSignal } from '@warp-drive/core/store/-private';
|
|
2
|
+
import { memoized, defineSignal, assertPrivateStore, defineNonEnumerableSignal, isResourceKey, recordIdentifierFor, isPrivateStore, storeFor, fastPush, createLegacyManyArray, notifyInternalSignal } from '@warp-drive/core/store/-private';
|
|
3
3
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
4
4
|
import { EnableHydration } from '@warp-drive/core/types/request';
|
|
5
|
-
import { u as upgradeStore } from "./-private-
|
|
5
|
+
import { u as upgradeStore } from "./-private-HaYCdCCm.js";
|
|
6
6
|
import { computed, get } from '@ember/object';
|
|
7
7
|
import PromiseProxyMixin from '@ember/object/promise-proxy-mixin';
|
|
8
8
|
import ObjectProxy from '@ember/object/proxy';
|
|
@@ -746,6 +746,7 @@ class HasManyReference {
|
|
|
746
746
|
if ('meta' in dataDoc) {
|
|
747
747
|
newData.meta = dataDoc.meta;
|
|
748
748
|
}
|
|
749
|
+
assertPrivateStore(store);
|
|
749
750
|
store._join(() => {
|
|
750
751
|
this.graph.push({
|
|
751
752
|
op: 'updateRelationship',
|
|
@@ -763,6 +764,7 @@ class HasManyReference {
|
|
|
763
764
|
}
|
|
764
765
|
const relationship = this.graph.getData(this.hasManyRelationship.identifier, this.key);
|
|
765
766
|
return relationship.data ? relationship.data.every(identifier => {
|
|
767
|
+
assertPrivateStore(this.store);
|
|
766
768
|
return this.store._instanceCache.recordIsLoaded(identifier, true) === true;
|
|
767
769
|
}) : false;
|
|
768
770
|
}
|
|
@@ -1331,6 +1333,7 @@ class BelongsToReference {
|
|
|
1331
1333
|
if ('meta' in doc) {
|
|
1332
1334
|
newData.meta = doc.meta;
|
|
1333
1335
|
}
|
|
1336
|
+
assertPrivateStore(store);
|
|
1334
1337
|
store._join(() => {
|
|
1335
1338
|
this.graph.push({
|
|
1336
1339
|
op: 'updateRelationship',
|
|
@@ -1515,9 +1518,17 @@ function lookupLegacySupport(record) {
|
|
|
1515
1518
|
return support;
|
|
1516
1519
|
}
|
|
1517
1520
|
class LegacySupport {
|
|
1521
|
+
/** @internal */
|
|
1522
|
+
|
|
1523
|
+
/** @internal */
|
|
1524
|
+
|
|
1525
|
+
/** @internal */
|
|
1526
|
+
|
|
1527
|
+
/** @internal */
|
|
1528
|
+
|
|
1518
1529
|
constructor(record, identifier) {
|
|
1519
1530
|
this.record = record;
|
|
1520
|
-
this.store = storeFor(record, false);
|
|
1531
|
+
this.store = isPrivateStore(storeFor(record, false));
|
|
1521
1532
|
this.identifier = identifier;
|
|
1522
1533
|
this.cache = this.store.cache;
|
|
1523
1534
|
if (this.store._graph) {
|
|
@@ -2139,6 +2150,7 @@ function extractIdentifierFromRecord(record) {
|
|
|
2139
2150
|
return recordIdentifierFor(record);
|
|
2140
2151
|
}
|
|
2141
2152
|
function anyUnloaded(store, relationship) {
|
|
2153
|
+
assertPrivateStore(store);
|
|
2142
2154
|
const graph = store._graph;
|
|
2143
2155
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
2144
2156
|
if (!test) {
|
|
@@ -2155,6 +2167,7 @@ function anyUnloaded(store, relationship) {
|
|
|
2155
2167
|
return unloaded || false;
|
|
2156
2168
|
}
|
|
2157
2169
|
function areAllInverseRecordsLoaded(store, resource) {
|
|
2170
|
+
assertPrivateStore(store);
|
|
2158
2171
|
const instanceCache = store._instanceCache;
|
|
2159
2172
|
const identifiers = resource.data;
|
|
2160
2173
|
if (Array.isArray(identifiers)) {
|
package/dist/model/-private.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-
|
|
1
|
+
export { E as Errors, L as LEGACY_SUPPORT, P as PromiseBelongsTo, a as PromiseManyArray, l as lookupLegacySupport } from "../errors-BMZPmFxm.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { deprecate } from '@ember/debug';
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
3
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
4
|
-
import { notifyInternalSignal } from '@warp-drive/core/store/-private';
|
|
4
|
+
import { notifyInternalSignal, assertPrivateStore } from '@warp-drive/core/store/-private';
|
|
5
5
|
import { getOrSetGlobal } from '@warp-drive/core/types/-private';
|
|
6
6
|
import { Type } from '@warp-drive/core/types/symbols';
|
|
7
|
-
import { l as lookupLegacySupport, E as Errors } from "../errors-
|
|
8
|
-
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-
|
|
7
|
+
import { l as lookupLegacySupport, E as Errors } from "../errors-BMZPmFxm.js";
|
|
8
|
+
import { b as buildSchema, u as unloadRecord, s as serialize, _ as _save, a as save, r as rollbackAttributes, c as _reload, d as reload, h as hasMany, e as _destroyRecord, f as destroyRecord, g as deleteRecord, R as RecordState, i as changedAttributes, j as belongsTo, k as createSnapshot } from "../schema-provider-Dhk-879f.js";
|
|
9
9
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
10
|
|
|
11
11
|
/**
|
|
@@ -315,6 +315,7 @@ function registerDerivations(schema) {
|
|
|
315
315
|
return lookupLegacySupport(record).getBelongsTo(field.name);
|
|
316
316
|
},
|
|
317
317
|
set(store, record, cacheKey, field, value) {
|
|
318
|
+
assertPrivateStore(store);
|
|
318
319
|
store._join(() => {
|
|
319
320
|
// FIXME field.name here should likely be field.sourceKey || field.name
|
|
320
321
|
lookupLegacySupport(record).setDirtyBelongsTo(field.name, value);
|
|
@@ -327,6 +328,7 @@ function registerDerivations(schema) {
|
|
|
327
328
|
return lookupLegacySupport(record).getHasMany(field.name);
|
|
328
329
|
},
|
|
329
330
|
set(store, record, cacheKey, field, value) {
|
|
331
|
+
assertPrivateStore(store);
|
|
330
332
|
store._join(() => {
|
|
331
333
|
const support = lookupLegacySupport(record);
|
|
332
334
|
// FIXME field.name here should likely be field.sourceKey || field.name
|
package/dist/model.js
CHANGED
|
@@ -4,12 +4,12 @@ import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
|
4
4
|
import { i as isElementDescriptor, n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
5
5
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
6
6
|
import { warn, deprecate } from '@ember/debug';
|
|
7
|
-
import {
|
|
7
|
+
import { assertPrivateStore, setRecordIdentifier, StoreMap } from '@warp-drive/core/store/-private';
|
|
8
|
+
import { l as lookupLegacySupport } from "./errors-BMZPmFxm.js";
|
|
8
9
|
import { singularize, dasherize } from '@warp-drive/utilities/string';
|
|
9
|
-
import { l as getModelFactory } from "./schema-provider-
|
|
10
|
-
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-
|
|
10
|
+
import { l as getModelFactory } from "./schema-provider-Dhk-879f.js";
|
|
11
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-Dhk-879f.js";
|
|
11
12
|
import { setOwner, getOwner } from '@ember/application';
|
|
12
|
-
import { setRecordIdentifier, StoreMap } from '@warp-drive/core/store/-private';
|
|
13
13
|
function _attr(type, options) {
|
|
14
14
|
if (typeof type === 'object') {
|
|
15
15
|
options = type;
|
|
@@ -247,6 +247,7 @@ function _belongsTo(type, options) {
|
|
|
247
247
|
throw new Error(`'${key}' is a reserved property name on instances of classes extending Model. Please choose a different property name for your belongsTo on ${this.constructor.toString()}`);
|
|
248
248
|
}
|
|
249
249
|
}
|
|
250
|
+
assertPrivateStore(this[RecordStore]);
|
|
250
251
|
this[RecordStore]._join(() => {
|
|
251
252
|
support.setDirtyBelongsTo(key, value);
|
|
252
253
|
});
|
|
@@ -485,6 +486,7 @@ function _hasMany(type, options) {
|
|
|
485
486
|
throw new Error(`You must pass an array of records to set a hasMany relationship`);
|
|
486
487
|
}
|
|
487
488
|
})(Array.isArray(records)) : {};
|
|
489
|
+
assertPrivateStore(this[RecordStore]);
|
|
488
490
|
this[RecordStore]._join(() => {
|
|
489
491
|
manyArray.splice(0, manyArray.length, ...records);
|
|
490
492
|
});
|
|
@@ -699,6 +701,7 @@ function teardownRecord(record) {
|
|
|
699
701
|
record.destroy();
|
|
700
702
|
}
|
|
701
703
|
function modelFor(modelName) {
|
|
704
|
+
assertPrivateStore(this);
|
|
702
705
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
703
706
|
if (!test) {
|
|
704
707
|
throw new Error(`Attempted to call store.modelFor(), but the store instance has already been destroyed.`);
|
|
@@ -2,10 +2,10 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { deprecate } from '@ember/debug';
|
|
3
3
|
import EmberObject from '@ember/object';
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@warp-drive/core';
|
|
5
|
-
import { notifyInternalSignal, peekInternalSignal, withSignalStore, recordIdentifierFor as recordIdentifierFor$1, gate, memoized, defineSignal, coerceId, entangleSignal, defineGate } from '@warp-drive/core/store/-private';
|
|
5
|
+
import { assertPrivateStore, notifyInternalSignal, peekInternalSignal, withSignalStore, recordIdentifierFor as recordIdentifierFor$1, gate, memoized, defineSignal, coerceId, entangleSignal, defineGate } from '@warp-drive/core/store/-private';
|
|
6
6
|
import { RecordStore } from '@warp-drive/core/types/symbols';
|
|
7
|
-
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-
|
|
8
|
-
import { u as upgradeStore, F as FetchManager } from "./-private-
|
|
7
|
+
import { l as lookupLegacySupport, L as LEGACY_SUPPORT, E as Errors } from "./errors-BMZPmFxm.js";
|
|
8
|
+
import { u as upgradeStore, F as FetchManager } from "./-private-HaYCdCCm.js";
|
|
9
9
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
10
|
import { cacheFor } from '@ember/object/internals';
|
|
11
11
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
@@ -19,6 +19,7 @@ function rollbackAttributes() {
|
|
|
19
19
|
isNew
|
|
20
20
|
} = currentState;
|
|
21
21
|
const store = this[RecordStore];
|
|
22
|
+
assertPrivateStore(store);
|
|
22
23
|
store._join(() => {
|
|
23
24
|
store.cache.rollbackAttrs(recordIdentifierFor(this));
|
|
24
25
|
this.errors.clear();
|
|
@@ -289,9 +290,32 @@ root
|
|
|
289
290
|
invalid
|
|
290
291
|
inFlight
|
|
291
292
|
|
|
292
|
-
@
|
|
293
|
+
@hideconstructor
|
|
294
|
+
@private
|
|
293
295
|
*/
|
|
294
296
|
class RecordState {
|
|
297
|
+
/** @internal */
|
|
298
|
+
|
|
299
|
+
/** @internal */
|
|
300
|
+
|
|
301
|
+
/** @internal */
|
|
302
|
+
|
|
303
|
+
/** @internal */
|
|
304
|
+
|
|
305
|
+
/** @internal */
|
|
306
|
+
|
|
307
|
+
/** @internal */
|
|
308
|
+
|
|
309
|
+
/** @internal */
|
|
310
|
+
|
|
311
|
+
/** @internal */
|
|
312
|
+
|
|
313
|
+
/** @internal */
|
|
314
|
+
|
|
315
|
+
/** @internal */
|
|
316
|
+
|
|
317
|
+
/** @internal */
|
|
318
|
+
|
|
295
319
|
constructor(record) {
|
|
296
320
|
const store = storeFor(record, false);
|
|
297
321
|
const identity = recordIdentifierFor$1(record);
|
|
@@ -730,7 +754,7 @@ class Model extends EmberObject {
|
|
|
730
754
|
});
|
|
731
755
|
}
|
|
732
756
|
|
|
733
|
-
/** @
|
|
757
|
+
/** @private */
|
|
734
758
|
// @ts-expect-error destroy should not return a value, but ember's types force it to
|
|
735
759
|
destroy() {
|
|
736
760
|
const identifier = recordIdentifierFor(this);
|
|
@@ -1031,6 +1055,7 @@ class Model extends EmberObject {
|
|
|
1031
1055
|
const normalizedId = coerceId(id);
|
|
1032
1056
|
const identifier = recordIdentifierFor(this);
|
|
1033
1057
|
const didChange = normalizedId !== identifier.id;
|
|
1058
|
+
assertPrivateStore(this.store);
|
|
1034
1059
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
1035
1060
|
if (!test) {
|
|
1036
1061
|
throw new Error(`Cannot set ${identifier.type} record's id to ${id}, because id is already ${identifier.id}`);
|
|
@@ -1206,8 +1231,8 @@ class Model extends EmberObject {
|
|
|
1206
1231
|
}
|
|
1207
1232
|
```
|
|
1208
1233
|
@public
|
|
1209
|
-
@param
|
|
1210
|
-
@param
|
|
1234
|
+
@param callback the callback to invoke
|
|
1235
|
+
@param binding the value to which the callback's `this` should be bound
|
|
1211
1236
|
*/
|
|
1212
1237
|
eachRelationship(callback, binding) {
|
|
1213
1238
|
this.constructor.eachRelationship(callback, binding);
|
|
@@ -1278,9 +1303,9 @@ class Model extends EmberObject {
|
|
|
1278
1303
|
```
|
|
1279
1304
|
Calling `store.modelFor('post').typeForRelationship('comments', store)` will return `Comment`.
|
|
1280
1305
|
@public
|
|
1281
|
-
@param
|
|
1282
|
-
@param
|
|
1283
|
-
@return
|
|
1306
|
+
@param name the name of the relationship
|
|
1307
|
+
@param store an instance of Store
|
|
1308
|
+
@return the type of the relationship, or undefined
|
|
1284
1309
|
*/
|
|
1285
1310
|
static typeForRelationship(name, store) {
|
|
1286
1311
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -1320,9 +1345,9 @@ class Model extends EmberObject {
|
|
|
1320
1345
|
store.modelFor('message').inverseFor('owner', store) // { type: 'post', name: 'comments', kind: 'hasMany' }
|
|
1321
1346
|
```
|
|
1322
1347
|
@public
|
|
1323
|
-
@param
|
|
1324
|
-
@param
|
|
1325
|
-
@return
|
|
1348
|
+
@param name the name of the relationship
|
|
1349
|
+
@param store
|
|
1350
|
+
@return the inverse relationship, or null
|
|
1326
1351
|
*/
|
|
1327
1352
|
static {
|
|
1328
1353
|
decorateMethodV2(this, "inverseMap", [computeOnce]);
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { warn } from '@ember/debug';
|
|
2
2
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
3
3
|
import '@warp-drive/core/reactive/-private';
|
|
4
|
-
import "./-private-
|
|
4
|
+
import "./-private-HaYCdCCm.js";
|
|
5
|
+
import '@warp-drive/core/store/-private';
|
|
5
6
|
const newline = /\r?\n/;
|
|
6
7
|
function parseResponseHeaders(headersString) {
|
|
7
8
|
const headers = Object.create(null);
|
package/dist/store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineSignal, ensureStringId, recordIdentifierFor, constructResource, storeFor } from '@warp-drive/core/store/-private';
|
|
1
|
+
import { defineSignal, assertPrivateStore, ensureStringId, recordIdentifierFor, constructResource, storeFor } from '@warp-drive/core/store/-private';
|
|
2
2
|
import { SkipCache } from '@warp-drive/core/types/request';
|
|
3
3
|
import { i as isMaybeIdentifier } from "./utils-Cqw9eRj5.js";
|
|
4
4
|
import { n as normalizeModelName } from "./util-Dul6TZts.js";
|
|
@@ -37,6 +37,7 @@ function preloadData(store, identifier, preload) {
|
|
|
37
37
|
}
|
|
38
38
|
});
|
|
39
39
|
const cache = store.cache;
|
|
40
|
+
assertPrivateStore(store);
|
|
40
41
|
const hasRecord = Boolean(store._instanceCache.peek(identifier));
|
|
41
42
|
cache.upsert(identifier, jsonPayload, hasRecord);
|
|
42
43
|
}
|
|
@@ -401,6 +402,7 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
401
402
|
}
|
|
402
403
|
const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resource);
|
|
403
404
|
options = options || {};
|
|
405
|
+
assertPrivateStore(this);
|
|
404
406
|
if (options.preload) {
|
|
405
407
|
// force reload if we preload to ensure we don't resolve the promise
|
|
406
408
|
// until we are complete, else we will end up background-reloading
|
|
@@ -522,8 +524,6 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
522
524
|
});
|
|
523
525
|
return promise.then(document => document.content);
|
|
524
526
|
};
|
|
525
|
-
|
|
526
|
-
// @ts-expect-error RecordReference private store shouldn't matter
|
|
527
527
|
StoreKlass.prototype.getReference = function (resource, id) {
|
|
528
528
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
529
529
|
if (!test) {
|
|
@@ -544,6 +544,7 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
544
544
|
}
|
|
545
545
|
})(isMaybeIdentifier(resourceIdentifier)) : {};
|
|
546
546
|
const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);
|
|
547
|
+
assertPrivateStore(this);
|
|
547
548
|
const cache = upgradeInstanceCaches(this._instanceCache.__instances).reference;
|
|
548
549
|
let reference = cache.get(identifier);
|
|
549
550
|
if (!reference) {
|
|
@@ -590,6 +591,7 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
590
591
|
// but just in case we reject here to prevent bad things.
|
|
591
592
|
return Promise.reject(new Error(`Record Is Disconnected`));
|
|
592
593
|
}
|
|
594
|
+
assertPrivateStore(this);
|
|
593
595
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
594
596
|
if (!test) {
|
|
595
597
|
throw new Error(`Cannot initiate a save request for an unloaded record: ${identifier.lid}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@warp-drive/legacy",
|
|
3
|
-
"version": "5.7.0-alpha.
|
|
3
|
+
"version": "5.7.0-alpha.28",
|
|
4
4
|
"description": "Decommissioned Packages for WarpDrive | Things your app might still want to maintain use of for a little longer.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ember-addon"
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
36
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
35
|
+
"@warp-drive/core": "5.7.0-alpha.28",
|
|
36
|
+
"@warp-drive/utilities": "5.7.0-alpha.28"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@embroider/macros": "^1.16.12"
|
|
@@ -43,9 +43,9 @@
|
|
|
43
43
|
"@babel/plugin-transform-typescript": "^7.27.0",
|
|
44
44
|
"@babel/preset-typescript": "^7.27.0",
|
|
45
45
|
"@types/jquery": "^3.5.32",
|
|
46
|
-
"@warp-drive/internal-config": "5.7.0-alpha.
|
|
47
|
-
"@warp-drive/core": "5.7.0-alpha.
|
|
48
|
-
"@warp-drive/utilities": "5.7.0-alpha.
|
|
46
|
+
"@warp-drive/internal-config": "5.7.0-alpha.28",
|
|
47
|
+
"@warp-drive/core": "5.7.0-alpha.28",
|
|
48
|
+
"@warp-drive/utilities": "5.7.0-alpha.28",
|
|
49
49
|
"ember-source": "~6.3.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
51
|
"expect-type": "^1.2.1",
|