@warp-drive/core 5.8.0-alpha.9 → 5.8.0-beta.1

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 (258) hide show
  1. package/README.md +22 -38
  2. package/declarations/configure.d.ts +1 -1
  3. package/declarations/graph/-private/-edge-definition.d.ts +12 -2
  4. package/declarations/index.d.ts +14 -9
  5. package/declarations/reactive/-private/default-mode.d.ts +1 -1
  6. package/declarations/reactive/-private/fields/extension.d.ts +1 -1
  7. package/declarations/reactive/-private/fields/managed-array.d.ts +2 -2
  8. package/declarations/reactive/-private/fields/managed-object.d.ts +1 -1
  9. package/declarations/reactive/-private/record.d.ts +10 -1
  10. package/declarations/reactive/-private.d.ts +1 -0
  11. package/declarations/reactive.d.ts +11 -7
  12. package/declarations/request/-private/types.d.ts +1 -1
  13. package/declarations/signals/-leaked.d.ts +2 -0
  14. package/declarations/signals/-private.d.ts +6 -0
  15. package/declarations/{store/-private/new-core-tmp → signals}/promise-state.d.ts +1 -1
  16. package/declarations/{store/-private/new-core-tmp → signals}/request-state.d.ts +6 -6
  17. package/declarations/{store/-private/new-core-tmp → signals}/request-subscription.d.ts +4 -4
  18. package/declarations/store/-private/cache-handler/types.d.ts +2 -16
  19. package/declarations/store/-private/caches/instance-cache.d.ts +1 -1
  20. package/declarations/store/-private/managers/cache-manager.d.ts +1 -14
  21. package/declarations/store/-private/managers/notification-manager.d.ts +1 -1
  22. package/declarations/store/-private/record-arrays/legacy-many-array.d.ts +1 -1
  23. package/declarations/store/-private/record-arrays/resource-array.d.ts +1 -1
  24. package/declarations/store/-private/store-service.d.ts +2 -2
  25. package/declarations/store/-private.d.ts +0 -6
  26. package/declarations/store/deprecated/-private.d.ts +2 -2
  27. package/declarations/store/deprecated/store.d.ts +1 -1
  28. package/declarations/store.d.ts +1 -0
  29. package/declarations/types/cache.d.ts +2 -2
  30. package/declarations/types/record.d.ts +132 -0
  31. package/declarations/types/request.d.ts +22 -8
  32. package/declarations/types/schema/fields.d.ts +26 -13
  33. package/declarations/types/schema/schema-service.d.ts +4 -4
  34. package/declarations/types/spec/document.d.ts +34 -0
  35. package/dist/configure-DPUFCemT.js +1940 -0
  36. package/dist/configure.js +2 -1
  37. package/dist/{request-oqoLC9rz.js → future-BKkJJkj7.js} +1 -48
  38. package/dist/graph/-private.js +15 -5
  39. package/dist/{index-B1cSRj-N.js → index-CQP2NSqg.js} +63 -1812
  40. package/dist/index.js +5 -5
  41. package/dist/reactive/-private.js +1 -1
  42. package/dist/reactive.js +4 -129
  43. package/dist/request.js +49 -1
  44. package/dist/signals/-leaked.js +1 -0
  45. package/dist/store/-private.js +1 -2
  46. package/dist/symbols-3C1OkYtZ.js +39 -0
  47. package/dist/types/-private.js +1 -1
  48. package/dist/types/record.js +127 -0
  49. package/dist/types/request.js +11 -7
  50. package/dist/unpkg/dev/-leaked-Co0EI6Go.js +1939 -0
  51. package/dist/unpkg/dev/build-config/babel-macros.js +1 -0
  52. package/dist/unpkg/dev/build-config/canary-features.js +1 -0
  53. package/dist/unpkg/dev/build-config/debugging.js +1 -0
  54. package/dist/unpkg/dev/build-config/deprecations.js +1 -0
  55. package/dist/unpkg/dev/build-config/env.js +1 -0
  56. package/dist/unpkg/dev/build-config/macros.js +1 -0
  57. package/dist/unpkg/dev/build-config.js +1 -0
  58. package/dist/unpkg/dev/configure.js +1 -0
  59. package/dist/unpkg/dev/future-DFfOzSoe.js +672 -0
  60. package/dist/unpkg/dev/graph/-private.js +3132 -0
  61. package/dist/unpkg/dev/index-BzcBOnw9.js +9392 -0
  62. package/dist/unpkg/dev/index.js +6 -0
  63. package/dist/unpkg/dev/reactive/-private.js +1 -0
  64. package/dist/unpkg/dev/reactive.js +3 -0
  65. package/dist/unpkg/dev/request.js +49 -0
  66. package/dist/unpkg/dev/runtime-E1M51_-O.js +135 -0
  67. package/dist/unpkg/dev/signals/-leaked.js +1 -0
  68. package/dist/unpkg/dev/store/-private.js +55 -0
  69. package/dist/unpkg/dev/store.js +558 -0
  70. package/dist/unpkg/dev/types/-private.js +69 -0
  71. package/dist/unpkg/dev/types/cache/aliases.js +0 -0
  72. package/dist/unpkg/dev/types/cache/change.js +0 -0
  73. package/dist/unpkg/dev/types/cache/mutations.js +0 -0
  74. package/dist/unpkg/dev/types/cache/operations.js +0 -0
  75. package/dist/unpkg/dev/types/cache/relationship.js +0 -0
  76. package/dist/unpkg/dev/types/cache.js +0 -0
  77. package/dist/unpkg/dev/types/graph.js +0 -0
  78. package/dist/unpkg/dev/types/identifier.js +61 -0
  79. package/dist/unpkg/dev/types/json/raw.js +0 -0
  80. package/dist/unpkg/dev/types/params.js +0 -0
  81. package/dist/unpkg/dev/types/record.js +191 -0
  82. package/dist/unpkg/dev/types/request.js +77 -0
  83. package/dist/unpkg/dev/types/runtime.js +34 -0
  84. package/dist/unpkg/dev/types/schema/concepts.js +0 -0
  85. package/dist/unpkg/dev/types/schema/fields.js +505 -0
  86. package/dist/unpkg/dev/types/schema/fields.type-test.js +0 -0
  87. package/dist/unpkg/dev/types/schema/schema-service.js +0 -0
  88. package/dist/unpkg/dev/types/spec/document.js +0 -0
  89. package/dist/unpkg/dev/types/spec/error.js +0 -0
  90. package/dist/unpkg/dev/types/spec/json-api-raw.js +0 -0
  91. package/dist/unpkg/dev/types/symbols.js +84 -0
  92. package/dist/unpkg/dev/types/utils.js +0 -0
  93. package/dist/unpkg/dev/types.js +0 -0
  94. package/dist/unpkg/dev/utils/string.js +91 -0
  95. package/dist/unpkg/dev-deprecated/-leaked-DjMeRqdU.js +1939 -0
  96. package/dist/unpkg/dev-deprecated/-private-3C1OkYtZ.js +39 -0
  97. package/dist/unpkg/dev-deprecated/build-config/babel-macros.js +1 -0
  98. package/dist/unpkg/dev-deprecated/build-config/canary-features.js +1 -0
  99. package/dist/unpkg/dev-deprecated/build-config/debugging.js +1 -0
  100. package/dist/unpkg/dev-deprecated/build-config/deprecations.js +1 -0
  101. package/dist/unpkg/dev-deprecated/build-config/env.js +1 -0
  102. package/dist/unpkg/dev-deprecated/build-config/macros.js +1 -0
  103. package/dist/unpkg/dev-deprecated/build-config.js +1 -0
  104. package/dist/unpkg/dev-deprecated/configure.js +1 -0
  105. package/dist/unpkg/dev-deprecated/future-DFfOzSoe.js +672 -0
  106. package/dist/unpkg/dev-deprecated/graph/-private.js +3327 -0
  107. package/dist/unpkg/dev-deprecated/index-6TnTv-WG.js +10007 -0
  108. package/dist/unpkg/dev-deprecated/index.js +5 -0
  109. package/dist/unpkg/dev-deprecated/reactive/-private.js +1 -0
  110. package/dist/unpkg/dev-deprecated/reactive.js +3 -0
  111. package/dist/unpkg/dev-deprecated/request.js +49 -0
  112. package/dist/unpkg/dev-deprecated/runtime-DAu5b0IR.js +135 -0
  113. package/dist/unpkg/dev-deprecated/signals/-leaked.js +1 -0
  114. package/dist/unpkg/dev-deprecated/store/-private.js +1 -0
  115. package/dist/unpkg/dev-deprecated/store.js +558 -0
  116. package/dist/unpkg/dev-deprecated/types/-private.js +69 -0
  117. package/dist/unpkg/dev-deprecated/types/cache/aliases.js +0 -0
  118. package/dist/unpkg/dev-deprecated/types/cache/change.js +0 -0
  119. package/dist/unpkg/dev-deprecated/types/cache/mutations.js +0 -0
  120. package/dist/unpkg/dev-deprecated/types/cache/operations.js +0 -0
  121. package/dist/unpkg/dev-deprecated/types/cache/relationship.js +0 -0
  122. package/dist/unpkg/dev-deprecated/types/cache.js +0 -0
  123. package/dist/unpkg/dev-deprecated/types/graph.js +0 -0
  124. package/dist/unpkg/dev-deprecated/types/identifier.js +61 -0
  125. package/dist/unpkg/dev-deprecated/types/json/raw.js +0 -0
  126. package/dist/unpkg/dev-deprecated/types/params.js +0 -0
  127. package/dist/unpkg/dev-deprecated/types/record.js +191 -0
  128. package/dist/unpkg/dev-deprecated/types/request.js +77 -0
  129. package/dist/unpkg/dev-deprecated/types/runtime.js +34 -0
  130. package/dist/unpkg/dev-deprecated/types/schema/concepts.js +0 -0
  131. package/dist/unpkg/dev-deprecated/types/schema/fields.js +505 -0
  132. package/dist/unpkg/dev-deprecated/types/schema/fields.type-test.js +0 -0
  133. package/dist/unpkg/dev-deprecated/types/schema/schema-service.js +0 -0
  134. package/dist/unpkg/dev-deprecated/types/spec/document.js +0 -0
  135. package/dist/unpkg/dev-deprecated/types/spec/error.js +0 -0
  136. package/dist/unpkg/dev-deprecated/types/spec/json-api-raw.js +0 -0
  137. package/dist/unpkg/dev-deprecated/types/symbols.js +84 -0
  138. package/dist/unpkg/dev-deprecated/types/utils.js +0 -0
  139. package/dist/unpkg/dev-deprecated/types.js +0 -0
  140. package/dist/unpkg/dev-deprecated/utils/string.js +91 -0
  141. package/dist/unpkg/prod/-leaked-DUONXQDB.js +1676 -0
  142. package/dist/unpkg/prod/-private-sql1_mdx.js +39 -0
  143. package/dist/unpkg/prod/build-config/babel-macros.js +1 -0
  144. package/dist/unpkg/prod/build-config/canary-features.js +1 -0
  145. package/dist/unpkg/prod/build-config/debugging.js +1 -0
  146. package/dist/unpkg/prod/build-config/deprecations.js +1 -0
  147. package/dist/unpkg/prod/build-config/env.js +1 -0
  148. package/dist/unpkg/prod/build-config/macros.js +1 -0
  149. package/dist/unpkg/prod/build-config.js +1 -0
  150. package/dist/unpkg/prod/configure.js +2 -0
  151. package/dist/unpkg/prod/graph/-private.js +2235 -0
  152. package/dist/unpkg/prod/handler-EU_8ncB2.js +1619 -0
  153. package/dist/unpkg/prod/index.js +483 -0
  154. package/dist/unpkg/prod/promise-cache-DIT8Ypjq.js +19 -0
  155. package/dist/unpkg/prod/reactive/-private.js +1 -0
  156. package/dist/unpkg/prod/reactive.js +30 -0
  157. package/dist/unpkg/prod/request-BrJSCG6r.js +421 -0
  158. package/dist/unpkg/prod/request.js +2 -0
  159. package/dist/unpkg/prod/schema-BSkHyoWz.js +5219 -0
  160. package/dist/unpkg/prod/signals/-leaked.js +1 -0
  161. package/dist/unpkg/prod/store/-private.js +126 -0
  162. package/dist/unpkg/prod/store.js +437 -0
  163. package/dist/unpkg/prod/types/-private.js +49 -0
  164. package/dist/unpkg/prod/types/cache/aliases.js +0 -0
  165. package/dist/unpkg/prod/types/cache/change.js +0 -0
  166. package/dist/unpkg/prod/types/cache/mutations.js +0 -0
  167. package/dist/unpkg/prod/types/cache/operations.js +0 -0
  168. package/dist/unpkg/prod/types/cache/relationship.js +0 -0
  169. package/dist/unpkg/prod/types/cache.js +0 -0
  170. package/dist/unpkg/prod/types/graph.js +0 -0
  171. package/dist/unpkg/prod/types/identifier.js +61 -0
  172. package/dist/unpkg/prod/types/json/raw.js +0 -0
  173. package/dist/unpkg/prod/types/params.js +0 -0
  174. package/dist/unpkg/prod/types/record.js +191 -0
  175. package/dist/unpkg/prod/types/request.js +77 -0
  176. package/dist/unpkg/prod/types/runtime.js +34 -0
  177. package/dist/unpkg/prod/types/schema/concepts.js +0 -0
  178. package/dist/unpkg/prod/types/schema/fields.js +505 -0
  179. package/dist/unpkg/prod/types/schema/fields.type-test.js +0 -0
  180. package/dist/unpkg/prod/types/schema/schema-service.js +0 -0
  181. package/dist/unpkg/prod/types/spec/document.js +0 -0
  182. package/dist/unpkg/prod/types/spec/error.js +0 -0
  183. package/dist/unpkg/prod/types/spec/json-api-raw.js +0 -0
  184. package/dist/unpkg/prod/types/symbols.js +84 -0
  185. package/dist/unpkg/prod/types/utils.js +0 -0
  186. package/dist/unpkg/prod/types.js +0 -0
  187. package/dist/unpkg/prod/utils/string.js +72 -0
  188. package/dist/unpkg/prod-deprecated/-leaked-DRNv9VIX.js +1676 -0
  189. package/dist/unpkg/prod-deprecated/-private-3C1OkYtZ.js +39 -0
  190. package/dist/unpkg/prod-deprecated/build-config/babel-macros.js +1 -0
  191. package/dist/unpkg/prod-deprecated/build-config/canary-features.js +1 -0
  192. package/dist/unpkg/prod-deprecated/build-config/debugging.js +1 -0
  193. package/dist/unpkg/prod-deprecated/build-config/deprecations.js +1 -0
  194. package/dist/unpkg/prod-deprecated/build-config/env.js +1 -0
  195. package/dist/unpkg/prod-deprecated/build-config/macros.js +1 -0
  196. package/dist/unpkg/prod-deprecated/build-config.js +1 -0
  197. package/dist/unpkg/prod-deprecated/configure.js +2 -0
  198. package/dist/unpkg/prod-deprecated/graph/-private.js +2408 -0
  199. package/dist/unpkg/prod-deprecated/handler-CCIu4sQ3.js +334 -0
  200. package/dist/unpkg/prod-deprecated/hooks-Dv4Np0MY.js +26 -0
  201. package/dist/unpkg/prod-deprecated/index.js +483 -0
  202. package/dist/unpkg/prod-deprecated/promise-cache-DIT8Ypjq.js +19 -0
  203. package/dist/unpkg/prod-deprecated/reactive/-private.js +1 -0
  204. package/dist/unpkg/prod-deprecated/reactive.js +5 -0
  205. package/dist/unpkg/prod-deprecated/request-BrJSCG6r.js +421 -0
  206. package/dist/unpkg/prod-deprecated/request.js +2 -0
  207. package/dist/unpkg/prod-deprecated/schema-CJcjHv0E.js +6939 -0
  208. package/dist/unpkg/prod-deprecated/signals/-leaked.js +1 -0
  209. package/dist/unpkg/prod-deprecated/store/-private.js +88 -0
  210. package/dist/unpkg/prod-deprecated/store.js +437 -0
  211. package/dist/unpkg/prod-deprecated/types/-private.js +49 -0
  212. package/dist/unpkg/prod-deprecated/types/cache/aliases.js +0 -0
  213. package/dist/unpkg/prod-deprecated/types/cache/change.js +0 -0
  214. package/dist/unpkg/prod-deprecated/types/cache/mutations.js +0 -0
  215. package/dist/unpkg/prod-deprecated/types/cache/operations.js +0 -0
  216. package/dist/unpkg/prod-deprecated/types/cache/relationship.js +0 -0
  217. package/dist/unpkg/prod-deprecated/types/cache.js +0 -0
  218. package/dist/unpkg/prod-deprecated/types/graph.js +0 -0
  219. package/dist/unpkg/prod-deprecated/types/identifier.js +61 -0
  220. package/dist/unpkg/prod-deprecated/types/json/raw.js +0 -0
  221. package/dist/unpkg/prod-deprecated/types/params.js +0 -0
  222. package/dist/unpkg/prod-deprecated/types/record.js +191 -0
  223. package/dist/unpkg/prod-deprecated/types/request.js +77 -0
  224. package/dist/unpkg/prod-deprecated/types/runtime.js +34 -0
  225. package/dist/unpkg/prod-deprecated/types/schema/concepts.js +0 -0
  226. package/dist/unpkg/prod-deprecated/types/schema/fields.js +505 -0
  227. package/dist/unpkg/prod-deprecated/types/schema/fields.type-test.js +0 -0
  228. package/dist/unpkg/prod-deprecated/types/schema/schema-service.js +0 -0
  229. package/dist/unpkg/prod-deprecated/types/spec/document.js +0 -0
  230. package/dist/unpkg/prod-deprecated/types/spec/error.js +0 -0
  231. package/dist/unpkg/prod-deprecated/types/spec/json-api-raw.js +0 -0
  232. package/dist/unpkg/prod-deprecated/types/symbols.js +84 -0
  233. package/dist/unpkg/prod-deprecated/types/utils.js +0 -0
  234. package/dist/unpkg/prod-deprecated/types.js +0 -0
  235. package/dist/unpkg/prod-deprecated/utils/string.js +72 -0
  236. package/logos/README.md +2 -2
  237. package/logos/logo-yellow-slab.svg +1 -0
  238. package/logos/word-mark-black.svg +1 -0
  239. package/logos/word-mark-white.svg +1 -0
  240. package/package.json +11 -3
  241. package/declarations/store/-private/new-core-tmp/expensive-subscription.d.ts +0 -24
  242. package/dist/configure-C3x8YXzL.js +0 -181
  243. package/logos/NCC-1701-a-blue.svg +0 -4
  244. package/logos/NCC-1701-a-gold.svg +0 -4
  245. package/logos/NCC-1701-a-gold_100.svg +0 -1
  246. package/logos/NCC-1701-a-gold_base-64.txt +0 -1
  247. package/logos/NCC-1701-a.svg +0 -4
  248. package/logos/docs-badge.svg +0 -2
  249. package/logos/ember-data-logo-dark.svg +0 -12
  250. package/logos/ember-data-logo-light.svg +0 -12
  251. package/logos/social1.png +0 -0
  252. package/logos/social2.png +0 -0
  253. package/logos/warp-drive-logo-dark.svg +0 -4
  254. package/logos/warp-drive-logo-gold.svg +0 -4
  255. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/configure.d.ts +0 -0
  256. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/internal.d.ts +0 -0
  257. /package/declarations/{store/-private/new-core-tmp → signals}/reactivity/signal.d.ts +0 -0
  258. /package/dist/{symbols-sql1_mdx.js → unpkg/dev/-private-sql1_mdx.js} +0 -0
@@ -1,480 +1,17 @@
1
+ import { a as defineGate, c as withSignalStore, n as notifyInternalSignal, p as peekInternalSignal, j as willSyncFlushWatchers, k as getOrCreateInternalSignal, l as consumeInternalSignal, o as createInternalSignal, A as ARRAY_SIGNAL, S as Signals, q as createSignalDescriptor, b as defineSignal, e as entangleSignal, r as entangleInitiallyStaleSignal, O as OBJECT_SIGNAL, t as createInternalMemo, w as waitFor } from "./configure-DPUFCemT.js";
1
2
  import { deprecate, warn } from '@ember/debug';
2
3
  import { EnableHydration, SkipCache, STRUCTURED } from './types/request.js';
3
4
  import { macroCondition, getGlobalConfig, dependencySatisfies, importSync } from '@embroider/macros';
4
- import { D as Destroy, C as Context, S as SOURCE, a as Checkout, b as Commit } from "./symbols-sql1_mdx.js";
5
+ import { D as Destroy, a as Context, S as SOURCE, C as Checkout, b as Commit } from "./symbols-3C1OkYtZ.js";
5
6
  import { isResourceSchema } from './types/schema/fields.js';
6
- import { w as withBrand, g as getPromiseResult, s as setPromiseResult, c as cloneResponseProperties, I as IS_CACHE_HANDLER, a as assertValidRequest, e as executeNextHandler, b as getRequestResult, u as upgradePromise, d as clearRequestResult } from "./request-oqoLC9rz.js";
7
+ import { a as cloneResponseProperties, I as IS_CACHE_HANDLER, b as assertValidRequest, e as executeNextHandler, d as getRequestResult, u as upgradePromise, s as setPromiseResult, f as clearRequestResult } from "./future-BKkJJkj7.js";
7
8
  import { getOrSetGlobal, peekTransient, setTransient, peekUniversalTransient, setUniversalTransient } from './types/-private.js';
8
- import { c as createSignal, a as consumeSignal, n as notifySignal, b as createMemo, d as willSyncFlushWatchers, A as ARRAY_SIGNAL, O as OBJECT_SIGNAL, w as waitFor } from "./configure-C3x8YXzL.js";
9
+ import { D as DefaultCachePolicy } from "./default-cache-policy-D7_u4YRH.js";
10
+ import { withBrand } from './request.js';
9
11
  import { CACHE_OWNER, DEBUG_STALE_CACHE_OWNER, DEBUG_KEY_TYPE, DEBUG_CLIENT_ORIGINATED } from './types/identifier.js';
10
12
  import { dasherize } from './utils/string.js';
11
- import { D as DefaultCachePolicy } from "./default-cache-policy-D7_u4YRH.js";
12
13
  import { setLogging, getRuntimeConfig } from './types/runtime.js';
13
14
  import { RecordStore, Type } from './types/symbols.js';
14
- const INITIALIZER_PROTO = {
15
- isInitializer: true
16
- };
17
- function makeInitializer(fn) {
18
- // we use a prototype to ensure that the initializer is not enumerable
19
- // and does not interfere with the signal's value.
20
- return Object.assign(Object.create(INITIALIZER_PROTO), {
21
- value: fn
22
- });
23
- }
24
- function isInitializer(obj) {
25
- return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === INITIALIZER_PROTO;
26
- }
27
-
28
- /**
29
- * A WarpDriveSignal is a wrapper around a framework specific or TC39 signal
30
- * that enables us to store and manage the signal in a universal way.
31
- *
32
- * WarpDrive uses signals to manage three separate concepts:
33
- *
34
- * - as a `storage` for a value local to the object that we want to be reactive
35
- * (see `@local` schema field for an example)
36
- * - as a `gate` for a memoized getter that we want to act as a reactive property
37
- * but whose value is computed/pulled from a non-reactive source elsewhere
38
- * and whose latest value is stored in the signal
39
- * (see `field` schema field for an example)
40
- * - as a `gate` with a manually managed value updated on pull when `isStale` is true
41
- *
42
- *
43
- * It offers
44
- *
45
- * - a non-reactive way to access/update the current value
46
- * - a non-reactive way to mark the signal as dirtied
47
- * - a non-reactive way to store content for why the signal was dirtied
48
- * - access to the underlying Signal(s) in-use
49
- *
50
- * For debugging:
51
- * - the "key" or "name" of the signal
52
- * - the "object identity" or "context" to which the signal is attached
53
- *
54
- * @private
55
- */
56
-
57
- /**
58
- * We attach signals to their context object via
59
- * a Map attached to the object via this symbol.
60
- *
61
- * This allows us to store multiple signals
62
- * on the same object with smaller memory
63
- * overhead and no WeakMap lookups.
64
- *
65
- * Performance sensitive objects should
66
- * pre-warm their shape by assigning this
67
- * during initialization.
68
- *
69
- * ```ts
70
- * initializeSignalStore(obj);
71
- * ```
72
- *
73
- * @private
74
- */
75
- const Signals = getOrSetGlobal('Signals', Symbol('Signals'));
76
-
77
- /**
78
- * A util that will create a signal store on the object
79
- * if it does not already exist and returns the associated
80
- * signal store.
81
- *
82
- * @private
83
- */
84
- function withSignalStore(obj) {
85
- if (!obj[Signals]) {
86
- initializeSignalStore(obj);
87
- }
88
- return obj[Signals];
89
- }
90
-
91
- /**
92
- * A util that will create a signal store on the object
93
- * if it does not already exist.
94
- *
95
- * Useful for pre-warming the shape of an object to ensure
96
- * a key-transition to add it is not required later.
97
- *
98
- * @private
99
- */
100
- function initializeSignalStore(obj) {
101
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
102
- if (!test) {
103
- throw new Error(`Signal store already exists on object`);
104
- }
105
- })(!obj[Signals]) : {};
106
- obj[Signals] = new Map();
107
- }
108
- function createInternalSignal(signals, obj, key, initialValue) {
109
- const warpDriveSignal = {
110
- key,
111
- context: obj,
112
- signal: createSignal(obj, key),
113
- value: isInitializer(initialValue) ? initialValue.value.call(obj) : initialValue,
114
- isStale: false
115
- };
116
- signals.set(key, warpDriveSignal);
117
- return warpDriveSignal;
118
- }
119
- function getOrCreateInternalSignal(signals, obj, key, initialValue) {
120
- let signal = peekInternalSignal(signals, key);
121
- if (!signal) {
122
- signal = createInternalSignal(signals, obj, key, initialValue);
123
- }
124
- return signal;
125
- }
126
- function createInternalMemo(signals, object, key, fn) {
127
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
128
- if (!test) {
129
- throw new Error(`Expected no signal/memo to exist for key "${String(key)}"`);
130
- }
131
- })(!peekInternalSignal(signals, key)) : {};
132
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
133
- return withFrame(signals, object, key, fn);
134
- } else {
135
- const memo = createMemo(object, key, fn);
136
- signals.set(key, memo);
137
- return memo;
138
- }
139
- }
140
- function peekInternalSignal(signals, key) {
141
- return signals?.get(key);
142
- }
143
- function consumeInternalSignal(signal) {
144
- TrackingFrame?.signals.add(signal);
145
- consumeSignal(signal.signal);
146
- }
147
- function notifyInternalSignal(signal) {
148
- if (signal) {
149
- signal.isStale = true;
150
- notifySignal(signal.signal);
151
- }
152
- }
153
- let TrackingFrame = null;
154
-
155
- /**
156
- * This is currently just for signals debugging, but it could be used in production
157
- * if we wanted to eliminate the need for frameworks to implement createMemo / to
158
- * allow us to add our own Watcher.
159
- *
160
- * @internal
161
- */
162
- function withFrame(signals, object, key, fn) {
163
- const frameSignals = new Set();
164
- const frameFn = () => {
165
- if (frameSignals.size) {
166
- frameSignals.clear();
167
- }
168
- TrackingFrame = {
169
- object,
170
- key,
171
- signals: frameSignals,
172
- parent: TrackingFrame
173
- };
174
- try {
175
- return fn();
176
- } finally {
177
- TrackingFrame = TrackingFrame.parent;
178
- }
179
- };
180
- const memo = createMemo(object, key, frameFn);
181
- // @ts-expect-error
182
- memo.signals = frameSignals;
183
- signals.set(key, memo);
184
- return memo;
185
- }
186
- function isMemo(obj) {
187
- // @ts-expect-error
188
- return typeof obj === 'function' && obj.signals instanceof Set;
189
- }
190
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
191
- // @ts-expect-error adding to global API
192
- globalThis.debugWarpDriveSignals = (obj, key) => {
193
- const signals = obj[Signals];
194
- if (!signals) {
195
- log$1('The object has no associated signals');
196
- return false;
197
- }
198
- if (key) {
199
- const signal = signals.get(key);
200
- if (!signal) {
201
- log$1(`No signal found for key "${String(key)}"`);
202
- return false;
203
- }
204
- log$1(signal);
205
- if (isMemo(signal)) {
206
- colorizeLines(printMemo(signal, key));
207
- return true;
208
- } else {
209
- colorizeLines(printSignal(signal, key));
210
- return true;
211
- }
212
- }
213
- const lines = [];
214
- for (const [k, signal] of signals) {
215
- if (isMemo(signal)) continue;
216
- printSignal(signal, k, lines);
217
- }
218
- for (const [k, signal] of signals) {
219
- if (isMemo(signal)) {
220
- printMemo(signal, k, lines);
221
- }
222
- }
223
- log$1(signals);
224
- colorizeLines(lines);
225
- return true;
226
- };
227
- }
228
- const LightColors = {
229
- red: 'color: red;',
230
- green: 'color: green;',
231
- reset: 'color: inherit;'
232
- };
233
- const DarkColors = {
234
- red: 'color: red;',
235
- green: 'color: lightgreen;',
236
- reset: 'color: inherit;'
237
- };
238
- function isLightMode$1() {
239
- if (window?.matchMedia?.('(prefers-color-scheme: light)').matches) {
240
- return true;
241
- }
242
- return false;
243
- }
244
- const RED = {};
245
- const GREEN = {};
246
- const RESET = {};
247
- const EOL = {};
248
- function colorizeLines(lines) {
249
- const Colors = isLightMode$1() ? LightColors : DarkColors;
250
- const colors = [];
251
- let line = '';
252
- for (const str of lines) {
253
- if (str === RED) {
254
- colors.push(Colors.red);
255
- line += '%c';
256
- } else if (str === GREEN) {
257
- colors.push(Colors.green);
258
- line += '%c';
259
- } else if (str === RESET) {
260
- colors.push(Colors.reset);
261
- line += '%c';
262
- } else if (str === EOL) {
263
- line += '\n';
264
- } else {
265
- line += str;
266
- }
267
- }
268
- log$1(line, ...colors);
269
- }
270
- function log$1(...args) {
271
- // eslint-disable-next-line no-console
272
- console.log(...args);
273
- }
274
- function isDirty(signal) {
275
- return signal.isStale;
276
- }
277
- function isDirtyMemo(memo) {
278
- // iterate simple signals first to get fastest answer
279
- for (const signal of memo.signals) {
280
- if (isMemo(signal)) continue;
281
- if (isDirty(signal)) {
282
- return true;
283
- }
284
- }
285
- for (const signal of memo.signals) {
286
- if (isMemo(signal)) {
287
- return isDirtyMemo(signal);
288
- }
289
- }
290
- return false;
291
- }
292
- function printSignal(signal, key, lines = [], depth = 0) {
293
- const _dirty = isDirty(signal);
294
- lines.push(`${''.padStart(depth * 2, ' ')}${_dirty ? '❌' : '✅'} `, _dirty ? RED : GREEN, `${String(key)}`, RESET, EOL);
295
- return lines;
296
- }
297
- function printMemo(memo, key, lines = [], depth = 0) {
298
- const _dirty = isDirtyMemo(memo);
299
- lines.push(`${''.padStart(depth * 2, ' ')}${_dirty ? '❌' : '✅'} `, _dirty ? RED : GREEN, `<memo> ${String(key)}`, RESET, `: (consumes ${memo.signals.size} signals)`, EOL);
300
- for (const signal of memo.signals) {
301
- if (isMemo(signal)) continue;
302
- printSignal(signal, signal.key, lines, depth + 1);
303
- }
304
- for (const signal of memo.signals) {
305
- if (isMemo(signal)) {
306
- printMemo(signal, signal.key, lines, depth + 1);
307
- }
308
- }
309
- return lines;
310
- }
311
- function entangleSignal(signals, obj, key, initialValue) {
312
- let internalSignal = peekInternalSignal(signals, key);
313
- if (!internalSignal) {
314
- internalSignal = createInternalSignal(signals, obj, key, initialValue);
315
- }
316
- consumeInternalSignal(internalSignal);
317
- return internalSignal;
318
- }
319
- function entangleInitiallyStaleSignal(signals, obj, key, initialValue) {
320
- let internalSignal = peekInternalSignal(signals, key);
321
- if (!internalSignal) {
322
- internalSignal = createInternalSignal(signals, obj, key, initialValue);
323
- internalSignal.isStale = true; // mark it as stale
324
- }
325
- consumeInternalSignal(internalSignal);
326
- return internalSignal;
327
- }
328
- function createSignalDescriptor(key, intialValue) {
329
- return {
330
- enumerable: true,
331
- configurable: false,
332
- get() {
333
- const signals = withSignalStore(this);
334
- const internalSignal = entangleSignal(signals, this, key, intialValue);
335
- internalSignal.isStale = false; // reset stale state
336
- return internalSignal.value;
337
- },
338
- set(value) {
339
- const signals = withSignalStore(this);
340
- const internalSignal = getOrCreateInternalSignal(signals, this, key, intialValue);
341
- if (internalSignal.value !== value) {
342
- internalSignal.value = value;
343
- notifyInternalSignal(internalSignal);
344
- }
345
- }
346
- };
347
- }
348
-
349
- /**
350
- * define an enumerable signal property.
351
- *
352
- * Akin to Object.defineProperty.
353
- *
354
- * The signal will be lazily created when accessed and scoped to the
355
- * instance of the object.
356
- *
357
- * @private
358
- */
359
- function defineSignal(obj, key, v) {
360
- Object.defineProperty(obj, key, createSignalDescriptor(key, v));
361
- }
362
-
363
- /**
364
- * Define a non-enumerable signal property.
365
- *
366
- * @private
367
- */
368
- function defineNonEnumerableSignal(obj, key, v) {
369
- const desc = createSignalDescriptor(key, v);
370
- desc.enumerable = false;
371
- Object.defineProperty(obj, key, desc);
372
- }
373
- /**
374
- * Decorator version of creating a signal.
375
- */
376
- function signal(target, key, descriptor) {
377
- // Error on `@signal()`, `@signal(...args)``
378
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
379
- if (!test) {
380
- throw new Error('You attempted to use @signal(), which is not necessary nor supported. Remove the parentheses and you will be good to go!');
381
- }
382
- })(target !== undefined) : {};
383
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
384
- if (!test) {
385
- throw new Error(`You attempted to use @signal on with ${arguments.length > 1 ? 'arguments' : 'an argument'} ( @signal(${Array.from(arguments).map(d => `'${d}'`).join(', ')}) ), which is not supported. Dependencies are automatically tracked, so you can just use ${'`@signal`'}`);
386
- }
387
- })(typeof target === 'object' && typeof key === 'string' && typeof descriptor === 'object' && arguments.length === 3) : {};
388
- return createSignalDescriptor(key, descriptor.initializer ? makeInitializer(descriptor.initializer) : null);
389
- }
390
-
391
- /**
392
- * Decorator version of creating a memoized getter
393
- */
394
- function memoized(target, key, descriptor) {
395
- // Error on `@memoized()`, `@memoized(...args)`, and `@memoized propName = value;`
396
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
397
- if (!test) {
398
- throw new Error('You attempted to use @memoized(), which is not necessary nor supported. Remove the parentheses and you will be good to go!');
399
- }
400
- })(target !== undefined) : {};
401
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
402
- if (!test) {
403
- throw new Error(`You attempted to use @memoized on with ${arguments.length > 1 ? 'arguments' : 'an argument'} ( @memoized(${Array.from(arguments).map(d => `'${d}'`).join(', ')}), which is not supported. Dependencies are automatically tracked, so you can just use ${'`@memoized`'}`);
404
- }
405
- })(typeof target === 'object' && typeof key === 'string' && typeof descriptor === 'object' && arguments.length === 3) : {};
406
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
407
- if (!test) {
408
- throw new Error(`The @memoized decorator must be applied to getters. '${key}' is not a getter.`);
409
- }
410
- })(typeof descriptor.get === 'function') : {};
411
-
412
- // eslint-disable-next-line @typescript-eslint/unbound-method
413
- const getter = descriptor.get;
414
- descriptor.get = function () {
415
- const signals = withSignalStore(this);
416
- let memoSignal = signals.get(key);
417
- if (!memoSignal) {
418
- memoSignal = createInternalMemo(signals, this, key, getter.bind(this));
419
- }
420
- return memoSignal();
421
- };
422
- return descriptor;
423
- }
424
-
425
- /**
426
- * Decorator version of creating a gate.
427
- *
428
- * @private
429
- */
430
- function gate(_target, key, desc) {
431
- // eslint-disable-next-line @typescript-eslint/unbound-method
432
- const getter = desc.get;
433
- // eslint-disable-next-line @typescript-eslint/unbound-method
434
- const setter = desc.set;
435
- const isLocal = desc.isLocal;
436
- desc.get = function () {
437
- const signals = withSignalStore(this);
438
- let internalSignal = peekInternalSignal(signals, key);
439
- if (!internalSignal) {
440
- internalSignal = createInternalSignal(signals, this, key, getter.call(this));
441
- } else if (internalSignal.isStale) {
442
- internalSignal.isStale = false;
443
- internalSignal.value = getter.call(this);
444
- }
445
- consumeInternalSignal(internalSignal);
446
- return internalSignal.value;
447
- };
448
- if (setter) {
449
- desc.set = function (v) {
450
- const signals = withSignalStore(this);
451
- let internalSignal = peekInternalSignal(signals, key);
452
- if (!internalSignal) {
453
- // we can't use `v` as initialValue here because setters don't
454
- // return the value and the final value may be different
455
- // than what the setter was called with.
456
- internalSignal = createInternalSignal(signals, this, key, undefined);
457
- internalSignal.isStale = true;
458
- }
459
- setter.call(this, v);
460
- // when a gate is set, we do not notify the signal
461
- // as its update is controlled externally.
462
- // unless it specifically sets itself to be locally managed
463
- if (isLocal) {
464
- internalSignal.isStale = true;
465
- notifyInternalSignal(internalSignal);
466
- }
467
- };
468
- }
469
- return desc;
470
- }
471
- function defineGate(obj, key, desc) {
472
- const options = Object.assign({
473
- enumerable: true,
474
- configurable: false
475
- }, gate(obj, key, desc));
476
- Object.defineProperty(obj, key, options);
477
- }
478
15
  function urlFromLink(link) {
479
16
  if (typeof link === 'string') return link;
480
17
  return link.href;
@@ -1884,7 +1421,7 @@ function peekResourceKey(record) {
1884
1421
  assigned to the given record instance.
1885
1422
 
1886
1423
  ```js
1887
- import { recordIdentifierFor } from "@ember-data/store";
1424
+ import { recordIdentifierFor } from "@warp-drive/core";
1888
1425
  // ... gain access to a record, for instance with peekRecord or findRecord
1889
1426
  const record = store.peekRecord("user", "1");
1890
1427
  // get the identifier for the record (see docs for ResourceKey)
@@ -1900,7 +1437,7 @@ function peekResourceKey(record) {
1900
1437
  function recordIdentifierFor(record) {
1901
1438
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
1902
1439
  if (!test) {
1903
- throw new Error(`${String(record)} is not a record instantiated by @ember-data/store`);
1440
+ throw new Error(`${String(record)} is not a ReactiveResource or Model known to WarpDrive`);
1904
1441
  }
1905
1442
  })(RecordCache.has(record)) : {};
1906
1443
  return RecordCache.get(record);
@@ -2290,8 +1827,6 @@ class CacheManager {
2290
1827
  * a `content` member and therefor must not assume the existence
2291
1828
  * of `request` and `response` on the document.
2292
1829
  *
2293
- * @param {StructuredDocument} doc
2294
- * @return {ResourceDocument}
2295
1830
  * @public
2296
1831
  */
2297
1832
  put(doc) {
@@ -2303,7 +1838,6 @@ class CacheManager {
2303
1838
  *
2304
1839
  * @public
2305
1840
  * @param op the operation to perform
2306
- * @return {void}
2307
1841
  */
2308
1842
  patch(op) {
2309
1843
  this.___cache.patch(op);
@@ -2314,7 +1848,6 @@ class CacheManager {
2314
1848
  * on relationships only.
2315
1849
  *
2316
1850
  * @public
2317
- * @param mutation
2318
1851
  */
2319
1852
  mutate(mutation) {
2320
1853
  this.___cache.mutate(mutation);
@@ -2348,8 +1881,7 @@ class CacheManager {
2348
1881
  * notifications for relational data.
2349
1882
  *
2350
1883
  * @public
2351
- * @param {ResourceKey | RequestKey} cacheKey
2352
- * @return {ResourceDocument | ResourceBlob | null} the known resource data
1884
+ * @return the known resource data
2353
1885
  */
2354
1886
 
2355
1887
  peek(cacheKey) {
@@ -2362,8 +1894,6 @@ class CacheManager {
2362
1894
  * Peek the Cache for the existing request data associated with
2363
1895
  * a cacheable request
2364
1896
  *
2365
- * @param {RequestKey}
2366
- * @return {RequestKey | null}
2367
1897
  * @public
2368
1898
  */
2369
1899
  peekRequest(key) {
@@ -2391,7 +1921,6 @@ class CacheManager {
2391
1921
  * utilize this method to fork the cache.
2392
1922
  *
2393
1923
  * @public
2394
- * @return {Promise<Cache>}
2395
1924
  */
2396
1925
  fork() {
2397
1926
  return this.___cache.fork();
@@ -2404,9 +1933,7 @@ class CacheManager {
2404
1933
  * preferring instead to merge at the Store level, which will
2405
1934
  * utilize this method to merge the caches.
2406
1935
  *
2407
- * @param {Cache} cache
2408
1936
  * @public
2409
- * @return {Promise<void>}
2410
1937
  */
2411
1938
  merge(cache) {
2412
1939
  return this.___cache.merge(cache);
@@ -2456,7 +1983,6 @@ class CacheManager {
2456
1983
  * which may be fed back into a new instance of the same Cache
2457
1984
  * via `cache.hydrate`.
2458
1985
  *
2459
- * @return {Promise<ReadableStream>}
2460
1986
  * @public
2461
1987
  */
2462
1988
  dump() {
@@ -2475,8 +2001,6 @@ class CacheManager {
2475
2001
  * behavior supports optimizing pre/fetching of data for route transitions
2476
2002
  * via data-only SSR modes.
2477
2003
  *
2478
- * @param {ReadableStream} stream
2479
- * @return {Promise<void>}
2480
2004
  * @public
2481
2005
  */
2482
2006
  hydrate(stream) {
@@ -4480,11 +4004,13 @@ class RequestStateService {
4480
4004
  */
4481
4005
 
4482
4006
  // this import location is deprecated but breaks in 4.8 and older
4483
- // @ts-expect-error adding to globalThis
4484
- globalThis.setWarpDriveLogging = setLogging;
4007
+ if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
4008
+ // @ts-expect-error adding to globalThis
4009
+ globalThis.setWarpDriveLogging = setLogging;
4485
4010
 
4486
- // @ts-expect-error adding to globalThis
4487
- globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
4011
+ // @ts-expect-error adding to globalThis
4012
+ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
4013
+ }
4488
4014
  if (macroCondition(getGlobalConfig().WarpDrive.activeLogging.LOG_METRIC_COUNTS)) {
4489
4015
  if (getGlobalConfig().WarpDrive.debug.LOG_METRIC_COUNTS || globalThis.getWarpDriveRuntimeConfig().debug.LOG_METRIC_COUNTS) {
4490
4016
  // @ts-expect-error adding to globalThis
@@ -4669,7 +4195,7 @@ class Store extends BaseClass {
4669
4195
  /** @internal */
4670
4196
 
4671
4197
  /**
4672
- * Provides access to the NotificationManager associated
4198
+ * Provides access to the {@link NotificationManager} associated
4673
4199
  * with this Store instance.
4674
4200
  *
4675
4201
  * The NotificationManager can be used to subscribe to
@@ -5798,7 +5324,7 @@ function _convertPreloadRelationshipToJSON(value, type) {
5798
5324
  * "model" class.
5799
5325
  *
5800
5326
  * Only used when using the legacy schema-service implementation
5801
- * for @ember-data/model or when wrapping schema for legacy
5327
+ * for @warp-drive/legacy/model or when wrapping schema for legacy
5802
5328
  * Adapters/Serializers.
5803
5329
  *
5804
5330
  */
@@ -5900,7 +5426,7 @@ class RecordReference {
5900
5426
  simplest usage of this API is similar to `store.push`: you provide a
5901
5427
  normalized hash of data and the object represented by the reference
5902
5428
  will update.
5903
- If you pass a promise to `push`, Ember Data will not ask the adapter
5429
+ If you pass a promise to `push`, WarpDrive will not ask the adapter
5904
5430
  for the data if another attempt to fetch it is made in the
5905
5431
  interim. When the promise resolves, the underlying object is updated
5906
5432
  with the new data, and the promise returned by *this function* is resolved
@@ -6018,7 +5544,7 @@ function getShimClass(store, modelName) {
6018
5544
  return shim;
6019
5545
  }
6020
5546
 
6021
- // Mimics the static apis of @ember-data/model
5547
+ // Mimics the static apis of @warp-drive/legacy/model
6022
5548
  class ShimModelClass {
6023
5549
  constructor(store, modelName) {
6024
5550
  this.__store = store;
@@ -7208,1322 +6734,30 @@ function mutate(collection, mutation, _SIGNAL) {
7208
6734
  manager.mutate(mutation);
7209
6735
  notifyInternalSignal(_SIGNAL);
7210
6736
  }
7211
- const PromiseCache = new WeakMap();
7212
-
7213
- /**
7214
- * The state of a promise in the "pending"
7215
- * state. This is the default initial state.
7216
- *
7217
- */
7218
-
7219
- /**
7220
- * The state of a promise in the "fulfilled" state.
7221
- * This is the state of a promise that has resolved
7222
- * successfully.
7223
- *
7224
- */
7225
-
7226
- /**
7227
- * The state of a promise in the "rejected" state.
7228
- * This is the state of a promise that has rejected
7229
- * with an error.
7230
- *
7231
- */
7232
-
7233
- /**
7234
- * The state of a promise. This is the type that is returned
7235
- * from `getPromiseState`.
7236
- *
7237
- * See also:
7238
- * - {@link PendingPromise}
7239
- * - {@link ResolvedPromise}
7240
- * - {@link RejectedPromise}
7241
- *
7242
- */
7243
-
7244
- const PromiseStateProto = {};
7245
-
7246
- // TODO introduce a new mechanism for defining multiple properties
7247
- // that share a common signal
7248
- defineSignal(PromiseStateProto, 'reason', null);
7249
- defineSignal(PromiseStateProto, 'value', null);
7250
- defineSignal(PromiseStateProto, 'result', null);
7251
- defineSignal(PromiseStateProto, 'error', null);
7252
- defineSignal(PromiseStateProto, 'status', 'pending');
7253
- defineSignal(PromiseStateProto, 'isPending', true);
7254
- defineSignal(PromiseStateProto, 'isLoading', true);
7255
- defineSignal(PromiseStateProto, 'isSuccess', false);
7256
- defineSignal(PromiseStateProto, 'isError', false);
7257
- function createPromiseState(promise) {
7258
- const state = getPromiseResult(promise);
7259
- const promiseState = Object.create(PromiseStateProto);
7260
- if (state) {
7261
- if (state.isError) {
7262
- promiseState.error = state.result;
7263
- promiseState.reason = state.result;
7264
- promiseState.status = 'rejected';
7265
- promiseState.isError = true;
7266
- promiseState.isPending = false;
7267
- promiseState.isLoading = false;
7268
- } else {
7269
- promiseState.result = state.result;
7270
- promiseState.value = state.result;
7271
- promiseState.status = 'fulfilled';
7272
- promiseState.isSuccess = true;
7273
- promiseState.isPending = false;
7274
- promiseState.isLoading = false;
6737
+ function getAliasField(context) {
6738
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
6739
+ {
6740
+ throw new Error(`Alias field access is not implemented`);
7275
6741
  }
7276
- } else {
7277
- void promise.then(result => {
7278
- setPromiseResult(promise, {
7279
- isError: false,
7280
- result
7281
- });
7282
- promiseState.result = result;
7283
- promiseState.value = result;
7284
- promiseState.status = 'fulfilled';
7285
- promiseState.isSuccess = true;
7286
- promiseState.isPending = false;
7287
- promiseState.isLoading = false;
7288
- }, error => {
7289
- setPromiseResult(promise, {
7290
- isError: true,
7291
- result: error
7292
- });
7293
- promiseState.error = error;
7294
- promiseState.reason = error;
7295
- promiseState.status = 'rejected';
7296
- promiseState.isError = true;
7297
- promiseState.isPending = false;
7298
- promiseState.isLoading = false;
7299
- });
7300
- }
7301
- return promiseState;
7302
- }
7303
- const LegacyPromiseProxy = Symbol.for('LegacyPromiseProxy');
7304
- function isLegacyAwaitable(promise) {
7305
- return LegacyPromiseProxy in promise && 'promise' in promise && promise[LegacyPromiseProxy] === true;
7306
- }
7307
- function getPromise(promise) {
7308
- return isLegacyAwaitable(promise) ? promise.promise : promise;
6742
+ })() : {};
7309
6743
  }
7310
-
7311
- /**
7312
- * Returns a reactive state-machine for the provided promise or awaitable.
7313
- *
7314
- * Repeat calls to `getPromiseState` with the same promise will return the same state object
7315
- * making is safe and easy to use in templates and JavaScript code to produce reactive
7316
- * behaviors around promises.
7317
- *
7318
- * `getPromiseState` can be used in both JavaScript and Template contexts.
7319
- *
7320
- * ```ts
7321
- * import { getPromiseState } from '@warp-drive/ember';
7322
- *
7323
- * const state = getPromiseState(promise);
7324
- * ```
7325
- *
7326
- * For instance, we could write a getter on a component that updates whenever
7327
- * the promise state advances or the promise changes, by combining the function
7328
- * with the use of `@cached`
7329
- *
7330
- * ```ts
7331
- * class Component {
7332
- * @cached
7333
- * get title() {
7334
- * const state = getPromiseState(this.args.request);
7335
- * if (state.isPending) {
7336
- * return 'loading...';
7337
- * }
7338
- * if (state.isError) { return null; }
7339
- * return state.result.title;
7340
- * }
7341
- * }
7342
- * ```
7343
- *
7344
- * Or in a template as a helper:
7345
- *
7346
- * ```gjs
7347
- * import { getPromiseState } from '@warp-drive/ember';
7348
- *
7349
- * <template>
7350
- * {{#let (getPromiseState @request) as |state|}}
7351
- * {{#if state.isPending}} <Spinner />
7352
- * {{else if state.isError}} <ErrorForm @error={{state.error}} />
7353
- * {{else}}
7354
- * <h1>{{state.result.title}}</h1>
7355
- * {{/if}}
7356
- * {{/let}}
7357
- * </template>
7358
- * ```
7359
- *
7360
- * If looking to use in a template, consider also the `<Await />` component.
7361
- *
7362
- * See also {@link PromiseState}
7363
- */
7364
- function getPromiseState(promise) {
6744
+ function setAliasField(context) {
7365
6745
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
7366
- if (!test) {
7367
- throw new Error(`getPromiseState expects to be called with a promise: called with ${String(promise)}`);
6746
+ {
6747
+ throw new Error(`Alias field setting is not implemented`);
7368
6748
  }
7369
- })(promise) : {};
7370
- const _promise = getPromise(promise);
7371
- let state = PromiseCache.get(_promise);
7372
- if (!state) {
7373
- state = createPromiseState(_promise);
7374
- PromiseCache.set(_promise, state);
7375
- }
7376
- return state;
6749
+ })() : {};
6750
+ return false;
7377
6751
  }
7378
- function decorateMethodV2(prototype, prop, decorators) {
7379
- const origDesc = Object.getOwnPropertyDescriptor(prototype, prop);
7380
- let desc = {
7381
- ...origDesc
7382
- };
7383
- for (let decorator of decorators) {
7384
- desc = decorator(prototype, prop, desc) || desc;
7385
- }
7386
- if (desc.initializer !== void 0) {
7387
- desc.value = desc.initializer ? desc.initializer.call(prototype) : void 0;
7388
- desc.initializer = void 0;
7389
- }
7390
- Object.defineProperty(prototype, prop, desc);
6752
+ const ARRAY_GETTER_METHODS = new Set([Symbol.iterator, 'concat', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'reduce', 'reduceRight', 'slice', 'some', 'values']);
6753
+ // const ARRAY_SETTER_METHODS = new Set<KeyType>(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
6754
+ const SYNC_PROPS = new Set(['[]', 'length']);
6755
+ function isArrayGetter(prop) {
6756
+ return ARRAY_GETTER_METHODS.has(prop);
7391
6757
  }
7392
-
7393
- // default to 30 seconds unavailable before we refresh
7394
- const DEFAULT_DEADLINE = 30_000;
7395
- const DISPOSE = Symbol.dispose || Symbol.for('dispose');
7396
- function isNeverString(val) {
7397
- return val;
7398
- }
7399
-
7400
- /**
7401
- * Utilities to assist in recovering from the error.
7402
- */
7403
-
7404
- /** @deprecated use {@link RecoveryFeatures} */
7405
-
7406
- /**
7407
- * Utilities for keeping the request fresh
7408
- */
7409
-
7410
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7411
-
7412
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7413
-
7414
- /**
7415
- * A reactive class
7416
- *
7417
- * @hideconstructor
7418
- */
7419
- class RequestSubscription {
7420
- /**
7421
- * Whether the browser reports that the network is online.
7422
- */
7423
-
7424
- /**
7425
- * Whether the browser reports that the tab is hidden.
7426
- */
7427
-
7428
- /**
7429
- * Whether the component is currently refreshing the request.
7430
- */
7431
-
7432
- /**
7433
- * The most recent blocking request that was made, typically
7434
- * the result of a reload.
7435
- *
7436
- * This will never be the original request passed as an arg to
7437
- * the component.
7438
- *
7439
- * @internal
7440
- */
7441
-
7442
- /**
7443
- * The most recent request that was made, typically due to either a
7444
- * reload or a refresh.
7445
- *
7446
- * This will never be the original request passed as an arg to
7447
- * the component.
7448
- *
7449
- * @internal
7450
- */
7451
-
7452
- /**
7453
- * The time at which the network was reported as offline.
7454
- *
7455
- * @internal
7456
- */
7457
-
7458
- /** @internal */
7459
-
7460
- /** @internal */
7461
-
7462
- /** @internal */
7463
-
7464
- /** @internal */
7465
-
7466
- /** @internal */
7467
-
7468
- /**
7469
- * The event listener for network status changes,
7470
- * cached to use the reference for removal.
7471
- *
7472
- * @internal
7473
- */
7474
-
7475
- /**
7476
- * The event listener for visibility status changes,
7477
- * cached to use the reference for removal.
7478
- *
7479
- * @internal
7480
- */
7481
-
7482
- /**
7483
- * The last request passed as an arg to the component,
7484
- * cached for comparison.
7485
- *
7486
- * @internal
7487
- */
7488
-
7489
- /**
7490
- * The last query passed as an arg to the component,
7491
- * cached for comparison.
7492
- *
7493
- * @internal
7494
- */
7495
-
7496
- /** @internal */
7497
-
7498
- /** @internal */
7499
-
7500
- /** @internal */
7501
-
7502
- /**
7503
- * The Store this subscription subscribes to or the RequestManager
7504
- * which issues this request.
7505
- */
7506
-
7507
- /**
7508
- * The Store or RequestManager that the last subscription is attached to.
7509
- *
7510
- * This differs from 'store' because a <Request /> may be passed a
7511
- * request originating from a different store than the <Request />
7512
- * component would use if it were to issue the request itself.
7513
- *
7514
- * @internal
7515
- */
7516
- _requester;
7517
- constructor(store, args) {
7518
- this._args = args;
7519
- this.store = store;
7520
- this._subscribedTo = null;
7521
- this._subscription = null;
7522
- this._intervalStart = null;
7523
- this._invalidated = false;
7524
- this._nextInterval = null;
7525
- this._requester = null;
7526
- this.isDestroyed = false;
7527
- this[DISPOSE] = _DISPOSE;
7528
- this._installListeners();
7529
- void this._beginPolling();
7530
- }
7531
-
7532
- /**
7533
- * @internal
7534
- */
7535
- async _beginPolling() {
7536
- // await the initial request
7537
- try {
7538
- if (!this.isIdle) {
7539
- await this.request;
7540
- }
7541
- } catch {
7542
- // ignore errors here, we just want to wait for the request to finish
7543
- } finally {
7544
- if (!this.isDestroyed) {
7545
- void this._scheduleInterval();
7546
- }
7547
- }
7548
- }
7549
- get isIdle() {
7550
- const {
7551
- request,
7552
- query
7553
- } = this._args;
7554
- return Boolean(!request && !query);
7555
- }
7556
- static {
7557
- decorateMethodV2(this.prototype, "isIdle", [memoized]);
7558
- }
7559
- get autorefreshTypes() {
7560
- const {
7561
- autorefresh
7562
- } = this._args;
7563
- let types;
7564
- if (autorefresh === true) {
7565
- types = ['online', 'invalid'];
7566
- } else if (typeof autorefresh === 'string') {
7567
- types = autorefresh.split(',');
7568
- } else {
7569
- types = [];
7570
- }
7571
- return new Set(types);
7572
- }
7573
-
7574
- // we only run this function on component creation
7575
- // and when an update is triggered, so it does not
7576
- // react to changes in the autorefreshThreshold
7577
- // or autorefresh args.
7578
- //
7579
- // if we need to react to those changes, we can
7580
- // use a modifier or internal component or some
7581
- // such to trigger a re-run of this function.
7582
- /** @internal */
7583
- static {
7584
- decorateMethodV2(this.prototype, "autorefreshTypes", [memoized]);
7585
- }
7586
- async _scheduleInterval() {
7587
- const {
7588
- autorefreshThreshold
7589
- } = this._args;
7590
- const hasValidThreshold = typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0;
7591
- if (
7592
- // dont schedule in SSR
7593
- typeof window === 'undefined' ||
7594
- // dont schedule without a threshold
7595
- !hasValidThreshold ||
7596
- // dont schedule if we weren't told to
7597
- !this.autorefreshTypes.has('interval') ||
7598
- // dont schedule if we're already scheduled
7599
- this._intervalStart !== null) {
7600
- return;
7601
- }
7602
-
7603
- // if we have a current request, wait for it to finish
7604
- // before scheduling the next one
7605
- if (this._latestRequest) {
7606
- try {
7607
- await this._latestRequest;
7608
- } catch {
7609
- // ignore errors here, we just want to wait for the request to finish
7610
- }
7611
- if (this.isDestroyed) {
7612
- return;
7613
- }
7614
- }
7615
-
7616
- // setup the next interval
7617
- this._intervalStart = Date.now();
7618
- this._nextInterval = setTimeout(() => {
7619
- this._maybeUpdate();
7620
- }, autorefreshThreshold);
7621
- }
7622
-
7623
- /** @internal */
7624
- _clearInterval() {
7625
- if (this._nextInterval) {
7626
- clearTimeout(this._nextInterval);
7627
- this._intervalStart = null;
7628
- }
7629
- }
7630
- /**
7631
- * @internal
7632
- */
7633
- _updateSubscriptions() {
7634
- if (this.isIdle) {
7635
- return;
7636
- }
7637
- const requestId = this._request.lid;
7638
-
7639
- // if we're already subscribed to this request, we don't need to do anything
7640
- if (this._subscribedTo === requestId) {
7641
- return;
7642
- }
7643
-
7644
- // if we're subscribed to a different request, we need to unsubscribe
7645
- this._removeSubscriptions();
7646
-
7647
- // if we have a request, we need to subscribe to it
7648
- const store = this._getRequester();
7649
- this._requester = store;
7650
- if (requestId && isStore(store)) {
7651
- this._subscribedTo = requestId;
7652
- this._subscription = store.notifications.subscribe(requestId, (_id, op) => {
7653
- // ignore subscription events that occur while our own component's request
7654
- // is occurring
7655
- if (this._isUpdating) {
7656
- return;
7657
- }
7658
- switch (op) {
7659
- case 'invalidated':
7660
- {
7661
- // if we're subscribed to invalidations, we need to update
7662
- if (this.autorefreshTypes.has('invalid')) {
7663
- this._invalidated = true;
7664
- this._maybeUpdate();
7665
- }
7666
- break;
7667
- }
7668
- case 'state':
7669
- {
7670
- const latest = store.requestManager._deduped.get(requestId);
7671
- const priority = latest?.priority;
7672
- const state = this.reqState;
7673
- if (!priority) {
7674
- // if there is no priority, we have completed whatever request
7675
- // was occurring and so we are no longer refreshing (if we were)
7676
- this.isRefreshing = false;
7677
- } else if (priority.blocking && !state.isLoading) {
7678
- // if we are blocking, there is an active request for this identity
7679
- // that MUST be fulfilled from network (not cache).
7680
- // Thus this is not "refreshing" because we should clear out and
7681
- // block on this request.
7682
- //
7683
- // we receive state notifications when either a request initiates
7684
- // or completes.
7685
- //
7686
- // In the completes case: we may receive the state notification
7687
- // slightly before the request is finalized because the NotificationManager
7688
- // may sync flush it (and thus deliver it before the microtask completes)
7689
- //
7690
- // In the initiates case: we aren't supposed to receive one unless there
7691
- // is no other request in flight for this identity.
7692
- //
7693
- // However, there is a race condition here where the completed
7694
- // notification can trigger an update that generates a new request
7695
- // thus giving us an initiated notification before the older request
7696
- // finalizes.
7697
- //
7698
- // When this occurs, if the triggered update happens to have caused
7699
- // a new request to be made for the same identity AND that request
7700
- // is the one passed into this component as the @request arg, then
7701
- // getRequestState will return the state of the new request.
7702
- // We can detect this by checking if the request state is "loading"
7703
- // as outside of this case we would have a completed request.
7704
- //
7705
- // That is the reason for the `&& !state.isLoading` check above.
7706
-
7707
- // TODO should we just treat this as refreshing?
7708
- this.isRefreshing = false;
7709
- this._maybeUpdate('policy', true);
7710
- } else {
7711
- this.isRefreshing = true;
7712
- }
7713
- }
7714
- }
7715
- });
7716
- }
7717
- }
7718
-
7719
- /**
7720
- * @internal
7721
- */
7722
- _removeSubscriptions() {
7723
- const store = this._requester;
7724
- if (this._subscription && store && isStore(store)) {
7725
- store.notifications.unsubscribe(this._subscription);
7726
- this._subscribedTo = null;
7727
- this._subscription = null;
7728
- this._requester = null;
7729
- }
7730
- }
7731
-
7732
- /**
7733
- * Install the event listeners for network and visibility changes.
7734
- * This is only done in browser environments with a global `window`.
7735
- *
7736
- * @internal
7737
- */
7738
- _installListeners() {
7739
- if (typeof window === 'undefined') {
7740
- return;
7741
- }
7742
- this.isOnline = window.navigator.onLine;
7743
- this._unavailableStart = this.isOnline ? null : Date.now();
7744
- this.isHidden = document.visibilityState === 'hidden';
7745
- this._onlineChanged = event => {
7746
- this.isOnline = event.type === 'online';
7747
- if (event.type === 'offline' && this._unavailableStart === null) {
7748
- this._unavailableStart = Date.now();
7749
- }
7750
- this._maybeUpdate();
7751
- };
7752
- this._backgroundChanged = () => {
7753
- const isHidden = document.visibilityState === 'hidden';
7754
- this.isHidden = isHidden;
7755
- if (isHidden && this._unavailableStart === null) {
7756
- this._unavailableStart = Date.now();
7757
- }
7758
- this._maybeUpdate();
7759
- };
7760
- window.addEventListener('online', this._onlineChanged, {
7761
- passive: true,
7762
- capture: true
7763
- });
7764
- window.addEventListener('offline', this._onlineChanged, {
7765
- passive: true,
7766
- capture: true
7767
- });
7768
- document.addEventListener('visibilitychange', this._backgroundChanged, {
7769
- passive: true,
7770
- capture: true
7771
- });
7772
- }
7773
-
7774
- /**
7775
- * If the network is online and the tab is visible, either reload or refresh the request
7776
- * based on the component's configuration and the requested update mode.
7777
- *
7778
- * Valid modes are:
7779
- *
7780
- * - `'reload'`: Force a reload of the request.
7781
- * - `'refresh'`: Refresh the request in the background.
7782
- * - `'policy'`: Make the request, letting the store's configured CachePolicy decide whether to reload, refresh, or do nothing.
7783
- * - `undefined`: Make the request using the component's autorefreshBehavior setting if the autorefreshThreshold has passed.
7784
- *
7785
- * @internal
7786
- */
7787
- _maybeUpdate(mode, silent) {
7788
- if (this.isIdle) {
7789
- return;
7790
- }
7791
- const {
7792
- reqState
7793
- } = this;
7794
- if (reqState.isPending) {
7795
- return;
7796
- }
7797
- const canAttempt = Boolean(this.isOnline && !this.isHidden && (mode || this.autorefreshTypes.size));
7798
- if (!canAttempt) {
7799
- if (!silent && mode && mode !== '_invalidated') {
7800
- throw new Error(`Reload not available: the network is not online or the tab is hidden`);
7801
- }
7802
- return;
7803
- }
7804
- const {
7805
- autorefreshTypes
7806
- } = this;
7807
- let shouldAttempt = this._invalidated || Boolean(mode);
7808
- if (!shouldAttempt && autorefreshTypes.has('online')) {
7809
- const {
7810
- _unavailableStart
7811
- } = this;
7812
- const {
7813
- autorefreshThreshold
7814
- } = this._args;
7815
- const deadline = typeof autorefreshThreshold === 'number' ? autorefreshThreshold : DEFAULT_DEADLINE;
7816
- shouldAttempt = Boolean(_unavailableStart && Date.now() - _unavailableStart > deadline);
7817
- }
7818
- if (!shouldAttempt && autorefreshTypes.has('interval')) {
7819
- const {
7820
- _intervalStart
7821
- } = this;
7822
- const {
7823
- autorefreshThreshold
7824
- } = this._args;
7825
- if (_intervalStart && typeof autorefreshThreshold === 'number' && autorefreshThreshold > 0) {
7826
- shouldAttempt = Boolean(Date.now() - _intervalStart >= autorefreshThreshold);
7827
- }
7828
- }
7829
- this._unavailableStart = null;
7830
- this._invalidated = false;
7831
- if (shouldAttempt) {
7832
- this._clearInterval();
7833
- this._isUpdating = true;
7834
- const realMode = mode === '_invalidated' ? null : mode;
7835
- const val = realMode ?? this._args.autorefreshBehavior ?? 'policy';
7836
-
7837
- // if the future was generated by an older store version, it may not have
7838
- // a requester set. In this case we append it to ensure that reload and
7839
- // refresh will work appropriately.
7840
- const requester = this._getRequester();
7841
- if (!reqState._request.requester) {
7842
- reqState._request.requester = requester;
7843
- }
7844
- switch (val) {
7845
- case 'reload':
7846
- this._latestRequest = reqState.reload();
7847
- break;
7848
- case 'refresh':
7849
- this._latestRequest = reqState.refresh();
7850
- break;
7851
- case 'policy':
7852
- this._latestRequest = reqState.refresh(true);
7853
- break;
7854
- default:
7855
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
7856
- {
7857
- throw new Error(`Invalid ${mode ? 'update mode' : '@autorefreshBehavior'} for <Request />: ${isNeverString(val)}`);
7858
- }
7859
- })() : {};
7860
- }
7861
- if (val !== 'refresh') {
7862
- this._localRequest = this._latestRequest;
7863
- }
7864
- void this._scheduleInterval();
7865
- void this._latestRequest.finally(() => {
7866
- this._isUpdating = false;
7867
- });
7868
- }
7869
- }
7870
-
7871
- /**
7872
- * @internal
7873
- */
7874
- _getRequester() {
7875
- // Note: we check for the requester's presence
7876
- // as well as the request's presence because we may
7877
- // be subscribed to a request issued by a store from an older
7878
- // version of the library that didn't yet set requester.
7879
- if (this._args.request?.requester) {
7880
- return this._args.request.requester;
7881
- }
7882
- return this.store;
7883
- }
7884
-
7885
- /**
7886
- * Retry the request, reloading it from the server.
7887
- */
7888
- retry = async () => {
7889
- this._maybeUpdate('reload');
7890
- await this._localRequest;
7891
- };
7892
-
7893
- /**
7894
- * Refresh the request, updating it in the background.
7895
- */
7896
- refresh = async () => {
7897
- this._maybeUpdate('refresh');
7898
- await this._latestRequest;
7899
- };
7900
-
7901
- /**
7902
- * features to yield to the error slot of a component
7903
- */
7904
- get errorFeatures() {
7905
- return {
7906
- isHidden: this.isHidden,
7907
- isOnline: this.isOnline,
7908
- retry: this.retry
7909
- };
7910
- }
7911
-
7912
- /**
7913
- * features to yield to the content slot of a component
7914
- */
7915
- static {
7916
- decorateMethodV2(this.prototype, "errorFeatures", [memoized]);
7917
- }
7918
- get contentFeatures() {
7919
- const feat = {
7920
- isHidden: this.isHidden,
7921
- isOnline: this.isOnline,
7922
- reload: this.retry,
7923
- refresh: this.refresh,
7924
- isRefreshing: this.isRefreshing,
7925
- latestRequest: this._latestRequest
7926
- };
7927
- if (feat.isRefreshing) {
7928
- feat.abort = () => {
7929
- this._latestRequest?.abort();
7930
- };
7931
- }
7932
- return feat;
7933
- }
7934
-
7935
- /**
7936
- * @internal
7937
- */
7938
- static {
7939
- decorateMethodV2(this.prototype, "contentFeatures", [memoized]);
7940
- }
7941
- get _request() {
7942
- const {
7943
- request,
7944
- query
7945
- } = this._args;
7946
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
7947
- if (!test) {
7948
- throw new Error(`Cannot use both @request and @query args with the <Request> component`);
7949
- }
7950
- })(!request || !query) : {};
7951
- const {
7952
- _localRequest,
7953
- _originalRequest,
7954
- _originalQuery
7955
- } = this;
7956
- const isOriginalRequest = request === _originalRequest && query === _originalQuery;
7957
- if (_localRequest && isOriginalRequest) {
7958
- return _localRequest;
7959
- }
7960
-
7961
- // update state checks for the next time
7962
- this._originalQuery = query;
7963
- this._originalRequest = request;
7964
- if (request) {
7965
- return request;
7966
- }
7967
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
7968
- if (!test) {
7969
- throw new Error(`You must provide either @request or an @query arg with the <Request> component`);
7970
- }
7971
- })(query) : {};
7972
- return this.store.request(query);
7973
- }
7974
- static {
7975
- decorateMethodV2(this.prototype, "_request", [memoized]);
7976
- }
7977
- get request() {
7978
- if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
7979
- try {
7980
- const request = this._request;
7981
- this._updateSubscriptions();
7982
- return request;
7983
- } catch (e) {
7984
- // eslint-disable-next-line no-console
7985
- console.log(e);
7986
- throw new Error(`Unable to initialize the request`, {
7987
- cause: e
7988
- });
7989
- }
7990
- } else {
7991
- const request = this._request;
7992
- this._updateSubscriptions();
7993
- return request;
7994
- }
7995
- }
7996
- static {
7997
- decorateMethodV2(this.prototype, "request", [memoized]);
7998
- }
7999
- get reqState() {
8000
- return getRequestState(this.request);
8001
- }
8002
- get result() {
8003
- return this.reqState.result;
8004
- }
8005
- }
8006
- defineSignal(RequestSubscription.prototype, 'isOnline', true);
8007
- defineSignal(RequestSubscription.prototype, 'isHidden', false);
8008
- defineSignal(RequestSubscription.prototype, 'isRefreshing', false);
8009
- defineSignal(RequestSubscription.prototype, '_localRequest', undefined);
8010
- defineSignal(RequestSubscription.prototype, '_latestRequest', undefined);
8011
- function isStore(store) {
8012
- return 'requestManager' in store;
8013
- }
8014
- function createRequestSubscription(store, args) {
8015
- return new RequestSubscription(store, args);
8016
- }
8017
- function upgradeSubscription(sub) {
8018
- return sub;
8019
- }
8020
- function _DISPOSE() {
8021
- const self = upgradeSubscription(this);
8022
- self.isDestroyed = true;
8023
- self._removeSubscriptions();
8024
- if (typeof window === 'undefined') {
8025
- return;
8026
- }
8027
- self._clearInterval();
8028
- window.removeEventListener('online', self._onlineChanged, {
8029
- passive: true,
8030
- capture: true
8031
- });
8032
- window.removeEventListener('offline', self._onlineChanged, {
8033
- passive: true,
8034
- capture: true
8035
- });
8036
- document.removeEventListener('visibilitychange', self._backgroundChanged, {
8037
- passive: true,
8038
- capture: true
8039
- });
8040
- }
8041
- const RequestCache = new WeakMap();
8042
- function isAbortError(error) {
8043
- return error instanceof DOMException && error.name === 'AbortError';
8044
- }
8045
- function upgradeLoadingState(state) {
8046
- return state;
8047
- }
8048
- async function watchStream(stream, loadingState) {
8049
- const state = upgradeLoadingState(loadingState);
8050
- const reader = stream.getReader();
8051
- let bytesLoaded = 0;
8052
- let shouldForward = state._stream !== null && state._stream.readable.locked;
8053
- let isForwarding = shouldForward;
8054
- let writer = state._stream?.writable.getWriter();
8055
- const buffer = [];
8056
- state._isPending = false;
8057
- state._isStarted = true;
8058
- state._startTime = performance.now();
8059
- while (true) {
8060
- const {
8061
- value,
8062
- done
8063
- } = await reader.read();
8064
- if (done) {
8065
- break;
8066
- }
8067
- bytesLoaded += value.byteLength;
8068
- state._bytesLoaded = bytesLoaded;
8069
- state._lastPacketTime = performance.now();
8070
- shouldForward = shouldForward || state._stream !== null && state._stream.readable.locked;
8071
- if (shouldForward) {
8072
- if (!isForwarding) {
8073
- isForwarding = true;
8074
- writer = state._stream.writable.getWriter();
8075
- for (const item of buffer) {
8076
- await writer.ready;
8077
- await writer.write(item);
8078
- }
8079
- buffer.length = 0;
8080
- }
8081
- await writer.ready;
8082
- await writer.write(value);
8083
- } else {
8084
- buffer.push(value);
8085
- }
8086
- }
8087
-
8088
- // if we are still forwarding, we need to close the writer
8089
- if (isForwarding) {
8090
- await writer.ready;
8091
- await writer.close();
8092
- } else if (state._stream) {
8093
- // if we are not forwarding, we need to cancel the stream
8094
- await state._stream.readable.cancel('The Stream Has Already Ended');
8095
- state._stream = null;
8096
- }
8097
- const endTime = performance.now();
8098
- state._endTime = endTime;
8099
- state._isComplete = true;
8100
- state._isStarted = false;
8101
- }
8102
-
8103
- /**
8104
- * Lazily consumes the stream of a request, providing a number of
8105
- * reactive properties that can be used to build UIs that respond
8106
- * to the progress of a request.
8107
- *
8108
- * @hideconstructor
8109
- */
8110
- class RequestLoadingState {
8111
- /** @internal */
8112
-
8113
- /** @internal */
8114
-
8115
- /** @internal */
8116
-
8117
- /** @internal */
8118
-
8119
- /** @internal */
8120
-
8121
- /** @internal */
8122
-
8123
- /** @internal */
8124
-
8125
- /** @internal */
8126
-
8127
- /** @internal */
8128
-
8129
- /** @internal */
8130
-
8131
- /** @internal */
8132
-
8133
- /** @internal */
8134
- _stream = null;
8135
- /** @internal */
8136
- _future;
8137
- /** @internal */
8138
- _triggered = false;
8139
- /** @internal */
8140
- _trigger() {
8141
- if (this._triggered) {
8142
- return;
8143
- }
8144
- this._triggered = true;
8145
- const future = this._future;
8146
- const promise = future.getStream();
8147
- if (promise.sizeHint) {
8148
- this._sizeHint = promise.sizeHint;
8149
- }
8150
- this.promise = promise.then(stream => {
8151
- if (!stream) {
8152
- this._isPending = false;
8153
- this._isComplete = true;
8154
- return;
8155
- }
8156
- return watchStream(stream, this);
8157
- }, error => {
8158
- this._isPending = false;
8159
- this._isStarted = false;
8160
- if (isAbortError(error)) {
8161
- this._isCancelled = true;
8162
- this._isComplete = true;
8163
- }
8164
- this._isErrored = true;
8165
- this._error = error;
8166
- });
8167
- }
8168
- promise = null;
8169
- get isPending() {
8170
- this._trigger();
8171
- return this._isPending;
8172
- }
8173
- get sizeHint() {
8174
- this._trigger();
8175
- return this._sizeHint;
8176
- }
8177
- get stream() {
8178
- this._trigger();
8179
- if (!this._stream) {
8180
- if (this._isComplete || this._isCancelled || this._isErrored) {
8181
- return null;
8182
- }
8183
- this._stream = new TransformStream();
8184
- }
8185
- return this._stream.readable;
8186
- }
8187
- get isStarted() {
8188
- this._trigger();
8189
- return this._isStarted;
8190
- }
8191
- get bytesLoaded() {
8192
- this._trigger();
8193
- return this._bytesLoaded;
8194
- }
8195
- get startTime() {
8196
- this._trigger();
8197
- return this._startTime;
8198
- }
8199
- get endTime() {
8200
- this._trigger();
8201
- return this._endTime;
8202
- }
8203
- get lastPacketTime() {
8204
- this._trigger();
8205
- return this._lastPacketTime;
8206
- }
8207
- get isComplete() {
8208
- this._trigger();
8209
- return this._isComplete;
8210
- }
8211
- get isCancelled() {
8212
- this._trigger();
8213
- return this._isCancelled;
8214
- }
8215
- get isErrored() {
8216
- this._trigger();
8217
- return this._isErrored;
8218
- }
8219
- get error() {
8220
- this._trigger();
8221
- return this._error;
8222
- }
8223
- get elapsedTime() {
8224
- return (this.endTime || this.lastPacketTime) - this.startTime;
8225
- }
8226
- get completedRatio() {
8227
- return this.sizeHint ? this.bytesLoaded / this.sizeHint : 0;
8228
- }
8229
- get remainingRatio() {
8230
- return 1 - this.completedRatio;
8231
- }
8232
- get duration() {
8233
- return this.endTime - this.startTime;
8234
- }
8235
- get speed() {
8236
- // bytes per second
8237
- return this.bytesLoaded / (this.elapsedTime / 1000);
8238
- }
8239
- constructor(future) {
8240
- this._future = future;
8241
- }
8242
- abort = () => {
8243
- this._future.abort();
8244
- };
8245
- }
8246
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_isPending', true);
8247
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_isStarted', false);
8248
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_isComplete', false);
8249
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_isCancelled', false);
8250
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_isErrored', false);
8251
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_error', null);
8252
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_sizeHint', 0);
8253
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_bytesLoaded', 0);
8254
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_startTime', 0);
8255
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_endTime', 0);
8256
- defineNonEnumerableSignal(RequestLoadingState.prototype, '_lastPacketTime', 0);
8257
-
8258
- /**
8259
- * The state of a request in the "pending"
8260
- * state. This is the default initial state.
8261
- *
8262
- * Extends the {@link PendingPromise} interface.
8263
- *
8264
- */
8265
-
8266
- /**
8267
- * The state of a request in the "fulfilled" state.
8268
- * This is the state of a request that has resolved
8269
- * successfully.
8270
- *
8271
- * Extends the {@link ResolvedPromise} interface.
8272
- *
8273
- */
8274
-
8275
- /**
8276
- * The state of a request in the "rejected" state.
8277
- * This is the state of a request that has rejected
8278
- * with an error.
8279
- *
8280
- * Extends the {@link RejectedPromise} interface.
8281
- *
8282
- */
8283
-
8284
- /**
8285
- * The state of a request in the "cancelled" state.
8286
- * This is the state of a promise that has been
8287
- * cancelled.
8288
- *
8289
- */
8290
-
8291
- /**
8292
- * RequestState extends the concept of {@link PromiseState} to provide a reactive
8293
- * wrapper for a request {@link Future} which allows you write declarative code
8294
- * around a Future's control flow.
8295
- *
8296
- * It is useful in both Template and JavaScript contexts, allowing you
8297
- * to quickly derive behaviors and data from pending, error and success
8298
- * states.
8299
- *
8300
- * The key difference between a {@link Promise} and a Future is that Futures provide
8301
- * access to a {@link ReadableStream | stream} of their content, the {@link RequestKey} of the request (if any)
8302
- * as well as the ability to attempt to {@link Future.abort | abort} the request.
8303
- *
8304
- * ```ts
8305
- * interface Future<T> extends Promise<T>> {
8306
- * getStream(): Promise<ReadableStream>;
8307
- * abort(): void;
8308
- * lid: RequestKey | null;
8309
- * }
8310
- * ```
8311
- *
8312
- * These additional APIs allow us to craft even richer state experiences.
8313
- *
8314
- * To get the state of a request, use {@link getRequestState}.
8315
- *
8316
- * See also:
8317
- * - {@link PendingRequest}
8318
- * - {@link ResolvedRequest}
8319
- * - {@link RejectedRequest}
8320
- * - {@link CancelledRequest}
8321
- *
8322
- */
8323
-
8324
- const RequestStateProto = {};
8325
- function performRefresh(requester, request, isReload) {
8326
- const req = Object.assign({}, request);
8327
- const cacheOptions = Object.assign({}, req.cacheOptions);
8328
- if (isReload) {
8329
- // force direct to network
8330
- cacheOptions.reload = true;
8331
- } else if (isReload === false) {
8332
- // delete reload to ensure we use backgroundReload / policy
8333
- delete cacheOptions.reload;
8334
- cacheOptions.backgroundReload = true;
8335
- } else {
8336
- // delete props to ensure we use the policy
8337
- delete cacheOptions.backgroundReload;
8338
- delete cacheOptions.reload;
8339
- }
8340
- req.cacheOptions = cacheOptions;
8341
- return requester.request(req);
8342
- }
8343
-
8344
- // TODO introduce a new mechanism for defining multiple properties
8345
- // that share a common signal
8346
- defineSignal(RequestStateProto, 'reason', null);
8347
- defineSignal(RequestStateProto, 'value', null);
8348
- defineSignal(RequestStateProto, 'result', null);
8349
- defineSignal(RequestStateProto, 'error', null);
8350
- defineSignal(RequestStateProto, 'status', 'pending');
8351
- defineSignal(RequestStateProto, 'isPending', true);
8352
- defineSignal(RequestStateProto, 'isLoading', true);
8353
- defineSignal(RequestStateProto, 'isSuccess', false);
8354
- defineSignal(RequestStateProto, 'isError', false);
8355
- defineSignal(RequestStateProto, 'request', null);
8356
- defineSignal(RequestStateProto, 'response', null);
8357
- Object.defineProperty(RequestStateProto, 'isCancelled', {
8358
- get() {
8359
- return this.isError && isAbortError(this.reason);
8360
- }
8361
- });
8362
- Object.defineProperty(RequestStateProto, 'loadingState', {
8363
- get() {
8364
- if (!this._loadingState) {
8365
- this._loadingState = new RequestLoadingState(this._request);
8366
- }
8367
- return this._loadingState;
8368
- }
8369
- });
8370
- function createRequestState(future) {
8371
- const state = getPromiseResult(future);
8372
- const promiseState = Object.create(RequestStateProto);
8373
- promiseState._request = future;
8374
- // @ts-expect-error - we still attach it for PendingState
8375
- promiseState.reload = () => {
8376
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
8377
- if (!test) {
8378
- throw new Error(`Cannot reload a request that is still pending. Await or abort the original request first.`);
8379
- }
8380
- })(!promiseState.isPending) : {};
8381
- return performRefresh(future.requester, promiseState.request, true);
8382
- };
8383
-
8384
- // @ts-expect-error - we still attach it for PendingState
8385
- promiseState.refresh = (usePolicy = false) => {
8386
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
8387
- if (!test) {
8388
- throw new Error(`Cannot refresh a request that is still pending. Await or abort the original request first.`);
8389
- }
8390
- })(!promiseState.isPending) : {};
8391
- return performRefresh(future.requester, promiseState.request, usePolicy === true ? null : false);
8392
- };
8393
- if (state) {
8394
- if (state.isError) {
8395
- promiseState.error = state.result;
8396
- promiseState.reason = state.result;
8397
- promiseState.status = 'rejected';
8398
- promiseState.isError = true;
8399
- promiseState.isPending = false;
8400
- promiseState.isLoading = false;
8401
- promiseState.request = state.result.request;
8402
- promiseState.response = state.result.response;
8403
- } else {
8404
- promiseState.result = state.result.content;
8405
- promiseState.value = state.result.content;
8406
- promiseState.status = 'fulfilled';
8407
- promiseState.isSuccess = true;
8408
- promiseState.isPending = false;
8409
- promiseState.isLoading = false;
8410
- promiseState.request = state.result.request;
8411
- promiseState.response = state.result.response;
8412
- }
8413
- } else {
8414
- void future.then(result => {
8415
- setPromiseResult(future, {
8416
- isError: false,
8417
- result
8418
- });
8419
- promiseState.result = result.content;
8420
- promiseState.value = result.content;
8421
- promiseState.status = 'fulfilled';
8422
- promiseState.isSuccess = true;
8423
- promiseState.isPending = false;
8424
- promiseState.isLoading = false;
8425
- promiseState.request = result.request;
8426
- promiseState.response = result.response;
8427
- }, error => {
8428
- setPromiseResult(future, {
8429
- isError: true,
8430
- result: error
8431
- });
8432
- promiseState.error = error;
8433
- promiseState.reason = error;
8434
- promiseState.status = 'rejected';
8435
- promiseState.isError = true;
8436
- promiseState.isPending = false;
8437
- promiseState.isLoading = false;
8438
- promiseState.request = error.request;
8439
- promiseState.response = error.response;
8440
- });
8441
- }
8442
- return promiseState;
8443
- }
8444
-
8445
- /**
8446
- * `getRequestState` can be used in both JavaScript and Template contexts.
8447
- *
8448
- * ```ts
8449
- * import { getRequestState } from '@warp-drive/ember';
8450
- *
8451
- * const state = getRequestState(future);
8452
- * ```
8453
- *
8454
- * For instance, we could write a getter on a component that updates whenever
8455
- * the request state advances or the future changes, by combining the function
8456
- * with the use of `@cached`
8457
- *
8458
- * ```ts
8459
- * class Component {
8460
- * @cached
8461
- * get title() {
8462
- * const state = getRequestState(this.args.request);
8463
- * if (state.isPending) {
8464
- * return 'loading...';
8465
- * }
8466
- * if (state.isError) { return null; }
8467
- * return state.result.title;
8468
- * }
8469
- * }
8470
- * ```
8471
- *
8472
- * Or in a template as a helper:
8473
- *
8474
- * ```gjs
8475
- * import { getRequestState } from '@warp-drive/ember';
8476
- *
8477
- * <template>
8478
- * {{#let (getRequestState @request) as |state|}}
8479
- * {{#if state.isPending}}
8480
- * <Spinner />
8481
- * {{else if state.isError}}
8482
- * <ErrorForm @error={{state.error}} />
8483
- * {{else}}
8484
- * <h1>{{state.result.title}}</h1>
8485
- * {{/if}}
8486
- * {{/let}}
8487
- * </template>
8488
- * ```
8489
- *
8490
- * If looking to use in a template, consider also the `<Request />` component
8491
- * which offers a numbe of additional capabilities for requests *beyond* what
8492
- * `RequestState` provides.
8493
- *
8494
- */
8495
- function getRequestState(future) {
8496
- let state = RequestCache.get(future);
8497
- if (!state) {
8498
- state = createRequestState(future);
8499
- RequestCache.set(future, state);
8500
- }
8501
- return state;
8502
- }
8503
- function getAliasField(context) {
8504
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
8505
- {
8506
- throw new Error(`Alias field access is not implemented`);
8507
- }
8508
- })() : {};
8509
- }
8510
- function setAliasField(context) {
8511
- macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
8512
- {
8513
- throw new Error(`Alias field setting is not implemented`);
8514
- }
8515
- })() : {};
8516
- return false;
8517
- }
8518
- const ARRAY_GETTER_METHODS = new Set([Symbol.iterator, 'concat', 'entries', 'every', 'fill', 'filter', 'find', 'findIndex', 'flat', 'flatMap', 'forEach', 'includes', 'indexOf', 'join', 'keys', 'lastIndexOf', 'map', 'reduce', 'reduceRight', 'slice', 'some', 'values']);
8519
- // const ARRAY_SETTER_METHODS = new Set<KeyType>(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
8520
- const SYNC_PROPS = new Set(['[]', 'length']);
8521
- function isArrayGetter(prop) {
8522
- return ARRAY_GETTER_METHODS.has(prop);
8523
- }
8524
- const ARRAY_SETTER_METHODS = new Set(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
8525
- function isArraySetter(prop) {
8526
- return ARRAY_SETTER_METHODS.has(prop);
6758
+ const ARRAY_SETTER_METHODS = new Set(['push', 'pop', 'unshift', 'shift', 'splice', 'sort']);
6759
+ function isArraySetter(prop) {
6760
+ return ARRAY_SETTER_METHODS.has(prop);
8527
6761
  }
8528
6762
 
8529
6763
  // function isSelfProp<T extends object>(self: T, prop: KeyType): prop is keyof T {
@@ -8796,7 +7030,7 @@ class ManagedArray {
8796
7030
  if (fn === undefined) {
8797
7031
  fn = function () {
8798
7032
  if (!IS_EDITABLE) {
8799
- throw new Error(`Mutating this array via ${String(prop)} is not allowed because the record is not editable`);
7033
+ throw new Error(`Mutating this array via ${String(prop)} is not allowed because the ReactiveResource is not editable`);
8800
7034
  }
8801
7035
  consumeInternalSignal(_SIGNAL);
8802
7036
  transaction = true;
@@ -8819,7 +7053,12 @@ class ManagedArray {
8819
7053
  if (context.path) {
8820
7054
  errorPath = context.path[context.path.length - 1];
8821
7055
  }
8822
- throw new Error(`Cannot set ${String(prop)} on ${errorPath} because the record is not editable`);
7056
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
7057
+ {
7058
+ throw new Error(`Cannot set ${String(prop)} on ${errorPath} because the ReactiveResource is not editable`);
7059
+ }
7060
+ })() : {};
7061
+ return false;
8823
7062
  }
8824
7063
  if (prop === 'identifier') {
8825
7064
  self.identifier = value;
@@ -9753,7 +7992,12 @@ function setSchemaObjectField(context) {
9753
7992
  });
9754
7993
  for (const key of Object.keys(newValue)) {
9755
7994
  if (!schemaFields.has(key)) {
9756
- throw new Error(`Field ${key} does not exist on schema object ${context.field.type}`);
7995
+ macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
7996
+ {
7997
+ throw new Error(`Field ${key} does not exist on schema object ${context.field.type}`);
7998
+ }
7999
+ })() : {};
8000
+ return false;
9757
8001
  }
9758
8002
  }
9759
8003
  } else {
@@ -9884,6 +8128,11 @@ function isNonEnumerableProp(prop) {
9884
8128
  return prop === 'constructor' || prop === 'prototype' || prop === '__proto__' || prop === 'toString' || prop === 'toJSON' || prop === 'toHTML' || typeof prop === 'symbol';
9885
8129
  }
9886
8130
  const Editables = new Map();
8131
+
8132
+ /**
8133
+ * @private
8134
+ */
8135
+
9887
8136
  /**
9888
8137
  * A class that uses a the ResourceSchema for a ResourceType
9889
8138
  * and a ResourceKey to transform data from the cache into a rich, reactive
@@ -10301,7 +8550,7 @@ class ReactiveResource {
10301
8550
  if (!context.editable) {
10302
8551
  macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? (test => {
10303
8552
  {
10304
- throw new Error(`Cannot set ${String(prop)} on ${context.path !== null ? context.value : resourceKey.type} because the record is not editable`);
8553
+ throw new Error(`Cannot set ${String(prop)} on ${context.path !== null ? context.value : resourceKey.type} because the ReactiveResource is not editable`);
10305
8554
  }
10306
8555
  })() : {};
10307
8556
  return false;
@@ -11645,11 +9894,13 @@ class RequestManager {
11645
9894
  * @mergeModuleWith <project>
11646
9895
  */
11647
9896
 
11648
- // @ts-expect-error adding to globalThis
11649
- globalThis.setWarpDriveLogging = setLogging;
9897
+ if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
9898
+ // @ts-expect-error adding to globalThis
9899
+ globalThis.setWarpDriveLogging = setLogging;
11650
9900
 
11651
- // @ts-expect-error adding to globalThis
11652
- globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
9901
+ // @ts-expect-error adding to globalThis
9902
+ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
9903
+ }
11653
9904
 
11654
9905
  /**
11655
9906
  * Options for setting up a Store instance with `useRecommendedStore`.
@@ -11670,7 +9921,7 @@ globalThis.getWarpDriveRuntimeConfig = getRuntimeConfig;
11670
9921
  * ```
11671
9922
  */
11672
9923
  function useRecommendedStore(options, StoreKlass = Store) {
11673
- return class ConfiguredStore extends StoreKlass {
9924
+ return class AppStore extends StoreKlass {
11674
9925
  requestManager = new RequestManager().use([...(options.handlers ?? []), Fetch]).useCache(CacheHandler);
11675
9926
  lifetimes = options.policy ?? new DefaultCachePolicy({
11676
9927
  apiCacheHardExpires: 15 * 60 * 1000,
@@ -11728,4 +9979,4 @@ function useRecommendedStore(options, StoreKlass = Store) {
11728
9979
  }
11729
9980
  };
11730
9981
  }
11731
- export { setIdentifierForgetMethod as $, defineGate as A, defineNonEnumerableSignal as B, CacheHandler as C, DISPOSE as D, Signals as E, peekInternalSignal as F, createInternalMemo as G, withSignalStore as H, notifyInternalSignal as I, consumeInternalSignal as J, getOrCreateInternalSignal as K, checkout as L, instantiateRecord as M, teardownRecord as N, SchemaService as O, withDefaults as P, fromIdentity as Q, RecordArrayManager as R, Store as S, registerDerivations as T, commit as U, Fetch as V, RequestManager as W, useRecommendedStore as X, setIdentifierGenerationMethod as Y, setIdentifierUpdateMethod as Z, _clearCaches as _, isRequestKey as a, setIdentifierResetMethod as a0, setKeyInfoForResource as a1, coerceId as b, constructResource as c, assertPrivateStore as d, ensureStringId as e, fastPush as f, isPrivateStore as g, assertPrivateCapabilities as h, isResourceKey as i, setRecordIdentifier as j, StoreMap as k, createLegacyManyArray as l, log as m, normalizeModelName as n, logGroup as o, getPromiseState as p, createRequestSubscription as q, recordIdentifierFor as r, storeFor as s, getRequestState as t, signal as u, memoized as v, gate as w, entangleSignal as x, entangleInitiallyStaleSignal as y, defineSignal as z };
9982
+ export { useRecommendedStore as A, setIdentifierGenerationMethod as B, CacheHandler as C, setIdentifierUpdateMethod as D, setIdentifierForgetMethod as E, Fetch as F, setIdentifierResetMethod as G, setKeyInfoForResource as H, RecordArrayManager as R, Store as S, _clearCaches as _, isRequestKey as a, coerceId as b, constructResource as c, assertPrivateStore as d, ensureStringId as e, fastPush as f, isPrivateStore as g, assertPrivateCapabilities as h, isResourceKey as i, setRecordIdentifier as j, StoreMap as k, createLegacyManyArray as l, log as m, normalizeModelName as n, logGroup as o, checkout as p, instantiateRecord as q, recordIdentifierFor as r, storeFor as s, teardownRecord as t, SchemaService as u, fromIdentity as v, withDefaults as w, registerDerivations as x, commit as y, RequestManager as z };