@ember-data/store 5.4.0-alpha.31 → 5.4.0-alpha.33

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 (35) hide show
  1. package/package.json +9 -9
  2. package/unstable-preview-types/-private/cache-handler.d.ts +101 -99
  3. package/unstable-preview-types/-private/caches/cache-utils.d.ts +11 -9
  4. package/unstable-preview-types/-private/caches/identifier-cache.d.ts +181 -179
  5. package/unstable-preview-types/-private/caches/instance-cache.d.ts +63 -61
  6. package/unstable-preview-types/-private/caches/resource-utils.d.ts +12 -10
  7. package/unstable-preview-types/-private/document.d.ts +146 -144
  8. package/unstable-preview-types/-private/index.d.ts +18 -16
  9. package/unstable-preview-types/-private/legacy-model-support/record-reference.d.ts +178 -176
  10. package/unstable-preview-types/-private/legacy-model-support/shim-model-class.d.ts +19 -17
  11. package/unstable-preview-types/-private/managers/cache-capabilities-manager.d.ts +29 -27
  12. package/unstable-preview-types/-private/managers/cache-manager.d.ts +442 -440
  13. package/unstable-preview-types/-private/managers/notification-manager.d.ts +98 -96
  14. package/unstable-preview-types/-private/managers/record-array-manager.d.ts +97 -95
  15. package/unstable-preview-types/-private/network/request-cache.d.ts +109 -107
  16. package/unstable-preview-types/-private/record-arrays/identifier-array.d.ts +134 -132
  17. package/unstable-preview-types/-private/store-service.d.ts +1503 -1501
  18. package/unstable-preview-types/-private/utils/coerce-id.d.ts +10 -8
  19. package/unstable-preview-types/-private/utils/construct-resource.d.ts +10 -8
  20. package/unstable-preview-types/-private/utils/identifier-debug-consts.d.ts +7 -5
  21. package/unstable-preview-types/-private/utils/is-non-empty-string.d.ts +4 -2
  22. package/unstable-preview-types/-private/utils/normalize-model-name.d.ts +4 -2
  23. package/unstable-preview-types/-private/utils/uuid-polyfill.d.ts +4 -2
  24. package/unstable-preview-types/-private.d.ts +4 -2
  25. package/unstable-preview-types/-types/overview.d.ts +21 -19
  26. package/unstable-preview-types/-types/q/cache-store-wrapper.d.ts +107 -105
  27. package/unstable-preview-types/-types/q/cache.d.ts +47 -45
  28. package/unstable-preview-types/-types/q/ds-model.d.ts +15 -13
  29. package/unstable-preview-types/-types/q/identifier.d.ts +169 -167
  30. package/unstable-preview-types/-types/q/promise-proxies.d.ts +4 -2
  31. package/unstable-preview-types/-types/q/record-data-json-api.d.ts +36 -34
  32. package/unstable-preview-types/-types/q/record-instance.d.ts +29 -27
  33. package/unstable-preview-types/-types/q/schema-service.d.ts +214 -212
  34. package/unstable-preview-types/-types/q/store.d.ts +17 -15
  35. package/unstable-preview-types/index.d.ts +220 -185
@@ -1,8 +1,10 @@
1
- /**
2
- @module @ember-data/store
3
- */
4
- type Coercable = string | number | boolean | null | undefined | symbol;
5
- declare function coerceId(id: unknown): string | null;
6
- export declare function ensureStringId(id: Coercable): string;
7
- export default coerceId;
8
- //# sourceMappingURL=coerce-id.d.ts.map
1
+ declare module '@ember-data/store/-private/utils/coerce-id' {
2
+ /**
3
+ @module @ember-data/store
4
+ */
5
+ type Coercable = string | number | boolean | null | undefined | symbol;
6
+ declare function coerceId(id: unknown): string | null;
7
+ export declare function ensureStringId(id: Coercable): string;
8
+ export default coerceId;
9
+ //# sourceMappingURL=coerce-id.d.ts.map
10
+ }
@@ -1,8 +1,10 @@
1
- import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from '@warp-drive/core-types/spec/raw';
2
- declare function constructResource(type: ResourceIdentifierObject): ResourceIdentifierObject;
3
- declare function constructResource(type: string, id: string, lid: string): ExistingResourceIdentifierObject;
4
- declare function constructResource(type: string | undefined, id: null | undefined, lid: string): ExistingResourceIdentifierObject;
5
- declare function constructResource(type: string, id: string, lid?: string | null): ExistingResourceIdentifierObject;
6
- declare function constructResource(type: string, id?: string | number | null, lid?: string | null): ResourceIdentifierObject;
7
- export default constructResource;
8
- //# sourceMappingURL=construct-resource.d.ts.map
1
+ declare module '@ember-data/store/-private/utils/construct-resource' {
2
+ import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from '@warp-drive/core-types/spec/raw';
3
+ declare function constructResource(type: ResourceIdentifierObject): ResourceIdentifierObject;
4
+ declare function constructResource(type: string, id: string, lid: string): ExistingResourceIdentifierObject;
5
+ declare function constructResource(type: string | undefined, id: null | undefined, lid: string): ExistingResourceIdentifierObject;
6
+ declare function constructResource(type: string, id: string, lid?: string | null): ExistingResourceIdentifierObject;
7
+ declare function constructResource(type: string, id?: string | number | null, lid?: string | null): ResourceIdentifierObject;
8
+ export default constructResource;
9
+ //# sourceMappingURL=construct-resource.d.ts.map
10
+ }
@@ -1,5 +1,7 @@
1
- export declare const DEBUG_CLIENT_ORIGINATED: unique symbol;
2
- export declare const DEBUG_IDENTIFIER_BUCKET: unique symbol;
3
- export declare const DEBUG_STALE_CACHE_OWNER: unique symbol;
4
- export declare const CACHE_OWNER: unique symbol;
5
- //# sourceMappingURL=identifier-debug-consts.d.ts.map
1
+ declare module '@ember-data/store/-private/utils/identifier-debug-consts' {
2
+ export declare const DEBUG_CLIENT_ORIGINATED: unique symbol;
3
+ export declare const DEBUG_IDENTIFIER_BUCKET: unique symbol;
4
+ export declare const DEBUG_STALE_CACHE_OWNER: unique symbol;
5
+ export declare const CACHE_OWNER: unique symbol;
6
+ //# sourceMappingURL=identifier-debug-consts.d.ts.map
7
+ }
@@ -1,2 +1,4 @@
1
- export default function isNonEmptyString(str: unknown): str is string;
2
- //# sourceMappingURL=is-non-empty-string.d.ts.map
1
+ declare module '@ember-data/store/-private/utils/is-non-empty-string' {
2
+ export default function isNonEmptyString(str: unknown): str is string;
3
+ //# sourceMappingURL=is-non-empty-string.d.ts.map
4
+ }
@@ -1,2 +1,4 @@
1
- export default function normalizeModelName(type: string): string;
2
- //# sourceMappingURL=normalize-model-name.d.ts.map
1
+ declare module '@ember-data/store/-private/utils/normalize-model-name' {
2
+ export default function normalizeModelName(type: string): string;
3
+ //# sourceMappingURL=normalize-model-name.d.ts.map
4
+ }
@@ -1,2 +1,4 @@
1
- export default function installPolyfill(): void;
2
- //# sourceMappingURL=uuid-polyfill.d.ts.map
1
+ declare module '@ember-data/store/-private/utils/uuid-polyfill' {
2
+ export default function installPolyfill(): void;
3
+ //# sourceMappingURL=uuid-polyfill.d.ts.map
4
+ }
@@ -1,2 +1,4 @@
1
- export * from './-private/index';
2
- //# sourceMappingURL=-private.d.ts.map
1
+ declare module '@ember-data/store/-private' {
2
+ export * from '@ember-data/store/-private/index';
3
+ //# sourceMappingURL=-private.d.ts.map
4
+ }
@@ -1,19 +1,21 @@
1
- export {};
2
- /**
3
- * Many parts of EmberData are interface-driven,
4
- * meaning that no specific base-class is necessary
5
- * to implement an interopable module of your own
6
- * utilizing only public APIs.
7
- *
8
- * Examples of primitives in EmberData that are interface-driven
9
- * include Adapters, Serializers, Request Handlers, and the Cache.
10
- *
11
- * These **Not Yet Installable** Typescript Types
12
- * Document key interfaces that libraries and
13
- * applications interfacing with EmberData would need
14
- * to conform to.
15
- *
16
- @module @ember-data/experimental-preview-types
17
- @main @ember-data/experimental-preview-types
18
- */
19
- //# sourceMappingURL=overview.d.ts.map
1
+ declare module '@ember-data/store/-types/overview' {
2
+ export {};
3
+ /**
4
+ * Many parts of EmberData are interface-driven,
5
+ * meaning that no specific base-class is necessary
6
+ * to implement an interopable module of your own
7
+ * utilizing only public APIs.
8
+ *
9
+ * Examples of primitives in EmberData that are interface-driven
10
+ * include Adapters, Serializers, Request Handlers, and the Cache.
11
+ *
12
+ * These **Not Yet Installable** Typescript Types
13
+ * Document key interfaces that libraries and
14
+ * applications interfacing with EmberData would need
15
+ * to conform to.
16
+ *
17
+ @module @ember-data/experimental-preview-types
18
+ @main @ember-data/experimental-preview-types
19
+ */
20
+ //# sourceMappingURL=overview.d.ts.map
21
+ }
@@ -1,105 +1,107 @@
1
- import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
2
- import type { IdentifierCache } from '../../-private/caches/identifier-cache';
3
- import type { NotificationType } from '../../-private/managers/notification-manager';
4
- import type { SchemaService } from './schema-service';
5
- /**
6
- @module @ember-data/store
7
- */
8
- /**
9
- * CacheCapabilitiesManager provides encapsulated API access to the minimal
10
- * subset of the Store's functionality that Cache implementations
11
- * should interact with. It is provided to the Store's `createRecordDataFor`
12
- * and `createCache` hooks.
13
- *
14
- * Cache implementations should not need more than this API provides.
15
- *
16
- * This class cannot be directly instantiated.
17
- *
18
- * @class CacheCapabilitiesManager
19
- * @public
20
- */
21
- export interface CacheCapabilitiesManager {
22
- /**
23
- * Provides access to the IdentifierCache instance
24
- * for this Store instance.
25
- *
26
- * The IdentifierCache can be used to peek, generate or
27
- * retrieve a stable unique identifier for any resource.
28
- *
29
- * @property {IdentifierCache} identifierCache
30
- * @public
31
- */
32
- identifierCache: IdentifierCache;
33
- /**
34
- * Provides access to the SchemaService instance
35
- * for this Store instance.
36
- *
37
- * The SchemaService can be used to query for
38
- * information about the schema of a resource.
39
- *
40
- * @method getSchemaDefinitionService
41
- * @public
42
- */
43
- getSchemaDefinitionService(): SchemaService;
44
- /**
45
- * Provides access to the SchemaService instance
46
- * for this Store instance.
47
- *
48
- * The SchemaService can be used to query for
49
- * information about the schema of a resource.
50
- *
51
- * @property schema
52
- * @public
53
- */
54
- schema: SchemaService;
55
- /**
56
- * Update the `id` for the record corresponding to the identifier
57
- * This operation can only be done for records whose `id` is `null`.
58
- *
59
- * @method setRecordId
60
- * @param {StableRecordIdentifier} identifier;
61
- * @param {string} id;
62
- * @public
63
- */
64
- setRecordId(identifier: StableRecordIdentifier, id: string): void;
65
- /**
66
- * Signal to the store that the specified record may be considered fully
67
- * removed from the cache. Generally this means that not only does no
68
- * data exist for the identified resource, no known relationships still
69
- * point to it either.
70
- *
71
- * @method disconnectRecord
72
- * @param {StableRecordIdentifier} identifier
73
- * @public
74
- */
75
- disconnectRecord(identifier: StableRecordIdentifier): void;
76
- /**
77
- * Use this method to determine if the Store has an instantiated record associated
78
- * with an identifier.
79
- *
80
- * @method hasRecord
81
- * @param identifier
82
- * @return {boolean}
83
- * @public
84
- */
85
- hasRecord(identifier: StableRecordIdentifier): boolean;
86
- /**
87
- * Notify subscribers of the NotificationManager that cache state has changed.
88
- *
89
- * `attributes` and `relationships` do not require a key, but if one is specified it
90
- * is assumed to be the name of the attribute or relationship that has been updated.
91
- *
92
- * No other namespaces currently expect the `key` argument.
93
- *
94
- * @method notifyChange
95
- * @param {StableRecordIdentifier} identifier
96
- * @param {'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'} namespace
97
- * @param {string|undefined} key
98
- * @public
99
- */
100
- notifyChange(identifier: StableRecordIdentifier, namespace: 'added' | 'removed'): void;
101
- notifyChange(identifier: StableDocumentIdentifier, namespace: 'added' | 'updated' | 'removed'): void;
102
- notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key?: string): void;
103
- notifyChange(identifier: StableRecordIdentifier | StableDocumentIdentifier, namespace: NotificationType | 'added' | 'removed' | 'updated', key?: string): void;
104
- }
105
- //# sourceMappingURL=cache-store-wrapper.d.ts.map
1
+ declare module '@ember-data/store/-types/q/cache-store-wrapper' {
2
+ import type { StableDocumentIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
3
+ import type { IdentifierCache } from '@ember-data/store/-private/caches/identifier-cache';
4
+ import type { NotificationType } from '@ember-data/store/-private/managers/notification-manager';
5
+ import type { SchemaService } from '@ember-data/store/-types/q/schema-service';
6
+ /**
7
+ @module @ember-data/store
8
+ */
9
+ /**
10
+ * CacheCapabilitiesManager provides encapsulated API access to the minimal
11
+ * subset of the Store's functionality that Cache implementations
12
+ * should interact with. It is provided to the Store's `createRecordDataFor`
13
+ * and `createCache` hooks.
14
+ *
15
+ * Cache implementations should not need more than this API provides.
16
+ *
17
+ * This class cannot be directly instantiated.
18
+ *
19
+ * @class CacheCapabilitiesManager
20
+ * @public
21
+ */
22
+ export interface CacheCapabilitiesManager {
23
+ /**
24
+ * Provides access to the IdentifierCache instance
25
+ * for this Store instance.
26
+ *
27
+ * The IdentifierCache can be used to peek, generate or
28
+ * retrieve a stable unique identifier for any resource.
29
+ *
30
+ * @property {IdentifierCache} identifierCache
31
+ * @public
32
+ */
33
+ identifierCache: IdentifierCache;
34
+ /**
35
+ * Provides access to the SchemaService instance
36
+ * for this Store instance.
37
+ *
38
+ * The SchemaService can be used to query for
39
+ * information about the schema of a resource.
40
+ *
41
+ * @method getSchemaDefinitionService
42
+ * @public
43
+ */
44
+ getSchemaDefinitionService(): SchemaService;
45
+ /**
46
+ * Provides access to the SchemaService instance
47
+ * for this Store instance.
48
+ *
49
+ * The SchemaService can be used to query for
50
+ * information about the schema of a resource.
51
+ *
52
+ * @property schema
53
+ * @public
54
+ */
55
+ schema: SchemaService;
56
+ /**
57
+ * Update the `id` for the record corresponding to the identifier
58
+ * This operation can only be done for records whose `id` is `null`.
59
+ *
60
+ * @method setRecordId
61
+ * @param {StableRecordIdentifier} identifier;
62
+ * @param {string} id;
63
+ * @public
64
+ */
65
+ setRecordId(identifier: StableRecordIdentifier, id: string): void;
66
+ /**
67
+ * Signal to the store that the specified record may be considered fully
68
+ * removed from the cache. Generally this means that not only does no
69
+ * data exist for the identified resource, no known relationships still
70
+ * point to it either.
71
+ *
72
+ * @method disconnectRecord
73
+ * @param {StableRecordIdentifier} identifier
74
+ * @public
75
+ */
76
+ disconnectRecord(identifier: StableRecordIdentifier): void;
77
+ /**
78
+ * Use this method to determine if the Store has an instantiated record associated
79
+ * with an identifier.
80
+ *
81
+ * @method hasRecord
82
+ * @param identifier
83
+ * @return {boolean}
84
+ * @public
85
+ */
86
+ hasRecord(identifier: StableRecordIdentifier): boolean;
87
+ /**
88
+ * Notify subscribers of the NotificationManager that cache state has changed.
89
+ *
90
+ * `attributes` and `relationships` do not require a key, but if one is specified it
91
+ * is assumed to be the name of the attribute or relationship that has been updated.
92
+ *
93
+ * No other namespaces currently expect the `key` argument.
94
+ *
95
+ * @method notifyChange
96
+ * @param {StableRecordIdentifier} identifier
97
+ * @param {'attributes' | 'relationships' | 'identity' | 'errors' | 'meta' | 'state'} namespace
98
+ * @param {string|undefined} key
99
+ * @public
100
+ */
101
+ notifyChange(identifier: StableRecordIdentifier, namespace: 'added' | 'removed'): void;
102
+ notifyChange(identifier: StableDocumentIdentifier, namespace: 'added' | 'updated' | 'removed'): void;
103
+ notifyChange(identifier: StableRecordIdentifier, namespace: NotificationType, key?: string): void;
104
+ notifyChange(identifier: StableRecordIdentifier | StableDocumentIdentifier, namespace: NotificationType | 'added' | 'removed' | 'updated', key?: string): void;
105
+ }
106
+ //# sourceMappingURL=cache-store-wrapper.d.ts.map
107
+ }
@@ -1,45 +1,47 @@
1
- import type { Cache, ChangedAttributesHash } from '@warp-drive/core-types/cache';
2
- import type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
3
- import type { ApiError } from '@warp-drive/core-types/spec/error';
4
- import type { CollectionResourceRelationship, SingleResourceRelationship } from '@warp-drive/core-types/spec/raw';
5
- import type { JsonApiResource } from './record-data-json-api';
6
- /**
7
- @module @ember-data/store
8
- */
9
- export interface MergeOperation {
10
- op: 'mergeIdentifiers';
11
- record: StableRecordIdentifier;
12
- value: StableRecordIdentifier;
13
- }
14
- export interface CacheV1 {
15
- version?: '1';
16
- getResourceIdentifier(): RecordIdentifier | undefined;
17
- pushData(data: JsonApiResource, calculateChange: true): string[];
18
- pushData(data: JsonApiResource, calculateChange?: false): void;
19
- pushData(data: JsonApiResource, calculateChange?: boolean): string[] | void;
20
- clientDidCreate(): void;
21
- _initRecordCreateOptions(options?: Record<string, unknown>): Record<string, unknown>;
22
- willCommit(): void;
23
- didCommit(data: JsonApiResource | null): void;
24
- commitWasRejected(recordIdentifier?: RecordIdentifier, errors?: ApiError[]): void;
25
- unloadRecord(): void;
26
- getAttr(key: string): unknown;
27
- setDirtyAttribute(key: string, value: unknown): void;
28
- changedAttributes(): ChangedAttributesHash;
29
- hasChangedAttributes(): boolean;
30
- rollbackAttributes(): string[];
31
- getBelongsTo(key: string): SingleResourceRelationship;
32
- getHasMany(key: string): CollectionResourceRelationship;
33
- setDirtyBelongsTo(name: string, recordData: Cache | null): void;
34
- setDirtyHasMany(key: string, recordDatas: Cache[]): void;
35
- addToHasMany(key: string, recordDatas: Cache[], idx?: number): void;
36
- removeFromHasMany(key: string, recordDatas: Cache[]): void;
37
- setIsDeleted(isDeleted: boolean): void;
38
- getErrors(identifier: StableRecordIdentifier): ApiError[];
39
- isEmpty?(identifier: StableRecordIdentifier): boolean;
40
- isNew(identifier: StableRecordIdentifier): boolean;
41
- isDeleted(identifier: StableRecordIdentifier): boolean;
42
- isDeletionCommitted(identifier: StableRecordIdentifier): boolean;
43
- }
44
- export type { Cache };
45
- //# sourceMappingURL=cache.d.ts.map
1
+ declare module '@ember-data/store/-types/q/cache' {
2
+ import type { Cache, ChangedAttributesHash } from '@warp-drive/core-types/cache';
3
+ import type { RecordIdentifier, StableRecordIdentifier } from '@warp-drive/core-types/identifier';
4
+ import type { ApiError } from '@warp-drive/core-types/spec/error';
5
+ import type { CollectionResourceRelationship, SingleResourceRelationship } from '@warp-drive/core-types/spec/raw';
6
+ import type { JsonApiResource } from '@ember-data/store/-types/q/record-data-json-api';
7
+ /**
8
+ @module @ember-data/store
9
+ */
10
+ export interface MergeOperation {
11
+ op: 'mergeIdentifiers';
12
+ record: StableRecordIdentifier;
13
+ value: StableRecordIdentifier;
14
+ }
15
+ export interface CacheV1 {
16
+ version?: '1';
17
+ getResourceIdentifier(): RecordIdentifier | undefined;
18
+ pushData(data: JsonApiResource, calculateChange: true): string[];
19
+ pushData(data: JsonApiResource, calculateChange?: false): void;
20
+ pushData(data: JsonApiResource, calculateChange?: boolean): string[] | void;
21
+ clientDidCreate(): void;
22
+ _initRecordCreateOptions(options?: Record<string, unknown>): Record<string, unknown>;
23
+ willCommit(): void;
24
+ didCommit(data: JsonApiResource | null): void;
25
+ commitWasRejected(recordIdentifier?: RecordIdentifier, errors?: ApiError[]): void;
26
+ unloadRecord(): void;
27
+ getAttr(key: string): unknown;
28
+ setDirtyAttribute(key: string, value: unknown): void;
29
+ changedAttributes(): ChangedAttributesHash;
30
+ hasChangedAttributes(): boolean;
31
+ rollbackAttributes(): string[];
32
+ getBelongsTo(key: string): SingleResourceRelationship;
33
+ getHasMany(key: string): CollectionResourceRelationship;
34
+ setDirtyBelongsTo(name: string, recordData: Cache | null): void;
35
+ setDirtyHasMany(key: string, recordDatas: Cache[]): void;
36
+ addToHasMany(key: string, recordDatas: Cache[], idx?: number): void;
37
+ removeFromHasMany(key: string, recordDatas: Cache[]): void;
38
+ setIsDeleted(isDeleted: boolean): void;
39
+ getErrors(identifier: StableRecordIdentifier): ApiError[];
40
+ isEmpty?(identifier: StableRecordIdentifier): boolean;
41
+ isNew(identifier: StableRecordIdentifier): boolean;
42
+ isDeleted(identifier: StableRecordIdentifier): boolean;
43
+ isDeletionCommitted(identifier: StableRecordIdentifier): boolean;
44
+ }
45
+ export type { Cache };
46
+ //# sourceMappingURL=cache.d.ts.map
47
+ }
@@ -1,13 +1,15 @@
1
- import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
2
- import type { AttributeSchema, RelationshipSchema } from '@warp-drive/core-types/schema';
3
- export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
4
- export interface ModelSchema<T = unknown> {
5
- modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
6
- fields: Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;
7
- attributes: Map<KeyOrString<T>, AttributeSchema>;
8
- relationshipsByName: Map<KeyOrString<T>, RelationshipSchema>;
9
- eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: AttributeSchema) => void, binding?: T): void;
10
- eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: RelationshipSchema) => void, binding?: T): void;
11
- eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
12
- }
13
- //# sourceMappingURL=ds-model.d.ts.map
1
+ declare module '@ember-data/store/-types/q/ds-model' {
2
+ import type { TypedRecordInstance, TypeFromInstance } from '@warp-drive/core-types/record';
3
+ import type { AttributeSchema, RelationshipSchema } from '@warp-drive/core-types/schema';
4
+ export type KeyOrString<T> = keyof T & string extends never ? string : keyof T & string;
5
+ export interface ModelSchema<T = unknown> {
6
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
7
+ fields: Map<KeyOrString<T>, 'attribute' | 'belongsTo' | 'hasMany'>;
8
+ attributes: Map<KeyOrString<T>, AttributeSchema>;
9
+ relationshipsByName: Map<KeyOrString<T>, RelationshipSchema>;
10
+ eachAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, attribute: AttributeSchema) => void, binding?: T): void;
11
+ eachRelationship<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, relationship: RelationshipSchema) => void, binding?: T): void;
12
+ eachTransformedAttribute<K extends KeyOrString<T>>(callback: (this: ModelSchema<T>, key: K, type: string | null) => void, binding?: T): void;
13
+ }
14
+ //# sourceMappingURL=ds-model.d.ts.map
15
+ }