@warp-drive/core 5.7.0-alpha.3 → 5.7.0-alpha.5
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 +6 -2
- package/declarations/reactive.d.ts +1 -0
- package/declarations/store/-types/q/schema-service.d.ts +20 -32
- package/declarations/types/schema/fields.d.ts +348 -11
- package/dist/graph/-private.js +1 -1
- package/dist/{handler-D2jjnIA-.js → handler-SdXlte1w.js} +1 -1
- package/dist/index.js +2 -2
- package/dist/reactive.js +1156 -584
- package/dist/{request-state-CejVJgdj.js → request-state-CeN66aML.js} +12 -10
- 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
|
@@ -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, type Trait } 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";
|
|
@@ -141,6 +141,7 @@ interface InternalSchema {
|
|
|
141
141
|
finalized: boolean;
|
|
142
142
|
traits: Set<string>;
|
|
143
143
|
fields: Map<string, FieldSchema>;
|
|
144
|
+
cacheFields: Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
144
145
|
attributes: Record<string, LegacyAttributeField>;
|
|
145
146
|
relationships: Record<string, LegacyRelationshipField>;
|
|
146
147
|
}
|
|
@@ -270,7 +271,7 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
270
271
|
CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: StableRecordIdentifier | {
|
|
271
272
|
type: string;
|
|
272
273
|
}): null | ProcessedExtension["features"];
|
|
273
|
-
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
274
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
274
275
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
275
276
|
CAUTION_MEGA_DANGER_ZONE_hasExtension(ext: {
|
|
276
277
|
kind: "object" | "array";
|
|
@@ -304,6 +305,9 @@ export declare class SchemaService implements SchemaServiceInterface {
|
|
|
304
305
|
fields({ type }: {
|
|
305
306
|
type: string;
|
|
306
307
|
}): InternalSchema["fields"];
|
|
308
|
+
cacheFields({ type }: {
|
|
309
|
+
type: string;
|
|
310
|
+
}): InternalSchema["cacheFields"];
|
|
307
311
|
hasResource(resource: {
|
|
308
312
|
type: string;
|
|
309
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";
|
|
@@ -3,7 +3,7 @@ import type { ExtensibleField } from "../../../reactive/-private/schema.js";
|
|
|
3
3
|
import type { RecordIdentifier, StableRecordIdentifier } from "../../../types/identifier.js";
|
|
4
4
|
import type { ObjectValue } from "../../../types/json/raw.js";
|
|
5
5
|
import type { Derivation, HashFn, Transformation } from "../../../types/schema/concepts.js";
|
|
6
|
-
import type { ArrayField, DerivedField, FieldSchema, GenericField, HashField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "../../../types/schema/fields.js";
|
|
6
|
+
import type { ArrayField, CacheableFieldSchema, DerivedField, FieldSchema, GenericField, HashField, IdentityField, LegacyAttributeField, LegacyRelationshipField, ObjectField, Schema, Trait } from "../../../types/schema/fields.js";
|
|
7
7
|
export type AttributesSchema = Record<string, LegacyAttributeField>;
|
|
8
8
|
export type RelationshipsSchema = Record<string, LegacyRelationshipField>;
|
|
9
9
|
interface ObjectWithStringTypeProperty {
|
|
@@ -57,7 +57,6 @@ interface ObjectWithStringTypeProperty {
|
|
|
57
57
|
* }
|
|
58
58
|
* ```
|
|
59
59
|
*
|
|
60
|
-
* @class (Interface) SchemaService
|
|
61
60
|
* @public
|
|
62
61
|
*/
|
|
63
62
|
export interface SchemaService {
|
|
@@ -68,33 +67,24 @@ export interface SchemaService {
|
|
|
68
67
|
*
|
|
69
68
|
* @public
|
|
70
69
|
* @deprecated
|
|
71
|
-
* @param {String} type
|
|
72
|
-
* @return {Boolean}
|
|
73
70
|
*/
|
|
74
71
|
doesTypeExist?(type: string): boolean;
|
|
75
72
|
/**
|
|
76
73
|
* Queries whether the SchemaService recognizes `type` as a resource type
|
|
77
74
|
*
|
|
78
75
|
* @public
|
|
79
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
80
|
-
* @return {Boolean}
|
|
81
76
|
*/
|
|
82
77
|
hasResource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): boolean;
|
|
83
78
|
/**
|
|
84
79
|
* Queries whether the SchemaService recognizes `type` as a resource trait
|
|
85
80
|
*
|
|
86
81
|
* @public
|
|
87
|
-
* @param {String} type
|
|
88
|
-
* @return {Boolean}
|
|
89
82
|
*/
|
|
90
83
|
hasTrait(type: string): boolean;
|
|
91
84
|
/**
|
|
92
85
|
* Queries whether the given resource has the given trait
|
|
93
86
|
*
|
|
94
87
|
* @public
|
|
95
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
96
|
-
* @param {String} trait
|
|
97
|
-
* @return {Boolean}
|
|
98
88
|
*/
|
|
99
89
|
resourceHasTrait(resource: ObjectWithStringTypeProperty | StableRecordIdentifier, trait: string): boolean;
|
|
100
90
|
/**
|
|
@@ -103,17 +93,21 @@ export interface SchemaService {
|
|
|
103
93
|
* Should error if the resource type is not recognized.
|
|
104
94
|
*
|
|
105
95
|
* @public
|
|
106
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
107
|
-
* @return {Map<string, FieldSchema>}
|
|
108
96
|
*/
|
|
109
97
|
fields(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, FieldSchema>;
|
|
110
98
|
/**
|
|
99
|
+
* Queries for the fields of a given resource type or resource identity.
|
|
100
|
+
*
|
|
101
|
+
* Should error if the resource type is not recognized.
|
|
102
|
+
*
|
|
103
|
+
* @public
|
|
104
|
+
*/
|
|
105
|
+
cacheFields?(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Map<string, Exclude<CacheableFieldSchema, IdentityField>>;
|
|
106
|
+
/**
|
|
111
107
|
* Returns the transformation registered with the name provided
|
|
112
108
|
* by `field.type`. Validates that the field is a valid transformable.
|
|
113
109
|
*
|
|
114
110
|
* @public
|
|
115
|
-
* @param {TransformableField|ObjectWithStringTypeProperty} field
|
|
116
|
-
* @return {Transformation}
|
|
117
111
|
*/
|
|
118
112
|
transformation(field: GenericField | ObjectField | ArrayField | ObjectWithStringTypeProperty): Transformation;
|
|
119
113
|
/**
|
|
@@ -121,8 +115,6 @@ export interface SchemaService {
|
|
|
121
115
|
* by `field.type`. Validates that the field is a valid HashField.
|
|
122
116
|
*
|
|
123
117
|
* @public
|
|
124
|
-
* @param {HashField|ObjectWithStringTypeProperty} field
|
|
125
|
-
* @return {HashFn}
|
|
126
118
|
*/
|
|
127
119
|
hashFn(field: HashField | ObjectWithStringTypeProperty): HashFn;
|
|
128
120
|
/**
|
|
@@ -130,16 +122,12 @@ export interface SchemaService {
|
|
|
130
122
|
* by `field.type`. Validates that the field is a valid DerivedField.
|
|
131
123
|
*
|
|
132
124
|
* @public
|
|
133
|
-
* @param {DerivedField|ObjectWithStringTypeProperty} field
|
|
134
|
-
* @return {Derivation}
|
|
135
125
|
*/
|
|
136
126
|
derivation(field: DerivedField | ObjectWithStringTypeProperty): Derivation;
|
|
137
127
|
/**
|
|
138
128
|
* Returns the schema for the provided resource type.
|
|
139
129
|
*
|
|
140
130
|
* @public
|
|
141
|
-
* @param {StableRecordIdentifier|ObjectWithStringTypeProperty} resource
|
|
142
|
-
* @return {ResourceSchema}
|
|
143
131
|
*/
|
|
144
132
|
resource(resource: ObjectWithStringTypeProperty | StableRecordIdentifier): Schema;
|
|
145
133
|
/**
|
|
@@ -150,7 +138,6 @@ export interface SchemaService {
|
|
|
150
138
|
* or other sources just-in-time.
|
|
151
139
|
*
|
|
152
140
|
* @public
|
|
153
|
-
* @param {Schema[]} schemas
|
|
154
141
|
*/
|
|
155
142
|
registerResources(schemas: Schema[]): void;
|
|
156
143
|
/**
|
|
@@ -163,7 +150,6 @@ export interface SchemaService {
|
|
|
163
150
|
* or other sources just-in-time.
|
|
164
151
|
*
|
|
165
152
|
* @public
|
|
166
|
-
* @param {Schema} schema
|
|
167
153
|
*/
|
|
168
154
|
registerResource(schema: Schema): void;
|
|
169
155
|
/**
|
|
@@ -173,7 +159,6 @@ export interface SchemaService {
|
|
|
173
159
|
* attached to it's `[Type]` property.
|
|
174
160
|
*
|
|
175
161
|
* @public
|
|
176
|
-
* @param {Transformation} transform
|
|
177
162
|
*/
|
|
178
163
|
registerTransformation(transform: Transformation): void;
|
|
179
164
|
/**
|
|
@@ -183,7 +168,6 @@ export interface SchemaService {
|
|
|
183
168
|
* attached to it's `[Type]` property.
|
|
184
169
|
*
|
|
185
170
|
* @public
|
|
186
|
-
* @param {Derivation} derivation
|
|
187
171
|
*/
|
|
188
172
|
registerDerivation<
|
|
189
173
|
R,
|
|
@@ -197,7 +181,6 @@ export interface SchemaService {
|
|
|
197
181
|
* attached to it's `[Type]` property.
|
|
198
182
|
*
|
|
199
183
|
* @public
|
|
200
|
-
* @param {HashFn} hashfn
|
|
201
184
|
*/
|
|
202
185
|
registerHashFn(hashFn: HashFn): void;
|
|
203
186
|
/**
|
|
@@ -269,8 +252,6 @@ export interface SchemaService {
|
|
|
269
252
|
*
|
|
270
253
|
* @public
|
|
271
254
|
* @deprecated
|
|
272
|
-
* @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
|
|
273
|
-
* @return {AttributesSchema}
|
|
274
255
|
*/
|
|
275
256
|
attributesDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): AttributesSchema;
|
|
276
257
|
/**
|
|
@@ -350,37 +331,44 @@ export interface SchemaService {
|
|
|
350
331
|
*
|
|
351
332
|
* @public
|
|
352
333
|
* @deprecated
|
|
353
|
-
* @param {RecordIdentifier|ObjectWithStringTypeProperty} identifier
|
|
354
|
-
* @return {RelationshipsSchema}
|
|
355
334
|
*/
|
|
356
335
|
relationshipsDefinitionFor?(identifier: RecordIdentifier | ObjectWithStringTypeProperty): RelationshipsSchema;
|
|
357
336
|
/**
|
|
358
337
|
* Returns all known resource types
|
|
359
338
|
*
|
|
360
339
|
* @public
|
|
361
|
-
* @return {String[]}
|
|
362
340
|
*/
|
|
363
341
|
resourceTypes(): Readonly<string[]>;
|
|
364
342
|
/**
|
|
365
343
|
* Register an extension for either objects or arrays
|
|
344
|
+
*
|
|
345
|
+
* @public
|
|
366
346
|
*/
|
|
367
347
|
CAUTION_MEGA_DANGER_ZONE_registerExtension?(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
|
|
368
348
|
/**
|
|
369
349
|
* Retrieve the extension map for a resource
|
|
350
|
+
*
|
|
351
|
+
* @public
|
|
370
352
|
*/
|
|
371
353
|
CAUTION_MEGA_DANGER_ZONE_resourceExtensions?(resource: StableRecordIdentifier | {
|
|
372
354
|
type: string;
|
|
373
355
|
}): null | ProcessedExtension["features"];
|
|
374
356
|
/**
|
|
375
357
|
* Retrieve the extension map for an object field
|
|
358
|
+
*
|
|
359
|
+
* @public
|
|
376
360
|
*/
|
|
377
|
-
CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
361
|
+
CAUTION_MEGA_DANGER_ZONE_objectExtensions?(field: ExtensibleField, resolvedType: string | null): null | ProcessedExtension["features"];
|
|
378
362
|
/**
|
|
379
363
|
* Retrieve the extension map for an array field
|
|
364
|
+
*
|
|
365
|
+
* @public
|
|
380
366
|
*/
|
|
381
367
|
CAUTION_MEGA_DANGER_ZONE_arrayExtensions?(field: ExtensibleField): null | ProcessedExtension["features"];
|
|
382
368
|
/**
|
|
383
369
|
* Check if a specific extension has been registered previously
|
|
370
|
+
*
|
|
371
|
+
* @public
|
|
384
372
|
*/
|
|
385
373
|
CAUTION_MEGA_DANGER_ZONE_hasExtension?(ext: {
|
|
386
374
|
kind: "object" | "array";
|