@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
package/src/SyncTable.ts DELETED
@@ -1,750 +0,0 @@
1
- import { PersistedObject } from './utils/PersistedObject.ts';
2
- import * as s from './store.ts';
3
- import weakHash from './utils/weakHash.ts';
4
- import uuid from './utils/id.ts';
5
- import { Logger } from './Reactor.js';
6
- import instaql from './instaql.ts';
7
- import { InstaQLResponse, ValidQuery } from './queryTypes.ts';
8
- import { EntitiesDef, IContainEntitiesAndLinks } from './schemaTypes.ts';
9
- import { StoreInterface } from './index.ts';
10
-
11
- type SubState = {
12
- txId?: number;
13
- subscriptionId: string;
14
- token: string;
15
- };
16
-
17
- type SubEntity = {
18
- entity: any;
19
- store: s.Store;
20
- serverCreatedAt: number;
21
- };
22
-
23
- type SubValues = {
24
- attrsStore: s.AttrsStore;
25
- entities: Array<SubEntity>;
26
- };
27
-
28
- type Sub = {
29
- query: any;
30
- hash: string;
31
- startEventId?: string;
32
- state?: SubState;
33
- values?: SubValues;
34
- createdAt: number;
35
- updatedAt: number;
36
- };
37
-
38
- type SubEntityInStorage = {
39
- entity: any;
40
- store: s.StoreJson;
41
- serverCreatedAt: number;
42
- };
43
-
44
- type SubValuesInStorage = {
45
- attrsStore: s.AttrsStoreJson;
46
- entities: Array<SubEntityInStorage>;
47
- };
48
-
49
- // We could make a better type for this if we had a return type for s.toJSON
50
- type SubInStorage = Omit<Sub, 'values'> & {
51
- values: SubValuesInStorage;
52
- };
53
-
54
- type StartMsg = {
55
- op: 'start-sync';
56
- q: string;
57
- };
58
-
59
- type EndMsg = {
60
- op: 'remove-sync';
61
- 'subscription-id': string;
62
- 'keep-subscription': boolean;
63
- };
64
-
65
- type ResyncMsg = {
66
- op: 'resync-table';
67
- 'subscription-id': string;
68
- 'tx-id': number;
69
- token: string;
70
- };
71
-
72
- type SendMsg = StartMsg | EndMsg;
73
-
74
- type StartSyncOkMsg = {
75
- 'subscription-id': string;
76
- 'client-event-id': string;
77
- q: string;
78
- token: string;
79
- };
80
-
81
- type Triple = [string, string, any, number];
82
-
83
- type SyncLoadBatchMsg = {
84
- 'subscription-id': string;
85
- 'join-rows': Array<Triple[]>;
86
- };
87
-
88
- type SyncInitFinishMsg = {
89
- 'subscription-id': string;
90
- 'tx-id': number;
91
- };
92
-
93
- type SyncUpdateTriplesMsg = {
94
- 'subscription-id': string;
95
- txes: {
96
- 'tx-id': number;
97
- changes: { action: 'added' | 'removed'; triple: Triple }[];
98
- }[];
99
- };
100
-
101
- type TrySend = (eventId: string, msg: SendMsg) => void;
102
-
103
- type Config = { useDateObjects: boolean };
104
-
105
- // Modifies the data in place because it comes directly from storage
106
- function syncSubFromStorage(sub: SubInStorage, useDateObjects: boolean): Sub {
107
- const values = sub.values;
108
- if (values) {
109
- const attrsStore = s.attrsStoreFromJSON(values.attrsStore, null);
110
- if (attrsStore) {
111
- for (const e of values.entities || []) {
112
- e.store.useDateObjects = useDateObjects;
113
- (e as unknown as SubEntity).store = s.fromJSON(attrsStore, e.store);
114
- }
115
- (values as unknown as SubValues).attrsStore = attrsStore;
116
- }
117
- }
118
-
119
- return sub as unknown as Sub;
120
- }
121
-
122
- function syncSubToStorage(_k: string, sub: Sub): SubInStorage {
123
- if (sub.values) {
124
- const entities: SubEntityInStorage[] = [];
125
- for (const e of sub.values?.entities) {
126
- const store = s.toJSON(e.store);
127
- entities.push({ ...e, store });
128
- }
129
- return {
130
- ...sub,
131
- values: { attrsStore: sub.values.attrsStore.toJSON(), entities },
132
- };
133
- } else {
134
- return sub as unknown as SubInStorage;
135
- }
136
- }
137
-
138
- function onMergeSub(
139
- _key: string,
140
- storageSub: Sub,
141
- inMemorySub: Sub | null,
142
- ): Sub {
143
- const storageTxId = storageSub?.state?.txId;
144
- const memoryTxId = inMemorySub?.state?.txId;
145
-
146
- if (storageTxId && (!memoryTxId || storageTxId > memoryTxId)) {
147
- return storageSub;
148
- }
149
-
150
- if (memoryTxId && (!storageTxId || memoryTxId > storageTxId)) {
151
- return inMemorySub;
152
- }
153
-
154
- return storageSub || inMemorySub;
155
- }
156
-
157
- function queryData(sub: Sub, store: s.Store, attrsStore: s.AttrsStore) {
158
- return instaql(
159
- { store, attrsStore, pageInfo: null, aggregate: null },
160
- sub.query,
161
- ).data;
162
- }
163
-
164
- function emptyData(query: any) {
165
- return Object.fromEntries(
166
- Object.keys(query)
167
- .filter((key) => key !== '$$ruleParams')
168
- .map((key) => [key, []]),
169
- );
170
- }
171
-
172
- function applyChangesToStore(
173
- store: s.Store,
174
- attrsStore: s.AttrsStore,
175
- changes: SyncUpdateTriplesMsg['txes'][number]['changes'],
176
- ): void {
177
- for (const { action, triple } of changes) {
178
- switch (action) {
179
- case 'added':
180
- s.addTriple(store, attrsStore, triple);
181
- break;
182
- case 'removed':
183
- s.retractTriple(store, attrsStore, triple);
184
- break;
185
- }
186
- }
187
- }
188
-
189
- function subData(sub: Sub, entities: NonNullable<Sub['values']>['entities']) {
190
- return entities[0]?.entity || emptyData(sub.query);
191
- }
192
-
193
- type CreateStore = (triples: Triple[]) => s.Store;
194
-
195
- function sameValue(left: any, right: any) {
196
- return JSON.stringify(left) === JSON.stringify(right);
197
- }
198
-
199
- function changedFields(oldEntity: any, newEntity: any) {
200
- const changed: Record<string, { oldValue: any; newValue: any }> = {};
201
- for (const key of new Set([
202
- ...Object.keys(oldEntity),
203
- ...Object.keys(newEntity),
204
- ])) {
205
- if (!sameValue(oldEntity[key], newEntity[key])) {
206
- changed[key] = { oldValue: oldEntity[key], newValue: newEntity[key] };
207
- }
208
- }
209
- return changed;
210
- }
211
-
212
- function diffData(oldData: any, newData: any) {
213
- const added: any[] = [];
214
- const removed: any[] = [];
215
- const updated: SyncTransaction<any, any, any>['updated'] = [];
216
- for (const root of new Set([
217
- ...Object.keys(oldData),
218
- ...Object.keys(newData),
219
- ])) {
220
- const oldEntities = Array.isArray(oldData[root]) ? oldData[root] : [];
221
- const newEntities = Array.isArray(newData[root]) ? newData[root] : [];
222
- const oldById = new Map(oldEntities.map((entity) => [entity.id, entity]));
223
- const newById = new Map(newEntities.map((entity) => [entity.id, entity]));
224
- for (const [id, entity] of newById) {
225
- const oldEntity = oldById.get(id);
226
- if (!oldEntity) {
227
- added.push(entity);
228
- } else if (!sameValue(oldEntity, entity)) {
229
- updated.push({
230
- oldEntity,
231
- newEntity: entity,
232
- changedFields: changedFields(oldEntity, entity),
233
- });
234
- }
235
- }
236
- for (const [id, entity] of oldById) {
237
- if (!newById.has(id)) {
238
- removed.push(entity);
239
- }
240
- }
241
- }
242
- return { added, removed, updated };
243
- }
244
-
245
- export enum CallbackEventType {
246
- InitialSyncBatch = 'InitialSyncBatch',
247
- InitialSyncComplete = 'InitialSyncComplete',
248
- LoadFromStorage = 'LoadFromStorage',
249
- SyncTransaction = 'SyncTransaction',
250
- Error = 'Error',
251
- }
252
-
253
- type QueryEntities<
254
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
255
- Q extends ValidQuery<Q, Schema>,
256
- UseDates extends boolean,
257
- > = InstaQLResponse<Schema, Q, UseDates>[keyof InstaQLResponse<
258
- Schema,
259
- Q,
260
- UseDates
261
- >];
262
-
263
- type QueryEntity<
264
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
265
- Q extends ValidQuery<Q, Schema>,
266
- UseDates extends boolean,
267
- > = QueryEntities<Schema, Q, UseDates> extends (infer E)[] ? E : never;
268
-
269
- type ChangedFields<Entity> = {
270
- [K in keyof Entity]?: {
271
- oldValue: Entity[K];
272
- newValue: Entity[K];
273
- };
274
- };
275
-
276
- export interface BaseCallbackEvent<
277
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
278
- Q extends ValidQuery<Q, Schema>,
279
- UseDates extends boolean,
280
- > {
281
- type: CallbackEventType;
282
- data: InstaQLResponse<Schema, Q, UseDates>;
283
- }
284
-
285
- export interface InitialSyncBatch<
286
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
287
- Q extends ValidQuery<Q, Schema>,
288
- UseDates extends boolean,
289
- > extends BaseCallbackEvent<Schema, Q, UseDates> {
290
- type: CallbackEventType.InitialSyncBatch;
291
- batch: QueryEntities<Schema, Q, UseDates>;
292
- }
293
-
294
- export interface InitialSyncComplete<
295
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
296
- Q extends ValidQuery<Q, Schema>,
297
- UseDates extends boolean,
298
- > extends BaseCallbackEvent<Schema, Q, UseDates> {
299
- type: CallbackEventType.InitialSyncComplete;
300
- }
301
-
302
- export interface SyncTransaction<
303
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
304
- Q extends ValidQuery<Q, Schema>,
305
- UseDates extends boolean,
306
- > extends BaseCallbackEvent<Schema, Q, UseDates> {
307
- type: CallbackEventType.SyncTransaction;
308
- added: QueryEntities<Schema, Q, UseDates>;
309
- removed: QueryEntities<Schema, Q, UseDates>;
310
- updated: {
311
- oldEntity: QueryEntity<Schema, Q, UseDates>;
312
- newEntity: QueryEntity<Schema, Q, UseDates>;
313
- changedFields: ChangedFields<QueryEntity<Schema, Q, UseDates>>;
314
- }[];
315
- }
316
-
317
- export interface LoadFromStorage<
318
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
319
- Q extends ValidQuery<Q, Schema>,
320
- UseDates extends boolean,
321
- > extends BaseCallbackEvent<Schema, Q, UseDates> {
322
- type: CallbackEventType.LoadFromStorage;
323
- }
324
-
325
- export interface SetupError<
326
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
327
- Q extends ValidQuery<Q, Schema>,
328
- UseDates extends boolean,
329
- > extends BaseCallbackEvent<Schema, Q, UseDates> {
330
- type: CallbackEventType.Error;
331
- error: { message: string; hint?: any; type: string; status: number };
332
- }
333
-
334
- export type CallbackEvent<
335
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
336
- Q extends ValidQuery<Q, Schema>,
337
- UseDates extends boolean,
338
- > =
339
- | InitialSyncBatch<Schema, Q, UseDates>
340
- | InitialSyncComplete<Schema, Q, UseDates>
341
- | SyncTransaction<Schema, Q, UseDates>
342
- | LoadFromStorage<Schema, Q, UseDates>
343
- | SetupError<Schema, Q, UseDates>;
344
-
345
- export type SyncTableCallback<
346
- Schema extends IContainEntitiesAndLinks<EntitiesDef, any>,
347
- Q extends ValidQuery<Q, Schema>,
348
- UseDates extends boolean,
349
- > = (event: CallbackEvent<Schema, Q, UseDates>) => void;
350
-
351
- export class SyncTable {
352
- private trySend: TrySend;
353
- private subs: PersistedObject<string, Sub, SubInStorage>;
354
- // Using any for the SyncCallback because we'd need Reactor to be typed
355
- private callbacks: { [hash: string]: SyncTableCallback<any, any, any>[] } =
356
- {};
357
- private config: Config;
358
- private idToHash: { [subscriptionId: string]: string } = {};
359
- private log: Logger;
360
- private createStore: CreateStore;
361
- private getAttrs: () => s.AttrsStore;
362
-
363
- constructor(
364
- trySend: TrySend,
365
- storage: StoreInterface,
366
- config: Config,
367
- log: Logger,
368
- createStore: CreateStore,
369
- getAttrs: () => s.AttrsStore,
370
- ) {
371
- this.trySend = trySend;
372
- this.config = config;
373
- this.log = log;
374
- this.createStore = createStore;
375
- this.getAttrs = getAttrs;
376
-
377
- this.subs = new PersistedObject<string, Sub, SubInStorage>({
378
- persister: storage,
379
- merge: onMergeSub,
380
- serialize: syncSubToStorage,
381
- parse: (_key, x) => syncSubFromStorage(x, this.config.useDateObjects),
382
- objectSize: (sub) => sub.values?.entities.length || 0,
383
- logger: log,
384
- gc: {
385
- maxAgeMs: 1000 * 60 * 60 * 24 * 7 * 52, // 1 year
386
- maxEntries: 1000,
387
- // Size of each sub is the number of entity
388
- maxSize: 1_000_000, // 1 million entities
389
- },
390
- });
391
- }
392
-
393
- public beforeUnload() {
394
- this.subs.flush();
395
- }
396
-
397
- public subscribe(
398
- q: any,
399
- cb: SyncTableCallback<any, any, any>,
400
- ): (
401
- opts?: { keepSubscription?: boolean | null | undefined } | null | undefined,
402
- ) => void {
403
- const hash = weakHash(q);
404
- const callbacks = (this.callbacks[hash] = this.callbacks[hash] || []);
405
- const isFirstSubscriber = callbacks.length === 0;
406
- callbacks.push(cb);
407
-
408
- if (isFirstSubscriber) {
409
- this.initSubscription(q, hash);
410
- } else {
411
- this.notifyCurrentSubscription(hash, cb);
412
- }
413
-
414
- return (opts?: { keepSubscription?: boolean | null | undefined }) => {
415
- this.unsubscribe(hash, cb, opts?.keepSubscription);
416
- };
417
- }
418
-
419
- private unsubscribe(
420
- hash: string,
421
- cb: SyncTableCallback<any, any, any>,
422
- keepSubscription: boolean | null | undefined,
423
- ) {
424
- const cbs = (this.callbacks[hash] || []).filter((x) => x !== cb);
425
- this.callbacks[hash] = cbs;
426
-
427
- if (!cbs.length) {
428
- delete this.callbacks[hash];
429
- const sub = this.subs.currentValue[hash];
430
- if (sub?.state) {
431
- this.clearSubscriptionData(
432
- sub.state.subscriptionId,
433
- !!keepSubscription,
434
- );
435
- }
436
- if (!keepSubscription) {
437
- this.subs.updateInPlace((prev) => {
438
- delete prev[hash];
439
- });
440
- }
441
- }
442
- }
443
-
444
- private sendStart(eventId: string, query: string) {
445
- this.trySend(eventId, {
446
- op: 'start-sync',
447
- q: query,
448
- });
449
- }
450
-
451
- private sendRemoveById(subscriptionId: string, keepSubscription: boolean) {
452
- this.trySend(uuid(), {
453
- op: 'remove-sync',
454
- 'subscription-id': subscriptionId,
455
- 'keep-subscription': keepSubscription,
456
- });
457
- }
458
-
459
- private sendRemove(state: SubState, keepSubscription: boolean) {
460
- this.trySend(uuid(), {
461
- op: 'remove-sync',
462
- 'subscription-id': state.subscriptionId,
463
- 'keep-subscription': keepSubscription,
464
- });
465
- }
466
-
467
- private async initSubscription(query: any, hash: string) {
468
- // Wait for storage to load so that we know if we already have an existing subscription
469
- await this.subs.waitForKeyToLoad(hash);
470
- const existingSub = this.subs.currentValue[hash];
471
-
472
- if (existingSub?.state) {
473
- // Re-authorize before exposing persisted data. A server restart or an
474
- // auth change must not resume a snapshot that is no longer visible.
475
- delete this.idToHash[existingSub.state.subscriptionId];
476
- this.sendRemove(existingSub.state, false);
477
- }
478
-
479
- const startEventId = uuid();
480
- this.subs.updateInPlace((prev) => {
481
- prev[hash] = {
482
- query,
483
- hash: hash,
484
- startEventId,
485
- createdAt: Date.now(),
486
- updatedAt: Date.now(),
487
- };
488
- });
489
-
490
- this.sendStart(startEventId, query);
491
- }
492
-
493
- private async notifyCurrentSubscription(
494
- hash: string,
495
- cb: SyncTableCallback<any, any, any>,
496
- ) {
497
- await this.subs.waitForKeyToLoad(hash);
498
- const sub = this.subs.currentValue[hash];
499
- if (sub?.state?.txId !== undefined && sub.values?.entities) {
500
- cb({
501
- type: CallbackEventType.LoadFromStorage,
502
- data: subData(sub, sub.values.entities),
503
- });
504
- }
505
- }
506
-
507
- public async flushPending() {
508
- for (const hash of Object.keys(this.callbacks)) {
509
- await this.subs.waitForKeyToLoad(hash);
510
- const sub = this.subs.currentValue[hash];
511
- if (sub) {
512
- await this.initSubscription(sub.query, sub.hash);
513
- } else {
514
- this.log.error('Missing sub for hash in flushPending', hash);
515
- }
516
- }
517
- }
518
-
519
- public onStartSyncOk(msg: StartSyncOkMsg) {
520
- const subscriptionId = msg['subscription-id'];
521
- const q = msg.q;
522
- const hash = weakHash(q);
523
-
524
- this.subs.updateInPlace((prev) => {
525
- const sub = prev[hash];
526
- if (!sub || sub.startEventId !== msg['client-event-id']) {
527
- this.log.error(
528
- 'Ignoring stale start-sync-ok for hash',
529
- hash,
530
- 'subscription-id',
531
- subscriptionId,
532
- 'query',
533
- q,
534
- );
535
- this.sendRemoveById(subscriptionId, false);
536
- return prev;
537
- }
538
-
539
- this.idToHash[subscriptionId] = hash;
540
- sub.state = {
541
- subscriptionId: subscriptionId,
542
- token: msg.token,
543
- };
544
- });
545
- }
546
-
547
- private notifyCbs(hash: string, event: CallbackEvent<any, any, any>) {
548
- for (const cb of this.callbacks[hash] || []) {
549
- cb(event);
550
- }
551
- }
552
-
553
- public onSyncLoadBatch(msg: SyncLoadBatchMsg) {
554
- const subscriptionId = msg['subscription-id'];
555
- const joinRows = msg['join-rows'];
556
- const hash = this.idToHash[subscriptionId];
557
- if (!hash) {
558
- this.log.error('Missing hash for subscription', msg);
559
- return;
560
- }
561
-
562
- const sub = this.subs.currentValue[hash];
563
- if (!sub) {
564
- this.log.error('Missing sub for hash', hash, msg);
565
- return;
566
- }
567
-
568
- const values: SubValues = sub.values ?? {
569
- entities: [],
570
- attrsStore: this.getAttrs(),
571
- };
572
- sub.values = values;
573
- const existing = values.entities[0];
574
- const store = existing?.store || this.createStore([]);
575
- const oldData = subData(sub, values.entities);
576
- for (const triple of joinRows.flat()) {
577
- s.addTriple(store, values.attrsStore, triple);
578
- }
579
- const data = queryData(sub, store, values.attrsStore);
580
- const { added: batch } = diffData(oldData, data);
581
- values.entities = [{ store, entity: data, serverCreatedAt: 0 }];
582
-
583
- this.subs.updateInPlace((prev) => {
584
- prev[hash] = sub;
585
- // Make sure we write a field or mutative won't
586
- // see the change because sub === prev[hash]
587
- prev[hash].updatedAt = Date.now();
588
- });
589
-
590
- if (sub.values) {
591
- this.notifyCbs(hash, {
592
- type: CallbackEventType.InitialSyncBatch,
593
- data: subData(sub, sub.values.entities),
594
- batch,
595
- });
596
- }
597
- }
598
-
599
- public onSyncInitFinish(msg: SyncInitFinishMsg) {
600
- const subscriptionId = msg['subscription-id'];
601
- const hash = this.idToHash[subscriptionId];
602
- if (!hash) {
603
- this.log.error('Missing hash for subscription', msg);
604
- return;
605
- }
606
- this.subs.updateInPlace((prev) => {
607
- const sub = prev[hash];
608
- if (!sub) {
609
- this.log.error('Missing sub for hash', hash, msg);
610
- return;
611
- }
612
- const state = sub.state;
613
- if (!state) {
614
- this.log.error('Sub never set init, missing result', sub, msg);
615
- return prev;
616
- }
617
- state.txId = msg['tx-id'];
618
- sub.updatedAt = Date.now();
619
- });
620
-
621
- const sub = this.subs.currentValue[hash];
622
-
623
- if (sub) {
624
- this.notifyCbs(hash, {
625
- type: CallbackEventType.InitialSyncComplete,
626
- data: subData(sub, sub.values?.entities || []),
627
- });
628
- }
629
- }
630
-
631
- public onSyncUpdateTriples(msg: SyncUpdateTriplesMsg) {
632
- const subscriptionId = msg['subscription-id'];
633
- const hash = this.idToHash[subscriptionId];
634
- if (!hash) {
635
- this.log.error('Missing hash for subscription', msg);
636
- return;
637
- }
638
-
639
- const sub = this.subs.currentValue[hash];
640
- if (!sub) {
641
- this.log.error('Missing sub for hash', hash, msg);
642
- return;
643
- }
644
-
645
- const state = sub.state;
646
- if (!state) {
647
- this.log.error('Missing state for sub', sub, msg);
648
- return;
649
- }
650
-
651
- for (const tx of msg.txes) {
652
- if (state.txId && state.txId >= tx['tx-id']) {
653
- continue;
654
- }
655
- state.txId = tx['tx-id'];
656
- const values: SubValues = sub.values ?? {
657
- entities: [],
658
- attrsStore: this.getAttrs(),
659
- };
660
- sub.values = values;
661
- const store = values.entities[0]?.store || this.createStore([]);
662
- const oldData = subData(sub, values.entities);
663
- applyChangesToStore(store, values.attrsStore, tx.changes);
664
- const data = queryData(sub, store, values.attrsStore);
665
- const { added, removed, updated } = diffData(oldData, data);
666
- values.entities = [{ store, entity: data, serverCreatedAt: 0 }];
667
- this.notifyCbs(hash, {
668
- type: CallbackEventType.SyncTransaction,
669
- data,
670
- added,
671
- removed,
672
- updated,
673
- });
674
- }
675
- this.subs.updateInPlace((prev) => {
676
- prev[hash] = sub;
677
- // Make sure we write a field or mutative won't
678
- // see the change because sub === prev[hash]
679
- prev[hash].updatedAt = Date.now();
680
- });
681
- }
682
-
683
- private clearSubscriptionData(
684
- subscriptionId: string,
685
- keepSubscription: boolean,
686
- ) {
687
- const hash = this.idToHash[subscriptionId];
688
- if (hash) {
689
- delete this.idToHash[subscriptionId];
690
- const sub = this.subs.currentValue[hash];
691
- if (sub?.state) {
692
- this.sendRemove(sub.state, keepSubscription);
693
- }
694
- if (keepSubscription) {
695
- this.subs.unloadKey(hash);
696
- } else {
697
- this.subs.updateInPlace((prev) => {
698
- delete prev[hash];
699
- });
700
- }
701
- if (sub) {
702
- return sub;
703
- }
704
- }
705
- }
706
-
707
- public onStartSyncError(msg: {
708
- op: 'error';
709
- 'original-event': StartMsg;
710
- 'client-event-id': string;
711
- status: number;
712
- type: string;
713
- message?: string;
714
- hint?: any;
715
- }) {
716
- const hash = weakHash(msg['original-event']['q']);
717
- const sub = this.subs.currentValue[hash];
718
- if (sub?.startEventId !== msg['client-event-id']) {
719
- return;
720
- }
721
- const error = {
722
- message: msg.message || 'Uh-oh, something went wrong. Ping Joe & Stopa.',
723
- status: msg.status,
724
- type: msg.type,
725
- hint: msg.hint,
726
- };
727
-
728
- this.notifyCbs(hash, {
729
- type: CallbackEventType.Error,
730
- data: emptyData(msg['original-event']['q']),
731
- error,
732
- });
733
- }
734
-
735
- public onResyncError(msg: {
736
- op: 'error';
737
- 'original-event': ResyncMsg;
738
- status: number;
739
- type: string;
740
- }) {
741
- // Clear the subscription and start from scrath on any resync error
742
- // This can happen if the auth changed and we need to refetch with the
743
- // new auth or if the subscription is too far behind.
744
- const subscriptionId = msg['original-event']['subscription-id'];
745
- const removedSub = this.clearSubscriptionData(subscriptionId, false);
746
- if (removedSub) {
747
- this.initSubscription(removedSub.query, removedSub.hash);
748
- }
749
- }
750
- }