@warp-drive/core 5.7.0-alpha.3 → 5.7.0-alpha.31
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/graph/-private/-diff.d.ts +7 -20
- package/declarations/graph/-private/-edge-definition.d.ts +3 -12
- package/declarations/graph/-private/-state.d.ts +2 -2
- package/declarations/graph/-private/-utils.d.ts +5 -5
- package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +3 -3
- package/declarations/graph/-private/edges/collection.d.ts +10 -10
- package/declarations/graph/-private/edges/implicit.d.ts +5 -5
- package/declarations/graph/-private/edges/resource.d.ts +6 -7
- package/declarations/graph/-private/graph.d.ts +17 -15
- package/declarations/graph/-private/operations/replace-related-records.d.ts +4 -4
- package/declarations/graph/-private/operations/update-relationship.d.ts +3 -3
- package/declarations/index.d.ts +1 -1
- package/declarations/reactive/-private/default-mode.d.ts +73 -0
- package/declarations/reactive/-private/document.d.ts +11 -21
- package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +7 -10
- package/declarations/reactive/-private/fields/managed-object.d.ts +7 -9
- package/declarations/reactive/-private/fields/many-array-manager.d.ts +2 -2
- package/declarations/reactive/-private/hooks.d.ts +2 -2
- package/declarations/reactive/-private/kind/alias-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
- package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
- package/declarations/reactive/-private/record.d.ts +44 -33
- package/declarations/reactive/-private/schema.d.ts +16 -72
- package/declarations/reactive/-private/symbols.d.ts +2 -7
- package/declarations/reactive/-private.d.ts +1 -1
- package/declarations/reactive.d.ts +278 -1
- package/declarations/request/-private/context.d.ts +3 -3
- package/declarations/request/-private/fetch.d.ts +2 -0
- package/declarations/request/-private/manager.d.ts +24 -28
- package/declarations/request/-private/types.d.ts +22 -23
- package/declarations/request/-private/utils.d.ts +44 -2
- package/declarations/store/-private/cache-handler/handler.d.ts +2 -8
- package/declarations/store/-private/cache-handler/types.d.ts +10 -10
- package/declarations/store/-private/cache-handler/utils.d.ts +4 -4
- package/declarations/store/-private/caches/instance-cache.d.ts +21 -19
- package/declarations/store/-private/debug/utils.d.ts +1 -0
- package/declarations/store/-private/default-cache-policy.d.ts +25 -38
- package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +24 -15
- package/declarations/store/-private/{caches/identifier-cache.d.ts → managers/cache-key-manager.d.ts} +38 -52
- package/declarations/store/-private/managers/cache-manager.d.ts +47 -95
- package/declarations/store/-private/managers/notification-manager.d.ts +30 -42
- package/declarations/store/-private/managers/record-array-manager.d.ts +45 -41
- package/declarations/store/-private/network/request-cache.d.ts +21 -21
- package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +24 -0
- package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +3 -41
- package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +14 -29
- package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +24 -3
- package/declarations/store/-private/new-core-tmp/request-state.d.ts +129 -22
- package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +51 -123
- package/declarations/store/-private/record-arrays/-utils.d.ts +80 -0
- package/declarations/store/-private/record-arrays/legacy-live-array.d.ts +81 -0
- package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +133 -0
- package/declarations/store/-private/record-arrays/legacy-query.d.ts +81 -0
- package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +1 -124
- package/declarations/store/-private/record-arrays/resource-array.d.ts +75 -0
- package/declarations/store/-private/store-service.d.ts +156 -101
- package/declarations/store/-private.d.ts +12 -9
- package/declarations/store/-types/q/cache-capabilities-manager.d.ts +15 -24
- package/declarations/store/-types/q/identifier.d.ts +9 -6
- package/declarations/store/-types/q/record-instance.d.ts +0 -1
- package/declarations/store/-types/q/schema-service.d.ts +28 -40
- package/declarations/store/-types/q/store.d.ts +6 -7
- package/declarations/store/deprecated/-private.d.ts +12 -23
- package/declarations/store/deprecated/store.d.ts +11 -12
- package/declarations/types/-private.d.ts +1 -1
- package/declarations/types/cache/aliases.d.ts +2 -2
- package/declarations/types/cache/change.d.ts +2 -2
- package/declarations/types/cache/mutations.d.ts +13 -13
- package/declarations/types/cache/operations.d.ts +115 -32
- package/declarations/types/cache/relationship.d.ts +4 -4
- package/declarations/types/cache.d.ts +51 -113
- package/declarations/types/graph.d.ts +12 -12
- package/declarations/types/identifier.d.ts +52 -76
- package/declarations/types/params.d.ts +2 -3
- package/declarations/types/request.d.ts +69 -42
- package/declarations/types/schema/concepts.d.ts +2 -2
- package/declarations/types/schema/fields.d.ts +378 -14
- package/declarations/types/spec/document.d.ts +6 -6
- package/declarations/types/spec/json-api-raw.d.ts +6 -8
- package/declarations/utils/string.d.ts +2 -2
- package/dist/{configure-B48bFHOl.js → configure-C3x8YXzL.js} +5 -5
- package/dist/configure.js +1 -1
- package/dist/{context-COmAnXUQ.js → context-Bh-MA_tH.js} +40 -6
- package/dist/graph/-private.js +137 -144
- package/dist/index.js +25 -14
- package/dist/reactive/-private.js +1 -1
- package/dist/reactive.js +203 -1413
- package/dist/{request-state-CejVJgdj.js → request-state-DGyt5EV8.js} +5674 -2812
- package/dist/request.js +1 -1
- package/dist/store/-private.js +2 -3
- package/dist/store.js +32 -44
- package/dist/{symbols-SIstXMLI.js → symbols-sql1_mdx.js} +3 -8
- package/dist/types/-private.js +1 -1
- package/dist/types/identifier.js +19 -45
- package/dist/types/request.js +45 -3
- package/dist/types/schema/fields.js +23 -2
- package/dist/utils/string.js +2 -2
- package/package.json +10 -10
- package/declarations/reactive/-private/fields/compute.d.ts +0 -43
- package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
- package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
- package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
- package/dist/handler-D2jjnIA-.js +0 -339
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Store } from "../../index.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ResourceKey } from "../../types.js";
|
|
3
3
|
import { ReactiveResource } from "./record.js";
|
|
4
|
-
export declare function instantiateRecord(store: Store, identifier:
|
|
4
|
+
export declare function instantiateRecord(store: Store, identifier: ResourceKey, createArgs?: Record<string, unknown>): ReactiveResource;
|
|
5
5
|
export declare function teardownRecord(record: unknown): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LegacyAliasField, ObjectAliasField, PolarisAliasField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getAliasField(context: KindContext<LegacyAliasField | ObjectAliasField | PolarisAliasField>): unknown;
|
|
4
|
+
export declare function setAliasField(context: KindContext<LegacyAliasField | ObjectAliasField | PolarisAliasField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ArrayField, SchemaArrayField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getArrayField(context: KindContext<ArrayField | SchemaArrayField>): unknown;
|
|
4
|
+
export declare function setArrayField(context: KindContext<ArrayField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LegacyAttributeField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getAttributeField(context: KindContext<LegacyAttributeField>): unknown;
|
|
4
|
+
export declare function setAttributeField(context: KindContext<LegacyAttributeField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LegacyBelongsToField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getBelongsToField(context: KindContext<LegacyBelongsToField>): unknown;
|
|
4
|
+
export declare function setBelongsToField(context: KindContext<LegacyBelongsToField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { CollectionField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getCollectionField(context: KindContext<CollectionField>): unknown;
|
|
4
|
+
export declare function setCollectionField(context: KindContext<CollectionField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DerivedField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getDerivedField(context: KindContext<DerivedField>): unknown;
|
|
4
|
+
export declare function setDerivedField(context: KindContext<DerivedField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { GenericField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getGenericField(context: KindContext<GenericField>): unknown;
|
|
4
|
+
export declare function setGenericField(context: KindContext<GenericField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LegacyHasManyField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getHasManyField(context: KindContext<LegacyHasManyField>): unknown;
|
|
4
|
+
export declare function setHasManyField(context: KindContext<LegacyHasManyField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { HashField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getHashField(context: KindContext<HashField>): unknown;
|
|
4
|
+
export declare function setHashField(context: KindContext<HashField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { IdentityField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getIdentityField(context: KindContext<IdentityField>): unknown;
|
|
4
|
+
export declare function setIdentityField(context: KindContext<IdentityField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LocalField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getLocalField(context: KindContext<LocalField>): unknown;
|
|
4
|
+
export declare function setLocalField(context: KindContext<LocalField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ObjectField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getObjectField(context: KindContext<ObjectField>): unknown;
|
|
4
|
+
export declare function setObjectField(context: KindContext<ObjectField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ResourceField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getResourceField(context: KindContext<ResourceField>): unknown;
|
|
4
|
+
export declare function setResourceField(context: KindContext<ResourceField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SchemaArrayField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export { getArrayField as getSchemaArrayField } from "./array-field.js";
|
|
4
|
+
export declare function setSchemaArrayField(context: KindContext<SchemaArrayField>): boolean;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SchemaObjectField } from "../../../types/schema/fields.js";
|
|
2
|
+
import type { KindContext } from "../default-mode.js";
|
|
3
|
+
export declare function getSchemaObjectField(context: KindContext<SchemaObjectField>): unknown;
|
|
4
|
+
export declare function setSchemaObjectField(context: KindContext<SchemaObjectField>): boolean;
|
|
@@ -1,37 +1,14 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import
|
|
3
|
-
import type { SchemaArrayField, SchemaObjectField } from "../../types/schema/fields.js";
|
|
4
|
-
import { RecordStore } from "../../types/symbols.js";
|
|
5
|
-
import { Checkout, Destroy, Editable, EmbeddedField, EmbeddedPath, Identifier, Legacy, Parent } from "./symbols.js";
|
|
6
|
-
export { Editable, Legacy, Checkout } from "./symbols.js";
|
|
1
|
+
import type { ObjectContext, ResourceContext } from "./default-mode.js";
|
|
2
|
+
import { Checkout } from "./symbols.js";
|
|
7
3
|
export interface ReactiveResource {
|
|
8
|
-
[Symbol.toStringTag]: `ReactiveResource<${string}>`;
|
|
9
|
-
/** @internal */
|
|
10
|
-
[RecordStore]: Store;
|
|
11
|
-
/** @internal */
|
|
12
|
-
[Identifier]: StableRecordIdentifier;
|
|
13
|
-
/** @internal */
|
|
14
|
-
[Parent]: StableRecordIdentifier;
|
|
15
|
-
/** @internal */
|
|
16
|
-
[EmbeddedField]: SchemaArrayField | SchemaObjectField | null;
|
|
17
|
-
/** @internal */
|
|
18
|
-
[EmbeddedPath]: string[] | null;
|
|
19
|
-
/** @internal */
|
|
20
|
-
[Editable]: boolean;
|
|
21
|
-
/** @internal */
|
|
22
|
-
[Legacy]: boolean;
|
|
23
|
-
/** @internal */
|
|
24
|
-
___notifications: object;
|
|
25
|
-
/** @internal */
|
|
26
|
-
[Destroy](): void;
|
|
27
4
|
/**
|
|
28
5
|
* Create an editable copy of the record
|
|
29
6
|
*
|
|
30
7
|
* ReactiveResource instances are not editable by default. This method creates an editable copy of the record. To use,
|
|
31
|
-
* import the `Checkout` symbol from `@warp-drive/
|
|
8
|
+
* import the `Checkout` symbol from `@warp-drive/core/reactive` and call it on the record.
|
|
32
9
|
*
|
|
33
10
|
* ```ts
|
|
34
|
-
* import { Checkout } from '@warp-drive/
|
|
11
|
+
* import { Checkout } from '@warp-drive/core/reactive';
|
|
35
12
|
*
|
|
36
13
|
* const record = store.peekRecord('user', '1');
|
|
37
14
|
* const editableRecord = await record[Checkout]();
|
|
@@ -39,13 +16,13 @@ export interface ReactiveResource {
|
|
|
39
16
|
*
|
|
40
17
|
* @returns a promise that resolves to the editable record
|
|
41
18
|
* @throws if the record is already editable or if the record is embedded
|
|
42
|
-
*
|
|
19
|
+
* @private
|
|
43
20
|
*/
|
|
44
21
|
[Checkout]<T>(): Promise<T>;
|
|
45
22
|
}
|
|
46
23
|
/**
|
|
47
24
|
* A class that uses a the ResourceSchema for a ResourceType
|
|
48
|
-
* and a
|
|
25
|
+
* and a ResourceKey to transform data from the cache into a rich, reactive
|
|
49
26
|
* object.
|
|
50
27
|
*
|
|
51
28
|
* This class is not directly instantiable. To use it, you should
|
|
@@ -57,8 +34,42 @@ export interface ReactiveResource {
|
|
|
57
34
|
*/
|
|
58
35
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
59
36
|
export declare class ReactiveResource {
|
|
60
|
-
constructor(
|
|
61
|
-
[Editable]: boolean;
|
|
62
|
-
[Legacy]: boolean;
|
|
63
|
-
}, isEmbedded?: boolean, embeddedField?: SchemaArrayField | SchemaObjectField | null, embeddedPath?: string[] | null);
|
|
37
|
+
constructor(context: ResourceContext | ObjectContext);
|
|
64
38
|
}
|
|
39
|
+
export declare function _CHECKOUT(record: ReactiveResource): ReactiveResource;
|
|
40
|
+
/**
|
|
41
|
+
* Checkout an immutable resource for editing.
|
|
42
|
+
*
|
|
43
|
+
* {@link ReactiveResource | ReactiveResources} are not editable by default. This method
|
|
44
|
+
* creates an editable copy of the resource.
|
|
45
|
+
*
|
|
46
|
+
* This returns a promise which resolves with the editable
|
|
47
|
+
* version of the resource.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { checkout } from '@warp-drive/core/reactive';
|
|
51
|
+
*
|
|
52
|
+
* const immutable = store.peekRecord('user', '1');
|
|
53
|
+
* const editable = await checkout(immutable);
|
|
54
|
+
* ```
|
|
55
|
+
*
|
|
56
|
+
* Edits to editable resources will be automatically committed if a new
|
|
57
|
+
* payload from the cache matches their existing value.
|
|
58
|
+
*
|
|
59
|
+
* @public
|
|
60
|
+
*
|
|
61
|
+
* @returns a promise that resolves to the editable resource
|
|
62
|
+
* @throws if the resource is already editable or if resource is an embedded object
|
|
63
|
+
*/
|
|
64
|
+
export declare function checkout<T>(resource: unknown): Promise<T & ReactiveResource>;
|
|
65
|
+
/**
|
|
66
|
+
* Forcibly commit all local changes on an editable resource to
|
|
67
|
+
* the remote (immutable) version.
|
|
68
|
+
*
|
|
69
|
+
* This API should only be used cautiously. Typically a better
|
|
70
|
+
* approach is for either the API or a Handler to reflect saved
|
|
71
|
+
* changes back to update the cache.
|
|
72
|
+
*
|
|
73
|
+
* @public
|
|
74
|
+
*/
|
|
75
|
+
export declare function commit(record: ReactiveResource): Promise<void>;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Store } from "../../store/-private.js";
|
|
2
1
|
import type { SchemaService as SchemaServiceInterface } from "../../types.js";
|
|
3
|
-
import type {
|
|
2
|
+
import type { ResourceKey } from "../../types/identifier.js";
|
|
4
3
|
import type { ObjectValue, Value } from "../../types/json/raw.js";
|
|
5
4
|
import type { Derivation, HashFn } from "../../types/schema/concepts.js";
|
|
6
|
-
import { type ArrayField, type DerivedField, type FieldSchema, type GenericField, type HashField, type
|
|
5
|
+
import { type ArrayField, type CacheableFieldSchema, type DerivedField, type FieldSchema, type GenericField, type HashField, type IdentityField, type LegacyAttributeField, type LegacyRelationshipField, type ObjectField, type ObjectSchema, type PolarisResourceSchema, type ResourceSchema, type Trait } from "../../types/schema/fields.js";
|
|
7
6
|
import { Type } from "../../types/symbols.js";
|
|
8
7
|
import type { WithPartial } from "../../types/utils.js";
|
|
9
8
|
import type { ReactiveResource } from "./record.js";
|
|
@@ -95,11 +94,11 @@ interface FromIdentityDerivation {
|
|
|
95
94
|
}, key: string): string | null;
|
|
96
95
|
(record: ReactiveResource, options: {
|
|
97
96
|
key: "^";
|
|
98
|
-
}, key: string):
|
|
97
|
+
}, key: string): ResourceKey;
|
|
99
98
|
(record: ReactiveResource, options: null, key: string): asserts options;
|
|
100
99
|
(record: ReactiveResource, options: {
|
|
101
100
|
key: "id" | "lid" | "type" | "^";
|
|
102
|
-
} | null, key: string):
|
|
101
|
+
} | null, key: string): ResourceKey | string | null;
|
|
103
102
|
[Type]: "@identity";
|
|
104
103
|
}
|
|
105
104
|
/**
|
|
@@ -133,7 +132,6 @@ export declare const fromIdentity: FromIdentityDerivation;
|
|
|
133
132
|
* ```
|
|
134
133
|
*
|
|
135
134
|
* @public
|
|
136
|
-
* @param {SchemaService} schema
|
|
137
135
|
*/
|
|
138
136
|
export declare function registerDerivations(schema: SchemaServiceInterface): void;
|
|
139
137
|
interface InternalSchema {
|
|
@@ -141,6 +139,7 @@ interface InternalSchema {
|
|
|
141
139
|
finalized: boolean;
|
|
142
140
|
traits: Set<string>;
|
|
143
141
|
fields: Map<string, FieldSchema>;
|
|
142
|
+
cacheFields: Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
144
143
|
attributes: Record<string, LegacyAttributeField>;
|
|
145
144
|
relationships: Record<string, LegacyRelationshipField>;
|
|
146
145
|
}
|
|
@@ -150,20 +149,9 @@ export type Transformation<
|
|
|
150
149
|
> = {
|
|
151
150
|
serialize(value: PT, options: Record<string, unknown> | null, record: ReactiveResource): T;
|
|
152
151
|
hydrate(value: T | undefined, options: Record<string, unknown> | null, record: ReactiveResource): PT;
|
|
153
|
-
defaultValue?(options: Record<string, unknown> | null, identifier:
|
|
152
|
+
defaultValue?(options: Record<string, unknown> | null, identifier: ResourceKey): T;
|
|
154
153
|
[Type]: string;
|
|
155
154
|
};
|
|
156
|
-
interface KindFns {
|
|
157
|
-
belongsTo: {
|
|
158
|
-
get: (store: Store, record: object, resourceKey: StableRecordIdentifier, field: LegacyBelongsToField) => unknown;
|
|
159
|
-
set: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyBelongsToField, value: unknown) => void;
|
|
160
|
-
};
|
|
161
|
-
hasMany: {
|
|
162
|
-
get: (store: Store, record: object, resourceKey: StableRecordIdentifier, field: LegacyHasManyField) => unknown;
|
|
163
|
-
set: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyHasManyField, value: unknown) => void;
|
|
164
|
-
notify: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyHasManyField) => boolean;
|
|
165
|
-
};
|
|
166
|
-
}
|
|
167
155
|
export interface SchemaService {
|
|
168
156
|
doesTypeExist(type: string): boolean;
|
|
169
157
|
attributesDefinitionFor(identifier: {
|
|
@@ -173,45 +161,16 @@ export interface SchemaService {
|
|
|
173
161
|
type: string;
|
|
174
162
|
}): InternalSchema["relationships"];
|
|
175
163
|
}
|
|
176
|
-
interface InternalTrait {
|
|
177
|
-
name: string;
|
|
178
|
-
mode: "legacy" | "polaris";
|
|
179
|
-
fields: Map<string, FieldSchema>;
|
|
180
|
-
traits: string[];
|
|
181
|
-
}
|
|
182
164
|
/**
|
|
183
165
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
184
166
|
*
|
|
185
|
-
* @class SchemaService
|
|
186
167
|
* @public
|
|
187
168
|
*/
|
|
188
169
|
export declare class SchemaService implements SchemaServiceInterface {
|
|
189
|
-
/** @internal */
|
|
190
|
-
_schemas: Map<string, InternalSchema>;
|
|
191
|
-
/** @internal */
|
|
192
|
-
_transforms: Map<string, Transformation>;
|
|
193
|
-
/** @internal */
|
|
194
|
-
_hashFns: Map<string, HashFn>;
|
|
195
|
-
/** @internal */
|
|
196
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
197
|
-
_derivations: Map<string, Derivation<any, any, any>>;
|
|
198
|
-
/** @internal */
|
|
199
|
-
_traits: Map<string, InternalTrait>;
|
|
200
|
-
/** @internal */
|
|
201
|
-
_modes: Map<string, KindFns>;
|
|
202
|
-
/** @internal */
|
|
203
|
-
_extensions: {
|
|
204
|
-
object: Map<string, ProcessedExtension>;
|
|
205
|
-
array: Map<string, ProcessedExtension>;
|
|
206
|
-
};
|
|
207
|
-
_cachedFieldExtensionsByField: {
|
|
208
|
-
object: Map<object, ProcessedExtension["features"] | null>;
|
|
209
|
-
array: Map<object, ProcessedExtension["features"] | null>;
|
|
210
|
-
};
|
|
211
170
|
constructor();
|
|
212
171
|
resourceTypes(): Readonly<string[]>;
|
|
213
172
|
hasTrait(type: string): boolean;
|
|
214
|
-
resourceHasTrait(resource:
|
|
173
|
+
resourceHasTrait(resource: ResourceKey | {
|
|
215
174
|
type: string;
|
|
216
175
|
}, trait: string): boolean;
|
|
217
176
|
transformation(field: GenericField | ObjectField | ArrayField | {
|
|
@@ -223,7 +182,7 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
223
182
|
hashFn(field: HashField | {
|
|
224
183
|
type: string;
|
|
225
184
|
}): HashFn;
|
|
226
|
-
resource(resource:
|
|
185
|
+
resource(resource: ResourceKey | {
|
|
227
186
|
type: string;
|
|
228
187
|
}): ResourceSchema | ObjectSchema;
|
|
229
188
|
registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
|
|
@@ -267,43 +226,28 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
267
226
|
FM extends ObjectValue | null
|
|
268
227
|
>(derivation: Derivation<R, T, FM>): void;
|
|
269
228
|
CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
270
|
-
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource:
|
|
229
|
+
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: ResourceKey | {
|
|
271
230
|
type: string;
|
|
272
231
|
}): null | ProcessedExtension["features"];
|
|
273
|
-
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
232
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
274
233
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
275
234
|
CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: {
|
|
276
235
|
kind: "object" | "array";
|
|
277
236
|
name: string;
|
|
278
237
|
}): boolean;
|
|
279
238
|
/**
|
|
280
|
-
*
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
* We do think a generalized `kind` registration system would be useful,
|
|
284
|
-
* but we have not yet designed it.
|
|
239
|
+
* Registers a {@link HashFn} for use with a {@link HashField} for
|
|
240
|
+
* either {@link ObjectSchema} identity or polymorphic type calculation.
|
|
285
241
|
*
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
* @internal
|
|
289
|
-
*/
|
|
290
|
-
_registerMode(mode: string, kinds: KindFns): void;
|
|
291
|
-
/**
|
|
292
|
-
* This is an internal method used to enable legacy behaviors for legacy mode.
|
|
293
|
-
* It is not intended for public use.
|
|
294
|
-
*
|
|
295
|
-
* We do think a generalized `kind` registration system would be useful,
|
|
296
|
-
* but we have not yet designed it.
|
|
297
|
-
*
|
|
298
|
-
* See https://github.com/emberjs/data/issues/9534
|
|
299
|
-
*
|
|
300
|
-
* @internal
|
|
242
|
+
* @public
|
|
301
243
|
*/
|
|
302
|
-
_kind<T extends keyof KindFns>(mode: string, kind: T): KindFns[T];
|
|
303
244
|
registerHashFn<T extends object>(hashFn: HashFn<T>): void;
|
|
304
245
|
fields({ type }: {
|
|
305
246
|
type: string;
|
|
306
247
|
}): InternalSchema["fields"];
|
|
248
|
+
cacheFields({ type }: {
|
|
249
|
+
type: string;
|
|
250
|
+
}): InternalSchema["cacheFields"];
|
|
307
251
|
hasResource(resource: {
|
|
308
252
|
type: string;
|
|
309
253
|
}): boolean;
|
|
@@ -25,12 +25,7 @@
|
|
|
25
25
|
// Note that none of these symbols are part of the public API, these are used for
|
|
26
26
|
// debugging DX and as a safe way to provide an intimate contract on public objects.
|
|
27
27
|
export declare const SOURCE: "___(unique) Symbol(SOURCE)";
|
|
28
|
-
export declare const MUTATE: "___(unique) Symbol(MUTATE)";
|
|
29
28
|
export declare const Destroy: "___(unique) Symbol(Destroy)";
|
|
30
|
-
export declare const Identifier: "___(unique) Symbol(Identifier)";
|
|
31
|
-
export declare const Editable: "___(unique) Symbol(Editable)";
|
|
32
|
-
export declare const Parent: "___(unique) Symbol(Parent)";
|
|
33
29
|
export declare const Checkout: "___(unique) Symbol(Checkout)";
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const EmbeddedField: "___(unique) Symbol(EmbeddedField)";
|
|
30
|
+
export declare const Commit: "___(unique) Symbol(Commit)";
|
|
31
|
+
export declare const Context: "___(unique) Symbol(Context)";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { Context } from "./-private/symbols.js";
|