@backendrelay/core 1.1.0 → 2.0.0

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 (598) hide show
  1. package/dist/standalone/index.js +1 -1
  2. package/dist/standalone/index.umd.cjs +1 -1
  3. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts +20 -0
  4. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  5. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js +5 -0
  6. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js.map +1 -0
  7. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts +2 -0
  8. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  9. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js +88 -0
  10. package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js.map +1 -0
  11. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts +2 -0
  12. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts.map +1 -0
  13. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js +131 -0
  14. package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js.map +1 -0
  15. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts +2 -0
  16. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts.map +1 -0
  17. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js +65 -0
  18. package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js.map +1 -0
  19. package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts +725 -0
  20. package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts.map +1 -0
  21. package/node_modules/@backendrelay/admin/dist/commonjs/index.js +1159 -0
  22. package/node_modules/@backendrelay/admin/dist/commonjs/index.js.map +1 -0
  23. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts +2 -0
  24. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  25. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js +91 -0
  26. package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js.map +1 -0
  27. package/node_modules/@backendrelay/admin/dist/commonjs/package.json +3 -0
  28. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts +17 -0
  29. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts.map +1 -0
  30. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js +26 -0
  31. package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js.map +1 -0
  32. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts +2 -0
  33. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts.map +1 -0
  34. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js +50 -0
  35. package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js.map +1 -0
  36. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts +2 -0
  37. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts.map +1 -0
  38. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js +33 -0
  39. package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js.map +1 -0
  40. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts +39 -0
  41. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts.map +1 -0
  42. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js +306 -0
  43. package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js.map +1 -0
  44. package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts +3 -0
  45. package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts.map +1 -0
  46. package/node_modules/@backendrelay/admin/dist/commonjs/version.js +5 -0
  47. package/node_modules/@backendrelay/admin/dist/commonjs/version.js.map +1 -0
  48. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts +20 -0
  49. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  50. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js +4 -0
  51. package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js.map +1 -0
  52. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts +2 -0
  53. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts.map +1 -0
  54. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js +86 -0
  55. package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js.map +1 -0
  56. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts +2 -0
  57. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts.map +1 -0
  58. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js +129 -0
  59. package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js.map +1 -0
  60. package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts +2 -0
  61. package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts.map +1 -0
  62. package/node_modules/@backendrelay/admin/dist/esm/config.test.js +63 -0
  63. package/node_modules/@backendrelay/admin/dist/esm/config.test.js.map +1 -0
  64. package/node_modules/@backendrelay/admin/dist/esm/index.d.ts +725 -0
  65. package/node_modules/@backendrelay/admin/dist/esm/index.d.ts.map +1 -0
  66. package/node_modules/@backendrelay/admin/dist/esm/index.js +1146 -0
  67. package/node_modules/@backendrelay/admin/dist/esm/index.js.map +1 -0
  68. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts +2 -0
  69. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts.map +1 -0
  70. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js +89 -0
  71. package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js.map +1 -0
  72. package/node_modules/@backendrelay/admin/dist/esm/package.json +3 -0
  73. package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts +17 -0
  74. package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts.map +1 -0
  75. package/node_modules/@backendrelay/admin/dist/esm/polyfill.js +22 -0
  76. package/node_modules/@backendrelay/admin/dist/esm/polyfill.js.map +1 -0
  77. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts +2 -0
  78. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts.map +1 -0
  79. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js +48 -0
  80. package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js.map +1 -0
  81. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts +2 -0
  82. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts.map +1 -0
  83. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js +31 -0
  84. package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js.map +1 -0
  85. package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts +39 -0
  86. package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts.map +1 -0
  87. package/node_modules/@backendrelay/admin/dist/esm/subscribe.js +300 -0
  88. package/node_modules/@backendrelay/admin/dist/esm/subscribe.js.map +1 -0
  89. package/node_modules/@backendrelay/admin/dist/esm/version.d.ts +3 -0
  90. package/node_modules/@backendrelay/admin/dist/esm/version.d.ts.map +1 -0
  91. package/{src/version.ts → node_modules/@backendrelay/admin/dist/esm/version.js} +1 -1
  92. package/node_modules/@backendrelay/admin/dist/esm/version.js.map +1 -0
  93. package/node_modules/@backendrelay/admin/package.json +52 -0
  94. package/node_modules/@backendrelay/functions/README.md +131 -0
  95. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts +3 -0
  96. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  97. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js +3 -0
  98. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js.map +1 -0
  99. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts +2 -0
  100. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  101. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js +51 -0
  102. package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js.map +1 -0
  103. package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts +230 -0
  104. package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts.map +1 -0
  105. package/node_modules/@backendrelay/functions/dist/commonjs/index.js +415 -0
  106. package/node_modules/@backendrelay/functions/dist/commonjs/index.js.map +1 -0
  107. package/node_modules/@backendrelay/functions/dist/commonjs/package.json +3 -0
  108. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts +3 -0
  109. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  110. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js +2 -0
  111. package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js.map +1 -0
  112. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts +2 -0
  113. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts.map +1 -0
  114. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js +49 -0
  115. package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js.map +1 -0
  116. package/node_modules/@backendrelay/functions/dist/esm/index.d.ts +230 -0
  117. package/node_modules/@backendrelay/functions/dist/esm/index.d.ts.map +1 -0
  118. package/node_modules/@backendrelay/functions/dist/esm/index.js +403 -0
  119. package/node_modules/@backendrelay/functions/dist/esm/index.js.map +1 -0
  120. package/node_modules/@backendrelay/functions/dist/esm/package.json +3 -0
  121. package/node_modules/@backendrelay/functions/package.json +49 -0
  122. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts +43 -0
  123. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts.map +1 -0
  124. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js +63 -0
  125. package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js.map +1 -0
  126. package/node_modules/@backendrelay/hatchet/dist/commonjs/package.json +3 -0
  127. package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts +43 -0
  128. package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts.map +1 -0
  129. package/node_modules/@backendrelay/hatchet/dist/esm/index.js +59 -0
  130. package/node_modules/@backendrelay/hatchet/dist/esm/index.js.map +1 -0
  131. package/node_modules/@backendrelay/hatchet/dist/esm/package.json +3 -0
  132. package/node_modules/@backendrelay/hatchet/package.json +46 -0
  133. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts +18 -0
  134. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts.map +1 -0
  135. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js +77 -0
  136. package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js.map +1 -0
  137. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts +99 -0
  138. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts.map +1 -0
  139. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js +177 -0
  140. package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js.map +1 -0
  141. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts +7 -0
  142. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts.map +1 -0
  143. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js +15 -0
  144. package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js.map +1 -0
  145. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts +3 -0
  146. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts.map +1 -0
  147. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js +46 -0
  148. package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js.map +1 -0
  149. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts +13 -0
  150. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts.map +1 -0
  151. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js +25 -0
  152. package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js.map +1 -0
  153. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts +285 -0
  154. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts.map +1 -0
  155. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js +426 -0
  156. package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js.map +1 -0
  157. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts +24 -0
  158. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts.map +1 -0
  159. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js +108 -0
  160. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js.map +1 -0
  161. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts +188 -0
  162. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts.map +1 -0
  163. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js +412 -0
  164. package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js.map +1 -0
  165. package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts +9 -0
  166. package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts.map +1 -0
  167. package/node_modules/@backendrelay/platform/dist/commonjs/api.js +12 -0
  168. package/node_modules/@backendrelay/platform/dist/commonjs/api.js.map +1 -0
  169. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts +89 -0
  170. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts.map +1 -0
  171. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js +357 -0
  172. package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js.map +1 -0
  173. package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts +146 -0
  174. package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts.map +1 -0
  175. package/node_modules/@backendrelay/platform/dist/commonjs/backups.js +251 -0
  176. package/node_modules/@backendrelay/platform/dist/commonjs/backups.js.map +1 -0
  177. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts +2 -0
  178. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts.map +1 -0
  179. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js +29 -0
  180. package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js.map +1 -0
  181. package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts +11 -0
  182. package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts.map +1 -0
  183. package/node_modules/@backendrelay/platform/dist/commonjs/consts.js +17 -0
  184. package/node_modules/@backendrelay/platform/dist/commonjs/consts.js.map +1 -0
  185. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts +4 -0
  186. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts.map +1 -0
  187. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js +26 -0
  188. package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js.map +1 -0
  189. package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts +19 -0
  190. package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts.map +1 -0
  191. package/node_modules/@backendrelay/platform/dist/commonjs/index.js +76 -0
  192. package/node_modules/@backendrelay/platform/dist/commonjs/index.js.map +1 -0
  193. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts +4 -0
  194. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts.map +1 -0
  195. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js +52 -0
  196. package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js.map +1 -0
  197. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts +99 -0
  198. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts.map +1 -0
  199. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js +597 -0
  200. package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js.map +1 -0
  201. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts +98 -0
  202. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts.map +1 -0
  203. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js +275 -0
  204. package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js.map +1 -0
  205. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts +12 -0
  206. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts.map +1 -0
  207. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js +26 -0
  208. package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js.map +1 -0
  209. package/node_modules/@backendrelay/platform/dist/commonjs/package.json +3 -0
  210. package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts +3 -0
  211. package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts.map +1 -0
  212. package/node_modules/@backendrelay/platform/dist/commonjs/perms.js +66 -0
  213. package/node_modules/@backendrelay/platform/dist/commonjs/perms.js.map +1 -0
  214. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts +13 -0
  215. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts.map +1 -0
  216. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js +31 -0
  217. package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js.map +1 -0
  218. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts +7 -0
  219. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts.map +1 -0
  220. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js +46 -0
  221. package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js.map +1 -0
  222. package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts +161 -0
  223. package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts.map +1 -0
  224. package/node_modules/@backendrelay/platform/dist/commonjs/schema.js +174 -0
  225. package/node_modules/@backendrelay/platform/dist/commonjs/schema.js.map +1 -0
  226. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts +25 -0
  227. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts.map +1 -0
  228. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js +68 -0
  229. package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js.map +1 -0
  230. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts +17 -0
  231. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts.map +1 -0
  232. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js +314 -0
  233. package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js.map +1 -0
  234. package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts +13 -0
  235. package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts.map +1 -0
  236. package/node_modules/@backendrelay/platform/dist/commonjs/util.js +55 -0
  237. package/node_modules/@backendrelay/platform/dist/commonjs/util.js.map +1 -0
  238. package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts +3 -0
  239. package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts.map +1 -0
  240. package/node_modules/@backendrelay/platform/dist/commonjs/version.js +5 -0
  241. package/node_modules/@backendrelay/platform/dist/commonjs/version.js.map +1 -0
  242. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts +18 -0
  243. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts.map +1 -0
  244. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js +73 -0
  245. package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js.map +1 -0
  246. package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts +99 -0
  247. package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts.map +1 -0
  248. package/node_modules/@backendrelay/platform/dist/esm/api/apps.js +165 -0
  249. package/node_modules/@backendrelay/platform/dist/esm/api/apps.js.map +1 -0
  250. package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts +7 -0
  251. package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts.map +1 -0
  252. package/node_modules/@backendrelay/platform/dist/esm/api/auth.js +12 -0
  253. package/node_modules/@backendrelay/platform/dist/esm/api/auth.js.map +1 -0
  254. package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts +3 -0
  255. package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts.map +1 -0
  256. package/node_modules/@backendrelay/platform/dist/esm/api/http.js +39 -0
  257. package/node_modules/@backendrelay/platform/dist/esm/api/http.js.map +1 -0
  258. package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts +13 -0
  259. package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts.map +1 -0
  260. package/node_modules/@backendrelay/platform/dist/esm/api/perms.js +21 -0
  261. package/node_modules/@backendrelay/platform/dist/esm/api/perms.js.map +1 -0
  262. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts +285 -0
  263. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts.map +1 -0
  264. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js +421 -0
  265. package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js.map +1 -0
  266. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts +24 -0
  267. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts.map +1 -0
  268. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js +99 -0
  269. package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js.map +1 -0
  270. package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts +188 -0
  271. package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts.map +1 -0
  272. package/node_modules/@backendrelay/platform/dist/esm/api/schema.js +393 -0
  273. package/node_modules/@backendrelay/platform/dist/esm/api/schema.js.map +1 -0
  274. package/node_modules/@backendrelay/platform/dist/esm/api.d.ts +9 -0
  275. package/node_modules/@backendrelay/platform/dist/esm/api.d.ts.map +1 -0
  276. package/node_modules/@backendrelay/platform/dist/esm/api.js +4 -0
  277. package/node_modules/@backendrelay/platform/dist/esm/api.js.map +1 -0
  278. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts +89 -0
  279. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts.map +1 -0
  280. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js +354 -0
  281. package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js.map +1 -0
  282. package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts +146 -0
  283. package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts.map +1 -0
  284. package/node_modules/@backendrelay/platform/dist/esm/backups.js +240 -0
  285. package/node_modules/@backendrelay/platform/dist/esm/backups.js.map +1 -0
  286. package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts +2 -0
  287. package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts.map +1 -0
  288. package/node_modules/@backendrelay/platform/dist/esm/clerk.js +26 -0
  289. package/node_modules/@backendrelay/platform/dist/esm/clerk.js.map +1 -0
  290. package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts +11 -0
  291. package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts.map +1 -0
  292. package/node_modules/@backendrelay/platform/dist/esm/consts.js +13 -0
  293. package/node_modules/@backendrelay/platform/dist/esm/consts.js.map +1 -0
  294. package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts +4 -0
  295. package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts.map +1 -0
  296. package/node_modules/@backendrelay/platform/dist/esm/crypto.js +21 -0
  297. package/node_modules/@backendrelay/platform/dist/esm/crypto.js.map +1 -0
  298. package/node_modules/@backendrelay/platform/dist/esm/index.d.ts +19 -0
  299. package/node_modules/@backendrelay/platform/dist/esm/index.d.ts.map +1 -0
  300. package/node_modules/@backendrelay/platform/dist/esm/index.js +18 -0
  301. package/node_modules/@backendrelay/platform/dist/esm/index.js.map +1 -0
  302. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts +4 -0
  303. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts.map +1 -0
  304. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js +47 -0
  305. package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js.map +1 -0
  306. package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts +99 -0
  307. package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts.map +1 -0
  308. package/node_modules/@backendrelay/platform/dist/esm/migrations.js +588 -0
  309. package/node_modules/@backendrelay/platform/dist/esm/migrations.js.map +1 -0
  310. package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts +98 -0
  311. package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts.map +1 -0
  312. package/node_modules/@backendrelay/platform/dist/esm/oauth.js +266 -0
  313. package/node_modules/@backendrelay/platform/dist/esm/oauth.js.map +1 -0
  314. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts +12 -0
  315. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts.map +1 -0
  316. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js +22 -0
  317. package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js.map +1 -0
  318. package/node_modules/@backendrelay/platform/dist/esm/package.json +3 -0
  319. package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts +3 -0
  320. package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts.map +1 -0
  321. package/node_modules/@backendrelay/platform/dist/esm/perms.js +62 -0
  322. package/node_modules/@backendrelay/platform/dist/esm/perms.js.map +1 -0
  323. package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts +13 -0
  324. package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts.map +1 -0
  325. package/node_modules/@backendrelay/platform/dist/esm/privateFields.js +28 -0
  326. package/node_modules/@backendrelay/platform/dist/esm/privateFields.js.map +1 -0
  327. package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts +7 -0
  328. package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts.map +1 -0
  329. package/node_modules/@backendrelay/platform/dist/esm/relationships.js +43 -0
  330. package/node_modules/@backendrelay/platform/dist/esm/relationships.js.map +1 -0
  331. package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts +161 -0
  332. package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts.map +1 -0
  333. package/node_modules/@backendrelay/platform/dist/esm/schema.js +158 -0
  334. package/node_modules/@backendrelay/platform/dist/esm/schema.js.map +1 -0
  335. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts +25 -0
  336. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts.map +1 -0
  337. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js +64 -0
  338. package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js.map +1 -0
  339. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts +17 -0
  340. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts.map +1 -0
  341. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js +310 -0
  342. package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js.map +1 -0
  343. package/node_modules/@backendrelay/platform/dist/esm/util.d.ts +13 -0
  344. package/node_modules/@backendrelay/platform/dist/esm/util.d.ts.map +1 -0
  345. package/node_modules/@backendrelay/platform/dist/esm/util.js +46 -0
  346. package/node_modules/@backendrelay/platform/dist/esm/util.js.map +1 -0
  347. package/node_modules/@backendrelay/platform/dist/esm/version.d.ts +3 -0
  348. package/node_modules/@backendrelay/platform/dist/esm/version.d.ts.map +1 -0
  349. package/node_modules/@backendrelay/platform/dist/esm/version.js +3 -0
  350. package/node_modules/@backendrelay/platform/dist/esm/version.js.map +1 -0
  351. package/node_modules/@backendrelay/platform/dist/standalone/index.js +13738 -0
  352. package/node_modules/@backendrelay/platform/dist/standalone/index.umd.cjs +72 -0
  353. package/node_modules/@backendrelay/platform/package.json +51 -0
  354. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts +67 -0
  355. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts.map +1 -0
  356. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js +129 -0
  357. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js.map +1 -0
  358. package/node_modules/@backendrelay/resumable-stream/dist/commonjs/package.json +3 -0
  359. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts +67 -0
  360. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts.map +1 -0
  361. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js +126 -0
  362. package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js.map +1 -0
  363. package/node_modules/@backendrelay/resumable-stream/dist/esm/package.json +3 -0
  364. package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.js +4354 -0
  365. package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.umd.cjs +6 -0
  366. package/node_modules/@backendrelay/resumable-stream/package.json +47 -0
  367. package/node_modules/@backendrelay/rules/README.md +34 -0
  368. package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts +117 -0
  369. package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts.map +1 -0
  370. package/node_modules/@backendrelay/rules/dist/commonjs/index.js +68 -0
  371. package/node_modules/@backendrelay/rules/dist/commonjs/index.js.map +1 -0
  372. package/node_modules/@backendrelay/rules/dist/commonjs/package.json +3 -0
  373. package/node_modules/@backendrelay/rules/dist/esm/index.d.ts +117 -0
  374. package/node_modules/@backendrelay/rules/dist/esm/index.d.ts.map +1 -0
  375. package/node_modules/@backendrelay/rules/dist/esm/index.js +64 -0
  376. package/node_modules/@backendrelay/rules/dist/esm/index.js.map +1 -0
  377. package/node_modules/@backendrelay/rules/dist/esm/package.json +3 -0
  378. package/node_modules/@backendrelay/rules/package.json +46 -0
  379. package/node_modules/@backendrelay/test/README.md +75 -0
  380. package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts +74 -0
  381. package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts.map +1 -0
  382. package/node_modules/@backendrelay/test/dist/commonjs/index.js +197 -0
  383. package/node_modules/@backendrelay/test/dist/commonjs/index.js.map +1 -0
  384. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts +2 -0
  385. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  386. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js +45 -0
  387. package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js.map +1 -0
  388. package/node_modules/@backendrelay/test/dist/commonjs/package.json +3 -0
  389. package/node_modules/@backendrelay/test/dist/esm/index.d.ts +74 -0
  390. package/node_modules/@backendrelay/test/dist/esm/index.d.ts.map +1 -0
  391. package/node_modules/@backendrelay/test/dist/esm/index.js +192 -0
  392. package/node_modules/@backendrelay/test/dist/esm/index.js.map +1 -0
  393. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts +2 -0
  394. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts.map +1 -0
  395. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js +43 -0
  396. package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js.map +1 -0
  397. package/node_modules/@backendrelay/test/dist/esm/package.json +3 -0
  398. package/node_modules/@backendrelay/test/package.json +49 -0
  399. package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts +3 -0
  400. package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts.map +1 -0
  401. package/node_modules/@backendrelay/version/dist/commonjs/index.js +6 -0
  402. package/node_modules/@backendrelay/version/dist/commonjs/index.js.map +1 -0
  403. package/node_modules/@backendrelay/version/dist/commonjs/package.json +3 -0
  404. package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts +3 -0
  405. package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts.map +1 -0
  406. package/node_modules/@backendrelay/version/dist/commonjs/version.js +10 -0
  407. package/node_modules/@backendrelay/version/dist/commonjs/version.js.map +1 -0
  408. package/node_modules/@backendrelay/version/dist/esm/index.d.ts +3 -0
  409. package/node_modules/@backendrelay/version/dist/esm/index.d.ts.map +1 -0
  410. package/node_modules/@backendrelay/version/dist/esm/index.js +3 -0
  411. package/node_modules/@backendrelay/version/dist/esm/index.js.map +1 -0
  412. package/node_modules/@backendrelay/version/dist/esm/package.json +3 -0
  413. package/node_modules/@backendrelay/version/dist/esm/version.d.ts +3 -0
  414. package/node_modules/@backendrelay/version/dist/esm/version.d.ts.map +1 -0
  415. package/node_modules/@backendrelay/version/dist/esm/version.js +7 -0
  416. package/node_modules/@backendrelay/version/dist/esm/version.js.map +1 -0
  417. package/node_modules/@backendrelay/version/dist/standalone/index.js +4 -0
  418. package/node_modules/@backendrelay/version/dist/standalone/index.umd.cjs +1 -0
  419. package/node_modules/@backendrelay/version/package.json +44 -0
  420. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts +12 -0
  421. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
  422. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js +5 -0
  423. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js.map +1 -0
  424. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts +2 -0
  425. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
  426. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js +82 -0
  427. package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js.map +1 -0
  428. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts +607 -0
  429. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts.map +1 -0
  430. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js +830 -0
  431. package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js.map +1 -0
  432. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts +2 -0
  433. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts.map +1 -0
  434. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js +139 -0
  435. package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js.map +1 -0
  436. package/node_modules/@backendrelay/webhooks/dist/commonjs/package.json +3 -0
  437. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts +12 -0
  438. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts.map +1 -0
  439. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js +4 -0
  440. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js.map +1 -0
  441. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts +2 -0
  442. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts.map +1 -0
  443. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js +80 -0
  444. package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js.map +1 -0
  445. package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts +607 -0
  446. package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts.map +1 -0
  447. package/node_modules/@backendrelay/webhooks/dist/esm/index.js +825 -0
  448. package/node_modules/@backendrelay/webhooks/dist/esm/index.js.map +1 -0
  449. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts +2 -0
  450. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts.map +1 -0
  451. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js +137 -0
  452. package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js.map +1 -0
  453. package/node_modules/@backendrelay/webhooks/dist/esm/package.json +3 -0
  454. package/node_modules/@backendrelay/webhooks/package.json +46 -0
  455. package/package.json +129 -56
  456. package/subpaths/admin/index.cjs +1 -0
  457. package/subpaths/admin/index.d.ts +1 -0
  458. package/subpaths/admin/index.mjs +3 -0
  459. package/subpaths/functions/index.cjs +1 -0
  460. package/subpaths/functions/index.d.ts +1 -0
  461. package/subpaths/functions/index.mjs +3 -0
  462. package/subpaths/hatchet/index.cjs +1 -0
  463. package/subpaths/hatchet/index.d.ts +1 -0
  464. package/subpaths/hatchet/index.mjs +3 -0
  465. package/subpaths/platform/index.cjs +1 -0
  466. package/subpaths/platform/index.d.ts +1 -0
  467. package/subpaths/platform/index.mjs +3 -0
  468. package/subpaths/resumable-stream/index.cjs +1 -0
  469. package/subpaths/resumable-stream/index.d.ts +1 -0
  470. package/subpaths/resumable-stream/index.mjs +3 -0
  471. package/subpaths/rules/index.cjs +1 -0
  472. package/subpaths/rules/index.d.ts +1 -0
  473. package/subpaths/rules/index.mjs +3 -0
  474. package/subpaths/test/index.cjs +1 -0
  475. package/subpaths/test/index.d.ts +1 -0
  476. package/subpaths/test/index.mjs +3 -0
  477. package/subpaths/version/index.cjs +1 -0
  478. package/subpaths/version/index.d.ts +1 -0
  479. package/subpaths/version/index.mjs +3 -0
  480. package/subpaths/webhooks/index.cjs +1 -0
  481. package/subpaths/webhooks/index.d.ts +1 -0
  482. package/subpaths/webhooks/index.mjs +3 -0
  483. package/.tshy/build.json +0 -8
  484. package/.tshy/commonjs.json +0 -16
  485. package/.tshy/esm.json +0 -15
  486. package/__example__/standalone.esm.html +0 -23
  487. package/__example__/standalone.umd.html +0 -21
  488. package/__tests__/src/Connection.test.ts +0 -292
  489. package/__tests__/src/IndexedDBStorage.test.ts +0 -96
  490. package/__tests__/src/Reactor.test.ts +0 -1179
  491. package/__tests__/src/auth-extra-fields.e2e.test.ts +0 -160
  492. package/__tests__/src/byop.e2e.test.ts +0 -762
  493. package/__tests__/src/config.test.ts +0 -85
  494. package/__tests__/src/cookieSync.e2e.test.ts +0 -163
  495. package/__tests__/src/data/movies/attrs.json +0 -145
  496. package/__tests__/src/data/movies/triples.json +0 -1507
  497. package/__tests__/src/data/zeneca/attrs.json +0 -251
  498. package/__tests__/src/data/zeneca/triples.json +0 -15854
  499. package/__tests__/src/datalog.test.ts +0 -175
  500. package/__tests__/src/devtool.test.ts +0 -23
  501. package/__tests__/src/framework.test.ts +0 -173
  502. package/__tests__/src/infiniteQuery.e2e.test.ts +0 -467
  503. package/__tests__/src/instaml.test.ts +0 -1593
  504. package/__tests__/src/instaql.bench.ts +0 -34
  505. package/__tests__/src/instaql.test.ts +0 -1497
  506. package/__tests__/src/instaqlInference.test.ts +0 -243
  507. package/__tests__/src/presence.test.ts +0 -49
  508. package/__tests__/src/queryValidation.test.ts +0 -1101
  509. package/__tests__/src/schema.test.ts +0 -653
  510. package/__tests__/src/serializeSchema.test.ts +0 -123
  511. package/__tests__/src/simple.e2e.test.ts +0 -133
  512. package/__tests__/src/storage-upload.test.ts +0 -37
  513. package/__tests__/src/store.test.ts +0 -960
  514. package/__tests__/src/syncTable.e2e.test.ts +0 -245
  515. package/__tests__/src/syncTable.test.ts +0 -235
  516. package/__tests__/src/transactionValidation.test.ts +0 -450
  517. package/__tests__/src/typeUtils.ts +0 -39
  518. package/__tests__/src/upstream-improvements.e2e.test.ts +0 -54
  519. package/__tests__/src/utils/MutationStorage.test.ts +0 -77
  520. package/__tests__/src/utils/PersistedObject.test.ts +0 -569
  521. package/__tests__/src/utils/dates.test.ts +0 -111
  522. package/__tests__/src/utils/e2e.ts +0 -100
  523. package/__tests__/src/utils/msw.ts +0 -3
  524. package/__tests__/src/utils/object.test.ts +0 -78
  525. package/__tests__/src/utils/weakHash.test.ts +0 -68
  526. package/__tests__/src/utils/weakHashLegacy.test.ts +0 -22
  527. package/__tests__/src/vite.env.d.ts +0 -1
  528. package/src/BackendRelayError.ts +0 -50
  529. package/src/Connection.ts +0 -361
  530. package/src/InMemoryStorage.ts +0 -34
  531. package/src/IndexedDBStorage.ts +0 -398
  532. package/src/Reactor.js +0 -1541
  533. package/src/StorageAPI.ts +0 -147
  534. package/src/Stream.ts +0 -1252
  535. package/src/SyncTable.ts +0 -750
  536. package/src/WindowNetworkListener.js +0 -19
  537. package/src/__types__/fieldsTypeTest.ts +0 -111
  538. package/src/__types__/typeUtils.ts +0 -39
  539. package/src/__types__/useDatesTypeTest.ts +0 -66
  540. package/src/attrTypes.ts +0 -37
  541. package/src/authAPI.ts +0 -205
  542. package/src/clientTypes.ts +0 -28
  543. package/src/coreTypes.ts +0 -58
  544. package/src/createRouteHandler.ts +0 -68
  545. package/src/datalog.js +0 -116
  546. package/src/devtool.ts +0 -179
  547. package/src/framework.ts +0 -450
  548. package/src/helperTypes.ts +0 -117
  549. package/src/index.ts +0 -1293
  550. package/src/infiniteQuery.ts +0 -599
  551. package/src/instaml.ts +0 -676
  552. package/src/instaql.ts +0 -999
  553. package/src/instatx.ts +0 -265
  554. package/src/model/instaqlResult.js +0 -25
  555. package/src/parseSchemaFromJSON.ts +0 -176
  556. package/src/presence.ts +0 -123
  557. package/src/presenceTypes.ts +0 -19
  558. package/src/queryTypes.ts +0 -749
  559. package/src/queryValidation.ts +0 -598
  560. package/src/reactorAuth.js +0 -236
  561. package/src/reactorEvents.js +0 -414
  562. package/src/reactorMutations.js +0 -354
  563. package/src/reactorRooms.js +0 -297
  564. package/src/reactorStorage.js +0 -180
  565. package/src/reactorSubs.js +0 -275
  566. package/src/reactorTransport.js +0 -391
  567. package/src/reactorTypes.ts +0 -41
  568. package/src/routeHandlerProtocol.ts +0 -25
  569. package/src/rulesTypes.ts +0 -132
  570. package/src/sanityCheckQueries.ts +0 -191
  571. package/src/schema.ts +0 -206
  572. package/src/schemaTypes.ts +0 -664
  573. package/src/store.ts +0 -1165
  574. package/src/transactionValidation.ts +0 -204
  575. package/src/urls.ts +0 -50
  576. package/src/utils/Deferred.ts +0 -20
  577. package/src/utils/MutationStorage.ts +0 -89
  578. package/src/utils/PersistedObject.ts +0 -612
  579. package/src/utils/dates.ts +0 -269
  580. package/src/utils/error.ts +0 -9
  581. package/src/utils/fetch.ts +0 -131
  582. package/src/utils/flags.ts +0 -14
  583. package/src/utils/id.ts +0 -28
  584. package/src/utils/linkIndex.ts +0 -33
  585. package/src/utils/log.ts +0 -23
  586. package/src/utils/object.js +0 -180
  587. package/src/utils/pgtime.ts +0 -199
  588. package/src/utils/pick.js +0 -9
  589. package/src/utils/strings.ts +0 -19
  590. package/src/utils/weakHash.ts +0 -77
  591. package/src/utils/weakHashLegacy.ts +0 -75
  592. package/src/warningToggle.ts +0 -5
  593. package/tsconfig.cjs.dev.json +0 -15
  594. package/tsconfig.dev.json +0 -14
  595. package/tsconfig.json +0 -13
  596. package/tsconfig.test.json +0 -5
  597. package/vite.config.ts +0 -19
  598. package/vitest.config.ts +0 -54
@@ -1,1497 +0,0 @@
1
- import { test, expect, vi } from 'vitest';
2
-
3
- import zenecaAttrs from './data/zeneca/attrs.json';
4
- import zenecaTriples from './data/zeneca/triples.json';
5
- import {
6
- createStore,
7
- transact,
8
- AttrsStoreClass,
9
- Store,
10
- AttrsStore,
11
- } from '../../src/store';
12
- import query from '../../src/instaql';
13
- import { tx, lookup } from '../../src/instatx';
14
- import { i } from '../../src/index';
15
- import * as instaml from '../../src/instaml';
16
- import { randomUUID } from 'crypto';
17
-
18
- const zenecaAttrsStore = new AttrsStoreClass(
19
- zenecaAttrs.reduce((res, x) => {
20
- res[x.id] = x;
21
- return res;
22
- }, {}),
23
- null,
24
- );
25
-
26
- const store = createStore(
27
- zenecaAttrsStore,
28
- zenecaTriples as [string, string, any, number][],
29
- );
30
-
31
- const ctx = { store, attrsStore: zenecaAttrsStore };
32
-
33
- test('Simple Query Without Where', () => {
34
- expect(
35
- query(ctx, { users: {} })
36
- .data.users.map((x) => x.handle)
37
- .sort(),
38
- ).toEqual(['alex', 'joe', 'nicolegf', 'stopa']);
39
- });
40
-
41
- test('Simple Where', () => {
42
- expect(
43
- query(ctx, { users: { $: { where: { handle: 'joe' } } } })
44
- .data.users.map((x) => x.handle)
45
- .sort(),
46
- ).toEqual(['joe']);
47
- });
48
-
49
- test('Simple Where has expected keys', () => {
50
- expect(
51
- Object.keys(
52
- query(ctx, { users: { $: { where: { handle: 'joe' } } } }).data.users[0],
53
- ).sort(),
54
- ).toEqual(['createdAt', 'email', 'fullName', 'handle', 'id']);
55
- });
56
-
57
- test('Simple Where with multiple clauses', () => {
58
- expect(
59
- query(ctx, {
60
- users: {
61
- $: {
62
- where: {
63
- 'bookshelves.books.title': 'The Count of Monte Cristo',
64
- handle: 'stopa',
65
- },
66
- },
67
- },
68
- })
69
- .data.users.map((x) => x.handle)
70
- .sort(),
71
- ).toEqual(['stopa']);
72
-
73
- expect(
74
- query(ctx, {
75
- users: {
76
- $: {
77
- where: {
78
- 'bookshelves.books.title': 'Title nobody has',
79
- handle: 'stopa',
80
- },
81
- },
82
- },
83
- })
84
- .data.users.map((x) => x.handle)
85
- .sort(),
86
- ).toEqual([]);
87
- });
88
-
89
- test('Where in', () => {
90
- expect(
91
- query(ctx, {
92
- users: {
93
- $: {
94
- where: {
95
- handle: { in: ['stopa', 'joe'] },
96
- },
97
- },
98
- },
99
- })
100
- .data.users.map((x) => x.handle)
101
- .sort(),
102
- ).toEqual(['joe', 'stopa']);
103
-
104
- expect(
105
- query(ctx, {
106
- users: {
107
- $: {
108
- where: {
109
- handle: { $in: ['stopa', 'joe'] },
110
- },
111
- },
112
- },
113
- })
114
- .data.users.map((x) => x.handle)
115
- .sort(),
116
- ).toEqual(['joe', 'stopa']);
117
- });
118
-
119
- // `$search` and `$nearest` are applied by the server; the client projects the
120
- // already-filtered store and must not treat the operator object as a value.
121
- test('Where $search is applied by the server only', () => {
122
- expect(
123
- query(ctx, {
124
- users: {
125
- $: {
126
- where: {
127
- handle: { $search: 'joe' },
128
- },
129
- },
130
- },
131
- })
132
- .data.users.map((x) => x.handle)
133
- .sort(),
134
- ).toEqual(['alex', 'joe', 'nicolegf', 'stopa']);
135
- });
136
-
137
- test('Where $search keeps other local operators on the same attr', () => {
138
- expect(
139
- query(ctx, {
140
- users: {
141
- $: {
142
- where: {
143
- handle: { $search: 'jo', $like: '%jo%' },
144
- },
145
- },
146
- },
147
- })
148
- .data.users.map((x) => x.handle)
149
- .sort(),
150
- ).toEqual(['joe']);
151
- });
152
-
153
- test('Where an OR with $search is left to the server', () => {
154
- expect(
155
- query(ctx, {
156
- users: {
157
- $: {
158
- where: {
159
- or: [{ handle: { $search: 'joe' } }, { handle: 'alex' }],
160
- },
161
- },
162
- },
163
- })
164
- .data.users.map((x) => x.handle)
165
- .sort(),
166
- ).toEqual(['alex', 'joe', 'nicolegf', 'stopa']);
167
- });
168
-
169
- test('Where $nearest is applied by the server only', () => {
170
- expect(
171
- query(ctx, {
172
- users: {
173
- $: {
174
- where: {
175
- handle: { $nearest: [1, 2, 3] },
176
- },
177
- },
178
- },
179
- })
180
- .data.users.map((x) => x.handle)
181
- .sort(),
182
- ).toEqual(['alex', 'joe', 'nicolegf', 'stopa']);
183
- });
184
-
185
- test('Where %like%', () => {
186
- expect(
187
- query(ctx, {
188
- users: {
189
- $: {
190
- where: {
191
- handle: { $like: '%o%' },
192
- },
193
- },
194
- },
195
- })
196
- .data.users.map((x) => x.handle)
197
- .sort(),
198
- ).toEqual(['joe', 'nicolegf', 'stopa']);
199
- });
200
-
201
- test('Where like equality', () => {
202
- expect(
203
- query(ctx, {
204
- users: {
205
- $: {
206
- where: {
207
- handle: { $like: 'joe' },
208
- },
209
- },
210
- },
211
- })
212
- .data.users.map((x) => x.handle)
213
- .sort(),
214
- ).toEqual(['joe']);
215
- });
216
-
217
- test('Where startsWith deep', () => {
218
- expect(
219
- query(ctx, {
220
- users: {
221
- $: {
222
- where: {
223
- 'bookshelves.books.title': { $like: '%Monte Cristo' },
224
- },
225
- },
226
- },
227
- })
228
- .data.users.map((x) => x.handle)
229
- .sort(),
230
- ).toEqual(['nicolegf', 'stopa']);
231
- });
232
-
233
- test('Where endsWith deep', () => {
234
- expect(
235
- query(ctx, {
236
- users: {
237
- $: {
238
- where: {
239
- 'bookshelves.books.title': { $like: 'Anti%' },
240
- },
241
- },
242
- },
243
- })
244
- .data.users.map((x) => x.handle)
245
- .sort(),
246
- ).toEqual(['alex', 'nicolegf', 'stopa']);
247
- });
248
-
249
- test('like case sensitivity', () => {
250
- function runQuery(where) {
251
- return query(ctx, {
252
- users: {
253
- $: {
254
- where: {
255
- fullName: where,
256
- },
257
- },
258
- },
259
- })
260
- .data.users.map((x) => x.fullName)
261
- .sort();
262
- }
263
- expect(runQuery({ $like: '%O%' })).toEqual([]);
264
- expect(runQuery({ $ilike: '%O%' })).toEqual(['Joe Averbukh', 'Nicole']);
265
- expect(runQuery({ $like: '%j%' })).toEqual([]);
266
- expect(runQuery({ $ilike: '%j%' })).toEqual(['Joe Averbukh']);
267
- });
268
-
269
- test('like special regex characters', () => {
270
- // Special characters that need escaping in regex
271
- const specialChars = [
272
- ['(', 'Stopa (The Hacker)'],
273
- [')', 'The Hacker (Stopa)'],
274
- ['[', 'Stopa [Hacker]'],
275
- [']', '[Hacker] Stopa'],
276
- ['{', 'Stopa {Hacker}'],
277
- ['}', '{Hacker} Stopa'],
278
- ['*', 'Stopa * Hacker'],
279
- ['+', 'Stopa + Hacker'],
280
- ['?', 'Stopa? Yes!'],
281
- ['^', 'Stopa ^ Hacker'],
282
- ['$', 'Stopa $ Hacker'],
283
- ['|', 'Stopa | Hacker'],
284
- ['\\', 'Stopa \\ Hacker'],
285
- ['.', 'Mr. Stopa'],
286
- ];
287
-
288
- function renameStopa(store, newName) {
289
- const chunk = tx.users[lookup('handle', 'stopa')].update({
290
- fullName: newName,
291
- });
292
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunk);
293
- return transact(store, zenecaAttrsStore, txSteps);
294
- }
295
-
296
- for (const [char, newName] of specialChars) {
297
- const newCtx = renameStopa(store, newName);
298
- const res = query(newCtx, {
299
- users: {
300
- $: { where: { fullName: { $like: `%${char}%` } } },
301
- },
302
- }).data.users;
303
- expect(res[0]?.fullName).toBe(newName);
304
- }
305
- });
306
-
307
- test('Where and', () => {
308
- expect(
309
- query(ctx, {
310
- users: {
311
- $: {
312
- where: {
313
- and: [
314
- { 'bookshelves.books.title': 'The Count of Monte Cristo' },
315
- { 'bookshelves.books.title': 'Antifragile' },
316
- ],
317
- },
318
- },
319
- },
320
- })
321
- .data.users.map((x) => x.handle)
322
- .sort(),
323
- ).toEqual(['nicolegf', 'stopa']);
324
- });
325
-
326
- test.each([
327
- [
328
- 'multiple OR matches',
329
- {
330
- or: [{ handle: 'stopa' }, { handle: 'joe' }],
331
- },
332
- ['joe', 'stopa'],
333
- ],
334
- [
335
- 'mix of matching and non-matching',
336
- {
337
- or: [{ handle: 'nobody' }, { handle: 'stopa' }, { handle: 'everybody' }],
338
- },
339
- ['stopa'],
340
- ],
341
- [
342
- 'with and',
343
- {
344
- 'bookshelves.books.title': 'The Count of Monte Cristo',
345
- or: [{ handle: 'joe' }, { handle: 'stopa' }],
346
- },
347
- ['stopa'],
348
- ],
349
- [
350
- 'with references',
351
- {
352
- or: [
353
- { handle: 'joe' },
354
- {
355
- handle: 'stopa',
356
- 'bookshelves.books.title': 'The Count of Monte Cristo',
357
- },
358
- ],
359
- },
360
- ['joe', 'stopa'],
361
- ],
362
- [
363
- 'with references in both `or` & `and` clauses, no matches',
364
- {
365
- 'bookshelves.books.title': 'Unknown',
366
- or: [
367
- { handle: 'joe' },
368
- {
369
- handle: 'stopa',
370
- 'bookshelves.books.title': 'The Count of Monte Cristo',
371
- },
372
- ],
373
- },
374
- [],
375
- ],
376
- [
377
- 'with references in both `or` & `and` clauses, with matches',
378
- {
379
- 'bookshelves.books.title': 'A Promised Land',
380
- or: [
381
- {
382
- handle: 'stopa',
383
- 'bookshelves.books.title': 'The Count of Monte Cristo',
384
- },
385
- {
386
- handle: 'joe',
387
- },
388
- ],
389
- },
390
- ['joe'],
391
- ],
392
- [
393
- 'with nested ors',
394
- {
395
- or: [
396
- { or: [{ handle: 'stopa' }] },
397
- {
398
- handle: 'joe',
399
- },
400
- ],
401
- },
402
- ['joe', 'stopa'],
403
- ],
404
- [
405
- 'with ands in ors',
406
- {
407
- or: [
408
- {
409
- or: [
410
- {
411
- and: [
412
- { or: [{ handle: 'stopa' }, { handle: 'joe' }] },
413
- { email: 'stopa@backendrelay.com' },
414
- ],
415
- },
416
- ],
417
- },
418
- {
419
- handle: 'joe',
420
- },
421
- ],
422
- },
423
- ['joe', 'stopa'],
424
- ],
425
- [
426
- 'with ands in ors in ands',
427
- {
428
- and: [
429
- { or: [{ and: [{ handle: 'stopa' }] }] },
430
- { or: [{ and: [{ or: [{ handle: 'stopa' }] }] }] },
431
- ],
432
- },
433
- ['stopa'],
434
- ],
435
- ])('Where OR %s', (_, whereQuery, expected) => {
436
- expect(
437
- query(ctx, {
438
- users: {
439
- $: {
440
- where: whereQuery,
441
- },
442
- },
443
- })
444
- .data.users.map((x) => x.handle)
445
- .sort(),
446
- ).toEqual(expected);
447
- });
448
-
449
- test('Get association', () => {
450
- expect(
451
- query(ctx, {
452
- users: {
453
- bookshelves: {},
454
- $: { where: { handle: 'alex' } },
455
- },
456
- }).data.users.map((x) => [
457
- x.handle,
458
- x.bookshelves.map((x) => x.name).sort(),
459
- ]),
460
- ).toEqual([['alex', ['Nonfiction', 'Short Stories']]]);
461
- });
462
-
463
- test('Get reverse association', () => {
464
- expect(
465
- query(ctx, {
466
- bookshelves: {
467
- users: {},
468
- $: { where: { name: 'Short Stories' } },
469
- },
470
- }).data.bookshelves.map((x) => [
471
- x.name,
472
- x.users.map((x) => x.handle).sort(),
473
- ]),
474
- ).toEqual([['Short Stories', ['alex']]]);
475
- });
476
-
477
- test('Get deep association', () => {
478
- expect(
479
- query(ctx, {
480
- users: {
481
- bookshelves: { books: {} },
482
- $: { where: { handle: 'alex' } },
483
- },
484
- })
485
- .data.users.flatMap((x) => x.bookshelves)
486
- .flatMap((x) => x.books)
487
- .map((x) => x.title),
488
- ).toEqual([
489
- `"Surely You're Joking, Mr. Feynman!": Adventures of a Curious Character`,
490
- '"What Do You Care What Other People Think?": Further Adventures of a Curious Character',
491
- 'The Spy and the Traitor',
492
- 'Antifragile',
493
- 'Atomic Habits',
494
- 'Catch and Kill',
495
- 'The Paper Menagerie and Other Stories',
496
- 'Stories of Your Life and Others',
497
- "Aesop's Fables",
498
- ]);
499
- });
500
-
501
- test('Nested wheres', () => {
502
- expect(
503
- query(ctx, {
504
- users: {
505
- bookshelves: {
506
- books: {},
507
- $: { where: { name: 'Short Stories' } },
508
- },
509
- $: { where: { handle: 'alex' } },
510
- },
511
- })
512
- .data.users.flatMap((x) => x.bookshelves)
513
- .flatMap((x) => x.books)
514
- .map((x) => x.title),
515
- ).toEqual([
516
- 'The Paper Menagerie and Other Stories',
517
- 'Stories of Your Life and Others',
518
- "Aesop's Fables",
519
- ]);
520
- });
521
-
522
- test('Nested wheres with OR queries', () => {
523
- expect(
524
- query(ctx, {
525
- users: {
526
- bookshelves: {
527
- books: {},
528
- $: {
529
- where: { or: [{ name: 'Short Stories' }] },
530
- },
531
- },
532
- $: { where: { handle: 'alex' } },
533
- },
534
- })
535
- .data.users.flatMap((x) => x.bookshelves)
536
- .flatMap((x) => x.books)
537
- .map((x) => x.title),
538
- ).toEqual([
539
- 'The Paper Menagerie and Other Stories',
540
- 'Stories of Your Life and Others',
541
- "Aesop's Fables",
542
- ]);
543
- });
544
-
545
- test('Nested wheres with AND queries', () => {
546
- expect(
547
- query(ctx, {
548
- users: {
549
- bookshelves: {
550
- books: {},
551
- $: {
552
- where: { and: [{ name: 'Short Stories' }, { order: 0 }] },
553
- },
554
- },
555
- $: { where: { handle: 'alex' } },
556
- },
557
- })
558
- .data.users.flatMap((x) => x.bookshelves)
559
- .flatMap((x) => x.books)
560
- .map((x) => x.title),
561
- ).toEqual([
562
- 'The Paper Menagerie and Other Stories',
563
- 'Stories of Your Life and Others',
564
- "Aesop's Fables",
565
- ]);
566
- });
567
-
568
- test('Deep where', () => {
569
- expect(
570
- query(ctx, {
571
- users: {
572
- $: { where: { 'bookshelves.books.title': "Aesop's Fables" } },
573
- },
574
- }).data.users.map((x) => x.handle),
575
- ).toEqual(['alex']);
576
- });
577
-
578
- test('Missing etype', () => {
579
- expect(query(ctx, { moopy: {} }).data).toEqual({ moopy: [] });
580
- });
581
-
582
- test('Missing inner etype', () => {
583
- expect(
584
- query(ctx, {
585
- users: {
586
- moopy: {},
587
- $: { where: { handle: 'joe' } },
588
- },
589
- })
590
- .data.users.map((x) => [x.handle, x.moopy])
591
- .sort(),
592
- ).toEqual([['joe', []]]);
593
- });
594
-
595
- test('Missing filter attr', () => {
596
- expect(
597
- query(ctx, {
598
- users: {
599
- $: { where: { 'bookshelves.moopy': 'joe' } },
600
- },
601
- }).data,
602
- ).toEqual({ users: [] });
603
- });
604
-
605
- test('multiple connections', () => {
606
- expect(
607
- query(ctx, {
608
- bookshelves: {
609
- books: {},
610
- users: {},
611
- $: { where: { name: 'Short Stories' } },
612
- },
613
- }).data.bookshelves.map((x) => [
614
- x.name,
615
- x.users.map((x) => x.handle).sort(),
616
- x.books.map((x) => x.title).sort(),
617
- ]),
618
- ).toEqual([
619
- [
620
- 'Short Stories',
621
- ['alex'],
622
- [
623
- "Aesop's Fables",
624
- 'Stories of Your Life and Others',
625
- 'The Paper Menagerie and Other Stories',
626
- ],
627
- ],
628
- ]);
629
- });
630
-
631
- test('query forward references work with and without id', () => {
632
- const bookshelf = query(ctx, {
633
- bookshelves: {
634
- $: { where: { 'users.handle': 'stopa' } },
635
- },
636
- }).data.bookshelves[0];
637
-
638
- const usersByBookshelfId = query(ctx, {
639
- users: {
640
- $: { where: { 'bookshelves.id': bookshelf.id } },
641
- },
642
- }).data.users.map((x) => x.handle);
643
-
644
- const usersByBookshelfLinkFIeld = query(ctx, {
645
- users: {
646
- $: { where: { bookshelves: bookshelf.id } },
647
- },
648
- }).data.users.map((x) => x.handle);
649
-
650
- expect(usersByBookshelfId).toEqual(['stopa']);
651
- expect(usersByBookshelfLinkFIeld).toEqual(['stopa']);
652
- });
653
-
654
- test('query reverse references work with and without id', () => {
655
- const stopa = query(ctx, {
656
- users: {
657
- $: { where: { handle: 'stopa' } },
658
- },
659
- }).data.users[0];
660
-
661
- const stopaBookshelvesByHandle = query(ctx, {
662
- bookshelves: {
663
- $: { where: { 'users.handle': 'stopa' } },
664
- },
665
- }).data.bookshelves;
666
-
667
- const stopaBookshelvesById = query(ctx, {
668
- bookshelves: {
669
- $: { where: { 'users.id': stopa.id } },
670
- },
671
- }).data.bookshelves;
672
-
673
- const stopaBookshelvesByLinkField = query(ctx, {
674
- bookshelves: {
675
- $: { where: { users: stopa.id } },
676
- },
677
- }).data.bookshelves;
678
-
679
- expect(stopaBookshelvesByHandle.length).toBe(16);
680
-
681
- expect(stopaBookshelvesByHandle).toEqual(stopaBookshelvesById);
682
- expect(stopaBookshelvesByHandle).toEqual(stopaBookshelvesByLinkField);
683
- });
684
-
685
- test('objects are created by etype', () => {
686
- const stopa = query(ctx, {
687
- users: {
688
- $: { where: { handle: 'stopa' } },
689
- },
690
- }).data.users[0];
691
- expect(stopa.email).toEqual('stopa@backendrelay.com');
692
- const chunk = tx.not_users[stopa.id].update({
693
- email: 'this-should-not-change-users-stopa@gmail.com',
694
- });
695
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunk);
696
- const newCtx = transact(store, zenecaAttrsStore, txSteps);
697
- const newStopa = query(newCtx, {
698
- users: {
699
- $: { where: { handle: 'stopa' } },
700
- },
701
- }).data.users[0];
702
- expect(newStopa.email).toEqual('stopa@backendrelay.com');
703
- });
704
-
705
- test('create and update triples in one tx', () => {
706
- const userId = randomUUID();
707
-
708
- const getUser = (ctx: { store: Store; attrsStore: AttrsStore }) =>
709
- query(ctx, { users: { $: { where: { id: userId } } } }).data.users[0];
710
-
711
- const chunk1 = tx.users[userId].create({
712
- email: 'e@mail',
713
- handle: 'handle',
714
- });
715
- const ctx1 = transact(
716
- store,
717
- zenecaAttrsStore,
718
- instaml.transform({ attrsStore: zenecaAttrsStore }, chunk1),
719
- );
720
- const user1 = getUser(ctx1);
721
- expect(user1.email).toEqual('e@mail');
722
- expect(user1.fullName).toEqual(undefined);
723
-
724
- const chunk2 = tx.users[userId].update(
725
- {
726
- email: 'e@mail 2',
727
- fullName: 'Full Name',
728
- },
729
- { upsert: false },
730
- );
731
- const ctx2 = transact(
732
- ctx1.store,
733
- ctx1.attrsStore,
734
- instaml.transform({ attrsStore: zenecaAttrsStore }, chunk2),
735
- );
736
- const user2 = getUser(ctx2);
737
- expect(user2.email).toEqual('e@mail 2');
738
- expect(user2.fullName).toEqual('Full Name');
739
- });
740
-
741
- test('object values', () => {
742
- const stopa = query(ctx, {
743
- users: {
744
- $: { where: { handle: 'stopa' } },
745
- },
746
- }).data.users[0];
747
- expect(stopa.email).toEqual('stopa@backendrelay.com');
748
- const chunk = tx.users[stopa.id].update({
749
- jsonField: { hello: 'world' },
750
- otherJsonField: { world: 'hello' },
751
- });
752
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunk);
753
- const newCtx = transact(store, zenecaAttrsStore, txSteps);
754
- const newStopa = query(newCtx, {
755
- users: {
756
- $: { where: { handle: 'stopa' } },
757
- },
758
- }).data.users[0];
759
-
760
- expect(newStopa.jsonField).toEqual({ hello: 'world' });
761
- });
762
-
763
- test('pagination limit', () => {
764
- const books = query(ctx, {
765
- books: {
766
- $: {
767
- limit: 10,
768
- },
769
- },
770
- }).data.books;
771
-
772
- expect(books.length).toEqual(10);
773
- });
774
-
775
- test('nested limit works but warns', () => {
776
- const warnMock = vi
777
- .spyOn(console, 'warn')
778
- .mockImplementation(() => undefined);
779
-
780
- const result = query(ctx, {
781
- bookshelves: {
782
- books: {
783
- $: {
784
- limit: 4,
785
- },
786
- },
787
- },
788
- });
789
-
790
- expect(result.data.bookshelves.length).toEqual(45);
791
- // Should be "6" but is limited to 4
792
- expect(result.data.bookshelves[1].books.length).toEqual(4);
793
- // Warning
794
- expect(warnMock).toHaveBeenCalled();
795
-
796
- warnMock.mockRestore();
797
- });
798
-
799
- test('pagination offset waits for pageInfo', () => {
800
- // If we don't have the pageInfo from the server, we have to
801
- // wait to know which items in the store we should return.
802
- // Otherwise, we might render optimistic changes for items
803
- // that aren't in our range.
804
- const booksWithOffset = query(ctx, {
805
- books: {
806
- $: {
807
- offset: 10,
808
- limit: 5,
809
- },
810
- },
811
- }).data.books;
812
-
813
- expect(booksWithOffset.length).toEqual(0);
814
-
815
- const booksWithPageInfo = query(
816
- {
817
- store,
818
- attrsStore: zenecaAttrsStore,
819
- pageInfo: {
820
- books: {
821
- 'start-cursor': [
822
- '000212ec-fe77-473d-9494-d29898c53b7a',
823
- '6eebf15a-ed3c-4442-8869-a44a7c85a1be',
824
- '000212ec-fe77-473d-9494-d29898c53b7a',
825
- 1718118155976,
826
- ],
827
- 'end-cursor': [
828
- '0270a27f-1363-4f6d-93c0-39cc43d92a78',
829
- '6eebf15a-ed3c-4442-8869-a44a7c85a1be',
830
- '0270a27f-1363-4f6d-93c0-39cc43d92a78',
831
- 1718118151976,
832
- ],
833
- },
834
- },
835
- },
836
- {
837
- books: {
838
- $: {
839
- offset: 10,
840
- limit: 5,
841
- order: { serverCreatedAt: 'desc' },
842
- },
843
- },
844
- },
845
- ).data.books;
846
-
847
- expect(booksWithPageInfo.map((b) => b.title)).toEqual([
848
- 'Norse Mythology',
849
- 'Love-at-Arms',
850
- 'The Young Lions',
851
- 'The Hounds of God',
852
- 'Which Comes First, Cardio or Weights?',
853
- ]);
854
-
855
- const booksWithPageInfoAsc = query(
856
- {
857
- store,
858
- attrsStore: zenecaAttrsStore,
859
- pageInfo: {
860
- books: {
861
- 'start-cursor': [
862
- 'f11c998f-d951-426b-b2b1-ffcb8d17bac5',
863
- '6eebf15a-ed3c-4442-8869-a44a7c85a1be',
864
- 'f11c998f-d951-426b-b2b1-ffcb8d17bac5',
865
- 1718117715976,
866
- ],
867
- 'end-cursor': [
868
- 'f1c15604-93cd-4189-bb9a-d4ee97b95f32',
869
- '6eebf15a-ed3c-4442-8869-a44a7c85a1be',
870
- 'f1c15604-93cd-4189-bb9a-d4ee97b95f32',
871
- 1718117721976,
872
- ],
873
- },
874
- },
875
- },
876
- {
877
- books: {
878
- $: {
879
- offset: 10,
880
- limit: 5,
881
- order: { serverCreatedAt: 'asc' },
882
- },
883
- },
884
- },
885
- ).data.books;
886
-
887
- expect(booksWithPageInfoAsc.map((b) => b.title)).toEqual([
888
- 'Sum',
889
- 'Insurgent',
890
- 'The Rational Male',
891
- 'The Restaurant at the End of the Universe',
892
- 'Bardelys the Magnificent',
893
- ]);
894
- });
895
-
896
- test('pagination last', () => {
897
- const books = query(ctx, {
898
- books: {
899
- $: {
900
- last: 10,
901
- },
902
- },
903
- }).data.books;
904
-
905
- expect(books.length).toEqual(10);
906
- });
907
-
908
- test('pagination first', () => {
909
- const books = query(ctx, {
910
- books: {
911
- $: {
912
- first: 10,
913
- },
914
- },
915
- }).data.books;
916
-
917
- expect(books.length).toEqual(10);
918
- });
919
-
920
- test('Leading queries should ignore the start cursor', () => {
921
- function storeWithUpdatedNicole() {
922
- const chunk = tx.users[lookup('handle', 'nicolegf')].update({
923
- createdAt: '2025-09-05 18:53:07.993689',
924
- });
925
-
926
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunk);
927
- return transact(store, zenecaAttrsStore, txSteps);
928
- }
929
-
930
- function storeWithBob() {
931
- const chunk = tx.users[randomUUID()].update({
932
- fullName: 'bob',
933
- email: 'bob@backendrelay.com',
934
- handle: 'bob',
935
- createdAt: '2025-09-05 18:53:07.993689',
936
- });
937
-
938
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunk);
939
- return transact(store, zenecaAttrsStore, txSteps);
940
- }
941
-
942
- // Existing pageInfo from server: starts at Nicole (2021-02-05), ends at Alex (2021-01-09)
943
- const pageInfo = {
944
- users: {
945
- 'start-cursor': [
946
- '0f3d67fc-8b37-4b03-ac47-29fec4edc4f7',
947
- '2ffdf0fc-1561-4fc5-96db-2210a41adfa6',
948
- '2021-02-05 22:35:23.754264',
949
- 1718118127976,
950
- ],
951
- 'end-cursor': [
952
- 'ad45e100-777a-4de8-8978-aa13200a4824',
953
- '2ffdf0fc-1561-4fc5-96db-2210a41adfa6',
954
- '2021-01-09 18:53:07.993689',
955
- 1718117855976,
956
- ],
957
- },
958
- };
959
- const existingUsers = query(
960
- { store, attrsStore: zenecaAttrsStore, pageInfo },
961
- {
962
- users: {
963
- $: {
964
- limit: 2,
965
- order: {
966
- createdAt: 'desc',
967
- },
968
- },
969
- },
970
- },
971
- ).data.users.map((x) => x.handle);
972
- expect(existingUsers).toEqual(['nicolegf', 'alex']);
973
-
974
- // Let's update Nicole's createdAt to be later.
975
- // She should _still_ show up,
976
- // even though the cursor says otherwise
977
- const usersWithUpdatedNicole = query(
978
- { ...storeWithUpdatedNicole(), pageInfo },
979
- {
980
- users: {
981
- $: {
982
- limit: 2,
983
- order: {
984
- createdAt: 'desc',
985
- },
986
- },
987
- },
988
- },
989
- ).data.users.map((x) => x.handle);
990
- expect(usersWithUpdatedNicole).toEqual(['nicolegf', 'alex']);
991
-
992
- // Let's add Bob.
993
- // Bob _should_ show up,
994
- // even though the cursor says otherwise
995
- const usersWithBob = query(
996
- { ...storeWithBob(), pageInfo },
997
- {
998
- users: {
999
- $: {
1000
- limit: 2,
1001
- order: {
1002
- createdAt: 'desc',
1003
- },
1004
- },
1005
- },
1006
- },
1007
- ).data.users.map((x) => x.handle);
1008
- expect(usersWithBob).toEqual(['bob', 'nicolegf']);
1009
- });
1010
-
1011
- test('Leading queries should ignore the end cursor for optimistic adds', () => {
1012
- // Simulates the offline optimistic add bug:
1013
- // 1. Server returns data with an end-cursor (last entity in asc order)
1014
- // 2. Client optimistically adds a new entity with a value beyond the end-cursor
1015
- // 3. The new entity should still appear (leading queries have no bounds)
1016
-
1017
- // pageInfo with end-cursor pointing to nicolegf (last in asc createdAt order)
1018
- const pageInfo = {
1019
- users: {
1020
- 'start-cursor': [
1021
- 'a55a5231-5c4d-4033-b859-7790c45c22d5', // stopa (first in asc)
1022
- '2ffdf0fc-1561-4fc5-96db-2210a41adfa6', // createdAt attr id
1023
- '2021-01-07 18:50:43.447955',
1024
- 1718117867976,
1025
- ],
1026
- 'end-cursor': [
1027
- '0f3d67fc-8b37-4b03-ac47-29fec4edc4f7', // nicolegf (last in asc)
1028
- '2ffdf0fc-1561-4fc5-96db-2210a41adfa6', // createdAt attr id
1029
- '2021-02-05 22:35:23.754264',
1030
- 1718118127976,
1031
- ],
1032
- },
1033
- };
1034
-
1035
- // Optimistically add a new user with a createdAt AFTER the end cursor
1036
- const chunk = tx.users[randomUUID()].update({
1037
- fullName: 'New User',
1038
- email: 'new@backendrelay.com',
1039
- handle: 'newuser',
1040
- createdAt: '2025-09-05 18:53:07.993689',
1041
- });
1042
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunk);
1043
- const { store: newStore, attrsStore: newAttrsStore } = transact(
1044
- store,
1045
- zenecaAttrsStore,
1046
- txSteps,
1047
- );
1048
-
1049
- // Leading query (no offset/before/after) with ascending order
1050
- const result = query(
1051
- { store: newStore, attrsStore: newAttrsStore, pageInfo },
1052
- {
1053
- users: {
1054
- $: {
1055
- order: { createdAt: 'asc' },
1056
- },
1057
- },
1058
- },
1059
- );
1060
-
1061
- const handles = result.data.users.map((x) => x.handle);
1062
- expect(handles).toContain('newuser');
1063
- expect(handles).toEqual(['stopa', 'joe', 'alex', 'nicolegf', 'newuser']);
1064
- });
1065
-
1066
- test('arbitrary ordering', () => {
1067
- const books = query(ctx, {
1068
- books: { $: { first: 10, order: { title: 'asc' } } },
1069
- });
1070
-
1071
- const titles = books.data.books.map((x) => x.title);
1072
- expect(titles).toEqual([
1073
- `"Surely You're Joking, Mr. Feynman!": Adventures of a Curious Character`,
1074
- '"What Do You Care What Other People Think?": Further Adventures of a Curious Character',
1075
- '12 Rules for Life',
1076
- '1984',
1077
- '21 Lessons for the 21st Century',
1078
- 'A Conflict of Visions',
1079
- 'A Damsel in Distress',
1080
- 'A Guide to the Good Life',
1081
- 'A Hero Of Our Time',
1082
- 'A History of Private Life: From pagan Rome to Byzantium',
1083
- ]);
1084
- });
1085
-
1086
- test('arbitrary ordering with dates', () => {
1087
- const schema = i.schema({
1088
- entities: {
1089
- tests: i.entity({
1090
- field: i.any(),
1091
- date: i.date().indexed(),
1092
- num: i.number().indexed(),
1093
- }),
1094
- },
1095
- });
1096
-
1097
- const txSteps: any[] = [];
1098
- let id = 0;
1099
- for (let i = -5; i < 5; i++) {
1100
- txSteps.push(
1101
- tx.tests[randomUUID()].update({
1102
- field: id++,
1103
- date: i,
1104
- num: i,
1105
- }),
1106
- );
1107
- }
1108
- // Add a null date
1109
- txSteps.push(
1110
- // Use predefined uuid so we can predict ordering
1111
- tx.tests['00000000-0000-0000-0000-000000000000'].update({
1112
- field: id++,
1113
- date: null,
1114
- num: null,
1115
- }),
1116
- );
1117
- // Add a missing date
1118
- txSteps.push(
1119
- tx.tests['00000000-0000-0000-0000-000000000001'].update({
1120
- field: id++,
1121
- }),
1122
- );
1123
- // Another null date
1124
- txSteps.push(
1125
- tx.tests['00000000-0000-0000-0000-000000000002'].update({
1126
- date: null,
1127
- num: null,
1128
- field: id++,
1129
- }),
1130
- );
1131
- // Another missing date
1132
- txSteps.push(
1133
- tx.tests['00000000-0000-0000-0000-000000000003'].update({
1134
- field: id++,
1135
- }),
1136
- );
1137
-
1138
- const newCtx = transact(
1139
- store,
1140
- zenecaAttrsStore,
1141
- instaml.transform(
1142
- { attrsStore: zenecaAttrsStore, schema: schema },
1143
- txSteps,
1144
- ),
1145
- );
1146
-
1147
- const descRes = query(newCtx, {
1148
- tests: { $: { order: { date: 'desc' } } },
1149
- }).data.tests.map((x) => x.date);
1150
-
1151
- const numDescRes = query(newCtx, {
1152
- tests: { $: { order: { num: 'desc' } } },
1153
- }).data.tests.map((x) => x.num);
1154
-
1155
- const descExpected = [
1156
- 4,
1157
- 3,
1158
- 2,
1159
- 1,
1160
- 0,
1161
- -1,
1162
- -2,
1163
- -3,
1164
- -4,
1165
- -5,
1166
- undefined,
1167
- null,
1168
- undefined,
1169
- null,
1170
- ];
1171
-
1172
- expect(descRes).toEqual(descExpected);
1173
-
1174
- expect(numDescRes).toEqual(descExpected);
1175
-
1176
- const ascRes = query(newCtx, {
1177
- tests: { $: { order: { date: 'asc' } } },
1178
- }).data.tests.map((x) => x.date);
1179
-
1180
- const numAscRes = query(newCtx, {
1181
- tests: { $: { order: { num: 'asc' } } },
1182
- }).data.tests.map((x) => x.num);
1183
-
1184
- const ascExpected = [
1185
- null,
1186
- undefined,
1187
- null,
1188
- undefined,
1189
- -5,
1190
- -4,
1191
- -3,
1192
- -2,
1193
- -1,
1194
- 0,
1195
- 1,
1196
- 2,
1197
- 3,
1198
- 4,
1199
- ];
1200
-
1201
- expect(ascRes).toEqual(ascExpected);
1202
- expect(numAscRes).toEqual(ascExpected);
1203
- });
1204
-
1205
- test('arbitrary ordering with strings', () => {
1206
- const schema = i.schema({
1207
- entities: {
1208
- tests: i.entity({
1209
- string: i.string().indexed(),
1210
- }),
1211
- },
1212
- });
1213
-
1214
- const txSteps: any[] = [];
1215
- const vs = ['10', '2', 'a0', 'Zz'];
1216
- for (const v of vs) {
1217
- txSteps.push(
1218
- tx.tests[randomUUID()].update({
1219
- string: v,
1220
- }),
1221
- );
1222
- }
1223
-
1224
- const newCtx = transact(
1225
- store,
1226
- zenecaAttrsStore,
1227
- instaml.transform(
1228
- { attrsStore: zenecaAttrsStore, schema: schema },
1229
- txSteps,
1230
- ),
1231
- );
1232
-
1233
- const ascRes = query(newCtx, {
1234
- tests: { $: { order: { string: 'asc' } } },
1235
- }).data.tests.map((x) => x.string);
1236
-
1237
- expect(ascRes).toEqual(vs);
1238
-
1239
- const descRes = query(newCtx, {
1240
- tests: { $: { order: { string: 'desc' } } },
1241
- }).data.tests.map((x) => x.string);
1242
-
1243
- // @ts-expect-error: doesn't like toReversed()
1244
- expect(descRes).toEqual(vs.toReversed());
1245
- });
1246
-
1247
- test('$isNull', () => {
1248
- const q = { books: { $: { where: { title: { $isNull: true } } } } };
1249
- expect(query(ctx, q).data.books.length).toEqual(0);
1250
- const chunks = [
1251
- tx.books[randomUUID()].update({ title: null }),
1252
- tx.books[randomUUID()].update({ pageCount: 20 }),
1253
- ];
1254
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunks);
1255
- const newCtx = transact(store, zenecaAttrsStore, txSteps);
1256
- expect(query(newCtx, q).data.books.map((x) => x.title)).toEqual([
1257
- null,
1258
- undefined,
1259
- ]);
1260
- });
1261
-
1262
- test('$isNull with relations', () => {
1263
- const q = { users: { $: { where: { bookshelves: { $isNull: true } } } } };
1264
- expect(query(ctx, q).data.users.length).toEqual(0);
1265
- const chunks = [tx.users[randomUUID()].update({ handle: 'dww' })];
1266
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunks);
1267
- const newCtx = transact(store, zenecaAttrsStore, txSteps);
1268
- expect(query(newCtx, q).data.users.map((x) => x.handle)).toEqual(['dww']);
1269
-
1270
- const bookId = query(ctx, {
1271
- books: { $: { where: { title: 'The Count of Monte Cristo' } } },
1272
- }).data.books[0].id;
1273
-
1274
- const usersWithBook = query(ctx, {
1275
- users: {
1276
- $: {
1277
- where: { 'bookshelves.books.title': 'The Count of Monte Cristo' },
1278
- },
1279
- },
1280
- }).data.users.map((x) => x.handle);
1281
-
1282
- const ctxWithNullTitle = transact(
1283
- newCtx.store,
1284
- newCtx.attrsStore,
1285
- instaml.transform(newCtx, [tx.books[bookId].update({ title: null })]),
1286
- );
1287
-
1288
- const usersWithNullTitle = query(ctxWithNullTitle, {
1289
- users: {
1290
- $: {
1291
- where: { 'bookshelves.books.title': { $isNull: true } },
1292
- },
1293
- },
1294
- }).data.users.map((x) => x.handle);
1295
-
1296
- expect(usersWithNullTitle).toEqual([...usersWithBook, 'dww']);
1297
- });
1298
-
1299
- test('$isNull with reverse relations', () => {
1300
- const q = {
1301
- bookshelves: { $: { where: { 'users.id': { $isNull: true } } }, users: {} },
1302
- };
1303
- expect(query(ctx, q).data.bookshelves.length).toBe(0);
1304
-
1305
- const chunks = [
1306
- tx.bookshelves[randomUUID()].update({ name: 'Lonely shelf' }),
1307
- ];
1308
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunks);
1309
- const newCtx = transact(store, zenecaAttrsStore, txSteps);
1310
- expect(query(newCtx, q).data.bookshelves.map((x) => x.name)).toEqual([
1311
- 'Lonely shelf',
1312
- ]);
1313
- });
1314
-
1315
- test('$not and $ne', () => {
1316
- const qNot = { tests: { $: { where: { val: { $not: 'a' } } } } };
1317
- const qNe = { tests: { $: { where: { val: { $ne: 'a' } } } } };
1318
- const chunks = [
1319
- tx.tests[randomUUID()].update({ val: 'a' }),
1320
- tx.tests[randomUUID()].update({ val: 'b' }),
1321
- tx.tests[randomUUID()].update({ val: 'c' }),
1322
- tx.tests[randomUUID()].update({ val: null }),
1323
- tx.tests[randomUUID()].update({ undefinedVal: 'd' }),
1324
- ];
1325
- const txSteps = instaml.transform({ attrsStore: zenecaAttrsStore }, chunks);
1326
- const newCtx = transact(store, zenecaAttrsStore, txSteps);
1327
- const expected = ['b', 'c', null, undefined];
1328
- expect(query(newCtx, qNot).data.tests.map((x) => x.val)).toEqual(expected);
1329
- expect(query(newCtx, qNe).data.tests.map((x) => x.val)).toEqual(expected);
1330
- });
1331
-
1332
- test('comparators', () => {
1333
- const schema = i.schema({
1334
- entities: {
1335
- tests: i.entity({
1336
- string: i.string().indexed(),
1337
- number: i.number().indexed(),
1338
- date: i.date().indexed(),
1339
- boolean: i.boolean().indexed(),
1340
- }),
1341
- },
1342
- });
1343
-
1344
- const txSteps: any[] = [];
1345
- for (let i = 0; i < 5; i++) {
1346
- txSteps.push(
1347
- tx.tests[randomUUID()].update({
1348
- string: `${i}`,
1349
- number: i,
1350
- date: i,
1351
- boolean: i % 2 === 0,
1352
- }),
1353
- );
1354
- }
1355
-
1356
- const newCtx = transact(
1357
- store,
1358
- zenecaAttrsStore,
1359
- instaml.transform(
1360
- { attrsStore: zenecaAttrsStore, schema: schema },
1361
- txSteps,
1362
- ),
1363
- );
1364
-
1365
- function runQuery(dataType, op, value) {
1366
- const res = query(newCtx, {
1367
- tests: {
1368
- $: { where: { [dataType]: { [op]: value } } },
1369
- },
1370
- });
1371
- return res.data.tests.map((x) => x[dataType]);
1372
- }
1373
-
1374
- expect(runQuery('string', '$gt', '2')).toEqual(['3', '4']);
1375
- expect(runQuery('string', '$gte', '2')).toEqual(['2', '3', '4']);
1376
- expect(runQuery('string', '$lt', '2')).toEqual(['0', '1']);
1377
- expect(runQuery('string', '$lte', '2')).toEqual(['0', '1', '2']);
1378
-
1379
- expect(runQuery('number', '$gt', 2)).toEqual([3, 4]);
1380
- expect(runQuery('number', '$gte', 2)).toEqual([2, 3, 4]);
1381
- expect(runQuery('number', '$lt', 2)).toEqual([0, 1]);
1382
- expect(runQuery('number', '$lte', 2)).toEqual([0, 1, 2]);
1383
-
1384
- expect(runQuery('date', '$gt', 2)).toEqual([3, 4]);
1385
- expect(runQuery('date', '$gte', 2)).toEqual([2, 3, 4]);
1386
- expect(runQuery('date', '$lt', 2)).toEqual([0, 1]);
1387
- expect(runQuery('date', '$lte', 2)).toEqual([0, 1, 2]);
1388
-
1389
- // Accepts string dates
1390
- expect(
1391
- runQuery('date', '$lt', JSON.parse(JSON.stringify(new Date()))),
1392
- ).toEqual([0, 1, 2, 3, 4]);
1393
- expect(
1394
- runQuery('date', '$gt', JSON.parse(JSON.stringify(new Date()))),
1395
- ).toEqual([]);
1396
-
1397
- expect(runQuery('boolean', '$gt', true)).toEqual([]);
1398
- expect(runQuery('boolean', '$gte', true)).toEqual([true, true, true]);
1399
- expect(runQuery('boolean', '$lt', true)).toEqual([false, false]);
1400
- expect(runQuery('boolean', '$lte', true)).toEqual([
1401
- true,
1402
- false,
1403
- true,
1404
- false,
1405
- true,
1406
- ]);
1407
- });
1408
-
1409
- test('date comparators recognize PostgreSQL special values', () => {
1410
- const schema = i.schema({
1411
- entities: {
1412
- tests: i.entity({
1413
- label: i.string(),
1414
- date: i.date().indexed(),
1415
- }),
1416
- },
1417
- });
1418
- const attrsStore = new AttrsStoreClass({}, null);
1419
- const initialCtx = { store: createStore(attrsStore, []), attrsStore, schema };
1420
- const specialDates = [
1421
- ['before', '-infinity'],
1422
- ['epoch', 'epoch'],
1423
- ['finite', '2025-01-01T00:00:00.000Z'],
1424
- ['after', 'infinity'],
1425
- ].concat(Array.from({ length: 28 }, (_, i) => [`after-${i}`, 'infinity']));
1426
- const specialCtx = transact(
1427
- initialCtx.store,
1428
- initialCtx.attrsStore,
1429
- instaml.transform(
1430
- initialCtx,
1431
- specialDates.map(([label, date]) =>
1432
- tx.tests[randomUUID()].update({ label, date }),
1433
- ),
1434
- ),
1435
- );
1436
-
1437
- function runQuery(op, value) {
1438
- return query(specialCtx, {
1439
- tests: { $: { where: { date: { [op]: value } } } },
1440
- }).data.tests.map((test) => test.label);
1441
- }
1442
-
1443
- expect(runQuery('$lt', 'epoch')).toEqual(['before']);
1444
- expect(runQuery('$lte', 'epoch')).toEqual(['before', 'epoch']);
1445
- expect(runQuery('$lt', 'infinity')).toEqual(['before', 'epoch', 'finite']);
1446
- expect(runQuery('$gte', 'infinity')).toEqual([
1447
- 'after',
1448
- ...Array.from({ length: 28 }, (_, i) => `after-${i}`),
1449
- ]);
1450
- });
1451
-
1452
- test('fields', () => {
1453
- expect(query(ctx, { users: { $: { fields: ['handle'] } } }).data).toEqual({
1454
- users: [
1455
- { handle: 'joe', id: 'ce942051-2d74-404a-9c7d-4aa3f2d54ae4' },
1456
- { handle: 'alex', id: 'ad45e100-777a-4de8-8978-aa13200a4824' },
1457
- { handle: 'stopa', id: 'a55a5231-5c4d-4033-b859-7790c45c22d5' },
1458
- { handle: 'nicolegf', id: '0f3d67fc-8b37-4b03-ac47-29fec4edc4f7' },
1459
- ],
1460
- });
1461
-
1462
- expect(
1463
- query(ctx, {
1464
- users: {
1465
- $: { where: { handle: 'alex' }, fields: ['handle'] },
1466
- bookshelves: { $: { fields: ['name'] } },
1467
- },
1468
- }).data,
1469
- ).toEqual({
1470
- users: [
1471
- {
1472
- handle: 'alex',
1473
- id: 'ad45e100-777a-4de8-8978-aa13200a4824',
1474
- bookshelves: [
1475
- {
1476
- name: 'Nonfiction',
1477
- id: '8164fb78-6fa3-4aab-8b92-80e706bae93a',
1478
- },
1479
- {
1480
- name: 'Short Stories',
1481
- id: '4ad10e00-1353-437e-9fee-2a89eb53575d',
1482
- },
1483
- ],
1484
- },
1485
- ],
1486
- });
1487
-
1488
- // id is always included
1489
- expect(query(ctx, { users: { $: { fields: [] } } }).data).toEqual({
1490
- users: [
1491
- { id: 'ce942051-2d74-404a-9c7d-4aa3f2d54ae4' },
1492
- { id: 'ad45e100-777a-4de8-8978-aa13200a4824' },
1493
- { id: 'a55a5231-5c4d-4033-b859-7790c45c22d5' },
1494
- { id: '0f3d67fc-8b37-4b03-ac47-29fec4edc4f7' },
1495
- ],
1496
- });
1497
- });