@warp-drive/core 5.7.0-alpha.1 → 5.7.0-alpha.11

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.
Files changed (46) hide show
  1. package/declarations/reactive/-private/default-mode.d.ts +73 -0
  2. package/declarations/reactive/-private/fields/get-field-key.d.ts +8 -0
  3. package/declarations/reactive/-private/fields/managed-array.d.ts +5 -8
  4. package/declarations/reactive/-private/fields/managed-object.d.ts +7 -9
  5. package/declarations/reactive/-private/kind/alias-field.d.ts +4 -0
  6. package/declarations/reactive/-private/kind/array-field.d.ts +4 -0
  7. package/declarations/reactive/-private/kind/attribute-field.d.ts +4 -0
  8. package/declarations/reactive/-private/kind/belongs-to-field.d.ts +4 -0
  9. package/declarations/reactive/-private/kind/collection-field.d.ts +4 -0
  10. package/declarations/reactive/-private/kind/derived-field.d.ts +4 -0
  11. package/declarations/reactive/-private/kind/generic-field.d.ts +4 -0
  12. package/declarations/reactive/-private/kind/has-many-field.d.ts +4 -0
  13. package/declarations/reactive/-private/kind/hash-field.d.ts +4 -0
  14. package/declarations/reactive/-private/kind/identity-field.d.ts +4 -0
  15. package/declarations/reactive/-private/kind/local-field.d.ts +4 -0
  16. package/declarations/reactive/-private/kind/object-field.d.ts +4 -0
  17. package/declarations/reactive/-private/kind/resource-field.d.ts +4 -0
  18. package/declarations/reactive/-private/kind/schema-array-field.d.ts +4 -0
  19. package/declarations/reactive/-private/kind/schema-object-field.d.ts +4 -0
  20. package/declarations/reactive/-private/record.d.ts +6 -21
  21. package/declarations/reactive/-private/schema.d.ts +6 -2
  22. package/declarations/reactive/-private/symbols.d.ts +1 -6
  23. package/declarations/reactive/-private.d.ts +1 -1
  24. package/declarations/reactive.d.ts +1 -0
  25. package/declarations/request/-private/fetch.d.ts +2 -0
  26. package/declarations/store/-types/q/schema-service.d.ts +27 -32
  27. package/declarations/store/-types/q/store.d.ts +6 -7
  28. package/declarations/store/deprecated/-private.d.ts +7 -7
  29. package/declarations/store/deprecated/store.d.ts +5 -5
  30. package/declarations/types/-private.d.ts +1 -1
  31. package/declarations/types/cache.d.ts +0 -2
  32. package/declarations/types/params.d.ts +2 -3
  33. package/declarations/types/request.d.ts +6 -6
  34. package/declarations/types/schema/fields.d.ts +377 -13
  35. package/dist/graph/-private.js +1 -1
  36. package/dist/{handler-D2jjnIA-.js → handler-SdXlte1w.js} +1 -1
  37. package/dist/index.js +2 -2
  38. package/dist/reactive/-private.js +1 -1
  39. package/dist/reactive.js +1171 -603
  40. package/dist/{request-state-CejVJgdj.js → request-state-CeN66aML.js} +12 -10
  41. package/dist/store/-private.js +2 -2
  42. package/dist/{symbols-SIstXMLI.js → symbols-BoONANuz.js} +2 -7
  43. package/dist/types/-private.js +1 -1
  44. package/dist/types/schema/fields.js +21 -2
  45. package/package.json +3 -3
  46. 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,22 +1,19 @@
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
- import { Editable, Legacy, SOURCE } from "../symbols.js";
7
+ import { Context, 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
- [Editable]: boolean;
17
- [Legacy]: boolean;
14
+ [Context]: KindContext<SchemaArrayField | ArrayField>;
18
15
  }
19
16
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
20
17
  export declare class ManagedArray {
21
- constructor(store: Store, schema: SchemaService, cache: Cache, field: ArrayField | SchemaArrayField, data: unknown[], identifier: StableRecordIdentifier, path: string[], owner: ReactiveResource, isSchemaArray: boolean, editable: boolean, legacy: boolean);
18
+ constructor(context: KindContext<SchemaArrayField | ArrayField>, owner: ReactiveResource, data: unknown[]);
22
19
  }
@@ -1,21 +1,19 @@
1
1
  import { OBJECT_SIGNAL, type WarpDriveSignal } from "../../../store/-private.js";
2
- import type { Cache } from "../../../types/cache.js";
3
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
4
2
  import type { ObjectField, SchemaObjectField } from "../../../types/schema/fields.js";
3
+ import type { KindContext } from "../default-mode.js";
5
4
  import type { ReactiveResource } from "../record.js";
6
- import type { SchemaService } from "../schema.js";
7
- import { Editable, EmbeddedPath, Legacy, Parent, SOURCE } from "../symbols.js";
5
+ import { Context, SOURCE } from "../symbols.js";
8
6
  export declare function notifyObject(obj: ManagedObject): void;
9
7
  // const ignoredGlobalFields = new Set<string>(['setInterval', 'nodeType', 'nodeName', 'length', 'document', STRUCTURED]);
10
8
  export interface ManagedObject {
11
9
  [SOURCE]: object;
12
- [Parent]: StableRecordIdentifier;
13
- [EmbeddedPath]: string[];
10
+ [Context]: KindContext<ObjectField>;
14
11
  [OBJECT_SIGNAL]: WarpDriveSignal;
15
- [Editable]: boolean;
16
- [Legacy]: boolean;
17
12
  }
18
13
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
19
14
  export declare class ManagedObject {
20
- constructor(schema: SchemaService, cache: Cache, field: ObjectField | SchemaObjectField, data: object, identifier: StableRecordIdentifier, path: string[], owner: ReactiveResource, editable: boolean, legacy: boolean);
15
+ constructor(context: KindContext<ObjectField>);
21
16
  }
17
+ export declare const ManagedObjectMap: Map<ReactiveResource, Map<string, ManagedObject | ReactiveResource>>;
18
+ export declare function peekManagedObject(record: ReactiveResource, field: ObjectField): ManagedObject | undefined;
19
+ 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;
@@ -1,25 +1,13 @@
1
- import type { Store } from "../../index.js";
2
- import type { StableRecordIdentifier } from "../../types/identifier.js";
3
- import type { SchemaArrayField, SchemaObjectField } from "../../types/schema/fields.js";
1
+ import type { Store } from "../../store/-private.js";
4
2
  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";
3
+ import type { ObjectContext, ResourceContext } from "./default-mode.js";
4
+ import { Checkout, Context, Destroy } from "./symbols.js";
7
5
  export interface ReactiveResource {
8
6
  [Symbol.toStringTag]: `ReactiveResource<${string}>`;
9
7
  /** @internal */
10
- [RecordStore]: Store;
11
- /** @internal */
12
- [Identifier]: StableRecordIdentifier;
13
- /** @internal */
14
- [Parent]: StableRecordIdentifier;
15
- /** @internal */
16
- [EmbeddedField]: SchemaArrayField | SchemaObjectField | null;
8
+ [Context]: ObjectContext | ResourceContext;
17
9
  /** @internal */
18
- [EmbeddedPath]: string[] | null;
19
- /** @internal */
20
- [Editable]: boolean;
21
- /** @internal */
22
- [Legacy]: boolean;
10
+ [RecordStore]: Store;
23
11
  /** @internal */
24
12
  ___notifications: object;
25
13
  /** @internal */
@@ -57,8 +45,5 @@ export interface ReactiveResource {
57
45
  */
58
46
  // eslint-disable-next-line @typescript-eslint/no-extraneous-class
59
47
  export declare class ReactiveResource {
60
- constructor(store: Store, identifier: StableRecordIdentifier, Mode: {
61
- [Editable]: boolean;
62
- [Legacy]: boolean;
63
- }, isEmbedded?: boolean, embeddedField?: SchemaArrayField | SchemaObjectField | null, embeddedPath?: string[] | null);
48
+ constructor(context: ResourceContext | ObjectContext);
64
49
  }
@@ -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;
@@ -27,10 +27,5 @@
27
27
  export declare const SOURCE: "___(unique) Symbol(SOURCE)";
28
28
  export declare const MUTATE: "___(unique) Symbol(MUTATE)";
29
29
  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
30
  export declare const Checkout: "___(unique) Symbol(Checkout)";
34
- export declare const Legacy: "___(unique) Symbol(Legacy)";
35
- export declare const EmbeddedPath: "___(unique) Symbol(EmbeddedPath)";
36
- export declare const EmbeddedField: "___(unique) Symbol(EmbeddedField)";
31
+ export declare const Context: "___(unique) Symbol(Context)";
@@ -1 +1 @@
1
- export { Editable, Legacy } from "./-private/symbols.js";
1
+ export { Context } from "./-private/symbols.js";
@@ -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,4 +1,6 @@
1
1
  import { type Context } from "./context.js";
2
+ import type { HttpErrorProps } from "./utils.js";
3
+ export type { HttpErrorProps };
2
4
  interface FastbootRequest extends Request {
3
5
  protocol: string;
4
6
  host: string;
@@ -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,34 +331,48 @@ 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"];
368
+ /**
369
+ * Check if a specific extension has been registered previously
370
+ *
371
+ * @public
372
+ */
373
+ CAUTION_MEGA_DANGER_ZONE_hasExtension?(ext: {
374
+ kind: "object" | "array";
375
+ name: string;
376
+ }): boolean;
382
377
  }
383
378
  export {};
@@ -1,12 +1,11 @@
1
1
  import type { Value } from "../../../types/json/raw.js";
2
- import type { Includes, TypedRecordInstance } from "../../../types/record.js";
3
- export interface BaseFinderOptions<T = unknown> {
2
+ export interface BaseFinderOptions {
4
3
  reload?: boolean;
5
4
  backgroundReload?: boolean;
6
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
5
+ include?: string | string[];
7
6
  adapterOptions?: Record<string, unknown>;
8
7
  }
9
- export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
8
+ export interface FindRecordOptions extends BaseFinderOptions {
10
9
  /**
11
10
  * Data to preload into the store before the request is made.
12
11
  * This feature is *highly* discouraged and has no corresponding
@@ -25,8 +24,8 @@ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
25
24
  preload?: Record<string, Value>;
26
25
  }
27
26
  export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
28
- export type FindAllOptions<T = unknown> = BaseFinderOptions<T>;
29
- export type LegacyResourceQuery<T = unknown> = {
30
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
27
+ export type FindAllOptions = BaseFinderOptions;
28
+ export type LegacyResourceQuery = {
29
+ include?: string | string[];
31
30
  [key: string]: Value | undefined;
32
31
  };
@@ -1,18 +1,18 @@
1
1
  import type { StableNewRecordIdentifier, StableRecordIdentifier } from "../../types/identifier.js";
2
2
  import type { Value } from "../../types/json/raw.js";
3
- import type { Includes, OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
3
+ import type { OpaqueRecordInstance, TypedRecordInstance, TypeFromInstance } from "../../types/record.js";
4
4
  import type { LegacyAttributeField, LegacyRelationshipField } from "../../types/schema/fields.js";
5
5
  import type { SingleResourceDocument } from "../../types/spec/json-api-raw.js";
6
6
  import { type InstanceCache } from "../-private.js";
7
7
  import type { Store } from "./store.js";
8
8
  export declare function preloadData(store: Store, identifier: StableNewRecordIdentifier, preload: Record<string, Value>): void;
9
- export interface BaseFinderOptions<T = unknown> {
9
+ export interface BaseFinderOptions {
10
10
  reload?: boolean;
11
11
  backgroundReload?: boolean;
12
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
12
+ include?: string | string[];
13
13
  adapterOptions?: Record<string, unknown>;
14
14
  }
15
- export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
15
+ export interface FindRecordOptions extends BaseFinderOptions {
16
16
  /**
17
17
  * Data to preload into the store before the request is made.
18
18
  * This feature is *highly* discouraged and has no corresponding
@@ -31,9 +31,9 @@ export interface FindRecordOptions<T = unknown> extends BaseFinderOptions<T> {
31
31
  preload?: Record<string, Value>;
32
32
  }
33
33
  export type QueryOptions = { [K in string | "adapterOptions"]? : K extends "adapterOptions" ? Record<string, unknown> : unknown };
34
- export type FindAllOptions<T = unknown> = BaseFinderOptions<T>;
35
- export type LegacyResourceQuery<T = unknown> = {
36
- include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];
34
+ export type FindAllOptions = BaseFinderOptions;
35
+ export type LegacyResourceQuery = {
36
+ include?: string | string[];
37
37
  [key: string]: Value | undefined;
38
38
  };
39
39
  export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;