@warp-drive/legacy 5.7.0-alpha.14 → 5.7.0-alpha.15
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/compat/builders/save-record.d.ts +3 -3
- package/declarations/compat/legacy-network-handler/fetch-manager.d.ts +10 -10
- package/declarations/compat/legacy-network-handler/identifier-has-id.d.ts +2 -2
- package/declarations/compat/legacy-network-handler/legacy-data-fetch.d.ts +5 -5
- package/declarations/compat/legacy-network-handler/snapshot.d.ts +4 -4
- package/declarations/model/-private/debug/assert-polymorphic-type.d.ts +2 -2
- package/declarations/model/-private/hooks.d.ts +2 -2
- package/declarations/model/-private/legacy-relationships-support.d.ts +8 -8
- package/declarations/model/-private/model.d.ts +3 -3
- package/declarations/model/-private/notify-changes.d.ts +2 -2
- package/declarations/model/-private/record-state.d.ts +2 -2
- package/declarations/model/-private/references/belongs-to.d.ts +6 -6
- package/declarations/model/-private/references/has-many.d.ts +6 -6
- package/declarations/model/-private/schema-provider.d.ts +6 -6
- package/declarations/model/migration-support.d.ts +9 -9
- package/declarations/store/-private.d.ts +5 -5
- package/dist/{-private-DGArz5W5.js → -private-CVsFOW1k.js} +3 -3
- 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.js +1 -1
- package/dist/{errors-CI53ie90.js → errors-VSxXZooE.js} +15 -15
- package/dist/model/-private.js +1 -1
- package/dist/model/migration-support.js +2 -2
- package/dist/model.js +3 -3
- package/dist/{schema-provider-keKLiu7p.js → schema-provider-BgBPZFfc.js} +2 -2
- package/dist/{serialize-into-hash-BJjGi7jB.js → serialize-into-hash-B59laYa4.js} +1 -1
- package/dist/store.js +2 -2
- package/package.json +6 -6
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type StoreRequestInput } from "@warp-drive/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ResourceKey } from "@warp-drive/core/types";
|
|
3
3
|
import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
|
|
4
4
|
import type { RequestSignature } from "@warp-drive/core/types/symbols";
|
|
5
5
|
type SaveRecordRequestInput<
|
|
@@ -8,10 +8,10 @@ type SaveRecordRequestInput<
|
|
|
8
8
|
> = StoreRequestInput & {
|
|
9
9
|
op: "createRecord" | "deleteRecord" | "updateRecord";
|
|
10
10
|
data: {
|
|
11
|
-
record:
|
|
11
|
+
record: ResourceKey<T>;
|
|
12
12
|
options: SaveRecordBuilderOptions;
|
|
13
13
|
};
|
|
14
|
-
records: [
|
|
14
|
+
records: [ResourceKey<T>];
|
|
15
15
|
[RequestSignature]?: RT;
|
|
16
16
|
};
|
|
17
17
|
type SaveRecordBuilderOptions = Record<string, unknown>;
|
|
@@ -2,7 +2,7 @@ import type { Store } from "@warp-drive/core";
|
|
|
2
2
|
import { createDeferred } from "@warp-drive/core/request";
|
|
3
3
|
import type { Request, RequestStateService } from "@warp-drive/core/store/-private";
|
|
4
4
|
import type { FindRecordOptions } from "@warp-drive/core/types";
|
|
5
|
-
import type {
|
|
5
|
+
import type { PersistedResourceKey, ResourceKey } from "@warp-drive/core/types/identifier";
|
|
6
6
|
import type { TypeFromInstance } from "@warp-drive/core/types/record";
|
|
7
7
|
import type { ImmutableRequestInfo } from "@warp-drive/core/types/request";
|
|
8
8
|
import type { SingleResourceDocument } from "@warp-drive/core/types/spec/json-api-raw";
|
|
@@ -13,23 +13,23 @@ export type FetchMutationOptions = FindRecordOptions & {
|
|
|
13
13
|
[SaveOp]: "createRecord" | "deleteRecord" | "updateRecord";
|
|
14
14
|
};
|
|
15
15
|
interface PendingFetchItem {
|
|
16
|
-
identifier:
|
|
16
|
+
identifier: PersistedResourceKey;
|
|
17
17
|
queryRequest: Request;
|
|
18
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
19
|
resolver: Deferred<any>;
|
|
20
20
|
options: FindRecordOptions;
|
|
21
21
|
trace?: unknown;
|
|
22
|
-
promise: Promise<
|
|
22
|
+
promise: Promise<PersistedResourceKey>;
|
|
23
23
|
}
|
|
24
24
|
export declare class FetchManager {
|
|
25
25
|
isDestroyed: boolean;
|
|
26
26
|
requestCache: RequestStateService;
|
|
27
27
|
// fetches pending in the runloop, waiting to be coalesced
|
|
28
|
-
_pendingFetch: Map<string, Map<
|
|
28
|
+
_pendingFetch: Map<string, Map<PersistedResourceKey, PendingFetchItem[]>>;
|
|
29
29
|
_store: Store;
|
|
30
30
|
constructor(store: Store);
|
|
31
|
-
createSnapshot<T>(identifier:
|
|
32
|
-
createSnapshot(identifier:
|
|
31
|
+
createSnapshot<T>(identifier: ResourceKey<TypeFromInstance<T>>, options?: FindRecordOptions): Snapshot<T>;
|
|
32
|
+
createSnapshot(identifier: ResourceKey, options?: FindRecordOptions): Snapshot;
|
|
33
33
|
/**
|
|
34
34
|
This method is called by `record.save`, and gets passed a
|
|
35
35
|
resolver for the promise that `record.save` returns.
|
|
@@ -38,11 +38,11 @@ export declare class FetchManager {
|
|
|
38
38
|
|
|
39
39
|
@internal
|
|
40
40
|
*/
|
|
41
|
-
scheduleSave(identifier:
|
|
42
|
-
scheduleFetch(identifier:
|
|
43
|
-
getPendingFetch(identifier:
|
|
41
|
+
scheduleSave(identifier: ResourceKey, options: FetchMutationOptions): Promise<null | SingleResourceDocument>;
|
|
42
|
+
scheduleFetch(identifier: PersistedResourceKey, options: FindRecordOptions, request: ImmutableRequestInfo): Promise<PersistedResourceKey>;
|
|
43
|
+
getPendingFetch(identifier: PersistedResourceKey, options: FindRecordOptions): Promise<PersistedResourceKey> | undefined;
|
|
44
44
|
flushAllPendingFetches(): void;
|
|
45
|
-
fetchDataIfNeededForIdentifier(identifier:
|
|
45
|
+
fetchDataIfNeededForIdentifier(identifier: PersistedResourceKey, options: FindRecordOptions | undefined, request: ImmutableRequestInfo): Promise<PersistedResourceKey>;
|
|
46
46
|
destroy(): void;
|
|
47
47
|
}
|
|
48
48
|
export {};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare function assertIdentifierHasId(identifier: unknown): asserts identifier is
|
|
1
|
+
import type { PersistedResourceKey } from "@warp-drive/core/types/identifier";
|
|
2
|
+
export declare function assertIdentifierHasId(identifier: unknown): asserts identifier is PersistedResourceKey;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { BaseFinderOptions } from "@warp-drive/core/types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { PersistedResourceKey, ResourceKey } from "@warp-drive/core/types/identifier";
|
|
4
4
|
import type { LegacyRelationshipField as RelationshipSchema } from "@warp-drive/core/types/schema/fields";
|
|
5
5
|
import type { MinimumAdapterInterface } from "./minimum-adapter-interface.js";
|
|
6
|
-
export declare function _findHasMany(adapter: MinimumAdapterInterface, store: Store, identifier:
|
|
6
|
+
export declare function _findHasMany(adapter: MinimumAdapterInterface, store: Store, identifier: ResourceKey, link: string | null | {
|
|
7
7
|
href: string;
|
|
8
|
-
}, relationship: RelationshipSchema, options: BaseFinderOptions): Promise<
|
|
9
|
-
export declare function _findBelongsTo(store: Store, identifier:
|
|
8
|
+
}, relationship: RelationshipSchema, options: BaseFinderOptions): Promise<PersistedResourceKey[]>;
|
|
9
|
+
export declare function _findBelongsTo(store: Store, identifier: ResourceKey, link: string | null | {
|
|
10
10
|
href: string;
|
|
11
|
-
}, relationship: RelationshipSchema, options: BaseFinderOptions): Promise<
|
|
11
|
+
}, relationship: RelationshipSchema, options: BaseFinderOptions): Promise<PersistedResourceKey | null>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { FindRecordOptions } from "@warp-drive/core/types";
|
|
3
3
|
import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
5
5
|
import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
|
|
6
6
|
import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
|
|
7
7
|
import type { SerializerOptions } from "./minimum-serializer-interface.js";
|
|
@@ -29,11 +29,11 @@ export declare class Snapshot<R = unknown> {
|
|
|
29
29
|
private _changedAttributes;
|
|
30
30
|
private _store;
|
|
31
31
|
/**
|
|
32
|
-
The unique
|
|
32
|
+
The unique ResourceKey associated with this Snapshot.
|
|
33
33
|
|
|
34
34
|
@public
|
|
35
35
|
*/
|
|
36
|
-
identifier:
|
|
36
|
+
identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>;
|
|
37
37
|
/**
|
|
38
38
|
The ResourceType of the underlying record for this Snapshot, as a string.
|
|
39
39
|
|
|
@@ -66,7 +66,7 @@ export declare class Snapshot<R = unknown> {
|
|
|
66
66
|
@public
|
|
67
67
|
*/
|
|
68
68
|
adapterOptions?: Record<string, unknown>;
|
|
69
|
-
constructor(options: FindRecordOptions, identifier:
|
|
69
|
+
constructor(options: FindRecordOptions, identifier: ResourceKey<R extends TypedRecordInstance ? TypeFromInstance<R> : string>, store: Store);
|
|
70
70
|
/**
|
|
71
71
|
The underlying record for this snapshot. Can be used to access methods and
|
|
72
72
|
properties defined on the record.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { UpgradedMeta } from "@warp-drive/core/graph/-private";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
4
4
|
/*
|
|
5
5
|
Assert that `addedRecord` has a valid type so it can be added to the
|
|
6
6
|
relationship of the `record`.
|
|
@@ -13,5 +13,5 @@ be stable record identifiers and the `relationshipMeta` needs to be the meta
|
|
|
13
13
|
information about the relationship, retrieved via
|
|
14
14
|
`record.relationshipFor(key)`.
|
|
15
15
|
*/
|
|
16
|
-
declare let assertPolymorphicType: (parentIdentifier:
|
|
16
|
+
declare let assertPolymorphicType: (parentIdentifier: ResourceKey, parentDefinition: UpgradedMeta, addedIdentifier: ResourceKey, store: Store) => void;
|
|
17
17
|
export { assertPolymorphicType };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Store } from "@warp-drive/core/store/-private";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
3
3
|
import type { TypeFromInstance } from "@warp-drive/core/types/record";
|
|
4
4
|
import type { Model } from "./model.js";
|
|
5
|
-
export declare function instantiateRecord(this: Store, identifier:
|
|
5
|
+
export declare function instantiateRecord(this: Store, identifier: ResourceKey, createRecordArgs: {
|
|
6
6
|
[key: string]: unknown;
|
|
7
7
|
}): Model;
|
|
8
8
|
export declare function teardownRecord(record: Model): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { CollectionEdge, Graph, ResourceEdge, UpgradedMeta } from "@warp-drive/core/graph/-private";
|
|
3
3
|
import type { LegacyManyArray } from "@warp-drive/core/store/-private";
|
|
4
|
-
import type { BaseFinderOptions,
|
|
4
|
+
import type { BaseFinderOptions, ResourceKey } from "@warp-drive/core/types";
|
|
5
5
|
import type { Cache } from "@warp-drive/core/types/cache";
|
|
6
6
|
import type { CollectionRelationship } from "@warp-drive/core/types/cache/relationship";
|
|
7
7
|
import type { LocalRelationshipOperation } from "@warp-drive/core/types/graph";
|
|
@@ -14,7 +14,7 @@ import type { HasManyProxyCreateArgs } from "./promise-many-array.js";
|
|
|
14
14
|
import { PromiseManyArray } from "./promise-many-array.js";
|
|
15
15
|
import BelongsToReference from "./references/belongs-to.js";
|
|
16
16
|
import HasManyReference from "./references/has-many.js";
|
|
17
|
-
export declare const LEGACY_SUPPORT: Map<
|
|
17
|
+
export declare const LEGACY_SUPPORT: Map<ResourceKey | MinimalLegacyRecord, LegacySupport>;
|
|
18
18
|
export declare function lookupLegacySupport(record: MinimalLegacyRecord): LegacySupport;
|
|
19
19
|
export declare class LegacySupport {
|
|
20
20
|
record: MinimalLegacyRecord;
|
|
@@ -22,21 +22,21 @@ export declare class LegacySupport {
|
|
|
22
22
|
graph: Graph;
|
|
23
23
|
cache: Cache;
|
|
24
24
|
references: Record<string, BelongsToReference | HasManyReference>;
|
|
25
|
-
identifier:
|
|
25
|
+
identifier: ResourceKey;
|
|
26
26
|
_manyArrayCache: Record<string, LegacyManyArray>;
|
|
27
27
|
_relationshipPromisesCache: Record<string, Promise<LegacyManyArray | OpaqueRecordInstance>>;
|
|
28
28
|
_relationshipProxyCache: Record<string, PromiseManyArray | PromiseBelongsTo | undefined>;
|
|
29
|
-
_pending: Record<string, Promise<
|
|
29
|
+
_pending: Record<string, Promise<ResourceKey | null> | undefined>;
|
|
30
30
|
isDestroying: boolean;
|
|
31
31
|
isDestroyed: boolean;
|
|
32
|
-
constructor(record: MinimalLegacyRecord, identifier:
|
|
32
|
+
constructor(record: MinimalLegacyRecord, identifier: ResourceKey);
|
|
33
33
|
_syncArray(array: LegacyManyArray): void;
|
|
34
34
|
mutate(mutation: LocalRelationshipOperation): void;
|
|
35
35
|
_findBelongsTo(key: string, resource: SingleResourceRelationship, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null>;
|
|
36
36
|
reloadBelongsTo(key: string, options?: BaseFinderOptions): Promise<OpaqueRecordInstance | null>;
|
|
37
37
|
getBelongsTo(key: string, options?: BaseFinderOptions): PromiseBelongsTo | OpaqueRecordInstance | null;
|
|
38
38
|
setDirtyBelongsTo(key: string, value: OpaqueRecordInstance | null): void;
|
|
39
|
-
_getCurrentState<T>(identifier:
|
|
39
|
+
_getCurrentState<T>(identifier: ResourceKey, field: string): [ResourceKey<TypeFromInstanceOrString<T>>[], CollectionRelationship];
|
|
40
40
|
getManyArray<T>(key: string, definition?: UpgradedMeta): LegacyManyArray<T>;
|
|
41
41
|
fetchAsyncHasMany(key: string, relationship: CollectionEdge, manyArray: LegacyManyArray, options?: BaseFinderOptions): Promise<LegacyManyArray>;
|
|
42
42
|
reloadHasMany<T>(key: string, options?: BaseFinderOptions): Promise<LegacyManyArray<T>> | PromiseManyArray<T>;
|
|
@@ -48,8 +48,8 @@ export declare class LegacySupport {
|
|
|
48
48
|
}): PromiseBelongsTo;
|
|
49
49
|
referenceFor(kind: "belongsTo", name: string): BelongsToReference;
|
|
50
50
|
referenceFor(kind: "hasMany", name: string): HasManyReference;
|
|
51
|
-
_findHasManyByJsonApiResource(resource: CollectionResourceRelationship, parentIdentifier:
|
|
52
|
-
_findBelongsToByJsonApiResource(resource: SingleResourceRelationship, parentIdentifier:
|
|
51
|
+
_findHasManyByJsonApiResource(resource: CollectionResourceRelationship, parentIdentifier: ResourceKey, relationship: CollectionEdge, options?: BaseFinderOptions): Promise<void | unknown[]> | void;
|
|
52
|
+
_findBelongsToByJsonApiResource(resource: SingleResourceRelationship, parentIdentifier: ResourceKey, relationship: ResourceEdge, options?: BaseFinderOptions): Promise<ResourceKey | null>;
|
|
53
53
|
destroy(): void;
|
|
54
54
|
}
|
|
55
55
|
export declare function areAllInverseRecordsLoaded(store: Store, resource: InnerRelationshipDocument): boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import EmberObject from "@ember/object";
|
|
2
2
|
import type { Store } from "@warp-drive/core";
|
|
3
|
-
import type { ModelSchema,
|
|
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
6
|
import { RecordStore } from "@warp-drive/core/types/symbols";
|
|
@@ -15,9 +15,9 @@ export type ModelCreateArgs = {
|
|
|
15
15
|
_createProps: Record<string, unknown>;
|
|
16
16
|
// TODO @deprecate consider deprecating accessing record properties during init which the below is necessary for
|
|
17
17
|
_secretInit: {
|
|
18
|
-
identifier:
|
|
18
|
+
identifier: ResourceKey;
|
|
19
19
|
store: Store;
|
|
20
|
-
cb: (record: Model, identifier:
|
|
20
|
+
cb: (record: Model, identifier: ResourceKey, store: Store) => void;
|
|
21
21
|
};
|
|
22
22
|
};
|
|
23
23
|
export type StaticModel = typeof Model & {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { NotificationType, Store } from "@warp-drive/core";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
3
3
|
import type { Model } from "./model.js";
|
|
4
|
-
export default function notifyChanges(identifier:
|
|
4
|
+
export default function notifyChanges(identifier: ResourceKey, value: NotificationType, key: string | undefined, record: Model, store: Store): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { RequestCacheRequestState, RequestStateService } from "@warp-drive/core/store/-private";
|
|
3
3
|
import type { Cache } from "@warp-drive/core/types/cache";
|
|
4
|
-
import type {
|
|
4
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
5
5
|
import type { Errors } from "./errors.js";
|
|
6
6
|
import type { MinimalLegacyRecord } from "./model-methods.js";
|
|
7
7
|
/**
|
|
@@ -45,7 +45,7 @@ inFlight
|
|
|
45
45
|
*/
|
|
46
46
|
export default class RecordState {
|
|
47
47
|
store: Store;
|
|
48
|
-
identifier:
|
|
48
|
+
identifier: ResourceKey;
|
|
49
49
|
record: MinimalLegacyRecord;
|
|
50
50
|
rs: RequestStateService;
|
|
51
51
|
pendingCount: number;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { Graph, ResourceEdge } from "@warp-drive/core/graph/-private";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
4
4
|
import type { TypeFromInstance, TypeFromInstanceOrString } from "@warp-drive/core/types/record";
|
|
5
5
|
import type { Links, Meta, SingleResourceDocument, SingleResourceRelationship } from "@warp-drive/core/types/spec/json-api-raw";
|
|
6
6
|
import type { IsUnknown } from "../belongs-to.js";
|
|
@@ -59,20 +59,20 @@ export default class BelongsToReference<
|
|
|
59
59
|
type: TypeFromInstanceOrString<Related>;
|
|
60
60
|
// unsubscribe tokens given to us by the notification manager
|
|
61
61
|
___token: object;
|
|
62
|
-
___identifier:
|
|
62
|
+
___identifier: ResourceKey<TypeFromInstanceOrString<T>>;
|
|
63
63
|
___relatedToken: object | null;
|
|
64
64
|
_ref: number;
|
|
65
|
-
constructor(store: Store, graph: Graph, parentIdentifier:
|
|
65
|
+
constructor(store: Store, graph: Graph, parentIdentifier: ResourceKey<TypeFromInstanceOrString<T>>, belongsToRelationship: ResourceEdge, key: K);
|
|
66
66
|
destroy(): void;
|
|
67
67
|
/**
|
|
68
68
|
* The identifier of the record that this reference refers to.
|
|
69
69
|
* `null` if no related record is known.
|
|
70
70
|
*
|
|
71
71
|
* @property identifier
|
|
72
|
-
* @type {
|
|
72
|
+
* @type {ResourceKey | null}
|
|
73
73
|
* @public
|
|
74
74
|
*/
|
|
75
|
-
get identifier():
|
|
75
|
+
get identifier(): ResourceKey<TypeFromInstanceOrString<Related>> | null;
|
|
76
76
|
/**
|
|
77
77
|
The `id` of the record that this reference refers to. Together, the
|
|
78
78
|
`type()` and `id()` methods form a composite key for the identity
|
|
@@ -198,7 +198,7 @@ export default class BelongsToReference<
|
|
|
198
198
|
@return {Object} The meta information for the belongs-to relationship.
|
|
199
199
|
*/
|
|
200
200
|
meta(): Meta | null;
|
|
201
|
-
_resource(): SingleResourceRelationship<
|
|
201
|
+
_resource(): SingleResourceRelationship<ResourceKey<TypeFromInstance<Related>>>;
|
|
202
202
|
/**
|
|
203
203
|
This returns a string that represents how the reference will be
|
|
204
204
|
looked up when it is loaded. If the relationship has a link it will
|
|
@@ -2,7 +2,7 @@ import type { Store } from "@warp-drive/core";
|
|
|
2
2
|
import type { CollectionEdge, Graph } from "@warp-drive/core/graph/-private";
|
|
3
3
|
import type { RelatedCollection as ManyArray } from "@warp-drive/core/store/-private";
|
|
4
4
|
import type { BaseFinderOptions } from "@warp-drive/core/types";
|
|
5
|
-
import type {
|
|
5
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
6
6
|
import type { TypeFromInstanceOrString } from "@warp-drive/core/types/record";
|
|
7
7
|
import type { CollectionResourceDocument, CollectionResourceRelationship, ExistingResourceObject, LinkObject, Meta, PaginationLinks } from "@warp-drive/core/types/spec/json-api-raw";
|
|
8
8
|
import type { IsUnknown } from "../belongs-to.js";
|
|
@@ -68,10 +68,10 @@ export default class HasManyReference<
|
|
|
68
68
|
type: TypeFromInstanceOrString<Related>;
|
|
69
69
|
// unsubscribe tokens given to us by the notification manager
|
|
70
70
|
___token: object;
|
|
71
|
-
___identifier:
|
|
72
|
-
___relatedTokenMap: Map<
|
|
71
|
+
___identifier: ResourceKey<TypeFromInstanceOrString<T>>;
|
|
72
|
+
___relatedTokenMap: Map<ResourceKey, object>;
|
|
73
73
|
_ref: number;
|
|
74
|
-
constructor(store: Store, graph: Graph, parentIdentifier:
|
|
74
|
+
constructor(store: Store, graph: Graph, parentIdentifier: ResourceKey<TypeFromInstanceOrString<T>>, hasManyRelationship: CollectionEdge, key: K);
|
|
75
75
|
/**
|
|
76
76
|
* This method should never be called by user code.
|
|
77
77
|
*
|
|
@@ -82,10 +82,10 @@ export default class HasManyReference<
|
|
|
82
82
|
* An array of identifiers for the records that this reference refers to.
|
|
83
83
|
*
|
|
84
84
|
* @property identifiers
|
|
85
|
-
* @type {
|
|
85
|
+
* @type {ResourceKey[]}
|
|
86
86
|
* @public
|
|
87
87
|
*/
|
|
88
|
-
get identifiers():
|
|
88
|
+
get identifiers(): ResourceKey<TypeFromInstanceOrString<Related>>[];
|
|
89
89
|
_resource(): CollectionResourceRelationship;
|
|
90
90
|
/**
|
|
91
91
|
This returns a string that represents how the reference will be
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Store } from "@warp-drive/core";
|
|
2
2
|
import type { SchemaService } from "@warp-drive/core/types";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
4
4
|
import type { ObjectValue } from "@warp-drive/core/types/json/raw";
|
|
5
5
|
import type { Derivation, HashFn, Transformation } from "@warp-drive/core/types/schema/concepts";
|
|
6
6
|
import type { ArrayField, DerivedField, GenericField, HashField, LegacyField, ObjectField, ObjectSchema, ResourceSchema } from "@warp-drive/core/types/schema/fields";
|
|
@@ -8,10 +8,10 @@ import type { ModelFactory, ModelStore } from "./model.js";
|
|
|
8
8
|
type AttributesSchema = ReturnType<Exclude<SchemaService["attributesDefinitionFor"], undefined>>;
|
|
9
9
|
type RelationshipsSchema = ReturnType<Exclude<SchemaService["relationshipsDefinitionFor"], undefined>>;
|
|
10
10
|
export interface ModelSchemaProvider {
|
|
11
|
-
attributesDefinitionFor(resource:
|
|
11
|
+
attributesDefinitionFor(resource: ResourceKey | {
|
|
12
12
|
type: string;
|
|
13
13
|
}): AttributesSchema;
|
|
14
|
-
relationshipsDefinitionFor(resource:
|
|
14
|
+
relationshipsDefinitionFor(resource: ResourceKey | {
|
|
15
15
|
type: string;
|
|
16
16
|
}): RelationshipsSchema;
|
|
17
17
|
doesTypeExist(type: string): boolean;
|
|
@@ -23,7 +23,7 @@ export declare class ModelSchemaProvider implements SchemaService {
|
|
|
23
23
|
constructor(store: ModelStore);
|
|
24
24
|
resourceTypes(): Readonly<string[]>;
|
|
25
25
|
hasTrait(type: string): boolean;
|
|
26
|
-
resourceHasTrait(resource:
|
|
26
|
+
resourceHasTrait(resource: ResourceKey | {
|
|
27
27
|
type: string;
|
|
28
28
|
}, trait: string): boolean;
|
|
29
29
|
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
@@ -35,7 +35,7 @@ export declare class ModelSchemaProvider implements SchemaService {
|
|
|
35
35
|
hashFn(field: HashField | {
|
|
36
36
|
type: string;
|
|
37
37
|
}): HashFn;
|
|
38
|
-
resource(resource:
|
|
38
|
+
resource(resource: ResourceKey | {
|
|
39
39
|
type: string;
|
|
40
40
|
}): ResourceSchema | ObjectSchema;
|
|
41
41
|
registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
|
|
@@ -48,7 +48,7 @@ export declare class ModelSchemaProvider implements SchemaService {
|
|
|
48
48
|
>(derivation: Derivation<R, T, FM>): void;
|
|
49
49
|
registerHashFn(hashFn: HashFn): void;
|
|
50
50
|
private _loadModelSchema;
|
|
51
|
-
fields(resource:
|
|
51
|
+
fields(resource: ResourceKey | {
|
|
52
52
|
type: string;
|
|
53
53
|
}): Map<string, LegacyField>;
|
|
54
54
|
hasResource(resource: {
|
|
@@ -3,7 +3,7 @@ import type { CAUTION_MEGA_DANGER_ZONE_Extension, ProcessedExtension } from "@wa
|
|
|
3
3
|
import type { ExtensibleField } from "@warp-drive/core/reactive/-private/schema";
|
|
4
4
|
import type { SchemaService } from "@warp-drive/core/types";
|
|
5
5
|
import type { ChangedAttributesHash } from "@warp-drive/core/types/cache";
|
|
6
|
-
import type {
|
|
6
|
+
import type { ResourceKey } from "@warp-drive/core/types/identifier";
|
|
7
7
|
import type { ObjectValue } from "@warp-drive/core/types/json/raw";
|
|
8
8
|
import type { TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
|
|
9
9
|
import type { Derivation, HashFn, Transformation } from "@warp-drive/core/types/schema/concepts";
|
|
@@ -198,10 +198,10 @@ export declare function registerDerivations(schema: SchemaService): void;
|
|
|
198
198
|
* @public
|
|
199
199
|
*/
|
|
200
200
|
export interface DelegatingSchemaService {
|
|
201
|
-
attributesDefinitionFor?(resource:
|
|
201
|
+
attributesDefinitionFor?(resource: ResourceKey | {
|
|
202
202
|
type: string;
|
|
203
203
|
}): AttributesSchema;
|
|
204
|
-
relationshipsDefinitionFor?(resource:
|
|
204
|
+
relationshipsDefinitionFor?(resource: ResourceKey | {
|
|
205
205
|
type: string;
|
|
206
206
|
}): RelationshipsSchema;
|
|
207
207
|
doesTypeExist?(type: string): boolean;
|
|
@@ -210,18 +210,18 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
210
210
|
_preferred: SchemaService;
|
|
211
211
|
_secondary: SchemaService;
|
|
212
212
|
constructor(store: Store, schema: SchemaService);
|
|
213
|
-
isDelegated(resource:
|
|
213
|
+
isDelegated(resource: ResourceKey | {
|
|
214
214
|
type: string;
|
|
215
215
|
}): boolean;
|
|
216
216
|
resourceTypes(): Readonly<string[]>;
|
|
217
|
-
hasResource(resource:
|
|
217
|
+
hasResource(resource: ResourceKey | {
|
|
218
218
|
type: string;
|
|
219
219
|
}): boolean;
|
|
220
220
|
hasTrait(type: string): boolean;
|
|
221
|
-
resourceHasTrait(resource:
|
|
221
|
+
resourceHasTrait(resource: ResourceKey | {
|
|
222
222
|
type: string;
|
|
223
223
|
}, trait: string): boolean;
|
|
224
|
-
fields(resource:
|
|
224
|
+
fields(resource: ResourceKey | {
|
|
225
225
|
type: string;
|
|
226
226
|
}): Map<string, FieldSchema>;
|
|
227
227
|
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
@@ -233,7 +233,7 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
233
233
|
derivation(field: DerivedField | {
|
|
234
234
|
type: string;
|
|
235
235
|
}): Derivation;
|
|
236
|
-
resource(resource:
|
|
236
|
+
resource(resource: ResourceKey | {
|
|
237
237
|
type: string;
|
|
238
238
|
}): ResourceSchema | ObjectSchema;
|
|
239
239
|
registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
|
|
@@ -246,7 +246,7 @@ export declare class DelegatingSchemaService implements SchemaService {
|
|
|
246
246
|
>(derivation: Derivation<R, T, FM>): void;
|
|
247
247
|
registerHashFn(hashFn: HashFn): void;
|
|
248
248
|
CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
249
|
-
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource:
|
|
249
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: ResourceKey | {
|
|
250
250
|
type: string;
|
|
251
251
|
}): null | ProcessedExtension["features"];
|
|
252
252
|
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type InstanceCache } from "@warp-drive/core/store/-private";
|
|
2
|
-
import type {
|
|
2
|
+
import type { NewResourceKey, ResourceKey } from "@warp-drive/core/types/identifier";
|
|
3
3
|
import type { Value } from "@warp-drive/core/types/json/raw";
|
|
4
4
|
import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "@warp-drive/core/types/record";
|
|
5
5
|
import type { LegacyAttributeField, LegacyRelationshipField } from "@warp-drive/core/types/schema/fields";
|
|
6
6
|
import type { SingleResourceDocument } from "@warp-drive/core/types/spec/json-api-raw";
|
|
7
7
|
import type { Store } from "../store.js";
|
|
8
|
-
export declare function preloadData(store: Store, identifier:
|
|
8
|
+
export declare function preloadData(store: Store, identifier: NewResourceKey, preload: Record<string, Value>): void;
|
|
9
9
|
export interface BaseFinderOptions {
|
|
10
10
|
reload?: boolean;
|
|
11
11
|
backgroundReload?: boolean;
|
|
@@ -55,7 +55,7 @@ export interface ModelSchema<T = unknown> {
|
|
|
55
55
|
eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: LegacyRelationshipField) => void, binding?: T): void;
|
|
56
56
|
eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
|
|
57
57
|
}
|
|
58
|
-
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier:
|
|
58
|
+
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: ResourceKey): boolean;
|
|
59
59
|
/**
|
|
60
60
|
A `RecordReference` is a low-level API that allows users and
|
|
61
61
|
addon authors to perform meta-operations on a record.
|
|
@@ -73,7 +73,7 @@ export declare class RecordReference {
|
|
|
73
73
|
private ___identifier;
|
|
74
74
|
/** @internal */
|
|
75
75
|
private _ref;
|
|
76
|
-
constructor(store: Store, identifier:
|
|
76
|
+
constructor(store: Store, identifier: ResourceKey);
|
|
77
77
|
/** @internal */
|
|
78
78
|
destroy(): void;
|
|
79
79
|
get type(): string;
|
|
@@ -112,7 +112,7 @@ export declare class RecordReference {
|
|
|
112
112
|
@public
|
|
113
113
|
@return The identifier of the record.
|
|
114
114
|
*/
|
|
115
|
-
identifier():
|
|
115
|
+
identifier(): ResourceKey;
|
|
116
116
|
/**
|
|
117
117
|
How the reference will be looked up when it is loaded. Currently
|
|
118
118
|
this always returns `identity` to signify that a record will be
|
|
@@ -247,7 +247,7 @@ function normalizeResponseHelper(serializer, store, modelClass, payload, id, req
|
|
|
247
247
|
*/
|
|
248
248
|
class Snapshot {
|
|
249
249
|
/**
|
|
250
|
-
The unique
|
|
250
|
+
The unique ResourceKey associated with this Snapshot.
|
|
251
251
|
@public
|
|
252
252
|
*/
|
|
253
253
|
|
|
@@ -483,7 +483,7 @@ class Snapshot {
|
|
|
483
483
|
}
|
|
484
484
|
const value = this._store.cache.getRelationship(identifier, keyName);
|
|
485
485
|
const data = value && value.data;
|
|
486
|
-
const inverseIdentifier = data ? store.
|
|
486
|
+
const inverseIdentifier = data ? store.cacheKeyManager.getOrCreateRecordIdentifier(data) : null;
|
|
487
487
|
if (value && value.data !== undefined) {
|
|
488
488
|
const cache = store.cache;
|
|
489
489
|
if (inverseIdentifier && !cache.isDeleted(inverseIdentifier)) {
|
|
@@ -575,7 +575,7 @@ class Snapshot {
|
|
|
575
575
|
if (value.data) {
|
|
576
576
|
results = [];
|
|
577
577
|
value.data.forEach(member => {
|
|
578
|
-
const inverseIdentifier = store.
|
|
578
|
+
const inverseIdentifier = store.cacheKeyManager.getOrCreateRecordIdentifier(member);
|
|
579
579
|
const cache = store.cache;
|
|
580
580
|
if (!cache.isDeleted(inverseIdentifier)) {
|
|
581
581
|
if (returnModeIsIds) {
|
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-B59laYa4.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-B59laYa4.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-B59laYa4.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-CVsFOW1k.js";
|
package/dist/compat.js
CHANGED
|
@@ -2,7 +2,7 @@ import { getOwner } from '@ember/application';
|
|
|
2
2
|
import { recordIdentifierFor } from '@warp-drive/core';
|
|
3
3
|
import { 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-CVsFOW1k.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(() => {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Context } from '@warp-drive/core/reactive/-private';
|
|
2
|
-
import { memoized, defineSignal, defineNonEnumerableSignal,
|
|
2
|
+
import { memoized, defineSignal, defineNonEnumerableSignal, isResourceKey, recordIdentifierFor, 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-CVsFOW1k.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';
|
|
@@ -421,7 +421,7 @@ class HasManyReference {
|
|
|
421
421
|
* An array of identifiers for the records that this reference refers to.
|
|
422
422
|
*
|
|
423
423
|
* @property identifiers
|
|
424
|
-
* @type {
|
|
424
|
+
* @type {ResourceKey[]}
|
|
425
425
|
* @public
|
|
426
426
|
*/
|
|
427
427
|
get identifiers() {
|
|
@@ -433,7 +433,7 @@ class HasManyReference {
|
|
|
433
433
|
this.___relatedTokenMap = new Map();
|
|
434
434
|
if (resource && resource.data) {
|
|
435
435
|
return resource.data.map(resourceIdentifier => {
|
|
436
|
-
const identifier = this.store.
|
|
436
|
+
const identifier = this.store.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);
|
|
437
437
|
let token = map.get(identifier);
|
|
438
438
|
if (token) {
|
|
439
439
|
map.delete(identifier);
|
|
@@ -725,7 +725,7 @@ class HasManyReference {
|
|
|
725
725
|
throw new Error(`You must provide at least one of 'links', 'meta' or 'data' when calling hasManyReference.push`);
|
|
726
726
|
}
|
|
727
727
|
})('links' in dataDoc || 'meta' in dataDoc || 'data' in dataDoc) : {};
|
|
728
|
-
const identifiers = !Array.isArray(dataDoc.data) ? [] : isResourceData ? store._push(dataDoc, true) : dataDoc.data.map(i => store.
|
|
728
|
+
const identifiers = !Array.isArray(dataDoc.data) ? [] : isResourceData ? store._push(dataDoc, true) : dataDoc.data.map(i => store.cacheKeyManager.getOrCreateRecordIdentifier(i));
|
|
729
729
|
const {
|
|
730
730
|
identifier
|
|
731
731
|
} = this.hasManyRelationship;
|
|
@@ -1023,7 +1023,7 @@ class BelongsToReference {
|
|
|
1023
1023
|
* `null` if no related record is known.
|
|
1024
1024
|
*
|
|
1025
1025
|
* @property identifier
|
|
1026
|
-
* @type {
|
|
1026
|
+
* @type {ResourceKey | null}
|
|
1027
1027
|
* @public
|
|
1028
1028
|
*/
|
|
1029
1029
|
get identifier() {
|
|
@@ -1033,7 +1033,7 @@ class BelongsToReference {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
const resource = this._resource();
|
|
1035
1035
|
if (resource && resource.data) {
|
|
1036
|
-
const identifier = this.store.
|
|
1036
|
+
const identifier = this.store.cacheKeyManager.getOrCreateRecordIdentifier(resource.data);
|
|
1037
1037
|
this.___relatedToken = this.store.notifications.subscribe(identifier, (_, bucket, notifiedKey) => {
|
|
1038
1038
|
if (bucket === 'identity' || bucket === 'attributes' && notifiedKey === 'id') {
|
|
1039
1039
|
this._ref++;
|
|
@@ -1310,7 +1310,7 @@ class BelongsToReference {
|
|
|
1310
1310
|
store
|
|
1311
1311
|
} = this;
|
|
1312
1312
|
const isResourceData = doc.data && isMaybeResource(doc.data);
|
|
1313
|
-
const added = isResourceData ? store._push(doc, true) : doc.data ? store.
|
|
1313
|
+
const added = isResourceData ? store._push(doc, true) : doc.data ? store.cacheKeyManager.getOrCreateRecordIdentifier(doc.data) : null;
|
|
1314
1314
|
const {
|
|
1315
1315
|
identifier
|
|
1316
1316
|
} = this.belongsToRelationship;
|
|
@@ -1588,7 +1588,7 @@ class LegacySupport {
|
|
|
1588
1588
|
if (!test) {
|
|
1589
1589
|
throw new Error(`Expected a stable identifier`);
|
|
1590
1590
|
}
|
|
1591
|
-
})(!relatedIdentifier ||
|
|
1591
|
+
})(!relatedIdentifier || isResourceKey(relatedIdentifier)) : {};
|
|
1592
1592
|
const store = this.store;
|
|
1593
1593
|
const relationship = this.graph.get(this.identifier, key);
|
|
1594
1594
|
macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
|
|
@@ -1648,7 +1648,7 @@ class LegacySupport {
|
|
|
1648
1648
|
if (!test) {
|
|
1649
1649
|
throw new Error(`Expected a stable identifier`);
|
|
1650
1650
|
}
|
|
1651
|
-
})(
|
|
1651
|
+
})(isResourceKey(relatedIdentifier)) : {};
|
|
1652
1652
|
if (cache.recordIsLoaded(relatedIdentifier, true)) {
|
|
1653
1653
|
identifiers.push(relatedIdentifier);
|
|
1654
1654
|
}
|
|
@@ -1898,7 +1898,7 @@ class LegacySupport {
|
|
|
1898
1898
|
if (!test) {
|
|
1899
1899
|
throw new Error(`Expected stable identifiers`);
|
|
1900
1900
|
}
|
|
1901
|
-
})(!identifiers || identifiers.every(
|
|
1901
|
+
})(!identifiers || identifiers.every(isResourceKey)) : {};
|
|
1902
1902
|
const req = field.options.linksMode ? {
|
|
1903
1903
|
url: getRelatedLink(resource),
|
|
1904
1904
|
op: 'findHasMany',
|
|
@@ -1933,7 +1933,7 @@ class LegacySupport {
|
|
|
1933
1933
|
if (!test) {
|
|
1934
1934
|
throw new Error(`Expected stable identifiers`);
|
|
1935
1935
|
}
|
|
1936
|
-
})(identifiers.every(
|
|
1936
|
+
})(identifiers.every(isResourceKey)) : {};
|
|
1937
1937
|
options.reload = options.reload || !attemptLocalCache || undefined;
|
|
1938
1938
|
return this.store.request({
|
|
1939
1939
|
op: 'findHasMany',
|
|
@@ -1972,7 +1972,7 @@ class LegacySupport {
|
|
|
1972
1972
|
if (!test) {
|
|
1973
1973
|
throw new Error(`Expected a stable identifier`);
|
|
1974
1974
|
}
|
|
1975
|
-
})(!identifier ||
|
|
1975
|
+
})(!identifier || isResourceKey(identifier)) : {};
|
|
1976
1976
|
const {
|
|
1977
1977
|
isStale,
|
|
1978
1978
|
hasDematerializedInverse,
|
|
@@ -2162,7 +2162,7 @@ function areAllInverseRecordsLoaded(store, resource) {
|
|
|
2162
2162
|
if (!test) {
|
|
2163
2163
|
throw new Error(`Expected stable identifiers`);
|
|
2164
2164
|
}
|
|
2165
|
-
})(identifiers.every(
|
|
2165
|
+
})(identifiers.every(isResourceKey)) : {};
|
|
2166
2166
|
// treat as collection
|
|
2167
2167
|
// check for unloaded records
|
|
2168
2168
|
return identifiers.every(identifier => instanceCache.recordIsLoaded(identifier));
|
|
@@ -2174,7 +2174,7 @@ function areAllInverseRecordsLoaded(store, resource) {
|
|
|
2174
2174
|
if (!test) {
|
|
2175
2175
|
throw new Error(`Expected stable identifiers`);
|
|
2176
2176
|
}
|
|
2177
|
-
})(
|
|
2177
|
+
})(isResourceKey(identifiers)) : {};
|
|
2178
2178
|
return instanceCache.recordIsLoaded(identifiers);
|
|
2179
2179
|
}
|
|
2180
2180
|
function isBelongsTo(relationship) {
|
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-VSxXZooE.js";
|
|
@@ -4,8 +4,8 @@ import { Context } from '@warp-drive/core/reactive/-private';
|
|
|
4
4
|
import { notifyInternalSignal } 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-VSxXZooE.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-BgBPZFfc.js";
|
|
9
9
|
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
10
10
|
|
|
11
11
|
/**
|
package/dist/model.js
CHANGED
|
@@ -4,10 +4,10 @@ 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 { l as lookupLegacySupport } from "./errors-
|
|
7
|
+
import { l as lookupLegacySupport } from "./errors-VSxXZooE.js";
|
|
8
8
|
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-
|
|
9
|
+
import { l as getModelFactory } from "./schema-provider-BgBPZFfc.js";
|
|
10
|
+
export { M as Model, b as buildSchema, M as default, m as restoreDeprecatedModelRequestBehaviors } from "./schema-provider-BgBPZFfc.js";
|
|
11
11
|
import { setOwner, getOwner } from '@ember/application';
|
|
12
12
|
import { setRecordIdentifier, StoreMap } from '@warp-drive/core/store/-private';
|
|
13
13
|
function _attr(type, options) {
|
|
@@ -4,8 +4,8 @@ import EmberObject from '@ember/object';
|
|
|
4
4
|
import { recordIdentifierFor, storeFor } from '@warp-drive/core';
|
|
5
5
|
import { 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-VSxXZooE.js";
|
|
8
|
+
import { u as upgradeStore, F as FetchManager } from "./-private-CVsFOW1k.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';
|
|
@@ -1,7 +1,7 @@
|
|
|
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-CVsFOW1k.js";
|
|
5
5
|
const newline = /\r?\n/;
|
|
6
6
|
function parseResponseHeaders(headersString) {
|
|
7
7
|
const headers = Object.create(null);
|
package/dist/store.js
CHANGED
|
@@ -399,7 +399,7 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
399
399
|
const normalizedId = ensureStringId(id);
|
|
400
400
|
resource = constructResource(type, normalizedId);
|
|
401
401
|
}
|
|
402
|
-
const identifier = this.
|
|
402
|
+
const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resource);
|
|
403
403
|
options = options || {};
|
|
404
404
|
if (options.preload) {
|
|
405
405
|
// force reload if we preload to ensure we don't resolve the promise
|
|
@@ -543,7 +543,7 @@ function restoreDeprecatedStoreBehaviors(StoreKlass) {
|
|
|
543
543
|
throw new Error('getReference expected to receive either a resource identifier or type and id as arguments');
|
|
544
544
|
}
|
|
545
545
|
})(isMaybeIdentifier(resourceIdentifier)) : {};
|
|
546
|
-
const identifier = this.
|
|
546
|
+
const identifier = this.cacheKeyManager.getOrCreateRecordIdentifier(resourceIdentifier);
|
|
547
547
|
const cache = upgradeInstanceCaches(this._instanceCache.__instances).reference;
|
|
548
548
|
let reference = cache.get(identifier);
|
|
549
549
|
if (!reference) {
|
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.15",
|
|
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.15",
|
|
36
|
+
"@warp-drive/utilities": "5.7.0-alpha.15"
|
|
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.15",
|
|
47
|
+
"@warp-drive/core": "5.7.0-alpha.15",
|
|
48
|
+
"@warp-drive/utilities": "5.7.0-alpha.15",
|
|
49
49
|
"ember-source": "~6.3.0",
|
|
50
50
|
"decorator-transforms": "^2.3.0",
|
|
51
51
|
"expect-type": "^1.2.1",
|