@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,44 @@
1
+ import { getOrSetGlobal } from "./types/-private.js";
2
+
3
+ ///////////////////
4
+ ///// WARNING /////
5
+ ///////////////////
6
+
7
+ // Great, got your attention with that warning didn't we?
8
+ // Good. Here's the deal: typescript treats symbols as unique types.
9
+ // If by accident a module creating a symbol is processed more than
10
+ // once, the symbol will be different in each processing. This will
11
+ // cause a type error.
12
+ // It could also cause a runtime error if the symbol is used innapropriately.
13
+ // However, this case is extremely hard to hit and would require other things
14
+ // to go wrong first.
15
+ //
16
+ // So, why do the warning? And why do we lie about the types of the symbols?
17
+ //
18
+ // Because we intentionally create multiple copies of them within the types
19
+ // at build time. This is because we rollup our d.ts files in order to give
20
+ // our consumers a better experience.
21
+ //
22
+ // However, no tool today supports rolling up d.ts files with multiple entry
23
+ // points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor
24
+ // which creates a fully unique stand-alone types file per-entry-point. Thus
25
+ // every entry point that uses one of these symbols somewhere will have accidentally
26
+ // created a new symbol type.
27
+ //
28
+ // This cast allows us to rollup these types using this tool while not encountering
29
+ // the unique symbol type issue.
30
+ //
31
+ // Note that none of these symbols are part of the public API, these are used for
32
+ // debugging DX and as a safe way to provide an intimate contract on public objects.
33
+
34
+ const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));
35
+ getOrSetGlobal('MUTATE', Symbol('#update'));
36
+ const Destroy = getOrSetGlobal('Destroy', Symbol('Destroy'));
37
+ const Identifier = getOrSetGlobal('Identifier', Symbol('Identifier'));
38
+ const Editable = getOrSetGlobal('Editable', Symbol('Editable'));
39
+ const Parent = getOrSetGlobal('Parent', Symbol('Parent'));
40
+ const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));
41
+ const Legacy = getOrSetGlobal('Legacy', Symbol('Legacy'));
42
+ const EmbeddedPath = getOrSetGlobal('EmbeddedPath', Symbol('EmbeddedPath'));
43
+ const EmbeddedType = getOrSetGlobal('EmbeddedType', Symbol('EmbeddedType'));
44
+ export { Checkout as C, Destroy as D, Editable as E, Identifier as I, Legacy as L, Parent as P, SOURCE as S, EmbeddedPath as a, EmbeddedType as b };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"symbols-DyqeYQTe.js","sources":["../src/reactive/-private/symbols.ts"],"sourcesContent":["///////////////////\n///// WARNING /////\n///////////////////\n\nimport { getOrSetGlobal } from '../../types/-private';\n\n// Great, got your attention with that warning didn't we?\n// Good. Here's the deal: typescript treats symbols as unique types.\n// If by accident a module creating a symbol is processed more than\n// once, the symbol will be different in each processing. This will\n// cause a type error.\n// It could also cause a runtime error if the symbol is used innapropriately.\n// However, this case is extremely hard to hit and would require other things\n// to go wrong first.\n//\n// So, why do the warning? And why do we lie about the types of the symbols?\n//\n// Because we intentionally create multiple copies of them within the types\n// at build time. This is because we rollup our d.ts files in order to give\n// our consumers a better experience.\n//\n// However, no tool today supports rolling up d.ts files with multiple entry\n// points correctly. The tool we use currently (vite-plugin-dts) uses @microsoft/api-extractor\n// which creates a fully unique stand-alone types file per-entry-point. Thus\n// every entry point that uses one of these symbols somewhere will have accidentally\n// created a new symbol type.\n//\n// This cast allows us to rollup these types using this tool while not encountering\n// the unique symbol type issue.\n//\n// Note that none of these symbols are part of the public API, these are used for\n// debugging DX and as a safe way to provide an intimate contract on public objects.\n\nexport const SOURCE = getOrSetGlobal('SOURCE', Symbol('#source'));\nexport const MUTATE = getOrSetGlobal('MUTATE', Symbol('#update'));\n\nexport const Destroy = getOrSetGlobal('Destroy', Symbol('Destroy'));\nexport const Identifier = getOrSetGlobal('Identifier', Symbol('Identifier'));\nexport const Editable = getOrSetGlobal('Editable', Symbol('Editable'));\nexport const Parent = getOrSetGlobal('Parent', Symbol('Parent'));\nexport const Checkout = getOrSetGlobal('Checkout', Symbol('Checkout'));\nexport const Legacy = getOrSetGlobal('Legacy', Symbol('Legacy'));\n\nexport const EmbeddedPath = getOrSetGlobal('EmbeddedPath', Symbol('EmbeddedPath'));\nexport const EmbeddedType = getOrSetGlobal('EmbeddedType', Symbol('EmbeddedType'));\n"],"names":["SOURCE","getOrSetGlobal","Symbol","Destroy","Identifier","Editable","Parent","Checkout","Legacy","EmbeddedPath","EmbeddedType"],"mappings":";;AAAA;AACA;AACA;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEO,MAAMA,MAAM,GAAGC,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,SAAS,CAAC;AAC1CD,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,SAAS,CAAC;AAEzD,MAAMC,OAAO,GAAGF,cAAc,CAAC,SAAS,EAAEC,MAAM,CAAC,SAAS,CAAC;AAC3D,MAAME,UAAU,GAAGH,cAAc,CAAC,YAAY,EAAEC,MAAM,CAAC,YAAY,CAAC;AACpE,MAAMG,QAAQ,GAAGJ,cAAc,CAAC,UAAU,EAAEC,MAAM,CAAC,UAAU,CAAC;AAC9D,MAAMI,MAAM,GAAGL,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,QAAQ,CAAC;AACxD,MAAMK,QAAQ,GAAGN,cAAc,CAAC,UAAU,EAAEC,MAAM,CAAC,UAAU,CAAC;AAC9D,MAAMM,MAAM,GAAGP,cAAc,CAAC,QAAQ,EAAEC,MAAM,CAAC,QAAQ,CAAC;AAExD,MAAMO,YAAY,GAAGR,cAAc,CAAC,cAAc,EAAEC,MAAM,CAAC,cAAc,CAAC;AAC1E,MAAMQ,YAAY,GAAGT,cAAc,CAAC,cAAc,EAAEC,MAAM,CAAC,cAAc,CAAC;;;;"}
@@ -0,0 +1,79 @@
1
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
+ const name = "@warp-drive/core";
3
+ const version = "5.6.0-alpha.11";
4
+
5
+ // in testing mode, we utilize globals to ensure only one copy exists of
6
+ // these maps, due to bugs in ember-auto-import
7
+
8
+ const GlobalRef = globalThis;
9
+ const UniversalCache = GlobalRef.__warpDrive_universalCache = GlobalRef.__warpDrive_universalCache ?? {};
10
+
11
+ // in order to support mirror packages, we ensure that each
12
+ // unique package name has its own global cache
13
+ GlobalRef[name] = GlobalRef[name] ?? {
14
+ __version: version
15
+ };
16
+ const GlobalSink = GlobalRef[name];
17
+ if (macroCondition(getGlobalConfig().WarpDrive.env.DEBUG)) {
18
+ if (GlobalSink.__version !== version) {
19
+ throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');
20
+ }
21
+ }
22
+ const ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? {};
23
+ if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
24
+ if (!GlobalSink.__warpDrive_ModuleScopedCaches) {
25
+ GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;
26
+ } else {
27
+ // eslint-disable-next-line no-console
28
+ console.warn(`
29
+ Multiple copies of WarpDrive have been detected. This may be due to a bug in ember-auto-import
30
+ in which test assets get their own copy of some v2-addons. This can cause the application to
31
+ malfunction as each copy will maintain its own separate state.`);
32
+ }
33
+ } else {
34
+ if (GlobalSink.__warpDrive_hasOtherCopy) {
35
+ throw new Error('Multiple copies of WarpDrive detected, the application will malfunction.');
36
+ }
37
+ GlobalSink.__warpDrive_hasOtherCopy = true;
38
+ }
39
+ function getOrSetGlobal(key, value) {
40
+ if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
41
+ const existing = ModuleScopedCaches[key];
42
+ if (existing === undefined) {
43
+ return ModuleScopedCaches[key] = value;
44
+ } else {
45
+ return existing;
46
+ }
47
+ } else {
48
+ return value;
49
+ }
50
+ }
51
+ function peekTransient(key) {
52
+ const globalKey = `(transient) ${key}`;
53
+ return ModuleScopedCaches[globalKey] ?? null;
54
+ }
55
+ function setTransient(key, value) {
56
+ const globalKey = `(transient) ${key}`;
57
+ return ModuleScopedCaches[globalKey] = value;
58
+ }
59
+ function getOrSetUniversal(key, value) {
60
+ if (macroCondition(getGlobalConfig().WarpDrive.env.TESTING)) {
61
+ const existing = UniversalCache[key];
62
+ if (existing === undefined) {
63
+ return UniversalCache[key] = value;
64
+ } else {
65
+ return existing;
66
+ }
67
+ } else {
68
+ return value;
69
+ }
70
+ }
71
+ function peekUniversalTransient(key) {
72
+ const globalKey = `(transient) ${key}`;
73
+ return UniversalCache[globalKey] ?? null;
74
+ }
75
+ function setUniversalTransient(key, value) {
76
+ const globalKey = `(transient) ${key}`;
77
+ return UniversalCache[globalKey] = value;
78
+ }
79
+ export { getOrSetGlobal, getOrSetUniversal, peekTransient, peekUniversalTransient, setTransient, setUniversalTransient };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"-private.js","sources":["../../src/types/-private.ts"],"sourcesContent":["// in testing mode, we utilize globals to ensure only one copy exists of\n// these maps, due to bugs in ember-auto-import\nimport { DEBUG, TESTING } from '@warp-drive/core/build-config/env';\n\nimport { name, version } from '../../package.json';\n\ntype UniversalTransientKey =\n // @ember-data/request\n 'REQ_ID';\n\ntype UniversalKey =\n | `(transient) ${UniversalTransientKey}`\n // @ember-data/request\n | 'RequestMap'\n | 'PromiseCache'\n | 'RequestCache'\n // @warp-drive/core-types/request\n | 'SkipCache'\n | 'EnableHydration'\n // @warp-drive/core-types/runtime\n | 'WarpDriveRuntimeConfig';\n\ntype TransientKey =\n // @ember-data/graph\n | 'transactionRef'\n // @ember-data/store\n | 'configuredGenerationMethod'\n | 'configuredUpdateMethod'\n | 'configuredForgetMethod'\n | 'configuredResetMethod'\n | 'configuredKeyInfoMethod'\n | 'signalHooks';\n\ntype GlobalKey =\n | `(transient) ${TransientKey}`\n // @ember-data/adapter\n | 'AdapterError'\n | 'InvalidError'\n | 'TimeoutError'\n | 'AbortError'\n | 'UnauthorizedError'\n | 'ForbiddenError'\n | 'NotFoundError'\n | 'ConflictError'\n | 'ServerError'\n // @ember-data/store/reactivity\n | '#{}'\n | '#[]'\n | 'Signals'\n // @ember-data/store LegacySupport\n | 'AvailableShims'\n // @ember-data/store RecordArrayManager\n | 'FAKE_ARR'\n // @ember-data/store IdentifierArray\n | '#source'\n | '#update'\n | '#notify'\n | 'IS_COLLECTION'\n // @ember-data/store RequestCache\n | 'Touching'\n | 'RequestPromise'\n // @ember-data/legacy-compat FetchManager\n | 'SaveOp'\n // @ember-data/model\n | 'LEGACY_SUPPORT'\n | 'LegacySupport'\n // @ember-data/graph\n | 'Graphs'\n // @ember-data/request\n | 'IS_FROZEN'\n | 'IS_CACHE_HANDLER'\n // @ember-data/request-utils\n | 'CONFIG'\n // @ember-data/store IdentityCache\n | 'DEBUG_MAP'\n | 'IDENTIFIERS'\n | 'DOCUMENTS'\n // @ember-data/store InstanceCache\n | 'CacheForIdentifierCache'\n | 'RecordCache'\n | 'StoreMap'\n // @warp-drive/core-types/symbols\n | 'Store'\n | '$type'\n | 'TransformName'\n | 'RequestSignature'\n // @warp-drive/core-types/request\n | 'IS_FUTURE'\n | 'DOC'\n // @warp-drive/schema-record\n | 'ManagedArrayMap'\n | 'ManagedObjectMap'\n | 'Support'\n | 'SOURCE'\n | 'MUTATE'\n | 'Destroy'\n | 'Identifier'\n | 'Editable'\n | 'EmbeddedPath'\n | 'EmbeddedType'\n | 'Parent'\n | 'Checkout'\n | 'Legacy';\n\ntype ModuleScopedCaches = Record<GlobalKey, unknown>;\n\nconst GlobalRef = globalThis as unknown as Record<\n string,\n {\n __warpDrive_ModuleScopedCaches?: ModuleScopedCaches;\n __warpDrive_hasOtherCopy?: boolean;\n __version: string;\n }\n> & {\n __warpDrive_universalCache: Record<UniversalKey, unknown>;\n};\nconst UniversalCache = (GlobalRef.__warpDrive_universalCache =\n GlobalRef.__warpDrive_universalCache ?? ({} as Record<UniversalKey, unknown>));\n\n// in order to support mirror packages, we ensure that each\n// unique package name has its own global cache\nGlobalRef[name] = GlobalRef[name] ?? { __version: version };\nconst GlobalSink = GlobalRef[name];\n\nif (DEBUG) {\n if (GlobalSink.__version !== version) {\n throw new Error('Multiple versions of WarpDrive detected, the application will malfunction.');\n }\n}\n\nconst ModuleScopedCaches = GlobalSink.__warpDrive_ModuleScopedCaches ?? ({} as ModuleScopedCaches);\nif (TESTING) {\n if (!GlobalSink.__warpDrive_ModuleScopedCaches) {\n GlobalSink.__warpDrive_ModuleScopedCaches = ModuleScopedCaches;\n } else {\n // eslint-disable-next-line no-console\n console.warn(`\nMultiple copies of WarpDrive have been detected. This may be due to a bug in ember-auto-import\n in which test assets get their own copy of some v2-addons. This can cause the application to\n malfunction as each copy will maintain its own separate state.`);\n }\n} else {\n if (GlobalSink.__warpDrive_hasOtherCopy) {\n throw new Error('Multiple copies of WarpDrive detected, the application will malfunction.');\n }\n GlobalSink.__warpDrive_hasOtherCopy = true;\n}\n\ntype UniqueSymbol<T extends string> = `___(unique) Symbol(${T})`;\ntype UniqueSymbolOr<T, K extends string> = T extends symbol ? UniqueSymbol<K> : T;\n\nexport function getOrSetGlobal<T, K extends GlobalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = ModuleScopedCaches[key];\n if (existing === undefined) {\n return (ModuleScopedCaches[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\nexport function peekTransient<T>(key: TransientKey): T | null {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] as T) ?? null;\n}\n\nexport function setTransient<T>(key: TransientKey, value: T): T {\n const globalKey: `(transient) ${TransientKey}` = `(transient) ${key}`;\n return (ModuleScopedCaches[globalKey] = value);\n}\n\nexport function getOrSetUniversal<T, K extends UniversalKey>(key: K, value: T): UniqueSymbolOr<T, K> {\n if (TESTING) {\n const existing = UniversalCache[key];\n if (existing === undefined) {\n return (UniversalCache[key] = value) as UniqueSymbolOr<T, K>;\n } else {\n return existing as UniqueSymbolOr<T, K>;\n }\n } else {\n return value as UniqueSymbolOr<T, K>;\n }\n}\n\nexport function peekUniversalTransient<T>(key: UniversalTransientKey): T | null {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] as T) ?? null;\n}\n\nexport function setUniversalTransient<T>(key: UniversalTransientKey, value: T): T {\n const globalKey: `(transient) ${UniversalTransientKey}` = `(transient) ${key}`;\n return (UniversalCache[globalKey] = value);\n}\n"],"names":["GlobalRef","globalThis","UniversalCache","__warpDrive_universalCache","name","__version","version","GlobalSink","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","Error","ModuleScopedCaches","__warpDrive_ModuleScopedCaches","TESTING","console","warn","__warpDrive_hasOtherCopy","getOrSetGlobal","key","value","existing","undefined","peekTransient","globalKey","setTransient","getOrSetUniversal","peekUniversalTransient","setUniversalTransient"],"mappings":";;;;;AAAA;AACA;;AAyGA,MAAMA,SAAS,GAAGC,UASjB;AACD,MAAMC,cAAc,GAAIF,SAAS,CAACG,0BAA0B,GAC1DH,SAAS,CAACG,0BAA0B,IAAK,EAAqC;;AAEhF;AACA;AACAH,SAAS,CAACI,IAAI,CAAC,GAAGJ,SAAS,CAACI,IAAI,CAAC,IAAI;AAAEC,EAAAA,SAAS,EAAEC;AAAQ,CAAC;AAC3D,MAAMC,UAAU,GAAGP,SAAS,CAACI,IAAI,CAAC;AAElC,IAAAI,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,CAAW,EAAA;AACT,EAAA,IAAIL,UAAU,CAACF,SAAS,KAAKC,OAAO,EAAE;AACpC,IAAA,MAAM,IAAIO,KAAK,CAAC,4EAA4E,CAAC;AAC/F;AACF;AAEA,MAAMC,kBAAkB,GAAGP,UAAU,CAACQ,8BAA8B,IAAK,EAAyB;AAClG,IAAAP,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAK,OAAA,CAAa,EAAA;AACX,EAAA,IAAI,CAACT,UAAU,CAACQ,8BAA8B,EAAE;IAC9CR,UAAU,CAACQ,8BAA8B,GAAGD,kBAAkB;AAChE,GAAC,MAAM;AACL;IACAG,OAAO,CAACC,IAAI,CAAC;AACjB;AACA;AACA,gEAAA,CAAiE,CAAC;AAChE;AACF,CAAC,MAAM;EACL,IAAIX,UAAU,CAACY,wBAAwB,EAAE;AACvC,IAAA,MAAM,IAAIN,KAAK,CAAC,0EAA0E,CAAC;AAC7F;EACAN,UAAU,CAACY,wBAAwB,GAAG,IAAI;AAC5C;AAKO,SAASC,cAAcA,CAAyBC,GAAM,EAAEC,KAAQ,EAAwB;EAC7F,IAAAd,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAK,OAAA,CAAa,EAAA;AACX,IAAA,MAAMO,QAAQ,GAAGT,kBAAkB,CAACO,GAAG,CAAC;IACxC,IAAIE,QAAQ,KAAKC,SAAS,EAAE;AAC1B,MAAA,OAAQV,kBAAkB,CAACO,GAAG,CAAC,GAAGC,KAAK;AACzC,KAAC,MAAM;AACL,MAAA,OAAOC,QAAQ;AACjB;AACF,GAAC,MAAM;AACL,IAAA,OAAOD,KAAK;AACd;AACF;AAEO,SAASG,aAAaA,CAAIJ,GAAiB,EAAY;AAC5D,EAAA,MAAMK,SAAwC,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AACrE,EAAA,OAAQP,kBAAkB,CAACY,SAAS,CAAC,IAAU,IAAI;AACrD;AAEO,SAASC,YAAYA,CAAIN,GAAiB,EAAEC,KAAQ,EAAK;AAC9D,EAAA,MAAMI,SAAwC,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AACrE,EAAA,OAAQP,kBAAkB,CAACY,SAAS,CAAC,GAAGJ,KAAK;AAC/C;AAEO,SAASM,iBAAiBA,CAA4BP,GAAM,EAAEC,KAAQ,EAAwB;EACnG,IAAAd,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAK,OAAA,CAAa,EAAA;AACX,IAAA,MAAMO,QAAQ,GAAGrB,cAAc,CAACmB,GAAG,CAAC;IACpC,IAAIE,QAAQ,KAAKC,SAAS,EAAE;AAC1B,MAAA,OAAQtB,cAAc,CAACmB,GAAG,CAAC,GAAGC,KAAK;AACrC,KAAC,MAAM;AACL,MAAA,OAAOC,QAAQ;AACjB;AACF,GAAC,MAAM;AACL,IAAA,OAAOD,KAAK;AACd;AACF;AAEO,SAASO,sBAAsBA,CAAIR,GAA0B,EAAY;AAC9E,EAAA,MAAMK,SAAiD,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AAC9E,EAAA,OAAQnB,cAAc,CAACwB,SAAS,CAAC,IAAU,IAAI;AACjD;AAEO,SAASI,qBAAqBA,CAAIT,GAA0B,EAAEC,KAAQ,EAAK;AAChF,EAAA,MAAMI,SAAiD,GAAG,CAAeL,YAAAA,EAAAA,GAAG,CAAE,CAAA;AAC9E,EAAA,OAAQnB,cAAc,CAACwB,SAAS,CAAC,GAAGJ,KAAK;AAC3C;;;;"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"aliases.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"change.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mutations.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"operations.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"relationship.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"graph.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,89 @@
1
+ import { macroCondition, getGlobalConfig } from '@embroider/macros';
2
+
3
+ // provided for additional debuggability
4
+ const DEBUG_CLIENT_ORIGINATED = Symbol('record-originated-on-client');
5
+ const DEBUG_IDENTIFIER_BUCKET = Symbol('identifier-bucket');
6
+ const DEBUG_STALE_CACHE_OWNER = Symbol('warpDriveStaleCache');
7
+ function ProdSymbol(str, debugStr) {
8
+ return macroCondition(getGlobalConfig().WarpDrive.env.DEBUG) ? Symbol(debugStr) : str;
9
+ }
10
+
11
+ // also present in production
12
+ const CACHE_OWNER = ProdSymbol('__$co', 'CACHE_OWNER');
13
+
14
+ /**
15
+ * An Identifier specific to a record which may or may not
16
+ * be present in the cache.
17
+ *
18
+ * The absence of an `id` DOES NOT indicate that this
19
+ * Identifier is for a new client-created record as it
20
+ * may also indicate that it was generated for a secondary
21
+ * index and the primary `id` index is not yet known.
22
+ *
23
+ * @internal
24
+ */
25
+
26
+ /**
27
+ * Used when an Identifier is known to be the stable version
28
+ *
29
+ * @internal
30
+ */
31
+
32
+ /**
33
+ * Used when a StableRecordIdentifier was not created locally as part
34
+ * of a call to store.createRecord
35
+ *
36
+ * Distinguishing between this Identifier and one for a client created
37
+ * record that was created with an ID is generally speaking not possible
38
+ * at runtime, so anything with an ID typically narrows to this.
39
+ *
40
+ * @internal
41
+ */
42
+
43
+ /**
44
+ * Used when a StableRecordIdentifier was created locally
45
+ * (by a call to store.createRecord).
46
+ *
47
+ * It is possible in rare circumstances to have a StableRecordIdentifier
48
+ * that is not for a new record but does not have an ID. This would
49
+ * happen if a user intentionally created one for use with a secondary-index
50
+ * prior to the record having been fully loaded.
51
+ *
52
+ * @internal
53
+ */
54
+
55
+ /**
56
+ * A referentially stable object with a unique string (lid) that can be used
57
+ * as a reference to data in the cache.
58
+ *
59
+ * Every record instance has a unique identifier, and identifiers may refer
60
+ * to data that has never been loaded (for instance, in an async relationship).
61
+ *
62
+ * @class StableRecordIdentifier
63
+ * @public
64
+ */
65
+
66
+ /**
67
+ * A string representing a unique identity.
68
+ *
69
+ * @property lid
70
+ * @type {String}
71
+ * @public
72
+ */
73
+ /**
74
+ * the primary resource `type` or `modelName` this identity belongs to.
75
+ *
76
+ * @property type
77
+ * @type {String}
78
+ * @public
79
+ */
80
+ /**
81
+ * the primary id for the record this identity belongs to. `null`
82
+ * if not yet assigned an id.
83
+ *
84
+ * @property id
85
+ * @type {String | null}
86
+ * @public
87
+ */
88
+
89
+ export { CACHE_OWNER, DEBUG_CLIENT_ORIGINATED, DEBUG_IDENTIFIER_BUCKET, DEBUG_STALE_CACHE_OWNER };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"identifier.js","sources":["../../src/types/identifier.ts"],"sourcesContent":["import { DEBUG } from '@warp-drive/core/build-config/env';\n\n// provided for additional debuggability\nexport const DEBUG_CLIENT_ORIGINATED: unique symbol = Symbol('record-originated-on-client');\nexport const DEBUG_IDENTIFIER_BUCKET: unique symbol = Symbol('identifier-bucket');\nexport const DEBUG_STALE_CACHE_OWNER: unique symbol = Symbol('warpDriveStaleCache');\n\nfunction ProdSymbol<T extends string>(str: T, debugStr: string): T {\n return DEBUG ? (Symbol(debugStr) as unknown as T) : str;\n}\n\n// also present in production\nexport const CACHE_OWNER: '__$co' = ProdSymbol('__$co', 'CACHE_OWNER');\n\nexport type IdentifierBucket = 'record' | 'document';\n\nexport interface Identifier {\n lid: string;\n clientId?: string;\n}\n\nexport interface ExistingRecordIdentifier<T extends string = string> extends Identifier {\n id: string;\n type: T;\n}\n\nexport interface NewRecordIdentifier<T extends string = string> extends Identifier {\n id: string | null;\n type: T;\n}\n\nexport type StableDocumentIdentifier = {\n lid: string;\n};\nexport type RequestKey = StableDocumentIdentifier;\n\n/**\n * An Identifier specific to a record which may or may not\n * be present in the cache.\n *\n * The absence of an `id` DOES NOT indicate that this\n * Identifier is for a new client-created record as it\n * may also indicate that it was generated for a secondary\n * index and the primary `id` index is not yet known.\n *\n * @internal\n */\nexport type RecordIdentifier<T extends string = string> = ExistingRecordIdentifier<T> | NewRecordIdentifier<T>;\n\n/**\n * Used when an Identifier is known to be the stable version\n *\n * @internal\n */\nexport interface StableIdentifier extends Identifier {\n [DEBUG_IDENTIFIER_BUCKET]?: string;\n}\n\n/**\n * Used when a StableRecordIdentifier was not created locally as part\n * of a call to store.createRecord\n *\n * Distinguishing between this Identifier and one for a client created\n * record that was created with an ID is generally speaking not possible\n * at runtime, so anything with an ID typically narrows to this.\n *\n * @internal\n */\nexport interface StableExistingRecordIdentifier<T extends string = string> extends StableIdentifier {\n id: string;\n type: T;\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n [CACHE_OWNER]: number | undefined;\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * Used when a StableRecordIdentifier was created locally\n * (by a call to store.createRecord).\n *\n * It is possible in rare circumstances to have a StableRecordIdentifier\n * that is not for a new record but does not have an ID. This would\n * happen if a user intentionally created one for use with a secondary-index\n * prior to the record having been fully loaded.\n *\n * @internal\n */\nexport interface StableNewRecordIdentifier<T extends string = string> extends StableIdentifier {\n id: string | null;\n type: T;\n [DEBUG_CLIENT_ORIGINATED]?: boolean;\n [CACHE_OWNER]: number | undefined;\n [DEBUG_STALE_CACHE_OWNER]?: number | undefined;\n}\n\n/**\n * A referentially stable object with a unique string (lid) that can be used\n * as a reference to data in the cache.\n *\n * Every record instance has a unique identifier, and identifiers may refer\n * to data that has never been loaded (for instance, in an async relationship).\n *\n * @class StableRecordIdentifier\n * @public\n */\n\n/**\n * A string representing a unique identity.\n *\n * @property lid\n * @type {String}\n * @public\n */\n/**\n * the primary resource `type` or `modelName` this identity belongs to.\n *\n * @property type\n * @type {String}\n * @public\n */\n/**\n * the primary id for the record this identity belongs to. `null`\n * if not yet assigned an id.\n *\n * @property id\n * @type {String | null}\n * @public\n */\nexport type StableRecordIdentifier<T extends string = string> =\n | StableExistingRecordIdentifier<T>\n | StableNewRecordIdentifier<T>;\n\nexport type ResourceKey<T extends string = string> = StableRecordIdentifier<T>;\n"],"names":["DEBUG_CLIENT_ORIGINATED","Symbol","DEBUG_IDENTIFIER_BUCKET","DEBUG_STALE_CACHE_OWNER","ProdSymbol","str","debugStr","macroCondition","getGlobalConfig","WarpDrive","env","DEBUG","CACHE_OWNER"],"mappings":";;AAEA;MACaA,uBAAsC,GAAGC,MAAM,CAAC,6BAA6B;MAC7EC,uBAAsC,GAAGD,MAAM,CAAC,mBAAmB;MACnEE,uBAAsC,GAAGF,MAAM,CAAC,qBAAqB;AAElF,SAASG,UAAUA,CAAmBC,GAAM,EAAEC,QAAgB,EAAK;AACjE,EAAA,OAAOC,cAAA,CAAAC,eAAA,EAAA,CAAAC,SAAA,CAAAC,GAAA,CAAAC,KAAA,IAASV,MAAM,CAACK,QAAQ,CAAC,GAAoBD,GAAG;AACzD;;AAEA;AACO,MAAMO,WAAoB,GAAGR,UAAU,CAAC,OAAO,EAAE,aAAa;;AAwBrE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"raw.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"params.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Records may be anything, They don't even
3
+ * have to be objects.
4
+ *
5
+ * Whatever they are, if they have a Type
6
+ * property, that property will be used by WarpDrive
7
+ * and WarpDrive to provide better type safety and
8
+ * intellisense.
9
+ *
10
+ * @class TypedRecordInstance
11
+ */
12
+
13
+ /**
14
+ * A type utility that extracts the Type if available,
15
+ * otherwise it returns never.
16
+ *
17
+ */
18
+
19
+ /**
20
+ * A type utility that extracts the Type if available,
21
+ * otherwise it returns string
22
+ *
23
+ */
24
+
25
+ /**
26
+ * A Utility that extracts either resource types or resource paths from a TypedRecordInstance.
27
+ *
28
+ * Its limitations are mostly around its intentional non-recursiveness. It presumes that APIs which
29
+ * implement includes will not allow cyclical include paths, and will collapse includes by type.
30
+ *
31
+ * This follows closer to the JSON:API fields spec than to the includes spec in nature, but in
32
+ * practice it is so impracticle for an API to allow z-algo include paths that this is probably
33
+ * reasonable.
34
+ *
35
+ * We may need to revisit this in the future, opting to either make this restriction optional or
36
+ * to allow for other strategies.
37
+ *
38
+ * There's a 90% chance this particular implementation belongs being in the JSON:API package instead
39
+ * of core-types, but it's here for now.
40
+ *
41
+ */
42
+
43
+ /**
44
+ * A utility that provides the union of all ResourceName for all potential
45
+ * includes for the given TypedRecordInstance.
46
+ *
47
+ */
48
+
49
+ // ToPaths<ExpandIgnore<T, true>, false>;
50
+
51
+ /**
52
+ * A utility that provides the union type of all valid include paths for the given
53
+ * TypedRecordInstance.
54
+ *
55
+ * Cyclical paths are filtered out.
56
+ *
57
+ */
58
+
59
+ function createIncludeValidator() {
60
+ return function validateIncludes(includes) {
61
+ return includes;
62
+ };
63
+ }
64
+ export { createIncludeValidator };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.js","sources":["../../src/types/record.ts"],"sourcesContent":["import type { Type } from './symbols.ts';\n\n/**\n * Records may be anything, They don't even\n * have to be objects.\n *\n * Whatever they are, if they have a Type\n * property, that property will be used by WarpDrive\n * and WarpDrive to provide better type safety and\n * intellisense.\n *\n * @class TypedRecordInstance\n */\nexport interface TypedRecordInstance {\n /**\n * The type of the resource.\n *\n * This is an optional feature that can be used by\n * record implementations to provide a typescript\n * hint for the type of the resource.\n *\n * When used, WarpDrive APIs can\n * take advantage of this to provide better type\n * safety and intellisense.\n *\n * @property [Type]\n * @type {Type}\n * @type {String}\n */\n [Type]: string;\n}\n\n/**\n * A type utility that extracts the Type if available,\n * otherwise it returns never.\n *\n */\nexport type TypeFromInstance<T> = T extends TypedRecordInstance ? T[typeof Type] : never;\n\n/**\n * A type utility that extracts the Type if available,\n * otherwise it returns string\n *\n */\nexport type TypeFromInstanceOrString<T> = T extends TypedRecordInstance ? T[typeof Type] : string;\n\ntype IsUniqueSymbol<T> = T extends `___(unique) Symbol(${string})` ? true : false;\ntype Unpacked<T> = T extends (infer U)[] ? U : T;\ntype NONE = { __NONE: never };\n\ntype __InternalExtract<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n V extends TypedRecordInstance,\n IncludePrefix extends boolean,\n Ignore,\n Pre extends string,\n DEPTH extends _DEPTHCOUNT,\n> =\n // if we extend T, we return the leaf value\n V extends T\n ? IncludePrefix extends false\n ? V[typeof Type]\n : Pre\n : // else if we are in Ignore we add the lead and exit\n V extends Ignore\n ? IncludePrefix extends false\n ? V[typeof Type]\n : Pre\n : // else if we are at max depth, we return never\n IS_MAX_DEPTH<DEPTH, MAX_DEPTH> extends true\n ? Pre\n : // else add T to Ignore and recurse\n ExtractUnion<MAX_DEPTH, V, IncludePrefix, Ignore | T, Pre, INC_DEPTH<DEPTH>>;\n\ntype __ExtractIfRecord<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n V,\n IncludePrefix extends boolean,\n Ignore,\n Pre extends string,\n DEPTH extends _DEPTHCOUNT,\n> = V extends TypedRecordInstance ? __InternalExtract<MAX_DEPTH, T, V, IncludePrefix, Ignore, Pre, DEPTH> : never;\n\ntype _ExtractUnion<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n IncludePrefix extends boolean,\n Ignore,\n Pre,\n DEPTH extends _DEPTHCOUNT,\n> = {\n // for each string key in the record,\n [K in keyof T]: IsUniqueSymbol<K> extends true\n ? never\n : K extends string\n ? // we recursively extract any values that resolve to a TypedRecordInstance\n __ExtractIfRecord<\n MAX_DEPTH,\n T,\n Unpacked<Awaited<T[K]>>,\n IncludePrefix,\n Ignore,\n Pre extends string ? `${Pre}.${K}` : K,\n DEPTH\n >\n : never;\n // then we return any value that is not 'never'\n}[keyof T];\n\n/**\n * A Utility that extracts either resource types or resource paths from a TypedRecordInstance.\n *\n * Its limitations are mostly around its intentional non-recursiveness. It presumes that APIs which\n * implement includes will not allow cyclical include paths, and will collapse includes by type.\n *\n * This follows closer to the JSON:API fields spec than to the includes spec in nature, but in\n * practice it is so impracticle for an API to allow z-algo include paths that this is probably\n * reasonable.\n *\n * We may need to revisit this in the future, opting to either make this restriction optional or\n * to allow for other strategies.\n *\n * There's a 90% chance this particular implementation belongs being in the JSON:API package instead\n * of core-types, but it's here for now.\n *\n */\ntype ExtractUnion<\n MAX_DEPTH extends _DEPTHCOUNT,\n T extends TypedRecordInstance,\n IncludePrefix extends boolean = false,\n Ignore = NONE,\n Pre = NONE,\n DEPTH extends _DEPTHCOUNT = 1,\n> = Exclude<\n IncludePrefix extends true\n ? // if we want to include prefix, we union with the prefix. Outer Exclude will filter any \"NONE\" types\n _ExtractUnion<MAX_DEPTH, T, IncludePrefix, Ignore, Pre, DEPTH> | Pre\n : // Else we just union the types.\n _ExtractUnion<MAX_DEPTH, T, IncludePrefix, Ignore, Pre, DEPTH> | T[typeof Type],\n NONE\n>;\n\ntype _DEPTHCOUNT = 1 | 2 | 3 | 4 | 5;\ntype INC_DEPTH<START extends _DEPTHCOUNT> = START extends 1 ? 2 : START extends 2 ? 3 : START extends 3 ? 4 : 5;\ntype IS_MAX_DEPTH<\n DEPTH extends _DEPTHCOUNT,\n MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH,\n> = DEPTH extends MAX_DEPTH ? true : false;\ntype DEFAULT_MAX_DEPTH = 3;\n/**\n * A utility that provides the union of all ResourceName for all potential\n * includes for the given TypedRecordInstance.\n *\n */\nexport type ExtractSuggestedCacheTypes<\n T extends TypedRecordInstance,\n MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH,\n> = ExtractUnion<MAX_DEPTH, T>; // ToPaths<ExpandIgnore<T, true>, false>;\n\n/**\n * A utility that provides the union type of all valid include paths for the given\n * TypedRecordInstance.\n *\n * Cyclical paths are filtered out.\n *\n */\nexport type Includes<T extends TypedRecordInstance, MAX_DEPTH extends _DEPTHCOUNT = DEFAULT_MAX_DEPTH> = ExtractUnion<\n MAX_DEPTH,\n T,\n true\n>;\n\nexport type OpaqueRecordInstance = unknown;\n\nexport type _StringSatisfiesIncludes<T extends string, SET extends string, FT extends string> = T extends SET\n ? FT\n : T extends `${infer U},${infer V}`\n ? U extends SET\n ? _StringSatisfiesIncludes<V, Exclude<SET, U>, FT>\n : never\n : never;\n\nexport type StringSatisfiesIncludes<T extends string, SET extends string> = _StringSatisfiesIncludes<T, SET, T>;\n\nexport function createIncludeValidator<T extends TypedRecordInstance>() {\n return function validateIncludes<U extends string>(includes: StringSatisfiesIncludes<U, Includes<T>>): U {\n return includes;\n };\n}\n"],"names":["createIncludeValidator","validateIncludes","includes"],"mappings":"AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAoBA;AACA;AACA;AACA;AACA;;AAGA;AACA;AACA;AACA;AACA;;AAoEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAwBA;AACA;AACA;AACA;AACA;;AAIgC;;AAEhC;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBO,SAASA,sBAAsBA,GAAkC;AACtE,EAAA,OAAO,SAASC,gBAAgBA,CAAmBC,QAAiD,EAAK;AACvG,IAAA,OAAOA,QAAQ;GAChB;AACH;;;;"}
@@ -0,0 +1,33 @@
1
+ import { getOrSetUniversal, getOrSetGlobal } from "./-private.js";
2
+ const SkipCache = getOrSetUniversal('SkipCache', Symbol.for('wd:skip-cache'));
3
+ const EnableHydration = getOrSetUniversal('EnableHydration', Symbol.for('wd:enable-hydration'));
4
+ const IS_FUTURE = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));
5
+ const STRUCTURED = getOrSetGlobal('DOC', Symbol('DOC'));
6
+
7
+ /**
8
+ * Use these options to adjust CacheHandler behavior for a request.
9
+ *
10
+ */
11
+
12
+ /**
13
+ * JavaScript's native Request class.
14
+ *
15
+ * WarpDrive provides our own typings due to incompleteness in the native typings.
16
+ *
17
+ */
18
+
19
+ /**
20
+ * Extends JavaScript's native {@link Request} object with additional
21
+ * properties specific to the RequestManager's capabilities.
22
+ *
23
+ */
24
+
25
+ /**
26
+ * Immutable version of {@link RequestInfo}. This is what is passed to handlers.
27
+ *
28
+ */
29
+
30
+ function withBrand(obj) {
31
+ return obj;
32
+ }
33
+ export { EnableHydration, IS_FUTURE, STRUCTURED, SkipCache, withBrand };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request.js","sources":["../../src/types/request.ts"],"sourcesContent":["import { getOrSetGlobal, getOrSetUniversal } from './-private.ts';\nimport type { StableRecordIdentifier } from './identifier.ts';\nimport type { QueryParamsSerializationOptions } from './params.ts';\nimport type { ExtractSuggestedCacheTypes, Includes, TypedRecordInstance, TypeFromInstanceOrString } from './record.ts';\nimport type { ResourceIdentifierObject } from './spec/json-api-raw.ts';\nimport type { RequestSignature } from './symbols.ts';\n\ntype Store = unknown;\n\nexport const SkipCache: '___(unique) Symbol(SkipCache)' = getOrSetUniversal('SkipCache', Symbol.for('wd:skip-cache'));\nexport const EnableHydration: '___(unique) Symbol(EnableHydration)' = getOrSetUniversal(\n 'EnableHydration',\n Symbol.for('wd:enable-hydration')\n);\nexport const IS_FUTURE: '___(unique) Symbol(IS_FUTURE)' = getOrSetGlobal('IS_FUTURE', Symbol('IS_FUTURE'));\nexport const STRUCTURED: '___(unique) Symbol(DOC)' = getOrSetGlobal('DOC', Symbol('DOC'));\n\nexport type HTTPMethod =\n | 'QUERY'\n | 'GET'\n | 'OPTIONS'\n | 'POST'\n | 'PUT'\n | 'PATCH'\n | 'DELETE'\n | 'HEAD'\n | 'CONNECT'\n | 'TRACE';\n\n/**\n * Use these options to adjust CacheHandler behavior for a request.\n *\n */\nexport type CacheOptions<T = unknown> = {\n /**\n * A key that uniquely identifies this request. If not present, the url wil be used\n * as the key for any GET request, while all other requests will not be cached.\n *\n */\n key?: string;\n /**\n * If true, the request will be made even if a cached response is present\n * and not expired.\n *\n */\n reload?: boolean;\n /**\n * If true, and a cached response is present and not expired, the request\n * will be made in the background and the cached response will be returned.\n *\n */\n backgroundReload?: boolean;\n /**\n * Useful for metadata around when to invalidate the cache. Typically used\n * by strategies that invalidate requests by resource type when a new resource\n * of that type has been created. See the CachePolicy implementation\n * provided by `@ember-data/request-utils` for an example.\n *\n * It is recommended to only use this for query/queryRecord requests where\n * new records created later would affect the results, though using it for\n * findRecord requests is also supported if desired where it may be useful\n * when a create may affect the result of a sideloaded relationship.\n *\n * Generally it is better to patch the cache directly for relationship updates\n * than to invalidate findRecord requests for one.\n *\n */\n types?: T extends TypedRecordInstance ? ExtractSuggestedCacheTypes<T>[] : string[];\n\n /**\n * If true, the request will never be handled by the cache-manager and thus\n * will never resolve from cache nor update the cache.\n *\n * Generally this is only used for legacy request that manage resource cache\n * updates in a non-standard way via the LegacyNetworkHandler.\n *\n */\n [SkipCache]?: boolean;\n};\nexport type FindRecordRequestOptions<RT = unknown, T = unknown> = {\n url: string;\n method: 'GET';\n headers: Headers;\n cacheOptions?: CacheOptions<T>;\n op: 'findRecord';\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\nexport type QueryRequestOptions<RT = unknown, T = unknown> = {\n url: string;\n method: 'GET';\n headers: Headers;\n cacheOptions?: CacheOptions<T>;\n op: 'query';\n [RequestSignature]?: RT;\n};\n\nexport type PostQueryRequestOptions<RT = unknown, T = unknown> = {\n url: string;\n method: 'POST' | 'QUERY';\n headers: Headers;\n body?: string | BodyInit | FormData;\n cacheOptions: CacheOptions<T> & { key: string };\n op: 'query';\n [RequestSignature]?: RT;\n};\n\nexport type DeleteRequestOptions<RT = unknown, T = unknown> = {\n url: string;\n method: 'DELETE';\n headers: Headers;\n op: 'deleteRecord';\n body?: string | BodyInit | FormData;\n data: {\n record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n };\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\ntype ImmutableRequest<T> = Readonly<T> & {\n readonly headers: ImmutableHeaders;\n readonly records: [StableRecordIdentifier];\n};\n\nexport type UpdateRequestOptions<RT = unknown, T = unknown> = {\n url: string;\n method: 'PATCH' | 'PUT';\n headers: Headers;\n op: 'updateRecord';\n body?: string | BodyInit | FormData;\n data: {\n record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n };\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\nexport type CreateRequestOptions<RT = unknown, T = unknown> = {\n url: string;\n method: 'POST';\n headers: Headers;\n op: 'createRecord';\n body?: string | BodyInit | FormData;\n data: {\n record: StableRecordIdentifier<TypeFromInstanceOrString<T>>;\n };\n records: [ResourceIdentifierObject<TypeFromInstanceOrString<T>>];\n [RequestSignature]?: RT;\n};\n\nexport type ImmutableDeleteRequestOptions = ImmutableRequest<DeleteRequestOptions>;\nexport type ImmutableUpdateRequestOptions = ImmutableRequest<UpdateRequestOptions>;\nexport type ImmutableCreateRequestOptions = ImmutableRequest<CreateRequestOptions>;\n\nexport type RemotelyAccessibleIdentifier<T extends string = string> = {\n id: string;\n type: T;\n lid?: string;\n};\n\nexport type ConstrainedRequestOptions = {\n reload?: boolean;\n backgroundReload?: boolean;\n host?: string;\n namespace?: string;\n resourcePath?: string;\n urlParamsSettings?: QueryParamsSerializationOptions;\n};\n\nexport type FindRecordOptions<T = unknown> = ConstrainedRequestOptions & {\n include?: T extends TypedRecordInstance ? Includes<T>[] : string | string[];\n};\n\nexport interface StructuredDataDocument<T> {\n [STRUCTURED]?: true;\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n response: Response | ResponseInfo | null;\n content: T;\n}\nexport interface StructuredErrorDocument<T = unknown> extends Error {\n [STRUCTURED]?: true;\n request: ImmutableRequestInfo;\n response: Response | ResponseInfo | null;\n error: string | object;\n content?: T;\n}\nexport type StructuredDocument<T> = StructuredDataDocument<T> | StructuredErrorDocument<T>;\n\n/**\n * JavaScript's native Request class.\n *\n * WarpDrive provides our own typings due to incompleteness in the native typings.\n *\n */\ninterface Request {\n /** Returns the cache mode associated with request, which is a string indicating how the request will interact with the browser's cache when fetching.\n */\n cache?: RequestCache;\n /** Returns the credentials mode associated with request, which is a string indicating whether credentials will be sent with the request always, never, or only when sent to a same-origin URL.\n */\n credentials?: RequestCredentials;\n /** Returns the kind of resource requested by request, e.g., \"document\" or \"script\".\n */\n destination?: RequestDestination;\n /** Returns a Headers object consisting of the headers associated with request. Note that headers added in the network layer by the user agent will not be accounted for in this object, e.g., the \"Host\" header.\n */\n headers?: Headers;\n /** Returns request's subresource integrity metadata, which is a cryptographic hash of the resource being fetched. Its value consists of multiple hashes separated by whitespace. [SRI]\n */\n integrity?: string;\n /** Returns a boolean indicating whether or not request can outlive the global in which it was created.\n */\n keepalive?: boolean;\n /** Returns request's HTTP method, which is \"GET\" by default.\n */\n method?: HTTPMethod;\n /** Returns the mode associated with request, which is a string indicating whether the request will use CORS, or will be restricted to same-origin URLs.\n *\n * `no-cors` is not allowed for streaming request bodies.\n *\n */\n mode?: RequestMode;\n /** Returns the redirect mode associated with request, which is a string indicating how redirects for the request will be handled during fetching. A request will follow redirects by default.\n */\n redirect?: RequestRedirect;\n /** Returns the referrer of request. Its value can be a same-origin URL if explicitly set in init, the empty string to indicate no referrer, and \"about:client\" when defaulting to the global's default. This is used during fetching to determine the value of the `Referer` header of the request being made.\n */\n referrer?: string;\n /** Returns the referrer policy associated with request. This is used during fetching to compute the value of the request's referrer.\n */\n referrerPolicy?: ReferrerPolicy;\n /** Returns the signal associated with request, which is an AbortSignal object indicating whether or not request has been aborted, and its abort event handler.\n */\n signal?: AbortSignal;\n /** Returns the URL of request as a string.\n */\n url?: string;\n /** Any body that you want to add to your request. Note that a GET or HEAD request may not have a body.\n */\n body?: BodyInit | null;\n\n /**\n * When sending a ReadableStream as the body of a request, 'half' must be\n * specified.\n *\n * [Half Duplex Further Reading](https://developer.chrome.com/docs/capabilities/web-apis/fetch-streaming-requests#half_duplex)\n *\n */\n duplex?: 'half';\n}\n\nexport interface ImmutableHeaders extends Headers {\n clone?(): Headers;\n toJSON(): [string, string][];\n}\n\n/**\n * Extends JavaScript's native {@link Request} object with additional\n * properties specific to the RequestManager's capabilities.\n *\n */\nexport interface RequestInfo<RT = unknown, T = unknown> extends Request {\n /**\n * If provided, used instead of the AbortController auto-configured for each request by the RequestManager\n *\n */\n controller?: AbortController;\n\n /**\n * @see {@link CacheOptions}\n */\n cacheOptions?: CacheOptions<T>;\n store?: Store;\n\n op?: string;\n\n /**\n * The identifiers of the primary resources involved in the request\n * (if any). This may be used by handlers to perform transactional\n * operations on the store.\n *\n */\n records?: StableRecordIdentifier[];\n\n disableTestWaiter?: boolean;\n /**\n * data that a handler should convert into\n * the query (GET) or body (POST).\n *\n * Note: It is recommended that builders set query params\n * and body directly in most scenarios.\n *\n */\n data?: Record<string, unknown>;\n /**\n * options specifically intended for handlers\n * to utilize to process the request\n *\n */\n options?: Record<string, unknown>;\n\n [RequestSignature]?: RT;\n\n [EnableHydration]?: boolean;\n}\n\n/**\n * Immutable version of {@link RequestInfo}. This is what is passed to handlers.\n *\n */\nexport type ImmutableRequestInfo<RT = unknown, T = unknown> = Readonly<Omit<RequestInfo<RT, T>, 'controller'>> & {\n readonly cacheOptions?: Readonly<CacheOptions<T>>;\n readonly headers?: ImmutableHeaders;\n readonly data?: Readonly<Record<string, unknown>>;\n readonly options?: Readonly<Record<string, unknown>>;\n\n /** Whether the request body has been read.\n */\n readonly bodyUsed?: boolean;\n};\n\nexport interface ResponseInfo {\n readonly headers: ImmutableHeaders; // to do, maybe not this?\n readonly ok: boolean;\n readonly redirected: boolean;\n readonly status: number;\n readonly statusText: string;\n readonly type: ResponseType;\n readonly url: string;\n}\n\nexport interface RequestContext {\n /**\n * @see {@link ImmutableRequestInfo}\n */\n request: ImmutableRequestInfo;\n id: number;\n\n setStream(stream: ReadableStream | Promise<ReadableStream | null>): void;\n setResponse(response: Response | ResponseInfo | null): void;\n}\n\nexport function withBrand<T>(obj: RequestInfo): RequestInfo<T> & { [RequestSignature]: T } {\n return obj as RequestInfo<T> & {\n [RequestSignature]: T;\n };\n}\n"],"names":["SkipCache","getOrSetUniversal","Symbol","for","EnableHydration","IS_FUTURE","getOrSetGlobal","STRUCTURED","withBrand","obj"],"mappings":";;AASaA,MAAAA,SAA0C,GAAGC,iBAAiB,CAAC,WAAW,EAAEC,MAAM,CAACC,GAAG,CAAC,eAAe,CAAC;AACvGC,MAAAA,eAAsD,GAAGH,iBAAiB,CACrF,iBAAiB,EACjBC,MAAM,CAACC,GAAG,CAAC,qBAAqB,CAClC;AACO,MAAME,SAA0C,GAAGC,cAAc,CAAC,WAAW,EAAEJ,MAAM,CAAC,WAAW,CAAC;AAClG,MAAMK,UAAqC,GAAGD,cAAc,CAAC,KAAK,EAAEJ,MAAM,CAAC,KAAK,CAAC;;AAcxF;AACA;AACA;AACA;;AAiKA;AACA;AACA;AACA;AACA;AACA;;AA+DA;AACA;AACA;AACA;AACA;;AA8CA;AACA;AACA;AACA;;AAiCO,SAASM,SAASA,CAAIC,GAAgB,EAA8C;AACzF,EAAA,OAAOA,GAAG;AAGZ;;;;"}
@@ -0,0 +1,34 @@
1
+ import { getOrSetUniversal } from "./-private.js";
2
+ const RuntimeConfig = getOrSetUniversal('WarpDriveRuntimeConfig', {
3
+ debug: {}
4
+ });
5
+ function trySessionStorage() {
6
+ // This works even when sessionStorage is not available.
7
+ // See https://github.com/emberjs/data/issues/9784
8
+ try {
9
+ return globalThis.sessionStorage;
10
+ } catch {
11
+ return undefined;
12
+ }
13
+ }
14
+ const storage = trySessionStorage();
15
+ const settings = storage?.getItem('WarpDriveRuntimeConfig');
16
+ if (settings) {
17
+ Object.assign(RuntimeConfig, JSON.parse(settings));
18
+ }
19
+ function getRuntimeConfig() {
20
+ return RuntimeConfig;
21
+ }
22
+
23
+ /**
24
+ * Upserts the specified logging configuration into the runtime
25
+ * config.
26
+ *
27
+ * globalThis.setWarpDriveLogging({ LOG_CACHE: true } });
28
+ *
29
+ */
30
+ function setLogging(config) {
31
+ Object.assign(RuntimeConfig.debug, config);
32
+ storage?.setItem('WarpDriveRuntimeConfig', JSON.stringify(RuntimeConfig));
33
+ }
34
+ export { getRuntimeConfig, setLogging };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime.js","sources":["../../src/types/runtime.ts"],"sourcesContent":["import type { LOG_CONFIG } from '@warp-drive/build-config/-private/utils/logging';\n\nimport { getOrSetUniversal } from './-private.ts';\n\nconst RuntimeConfig: { debug: Partial<LOG_CONFIG> } = getOrSetUniversal('WarpDriveRuntimeConfig', {\n debug: {},\n});\n\nfunction trySessionStorage() {\n // This works even when sessionStorage is not available.\n // See https://github.com/emberjs/data/issues/9784\n try {\n return globalThis.sessionStorage;\n } catch {\n return undefined;\n }\n}\n\nconst storage = trySessionStorage();\nconst settings = storage?.getItem('WarpDriveRuntimeConfig');\nif (settings) {\n Object.assign(RuntimeConfig, JSON.parse(settings));\n}\n\nexport function getRuntimeConfig(): typeof RuntimeConfig {\n return RuntimeConfig;\n}\n\n/**\n * Upserts the specified logging configuration into the runtime\n * config.\n *\n * globalThis.setWarpDriveLogging({ LOG_CACHE: true } });\n *\n */\nexport function setLogging(config: Partial<LOG_CONFIG>): void {\n Object.assign(RuntimeConfig.debug, config);\n storage?.setItem('WarpDriveRuntimeConfig', JSON.stringify(RuntimeConfig));\n}\n"],"names":["RuntimeConfig","getOrSetUniversal","debug","trySessionStorage","globalThis","sessionStorage","undefined","storage","settings","getItem","Object","assign","JSON","parse","getRuntimeConfig","setLogging","config","setItem","stringify"],"mappings":";;AAIA,MAAMA,aAA6C,GAAGC,iBAAiB,CAAC,wBAAwB,EAAE;AAChGC,EAAAA,KAAK,EAAE;AACT,CAAC,CAAC;AAEF,SAASC,iBAAiBA,GAAG;AAC3B;AACA;EACA,IAAI;IACF,OAAOC,UAAU,CAACC,cAAc;AAClC,GAAC,CAAC,MAAM;AACN,IAAA,OAAOC,SAAS;AAClB;AACF;AAEA,MAAMC,OAAO,GAAGJ,iBAAiB,EAAE;AACnC,MAAMK,QAAQ,GAAGD,OAAO,EAAEE,OAAO,CAAC,wBAAwB,CAAC;AAC3D,IAAID,QAAQ,EAAE;EACZE,MAAM,CAACC,MAAM,CAACX,aAAa,EAAEY,IAAI,CAACC,KAAK,CAACL,QAAQ,CAAC,CAAC;AACpD;AAEO,SAASM,gBAAgBA,GAAyB;AACvD,EAAA,OAAOd,aAAa;AACtB;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACO,SAASe,UAAUA,CAACC,MAA2B,EAAQ;EAC5DN,MAAM,CAACC,MAAM,CAACX,aAAa,CAACE,KAAK,EAAEc,MAAM,CAAC;EAC1CT,OAAO,EAAEU,OAAO,CAAC,wBAAwB,EAAEL,IAAI,CAACM,SAAS,CAAClB,aAAa,CAAC,CAAC;AAC3E;;;;"}
File without changes
@@ -0,0 +1 @@
1
+ {"version":3,"file":"concepts.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}