@warp-drive/core 5.7.0-alpha.0 → 5.7.0-alpha.10
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/reactive/-private/default-mode.d.ts +73 -0
- package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
- package/declarations/reactive/-private/fields/managed-array.d.ts +3 -5
- package/declarations/reactive/-private/fields/managed-object.d.ts +5 -3
- 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 +2 -4
- package/declarations/reactive/-private/schema.d.ts +47 -3
- package/declarations/reactive.d.ts +1 -0
- package/declarations/request/-private/fetch.d.ts +2 -0
- package/declarations/store/-private/caches/instance-cache.d.ts +1 -8
- package/declarations/store/-private/store-service.d.ts +17 -777
- package/declarations/store/-private.d.ts +3 -2
- package/declarations/store/-types/q/schema-service.d.ts +56 -32
- package/declarations/store/-types/q/store.d.ts +6 -7
- package/declarations/store/deprecated/-private.d.ts +235 -0
- package/declarations/store/deprecated/store.d.ts +788 -0
- package/declarations/types/cache.d.ts +0 -2
- package/declarations/types/params.d.ts +2 -3
- package/declarations/types/request.d.ts +6 -6
- package/declarations/types/schema/fields.d.ts +361 -11
- package/declarations/types.d.ts +2 -1
- package/dist/graph/-private.js +1 -1
- package/dist/{handler-C2T-IyJK.js → handler-SdXlte1w.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/reactive.js +1287 -589
- package/dist/{request-state-CjLph1LP.js → request-state-CeN66aML.js} +851 -1346
- package/dist/store/-private.js +2 -2
- package/dist/types/-private.js +1 -1
- package/dist/types/schema/fields.js +17 -2
- package/package.json +3 -3
- package/declarations/reactive/-private/fields/compute.d.ts +0 -43
- package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
- package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
- package/declarations/store/-types/q/ds-model.d.ts +0 -21
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Store } from "../../store/-private.js";
|
|
2
|
+
import type { SignalStore } from "../../store/-private/new-core-tmp/reactivity/internal.js";
|
|
3
|
+
import type { StableRecordIdentifier } from "../../types.js";
|
|
4
|
+
import type { FieldSchema, HashField, IdentityField, SchemaArrayField, SchemaObjectField } from "../../types/schema/fields.js";
|
|
5
|
+
import type { ReactiveResource } from "./record.js";
|
|
6
|
+
export type PathLike = string | symbol | Array<string | symbol>;
|
|
7
|
+
export type ModeName = "polaris" | "legacy";
|
|
8
|
+
export interface ModeInfo {
|
|
9
|
+
name: ModeName;
|
|
10
|
+
legacy: boolean;
|
|
11
|
+
editable: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface BaseContext {
|
|
14
|
+
store: Store;
|
|
15
|
+
resourceKey: StableRecordIdentifier;
|
|
16
|
+
modeName: ModeName;
|
|
17
|
+
legacy: boolean;
|
|
18
|
+
editable: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface ResourceContext extends BaseContext {
|
|
21
|
+
path: null;
|
|
22
|
+
field: null;
|
|
23
|
+
value: null;
|
|
24
|
+
}
|
|
25
|
+
export interface ObjectContext extends BaseContext {
|
|
26
|
+
path: string[];
|
|
27
|
+
field: SchemaObjectField | SchemaArrayField;
|
|
28
|
+
value: string;
|
|
29
|
+
}
|
|
30
|
+
export interface KindContext<T extends FieldSchema | IdentityField | HashField> extends BaseContext {
|
|
31
|
+
path: string[];
|
|
32
|
+
field: T;
|
|
33
|
+
value: unknown;
|
|
34
|
+
record: ReactiveResource;
|
|
35
|
+
signals: SignalStore;
|
|
36
|
+
}
|
|
37
|
+
export interface KindImpl<T extends FieldSchema | IdentityField | HashField> {
|
|
38
|
+
/**
|
|
39
|
+
* A function which produces the value for the field when invoked.
|
|
40
|
+
*/
|
|
41
|
+
get: (context: KindContext<T>) => unknown;
|
|
42
|
+
/**
|
|
43
|
+
* A function which updates the value for the field when invoked.
|
|
44
|
+
*
|
|
45
|
+
* This will never be invoked when the record is in a non-editable mode.
|
|
46
|
+
*
|
|
47
|
+
* This should assert in dev and return false if mutation is not allowed.
|
|
48
|
+
*/
|
|
49
|
+
set: (context: KindContext<T>) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether this field is ever mutable (writable). This should be
|
|
52
|
+
* if there is ever a scenario in which the field can be written
|
|
53
|
+
* and false only if the field can never be written to.
|
|
54
|
+
*/
|
|
55
|
+
mutable: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether this field's of this kind should be included in the
|
|
58
|
+
* enumerated (iterable) keys of the record/object instance.
|
|
59
|
+
*
|
|
60
|
+
* This should generally be true except for fields that are not
|
|
61
|
+
* producing a value backed by the cache. For instance, locals
|
|
62
|
+
* should not be enumerable, as their value is not tied to the
|
|
63
|
+
* cache at all.
|
|
64
|
+
*/
|
|
65
|
+
enumerable: boolean;
|
|
66
|
+
/**
|
|
67
|
+
*
|
|
68
|
+
*/
|
|
69
|
+
serializable: boolean;
|
|
70
|
+
}
|
|
71
|
+
type Mode = { [Field in FieldSchema | IdentityField | HashField as Field["kind"]] : KindImpl<Field> };
|
|
72
|
+
export declare const DefaultMode: Mode;
|
|
73
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CacheableFieldSchema, FieldSchema, HashField, IdentityField } from "../../../types/schema/fields.js";
|
|
2
|
+
type InvalidKind = "alias" | "derived" | "@local";
|
|
3
|
+
export declare function isInvalidKind(kind: string): kind is InvalidKind;
|
|
4
|
+
export declare function isNonIdentityCacheableField(field: FieldSchema | IdentityField | HashField): field is Exclude<CacheableFieldSchema, IdentityField>;
|
|
5
|
+
export declare function getFieldCacheKeyStrict(field: CacheableFieldSchema): string;
|
|
6
|
+
export declare function getFieldCacheKey(field: FieldSchema | IdentityField | HashField): string | null;
|
|
7
|
+
export declare function assertIsCacheField(field: FieldSchema | IdentityField): asserts field is CacheableFieldSchema;
|
|
8
|
+
export {};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import type { Store } from "../../../index.js";
|
|
2
1
|
import type { WarpDriveSignal } from "../../../store/-private.js";
|
|
3
2
|
import { ARRAY_SIGNAL } from "../../../store/-private.js";
|
|
4
|
-
import type { Cache } from "../../../types/cache.js";
|
|
5
3
|
import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
6
4
|
import type { ArrayField, SchemaArrayField } from "../../../types/schema/fields.js";
|
|
5
|
+
import type { KindContext } from "../default-mode.js";
|
|
7
6
|
import { ReactiveResource } from "../record.js";
|
|
8
|
-
import type { SchemaService } from "../schema.js";
|
|
9
7
|
import { Editable, Legacy, SOURCE } from "../symbols.js";
|
|
10
8
|
export interface ManagedArray extends Omit<Array<unknown>, "[]"> {
|
|
11
9
|
[SOURCE]: unknown[];
|
|
12
10
|
identifier: StableRecordIdentifier;
|
|
13
|
-
path: string[];
|
|
11
|
+
path: string | string[];
|
|
14
12
|
owner: ReactiveResource;
|
|
15
13
|
[ARRAY_SIGNAL]: WarpDriveSignal;
|
|
16
14
|
[Editable]: boolean;
|
|
@@ -18,5 +16,5 @@ export interface ManagedArray extends Omit<Array<unknown>, "[]"> {
|
|
|
18
16
|
}
|
|
19
17
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
20
18
|
export declare class ManagedArray {
|
|
21
|
-
constructor(
|
|
19
|
+
constructor(context: KindContext<SchemaArrayField | ArrayField>, owner: ReactiveResource, data: unknown[]);
|
|
22
20
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { OBJECT_SIGNAL, type WarpDriveSignal } from "../../../store/-private.js";
|
|
2
|
-
import type { Cache } from "../../../types/cache.js";
|
|
3
2
|
import type { StableRecordIdentifier } from "../../../types/identifier.js";
|
|
4
3
|
import type { ObjectField, SchemaObjectField } from "../../../types/schema/fields.js";
|
|
4
|
+
import type { KindContext } from "../default-mode.js";
|
|
5
5
|
import type { ReactiveResource } from "../record.js";
|
|
6
|
-
import type { SchemaService } from "../schema.js";
|
|
7
6
|
import { Editable, EmbeddedPath, Legacy, Parent, SOURCE } from "../symbols.js";
|
|
8
7
|
export declare function notifyObject(obj: ManagedObject): void;
|
|
9
8
|
// const ignoredGlobalFields = new Set<string>(['setInterval', 'nodeType', 'nodeName', 'length', 'document', STRUCTURED]);
|
|
@@ -17,5 +16,8 @@ export interface ManagedObject {
|
|
|
17
16
|
}
|
|
18
17
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
19
18
|
export declare class ManagedObject {
|
|
20
|
-
constructor(
|
|
19
|
+
constructor(context: KindContext<ObjectField>);
|
|
21
20
|
}
|
|
21
|
+
export declare const ManagedObjectMap: Map<ReactiveResource, Map<string, ManagedObject | ReactiveResource>>;
|
|
22
|
+
export declare function peekManagedObject(record: ReactiveResource, field: ObjectField): ManagedObject | undefined;
|
|
23
|
+
export declare function peekManagedObject(record: ReactiveResource, field: SchemaObjectField): ReactiveResource | undefined;
|
|
@@ -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;
|
|
@@ -2,6 +2,7 @@ import type { Store } from "../../index.js";
|
|
|
2
2
|
import type { StableRecordIdentifier } from "../../types/identifier.js";
|
|
3
3
|
import type { SchemaArrayField, SchemaObjectField } from "../../types/schema/fields.js";
|
|
4
4
|
import { RecordStore } from "../../types/symbols.js";
|
|
5
|
+
import type { ObjectContext, ResourceContext } from "./default-mode.js";
|
|
5
6
|
import { Checkout, Destroy, Editable, EmbeddedField, EmbeddedPath, Identifier, Legacy, Parent } from "./symbols.js";
|
|
6
7
|
export { Editable, Legacy, Checkout } from "./symbols.js";
|
|
7
8
|
export interface ReactiveResource {
|
|
@@ -57,8 +58,5 @@ export interface ReactiveResource {
|
|
|
57
58
|
*/
|
|
58
59
|
// eslint-disable-next-line @typescript-eslint/no-extraneous-class
|
|
59
60
|
export declare class ReactiveResource {
|
|
60
|
-
constructor(
|
|
61
|
-
[Editable]: boolean;
|
|
62
|
-
[Legacy]: boolean;
|
|
63
|
-
}, isEmbedded?: boolean, embeddedField?: SchemaArrayField | SchemaObjectField | null, embeddedPath?: string[] | null);
|
|
61
|
+
constructor(context: ResourceContext | ObjectContext);
|
|
64
62
|
}
|
|
@@ -3,7 +3,7 @@ import type { SchemaService as SchemaServiceInterface } from "../../types.js";
|
|
|
3
3
|
import type { StableRecordIdentifier } from "../../types/identifier.js";
|
|
4
4
|
import type { ObjectValue, Value } from "../../types/json/raw.js";
|
|
5
5
|
import type { Derivation, HashFn } from "../../types/schema/concepts.js";
|
|
6
|
-
import { type ArrayField, type DerivedField, type FieldSchema, type GenericField, type HashField, type LegacyAttributeField, type LegacyBelongsToField, type LegacyHasManyField, type LegacyRelationshipField, type ObjectField, type ObjectSchema, type PolarisResourceSchema, type ResourceSchema } from "../../types/schema/fields.js";
|
|
6
|
+
import { type ArrayField, type CacheableFieldSchema, type DerivedField, type FieldSchema, type GenericField, type HashField, type IdentityField, type LegacyAttributeField, type LegacyBelongsToField, type LegacyHasManyField, type LegacyRelationshipField, type ObjectField, type ObjectSchema, type PolarisResourceSchema, type ResourceSchema, type Trait } from "../../types/schema/fields.js";
|
|
7
7
|
import { Type } from "../../types/symbols.js";
|
|
8
8
|
import type { WithPartial } from "../../types/utils.js";
|
|
9
9
|
import type { ReactiveResource } from "./record.js";
|
|
@@ -138,8 +138,10 @@ export declare const fromIdentity: FromIdentityDerivation;
|
|
|
138
138
|
export declare function registerDerivations(schema: SchemaServiceInterface): void;
|
|
139
139
|
interface InternalSchema {
|
|
140
140
|
original: ResourceSchema | ObjectSchema;
|
|
141
|
+
finalized: boolean;
|
|
141
142
|
traits: Set<string>;
|
|
142
143
|
fields: Map<string, FieldSchema>;
|
|
144
|
+
cacheFields: Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
143
145
|
attributes: Record<string, LegacyAttributeField>;
|
|
144
146
|
relationships: Record<string, LegacyRelationshipField>;
|
|
145
147
|
}
|
|
@@ -172,6 +174,12 @@ export interface SchemaService {
|
|
|
172
174
|
type: string;
|
|
173
175
|
}): InternalSchema["relationships"];
|
|
174
176
|
}
|
|
177
|
+
interface InternalTrait {
|
|
178
|
+
name: string;
|
|
179
|
+
mode: "legacy" | "polaris";
|
|
180
|
+
fields: Map<string, FieldSchema>;
|
|
181
|
+
traits: string[];
|
|
182
|
+
}
|
|
175
183
|
/**
|
|
176
184
|
* A SchemaService designed to work with dynamically registered schemas.
|
|
177
185
|
*
|
|
@@ -189,7 +197,7 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
189
197
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
190
198
|
_derivations: Map<string, Derivation<any, any, any>>;
|
|
191
199
|
/** @internal */
|
|
192
|
-
_traits:
|
|
200
|
+
_traits: Map<string, InternalTrait>;
|
|
193
201
|
/** @internal */
|
|
194
202
|
_modes: Map<string, KindFns>;
|
|
195
203
|
/** @internal */
|
|
@@ -221,6 +229,35 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
221
229
|
}): ResourceSchema | ObjectSchema;
|
|
222
230
|
registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
|
|
223
231
|
registerResource(schema: ResourceSchema | ObjectSchema): void;
|
|
232
|
+
/**
|
|
233
|
+
* Registers a {@link Trait} for use by resource schemas.
|
|
234
|
+
*
|
|
235
|
+
* Traits are re-usable collections of fields that can be composed to
|
|
236
|
+
* build up a resource schema. Often they represent polymorphic behaviors
|
|
237
|
+
* a resource should exhibit.
|
|
238
|
+
*
|
|
239
|
+
* When we finalize a resource, we walk its traits and apply their fields
|
|
240
|
+
* to the resource's fields. All specified traits must be registered by
|
|
241
|
+
* this time or an error will be thrown.
|
|
242
|
+
*
|
|
243
|
+
* Traits are applied left-to-right, with traits of traits being applied in the same
|
|
244
|
+
* way. Thus for the most part, application of traits is a post-order graph traversal
|
|
245
|
+
* problem.
|
|
246
|
+
*
|
|
247
|
+
* A trait is only ever processed once. If multiple traits (A, B, C) have the same
|
|
248
|
+
* trait (D) as a dependency, D will be included only once when first encountered by
|
|
249
|
+
* A.
|
|
250
|
+
*
|
|
251
|
+
* If a cycle exists such that trait A has trait B which has Trait A, trait A will
|
|
252
|
+
* be applied *after* trait B in production. In development a cycle error will be thrown.
|
|
253
|
+
*
|
|
254
|
+
* Fields are finalized on a "last wins principle". Thus traits appearing higher in
|
|
255
|
+
* the tree and further to the right of a traits array take precedence, with the
|
|
256
|
+
* resource's fields always being applied last and winning out.
|
|
257
|
+
*
|
|
258
|
+
* @public
|
|
259
|
+
*/
|
|
260
|
+
registerTrait(trait: Trait): void;
|
|
224
261
|
registerTransformation<
|
|
225
262
|
T extends Value = string,
|
|
226
263
|
PT = unknown
|
|
@@ -234,8 +271,12 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
234
271
|
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: StableRecordIdentifier | {
|
|
235
272
|
type: string;
|
|
236
273
|
}): null | ProcessedExtension["features"];
|
|
237
|
-
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
274
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
238
275
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
276
|
+
CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: {
|
|
277
|
+
kind: "object" | "array";
|
|
278
|
+
name: string;
|
|
279
|
+
}): boolean;
|
|
239
280
|
/**
|
|
240
281
|
* This is an internal method used to register behaviors for legacy mode.
|
|
241
282
|
* It is not intended for public use.
|
|
@@ -264,6 +305,9 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
264
305
|
fields({ type }: {
|
|
265
306
|
type: string;
|
|
266
307
|
}): InternalSchema["fields"];
|
|
308
|
+
cacheFields({ type }: {
|
|
309
|
+
type: string;
|
|
310
|
+
}): InternalSchema["cacheFields"];
|
|
267
311
|
hasResource(resource: {
|
|
268
312
|
type: string;
|
|
269
313
|
}): boolean;
|
|
@@ -2,3 +2,4 @@ export { instantiateRecord, teardownRecord } from "./reactive/-private/hooks.js"
|
|
|
2
2
|
export { type CAUTION_MEGA_DANGER_ZONE_Extension, type ProcessedExtension, type ExtensionDef, type Transformation, SchemaService, withDefaults, fromIdentity, registerDerivations } from "./reactive/-private/schema.js";
|
|
3
3
|
export { type ReactiveResource } from "./reactive/-private/record.js";
|
|
4
4
|
export { Checkout } from "./reactive/-private/symbols.js";
|
|
5
|
+
export { type ReactiveDocument } from "./reactive/-private/document.js";
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { ReactiveDocument } from "../../../reactive/-private/document.js";
|
|
2
2
|
import type { Cache } from "../../../types/cache.js";
|
|
3
3
|
import type { StableDocumentIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
|
|
4
|
-
import type { Value } from "../../../types/json/raw.js";
|
|
5
4
|
import type { TypedRecordInstance, TypeFromInstance } from "../../../types/record.js";
|
|
6
5
|
import type { OpaqueRecordInstance } from "../../-types/q/record-instance.js";
|
|
7
|
-
import RecordReference from "../legacy-model-support/record-reference.js";
|
|
8
6
|
import { CacheCapabilitiesManager } from "../managers/cache-capabilities-manager.js";
|
|
9
7
|
import type { CacheManager } from "../managers/cache-manager.js";
|
|
10
8
|
import type { CreateRecordProperties, Store } from "../store-service.js";
|
|
@@ -36,9 +34,8 @@ export declare const StoreMap: Map<unknown, Store>;
|
|
|
36
34
|
* @internal
|
|
37
35
|
*/
|
|
38
36
|
export declare function storeFor(record: OpaqueRecordInstance): Store | undefined;
|
|
39
|
-
type Caches = {
|
|
37
|
+
export type Caches = {
|
|
40
38
|
record: Map<StableRecordIdentifier, OpaqueRecordInstance>;
|
|
41
|
-
reference: WeakMap<StableRecordIdentifier, RecordReference>;
|
|
42
39
|
document: Map<StableDocumentIdentifier, ReactiveDocument<OpaqueRecordInstance | OpaqueRecordInstance[] | null | undefined>>;
|
|
43
40
|
};
|
|
44
41
|
export declare class InstanceCache {
|
|
@@ -51,7 +48,6 @@ export declare class InstanceCache {
|
|
|
51
48
|
peek(identifier: StableRecordIdentifier): Cache | OpaqueRecordInstance | undefined;
|
|
52
49
|
getDocument<T>(identifier: StableDocumentIdentifier): ReactiveDocument<T>;
|
|
53
50
|
getRecord(identifier: StableRecordIdentifier, properties?: CreateRecordProperties): OpaqueRecordInstance;
|
|
54
|
-
getReference(identifier: StableRecordIdentifier): RecordReference;
|
|
55
51
|
recordIsLoaded(identifier: StableRecordIdentifier, filterDeleted?: boolean): boolean;
|
|
56
52
|
disconnect(identifier: StableRecordIdentifier): void;
|
|
57
53
|
unloadRecord(identifier: StableRecordIdentifier): void;
|
|
@@ -59,7 +55,4 @@ export declare class InstanceCache {
|
|
|
59
55
|
// TODO this should move into something coordinating operations
|
|
60
56
|
setRecordId(identifier: StableRecordIdentifier, id: string): void;
|
|
61
57
|
}
|
|
62
|
-
export declare function resourceIsFullyDeleted(instanceCache: InstanceCache, identifier: StableRecordIdentifier): boolean;
|
|
63
|
-
export declare function preloadData(store: Store, identifier: StableRecordIdentifier, preload: Record<string, Value>): void;
|
|
64
58
|
export declare function _clearCaches(): void;
|
|
65
|
-
export {};
|