@warp-drive/core 5.6.0-alpha.14 → 5.6.0-alpha.17

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 (287) hide show
  1. package/declarations/build-config/babel-macros.d.ts +1 -2
  2. package/declarations/build-config/canary-features.d.ts +1 -2
  3. package/declarations/build-config/debugging.d.ts +1 -2
  4. package/declarations/build-config/deprecations.d.ts +1 -2
  5. package/declarations/build-config/env.d.ts +1 -2
  6. package/declarations/build-config/macros.d.ts +1 -2
  7. package/declarations/build-config.d.ts +1 -2
  8. package/declarations/configure.d.ts +6 -7
  9. package/declarations/graph/-private/-diff.d.ts +21 -22
  10. package/declarations/graph/-private/-edge-definition.d.ts +134 -135
  11. package/declarations/graph/-private/-state.d.ts +93 -7
  12. package/declarations/graph/-private/-utils.d.ts +18 -13
  13. package/declarations/graph/-private/coerce-id.d.ts +6 -1
  14. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +15 -4
  15. package/declarations/graph/-private/edges/collection.d.ts +35 -36
  16. package/declarations/graph/-private/edges/implicit.d.ts +28 -29
  17. package/declarations/graph/-private/edges/resource.d.ts +19 -20
  18. package/declarations/graph/-private/graph.d.ts +83 -48
  19. package/declarations/graph/-private/normalize-link.d.ts +7 -2
  20. package/declarations/graph/-private/operations/add-to-related-records.d.ts +3 -4
  21. package/declarations/graph/-private/operations/merge-identifier.d.ts +2 -3
  22. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +3 -4
  23. package/declarations/graph/-private/operations/replace-related-record.d.ts +2 -3
  24. package/declarations/graph/-private/operations/replace-related-records.d.ts +58 -4
  25. package/declarations/graph/-private/operations/update-relationship.d.ts +11 -9
  26. package/declarations/graph/-private.d.ts +9 -10
  27. package/declarations/index.d.ts +11 -12
  28. package/declarations/reactive/-private/document.d.ts +143 -144
  29. package/declarations/reactive/-private/fields/compute.d.ts +31 -28
  30. package/declarations/reactive/-private/fields/extension.d.ts +8 -0
  31. package/declarations/reactive/-private/fields/managed-array.d.ts +19 -20
  32. package/declarations/reactive/-private/fields/managed-object.d.ts +16 -16
  33. package/declarations/reactive/-private/fields/many-array-manager.d.ts +15 -16
  34. package/declarations/reactive/-private/hooks.d.ts +3 -4
  35. package/declarations/reactive/-private/record.d.ts +61 -58
  36. package/declarations/reactive/-private/schema.d.ts +256 -165
  37. package/declarations/reactive/-private/symbols.d.ts +27 -2
  38. package/declarations/reactive/-private.d.ts +1 -2
  39. package/declarations/reactive.d.ts +4 -5
  40. package/declarations/request/-private/context.d.ts +34 -35
  41. package/declarations/request/-private/debug.d.ts +2 -3
  42. package/declarations/request/-private/fetch.d.ts +23 -24
  43. package/declarations/request/-private/future.d.ts +3 -4
  44. package/declarations/request/-private/manager.d.ts +159 -157
  45. package/declarations/request/-private/promise-cache.d.ts +21 -13
  46. package/declarations/request/-private/types.d.ts +124 -124
  47. package/declarations/request/-private/utils.d.ts +8 -9
  48. package/declarations/request.d.ts +5 -6
  49. package/declarations/store/-private/cache-handler/handler.d.ts +57 -52
  50. package/declarations/store/-private/cache-handler/types.d.ts +95 -96
  51. package/declarations/store/-private/cache-handler/utils.d.ts +16 -16
  52. package/declarations/store/-private/caches/cache-utils.d.ts +7 -4
  53. package/declarations/store/-private/caches/identifier-cache.d.ts +234 -246
  54. package/declarations/store/-private/caches/instance-cache.d.ts +47 -47
  55. package/declarations/store/-private/caches/resource-utils.d.ts +3 -4
  56. package/declarations/store/-private/debug/utils.d.ts +6 -7
  57. package/declarations/store/-private/default-cache-policy.d.ts +362 -361
  58. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +154 -159
  59. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +14 -14
  60. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +21 -22
  61. package/declarations/store/-private/managers/cache-manager.d.ts +440 -425
  62. package/declarations/store/-private/managers/notification-manager.d.ts +88 -83
  63. package/declarations/store/-private/managers/record-array-manager.d.ts +89 -90
  64. package/declarations/store/-private/network/request-cache.d.ts +86 -83
  65. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +252 -244
  66. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +155 -72
  67. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +148 -149
  68. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +28 -23
  69. package/declarations/store/-private/new-core-tmp/request-state.d.ts +263 -241
  70. package/declarations/store/-private/new-core-tmp/request-subscription.d.ts +261 -0
  71. package/declarations/store/-private/record-arrays/identifier-array.d.ts +125 -119
  72. package/declarations/store/-private/record-arrays/many-array.d.ts +180 -182
  73. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +120 -110
  74. package/declarations/store/-private/store-service.d.ts +1594 -1586
  75. package/declarations/store/-private/utils/coerce-id.d.ts +6 -1
  76. package/declarations/store/-private/utils/construct-resource.d.ts +1 -2
  77. package/declarations/store/-private/utils/is-non-empty-string.d.ts +0 -1
  78. package/declarations/store/-private/utils/normalize-model-name.d.ts +0 -1
  79. package/declarations/store/-private/utils/uuid-polyfill.d.ts +0 -1
  80. package/declarations/store/-private.d.ts +31 -27
  81. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +96 -97
  82. package/declarations/store/-types/q/ds-model.d.ts +17 -18
  83. package/declarations/store/-types/q/identifier.d.ts +11 -12
  84. package/declarations/store/-types/q/record-instance.d.ts +16 -17
  85. package/declarations/store/-types/q/schema-service.d.ts +346 -323
  86. package/declarations/store/-types/q/store.d.ts +25 -28
  87. package/declarations/store.d.ts +1 -2
  88. package/declarations/types/-private.d.ts +16 -8
  89. package/declarations/types/cache/aliases.d.ts +11 -1
  90. package/declarations/types/cache/change.d.ts +4 -5
  91. package/declarations/types/cache/mutations.d.ts +51 -28
  92. package/declarations/types/cache/operations.d.ts +60 -47
  93. package/declarations/types/cache/relationship.d.ts +11 -9
  94. package/declarations/types/cache.d.ts +495 -484
  95. package/declarations/types/graph.d.ts +31 -32
  96. package/declarations/types/identifier.d.ts +83 -82
  97. package/declarations/types/json/raw.d.ts +1 -2
  98. package/declarations/types/params.d.ts +4 -5
  99. package/declarations/types/record.d.ts +117 -76
  100. package/declarations/types/request.d.ts +289 -266
  101. package/declarations/types/runtime.d.ts +8 -9
  102. package/declarations/types/schema/concepts.d.ts +19 -13
  103. package/declarations/types/schema/fields.d.ts +1712 -1587
  104. package/declarations/types/schema/fields.type-test.d.ts +0 -1
  105. package/declarations/types/spec/document.d.ts +28 -22
  106. package/declarations/types/spec/error.d.ts +16 -17
  107. package/declarations/types/spec/json-api-raw.d.ts +102 -102
  108. package/declarations/types/symbols.d.ts +74 -75
  109. package/declarations/types/utils.d.ts +5 -5
  110. package/declarations/types.d.ts +10 -11
  111. package/declarations/utils/string.d.ts +43 -40
  112. package/dist/{configure-BgaZESRo.js → configure-B48bFHOl.js} +38 -2
  113. package/dist/configure.js +1 -1
  114. package/dist/graph/-private.js +2 -2
  115. package/dist/{handler-cHghx9Y9.js → handler-C2T-IyJK.js} +1 -1
  116. package/dist/index.js +3 -3
  117. package/dist/reactive/-private.js +1 -1
  118. package/dist/reactive.js +287 -101
  119. package/dist/{request-state-DgwTEXLU.js → request-state-CjLph1LP.js} +1030 -249
  120. package/dist/store/-private.js +3 -3
  121. package/dist/{symbols-BmDcn6hS.js → symbols-SIstXMLI.js} +3 -3
  122. package/dist/types/-private.js +1 -1
  123. package/dist/types/schema/fields.js +4 -4
  124. package/package.json +4 -4
  125. package/declarations/build-config/babel-macros.d.ts.map +0 -1
  126. package/declarations/build-config/canary-features.d.ts.map +0 -1
  127. package/declarations/build-config/debugging.d.ts.map +0 -1
  128. package/declarations/build-config/deprecations.d.ts.map +0 -1
  129. package/declarations/build-config/env.d.ts.map +0 -1
  130. package/declarations/build-config/macros.d.ts.map +0 -1
  131. package/declarations/build-config.d.ts.map +0 -1
  132. package/declarations/configure.d.ts.map +0 -1
  133. package/declarations/graph/-private/-diff.d.ts.map +0 -1
  134. package/declarations/graph/-private/-edge-definition.d.ts.map +0 -1
  135. package/declarations/graph/-private/-state.d.ts.map +0 -1
  136. package/declarations/graph/-private/-utils.d.ts.map +0 -1
  137. package/declarations/graph/-private/coerce-id.d.ts.map +0 -1
  138. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +0 -1
  139. package/declarations/graph/-private/edges/collection.d.ts.map +0 -1
  140. package/declarations/graph/-private/edges/implicit.d.ts.map +0 -1
  141. package/declarations/graph/-private/edges/resource.d.ts.map +0 -1
  142. package/declarations/graph/-private/graph.d.ts.map +0 -1
  143. package/declarations/graph/-private/normalize-link.d.ts.map +0 -1
  144. package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +0 -1
  145. package/declarations/graph/-private/operations/merge-identifier.d.ts.map +0 -1
  146. package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +0 -1
  147. package/declarations/graph/-private/operations/replace-related-record.d.ts.map +0 -1
  148. package/declarations/graph/-private/operations/replace-related-records.d.ts.map +0 -1
  149. package/declarations/graph/-private/operations/update-relationship.d.ts.map +0 -1
  150. package/declarations/graph/-private.d.ts.map +0 -1
  151. package/declarations/index.d.ts.map +0 -1
  152. package/declarations/reactive/-private/document.d.ts.map +0 -1
  153. package/declarations/reactive/-private/fields/compute.d.ts.map +0 -1
  154. package/declarations/reactive/-private/fields/managed-array.d.ts.map +0 -1
  155. package/declarations/reactive/-private/fields/managed-object.d.ts.map +0 -1
  156. package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +0 -1
  157. package/declarations/reactive/-private/hooks.d.ts.map +0 -1
  158. package/declarations/reactive/-private/record.d.ts.map +0 -1
  159. package/declarations/reactive/-private/schema.d.ts.map +0 -1
  160. package/declarations/reactive/-private/symbols.d.ts.map +0 -1
  161. package/declarations/reactive/-private.d.ts.map +0 -1
  162. package/declarations/reactive.d.ts.map +0 -1
  163. package/declarations/request/-private/context.d.ts.map +0 -1
  164. package/declarations/request/-private/debug.d.ts.map +0 -1
  165. package/declarations/request/-private/fetch.d.ts.map +0 -1
  166. package/declarations/request/-private/future.d.ts.map +0 -1
  167. package/declarations/request/-private/manager.d.ts.map +0 -1
  168. package/declarations/request/-private/promise-cache.d.ts.map +0 -1
  169. package/declarations/request/-private/types.d.ts.map +0 -1
  170. package/declarations/request/-private/utils.d.ts.map +0 -1
  171. package/declarations/request.d.ts.map +0 -1
  172. package/declarations/store/-private/cache-handler/handler.d.ts.map +0 -1
  173. package/declarations/store/-private/cache-handler/types.d.ts.map +0 -1
  174. package/declarations/store/-private/cache-handler/utils.d.ts.map +0 -1
  175. package/declarations/store/-private/caches/cache-utils.d.ts.map +0 -1
  176. package/declarations/store/-private/caches/identifier-cache.d.ts.map +0 -1
  177. package/declarations/store/-private/caches/instance-cache.d.ts.map +0 -1
  178. package/declarations/store/-private/caches/resource-utils.d.ts.map +0 -1
  179. package/declarations/store/-private/debug/utils.d.ts.map +0 -1
  180. package/declarations/store/-private/default-cache-policy.d.ts.map +0 -1
  181. package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +0 -1
  182. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +0 -1
  183. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +0 -1
  184. package/declarations/store/-private/managers/cache-manager.d.ts.map +0 -1
  185. package/declarations/store/-private/managers/notification-manager.d.ts.map +0 -1
  186. package/declarations/store/-private/managers/record-array-manager.d.ts.map +0 -1
  187. package/declarations/store/-private/network/request-cache.d.ts.map +0 -1
  188. package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +0 -1
  189. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +0 -1
  190. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +0 -1
  191. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +0 -1
  192. package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +0 -1
  193. package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +0 -1
  194. package/declarations/store/-private/record-arrays/many-array.d.ts.map +0 -1
  195. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +0 -1
  196. package/declarations/store/-private/store-service.d.ts.map +0 -1
  197. package/declarations/store/-private/store-service.type-test.d.ts +0 -2
  198. package/declarations/store/-private/store-service.type-test.d.ts.map +0 -1
  199. package/declarations/store/-private/utils/coerce-id.d.ts.map +0 -1
  200. package/declarations/store/-private/utils/construct-resource.d.ts.map +0 -1
  201. package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +0 -1
  202. package/declarations/store/-private/utils/normalize-model-name.d.ts.map +0 -1
  203. package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +0 -1
  204. package/declarations/store/-private.d.ts.map +0 -1
  205. package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +0 -1
  206. package/declarations/store/-types/q/ds-model.d.ts.map +0 -1
  207. package/declarations/store/-types/q/identifier.d.ts.map +0 -1
  208. package/declarations/store/-types/q/promise-proxies.d.ts +0 -2
  209. package/declarations/store/-types/q/promise-proxies.d.ts.map +0 -1
  210. package/declarations/store/-types/q/record-data-json-api.d.ts +0 -31
  211. package/declarations/store/-types/q/record-data-json-api.d.ts.map +0 -1
  212. package/declarations/store/-types/q/record-instance.d.ts.map +0 -1
  213. package/declarations/store/-types/q/schema-service.d.ts.map +0 -1
  214. package/declarations/store/-types/q/store.d.ts.map +0 -1
  215. package/declarations/store.d.ts.map +0 -1
  216. package/declarations/types/-private.d.ts.map +0 -1
  217. package/declarations/types/cache/aliases.d.ts.map +0 -1
  218. package/declarations/types/cache/change.d.ts.map +0 -1
  219. package/declarations/types/cache/mutations.d.ts.map +0 -1
  220. package/declarations/types/cache/operations.d.ts.map +0 -1
  221. package/declarations/types/cache/relationship.d.ts.map +0 -1
  222. package/declarations/types/cache.d.ts.map +0 -1
  223. package/declarations/types/graph.d.ts.map +0 -1
  224. package/declarations/types/identifier.d.ts.map +0 -1
  225. package/declarations/types/json/raw.d.ts.map +0 -1
  226. package/declarations/types/params.d.ts.map +0 -1
  227. package/declarations/types/record.d.ts.map +0 -1
  228. package/declarations/types/record.type-test.d.ts +0 -2
  229. package/declarations/types/record.type-test.d.ts.map +0 -1
  230. package/declarations/types/request.d.ts.map +0 -1
  231. package/declarations/types/request.type-test.d.ts +0 -2
  232. package/declarations/types/request.type-test.d.ts.map +0 -1
  233. package/declarations/types/runtime.d.ts.map +0 -1
  234. package/declarations/types/schema/concepts.d.ts.map +0 -1
  235. package/declarations/types/schema/fields.d.ts.map +0 -1
  236. package/declarations/types/schema/fields.type-test.d.ts.map +0 -1
  237. package/declarations/types/spec/document.d.ts.map +0 -1
  238. package/declarations/types/spec/error.d.ts.map +0 -1
  239. package/declarations/types/spec/json-api-raw.d.ts.map +0 -1
  240. package/declarations/types/symbols.d.ts.map +0 -1
  241. package/declarations/types/utils.d.ts.map +0 -1
  242. package/declarations/types.d.ts.map +0 -1
  243. package/declarations/utils/string.d.ts.map +0 -1
  244. package/dist/build-config/babel-macros.js.map +0 -1
  245. package/dist/build-config/canary-features.js.map +0 -1
  246. package/dist/build-config/debugging.js.map +0 -1
  247. package/dist/build-config/deprecations.js.map +0 -1
  248. package/dist/build-config/env.js.map +0 -1
  249. package/dist/build-config/macros.js.map +0 -1
  250. package/dist/build-config.js.map +0 -1
  251. package/dist/configure-BgaZESRo.js.map +0 -1
  252. package/dist/configure.js.map +0 -1
  253. package/dist/context-COmAnXUQ.js.map +0 -1
  254. package/dist/graph/-private.js.map +0 -1
  255. package/dist/handler-cHghx9Y9.js.map +0 -1
  256. package/dist/index.js.map +0 -1
  257. package/dist/reactive/-private.js.map +0 -1
  258. package/dist/reactive.js.map +0 -1
  259. package/dist/request-state-DgwTEXLU.js.map +0 -1
  260. package/dist/request.js.map +0 -1
  261. package/dist/store/-private.js.map +0 -1
  262. package/dist/store.js.map +0 -1
  263. package/dist/symbols-BmDcn6hS.js.map +0 -1
  264. package/dist/types/-private.js.map +0 -1
  265. package/dist/types/cache/aliases.js.map +0 -1
  266. package/dist/types/cache/change.js.map +0 -1
  267. package/dist/types/cache/mutations.js.map +0 -1
  268. package/dist/types/cache/operations.js.map +0 -1
  269. package/dist/types/cache/relationship.js.map +0 -1
  270. package/dist/types/cache.js.map +0 -1
  271. package/dist/types/graph.js.map +0 -1
  272. package/dist/types/identifier.js.map +0 -1
  273. package/dist/types/json/raw.js.map +0 -1
  274. package/dist/types/params.js.map +0 -1
  275. package/dist/types/record.js.map +0 -1
  276. package/dist/types/request.js.map +0 -1
  277. package/dist/types/runtime.js.map +0 -1
  278. package/dist/types/schema/concepts.js.map +0 -1
  279. package/dist/types/schema/fields.js.map +0 -1
  280. package/dist/types/schema/fields.type-test.js.map +0 -1
  281. package/dist/types/spec/document.js.map +0 -1
  282. package/dist/types/spec/error.js.map +0 -1
  283. package/dist/types/spec/json-api-raw.js.map +0 -1
  284. package/dist/types/symbols.js.map +0 -1
  285. package/dist/types/utils.js.map +0 -1
  286. package/dist/types.js.map +0 -1
  287. package/dist/utils/string.js.map +0 -1
@@ -1,316 +1,304 @@
1
- import { type Identifier, type RecordIdentifier, type StableDocumentIdentifier, type StableExistingRecordIdentifier, type StableRecordIdentifier } from '../../../types/identifier.ts';
2
- import type { ImmutableRequestInfo } from '../../../types/request.ts';
3
- import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from '../../../types/spec/json-api-raw.ts';
4
- import type { ForgetMethod, GenerationMethod, KeyInfo, KeyInfoMethod, ResetMethod, UpdateMethod } from '../../-types/q/identifier.ts';
1
+ import { type Identifier, type RecordIdentifier, type StableDocumentIdentifier, type StableExistingRecordIdentifier, type StableRecordIdentifier } from "../../../types/identifier.js";
2
+ import type { ImmutableRequestInfo } from "../../../types/request.js";
3
+ import type { ExistingResourceIdentifierObject, ResourceIdentifierObject } from "../../../types/spec/json-api-raw.js";
4
+ import type { ForgetMethod, GenerationMethod, KeyInfo, KeyInfoMethod, ResetMethod, UpdateMethod } from "../../-types/q/identifier.js";
5
5
  type TypeFromIdentifier<T> = T extends {
6
- type: infer U;
6
+ type: infer U;
7
7
  } ? U : string;
8
8
  type NarrowIdentifierIfPossible<T> = T extends ExistingResourceIdentifierObject ? StableExistingRecordIdentifier<TypeFromIdentifier<T>> : StableRecordIdentifier;
9
9
  export declare function isStableIdentifier(identifier: unknown): identifier is StableRecordIdentifier;
10
10
  export declare function isDocumentIdentifier(identifier: unknown): identifier is StableDocumentIdentifier;
11
11
  interface KeyOptions {
12
- lid: IdentifierMap;
13
- id: IdentifierMap;
12
+ lid: IdentifierMap;
13
+ id: IdentifierMap;
14
14
  }
15
15
  type TypeMap = {
16
- [key: string]: KeyOptions;
16
+ [key: string]: KeyOptions;
17
17
  };
18
+ // type IdentifierTypeLookup = { all: Set<StableRecordIdentifier>; id: Map<string, StableRecordIdentifier> };
19
+ // type IdentifiersByType = Map<string, IdentifierTypeLookup>;
18
20
  type IdentifierMap = Map<string, StableRecordIdentifier>;
19
21
  type StableCache = {
20
- resources: IdentifierMap;
21
- documents: Map<string, StableDocumentIdentifier>;
22
- resourcesByType: TypeMap;
23
- polymorphicLidBackMap: Map<string, string[]>;
22
+ resources: IdentifierMap;
23
+ documents: Map<string, StableDocumentIdentifier>;
24
+ resourcesByType: TypeMap;
25
+ polymorphicLidBackMap: Map<string, string[]>;
24
26
  };
25
27
  export type MergeMethod = (targetIdentifier: StableRecordIdentifier, matchedIdentifier: StableRecordIdentifier, resourceData: unknown) => StableRecordIdentifier;
26
28
  /**
27
- Configures how unique identifier lid strings are generated by @ember-data/store.
29
+ Configures how unique identifier lid strings are generated by @ember-data/store.
28
30
 
29
- This configuration MUST occur prior to the store instance being created.
31
+ This configuration MUST occur prior to the store instance being created.
30
32
 
31
- Takes a method which can expect to receive various data as its first argument
32
- and the name of a bucket as its second argument.
33
+ Takes a method which can expect to receive various data as its first argument
34
+ and the name of a bucket as its second argument.
33
35
 
34
- Currently there are two buckets, 'record' and 'document'.
36
+ Currently there are two buckets, 'record' and 'document'.
35
37
 
36
- ### Resource (`Record`) Identity
38
+ ### Resource (`Record`) Identity
37
39
 
38
- If the bucket is `record` the method must return a unique (to at-least
39
- the given bucket) string identifier for the given data as a string to be
40
- used as the `lid` of an `Identifier` token.
40
+ If the bucket is `record` the method must return a unique (to at-least
41
+ the given bucket) string identifier for the given data as a string to be
42
+ used as the `lid` of an `Identifier` token.
41
43
 
42
- This method will only be called by either `getOrCreateRecordIdentifier` or
43
- `createIdentifierForNewRecord` when an identifier for the supplied data
44
- is not already known via `lid` or `type + id` combo and one needs to be
45
- generated or retrieved from a proprietary cache.
44
+ This method will only be called by either `getOrCreateRecordIdentifier` or
45
+ `createIdentifierForNewRecord` when an identifier for the supplied data
46
+ is not already known via `lid` or `type + id` combo and one needs to be
47
+ generated or retrieved from a proprietary cache.
46
48
 
47
- `data` will be the same data argument provided to `getOrCreateRecordIdentifier`
48
- and in the `createIdentifierForNewRecord` case will be an object with
49
- only `type` as a key.
49
+ `data` will be the same data argument provided to `getOrCreateRecordIdentifier`
50
+ and in the `createIdentifierForNewRecord` case will be an object with
51
+ only `type` as a key.
50
52
 
51
- ```ts
52
- import { setIdentifierGenerationMethod } from '@warp-drive/core';
53
+ ```ts
54
+ import { setIdentifierGenerationMethod } from '@warp-drive/core';
53
55
 
54
- export function initialize(applicationInstance) {
55
- // note how `count` here is now scoped to the application instance
56
- // for our generation method by being inside the closure provided
57
- // by the initialize function
58
- let count = 0;
56
+ export function initialize(applicationInstance) {
57
+ // note how `count` here is now scoped to the application instance
58
+ // for our generation method by being inside the closure provided
59
+ // by the initialize function
60
+ let count = 0;
59
61
 
60
- setIdentifierGenerationMethod((resource, bucket) => {
61
- return resource.lid || `my-key-${count++}`;
62
- });
63
- }
62
+ setIdentifierGenerationMethod((resource, bucket) => {
63
+ return resource.lid || `my-key-${count++}`;
64
+ });
65
+ }
64
66
 
65
- export default {
66
- name: 'configure-ember-data-identifiers',
67
- initialize
68
- };
69
- ```
67
+ export default {
68
+ name: 'configure-ember-data-identifiers',
69
+ initialize
70
+ };
71
+ ```
70
72
 
71
- ### Document Identity
73
+ ### Document Identity
72
74
 
73
- If the bucket is `document` the method will receive the associated
74
- immutable `request` passed to `store.request` as its first argument
75
- and should return a unique string for the given request if the document
76
- should be cached, and `null` if it should not be cached.
75
+ If the bucket is `document` the method will receive the associated
76
+ immutable `request` passed to `store.request` as its first argument
77
+ and should return a unique string for the given request if the document
78
+ should be cached, and `null` if it should not be cached.
77
79
 
78
- Note, the request result will still be passed to the cache via `Cache.put`,
79
- but caches should take this as a signal that the document should not itself
80
- be cached, while its contents may still be used to update other cache state.
80
+ Note, the request result will still be passed to the cache via `Cache.put`,
81
+ but caches should take this as a signal that the document should not itself
82
+ be cached, while its contents may still be used to update other cache state.
81
83
 
82
- The presence of `cacheOptions.key` on the request will take precedence
83
- for the document cache key, and this method will not be called if it is
84
- present.
84
+ The presence of `cacheOptions.key` on the request will take precedence
85
+ for the document cache key, and this method will not be called if it is
86
+ present.
85
87
 
86
- The default method implementation for this bucket is to return `null`
87
- for all requests whose method is not `GET`, and to return the `url` for
88
- those where it is.
88
+ The default method implementation for this bucket is to return `null`
89
+ for all requests whose method is not `GET`, and to return the `url` for
90
+ those where it is.
89
91
 
90
- This means that queries via `POST` MUST provide `cacheOptions.key` or
91
- implement this hook.
92
+ This means that queries via `POST` MUST provide `cacheOptions.key` or
93
+ implement this hook.
92
94
 
93
- ⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
95
+ ⚠️ Caution: Requests that do not have a `method` assigned are assumed to be `GET`
94
96
 
95
- @public
97
+ @public
96
98
  */
97
99
  export declare function setIdentifierGenerationMethod(method: GenerationMethod | null): void;
98
100
  /**
99
- Configure a callback for when the identifier cache encounters new resource
100
- data for an existing resource.
101
+ Configure a callback for when the identifier cache encounters new resource
102
+ data for an existing resource.
101
103
 
102
- This configuration MUST occur prior to the store instance being created.
104
+ This configuration MUST occur prior to the store instance being created.
103
105
 
104
- ```js
105
- import { setIdentifierUpdateMethod } from '@warp-drive/core';
106
- ```
106
+ ```js
107
+ import { setIdentifierUpdateMethod } from '@warp-drive/core';
108
+ ```
107
109
 
108
- Takes a method which can expect to receive an existing `Identifier` alongside
109
- some new data to consider as a second argument. This is an opportunity
110
- for secondary lookup tables and caches associated with the identifier
111
- to be amended.
110
+ Takes a method which can expect to receive an existing `Identifier` alongside
111
+ some new data to consider as a second argument. This is an opportunity
112
+ for secondary lookup tables and caches associated with the identifier
113
+ to be amended.
112
114
 
113
- This method is called everytime `updateRecordIdentifier` is called and
114
- with the same arguments. It provides the opportunity to update secondary
115
- lookup tables for existing identifiers.
115
+ This method is called everytime `updateRecordIdentifier` is called and
116
+ with the same arguments. It provides the opportunity to update secondary
117
+ lookup tables for existing identifiers.
116
118
 
117
- It will always be called after an identifier created with `createIdentifierForNewRecord`
118
- has been committed, or after an update to the `record` a `RecordIdentifier`
119
- is assigned to has been committed. Committed here meaning that the server
120
- has acknowledged the update (for instance after a call to `.save()`)
119
+ It will always be called after an identifier created with `createIdentifierForNewRecord`
120
+ has been committed, or after an update to the `record` a `RecordIdentifier`
121
+ is assigned to has been committed. Committed here meaning that the server
122
+ has acknowledged the update (for instance after a call to `.save()`)
121
123
 
122
- If `id` has not previously existed, it will be assigned to the `Identifier`
123
- prior to this `UpdateMethod` being called; however, calls to the parent method
124
- `updateRecordIdentifier` that attempt to change the `id` or calling update
125
- without providing an `id` when one is missing will throw an error.
124
+ If `id` has not previously existed, it will be assigned to the `Identifier`
125
+ prior to this `UpdateMethod` being called; however, calls to the parent method
126
+ `updateRecordIdentifier` that attempt to change the `id` or calling update
127
+ without providing an `id` when one is missing will throw an error.
126
128
 
127
- @public
129
+ @public
128
130
  */
129
131
  export declare function setIdentifierUpdateMethod(method: UpdateMethod | null): void;
130
132
  /**
131
- Configure a callback for when the identifier cache is going to release an identifier.
133
+ Configure a callback for when the identifier cache is going to release an identifier.
132
134
 
133
- This configuration MUST occur prior to the store instance being created.
135
+ This configuration MUST occur prior to the store instance being created.
134
136
 
135
- ```js
136
- import { setIdentifierForgetMethod } from '@warp-drive/core';
137
- ```
137
+ ```js
138
+ import { setIdentifierForgetMethod } from '@warp-drive/core';
139
+ ```
138
140
 
139
- Takes method which can expect to receive an existing `Identifier` that should be eliminated
140
- from any secondary lookup tables or caches that the user has populated for it.
141
+ Takes method which can expect to receive an existing `Identifier` that should be eliminated
142
+ from any secondary lookup tables or caches that the user has populated for it.
141
143
 
142
- @public
144
+ @public
143
145
  */
144
146
  export declare function setIdentifierForgetMethod(method: ForgetMethod | null): void;
145
147
  /**
146
- Configure a callback for when the identifier cache is being torn down.
148
+ Configure a callback for when the identifier cache is being torn down.
147
149
 
148
- This configuration MUST occur prior to the store instance being created.
150
+ This configuration MUST occur prior to the store instance being created.
149
151
 
150
- ```js
151
- import { setIdentifierResetMethod } from '@warp-drive/core';
152
- ```
152
+ ```js
153
+ import { setIdentifierResetMethod } from '@warp-drive/core';
154
+ ```
153
155
 
154
- Takes a method which can expect to be called when the parent application is destroyed.
156
+ Takes a method which can expect to be called when the parent application is destroyed.
155
157
 
156
- If you have properly used a WeakMap to encapsulate the state of your customization
157
- to the application instance, you may not need to implement the `resetMethod`.
158
+ If you have properly used a WeakMap to encapsulate the state of your customization
159
+ to the application instance, you may not need to implement the `resetMethod`.
158
160
 
159
- @public
161
+ @public
160
162
  */
161
163
  export declare function setIdentifierResetMethod(method: ResetMethod | null): void;
162
164
  /**
163
- Configure a callback for when the identifier cache is generating a new
164
- StableRecordIdentifier for a resource.
165
+ Configure a callback for when the identifier cache is generating a new
166
+ StableRecordIdentifier for a resource.
165
167
 
166
- This method controls the `type` and `id` that will be assigned to the
167
- `StableRecordIdentifier` that is created.
168
+ This method controls the `type` and `id` that will be assigned to the
169
+ `StableRecordIdentifier` that is created.
168
170
 
169
- This configuration MUST occur prior to the store instance being created.
171
+ This configuration MUST occur prior to the store instance being created.
170
172
 
171
- ```js
172
- import { setKeyInfoForResource } from '@warp-drive/core';
173
- ```
173
+ ```js
174
+ import { setKeyInfoForResource } from '@warp-drive/core';
175
+ ```
174
176
 
175
- @public
176
- */
177
+ @public
178
+ */
177
179
  export declare function setKeyInfoForResource(method: KeyInfoMethod | null): void;
178
180
  /**
179
- * Each instance of {Store} receives a unique instance of a IdentifierCache.
180
- *
181
- * This cache is responsible for assigning or retrieving the unique identify
182
- * for arbitrary resource data encountered by the store. Data representing
183
- * a unique resource or record should always be represented by the same
184
- * identifier.
185
- *
186
- * It can be configured by consuming applications.
187
- *
188
- * @class IdentifierCache
189
- @public
190
- */
181
+ * Each instance of {@link Store} receives a unique instance of a IdentifierCache.
182
+ *
183
+ * This cache is responsible for assigning or retrieving the unique identify
184
+ * for arbitrary resource data encountered by the store. Data representing
185
+ * a unique resource or record should always be represented by the same
186
+ * identifier.
187
+ *
188
+ * It can be configured by consuming applications.
189
+ *
190
+ * @hideconstructor
191
+ * @public
192
+ */
191
193
  export declare class IdentifierCache {
192
- _cache: StableCache;
193
- _generate: GenerationMethod;
194
- _update: UpdateMethod;
195
- _forget: ForgetMethod;
196
- _reset: ResetMethod;
197
- _merge: MergeMethod;
198
- _keyInfoForResource: KeyInfoMethod;
199
- _id: number;
200
- constructor();
201
- /**
202
- * Internal hook to allow management of merge conflicts with identifiers.
203
- *
204
- * we allow late binding of this private internal merge so that
205
- * the cache can insert itself here to handle elimination of duplicates
206
- *
207
- * @private
208
- */
209
- __configureMerge(method: MergeMethod | null): void;
210
- upgradeIdentifier(resource: {
211
- type: string;
212
- id: string | null;
213
- lid?: string;
214
- }): StableRecordIdentifier;
215
- /**
216
- * @private
217
- */
218
- _getRecordIdentifier(resource: {
219
- type: string;
220
- id: string | null;
221
- lid?: string;
222
- }, shouldGenerate: 2): StableRecordIdentifier;
223
- _getRecordIdentifier(resource: unknown, shouldGenerate: 1): StableRecordIdentifier;
224
- _getRecordIdentifier(resource: unknown, shouldGenerate: 0): StableRecordIdentifier | undefined;
225
- /**
226
- * allows us to peek without generating when needed
227
- * useful for the "create" case when we need to see if
228
- * we are accidentally overwritting something
229
- *
230
- * @param resource
231
- * @return {StableRecordIdentifier | undefined}
232
- * @private
233
- */
234
- peekRecordIdentifier(resource: ResourceIdentifierObject | Identifier): StableRecordIdentifier | undefined;
235
- /**
236
- Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.
237
- Returns `null` if the request does not have a `cacheKey` or `url`.
238
-
239
- @param request
240
- @return {StableDocumentIdentifier | null}
241
- @public
242
- */
243
- getOrCreateDocumentIdentifier(request: ImmutableRequestInfo): StableDocumentIdentifier | null;
244
- /**
245
- Returns the Identifier for the given Resource, creates one if it does not yet exist.
246
-
247
- Specifically this means that we:
248
-
249
- - validate the `id` `type` and `lid` combo against known identifiers
250
- - return an object with an `lid` that is stable (repeated calls with the same
251
- `id` + `type` or `lid` will return the same `lid` value)
252
- - this referential stability of the object itself is guaranteed
253
-
254
- @param resource
255
- @return {StableRecordIdentifier}
256
- @public
257
- */
258
- getOrCreateRecordIdentifier<T>(resource: T): NarrowIdentifierIfPossible<T>;
259
- /**
260
- Returns a new Identifier for the supplied data. Call this method to generate
261
- an identifier when a new resource is being created local to the client and
262
- potentially does not have an `id`.
263
-
264
- Delegates generation to the user supplied `GenerateMethod` if one has been provided
265
- with the signature `generateMethod({ type }, 'record')`.
266
-
267
- @param data
268
- @return {StableRecordIdentifier}
269
- @public
270
- */
271
- createIdentifierForNewRecord(data: {
272
- type: string;
273
- id?: string | null;
274
- }): StableRecordIdentifier;
275
- /**
276
- Provides the opportunity to update secondary lookup tables for existing identifiers
277
- Called after an identifier created with `createIdentifierForNewRecord` has been
278
- committed.
279
-
280
- Assigned `id` to an `Identifier` if `id` has not previously existed; however,
281
- attempting to change the `id` or calling update without providing an `id` when
282
- one is missing will throw an error.
283
-
284
- - sets `id` (if `id` was previously `null`)
285
- - `lid` and `type` MUST NOT be altered post creation
286
-
287
- If a merge occurs, it is possible the returned identifier does not match the originally
288
- provided identifier. In this case the abandoned identifier will go through the usual
289
- `forgetRecordIdentifier` codepaths.
290
-
291
- @param identifierObject
292
- @param data
293
- @return {StableRecordIdentifier}
294
- @public
295
- */
296
- updateRecordIdentifier(identifierObject: RecordIdentifier, data: unknown): StableRecordIdentifier;
297
- /**
298
- * @private
299
- */
300
- _mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: StableRecordIdentifier, existingIdentifier: StableRecordIdentifier, data: unknown): StableRecordIdentifier;
301
- /**
302
- Provides the opportunity to eliminate an identifier from secondary lookup tables
303
- as well as eliminates it from ember-data's own lookup tables and book keeping.
304
-
305
- Useful when a record has been deleted and the deletion has been persisted and
306
- we do not care about the record anymore. Especially useful when an `id` of a
307
- deleted record might be reused later for a new record.
308
-
309
- @param identifierObject
310
- @public
311
- */
312
- forgetRecordIdentifier(identifierObject: RecordIdentifier): void;
313
- destroy(): void;
194
+ /** @internal */
195
+ _cache: StableCache;
196
+ private _generate;
197
+ private _update;
198
+ private _forget;
199
+ private _reset;
200
+ private _merge;
201
+ private _keyInfoForResource;
202
+ private _id;
203
+ constructor();
204
+ /**
205
+ * Internal hook to allow management of merge conflicts with identifiers.
206
+ *
207
+ * we allow late binding of this private internal merge so that
208
+ * the cache can insert itself here to handle elimination of duplicates
209
+ *
210
+ * @private
211
+ */
212
+ __configureMerge(method: MergeMethod | null): void;
213
+ /** @internal */
214
+ upgradeIdentifier(resource: {
215
+ type: string;
216
+ id: string | null;
217
+ lid?: string;
218
+ }): StableRecordIdentifier;
219
+ /**
220
+ * @private
221
+ */
222
+ private _getRecordIdentifier;
223
+ private _getRecordIdentifier;
224
+ private _getRecordIdentifier;
225
+ /**
226
+ * allows us to peek without generating when needed
227
+ * useful for the "create" case when we need to see if
228
+ * we are accidentally overwritting something
229
+ *
230
+ * @private
231
+ */
232
+ peekRecordIdentifier(resource: ResourceIdentifierObject | Identifier): StableRecordIdentifier | undefined;
233
+ /**
234
+ Returns the DocumentIdentifier for the given Request, creates one if it does not yet exist.
235
+ Returns `null` if the request does not have a `cacheKey` or `url`.
236
+
237
+ @public
238
+ */
239
+ getOrCreateDocumentIdentifier(request: ImmutableRequestInfo): StableDocumentIdentifier | null;
240
+ /**
241
+ Returns the Identifier for the given Resource, creates one if it does not yet exist.
242
+
243
+ Specifically this means that we:
244
+
245
+ - validate the `id` `type` and `lid` combo against known identifiers
246
+ - return an object with an `lid` that is stable (repeated calls with the same
247
+ `id` + `type` or `lid` will return the same `lid` value)
248
+ - this referential stability of the object itself is guaranteed
249
+
250
+ @public
251
+ */
252
+ getOrCreateRecordIdentifier<T>(resource: T): NarrowIdentifierIfPossible<T>;
253
+ /**
254
+ Returns a new Identifier for the supplied data. Call this method to generate
255
+ an identifier when a new resource is being created local to the client and
256
+ potentially does not have an `id`.
257
+
258
+ Delegates generation to the user supplied `GenerateMethod` if one has been provided
259
+ with the signature `generateMethod({ type }, 'record')`.
260
+
261
+ @public
262
+ */
263
+ createIdentifierForNewRecord(data: {
264
+ type: string;
265
+ id?: string | null;
266
+ }): StableRecordIdentifier;
267
+ /**
268
+ Provides the opportunity to update secondary lookup tables for existing identifiers
269
+ Called after an identifier created with `createIdentifierForNewRecord` has been
270
+ committed.
271
+
272
+ Assigned `id` to an `Identifier` if `id` has not previously existed; however,
273
+ attempting to change the `id` or calling update without providing an `id` when
274
+ one is missing will throw an error.
275
+
276
+ - sets `id` (if `id` was previously `null`)
277
+ - `lid` and `type` MUST NOT be altered post creation
278
+
279
+ If a merge occurs, it is possible the returned identifier does not match the originally
280
+ provided identifier. In this case the abandoned identifier will go through the usual
281
+ `forgetRecordIdentifier` codepaths.
282
+
283
+ @public
284
+ */
285
+ updateRecordIdentifier(identifierObject: RecordIdentifier, data: unknown): StableRecordIdentifier;
286
+ /**
287
+ * @private
288
+ */
289
+ _mergeRecordIdentifiers(keyInfo: KeyInfo, identifier: StableRecordIdentifier, existingIdentifier: StableRecordIdentifier, data: unknown): StableRecordIdentifier;
290
+ /**
291
+ Provides the opportunity to eliminate an identifier from secondary lookup tables
292
+ as well as eliminates it from ember-data's own lookup tables and book keeping.
293
+
294
+ Useful when a record has been deleted and the deletion has been persisted and
295
+ we do not care about the record anymore. Especially useful when an `id` of a
296
+ deleted record might be reused later for a new record.
297
+
298
+ @public
299
+ */
300
+ forgetRecordIdentifier(identifierObject: RecordIdentifier): void;
301
+ /** @internal */
302
+ destroy(): void;
314
303
  }
315
304
  export {};
316
- //# sourceMappingURL=identifier-cache.d.ts.map