@warp-drive/core 5.6.0-alpha.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. package/CHANGELOG.md +1 -0
  2. package/LICENSE.md +23 -0
  3. package/README.md +70 -0
  4. package/addon-main.cjs +5 -0
  5. package/cjs-dist/addon-shim.cjs +1 -0
  6. package/cjs-dist/cjs-set-config.cjs +1 -0
  7. package/declarations/build-config/babel-macros.d.ts +2 -0
  8. package/declarations/build-config/babel-macros.d.ts.map +1 -0
  9. package/declarations/build-config/canary-features.d.ts +2 -0
  10. package/declarations/build-config/canary-features.d.ts.map +1 -0
  11. package/declarations/build-config/debugging.d.ts +2 -0
  12. package/declarations/build-config/debugging.d.ts.map +1 -0
  13. package/declarations/build-config/deprecations.d.ts +2 -0
  14. package/declarations/build-config/deprecations.d.ts.map +1 -0
  15. package/declarations/build-config/env.d.ts +2 -0
  16. package/declarations/build-config/env.d.ts.map +1 -0
  17. package/declarations/build-config/macros.d.ts +2 -0
  18. package/declarations/build-config/macros.d.ts.map +1 -0
  19. package/declarations/build-config.d.ts +2 -0
  20. package/declarations/build-config.d.ts.map +1 -0
  21. package/declarations/configure.d.ts +8 -0
  22. package/declarations/configure.d.ts.map +1 -0
  23. package/declarations/graph/-private/-diff.d.ts +33 -0
  24. package/declarations/graph/-private/-diff.d.ts.map +1 -0
  25. package/declarations/graph/-private/-edge-definition.d.ts +149 -0
  26. package/declarations/graph/-private/-edge-definition.d.ts.map +1 -0
  27. package/declarations/graph/-private/-state.d.ts +10 -0
  28. package/declarations/graph/-private/-state.d.ts.map +1 -0
  29. package/declarations/graph/-private/-utils.d.ts +26 -0
  30. package/declarations/graph/-private/-utils.d.ts.map +1 -0
  31. package/declarations/graph/-private/coerce-id.d.ts +5 -0
  32. package/declarations/graph/-private/coerce-id.d.ts.map +1 -0
  33. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts +7 -0
  34. package/declarations/graph/-private/debug/assert-polymorphic-type.d.ts.map +1 -0
  35. package/declarations/graph/-private/edges/collection.d.ts +40 -0
  36. package/declarations/graph/-private/edges/collection.d.ts.map +1 -0
  37. package/declarations/graph/-private/edges/implicit.d.ts +14 -0
  38. package/declarations/graph/-private/edges/implicit.d.ts.map +1 -0
  39. package/declarations/graph/-private/edges/resource.d.ts +25 -0
  40. package/declarations/graph/-private/edges/resource.d.ts.map +1 -0
  41. package/declarations/graph/-private/graph.d.ts +55 -0
  42. package/declarations/graph/-private/graph.d.ts.map +1 -0
  43. package/declarations/graph/-private/normalize-link.d.ts +3 -0
  44. package/declarations/graph/-private/normalize-link.d.ts.map +1 -0
  45. package/declarations/graph/-private/operations/add-to-related-records.d.ts +5 -0
  46. package/declarations/graph/-private/operations/add-to-related-records.d.ts.map +1 -0
  47. package/declarations/graph/-private/operations/merge-identifier.d.ts +4 -0
  48. package/declarations/graph/-private/operations/merge-identifier.d.ts.map +1 -0
  49. package/declarations/graph/-private/operations/remove-from-related-records.d.ts +5 -0
  50. package/declarations/graph/-private/operations/remove-from-related-records.d.ts.map +1 -0
  51. package/declarations/graph/-private/operations/replace-related-record.d.ts +4 -0
  52. package/declarations/graph/-private/operations/replace-related-record.d.ts.map +1 -0
  53. package/declarations/graph/-private/operations/replace-related-records.d.ts +8 -0
  54. package/declarations/graph/-private/operations/replace-related-records.d.ts.map +1 -0
  55. package/declarations/graph/-private/operations/update-relationship.d.ts +11 -0
  56. package/declarations/graph/-private/operations/update-relationship.d.ts.map +1 -0
  57. package/declarations/graph/-private.d.ts +14 -0
  58. package/declarations/graph/-private.d.ts.map +1 -0
  59. package/declarations/index.d.ts +15 -0
  60. package/declarations/index.d.ts.map +1 -0
  61. package/declarations/reactive/-private/document.d.ts +147 -0
  62. package/declarations/reactive/-private/document.d.ts.map +1 -0
  63. package/declarations/reactive/-private/fields/compute.d.ts +40 -0
  64. package/declarations/reactive/-private/fields/compute.d.ts.map +1 -0
  65. package/declarations/reactive/-private/fields/managed-array.d.ts +23 -0
  66. package/declarations/reactive/-private/fields/managed-array.d.ts.map +1 -0
  67. package/declarations/reactive/-private/fields/managed-object.d.ts +21 -0
  68. package/declarations/reactive/-private/fields/managed-object.d.ts.map +1 -0
  69. package/declarations/reactive/-private/fields/many-array-manager.d.ts +20 -0
  70. package/declarations/reactive/-private/fields/many-array-manager.d.ts.map +1 -0
  71. package/declarations/reactive/-private/hooks.d.ts +6 -0
  72. package/declarations/reactive/-private/hooks.d.ts.map +1 -0
  73. package/declarations/reactive/-private/record.d.ts +61 -0
  74. package/declarations/reactive/-private/record.d.ts.map +1 -0
  75. package/declarations/reactive/-private/schema.d.ts +180 -0
  76. package/declarations/reactive/-private/schema.d.ts.map +1 -0
  77. package/declarations/reactive/-private/symbols.d.ts +11 -0
  78. package/declarations/reactive/-private/symbols.d.ts.map +1 -0
  79. package/declarations/reactive/-private.d.ts +2 -0
  80. package/declarations/reactive/-private.d.ts.map +1 -0
  81. package/declarations/reactive.d.ts +5 -0
  82. package/declarations/reactive.d.ts.map +1 -0
  83. package/declarations/request/-private/context.d.ts +42 -0
  84. package/declarations/request/-private/context.d.ts.map +1 -0
  85. package/declarations/request/-private/debug.d.ts +5 -0
  86. package/declarations/request/-private/debug.d.ts.map +1 -0
  87. package/declarations/request/-private/fetch.d.ts +40 -0
  88. package/declarations/request/-private/fetch.d.ts.map +1 -0
  89. package/declarations/request/-private/future.d.ts +8 -0
  90. package/declarations/request/-private/future.d.ts.map +1 -0
  91. package/declarations/request/-private/manager.d.ts +160 -0
  92. package/declarations/request/-private/manager.d.ts.map +1 -0
  93. package/declarations/request/-private/promise-cache.d.ts +20 -0
  94. package/declarations/request/-private/promise-cache.d.ts.map +1 -0
  95. package/declarations/request/-private/types.d.ts +236 -0
  96. package/declarations/request/-private/types.d.ts.map +1 -0
  97. package/declarations/request/-private/utils.d.ts +16 -0
  98. package/declarations/request/-private/utils.d.ts.map +1 -0
  99. package/declarations/request.d.ts +6 -0
  100. package/declarations/request.d.ts.map +1 -0
  101. package/declarations/store/-private/cache-handler/handler.d.ts +57 -0
  102. package/declarations/store/-private/cache-handler/handler.d.ts.map +1 -0
  103. package/declarations/store/-private/cache-handler/types.d.ts +99 -0
  104. package/declarations/store/-private/cache-handler/types.d.ts.map +1 -0
  105. package/declarations/store/-private/cache-handler/utils.d.ts +32 -0
  106. package/declarations/store/-private/cache-handler/utils.d.ts.map +1 -0
  107. package/declarations/store/-private/caches/cache-utils.d.ts +9 -0
  108. package/declarations/store/-private/caches/cache-utils.d.ts.map +1 -0
  109. package/declarations/store/-private/caches/identifier-cache.d.ts +316 -0
  110. package/declarations/store/-private/caches/identifier-cache.d.ts.map +1 -0
  111. package/declarations/store/-private/caches/instance-cache.d.ts +65 -0
  112. package/declarations/store/-private/caches/instance-cache.d.ts.map +1 -0
  113. package/declarations/store/-private/caches/resource-utils.d.ts +10 -0
  114. package/declarations/store/-private/caches/resource-utils.d.ts.map +1 -0
  115. package/declarations/store/-private/debug/utils.d.ts +7 -0
  116. package/declarations/store/-private/debug/utils.d.ts.map +1 -0
  117. package/declarations/store/-private/default-cache-policy.d.ts +383 -0
  118. package/declarations/store/-private/default-cache-policy.d.ts.map +1 -0
  119. package/declarations/store/-private/legacy-model-support/record-reference.d.ts +164 -0
  120. package/declarations/store/-private/legacy-model-support/record-reference.d.ts.map +1 -0
  121. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts +17 -0
  122. package/declarations/store/-private/legacy-model-support/shim-model-class.d.ts.map +1 -0
  123. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts +26 -0
  124. package/declarations/store/-private/managers/cache-capabilities-manager.d.ts.map +1 -0
  125. package/declarations/store/-private/managers/cache-manager.d.ts +428 -0
  126. package/declarations/store/-private/managers/cache-manager.d.ts.map +1 -0
  127. package/declarations/store/-private/managers/notification-manager.d.ts +93 -0
  128. package/declarations/store/-private/managers/notification-manager.d.ts.map +1 -0
  129. package/declarations/store/-private/managers/record-array-manager.d.ts +98 -0
  130. package/declarations/store/-private/managers/record-array-manager.d.ts.map +1 -0
  131. package/declarations/store/-private/network/request-cache.d.ts +104 -0
  132. package/declarations/store/-private/network/request-cache.d.ts.map +1 -0
  133. package/declarations/store/-private/new-core-tmp/promise-state.d.ts +255 -0
  134. package/declarations/store/-private/new-core-tmp/promise-state.d.ts.map +1 -0
  135. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts +93 -0
  136. package/declarations/store/-private/new-core-tmp/reactivity/configure.d.ts.map +1 -0
  137. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts +170 -0
  138. package/declarations/store/-private/new-core-tmp/reactivity/internal.d.ts.map +1 -0
  139. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts +30 -0
  140. package/declarations/store/-private/new-core-tmp/reactivity/signal.d.ts.map +1 -0
  141. package/declarations/store/-private/new-core-tmp/request-state.d.ts +255 -0
  142. package/declarations/store/-private/new-core-tmp/request-state.d.ts.map +1 -0
  143. package/declarations/store/-private/record-arrays/identifier-array.d.ts +141 -0
  144. package/declarations/store/-private/record-arrays/identifier-array.d.ts.map +1 -0
  145. package/declarations/store/-private/record-arrays/many-array.d.ts +199 -0
  146. package/declarations/store/-private/record-arrays/many-array.d.ts.map +1 -0
  147. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts +116 -0
  148. package/declarations/store/-private/record-arrays/native-proxy-type-fix.d.ts.map +1 -0
  149. package/declarations/store/-private/store-service.d.ts +1597 -0
  150. package/declarations/store/-private/store-service.d.ts.map +1 -0
  151. package/declarations/store/-private/store-service.type-test.d.ts +2 -0
  152. package/declarations/store/-private/store-service.type-test.d.ts.map +1 -0
  153. package/declarations/store/-private/utils/coerce-id.d.ts +5 -0
  154. package/declarations/store/-private/utils/coerce-id.d.ts.map +1 -0
  155. package/declarations/store/-private/utils/construct-resource.d.ts +7 -0
  156. package/declarations/store/-private/utils/construct-resource.d.ts.map +1 -0
  157. package/declarations/store/-private/utils/is-non-empty-string.d.ts +2 -0
  158. package/declarations/store/-private/utils/is-non-empty-string.d.ts.map +1 -0
  159. package/declarations/store/-private/utils/normalize-model-name.d.ts +2 -0
  160. package/declarations/store/-private/utils/normalize-model-name.d.ts.map +1 -0
  161. package/declarations/store/-private/utils/uuid-polyfill.d.ts +2 -0
  162. package/declarations/store/-private/utils/uuid-polyfill.d.ts.map +1 -0
  163. package/declarations/store/-private.d.ts +27 -0
  164. package/declarations/store/-private.d.ts.map +1 -0
  165. package/declarations/store/-types/q/cache-capabilities-manager.d.ts +100 -0
  166. package/declarations/store/-types/q/cache-capabilities-manager.d.ts.map +1 -0
  167. package/declarations/store/-types/q/ds-model.d.ts +22 -0
  168. package/declarations/store/-types/q/ds-model.d.ts.map +1 -0
  169. package/declarations/store/-types/q/identifier.d.ts +21 -0
  170. package/declarations/store/-types/q/identifier.d.ts.map +1 -0
  171. package/declarations/store/-types/q/promise-proxies.d.ts +2 -0
  172. package/declarations/store/-types/q/promise-proxies.d.ts.map +1 -0
  173. package/declarations/store/-types/q/record-data-json-api.d.ts +31 -0
  174. package/declarations/store/-types/q/record-data-json-api.d.ts.map +1 -0
  175. package/declarations/store/-types/q/record-instance.d.ts +24 -0
  176. package/declarations/store/-types/q/record-instance.d.ts.map +1 -0
  177. package/declarations/store/-types/q/schema-service.d.ts +331 -0
  178. package/declarations/store/-types/q/schema-service.d.ts.map +1 -0
  179. package/declarations/store/-types/q/store.d.ts +35 -0
  180. package/declarations/store/-types/q/store.d.ts.map +1 -0
  181. package/declarations/store.d.ts +2 -0
  182. package/declarations/store.d.ts.map +1 -0
  183. package/declarations/types/-private.d.ts +14 -0
  184. package/declarations/types/-private.d.ts.map +1 -0
  185. package/declarations/types/cache/aliases.d.ts +2 -0
  186. package/declarations/types/cache/aliases.d.ts.map +1 -0
  187. package/declarations/types/cache/change.d.ts +7 -0
  188. package/declarations/types/cache/change.d.ts.map +1 -0
  189. package/declarations/types/cache/mutations.d.ts +39 -0
  190. package/declarations/types/cache/mutations.d.ts.map +1 -0
  191. package/declarations/types/cache/operations.d.ts +72 -0
  192. package/declarations/types/cache/operations.d.ts.map +1 -0
  193. package/declarations/types/cache/relationship.d.ts +14 -0
  194. package/declarations/types/cache/relationship.d.ts.map +1 -0
  195. package/declarations/types/cache.d.ts +492 -0
  196. package/declarations/types/cache.d.ts.map +1 -0
  197. package/declarations/types/graph.d.ts +48 -0
  198. package/declarations/types/graph.d.ts.map +1 -0
  199. package/declarations/types/identifier.d.ts +111 -0
  200. package/declarations/types/identifier.d.ts.map +1 -0
  201. package/declarations/types/json/raw.d.ts +7 -0
  202. package/declarations/types/json/raw.d.ts.map +1 -0
  203. package/declarations/types/params.d.ts +10 -0
  204. package/declarations/types/params.d.ts.map +1 -0
  205. package/declarations/types/record.d.ts +96 -0
  206. package/declarations/types/record.d.ts.map +1 -0
  207. package/declarations/types/record.type-test.d.ts +2 -0
  208. package/declarations/types/record.type-test.d.ts.map +1 -0
  209. package/declarations/types/request.d.ts +308 -0
  210. package/declarations/types/request.d.ts.map +1 -0
  211. package/declarations/types/request.type-test.d.ts +2 -0
  212. package/declarations/types/request.type-test.d.ts.map +1 -0
  213. package/declarations/types/runtime.d.ts +15 -0
  214. package/declarations/types/runtime.d.ts.map +1 -0
  215. package/declarations/types/schema/concepts.d.ts +17 -0
  216. package/declarations/types/schema/concepts.d.ts.map +1 -0
  217. package/declarations/types/schema/fields.d.ts +1674 -0
  218. package/declarations/types/schema/fields.d.ts.map +1 -0
  219. package/declarations/types/schema/fields.type-test.d.ts +2 -0
  220. package/declarations/types/schema/fields.type-test.d.ts.map +1 -0
  221. package/declarations/types/spec/document.d.ts +31 -0
  222. package/declarations/types/spec/document.d.ts.map +1 -0
  223. package/declarations/types/spec/error.d.ts +19 -0
  224. package/declarations/types/spec/error.d.ts.map +1 -0
  225. package/declarations/types/spec/json-api-raw.d.ts +142 -0
  226. package/declarations/types/spec/json-api-raw.d.ts.map +1 -0
  227. package/declarations/types/symbols.d.ts +79 -0
  228. package/declarations/types/symbols.d.ts.map +1 -0
  229. package/declarations/types/utils.d.ts +5 -0
  230. package/declarations/types/utils.d.ts.map +1 -0
  231. package/declarations/types.d.ts +12 -0
  232. package/declarations/types.d.ts.map +1 -0
  233. package/declarations/utils/string.d.ts +45 -0
  234. package/declarations/utils/string.d.ts.map +1 -0
  235. package/dist/build-config/babel-macros.js +1 -0
  236. package/dist/build-config/babel-macros.js.map +1 -0
  237. package/dist/build-config/canary-features.js +1 -0
  238. package/dist/build-config/canary-features.js.map +1 -0
  239. package/dist/build-config/debugging.js +1 -0
  240. package/dist/build-config/debugging.js.map +1 -0
  241. package/dist/build-config/deprecations.js +1 -0
  242. package/dist/build-config/deprecations.js.map +1 -0
  243. package/dist/build-config/env.js +1 -0
  244. package/dist/build-config/env.js.map +1 -0
  245. package/dist/build-config/macros.js +1 -0
  246. package/dist/build-config/macros.js.map +1 -0
  247. package/dist/build-config.js +1 -0
  248. package/dist/build-config.js.map +1 -0
  249. package/dist/configure-Bz49BEZQ.js +145 -0
  250. package/dist/configure-Bz49BEZQ.js.map +1 -0
  251. package/dist/configure.js +1 -0
  252. package/dist/configure.js.map +1 -0
  253. package/dist/context-DE5sFezZ.js +636 -0
  254. package/dist/context-DE5sFezZ.js.map +1 -0
  255. package/dist/graph/-private.js +3364 -0
  256. package/dist/graph/-private.js.map +1 -0
  257. package/dist/handler-DYUefHNU.js +339 -0
  258. package/dist/handler-DYUefHNU.js.map +1 -0
  259. package/dist/index.js +382 -0
  260. package/dist/index.js.map +1 -0
  261. package/dist/reactive/-private.js +1 -0
  262. package/dist/reactive/-private.js.map +1 -0
  263. package/dist/reactive.js +1802 -0
  264. package/dist/reactive.js.map +1 -0
  265. package/dist/request-state-Bv5CY_H0.js +7358 -0
  266. package/dist/request-state-Bv5CY_H0.js.map +1 -0
  267. package/dist/request.js +1 -0
  268. package/dist/request.js.map +1 -0
  269. package/dist/store/-private.js +3 -0
  270. package/dist/store/-private.js.map +1 -0
  271. package/dist/store.js +545 -0
  272. package/dist/store.js.map +1 -0
  273. package/dist/symbols-DyqeYQTe.js +44 -0
  274. package/dist/symbols-DyqeYQTe.js.map +1 -0
  275. package/dist/types/-private.js +79 -0
  276. package/dist/types/-private.js.map +1 -0
  277. package/dist/types/cache/aliases.js +0 -0
  278. package/dist/types/cache/aliases.js.map +1 -0
  279. package/dist/types/cache/change.js +0 -0
  280. package/dist/types/cache/change.js.map +1 -0
  281. package/dist/types/cache/mutations.js +0 -0
  282. package/dist/types/cache/mutations.js.map +1 -0
  283. package/dist/types/cache/operations.js +0 -0
  284. package/dist/types/cache/operations.js.map +1 -0
  285. package/dist/types/cache/relationship.js +0 -0
  286. package/dist/types/cache/relationship.js.map +1 -0
  287. package/dist/types/cache.js +0 -0
  288. package/dist/types/cache.js.map +1 -0
  289. package/dist/types/graph.js +0 -0
  290. package/dist/types/graph.js.map +1 -0
  291. package/dist/types/identifier.js +89 -0
  292. package/dist/types/identifier.js.map +1 -0
  293. package/dist/types/json/raw.js +0 -0
  294. package/dist/types/json/raw.js.map +1 -0
  295. package/dist/types/params.js +0 -0
  296. package/dist/types/params.js.map +1 -0
  297. package/dist/types/record.js +64 -0
  298. package/dist/types/record.js.map +1 -0
  299. package/dist/types/request.js +33 -0
  300. package/dist/types/request.js.map +1 -0
  301. package/dist/types/runtime.js +34 -0
  302. package/dist/types/runtime.js.map +1 -0
  303. package/dist/types/schema/concepts.js +0 -0
  304. package/dist/types/schema/concepts.js.map +1 -0
  305. package/dist/types/schema/fields.js +470 -0
  306. package/dist/types/schema/fields.js.map +1 -0
  307. package/dist/types/schema/fields.type-test.js +0 -0
  308. package/dist/types/schema/fields.type-test.js.map +1 -0
  309. package/dist/types/spec/document.js +0 -0
  310. package/dist/types/spec/document.js.map +1 -0
  311. package/dist/types/spec/error.js +0 -0
  312. package/dist/types/spec/error.js.map +1 -0
  313. package/dist/types/spec/json-api-raw.js +0 -0
  314. package/dist/types/spec/json-api-raw.js.map +1 -0
  315. package/dist/types/symbols.js +84 -0
  316. package/dist/types/symbols.js.map +1 -0
  317. package/dist/types/utils.js +0 -0
  318. package/dist/types/utils.js.map +1 -0
  319. package/dist/types.js +0 -0
  320. package/dist/types.js.map +1 -0
  321. package/dist/utils/string.js +92 -0
  322. package/dist/utils/string.js.map +1 -0
  323. package/logos/NCC-1701-a-blue.svg +4 -0
  324. package/logos/NCC-1701-a-gold.svg +4 -0
  325. package/logos/NCC-1701-a-gold_100.svg +1 -0
  326. package/logos/NCC-1701-a-gold_base-64.txt +1 -0
  327. package/logos/NCC-1701-a.svg +4 -0
  328. package/logos/README.md +4 -0
  329. package/logos/docs-badge.svg +2 -0
  330. package/logos/ember-data-logo-dark.svg +12 -0
  331. package/logos/ember-data-logo-light.svg +12 -0
  332. package/logos/github-header.svg +444 -0
  333. package/logos/social1.png +0 -0
  334. package/logos/social2.png +0 -0
  335. package/logos/warp-drive-logo-dark.svg +4 -0
  336. package/logos/warp-drive-logo-gold.svg +4 -0
  337. package/package.json +70 -0
@@ -0,0 +1,255 @@
1
+ import type { Future } from '../../../request.ts';
2
+ import type { ImmutableRequestInfo, ResponseInfo, StructuredErrorDocument } from '../../../types/request.ts';
3
+ import type { PendingPromise, RejectedPromise, ResolvedPromise } from './promise-state.ts';
4
+ /**
5
+ * Lazily consumes the stream of a request, providing a number of
6
+ * reactive properties that can be used to build UIs that respond
7
+ * to the progress of a request.
8
+ *
9
+ */
10
+ export declare class RequestLoadingState {
11
+ _sizeHint: number;
12
+ _bytesLoaded: number;
13
+ _startTime: number;
14
+ _endTime: number;
15
+ _lastPacketTime: number;
16
+ _isPending: boolean;
17
+ _isStarted: boolean;
18
+ _isComplete: boolean;
19
+ _isCancelled: boolean;
20
+ _isErrored: boolean;
21
+ _error: Error | null;
22
+ _stream: TransformStream | null;
23
+ _future: Future<unknown>;
24
+ _triggered: boolean;
25
+ _trigger(): void;
26
+ promise: Promise<void> | null;
27
+ get isPending(): boolean;
28
+ get sizeHint(): number;
29
+ get stream(): ReadableStream | null;
30
+ get isStarted(): boolean;
31
+ get bytesLoaded(): number;
32
+ get startTime(): number;
33
+ get endTime(): number;
34
+ get lastPacketTime(): number;
35
+ get isComplete(): boolean;
36
+ get isCancelled(): boolean;
37
+ get isErrored(): boolean;
38
+ get error(): Error | null;
39
+ get elapsedTime(): number;
40
+ get completedRatio(): number;
41
+ get remainingRatio(): number;
42
+ get duration(): number;
43
+ get speed(): number;
44
+ constructor(future: Future<unknown>);
45
+ abort: () => void;
46
+ }
47
+ /**
48
+ * The state of a request in the "pending"
49
+ * state. This is the default initial state.
50
+ *
51
+ * Extends the {@link PendingPromise} interface.
52
+ *
53
+ */
54
+ export interface PendingRequest extends PendingPromise {
55
+ /**
56
+ * Whether the request is cancelled.
57
+ *
58
+ */
59
+ isCancelled: false;
60
+ loadingState: RequestLoadingState;
61
+ request: null;
62
+ response: null;
63
+ }
64
+ /**
65
+ * The state of a request in the "fulfilled" state.
66
+ * This is the state of a request that has resolved
67
+ * successfully.
68
+ *
69
+ * Extends the {@link ResolvedPromise} interface.
70
+ *
71
+ */
72
+ export interface ResolvedRequest<RT, T> extends ResolvedPromise<RT> {
73
+ /**
74
+ * Whether the request is cancelled.
75
+ *
76
+ */
77
+ isCancelled: false;
78
+ loadingState: RequestLoadingState;
79
+ request: ImmutableRequestInfo<RT, T> | null;
80
+ response: Response | ResponseInfo | null;
81
+ }
82
+ /**
83
+ * The state of a request in the "rejected" state.
84
+ * This is the state of a request that has rejected
85
+ * with an error.
86
+ *
87
+ * Extends the {@link RejectedPromise} interface.
88
+ *
89
+ */
90
+ export interface RejectedRequest<RT, T, E extends StructuredErrorDocument = StructuredErrorDocument> extends RejectedPromise<E> {
91
+ /**
92
+ * Whether the request is cancelled.
93
+ *
94
+ */
95
+ isCancelled: false;
96
+ loadingState: RequestLoadingState;
97
+ request: ImmutableRequestInfo<RT, T> | null;
98
+ response: Response | ResponseInfo | null;
99
+ }
100
+ /**
101
+ * The state of a request in the "cancelled" state.
102
+ * This is the state of a promise that has been
103
+ * cancelled.
104
+ *
105
+ */
106
+ export interface CancelledRequest<RT, T, E extends StructuredErrorDocument = StructuredErrorDocument> {
107
+ /**
108
+ * The status of the request.
109
+ *
110
+ */
111
+ status: 'cancelled';
112
+ /**
113
+ * Whether the request is pending.
114
+ *
115
+ */
116
+ isPending: false;
117
+ /**
118
+ * Whether the request is pending.
119
+ *
120
+ */
121
+ isLoading: false;
122
+ /**
123
+ * Whether the request has resolved
124
+ * successfully.
125
+ *
126
+ */
127
+ isSuccess: false;
128
+ /**
129
+ * Whether the request has rejected
130
+ * with an error.
131
+ *
132
+ */
133
+ isError: true;
134
+ /**
135
+ * Once the request has resolved, this will
136
+ * be the value the request resolved to.
137
+ *
138
+ */
139
+ value: null;
140
+ /**
141
+ * Once the request has resolved, this will
142
+ * be the value the request resolved to.
143
+ *
144
+ * @deprecated use `value` instead
145
+ */
146
+ result: null;
147
+ /**
148
+ * Once the request has rejected, this will
149
+ * be the error the request rejected with.
150
+ *
151
+ *
152
+ * @deprecated use `reason` instead
153
+ */
154
+ error: E;
155
+ /**
156
+ * Once the request has rejected, this will
157
+ * be the error the request rejected with.
158
+ *
159
+ */
160
+ reason: E;
161
+ /**
162
+ * Whether the request is cancelled.
163
+ *
164
+ */
165
+ isCancelled: true;
166
+ loadingState: RequestLoadingState;
167
+ request: ImmutableRequestInfo<RT, T> | null;
168
+ response: Response | ResponseInfo | null;
169
+ }
170
+ /**
171
+ * RequestState extends the concept of PromiseState to provide a reactive
172
+ * wrapper for a request `Future` which allows you write declarative code
173
+ * around a Future's control flow.
174
+ *
175
+ * It is useful in both Template and JavaScript contexts, allowing you
176
+ * to quickly derive behaviors and data from pending, error and success
177
+ * states.
178
+ *
179
+ * The key difference between a Promise and a Future is that Futures provide
180
+ * access to a stream of their content, the identity of the request (if any)
181
+ * as well as the ability to attempt to abort the request.
182
+ *
183
+ * ```ts
184
+ * interface Future<T> extends Promise<T>> {
185
+ * getStream(): Promise<ReadableStream>;
186
+ * abort(): void;
187
+ * lid: StableDocumentIdentifier | null;
188
+ * }
189
+ * ```
190
+ *
191
+ * These additional APIs allow us to craft even richer state experiences.
192
+ *
193
+ * To get the state of a request, use `getRequestState`.
194
+ *
195
+ * See also:
196
+ * - {@link PendingRequest}
197
+ * - {@link ResolvedRequest}
198
+ * - {@link RejectedRequest}
199
+ * - {@link CancelledRequest}
200
+ *
201
+ */
202
+ export type RequestCacheRequestState<RT = unknown, T = unknown, E extends StructuredErrorDocument = StructuredErrorDocument> = PendingRequest | ResolvedRequest<RT, T> | RejectedRequest<RT, T, E> | CancelledRequest<RT, T, E>;
203
+ export declare function createRequestState<RT, T, E>(future: Future<RT>): Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>>;
204
+ /**
205
+ * `getRequestState` can be used in both JavaScript and Template contexts.
206
+ *
207
+ * ```ts
208
+ * import { getRequestState } from '@warp-drive/ember';
209
+ *
210
+ * const state = getRequestState(future);
211
+ * ```
212
+ *
213
+ * For instance, we could write a getter on a component that updates whenever
214
+ * the request state advances or the future changes, by combining the function
215
+ * with the use of `@cached`
216
+ *
217
+ * ```ts
218
+ * class Component {
219
+ * @cached
220
+ * get title() {
221
+ * const state = getRequestState(this.args.request);
222
+ * if (state.isPending) {
223
+ * return 'loading...';
224
+ * }
225
+ * if (state.isError) { return null; }
226
+ * return state.result.title;
227
+ * }
228
+ * }
229
+ * ```
230
+ *
231
+ * Or in a template as a helper:
232
+ *
233
+ * ```gjs
234
+ * import { getRequestState } from '@warp-drive/ember';
235
+ *
236
+ * <template>
237
+ * {{#let (getRequestState @request) as |state|}}
238
+ * {{#if state.isPending}}
239
+ * <Spinner />
240
+ * {{else if state.isError}}
241
+ * <ErrorForm @error={{state.error}} />
242
+ * {{else}}
243
+ * <h1>{{state.result.title}}</h1>
244
+ * {{/if}}
245
+ * {{/let}}
246
+ * </template>
247
+ * ```
248
+ *
249
+ * If looking to use in a template, consider also the `<Request />` component
250
+ * which offers a numbe of additional capabilities for requests *beyond* what
251
+ * `RequestState` provides.
252
+ *
253
+ */
254
+ export declare function getRequestState<RT, T, E>(future: Future<RT>): Readonly<RequestCacheRequestState<RT, T, StructuredErrorDocument<E>>>;
255
+ //# sourceMappingURL=request-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-state.d.ts","sourceRoot":"","sources":["../../../../src/store/-private/new-core-tmp/request-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAa,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7D,OAAO,KAAK,EACV,oBAAoB,EACpB,YAAY,EAEZ,uBAAuB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAiE3F;;;;;GAKG;AACH,qBAAa,mBAAmB;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,UAAU,EAAE,OAAO,CAAC;IACpB,MAAM,EAAE,KAAK,GAAG,IAAI,CAAC;IAE7B,OAAO,EAAE,eAAe,GAAG,IAAI,CAAQ;IACvC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACzB,UAAU,UAAS;IACnB,QAAQ;IAgCR,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAQ;IAErC,IAAI,SAAS,IAAI,OAAO,CAGvB;IAED,IAAI,QAAQ,IAAI,MAAM,CAGrB;IAED,IAAI,MAAM,IAAI,cAAc,GAAG,IAAI,CASlC;IAED,IAAI,SAAS,IAAI,OAAO,CAGvB;IAED,IAAI,WAAW,IAAI,MAAM,CAGxB;IAED,IAAI,SAAS,IAAI,MAAM,CAGtB;IAED,IAAI,OAAO,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C,EACzC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GACjB,QAAQ,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CAwDvE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EACtC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC,GACjB,QAAQ,CAAC,wBAAwB,CAAC,EAAE,EAAE,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC,CAAC,CASvE"}
@@ -0,0 +1,141 @@
1
+ import type { BaseFinderOptions } from '../../../types';
2
+ import type { LocalRelationshipOperation } from '../../../types/graph.ts';
3
+ import type { StableDocumentIdentifier, StableRecordIdentifier } from '../../../types/identifier.ts';
4
+ import type { TypeFromInstanceOrString } from '../../../types/record.ts';
5
+ import type { ImmutableRequestInfo } from '../../../types/request.ts';
6
+ import type { Links, PaginationLinks } from '../../../types/spec/json-api-raw.ts';
7
+ import type { RecordArrayManager } from '../managers/record-array-manager.ts';
8
+ import type { WarpDriveSignal } from '../new-core-tmp/reactivity/internal.ts';
9
+ import { ARRAY_SIGNAL } from '../new-core-tmp/reactivity/internal.ts';
10
+ import type { Store } from '../store-service.ts';
11
+ import { NativeProxy } from './native-proxy-type-fix.ts';
12
+ export declare const SOURCE: "___(unique) Symbol(#source)";
13
+ export declare const MUTATE: "___(unique) Symbol(#update)";
14
+ declare const IS_COLLECTION: "___(unique) Symbol(IS_COLLECTION)";
15
+ export type IdentifierArrayCreateOptions<T = unknown> = {
16
+ identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];
17
+ type?: TypeFromInstanceOrString<T>;
18
+ store: Store;
19
+ allowMutation: boolean;
20
+ manager: MinimumManager;
21
+ links?: Links | PaginationLinks | null;
22
+ meta?: Record<string, unknown> | null;
23
+ identifier?: StableDocumentIdentifier | null;
24
+ };
25
+ type PromiseTo<T> = Omit<Promise<T>, typeof Symbol.toStringTag>;
26
+ type PromiseManyArray<T> = {
27
+ length: number;
28
+ content: IdentifierArray<T> | null;
29
+ promise: Promise<IdentifierArray<T>> | null;
30
+ } & PromiseTo<IdentifierArray<T>>;
31
+ export type MinimumManager = {
32
+ _syncArray: (array: IdentifierArray) => void;
33
+ mutate?(mutation: LocalRelationshipOperation): void;
34
+ reloadHasMany?<T>(key: string, options?: BaseFinderOptions): Promise<IdentifierArray<T>> | PromiseManyArray<T>;
35
+ };
36
+ /**
37
+ A record array is an array that contains records of a certain type (or modelName).
38
+ The record array materializes records as needed when they are retrieved for the first
39
+ time. You should not create record arrays yourself. Instead, an instance of
40
+ `RecordArray` or its subclasses will be returned by your application's store
41
+ in response to queries.
42
+
43
+ This class should not be imported and instantiated by consuming applications.
44
+
45
+ @class RecordArray
46
+ @public
47
+ */
48
+ export interface IdentifierArray<T = unknown> extends Omit<Array<T>, '[]'> {
49
+ [MUTATE]?(target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal): unknown;
50
+ }
51
+ export declare class IdentifierArray<T = unknown> {
52
+ DEPRECATED_CLASS_NAME: string;
53
+ /**
54
+ The flag to signal a `RecordArray` is currently loading data.
55
+ Example
56
+ ```javascript
57
+ let people = store.peekAll('person');
58
+ people.isUpdating; // false
59
+ people.update();
60
+ people.isUpdating; // true
61
+ ```
62
+ @property isUpdating
63
+ @public
64
+ @type Boolean
65
+ */
66
+ isUpdating: boolean;
67
+ isLoaded: boolean;
68
+ isDestroying: boolean;
69
+ isDestroyed: boolean;
70
+ _updatingPromise: Promise<IdentifierArray<T>> | null;
71
+ readonly identifier: StableDocumentIdentifier | null;
72
+ [IS_COLLECTION]: boolean;
73
+ [ARRAY_SIGNAL]: WarpDriveSignal;
74
+ [SOURCE]: StableRecordIdentifier[];
75
+ links: Links | PaginationLinks | null;
76
+ meta: Record<string, unknown> | null;
77
+ modelName?: TypeFromInstanceOrString<T>;
78
+ /**
79
+ The store that created this record array.
80
+
81
+ @property store
82
+ @private
83
+ @type Store
84
+ */
85
+ store: Store;
86
+ _manager: MinimumManager;
87
+ destroy(clear: boolean): void;
88
+ constructor(options: IdentifierArrayCreateOptions<T>);
89
+ /**
90
+ Used to get the latest version of all of the records in this array
91
+ from the adapter.
92
+
93
+ Example
94
+
95
+ ```javascript
96
+ let people = store.peekAll('person');
97
+ people.isUpdating; // false
98
+
99
+ people.update().then(function() {
100
+ people.isUpdating; // false
101
+ });
102
+
103
+ people.isUpdating; // true
104
+ ```
105
+
106
+ @public
107
+ */
108
+ update(): Promise<IdentifierArray<T>>;
109
+ _update(): Promise<IdentifierArray<T>>;
110
+ /**
111
+ Saves all of the records in the `RecordArray`.
112
+
113
+ Example
114
+
115
+ ```javascript
116
+ let messages = store.peekAll('message');
117
+ messages.forEach(function(message) {
118
+ message.hasBeenSeen = true;
119
+ });
120
+ messages.save();
121
+ ```
122
+
123
+ @public
124
+ @return {Promise<IdentifierArray>} promise
125
+ */
126
+ save(): Promise<IdentifierArray>;
127
+ }
128
+ export type CollectionCreateOptions = IdentifierArrayCreateOptions & {
129
+ manager: RecordArrayManager;
130
+ query: ImmutableRequestInfo | Record<string, unknown> | null;
131
+ isLoaded: boolean;
132
+ };
133
+ export declare class Collection<T = unknown> extends IdentifierArray<T> {
134
+ query: ImmutableRequestInfo | Record<string, unknown> | null;
135
+ _manager: RecordArrayManager;
136
+ constructor(options: CollectionCreateOptions);
137
+ _update(): Promise<Collection<T>>;
138
+ destroy(clear: boolean): void;
139
+ }
140
+ export {};
141
+ //# sourceMappingURL=identifier-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier-array.d.ts","sourceRoot":"","sources":["../../../../src/store/-private/record-arrays/identifier-array.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CA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,OAAO,CAAC,GAAG,IAAI,CAAQ;IAC5D,QAAQ,EAAE,kBAAkB,CAAC;gBAEzB,OAAO,EAAE,uBAAuB;IAM5C,OAAO,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;IAejC,OAAO,CAAC,KAAK,EAAE,OAAO;CAKvB"}
@@ -0,0 +1,199 @@
1
+ import type { BaseFinderOptions, ModelSchema, StableRecordIdentifier } from '../../../types.ts';
2
+ import type { Cache } from '../../../types/cache.ts';
3
+ import type { TypedRecordInstance, TypeFromInstance, TypeFromInstanceOrString } from '../../../types/record.ts';
4
+ import type { Links, PaginationLinks } from '../../../types/spec/json-api-raw.ts';
5
+ import { type WarpDriveSignal } from '../new-core-tmp/reactivity/internal.ts';
6
+ import type { CreateRecordProperties, Store } from '../store-service.ts';
7
+ import type { MinimumManager } from './identifier-array.ts';
8
+ import { IdentifierArray, MUTATE } from './identifier-array.ts';
9
+ import type { NativeProxy } from './native-proxy-type-fix.ts';
10
+ export interface ManyArrayCreateArgs<T> {
11
+ identifiers: StableRecordIdentifier<TypeFromInstanceOrString<T>>[];
12
+ type: TypeFromInstanceOrString<T>;
13
+ store: Store;
14
+ allowMutation: boolean;
15
+ manager: MinimumManager;
16
+ identifier: StableRecordIdentifier;
17
+ cache: Cache;
18
+ meta: Record<string, unknown> | null;
19
+ links: Links | PaginationLinks | null;
20
+ key: string;
21
+ isPolymorphic: boolean;
22
+ isAsync: boolean;
23
+ _inverseIsAsync: boolean;
24
+ isLoaded: boolean;
25
+ }
26
+ /**
27
+ A `ManyArray` is a `MutableArray` that represents the contents of a has-many
28
+ relationship.
29
+
30
+ The `ManyArray` is instantiated lazily the first time the relationship is
31
+ requested.
32
+
33
+ This class is not intended to be directly instantiated by consuming applications.
34
+
35
+ ### Inverses
36
+
37
+ Often, the relationships in Ember Data applications will have
38
+ an inverse. For example, imagine the following models are
39
+ defined:
40
+
41
+ ```js [app/models/post.js]
42
+ import Model, { hasMany } from '@ember-data/model';
43
+
44
+ export default class PostModel extends Model {
45
+ @hasMany('comment') comments;
46
+ }
47
+ ```
48
+
49
+ ```js [app/models/comment.js]
50
+ import { Model, belongsTo } from '@warp-drive/legacy/model';
51
+
52
+ export default class CommentModel extends Model {
53
+ @belongsTo('post') post;
54
+ }
55
+ ```
56
+
57
+ If you created a new instance of `Post` and added
58
+ a `Comment` record to its `comments` has-many
59
+ relationship, you would expect the comment's `post`
60
+ property to be set to the post that contained
61
+ the has-many.
62
+
63
+ We call the record to which a relationship belongs-to the
64
+ relationship's _owner_.
65
+
66
+ @class ManyArray
67
+ @public
68
+ */
69
+ export declare class RelatedCollection<T = unknown> extends IdentifierArray<T> {
70
+ isAsync: boolean;
71
+ /**
72
+ The loading state of this array
73
+
74
+ @property isLoaded
75
+ @type {Boolean}
76
+ @public
77
+ */
78
+ isLoaded: boolean;
79
+ /**
80
+ `true` if the relationship is polymorphic, `false` otherwise.
81
+
82
+ @property isPolymorphic
83
+ @type {Boolean}
84
+ @private
85
+ */
86
+ isPolymorphic: boolean;
87
+ _inverseIsAsync: boolean;
88
+ /**
89
+ Metadata associated with the request for async hasMany relationships.
90
+
91
+ Example
92
+
93
+ Given that the server returns the following JSON payload when fetching a
94
+ hasMany relationship:
95
+
96
+ ```js
97
+ {
98
+ "comments": [{
99
+ "id": 1,
100
+ "comment": "This is the first comment",
101
+ }, {
102
+ // ...
103
+ }],
104
+
105
+ "meta": {
106
+ "page": 1,
107
+ "total": 5
108
+ }
109
+ }
110
+ ```
111
+
112
+ You can then access the meta data via the `meta` property:
113
+
114
+ ```js
115
+ let comments = await post.comments;
116
+ let meta = comments.meta;
117
+
118
+ // meta.page => 1
119
+ // meta.total => 5
120
+ ```
121
+
122
+ @property meta
123
+ @type {Object | null}
124
+ @public
125
+ */
126
+ meta: Record<string, unknown> | null;
127
+ /**
128
+ * Retrieve the links for this relationship
129
+ *
130
+ @property links
131
+ @type {Object | null}
132
+ @public
133
+ */
134
+ links: Links | PaginationLinks | null;
135
+ identifier: StableRecordIdentifier;
136
+ cache: Cache;
137
+ _manager: MinimumManager;
138
+ store: Store;
139
+ key: string;
140
+ type: ModelSchema;
141
+ modelName: T extends TypedRecordInstance ? TypeFromInstance<T> : string;
142
+ constructor(options: ManyArrayCreateArgs<T>);
143
+ [MUTATE](target: StableRecordIdentifier[], receiver: typeof NativeProxy<StableRecordIdentifier[], T[]>, prop: string, args: unknown[], _SIGNAL: WarpDriveSignal): unknown;
144
+ notify(): void;
145
+ /**
146
+ Reloads all of the records in the manyArray. If the manyArray
147
+ holds a relationship that was originally fetched using a links url
148
+ WarpDrive will revisit the original links url to repopulate the
149
+ relationship.
150
+
151
+ If the ManyArray holds the result of a `store.query()` reload will
152
+ re-run the original query.
153
+
154
+ Example
155
+
156
+ ```javascript
157
+ let user = store.peekRecord('user', '1')
158
+ await login(user);
159
+
160
+ let permissions = await user.permissions;
161
+ await permissions.reload();
162
+ ```
163
+
164
+ @public
165
+ */
166
+ reload(options?: BaseFinderOptions): Promise<this>;
167
+ /**
168
+ Create a child record within the owner
169
+
170
+ @public
171
+ @param {Object} hash
172
+ @return {Model} record
173
+ */
174
+ createRecord(hash: CreateRecordProperties<T>): T;
175
+ /**
176
+ Saves all of the records in the `ManyArray`.
177
+
178
+ Note: this API can only be used in legacy mode with a configured Adapter.
179
+
180
+ Example
181
+
182
+ ```javascript
183
+ const { content: { data: inbox } } = await store.request(findRecord({ type: 'inbox', id: '1' }));
184
+
185
+ let messages = await inbox.messages;
186
+ messages.forEach((message) => {
187
+ message.isRead = true;
188
+ });
189
+ messages.save();
190
+ ```
191
+
192
+ @public
193
+ @return {PromiseArray} promise
194
+ */
195
+ save: () => Promise<IdentifierArray<T>>;
196
+ /** @internal */
197
+ destroy(): void;
198
+ }
199
+ //# sourceMappingURL=many-array.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"many-array.d.ts","sourceRoot":"","sources":["../../../../src/store/-private/record-arrays/many-array.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA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