@warp-drive/core 5.6.0-alpha.18 → 5.6.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.
Files changed (219) hide show
  1. package/README.md +7 -8
  2. package/declarations/index.d.ts +3 -14
  3. package/declarations/index.d.ts.map +1 -0
  4. package/declarations/request/-private/context.d.ts +35 -34
  5. package/declarations/request/-private/context.d.ts.map +1 -0
  6. package/declarations/request/-private/debug.d.ts +3 -2
  7. package/declarations/request/-private/debug.d.ts.map +1 -0
  8. package/declarations/request/-private/fetch.d.ts +36 -24
  9. package/declarations/request/-private/fetch.d.ts.map +1 -0
  10. package/declarations/request/-private/future.d.ts +4 -3
  11. package/declarations/request/-private/future.d.ts.map +1 -0
  12. package/declarations/request/-private/manager.d.ts +132 -159
  13. package/declarations/request/-private/manager.d.ts.map +1 -0
  14. package/declarations/request/-private/promise-cache.d.ts +13 -21
  15. package/declarations/request/-private/promise-cache.d.ts.map +1 -0
  16. package/declarations/request/-private/types.d.ts +123 -124
  17. package/declarations/request/-private/types.d.ts.map +1 -0
  18. package/declarations/request/-private/utils.d.ts +9 -8
  19. package/declarations/request/-private/utils.d.ts.map +1 -0
  20. package/declarations/request.d.ts +433 -5
  21. package/declarations/request.d.ts.map +1 -0
  22. package/declarations/types/-private.d.ts +8 -16
  23. package/declarations/types/-private.d.ts.map +1 -0
  24. package/declarations/types/cache/aliases.d.ts +1 -11
  25. package/declarations/types/cache/aliases.d.ts.map +1 -0
  26. package/declarations/types/cache/change.d.ts +5 -4
  27. package/declarations/types/cache/change.d.ts.map +1 -0
  28. package/declarations/types/cache/mutations.d.ts +28 -51
  29. package/declarations/types/cache/mutations.d.ts.map +1 -0
  30. package/declarations/types/cache/operations.d.ts +47 -60
  31. package/declarations/types/cache/operations.d.ts.map +1 -0
  32. package/declarations/types/cache/relationship.d.ts +9 -11
  33. package/declarations/types/cache/relationship.d.ts.map +1 -0
  34. package/declarations/types/cache.d.ts +484 -495
  35. package/declarations/types/cache.d.ts.map +1 -0
  36. package/declarations/types/graph.d.ts +40 -31
  37. package/declarations/types/graph.d.ts.map +1 -0
  38. package/declarations/types/identifier.d.ts +82 -83
  39. package/declarations/types/identifier.d.ts.map +1 -0
  40. package/declarations/types/json/raw.d.ts +2 -1
  41. package/declarations/types/json/raw.d.ts.map +1 -0
  42. package/declarations/types/params.d.ts +5 -4
  43. package/declarations/types/params.d.ts.map +1 -0
  44. package/declarations/types/record.d.ts +76 -117
  45. package/declarations/types/record.d.ts.map +1 -0
  46. package/declarations/types/record.type-test.d.ts +2 -0
  47. package/declarations/types/record.type-test.d.ts.map +1 -0
  48. package/declarations/types/request.d.ts +266 -289
  49. package/declarations/types/request.d.ts.map +1 -0
  50. package/declarations/types/request.type-test.d.ts +2 -0
  51. package/declarations/types/request.type-test.d.ts.map +1 -0
  52. package/declarations/types/runtime.d.ts +9 -8
  53. package/declarations/types/runtime.d.ts.map +1 -0
  54. package/declarations/types/schema/concepts.d.ts +13 -19
  55. package/declarations/types/schema/concepts.d.ts.map +1 -0
  56. package/declarations/types/schema/fields.d.ts +1741 -1712
  57. package/declarations/types/schema/fields.d.ts.map +1 -0
  58. package/declarations/types/schema/fields.type-test.d.ts +1 -0
  59. package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
  60. package/declarations/types/spec/document.d.ts +22 -28
  61. package/declarations/types/spec/document.d.ts.map +1 -0
  62. package/declarations/types/spec/error.d.ts +17 -16
  63. package/declarations/types/spec/error.d.ts.map +1 -0
  64. package/declarations/types/spec/json-api-raw.d.ts +102 -102
  65. package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
  66. package/declarations/types/symbols.d.ts +75 -74
  67. package/declarations/types/symbols.d.ts.map +1 -0
  68. package/declarations/types/utils.d.ts +5 -5
  69. package/declarations/types/utils.d.ts.map +1 -0
  70. package/declarations/types.d.ts +7 -10
  71. package/declarations/types.d.ts.map +1 -0
  72. package/dist/{context-COmAnXUQ.js → context-DE5sFezZ.js} +2 -2
  73. package/dist/context-DE5sFezZ.js.map +1 -0
  74. package/dist/index.js +104 -37
  75. package/dist/index.js.map +1 -0
  76. package/dist/request.js +1 -1
  77. package/dist/request.js.map +1 -0
  78. package/dist/types/-private.js +3 -3
  79. package/dist/types/-private.js.map +1 -0
  80. package/dist/types/cache/aliases.js.map +1 -0
  81. package/dist/types/cache/change.js.map +1 -0
  82. package/dist/types/cache/mutations.js.map +1 -0
  83. package/dist/types/cache/operations.js.map +1 -0
  84. package/dist/types/cache/relationship.js.map +1 -0
  85. package/dist/types/cache.js.map +1 -0
  86. package/dist/types/graph.js.map +1 -0
  87. package/dist/types/identifier.js.map +1 -0
  88. package/dist/types/json/raw.js.map +1 -0
  89. package/dist/types/params.js.map +1 -0
  90. package/dist/types/record.js +1 -1
  91. package/dist/types/record.js.map +1 -0
  92. package/dist/types/request.js +2 -2
  93. package/dist/types/request.js.map +1 -0
  94. package/dist/types/runtime.js +1 -1
  95. package/dist/types/runtime.js.map +1 -0
  96. package/dist/types/schema/concepts.js.map +1 -0
  97. package/dist/types/schema/fields.js +41 -8
  98. package/dist/types/schema/fields.js.map +1 -0
  99. package/dist/types/schema/fields.type-test.js.map +1 -0
  100. package/dist/types/spec/document.js.map +1 -0
  101. package/dist/types/spec/error.js.map +1 -0
  102. package/dist/types/spec/json-api-raw.js.map +1 -0
  103. package/dist/types/symbols.js +3 -3
  104. package/dist/types/symbols.js.map +1 -0
  105. package/dist/types/utils.js.map +1 -0
  106. package/dist/types.js.map +1 -0
  107. package/package.json +8 -11
  108. package/cjs-dist/addon-shim.cjs +0 -1
  109. package/cjs-dist/cjs-set-config.cjs +0 -1
  110. package/declarations/build-config/babel-macros.d.ts +0 -1
  111. package/declarations/build-config/canary-features.d.ts +0 -1
  112. package/declarations/build-config/debugging.d.ts +0 -1
  113. package/declarations/build-config/deprecations.d.ts +0 -1
  114. package/declarations/build-config/env.d.ts +0 -1
  115. package/declarations/build-config/macros.d.ts +0 -1
  116. package/declarations/build-config.d.ts +0 -1
  117. package/declarations/configure.d.ts +0 -7
  118. package/declarations/graph/-private/-diff.d.ts +0 -32
  119. package/declarations/graph/-private/-edge-definition.d.ts +0 -148
  120. package/declarations/graph/-private/-state.d.ts +0 -96
  121. package/declarations/graph/-private/-utils.d.ts +0 -31
  122. package/declarations/graph/-private/coerce-id.d.ts +0 -10
  123. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +0 -18
  124. package/declarations/graph/-private/edges/collection.d.ts +0 -39
  125. package/declarations/graph/-private/edges/implicit.d.ts +0 -43
  126. package/declarations/graph/-private/edges/resource.d.ts +0 -24
  127. package/declarations/graph/-private/graph.d.ts +0 -90
  128. package/declarations/graph/-private/normalize-link.d.ts +0 -8
  129. package/declarations/graph/-private/operations/add-to-related-records.d.ts +0 -4
  130. package/declarations/graph/-private/operations/merge-identifier.d.ts +0 -3
  131. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +0 -4
  132. package/declarations/graph/-private/operations/replace-related-record.d.ts +0 -3
  133. package/declarations/graph/-private/operations/replace-related-records.d.ts +0 -62
  134. package/declarations/graph/-private/operations/update-relationship.d.ts +0 -13
  135. package/declarations/graph/-private.d.ts +0 -13
  136. package/declarations/reactive/-private/document.d.ts +0 -146
  137. package/declarations/reactive/-private/fields/compute.d.ts +0 -43
  138. package/declarations/reactive/-private/fields/extension.d.ts +0 -8
  139. package/declarations/reactive/-private/fields/managed-array.d.ts +0 -22
  140. package/declarations/reactive/-private/fields/managed-object.d.ts +0 -21
  141. package/declarations/reactive/-private/fields/many-array-manager.d.ts +0 -19
  142. package/declarations/reactive/-private/hooks.d.ts +0 -5
  143. package/declarations/reactive/-private/record.d.ts +0 -64
  144. package/declarations/reactive/-private/schema.d.ts +0 -271
  145. package/declarations/reactive/-private/symbols.d.ts +0 -36
  146. package/declarations/reactive/-private.d.ts +0 -1
  147. package/declarations/reactive.d.ts +0 -4
  148. package/declarations/store/-private/cache-handler/handler.d.ts +0 -62
  149. package/declarations/store/-private/cache-handler/types.d.ts +0 -98
  150. package/declarations/store/-private/cache-handler/utils.d.ts +0 -32
  151. package/declarations/store/-private/caches/cache-utils.d.ts +0 -12
  152. package/declarations/store/-private/caches/identifier-cache.d.ts +0 -304
  153. package/declarations/store/-private/caches/instance-cache.d.ts +0 -65
  154. package/declarations/store/-private/caches/resource-utils.d.ts +0 -9
  155. package/declarations/store/-private/debug/utils.d.ts +0 -6
  156. package/declarations/store/-private/default-cache-policy.d.ts +0 -384
  157. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +0 -159
  158. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +0 -17
  159. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +0 -25
  160. package/declarations/store/-private/managers/cache-manager.d.ts +0 -443
  161. package/declarations/store/-private/managers/notification-manager.d.ts +0 -98
  162. package/declarations/store/-private/managers/record-array-manager.d.ts +0 -97
  163. package/declarations/store/-private/network/request-cache.d.ts +0 -107
  164. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +0 -263
  165. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +0 -176
  166. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +0 -169
  167. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +0 -35
  168. package/declarations/store/-private/new-core-tmp/request-state.d.ts +0 -277
  169. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +0 -261
  170. package/declarations/store/-private/record-arrays/identifier-array.d.ts +0 -147
  171. package/declarations/store/-private/record-arrays/many-array.d.ts +0 -197
  172. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +0 -126
  173. package/declarations/store/-private/store-service.d.ts +0 -1605
  174. package/declarations/store/-private/utils/coerce-id.d.ts +0 -10
  175. package/declarations/store/-private/utils/construct-resource.d.ts +0 -6
  176. package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
  177. package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
  178. package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
  179. package/declarations/store/-private.d.ts +0 -31
  180. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +0 -99
  181. package/declarations/store/-types/q/ds-model.d.ts +0 -21
  182. package/declarations/store/-types/q/identifier.d.ts +0 -20
  183. package/declarations/store/-types/q/record-instance.d.ts +0 -23
  184. package/declarations/store/-types/q/schema-service.d.ts +0 -354
  185. package/declarations/store/-types/q/store.d.ts +0 -32
  186. package/declarations/store.d.ts +0 -1
  187. package/declarations/utils/string.d.ts +0 -48
  188. package/dist/build-config/babel-macros.js +0 -1
  189. package/dist/build-config/canary-features.js +0 -1
  190. package/dist/build-config/debugging.js +0 -1
  191. package/dist/build-config/deprecations.js +0 -1
  192. package/dist/build-config/env.js +0 -1
  193. package/dist/build-config/macros.js +0 -1
  194. package/dist/build-config.js +0 -1
  195. package/dist/configure-B48bFHOl.js +0 -181
  196. package/dist/configure.js +0 -1
  197. package/dist/graph/-private.js +0 -3372
  198. package/dist/handler-C2T-IyJK.js +0 -339
  199. package/dist/reactive/-private.js +0 -1
  200. package/dist/reactive.js +0 -1988
  201. package/dist/request-state-CjLph1LP.js +0 -8139
  202. package/dist/store/-private.js +0 -3
  203. package/dist/store.js +0 -545
  204. package/dist/symbols-SIstXMLI.js +0 -44
  205. package/dist/utils/string.js +0 -92
  206. package/logos/NCC-1701-a-blue.svg +0 -4
  207. package/logos/NCC-1701-a-gold.svg +0 -4
  208. package/logos/NCC-1701-a-gold_100.svg +0 -1
  209. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  210. package/logos/NCC-1701-a.svg +0 -4
  211. package/logos/README.md +0 -4
  212. package/logos/docs-badge.svg +0 -2
  213. package/logos/ember-data-logo-dark.svg +0 -12
  214. package/logos/ember-data-logo-light.svg +0 -12
  215. package/logos/github-header.svg +0 -444
  216. package/logos/social1.png +0 -0
  217. package/logos/social2.png +0 -0
  218. package/logos/warp-drive-logo-dark.svg +0 -4
  219. package/logos/warp-drive-logo-gold.svg +0 -4
@@ -1,146 +0,0 @@
1
- import type { Store } from "../../store/-private/store-service.js";
2
- import type { StableDocumentIdentifier } from "../../types/identifier.js";
3
- import type { ImmutableRequestInfo, RequestInfo } from "../../types/request.js";
4
- import type { ResourceDocument } from "../../types/spec/document.js";
5
- import type { Meta, PaginationLinks } from "../../types/spec/json-api-raw.js";
6
- /**
7
- * A Document is a class that wraps the response content from a request to the API
8
- * returned by `Cache.put` or `Cache.peek`, converting resource-identifiers into
9
- * record instances.
10
- *
11
- * It is not directly instantiated by the user, and its properties should not
12
- * be directly modified. Whether individual properties are mutable or not is
13
- * determined by the record instance itself.
14
- *
15
- * @public
16
- * @hideconstructor
17
- */
18
- export declare class ReactiveDocument<T> {
19
- #private;
20
- /**
21
- * The links object for this document, if any
22
- *
23
- * e.g.
24
- *
25
- * ```
26
- * {
27
- * self: '/articles?page[number]=3',
28
- * }
29
- * ```
30
- *
31
- * @property links
32
- * @type {Object|undefined} - a links object
33
- * @public
34
- */
35
- readonly links?: PaginationLinks;
36
- /**
37
- * The primary data for this document, if any.
38
- *
39
- * If this document has no primary data (e.g. because it is an error document)
40
- * this property will be `undefined`.
41
- *
42
- * For collections this will be an array of record instances,
43
- * for single resource requests it will be a single record instance or null.
44
- *
45
- * @property data
46
- * @public
47
- * @type {Object|Array<object>|null|undefined} - a data object
48
- */
49
- readonly data?: T;
50
- /**
51
- * The errors returned by the API for this request, if any
52
- *
53
- * @property errors
54
- * @public
55
- * @type {Object|undefined} - an errors object
56
- */
57
- readonly errors?: object[];
58
- /**
59
- * The meta object for this document, if any
60
- *
61
- * @property meta
62
- * @public
63
- * @type {Object|undefined} - a meta object
64
- */
65
- readonly meta?: Meta;
66
- /**
67
- * The identifier associated with this document, if any
68
- *
69
- * @property identifier
70
- * @public
71
- * @type {StableDocumentIdentifier|null}
72
- */
73
- readonly identifier: StableDocumentIdentifier | null;
74
- protected readonly _store: Store;
75
- protected readonly _localCache: {
76
- document: ResourceDocument;
77
- request: ImmutableRequestInfo;
78
- } | null;
79
- constructor(store: Store, identifier: StableDocumentIdentifier | null, localCache: {
80
- document: ResourceDocument;
81
- request: ImmutableRequestInfo;
82
- } | null);
83
- /**
84
- * Fetches the related link for this document, returning a promise that resolves
85
- * with the document when the request completes. If no related link is present,
86
- * will fallback to the self link if present
87
- *
88
- * @public
89
- * @param {Object} options
90
- * @return {Promise<Document>}
91
- */
92
- fetch(options?: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T>>;
93
- /**
94
- * Fetches the next link for this document, returning a promise that resolves
95
- * with the new document when the request completes, or null if there is no
96
- * next link.
97
- *
98
- * @public
99
- * @param {Object} options
100
- * @return {Promise<Document | null>}
101
- */
102
- next(options?: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null>;
103
- /**
104
- * Fetches the prev link for this document, returning a promise that resolves
105
- * with the new document when the request completes, or null if there is no
106
- * prev link.
107
- *
108
- * @public
109
- * @param {Object} options
110
- * @return {Promise<Document | null>}
111
- */
112
- prev(options: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null>;
113
- /**
114
- * Fetches the first link for this document, returning a promise that resolves
115
- * with the new document when the request completes, or null if there is no
116
- * first link.
117
- *
118
- * @public
119
- * @param {Object} options
120
- * @return {Promise<Document | null>}
121
- */
122
- first(options: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null>;
123
- /**
124
- * Fetches the last link for this document, returning a promise that resolves
125
- * with the new document when the request completes, or null if there is no
126
- * last link.
127
- *
128
- * @public
129
- * @param {Object} options
130
- * @return {Promise<Document | null>}
131
- */
132
- last(options: RequestInfo<ReactiveDocument<T>, T>): Promise<ReactiveDocument<T> | null>;
133
- /**
134
- * Implemented for `JSON.stringify` support.
135
- *
136
- * Returns the JSON representation of the document wrapper.
137
- *
138
- * This is a shallow serialization, it does not deeply serialize
139
- * the document's contents, leaving that to the individual record
140
- * instances to determine how to do, if at all.
141
- *
142
- * @public
143
- * @return
144
- */
145
- toJSON(): object;
146
- }
@@ -1,43 +0,0 @@
1
- import type { Store, StoreRequestInput } from "../../../index.js";
2
- import type { Future } from "../../../request.js";
3
- import { RelatedCollection as ManyArray } from "../../../store/-private.js";
4
- import type { Cache } from "../../../types/cache.js";
5
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
6
- import type { ArrayField, DerivedField, FieldSchema, GenericField, LegacyHasManyField, LocalField, ObjectField, SchemaArrayField, SchemaObjectField } from "../../../types/schema/fields.js";
7
- import type { Links } from "../../../types/spec/json-api-raw.js";
8
- import { RecordStore } from "../../../types/symbols.js";
9
- import { ReactiveResource } from "../record.js";
10
- import type { SchemaService } from "../schema.js";
11
- import { Parent } from "../symbols.js";
12
- import { ManagedArray } from "./managed-array.js";
13
- import { ManagedObject } from "./managed-object.js";
14
- export declare const ManagedArrayMap: Map<ReactiveResource, Map<string, ManagedArray | ManyArray>>;
15
- export declare const ManagedObjectMap: Map<ReactiveResource, Map<string, ManagedObject | ReactiveResource>>;
16
- export declare function computeLocal(record: typeof Proxy<ReactiveResource>, field: LocalField, prop: string): unknown;
17
- export declare function peekManagedArray(record: ReactiveResource, field: FieldSchema): ManyArray | ManagedArray | undefined;
18
- export declare function peekManagedObject(record: ReactiveResource, field: ObjectField): ManagedObject | undefined;
19
- export declare function peekManagedObject(record: ReactiveResource, field: SchemaObjectField): ReactiveResource | undefined;
20
- export declare function computeField(schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: GenericField, prop: string | string[], editable: boolean): unknown;
21
- export declare function computeArray(store: Store, schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: ArrayField | SchemaArrayField, path: string[], editable: boolean, legacy: boolean): ManagedArray | null;
22
- export declare function computeObject(schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: ObjectField, path: string[], editable: boolean, legacy: boolean): ManagedObject | null;
23
- export declare function computeSchemaObject(store: Store, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: SchemaObjectField, path: string[], legacy: boolean, editable: boolean): ReactiveResource | null;
24
- export declare function computeAttribute(cache: Cache, identifier: StableRecordIdentifier, prop: string, editable: boolean): unknown;
25
- export declare function computeDerivation(schema: SchemaService, record: ReactiveResource, identifier: StableRecordIdentifier, field: DerivedField, prop: string): unknown;
26
- interface ResourceRelationship<T extends ReactiveResource = ReactiveResource> {
27
- lid: string;
28
- [Parent]: ReactiveResource;
29
- [RecordStore]: Store;
30
- name: string;
31
- data: T | null;
32
- links: Links;
33
- meta: Record<string, unknown>;
34
- }
35
- // TODO probably this should just be a Document
36
- // but its separate until we work out the lid situation
37
- declare class ResourceRelationship<T extends ReactiveResource = ReactiveResource> {
38
- constructor(store: Store, cache: Cache, parent: ReactiveResource, identifier: StableRecordIdentifier, field: FieldSchema, name: string, editable: boolean);
39
- fetch(options?: StoreRequestInput<T, T>): Future<T>;
40
- }
41
- export declare function computeResource<T extends ReactiveResource>(store: Store, cache: Cache, parent: ReactiveResource, identifier: StableRecordIdentifier, field: FieldSchema, prop: string, editable: boolean): ResourceRelationship<T>;
42
- export declare function computeHasMany(store: Store, schema: SchemaService, cache: Cache, record: ReactiveResource, identifier: StableRecordIdentifier, field: LegacyHasManyField, path: string[], editable: boolean, legacy: boolean): ManyArray | null;
43
- export {};
@@ -1,8 +0,0 @@
1
- import type { SignalStore, WarpDriveSignal } from "../../../store/-private/new-core-tmp/reactivity/internal.js";
2
- import type { ExtensionDef } from "../schema.js";
3
- export type ProxiedMethod = (...args: unknown[]) => unknown;
4
- export declare function expectNever(value: never): void;
5
- export declare function isExtensionProp(extensions: Map<string | symbol, ExtensionDef> | null, prop: string | number | symbol): prop is string | symbol;
6
- export declare function performObjectExtensionGet(receiver: object, extensions: Map<string | symbol, ExtensionDef>, signals: SignalStore, prop: string | symbol): unknown;
7
- export declare function performExtensionSet(receiver: object, extensions: Map<string | symbol, ExtensionDef>, signals: SignalStore, prop: string | symbol, value: unknown): boolean;
8
- export declare function performArrayExtensionGet(receiver: object, extensions: Map<string | symbol, ExtensionDef>, signals: SignalStore, prop: string | symbol, _SIGNAL: WarpDriveSignal, boundFns: Map<string | symbol | number, ProxiedMethod>, transaction: (v: boolean) => void): unknown;
@@ -1,22 +0,0 @@
1
- import type { Store } from "../../../index.js";
2
- import type { WarpDriveSignal } from "../../../store/-private.js";
3
- import { ARRAY_SIGNAL } from "../../../store/-private.js";
4
- import type { Cache } from "../../../types/cache.js";
5
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
6
- import type { ArrayField, SchemaArrayField } from "../../../types/schema/fields.js";
7
- import { ReactiveResource } from "../record.js";
8
- import type { SchemaService } from "../schema.js";
9
- import { Editable, Legacy, SOURCE } from "../symbols.js";
10
- export interface ManagedArray extends Omit<Array<unknown>, "[]"> {
11
- [SOURCE]: unknown[];
12
- identifier: StableRecordIdentifier;
13
- path: string[];
14
- owner: ReactiveResource;
15
- [ARRAY_SIGNAL]: WarpDriveSignal;
16
- [Editable]: boolean;
17
- [Legacy]: boolean;
18
- }
19
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
20
- 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);
22
- }
@@ -1,21 +0,0 @@
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
- import type { ObjectField, SchemaObjectField } from "../../../types/schema/fields.js";
5
- import type { ReactiveResource } from "../record.js";
6
- import type { SchemaService } from "../schema.js";
7
- import { Editable, EmbeddedPath, Legacy, Parent, SOURCE } from "../symbols.js";
8
- export declare function notifyObject(obj: ManagedObject): void;
9
- // const ignoredGlobalFields = new Set<string>(['setInterval', 'nodeType', 'nodeName', 'length', 'document', STRUCTURED]);
10
- export interface ManagedObject {
11
- [SOURCE]: object;
12
- [Parent]: StableRecordIdentifier;
13
- [EmbeddedPath]: string[];
14
- [OBJECT_SIGNAL]: WarpDriveSignal;
15
- [Editable]: boolean;
16
- [Legacy]: boolean;
17
- }
18
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
19
- 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);
21
- }
@@ -1,19 +0,0 @@
1
- import type { Store } from "../../../index.js";
2
- import type { RelatedCollection as ManyArray } from "../../../store/-private.js";
3
- import type { LocalRelationshipOperation } from "../../../types/graph.js";
4
- import type { StableRecordIdentifier } from "../../../types/identifier.js";
5
- import type { ReactiveResource } from "../record.js";
6
- export interface FindHasManyOptions {
7
- reload?: boolean;
8
- backgroundReload?: boolean;
9
- }
10
- export declare class ManyArrayManager {
11
- record: ReactiveResource;
12
- store: Store;
13
- identifier: StableRecordIdentifier;
14
- editable: boolean;
15
- constructor(record: ReactiveResource, editable: boolean);
16
- _syncArray(array: ManyArray): void;
17
- reloadHasMany<T>(key: string, options?: FindHasManyOptions): Promise<ManyArray<T>>;
18
- mutate(mutation: LocalRelationshipOperation): void;
19
- }
@@ -1,5 +0,0 @@
1
- import type { Store } from "../../index.js";
2
- import type { StableRecordIdentifier } from "../../types.js";
3
- import { ReactiveResource } from "./record.js";
4
- export declare function instantiateRecord(store: Store, identifier: StableRecordIdentifier, createArgs?: Record<string, unknown>): ReactiveResource;
5
- export declare function teardownRecord(record: unknown): void;
@@ -1,64 +0,0 @@
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";
4
- import { RecordStore } from "../../types/symbols.js";
5
- import { Checkout, Destroy, Editable, EmbeddedField, EmbeddedPath, Identifier, Legacy, Parent } from "./symbols.js";
6
- export { Editable, Legacy, Checkout } from "./symbols.js";
7
- export interface ReactiveResource {
8
- [Symbol.toStringTag]: `ReactiveResource<${string}>`;
9
- /** @internal */
10
- [RecordStore]: Store;
11
- /** @internal */
12
- [Identifier]: StableRecordIdentifier;
13
- /** @internal */
14
- [Parent]: StableRecordIdentifier;
15
- /** @internal */
16
- [EmbeddedField]: SchemaArrayField | SchemaObjectField | null;
17
- /** @internal */
18
- [EmbeddedPath]: string[] | null;
19
- /** @internal */
20
- [Editable]: boolean;
21
- /** @internal */
22
- [Legacy]: boolean;
23
- /** @internal */
24
- ___notifications: object;
25
- /** @internal */
26
- [Destroy](): void;
27
- /**
28
- * Create an editable copy of the record
29
- *
30
- * ReactiveResource instances are not editable by default. This method creates an editable copy of the record. To use,
31
- * import the `Checkout` symbol from `@warp-drive/schema-record` and call it on the record.
32
- *
33
- * ```ts
34
- * import { Checkout } from '@warp-drive/schema-record';
35
- *
36
- * const record = store.peekRecord('user', '1');
37
- * const editableRecord = await record[Checkout]();
38
- * ```
39
- *
40
- * @returns a promise that resolves to the editable record
41
- * @throws if the record is already editable or if the record is embedded
42
- *
43
- */
44
- [Checkout]<T>(): Promise<T>;
45
- }
46
- /**
47
- * A class that uses a the ResourceSchema for a ResourceType
48
- * and a ResouceKey to transform data from the cache into a rich, reactive
49
- * object.
50
- *
51
- * This class is not directly instantiable. To use it, you should
52
- * configure the store's `instantiateRecord` and `teardownRecord` hooks
53
- * with the matching hooks provided by this package.
54
- *
55
- * @hideconstructor
56
- * @public
57
- */
58
- // eslint-disable-next-line @typescript-eslint/no-extraneous-class
59
- 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);
64
- }
@@ -1,271 +0,0 @@
1
- import type { Store } from "../../store/-private.js";
2
- import type { SchemaService as SchemaServiceInterface } from "../../types.js";
3
- import type { StableRecordIdentifier } from "../../types/identifier.js";
4
- import type { ObjectValue, Value } from "../../types/json/raw.js";
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";
7
- import { Type } from "../../types/symbols.js";
8
- import type { WithPartial } from "../../types/utils.js";
9
- import type { ReactiveResource } from "./record.js";
10
- /**
11
- * Extensions allow providing non-schema driven behaviors to
12
- * reactive resources and arrays.
13
- */
14
- export interface CAUTION_MEGA_DANGER_ZONE_Extension {
15
- /**
16
- * Whether this extension extends the behaviors of objects
17
- * or of arrays.
18
- */
19
- kind: "object" | "array";
20
- /**
21
- * The name of the extension, to be used when specifying
22
- * either `objectExtensions` or `arrayExtensions`
23
- */
24
- name: string;
25
- /**
26
- * An object with iterable keys whose values are the getters
27
- * or methods to expose on the object or array.
28
- *
29
- * or
30
- *
31
- * A constructable such as a Function or Class whose prototype
32
- * will be iterated with getOwnPropertyNames.
33
- */
34
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
35
- features: Record<string | symbol, unknown> | Function;
36
- }
37
- export type ExtensionDef = {
38
- kind: "method";
39
- // eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
40
- fn: Function;
41
- } | {
42
- kind: "readonly-value";
43
- value: unknown;
44
- } | {
45
- kind: "mutable-value";
46
- value: unknown;
47
- } | {
48
- kind: "readonly-field";
49
- get: () => unknown;
50
- } | {
51
- kind: "mutable-field";
52
- get: () => unknown;
53
- set: (value: unknown) => void;
54
- } | {
55
- kind: "writeonly-field";
56
- set: (value: unknown) => void;
57
- };
58
- export interface ProcessedExtension {
59
- kind: "object" | "array";
60
- name: string;
61
- features: Map<string | symbol, ExtensionDef>;
62
- }
63
- export interface ExtensibleField {
64
- kind: "schema-object" | "schema-array" | "array" | "object" | "hasMany";
65
- options?: {
66
- objectExtensions?: string[];
67
- arrayExtensions?: string[];
68
- };
69
- }
70
- /**
71
- * Utility for constructing a ResourceSchema with the recommended
72
- * fields for the PolarisMode experience.
73
- *
74
- * Using this requires registering the PolarisMode derivations
75
- *
76
- * ```ts
77
- * import { registerDerivations } from '@warp-drive/schema-record';
78
- *
79
- * registerDerivations(schema);
80
- * ```
81
- *
82
- * @public
83
- * @param schema
84
- * @return {PolarisResourceSchema}
85
- */
86
- export declare function withDefaults(schema: WithPartial<PolarisResourceSchema, "identity">): ResourceSchema;
87
- interface FromIdentityDerivation {
88
- (record: ReactiveResource, options: {
89
- key: "lid";
90
- } | {
91
- key: "type";
92
- }, key: string): string;
93
- (record: ReactiveResource, options: {
94
- key: "id";
95
- }, key: string): string | null;
96
- (record: ReactiveResource, options: {
97
- key: "^";
98
- }, key: string): StableRecordIdentifier;
99
- (record: ReactiveResource, options: null, key: string): asserts options;
100
- (record: ReactiveResource, options: {
101
- key: "id" | "lid" | "type" | "^";
102
- } | null, key: string): StableRecordIdentifier | string | null;
103
- [Type]: "@identity";
104
- }
105
- /**
106
- * A derivation that computes its value from the
107
- * record's identity.
108
- *
109
- * It can be used via a derived field definition like:
110
- *
111
- * ```ts
112
- * {
113
- * kind: 'derived',
114
- * name: 'id',
115
- * type: '@identity',
116
- * options: { key: 'id' }
117
- * }
118
- * ```
119
- *
120
- * Valid keys are `'id'`, `'lid'`, `'type'`, and `'^'`.
121
- *
122
- * `^` returns the entire identifier object.
123
- *
124
- * @public
125
- */
126
- export declare const fromIdentity: FromIdentityDerivation;
127
- /**
128
- * Registers the default derivations for records that want
129
- * to use the PolarisMode defaults provided by
130
- *
131
- * ```ts
132
- * import { withDefaults } from '@warp-drive/schema-record';
133
- * ```
134
- *
135
- * @public
136
- * @param {SchemaService} schema
137
- */
138
- export declare function registerDerivations(schema: SchemaServiceInterface): void;
139
- interface InternalSchema {
140
- original: ResourceSchema | ObjectSchema;
141
- traits: Set<string>;
142
- fields: Map<string, FieldSchema>;
143
- attributes: Record<string, LegacyAttributeField>;
144
- relationships: Record<string, LegacyRelationshipField>;
145
- }
146
- export type Transformation<
147
- T extends Value = Value,
148
- PT = unknown
149
- > = {
150
- serialize(value: PT, options: Record<string, unknown> | null, record: ReactiveResource): T;
151
- hydrate(value: T | undefined, options: Record<string, unknown> | null, record: ReactiveResource): PT;
152
- defaultValue?(options: Record<string, unknown> | null, identifier: StableRecordIdentifier): T;
153
- [Type]: string;
154
- };
155
- interface KindFns {
156
- belongsTo: {
157
- get: (store: Store, record: object, resourceKey: StableRecordIdentifier, field: LegacyBelongsToField) => unknown;
158
- set: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyBelongsToField, value: unknown) => void;
159
- };
160
- hasMany: {
161
- get: (store: Store, record: object, resourceKey: StableRecordIdentifier, field: LegacyHasManyField) => unknown;
162
- set: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyHasManyField, value: unknown) => void;
163
- notify: (store: Store, record: object, cacheKey: StableRecordIdentifier, field: LegacyHasManyField) => boolean;
164
- };
165
- }
166
- export interface SchemaService {
167
- doesTypeExist(type: string): boolean;
168
- attributesDefinitionFor(identifier: {
169
- type: string;
170
- }): InternalSchema["attributes"];
171
- relationshipsDefinitionFor(identifier: {
172
- type: string;
173
- }): InternalSchema["relationships"];
174
- }
175
- /**
176
- * A SchemaService designed to work with dynamically registered schemas.
177
- *
178
- * @class SchemaService
179
- * @public
180
- */
181
- export declare class SchemaService implements SchemaServiceInterface {
182
- /** @internal */
183
- _schemas: Map<string, InternalSchema>;
184
- /** @internal */
185
- _transforms: Map<string, Transformation>;
186
- /** @internal */
187
- _hashFns: Map<string, HashFn>;
188
- /** @internal */
189
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
190
- _derivations: Map<string, Derivation<any, any, any>>;
191
- /** @internal */
192
- _traits: Set<string>;
193
- /** @internal */
194
- _modes: Map<string, KindFns>;
195
- /** @internal */
196
- _extensions: {
197
- object: Map<string, ProcessedExtension>;
198
- array: Map<string, ProcessedExtension>;
199
- };
200
- _cachedFieldExtensionsByField: {
201
- object: Map<object, ProcessedExtension["features"] | null>;
202
- array: Map<object, ProcessedExtension["features"] | null>;
203
- };
204
- constructor();
205
- resourceTypes(): Readonly<string[]>;
206
- hasTrait(type: string): boolean;
207
- resourceHasTrait(resource: StableRecordIdentifier | {
208
- type: string;
209
- }, trait: string): boolean;
210
- transformation(field: GenericField | ObjectField | ArrayField | {
211
- type: string;
212
- }): Transformation;
213
- derivation(field: DerivedField | {
214
- type: string;
215
- }): Derivation;
216
- hashFn(field: HashField | {
217
- type: string;
218
- }): HashFn;
219
- resource(resource: StableRecordIdentifier | {
220
- type: string;
221
- }): ResourceSchema | ObjectSchema;
222
- registerResources(schemas: Array<ResourceSchema | ObjectSchema>): void;
223
- registerResource(schema: ResourceSchema | ObjectSchema): void;
224
- registerTransformation<
225
- T extends Value = string,
226
- PT = unknown
227
- >(transformation: Transformation<T, PT>): void;
228
- registerDerivation<
229
- R,
230
- T,
231
- FM extends ObjectValue | null
232
- >(derivation: Derivation<R, T, FM>): void;
233
- CAUTION_MEGA_DANGER_ZONE_registerExtension(extension: CAUTION_MEGA_DANGER_ZONE_Extension): void;
234
- CAUTION_MEGA_DANGER_ZONE_resourceExtensions(resource: StableRecordIdentifier | {
235
- type: string;
236
- }): null | ProcessedExtension["features"];
237
- CAUTION_MEGA_DANGER_ZONE_objectExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
238
- CAUTION_MEGA_DANGER_ZONE_arrayExtensions(field: ExtensibleField): null | ProcessedExtension["features"];
239
- /**
240
- * This is an internal method used to register behaviors for legacy mode.
241
- * It is not intended for public use.
242
- *
243
- * We do think a generalized `kind` registration system would be useful,
244
- * but we have not yet designed it.
245
- *
246
- * See https://github.com/emberjs/data/issues/9534
247
- *
248
- * @internal
249
- */
250
- _registerMode(mode: string, kinds: KindFns): void;
251
- /**
252
- * This is an internal method used to enable legacy behaviors for legacy mode.
253
- * It is not intended for public use.
254
- *
255
- * We do think a generalized `kind` registration system would be useful,
256
- * but we have not yet designed it.
257
- *
258
- * See https://github.com/emberjs/data/issues/9534
259
- *
260
- * @internal
261
- */
262
- _kind<T extends keyof KindFns>(mode: string, kind: T): KindFns[T];
263
- registerHashFn<T extends object>(hashFn: HashFn<T>): void;
264
- fields({ type }: {
265
- type: string;
266
- }): InternalSchema["fields"];
267
- hasResource(resource: {
268
- type: string;
269
- }): boolean;
270
- }
271
- export {};
@@ -1,36 +0,0 @@
1
- // Great, got your attention with that warning didn't we?
2
- // Good. Here's the deal: typescript treats symbols as unique types.
3
- // If by accident a module creating a symbol is processed more than
4
- // once, the symbol will be different in each processing. This will
5
- // cause a type error.
6
- // It could also cause a runtime error if the symbol is used innapropriately.
7
- // However, this case is extremely hard to hit and would require other things
8
- // to go wrong first.
9
- //
10
- // So, why do the warning? And why do we lie about the types of the symbols?
11
- //
12
- // Because we intentionally create multiple copies of them within the types
13
- // at build time. This is because we rollup our d.ts files in order to give
14
- // our consumers a better experience.
15
- //
16
- // However, no tool today supports rolling up d.ts files with multiple entry
17
- // points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor
18
- // which creates a fully unique stand-alone types file per-entry-point. Thus
19
- // every entry point that uses one of these symbols somewhere will have accidentally
20
- // created a new symbol type.
21
- //
22
- // This cast allows us to rollup these types using this tool while not encountering
23
- // the unique symbol type issue.
24
- //
25
- // Note that none of these symbols are part of the public API, these are used for
26
- // debugging DX and as a safe way to provide an intimate contract on public objects.
27
- export declare const SOURCE: "___(unique) Symbol(SOURCE)";
28
- export declare const MUTATE: "___(unique) Symbol(MUTATE)";
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
- 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)";
@@ -1 +0,0 @@
1
- export { Editable, Legacy } from "./-private/symbols.js";
@@ -1,4 +0,0 @@
1
- export { instantiateRecord, teardownRecord } from "./reactive/-private/hooks.js";
2
- export { type CAUTION_MEGA_DANGER_ZONE_Extension, type ProcessedExtension, type ExtensionDef, type Transformation, SchemaService, withDefaults, fromIdentity, registerDerivations } from "./reactive/-private/schema.js";
3
- export { type ReactiveResource } from "./reactive/-private/record.js";
4
- export { Checkout } from "./reactive/-private/symbols.js";