@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,104 @@
1
+ import type { StableRecordIdentifier } from '../../../types/identifier.ts';
2
+ import type { FindRecordOptions } from '../../-types/q/store.ts';
3
+ import type { Store } from '../store-service.ts';
4
+ declare const Touching: "___(unique) Symbol(Touching)";
5
+ export declare const RequestPromise: "___(unique) Symbol(RequestPromise)";
6
+ export interface Operation {
7
+ op: string;
8
+ options: FindRecordOptions | undefined;
9
+ recordIdentifier: StableRecordIdentifier;
10
+ }
11
+ export interface FindRecordQuery extends Operation {
12
+ op: 'findRecord';
13
+ }
14
+ export interface SaveRecordMutation extends Operation {
15
+ op: 'saveRecord';
16
+ }
17
+ export interface Request {
18
+ data: Operation[];
19
+ options?: Record<string, unknown>;
20
+ }
21
+ export type RequestStates = 'pending' | 'fulfilled' | 'rejected';
22
+ export interface RequestCacheRequestState {
23
+ state: RequestStates;
24
+ type: 'query' | 'mutation';
25
+ request: Request;
26
+ response?: Response;
27
+ }
28
+ export interface Response {
29
+ data: unknown;
30
+ }
31
+ interface InternalRequest extends RequestCacheRequestState {
32
+ [Touching]: StableRecordIdentifier[];
33
+ [RequestPromise]?: Promise<unknown>;
34
+ }
35
+ export type RequestSubscription = (requestState: RequestCacheRequestState) => void;
36
+ /**
37
+ * The RequestStateService is used to track the state of requests
38
+ * for fetching or updating known resource identifies that are inflight.
39
+ *
40
+ * @class RequestStateService
41
+ * @public
42
+ */
43
+ export declare class RequestStateService {
44
+ _pending: Map<StableRecordIdentifier, InternalRequest[]>;
45
+ _done: Map<StableRecordIdentifier, InternalRequest[]>;
46
+ _subscriptions: Map<StableRecordIdentifier, RequestSubscription[]>;
47
+ _toFlush: InternalRequest[];
48
+ _store: Store;
49
+ constructor(store: Store);
50
+ _clearEntries(identifier: StableRecordIdentifier): void;
51
+ _enqueue<T>(promise: Promise<T>, queryRequest: Request): Promise<T>;
52
+ _triggerSubscriptions(req: InternalRequest): void;
53
+ _flush(): void;
54
+ _flushRequest(req: InternalRequest): void;
55
+ _dequeue(identifier: StableRecordIdentifier, request: InternalRequest): void;
56
+ _addDone(request: InternalRequest): void;
57
+ /**
58
+ * Subscribe to requests for a given resource identity.
59
+ *
60
+ * The callback will receive the current state of the request.
61
+ *
62
+ * ```ts
63
+ * interface RequestState {
64
+ * state: 'pending' | 'fulfilled' | 'rejected';
65
+ * type: 'query' | 'mutation';
66
+ * request: Request;
67
+ * response?: { data: unknown };
68
+ * }
69
+ * ```
70
+ *
71
+ * Note: It should be considered dangerous to use this API for more than simple
72
+ * state derivation or debugging. The `request` and `response` properties are poorly
73
+ * spec'd and may change unexpectedly when shifting what Handlers are in use or how
74
+ * requests are issued from the Store.
75
+ *
76
+ * We expect to revisit this API in the near future as we continue to refine the
77
+ * RequestManager ergonomics, as a simpler but more powerful direct integration
78
+ * with the RequestManager for these purposes is likely to be a better long-term
79
+ * design.
80
+ *
81
+ * @public
82
+ * @param {StableRecordIdentifier} identifier
83
+ * @param {(state: RequestCacheRequestState) => void} callback
84
+ */
85
+ subscribeForRecord(identifier: StableRecordIdentifier, callback: RequestSubscription): void;
86
+ /**
87
+ * Retrieve all active requests for a given resource identity.
88
+ *
89
+ * @public
90
+ * @param {StableRecordIdentifier} identifier
91
+ * @return {RequestCacheRequestState[]} an array of request states for any pending requests for the given identifier
92
+ */
93
+ getPendingRequestsForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState[];
94
+ /**
95
+ * Retrieve the last completed request for a given resource identity.
96
+ *
97
+ * @public
98
+ * @param {StableRecordIdentifier} identifier
99
+ * @return {RequestCacheRequestState | null} the state of the most recent request for the given identifier
100
+ */
101
+ getLastRequestForRecord(identifier: StableRecordIdentifier): RequestCacheRequestState | null;
102
+ }
103
+ export {};
104
+ //# sourceMappingURL=request-cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-cache.d.ts","sourceRoot":"","sources":["../../../../src/store/-private/network/request-cache.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAEjD,QAAA,MAAM,QAAQ,gCAAiD,CAAC;AAChE,eAAO,MAAM,cAAc,sCAAsD,CAAC;AAGlF,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,iBAAiB,GAAG,SAAS,CAAC;IACvC,gBAAgB,EAAE,sBAAsB,CAAC;CAC1C;AAED,MAAM,WAAW,eAAgB,SAAQ,SAAS;IAChD,EAAE,EAAE,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,kBAAmB,SAAQ,SAAS;IACnD,EAAE,EAAE,YAAY,CAAC;CAClB;AAED,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,SAAS,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACnC;AAED,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,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;;;;;;;;;;;;;;;;OA2BG;IACH,kBAAkB,CAAC,UAAU,EAAE,sBAAsB,EAAE,QAAQ,EAAE,mBAAmB;IASpF;;;;;;OAMG;IACH,2BAA2B,CAAC,UAAU,EAAE,sBAAsB,GAAG,wBAAwB,EAAE;IAI3F;;;;;;OAMG;IACH,uBAAuB,CAAC,UAAU,EAAE,sBAAsB,GAAG,wBAAwB,GAAG,IAAI;CAO7F"}
@@ -0,0 +1,255 @@
1
+ import type { Awaitable } from '../../../request.ts';
2
+ /**
3
+ * The state of a promise in the "pending"
4
+ * state. This is the default initial state.
5
+ *
6
+ */
7
+ export interface PendingPromise {
8
+ /**
9
+ * The status of the promise.
10
+ *
11
+ */
12
+ status: 'pending';
13
+ /**
14
+ * Whether the promise is pending.
15
+ *
16
+ */
17
+ isPending: true;
18
+ /**
19
+ * Whether the promise is pending.
20
+ *
21
+ * @deprecated use `isPending` instead
22
+ */
23
+ isLoading: true;
24
+ /**
25
+ * Whether the promise has resolved
26
+ * successfully.
27
+ *
28
+ */
29
+ isSuccess: false;
30
+ /**
31
+ * Whether the promise has rejected
32
+ * with an error.
33
+ *
34
+ */
35
+ isError: false;
36
+ /**
37
+ * Once the promise has resolved, this will
38
+ * be the value the promise resolved to.
39
+ *
40
+ */
41
+ value: null;
42
+ /**
43
+ * Once the promise has resolved, this will
44
+ * be the value the promise resolved to.
45
+ *
46
+ * @deprecated use `value` instead
47
+ */
48
+ result: null;
49
+ /**
50
+ * Once the promise has rejected, this will
51
+ * be the error the promise rejected with.
52
+ *
53
+ *
54
+ * @deprecated use `reason` instead
55
+ */
56
+ error: null;
57
+ /**
58
+ * Once the promise has rejected, this will
59
+ * be the error the promise rejected with.
60
+ *
61
+ */
62
+ reason: null;
63
+ }
64
+ /**
65
+ * The state of a promise in the "fulfilled" state.
66
+ * This is the state of a promise that has resolved
67
+ * successfully.
68
+ *
69
+ */
70
+ export interface ResolvedPromise<T> {
71
+ /**
72
+ * The status of the promise.
73
+ *
74
+ */
75
+ status: 'fulfilled';
76
+ /**
77
+ * Whether the promise is pending.
78
+ *
79
+ */
80
+ isPending: false;
81
+ /**
82
+ * Whether the promise is pending.
83
+ *
84
+ * @deprecated use `isPending` instead
85
+ */
86
+ isLoading: false;
87
+ /**
88
+ * Whether the promise has resolved
89
+ * successfully.
90
+ *
91
+ */
92
+ isSuccess: true;
93
+ /**
94
+ * Whether the promise has rejected
95
+ * with an error.
96
+ *
97
+ */
98
+ isError: false;
99
+ /**
100
+ * Once the promise has resolved, this will
101
+ * be the value the promise resolved to.
102
+ *
103
+ */
104
+ value: T;
105
+ /**
106
+ * Once the promise has resolved, this will
107
+ * be the value the promise resolved to.
108
+ *
109
+ * @deprecated use `value` instead
110
+ */
111
+ result: T;
112
+ /**
113
+ * Once the promise has rejected, this will
114
+ * be the error the promise rejected with.
115
+ *
116
+ *
117
+ * @deprecated use `reason` instead
118
+ */
119
+ error: null;
120
+ /**
121
+ * Once the promise has rejected, this will
122
+ * be the error the promise rejected with.
123
+ *
124
+ */
125
+ reason: null;
126
+ }
127
+ /**
128
+ * The state of a promise in the "rejected" state.
129
+ * This is the state of a promise that has rejected
130
+ * with an error.
131
+ *
132
+ */
133
+ export interface RejectedPromise<E> {
134
+ /**
135
+ * The status of the promise.
136
+ *
137
+ */
138
+ status: 'rejected';
139
+ /**
140
+ * Whether the promise is pending.
141
+ *
142
+ */
143
+ isPending: false;
144
+ /**
145
+ * Whether the promise is pending.
146
+ *
147
+ * @deprecated use `isPending` instead
148
+ */
149
+ isLoading: false;
150
+ /**
151
+ * Whether the promise has resolved
152
+ * successfully.
153
+ *
154
+ */
155
+ isSuccess: false;
156
+ /**
157
+ * Whether the promise has rejected
158
+ * with an error.
159
+ *
160
+ */
161
+ isError: true;
162
+ /**
163
+ * Once the promise has resolved, this will
164
+ * be the value the promise resolved to.
165
+ *
166
+ */
167
+ value: null;
168
+ /**
169
+ * Once the promise has resolved, this will
170
+ * be the value the promise resolved to.
171
+ *
172
+ * @deprecated use `value` instead
173
+ */
174
+ result: null;
175
+ /**
176
+ * Once the promise has rejected, this will
177
+ * be the error the promise rejected with.
178
+ *
179
+ *
180
+ * @deprecated use `reason` instead
181
+ */
182
+ error: E;
183
+ /**
184
+ * Once the promise has rejected, this will
185
+ * be the error the promise rejected with.
186
+ *
187
+ */
188
+ reason: E;
189
+ }
190
+ /**
191
+ * The state of a promise. This is the type that is returned
192
+ * from `getPromiseState`.
193
+ *
194
+ * See also:
195
+ * - {@link PendingPromise}
196
+ * - {@link ResolvedPromise}
197
+ * - {@link RejectedPromise}
198
+ *
199
+ */
200
+ export type PromiseState<T = unknown, E = unknown> = PendingPromise | ResolvedPromise<T> | RejectedPromise<E>;
201
+ export declare function createPromiseState<T, E>(promise: Promise<T> | Awaitable<T, E>): Readonly<PromiseState<T, E>>;
202
+ /**
203
+ * Returns a reactive state-machine for the provided promise or awaitable.
204
+ *
205
+ * Repeat calls to `getPromiseState` with the same promise will return the same state object
206
+ * making is safe and easy to use in templates and JavaScript code to produce reactive
207
+ * behaviors around promises.
208
+ *
209
+ * `getPromiseState` can be used in both JavaScript and Template contexts.
210
+ *
211
+ * ```ts
212
+ * import { getPromiseState } from '@warp-drive/ember';
213
+ *
214
+ * const state = getPromiseState(promise);
215
+ * ```
216
+ *
217
+ * For instance, we could write a getter on a component that updates whenever
218
+ * the promise state advances or the promise changes, by combining the function
219
+ * with the use of `@cached`
220
+ *
221
+ * ```ts
222
+ * class Component {
223
+ * @cached
224
+ * get title() {
225
+ * const state = getPromiseState(this.args.request);
226
+ * if (state.isPending) {
227
+ * return 'loading...';
228
+ * }
229
+ * if (state.isError) { return null; }
230
+ * return state.result.title;
231
+ * }
232
+ * }
233
+ * ```
234
+ *
235
+ * Or in a template as a helper:
236
+ *
237
+ * ```gjs
238
+ * import { getPromiseState } from '@warp-drive/ember';
239
+ *
240
+ * <template>
241
+ * {{#let (getPromiseState @request) as |state|}}
242
+ * {{#if state.isPending}} <Spinner />
243
+ * {{else if state.isError}} <ErrorForm @error={{state.error}} />
244
+ * {{else}}
245
+ * <h1>{{state.result.title}}</h1>
246
+ * {{/if}}
247
+ * {{/let}}
248
+ * </template>
249
+ * ```
250
+ *
251
+ * If looking to use in a template, consider also the `<Await />` component.
252
+ *
253
+ */
254
+ export declare function getPromiseState<T = unknown, E = unknown>(promise: Promise<T> | Awaitable<T, E>): Readonly<PromiseState<T, E>>;
255
+ //# sourceMappingURL=promise-state.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"promise-state.d.ts","sourceRoot":"","sources":["../../../../src/store/-private/new-core-tmp/promise-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAMrD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,MAAM,EAAE,SAAS,CAAC;IAElB;;;OAGG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;OAIG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;OAIG;IACH,SAAS,EAAE,KAAK,CAAC;IAEjB;;;;OAIG;IACH,OAAO,EAAE,KAAK,CAAC;IAEf;;;;OAIG;IACH,KAAK,EAAE,IAAI,CAAC;IACZ;;;;;OAKG;IACH,MAAM,EAAE,IAAI,CAAC;IAEb;;;;;;OAMG;IACH,KAAK,EAAE,IAAI,CAAC;IAEZ;;;;OAIG;IACH,MAAM,EAAE,IAAI,CAAC;CACd;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC;IAChC;;;OAGG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;;OAGG;IACH,SAAS,EAAE,KAAK,CAAC;IAEjB;;;;OAIG;IACH,SAAS,EAAE,KAAK,CAAC;IACjB;;;;OAIG;IACH,SAAS,EAAE,IAAI,CAAC;IAEhB;;;;OAIG;IACH,OAAO,EAAE,KAAK,CAAC;IAEf;;;;OAIG;IACH,KAAK,EAAE,CAAC,CAAC;IAET;;;;;OAKG;IACH,MAAM,EA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,CAU9B"}
@@ -0,0 +1,93 @@
1
+ export declare const ARRAY_SIGNAL: "___(unique) Symbol(#[])";
2
+ export declare const OBJECT_SIGNAL: "___(unique) Symbol(#{})";
3
+ /**
4
+ * Requirements:
5
+ *
6
+ * Signal:
7
+ *
8
+ * - signal: a way of creating a reference that we can dirty when we desire to notify
9
+ * - @signal: a way of creating an accessor on an object that subscribes to a signal on access
10
+ * and notifies the signal on set, or of upgrading a descriptor to be such an accessor
11
+ * - defineSignal: a way of creating a signal on an object
12
+ * - notifySignal: a way of notifying the underlying signal that it has been dirtied
13
+ * - peekSignal: a way of inspecting the signal without notifying it
14
+ *
15
+ * - gate: a memoized getter function that re-runs when on access if its signal is dirty
16
+ * conceptually, a gate is a tightly coupled signal and memo
17
+ * - @gate: a way of creating a gate on an object or upgrading a descriptor with a getter
18
+ * to be a gate
19
+ * - defineGate: a way of creating a gate on an object
20
+ * - notifySignal: a way of notifying the signal for a gate that it has been dirtied
21
+ *
22
+ * - memo:
23
+ * - @memo: a way of creating a memoized getter on an object or upgrading a descriptor with a getter
24
+ * to be a memo
25
+ * - defineMemo: a way of creating a memo on an object
26
+ *
27
+ * - signalStore: storage bucket for signals associated to an object
28
+ * - withSignalStore: a way of pre-creating a signal store on an object
29
+ *
30
+ *
31
+ * @internal
32
+ */
33
+ /**
34
+ * An Opaque type that represents a framework specific or TC39 signal.
35
+ *
36
+ * It may be an array of signals or a single signal.
37
+ *
38
+ * @internal
39
+ */
40
+ export type SignalRef = unknown;
41
+ /**
42
+ * The hooks which MUST be configured in order to use this library,
43
+ * either for framework specfic signals or TC39 signals.
44
+ *
45
+ * Support for multiple frameworks simultaneously can be done via
46
+ * this abstraction by returning multiple signals from the `createSignal`
47
+ * method, and consuming the correct one via the correct framework via
48
+ * the `consumeSignal` and `notifySignal` methods.
49
+ *
50
+ */
51
+ export interface SignalHooks<T = SignalRef> {
52
+ createSignal: (obj: object, key: string | symbol) => T;
53
+ consumeSignal: (signal: T) => void;
54
+ notifySignal: (signal: T) => void;
55
+ createMemo: <F>(obj: object, key: string | symbol, fn: () => F) => () => F;
56
+ willSyncFlushWatchers: () => boolean;
57
+ waitFor?: <K>(promise: Promise<K>) => Promise<K>;
58
+ }
59
+ export interface HooksOptions {
60
+ wellknown: {
61
+ Array: symbol | string;
62
+ };
63
+ }
64
+ /**
65
+ * Configures the signals implementation to use. Supports multiple
66
+ * implementations simultaneously.
67
+ *
68
+ * @public
69
+ * @param buildConfig - a function that takes options and returns a configuration object
70
+ */
71
+ export declare function setupSignals<T>(buildConfig: (options: HooksOptions) => SignalHooks<T>): void;
72
+ /**
73
+ * Internal method for consuming the configured `createSignal` hook
74
+ *
75
+ * @internal
76
+ */
77
+ export declare function createSignal(obj: object, key: string | symbol): SignalRef;
78
+ /**
79
+ * Internal method for consuming the configured `consumeSignal` hook
80
+ *
81
+ * @internal
82
+ */
83
+ export declare function consumeSignal(signal: SignalRef): void;
84
+ /**
85
+ * Internal method for consuming the configured `notifySignal` hook
86
+ *
87
+ * @internal
88
+ */
89
+ export declare function notifySignal(signal: SignalRef): void;
90
+ export declare function createMemo<T>(object: object, key: string | symbol, fn: () => T): () => T;
91
+ export declare function willSyncFlushWatchers(): boolean;
92
+ export declare function waitFor<K>(promise: Promise<K>): Promise<K>;
93
+ //# sourceMappingURL=configure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../../../../../src/store/-private/new-core-tmp/reactivity/configure.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,YAAY,2BAAuC,CAAC;AACjE,eAAO,MAAM,aAAa,2BAAuC,CAAC;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;GAMG;AACH,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC;AAChC;;;;;;;;;GASG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,SAAS;IACxC,YAAY,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EA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"}
@@ -0,0 +1,170 @@
1
+ import { ARRAY_SIGNAL, OBJECT_SIGNAL, type SignalRef } from './configure.ts';
2
+ export type { SignalRef };
3
+ export { ARRAY_SIGNAL, OBJECT_SIGNAL };
4
+ /**
5
+ * A WarpDriveSignal is a wrapper around a framework specific or TC39 signal
6
+ * that enables us to store and manage the signal in a universal way.
7
+ *
8
+ * WarpDrive uses signals to manage three separate concepts:
9
+ *
10
+ * - as a `storage` for a value local to the object that we want to be reactive
11
+ * (see `@local` schema field for an example)
12
+ * - as a `gate` for a memoized getter that we want to act as a reactive property
13
+ * but whose value is computed/pulled from a non-reactive source elsewhere
14
+ * and whose latest value is stored in the signal
15
+ * (see `field` schema field for an example)
16
+ * - as a `gate` with a manually managed value updated on pull when `isStale` is true
17
+ *
18
+ *
19
+ * It offers
20
+ *
21
+ * - a non-reactive way to access/update the current value
22
+ * - a non-reactive way to mark the signal as dirtied
23
+ * - a non-reactive way to store content for why the signal was dirtied
24
+ * - access to the underlying Signal(s) in-use
25
+ *
26
+ * For debugging:
27
+ * - the "key" or "name" of the signal
28
+ * - the "object identity" or "context" to which the signal is attached
29
+ *
30
+ * @internal
31
+ */
32
+ export interface WarpDriveSignal {
33
+ /**
34
+ * The "key" or "name" of the signal.
35
+ * This is usually (but not always) the name of a property
36
+ * on the object to which the signal is attached.
37
+ *
38
+ * This is used for debugging purposes.
39
+ * It is not used for any other purpose.
40
+ *
41
+ * @internal
42
+ */
43
+ key: string | symbol;
44
+ /**
45
+ * The "object identity" or "context" to which the
46
+ * signal is attached.
47
+ *
48
+ * This is used for debugging purposes.
49
+ * It is not used for any other purpose.
50
+ *
51
+ * @internal
52
+ */
53
+ context: object;
54
+ /**
55
+ * The underlying signal(s) in-use.
56
+ *
57
+ * Generally, this is a single signal.
58
+ *
59
+ * In some cases multiple signals need to be condensed,
60
+ * such as to support legacy Ember Array APIs or to
61
+ * support reactive-objects shared between the code of
62
+ * multiple frameworks.
63
+ *
64
+ * In such cases, this value may be an array.
65
+ *
66
+ * e.g. (pseudo-code for Ember):
67
+ *
68
+ * setupSignals({
69
+ * createSignal: (obj, key, initialValue) => {
70
+ * if (isArraySignal(key)) {
71
+ * return [
72
+ * tagForProperty(obj, key),
73
+ * tagForProperty(obj, '[]'),
74
+ * tagForProperty(obj, 'length'),
75
+ * ];
76
+ * }
77
+ * return tagForProperty(obj, key);
78
+ * },
79
+ *
80
+ * consumeSignal: (signal) => {
81
+ * if (Array.isArray(signal)) {
82
+ * signal.forEach((s) => consumeTag(s));
83
+ * } else {
84
+ * consumeTag(signal);
85
+ * }
86
+ * },
87
+ *
88
+ * dirtySignal: (signal) => {
89
+ * if (Array.isArray(signal)) {
90
+ * signal.forEach((s) => dirtyTag(s));
91
+ * } else {
92
+ * dirtyTag(signal);
93
+ * }
94
+ * },
95
+ * });
96
+ *
97
+ * @internal
98
+ */
99
+ signal: SignalRef;
100
+ /**
101
+ * The last "value" computed for this signal when
102
+ * a signal is also used for storage.
103
+ *
104
+ * @internal
105
+ */
106
+ value: unknown;
107
+ /**
108
+ * Whether ths signal is known to have been dirtied.
109
+ * This is useful *both* when manually managing the
110
+ * `value` cache and when using the signal as a
111
+ * "gate"
112
+ *
113
+ * @internal
114
+ */
115
+ isStale: boolean;
116
+ }
117
+ /**
118
+ * We attach signals to their context object via
119
+ * a Map attached to the object via this symbol.
120
+ *
121
+ * This allows us to store multiple signals
122
+ * on the same object with smaller memory
123
+ * overhead and no WeakMap lookups.
124
+ *
125
+ * Performance sensitive objects should
126
+ * pre-warm their shape by assigning this
127
+ * during initialization.
128
+ *
129
+ * ```ts
130
+ * initializeSignalStore(obj);
131
+ * ```
132
+ *
133
+ * @internal
134
+ */
135
+ export declare const Signals: "___(unique) Symbol(Signals)";
136
+ export type SignalStore = Map<string | symbol, WarpDriveSignal>;
137
+ /**
138
+ * A type util to recast the object as having a signal store.
139
+ *
140
+ * @internal
141
+ */
142
+ export declare function upgradeWithSignals<T extends object>(obj: T): asserts obj is T & {
143
+ [Signals]: SignalStore;
144
+ };
145
+ /**
146
+ * A util that will create a signal store on the object
147
+ * if it does not already exist and returns the associated
148
+ * signal store.
149
+ *
150
+ * @internal
151
+ */
152
+ export declare function withSignalStore<T extends object>(obj: T): SignalStore;
153
+ /**
154
+ * A util that will create a signal store on the object
155
+ * if it does not already exist.
156
+ *
157
+ * Useful for pre-warming the shape of an object to ensure
158
+ * a key-transition to add it is not required later.
159
+ *
160
+ * @internal
161
+ */
162
+ export declare function initializeSignalStore<T extends object>(obj: T): asserts obj is T & {
163
+ [Signals]: SignalStore;
164
+ };
165
+ export declare function createInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
166
+ export declare function getOrCreateInternalSignal(signals: SignalStore, obj: object, key: string | symbol, initialValue: unknown): WarpDriveSignal;
167
+ export declare function peekInternalSignal(signals: SignalStore | undefined, key: string | symbol): WarpDriveSignal | undefined;
168
+ export declare function consumeInternalSignal(signal: WarpDriveSignal): void;
169
+ export declare function notifyInternalSignal(signal: WarpDriveSignal | undefined): void;
170
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../../../../src/store/-private/new-core-tmp/reactivity/internal.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAA6C,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAExH,YAAY,EAAE,SAAS,EAAE,CAAC;AAC1B,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,CAAC;AACvC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;;;;;OASG;IACH,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;IAErB;;;;;;;;OAQG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4CG;IACH,MAAM,EAAE,SAAS,CAAC;IAElB;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AG,SAAS,QAKvE"}
@@ -0,0 +1,30 @@
1
+ import type { SignalStore, WarpDriveSignal } from './internal.ts';
2
+ /**
3
+ * Creates a signal for the key/object pairing and subscribes to the signal.
4
+ *
5
+ * Use when you need to ensure a signal exists and is subscribed to.
6
+ *
7
+ * @internal
8
+ */
9
+ export declare function entangleSignal<T extends object>(signals: SignalStore, obj: T, key: string | symbol, initialValue: unknown): WarpDriveSignal;
10
+ /**
11
+ * define an enumerable signal property.
12
+ *
13
+ * Akin to Object.defineProperty.
14
+ *
15
+ * The signal will be lazily created when accessed and scoped to the
16
+ * instance of the object.
17
+ *
18
+ * @internal
19
+ */
20
+ export declare function defineSignal<T extends object>(obj: T, key: string, v?: unknown): void;
21
+ /**
22
+ * Define a non-enumerable signal property.
23
+ *
24
+ * @internal
25
+ */
26
+ export declare function defineNonEnumerableSignal<T extends object>(obj: T, key: string, v?: unknown): void;
27
+ export declare function memoized<T extends object, K extends keyof T & string>(target: T, key: K, descriptor: PropertyDescriptor): PropertyDescriptor;
28
+ export declare function gate<T extends object, K extends keyof T & string>(_target: T, key: K, desc: PropertyDescriptor): PropertyDescriptor;
29
+ export declare function defineGate<T extends object>(obj: T, key: string, desc: PropertyDescriptor): void;
30
+ //# sourceMappingURL=signal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../../../src/store/-private/new-core-tmp/reactivity/signal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAW,WAAW,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAU3E;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAC7C,OAAO,EAAE,WAAW,EACpB,GAAG,EAAE,CAAC,EACN,GAAG,EAAE,MAAM,GAAG,MAAM,EACpB,YAAY,EAAE,OAAO,GACpB,eAAe,CAQjB;AAsBD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,QAE9E;AAED;;;;GAIG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,CAAC,CAAC,EAAE,OAAO,QAI3F;AAED,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EACnE,MAAM,EAAE,CAAC,EACT,GAAG,EAAE,CAAC,EACN,UAAU,EAAE,kBAAkB,sBAoC/B;AAED,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,MAAM,EAAE,OAAO,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,kBAAkB,sBAqC9G;AAED,wBAAgB,UAAU,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,kBAAkB,QAGzF"}