@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/index.ts DELETED
@@ -1,1293 +0,0 @@
1
- import Reactor from './Reactor.js';
2
- import {
3
- tx,
4
- txInit,
5
- lookup,
6
- getOps,
7
- type TxChunk,
8
- type TransactionChunk,
9
- } from './instatx.js';
10
- import weakHash from './utils/weakHash.js';
11
- import id from './utils/id.ts';
12
- import IndexedDBStorage from './IndexedDBStorage.ts';
13
- import { coerceToDate } from './utils/dates.js';
14
- import WindowNetworkListener from './WindowNetworkListener.js';
15
- import { i } from './schema.js';
16
- import { createDevtool } from './devtool.js';
17
- import version from './version.ts';
18
- import { validateQuery, QueryValidationError } from './queryValidation.ts';
19
- import {
20
- validateTransactions,
21
- TransactionValidationError,
22
- } from './transactionValidation.ts';
23
- import { setBackendRelayWarningsEnabled } from './warningToggle.ts';
24
-
25
- import {
26
- StoreInterface,
27
- type StoreInterfaceClass,
28
- type StoreInterfaceStoreName,
29
- } from './utils/PersistedObject.ts';
30
- import { createBackendRelayRouteHandler } from './createRouteHandler.ts';
31
- import type {
32
- BackendRelayRouteHandlerPayloadByType,
33
- BackendRelayRouteHandlerType,
34
- BackendRelayRouteHandlerBody,
35
- } from './routeHandlerProtocol.ts';
36
- import { parseSchemaFromJSON } from './parseSchemaFromJSON.ts';
37
- import type { Logger } from './utils/log.ts';
38
-
39
- import type {
40
- PresenceOpts,
41
- PresenceResponse,
42
- PresenceSlice,
43
- RoomSchemaShape,
44
- } from './presence.ts';
45
- import type {
46
- DevtoolConfig,
47
- IDatabase,
48
- IBackendRelayDatabase,
49
- StrictDevtoolConfig,
50
- } from './coreTypes.ts';
51
- import type {
52
- Query,
53
- QueryResponse,
54
- InstaQLResponse,
55
- PageInfoResponse,
56
- Exactly,
57
- BackendRelayObject,
58
- InstaQLParams,
59
- InstaQLOptions,
60
- InstaQLQueryParams,
61
- InstaQLEntity,
62
- InstaQLEntitySubquery,
63
- InstaQLResult,
64
- InstaQLFields,
65
- ValidQuery,
66
- Cursor,
67
- Order,
68
- InstaQLQueryEntityResult,
69
- } from './queryTypes.ts';
70
- import type { PresencePeer } from './presenceTypes.ts';
71
- import type {
72
- AuthState,
73
- User,
74
- AuthResult,
75
- ConnectionStatus,
76
- AppStatusState,
77
- } from './clientTypes.ts';
78
- import type {
79
- BackendRelayQuery,
80
- BackendRelayQueryResult,
81
- BackendRelaySchema,
82
- BackendRelayEntity,
83
- BackendRelaySchemaDatabase,
84
- } from './helperTypes.ts';
85
- import type {
86
- BackendRelayDBAttr,
87
- BackendRelayDBAttrOnDelete,
88
- BackendRelayDBCheckedDataType,
89
- BackendRelayDBIdent,
90
- BackendRelayDBInferredType,
91
- } from './attrTypes.ts';
92
- import type {
93
- AttrsDefs,
94
- CardinalityKind,
95
- DataAttrDef,
96
- EntitiesDef,
97
- EntitiesWithLinks,
98
- EntityDef,
99
- RoomsDef,
100
- BackendRelaySchemaDef,
101
- BackendRelayGraph,
102
- LinkAttrDef,
103
- LinkDef,
104
- LinksDef,
105
- PresenceOf,
106
- ResolveAttrs,
107
- RoomsOf,
108
- TopicsOf,
109
- TopicOf,
110
- ValueTypes,
111
- BackendRelayUnknownSchema,
112
- BackendRelayUnknownSchemaDef,
113
- BackwardsCompatibleSchema,
114
- UpdateParams,
115
- LinkParams,
116
- CreateParams,
117
- RuleParams,
118
- } from './schemaTypes.ts';
119
- import type { BackendRelayRules } from './rulesTypes.ts';
120
- import type { UploadFileResponse, DeleteFileResponse } from './StorageAPI.ts';
121
- import { FrameworkClient, type FrameworkConfig } from './framework.ts';
122
-
123
- import type {
124
- CheckMagicCodeParams,
125
- CheckMagicCodeResponse,
126
- ExchangeCodeForTokenParams,
127
- SendMagicCodeParams,
128
- SendMagicCodeResponse,
129
- SignInAsGuestParams,
130
- SignInWithIdTokenParams,
131
- VerifyMagicCodeParams,
132
- VerifyResponse,
133
- } from './authAPI.ts';
134
-
135
- import { BackendRelayAPIError, type BackendRelayIssue } from './utils/fetch.js';
136
- import {
137
- BackendRelayError,
138
- notifyError,
139
- type BackendRelayErrorHandler,
140
- } from './BackendRelayError.ts';
141
- import {
142
- deriveWebsocketURI,
143
- MissingApiURIError,
144
- requireApiURI,
145
- } from './urls.ts';
146
- import {
147
- SSEConnection,
148
- EventSourceType,
149
- type EventSourceConstructor,
150
- } from './Connection.ts';
151
- import { CallbackEventType as SyncTableCallbackEventType } from './SyncTable.ts';
152
- import type {
153
- SyncTableCallback,
154
- CallbackEvent as SyncTableCallbackEvent,
155
- InitialSyncBatch as SyncTableInitialSyncBatch,
156
- InitialSyncComplete as SyncTableInitialSyncComplete,
157
- SyncTransaction as SyncTableSyncTransaction,
158
- LoadFromStorage as SyncTableLoadFromStorage,
159
- SetupError as SyncTableSetupError,
160
- } from './SyncTable.ts';
161
- import {
162
- BackendRelayStream,
163
- BackendRelayWritableStream,
164
- BackendRelayReadableStream,
165
- ReadableStreamCtor,
166
- WritableStreamCtor,
167
- } from './Stream.ts';
168
- import {
169
- type InfiniteQueryCallbackResponse,
170
- type InfiniteQuerySubscription,
171
- subscribeInfiniteQuery,
172
- getInfiniteQueryInitialSnapshot,
173
- } from './infiniteQuery.ts';
174
-
175
- export type Config = {
176
- appId: string;
177
- websocketURI?: string;
178
- apiURI?: string;
179
- devtool?: boolean | DevtoolConfig;
180
- verbose?: boolean;
181
- logger?: Logger;
182
- queryCacheLimit?: number;
183
- useDateObjects: boolean;
184
- disableValidation?: boolean;
185
- /**
186
- * Receives runtime failures (query, mutation and connection errors) so apps
187
- * can forward them to Sentry, Bugsink, or another error tracker.
188
- */
189
- onError?: BackendRelayErrorHandler;
190
- };
191
-
192
- export type BackendRelayConfig<
193
- S extends BackendRelaySchemaDef<any, any, any>,
194
- UseDates extends boolean = false,
195
- > = {
196
- appId: string;
197
- schema?: S;
198
- websocketURI?: string;
199
- firstPartyPath?: string;
200
- apiURI?: string;
201
- devtool?: boolean | DevtoolConfig;
202
- verbose?: boolean;
203
- logger?: Logger;
204
- queryCacheLimit?: number;
205
- useDateObjects: UseDates;
206
- disableValidation?: boolean;
207
- /** Receives runtime failures for error reporting. */
208
- onError?: BackendRelayErrorHandler;
209
- Store?: StoreInterfaceClass;
210
- WritableStream?: WritableStreamCtor;
211
- ReadableStream?: ReadableStreamCtor;
212
- };
213
-
214
- export type ConfigWithSchema<S extends BackendRelayGraph<any, any>> = Config & {
215
- schema: S;
216
- };
217
-
218
- export type TransactionResult = {
219
- status: 'synced' | 'enqueued';
220
- clientId: string;
221
- };
222
-
223
- export type PublishTopic<TopicsByKey> = <Key extends keyof TopicsByKey>(
224
- topic: Key,
225
- data: TopicsByKey[Key],
226
- ) => void;
227
-
228
- export type SubscribeTopic<PresenceShape, TopicsByKey> = <
229
- Key extends keyof TopicsByKey,
230
- >(
231
- topic: Key,
232
- onEvent: (event: TopicsByKey[Key], peer: PresenceShape) => void,
233
- ) => () => void;
234
-
235
- export type GetPresence<PresenceShape> = <Keys extends keyof PresenceShape>(
236
- opts: PresenceOpts<PresenceShape, Keys>,
237
- ) => PresenceResponse<PresenceShape, Keys> | null;
238
-
239
- export type SubscribePresence<PresenceShape> = <
240
- Keys extends keyof PresenceShape,
241
- >(
242
- opts: PresenceOpts<PresenceShape, Keys>,
243
- onChange: (slice: PresenceResponse<PresenceShape, Keys>) => void,
244
- ) => () => void;
245
-
246
- export type RoomHandle<PresenceShape, TopicsByKey> = {
247
- leaveRoom: () => void;
248
- publishTopic: PublishTopic<TopicsByKey>;
249
- subscribeTopic: SubscribeTopic<PresenceShape, TopicsByKey>;
250
- publishPresence: (data: Partial<PresenceShape>) => void;
251
- getPresence: GetPresence<PresenceShape>;
252
- subscribePresence: SubscribePresence<PresenceShape>;
253
- };
254
-
255
- type AuthToken = string;
256
-
257
- type SubscriptionState<Q, Schema, WithCardinalityInference extends boolean> =
258
- | {
259
- error: { message: string; traceId?: string };
260
- data: undefined;
261
- pageInfo: undefined;
262
- }
263
- | {
264
- error: undefined;
265
- data: QueryResponse<Q, Schema, WithCardinalityInference>;
266
- pageInfo: PageInfoResponse<Q>;
267
- };
268
-
269
- type InstaQLSubscriptionState<Schema, Q, UseDates extends boolean> =
270
- | {
271
- error: { message: string; traceId?: string };
272
- data: undefined;
273
- pageInfo: undefined;
274
- }
275
- | {
276
- error: undefined;
277
- data: InstaQLResponse<Schema, Q, UseDates>;
278
- pageInfo: PageInfoResponse<Q>;
279
- };
280
-
281
- type LifecycleSubscriptionState<
282
- Q,
283
- Schema,
284
- WithCardinalityInference extends boolean,
285
- > = SubscriptionState<Q, Schema, WithCardinalityInference> & {
286
- isLoading: boolean;
287
- };
288
-
289
- type InstaQLLifecycleState<Schema, Q, UseDates extends boolean = false> =
290
- | (InstaQLSubscriptionState<Schema, Q, UseDates> & {
291
- isLoading: boolean;
292
- })
293
- | {
294
- isLoading: true;
295
- data: undefined;
296
- pageInfo: undefined;
297
- error: undefined;
298
- };
299
-
300
- type UnsubscribeFn = () => void;
301
-
302
- // consts
303
-
304
- // hmr
305
- function initSchemaHashStore(): WeakMap<any, string> {
306
- globalThis.__backendrelayDbSchemaHashStore =
307
- globalThis.__backendrelayDbSchemaHashStore ?? new WeakMap<any, string>();
308
- return globalThis.__backendrelayDbSchemaHashStore;
309
- }
310
-
311
- function initGlobalBackendRelayCoreStore(): Record<string, any> {
312
- globalThis.__backendrelayDbStore = globalThis.__backendrelayDbStore ?? {};
313
- return globalThis.__backendrelayDbStore;
314
- }
315
-
316
- function reactorKey(config: BackendRelayConfig<any, boolean>): string {
317
- // @ts-expect-error
318
- const adminToken = config.__adminToken;
319
- // Sometimes you _want_ to simulate two separate db instances in the same
320
- // page. This can happen when doing real-time demos. To make this work we
321
- // have a hidden `__extraDedupeKey` that you can use to differentiate db
322
- // configs that are otherwise exactly the same.
323
- // @ts-expect-error
324
- const extraDedupeKey = config.__extraDedupeKey;
325
- return (
326
- config.appId +
327
- '_' +
328
- (config.websocketURI || 'default_ws_uri') +
329
- '_' +
330
- (config.apiURI || 'default_api_uri') +
331
- '_' +
332
- (adminToken || 'client_only') +
333
- '_' +
334
- config.useDateObjects +
335
- '_' +
336
- (extraDedupeKey || '')
337
- );
338
- }
339
-
340
- const globalBackendRelayCoreStore = initGlobalBackendRelayCoreStore();
341
- const schemaHashStore = initSchemaHashStore();
342
-
343
- type SignoutOpts = {
344
- invalidateToken?: boolean;
345
- };
346
-
347
- /**
348
- * Functions to log users in and out.
349
- *
350
- * @see https://backendrelay.com/docs/auth
351
- */
352
- class Auth {
353
- constructor(private db: Reactor) {}
354
-
355
- /**
356
- * Sends a magic code to the user's email address.
357
- *
358
- * Once you send the magic code, see {@link auth.signInWithMagicCode} to let the
359
- * user verify.
360
- *
361
- * @see https://backendrelay.com/docs/auth
362
- * @example
363
- * db.auth.sendMagicCode({email: "example@gmail.com"})
364
- * .catch((err) => console.error(err.body?.message))
365
- */
366
- sendMagicCode = (
367
- params: SendMagicCodeParams,
368
- ): Promise<SendMagicCodeResponse> => {
369
- return this.db.sendMagicCode(params);
370
- };
371
-
372
- /**
373
- * Verify a magic code that was sent to the user's email address.
374
- *
375
- * @see https://backendrelay.com/docs/auth
376
- *
377
- * @example
378
- * db.auth.signInWithMagicCode({email: "example@gmail.com", code: "123456"})
379
- * .catch((err) => console.error(err.body?.message))
380
- */
381
- signInWithMagicCode = (
382
- params: CheckMagicCodeParams,
383
- ): Promise<CheckMagicCodeResponse> => {
384
- return this.db.signInWithMagicCode(params);
385
- };
386
-
387
- /**
388
- * Sign in a user with a refresh token
389
- *
390
- * @see https://backendrelay.com/docs/backend#frontend-auth-sign-in-with-token
391
- *
392
- * @example
393
- * // Get the token from your backend
394
- * const token = await fetch('/signin', ...);
395
- * //Sign in
396
- * db.auth.signInWithToken(token);
397
- */
398
- signInWithToken = (token: AuthToken): Promise<VerifyResponse> => {
399
- return this.db.signInWithCustomToken(token);
400
- };
401
-
402
- /**
403
- * Sign in as guest, creating a new user without email
404
- *
405
- * @see https://backendrelay.com/docs/auth
406
- *
407
- * @example
408
- * db.auth.signInAsGuest();
409
- */
410
- signInAsGuest = (params?: SignInAsGuestParams): Promise<VerifyResponse> => {
411
- return this.db.signInAsGuest(params);
412
- };
413
-
414
- /**
415
- * Create an authorization url to sign in with an external provider.
416
- *
417
- * @see https://backendrelay.com/docs/auth
418
- *
419
- * @example
420
- * // Get the authorization url from your backend
421
- * const url = db.auth.createAuthorizationUrl({
422
- * clientName: "google",
423
- * redirectURL: window.location.href,
424
- * });
425
- *
426
- * // Put it in a sign in link
427
- * <a href={url}>Log in with Google</a>
428
- */
429
- createAuthorizationURL = (params: {
430
- clientName: string;
431
- redirectURL: string;
432
- extraFields?: Record<string, any>;
433
- }): string => {
434
- return this.db.createAuthorizationURL(params);
435
- };
436
-
437
- /**
438
- * Sign in with the id_token from an external provider like Google
439
- *
440
- * @see https://backendrelay.com/docs/auth
441
- * @example
442
- * db.auth
443
- * .signInWithIdToken({
444
- * // Token from external service
445
- * idToken: id_token,
446
- * // The name you gave the client when you registered it with BackendRelay
447
- * clientName: "google",
448
- * // The nonce, if any, that you used when you initiated the auth flow
449
- * // with the external service.
450
- * nonce: your_nonce
451
- * })
452
- * .catch((err) => console.error(err.body?.message));
453
- *
454
- */
455
- signInWithIdToken = (
456
- params: SignInWithIdTokenParams,
457
- ): Promise<CheckMagicCodeResponse> => {
458
- return this.db.signInWithIdToken(params);
459
- };
460
-
461
- /**
462
- * Sign in with the id_token from an external provider like Google
463
- *
464
- * @see https://backendrelay.com/docs/auth
465
- * @example
466
- * db.auth
467
- * .exchangeOAuthCode({
468
- * // code received in redirect from OAuth callback
469
- * code: code
470
- * // The PKCE code_verifier, if any, that you used when you
471
- * // initiated the auth flow
472
- * codeVerifier: your_code_verifier
473
- * })
474
- * .catch((err) => console.error(err.body?.message));
475
- *
476
- */
477
- exchangeOAuthCode = (
478
- params: ExchangeCodeForTokenParams,
479
- ): Promise<CheckMagicCodeResponse> => {
480
- return this.db.exchangeCodeForToken(params);
481
- };
482
-
483
- /**
484
- * OpenID Discovery path for use with tools like
485
- * expo-auth-session that use auto-discovery of
486
- * OAuth parameters.
487
- *
488
- * @see https://backendrelay.com/docs/auth
489
- * @example
490
- * const discovery = useAutoDiscovery(
491
- * db.auth.issuerURI()
492
- * );
493
- */
494
- issuerURI = (): string => {
495
- return this.db.issuerURI();
496
- };
497
-
498
- /**
499
- * Sign out the current user
500
- */
501
- signOut = (opts: SignoutOpts = { invalidateToken: true }): Promise<void> => {
502
- return this.db.signOut(opts);
503
- };
504
- }
505
-
506
- type FileOpts = {
507
- contentType?: string;
508
- contentDisposition?: string;
509
- fileSize?: number; // Required for streaming uploads
510
- };
511
-
512
- /**
513
- * Functions to manage file storage.
514
- */
515
- class Storage {
516
- constructor(private db: Reactor) {}
517
-
518
- /**
519
- * Uploads file at the provided path.
520
- *
521
- * @see https://backendrelay.com/docs/storage
522
- * @example
523
- * const [file] = e.target.files; // result of file input
524
- * const data = await db.storage.uploadFile('photos/demo.png', file);
525
- */
526
- uploadFile = (
527
- path: string,
528
- file: File | Blob,
529
- opts: FileOpts = {},
530
- ): Promise<UploadFileResponse> => {
531
- return this.db.uploadFile(path, file, opts);
532
- };
533
-
534
- /**
535
- * Deletes a file by path name.
536
- *
537
- * @deprecated Use `db.transact` to delete files instead:
538
- * @example
539
- * // Delete by id
540
- * db.transact(db.tx.$files[fileId].delete());
541
- *
542
- * // Delete by path
543
- * db.transact(db.tx.$files[lookup('path', 'photos/demo.png')].delete());
544
- *
545
- * // Delete multiple files
546
- * db.transact(fileIds.map(id => db.tx.$files[id].delete()));
547
- *
548
- * @see https://backendrelay.com/docs/storage
549
- */
550
- delete = (pathname: string) => {
551
- return this.db.deleteFile(pathname);
552
- };
553
-
554
- // Deprecated Storage API (Jan 2025)
555
- // ---------------------------------
556
-
557
- /**
558
- * @deprecated. Use `db.storage.uploadFile` instead
559
- * remove in the future.
560
- */
561
- upload = (pathname: string, file: File) => {
562
- return this.db.upload(pathname, file);
563
- };
564
-
565
- /**
566
- * @deprecated Use `db.storage.uploadFile` instead
567
- */
568
- put = this.upload;
569
-
570
- /**
571
- * @deprecated. getDownloadUrl will be removed in the future.
572
- * Use `useQuery` instead to query and fetch for valid urls
573
- *
574
- * db.useQuery({
575
- * $files: {
576
- * $: {
577
- * where: {
578
- * path: "moop.png"
579
- * }
580
- * }
581
- * }
582
- * })
583
- */
584
- getDownloadUrl = (pathname: string) => {
585
- return this.db.getDownloadUrl(pathname);
586
- };
587
- }
588
-
589
- type CreateReadStreamOpts = {
590
- clientId?: string | null | undefined;
591
- streamId?: string | null | undefined;
592
- byteOffset?: number | null | undefined;
593
- ruleParams?: RuleParams | null | undefined;
594
- };
595
-
596
- type CreateWriteStreamOpts = {
597
- clientId: string;
598
- /**
599
- * A function that takes a promise and ensures that the current program stays alive
600
- * until the promise is resolved.
601
- *
602
- * Useful in serverless environments to ensure the writer fully flushes before the
603
- * environment is shut down.
604
- *
605
- * @example
606
- * import { after } from 'next/server'
607
- * db.streams.createWriteStream({clientId, waitUntil: after})
608
- */
609
- waitUntil?: (promise: Promise<any>) => void | null | undefined;
610
- ruleParams?: RuleParams | null | undefined;
611
- };
612
-
613
- /**
614
- * Functions to manage streams.
615
- */
616
- class Streams {
617
- constructor(private db: Reactor) {}
618
-
619
- /**
620
- * Creates a new ReadableStream for the given clientId.
621
- *
622
- * @example
623
- * const stream = db.streams.createReadStream({clientId: clientId})
624
- * for await (const chunk of stream) {
625
- * console.log(chunk);
626
- * }
627
- */
628
- createReadStream = (
629
- opts: CreateReadStreamOpts,
630
- ): BackendRelayReadableStream<string> => {
631
- return this.db.createReadStream(opts);
632
- };
633
-
634
- /**
635
- * Creates a new WritableStream for the given clientId.
636
- *
637
- * @example
638
- * const writeStream = db.streams.createWriteStream({clientId: clientId})
639
- * const writer = writeStream.getWriter();
640
- * writer.write('Hello world');
641
- * writer.close();
642
- */
643
- createWriteStream = (
644
- opts: CreateWriteStreamOpts,
645
- ): BackendRelayWritableStream<string> => {
646
- return this.db.createWriteStream(opts);
647
- };
648
- }
649
-
650
- // util
651
-
652
- function coerceQuery(o: any) {
653
- // stringify and parse to remove undefined values
654
- return JSON.parse(JSON.stringify(o));
655
- }
656
-
657
- class BackendRelayCoreDatabase<
658
- Schema extends BackendRelaySchemaDef<any, any, any>,
659
- UseDates extends boolean = false,
660
- > implements IBackendRelayDatabase<Schema>
661
- {
662
- public _reactor: Reactor<RoomsOf<Schema>>;
663
- public auth: Auth;
664
- public storage: Storage;
665
- public streams: Streams;
666
-
667
- public tx = txInit<Schema>();
668
-
669
- constructor(reactor: Reactor<RoomsOf<Schema>>) {
670
- this._reactor = reactor;
671
- this.auth = new Auth(this._reactor);
672
- this.storage = new Storage(this._reactor);
673
- this.streams = new Streams(this._reactor);
674
- }
675
-
676
- /**
677
- * Use this to write data! You can create, update, delete, and link objects
678
- *
679
- * @see https://backendrelay.com/docs/instaml
680
- *
681
- * @example
682
- * // Create a new object in the `goals` namespace
683
- * const goalId = id();
684
- * db.transact(db.tx.goals[goalId].update({title: "Get fit"}))
685
- *
686
- * // Update the title
687
- * db.transact(db.tx.goals[goalId].update({title: "Get super fit"}))
688
- *
689
- * // Delete it
690
- * db.transact(db.tx.goals[goalId].delete())
691
- *
692
- * // Or create an association:
693
- * todoId = id();
694
- * db.transact([
695
- * db.tx.todos[todoId].update({ title: 'Go on a run' }),
696
- * db.tx.goals[goalId].link({todos: todoId}),
697
- * ])
698
- */
699
- transact(
700
- chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],
701
- ): Promise<TransactionResult> {
702
- return this._reactor.pushTx(chunks);
703
- }
704
-
705
- /**
706
- * Applies a transaction to local queries without sending it to the server.
707
- * Use it to make a server function feel instant, then call `rollback` when
708
- * the function returns or fails. The server's realtime refresh is the source
709
- * of truth.
710
- */
711
- applyOptimistic(
712
- chunks: TransactionChunk<any, any> | TransactionChunk<any, any>[],
713
- ): { eventId: string; rollback: () => void } {
714
- return this._reactor.pushOptimisticTx(chunks);
715
- }
716
-
717
- getLocalId(name: string): Promise<string> {
718
- return this._reactor.getLocalId(name);
719
- }
720
-
721
- /**
722
- * Use this to query your data!
723
- *
724
- * @see https://backendrelay.com/docs/instaql
725
- *
726
- * @example
727
- * // listen to all goals
728
- * db.subscribeQuery({ goals: {} }, (resp) => {
729
- * console.log(resp.data.goals)
730
- * })
731
- *
732
- * // goals where the title is "Get Fit"
733
- * db.subscribeQuery(
734
- * { goals: { $: { where: { title: "Get Fit" } } } },
735
- * (resp) => {
736
- * console.log(resp.data.goals)
737
- * }
738
- * )
739
- *
740
- * // all goals, _alongside_ their todos
741
- * db.subscribeQuery({ goals: { todos: {} } }, (resp) => {
742
- * console.log(resp.data.goals)
743
- * });
744
- */
745
- subscribeQuery<
746
- Q extends ValidQuery<Q, Schema>,
747
- UseDatesLocal extends boolean = UseDates,
748
- >(
749
- query: Q,
750
- cb: (resp: InstaQLSubscriptionState<Schema, Q, UseDatesLocal>) => void,
751
- opts?: InstaQLOptions,
752
- ) {
753
- return this._reactor.subscribeQuery(query, cb, opts);
754
- }
755
-
756
- /**
757
- * Subscribe to a query and incrementally load more items
758
- *
759
- * Only one top level namespace in the query is allowed.
760
- * @example
761
- * const { unsubscribe, loadNextPage } = db.subscribeInfiniteQuery({
762
- * posts: {
763
- * $: {
764
- * limit: 20, // Load 20 posts at a time
765
- * order: {
766
- * createdAt: 'desc',
767
- * },
768
- * },
769
- * },
770
- * (resp) => {
771
- * console.log(resp.data.posts);
772
- * }
773
- * });
774
- */
775
- subscribeInfiniteQuery<Q extends ValidQuery<Q, Schema>>(
776
- query: Q,
777
- cb: (resp: InfiniteQueryCallbackResponse<Schema, Q, UseDates>) => void,
778
- opts?: InstaQLOptions,
779
- ): InfiniteQuerySubscription {
780
- return subscribeInfiniteQuery<Schema, Q, UseDates>(
781
- this as any,
782
- query,
783
- cb,
784
- opts,
785
- );
786
- }
787
-
788
- /**
789
- * Listen for the logged in state. This is useful
790
- * for deciding when to show a login screen.
791
- *
792
- * @see https://backendrelay.com/docs/auth
793
- * @example
794
- * const unsub = db.subscribeAuth((auth) => {
795
- * if (auth.user) {
796
- * console.log('logged in as', auth.user.email)
797
- * } else {
798
- * console.log('logged out')
799
- * }
800
- * })
801
- */
802
- subscribeAuth(cb: (auth: AuthResult) => void): UnsubscribeFn {
803
- return this._reactor.subscribeAuth(cb);
804
- }
805
-
806
- /**
807
- * One time query for the logged in state. This is useful
808
- * for scenarios where you want to know the current auth
809
- * state without subscribing to changes.
810
- *
811
- * @see https://backendrelay.com/docs/auth
812
- * @example
813
- * const user = await db.getAuth();
814
- * console.log('logged in as', user.email)
815
- */
816
- getAuth(): Promise<User | null> {
817
- return this._reactor.getAuth();
818
- }
819
-
820
- /**
821
- * Listen for connection status changes to BackendRelay. This is useful
822
- * for building things like connectivity indicators
823
- *
824
- * @see https://www.backendrelay.com/docs/patterns#connection-status
825
- * @example
826
- * const unsub = db.subscribeConnectionStatus((status) => {
827
- * const connectionState =
828
- * status === 'connecting' || status === 'opened'
829
- * ? 'authenticating'
830
- * : status === 'authenticated'
831
- * ? 'connected'
832
- * : status === 'closed'
833
- * ? 'closed'
834
- * : status === 'errored'
835
- * ? 'errored'
836
- * : 'unexpected state';
837
- *
838
- * console.log('Connection status:', connectionState);
839
- * });
840
- */
841
- subscribeConnectionStatus(
842
- cb: (status: ConnectionStatus) => void,
843
- ): UnsubscribeFn {
844
- return this._reactor.subscribeConnectionStatus(cb);
845
- }
846
-
847
- /**
848
- * Observe the app's maintenance-mode state. While read-only, reads and
849
- * live queries keep working but writes are rejected. The callback fires
850
- * immediately with the current state and again on every change.
851
- *
852
- * @example
853
- * const unsub = db.subscribeAppStatus(({ isLoading, isReadOnly }) => {
854
- * if (isLoading) return;
855
- * if (isReadOnly) showMaintenanceBanner();
856
- * });
857
- */
858
- subscribeAppStatus(cb: (state: AppStatusState) => void): UnsubscribeFn {
859
- return this._reactor.subscribeAppStatus(cb);
860
- }
861
-
862
- /**
863
- * Join a room to publish and subscribe to topics and presence.
864
- *
865
- * @see https://backendrelay.com/docs/presence-and-topics
866
- * @example
867
- * // init
868
- * const db = init();
869
- * const room = db.joinRoom(roomType, roomId);
870
- * // usage
871
- * const unsubscribeTopic = room.subscribeTopic("foo", console.log);
872
- * const unsubscribePresence = room.subscribePresence({}, console.log);
873
- * room.publishTopic("hello", { message: "hello world!" });
874
- * room.publishPresence({ name: "joe" });
875
- * // later
876
- * unsubscribePresence();
877
- * unsubscribeTopic();
878
- * room.leaveRoom();
879
- */
880
- joinRoom<RoomType extends string & keyof RoomsOf<Schema>>(
881
- roomType: RoomType = '_defaultRoomType' as RoomType,
882
- roomId: string = '_defaultRoomId',
883
- opts?: {
884
- initialPresence?: Partial<PresenceOf<Schema, RoomType>>;
885
- },
886
- ): RoomHandle<PresenceOf<Schema, RoomType>, TopicsOf<Schema, RoomType>> {
887
- const leaveRoom = this._reactor.joinRoom(
888
- roomType,
889
- roomId,
890
- opts?.initialPresence,
891
- );
892
-
893
- return {
894
- leaveRoom,
895
- subscribeTopic: (topic, onEvent) =>
896
- this._reactor.subscribeTopic(roomType, roomId, topic, onEvent),
897
- subscribePresence: (opts, onChange) =>
898
- this._reactor.subscribePresence(roomType, roomId, opts, onChange),
899
- publishTopic: (topic, data) =>
900
- this._reactor.publishTopic({ roomType, roomId, topic, data }),
901
- publishPresence: (data) =>
902
- this._reactor.publishPresence(roomType, roomId, data),
903
- getPresence: (opts) => this._reactor.getPresence(roomType, roomId, opts),
904
- };
905
- }
906
-
907
- shutdown() {
908
- delete globalBackendRelayCoreStore[reactorKey(this._reactor.config)];
909
- this._reactor.shutdown();
910
- }
911
-
912
- /**
913
- * Use this for one-off queries.
914
- * Returns local data if available, otherwise fetches from the server.
915
- * Because we want to avoid stale data, this method will throw an error
916
- * if the user is offline or there is no active connection to the server.
917
- *
918
- * @see https://backendrelay.com/docs/instaql
919
- *
920
- * @example
921
- *
922
- * const resp = await db.queryOnce({ goals: {} });
923
- * console.log(resp.data.goals)
924
- */
925
- queryOnce<Q extends ValidQuery<Q, Schema>>(
926
- query: Q,
927
- opts?: InstaQLOptions,
928
- ): Promise<{
929
- data: InstaQLResponse<Schema, Q, UseDates>;
930
- pageInfo: PageInfoResponse<Q>;
931
- }> {
932
- return this._reactor.queryOnce(query, opts);
933
- }
934
-
935
- /**
936
- * @deprecated This is an experimental function that is not yet ready for production use.
937
- * Subscribes to an InstaQL query and delivers its normal combined result.
938
- */
939
- _syncTableExperimental<Q extends ValidQuery<Q, Schema>>(
940
- query: Q,
941
- cb: SyncTableCallback<Schema, Q, UseDates>,
942
- ): (
943
- opts?: { keepSubscription: boolean | null | undefined } | null | undefined,
944
- ) => void {
945
- return this._reactor.subscribeTable(query, cb);
946
- }
947
- }
948
-
949
- function schemaHash(schema?: BackendRelaySchemaDef<any, any, any>): string {
950
- if (!schema) {
951
- return '0';
952
- }
953
-
954
- const fromStore = schemaHashStore.get(schema);
955
- if (fromStore) {
956
- return fromStore;
957
- }
958
- const hash = weakHash(schema);
959
- schemaHashStore.set(schema, hash);
960
- return hash;
961
- }
962
-
963
- function schemaChanged(
964
- existingClient: BackendRelayCoreDatabase<any, boolean>,
965
- newSchema?: BackendRelaySchemaDef<any, any, any>,
966
- ): boolean {
967
- return (
968
- schemaHash(existingClient._reactor.config.schema) !== schemaHash(newSchema)
969
- );
970
- }
971
-
972
- /**
973
- *
974
- * The first step: init your application!
975
- *
976
- * Visit your BackendRelay dashboard to get your `appId`, and pass the API
977
- * origin as `apiURI` :) The SDK no longer defaults to backendrelay.com.
978
- *
979
- * @example
980
- * import { init } from "@backendrelay/core"
981
- *
982
- * const db = init({ appId: "my-app-id", apiURI: "https://api.example.com" })
983
- *
984
- * // You can also provide a schema for type safety and editor autocomplete!
985
- *
986
- * import { init } from "@backendrelay/core"
987
- * import schema from ""../backendrelay.schema.ts";
988
- *
989
- * const db = init({ appId: "my-app-id", apiURI: "https://api.example.com", schema })
990
- *
991
- * // To learn more about modeling data: see the BackendRelay docs.
992
- */
993
- function init<
994
- Schema extends BackendRelaySchemaDef<
995
- any,
996
- any,
997
- any
998
- > = BackendRelayUnknownSchema,
999
- UseDates extends boolean = false,
1000
- >(
1001
- // Allows config with missing `useDateObjects`, but keeps `UseDates`
1002
- // as a non-nullable in the BackendRelayConfig type.
1003
- config: Omit<BackendRelayConfig<Schema, UseDates>, 'useDateObjects'> & {
1004
- useDateObjects?: UseDates;
1005
- },
1006
- Store?: any,
1007
- NetworkListener?: any,
1008
- versions?: { [key: string]: string },
1009
- EventSourceImpl?: any,
1010
- ): BackendRelayCoreDatabase<Schema, UseDates> {
1011
- const apiURI = requireApiURI(config.apiURI, 'BackendRelay core SDK');
1012
- const configStrict = {
1013
- ...config,
1014
- appId: config.appId?.trim(),
1015
- apiURI,
1016
- websocketURI: config.websocketURI ?? deriveWebsocketURI(apiURI),
1017
- useDateObjects: (config.useDateObjects ?? false) as UseDates,
1018
- };
1019
- const existingClient = globalBackendRelayCoreStore[
1020
- reactorKey(configStrict)
1021
- ] as BackendRelayCoreDatabase<any, UseDates>;
1022
-
1023
- if (existingClient) {
1024
- if (schemaChanged(existingClient, configStrict.schema)) {
1025
- existingClient._reactor.updateSchema(configStrict.schema);
1026
- }
1027
- return existingClient;
1028
- }
1029
-
1030
- const reactor = new Reactor<RoomsOf<Schema>>(
1031
- {
1032
- ...configStrict,
1033
- cardinalityInference: configStrict.schema ? true : false,
1034
- },
1035
- Store || IndexedDBStorage,
1036
- NetworkListener || WindowNetworkListener,
1037
- { ...(versions || {}), '@backendrelay/core': version },
1038
- EventSourceImpl,
1039
- );
1040
-
1041
- const client = new BackendRelayCoreDatabase<any, UseDates>(reactor);
1042
- globalBackendRelayCoreStore[reactorKey(configStrict)] = client;
1043
-
1044
- handleDevtool(configStrict.appId, configStrict.devtool);
1045
-
1046
- return client;
1047
- }
1048
-
1049
- function handleDevtool(
1050
- appId: string,
1051
- devtool: boolean | DevtoolConfig | null | undefined,
1052
- ) {
1053
- if (
1054
- typeof window === 'undefined' ||
1055
- typeof window.location === 'undefined' ||
1056
- typeof document === 'undefined'
1057
- ) {
1058
- return;
1059
- }
1060
-
1061
- if (typeof devtool === 'boolean' && !devtool) {
1062
- return;
1063
- }
1064
-
1065
- // The devtool is opt-in: without an explicit `devtool: true` or config object
1066
- // we never mount an iframe or call a dashboard origin.
1067
- if (devtool !== true && (typeof devtool !== 'object' || devtool === null)) {
1068
- return;
1069
- }
1070
-
1071
- const config: StrictDevtoolConfig = {
1072
- position: 'bottom-right' as const,
1073
- allowedHosts: ['localhost'],
1074
- ...(typeof devtool === 'object' ? devtool : {}),
1075
- };
1076
-
1077
- if (!config.allowedHosts.includes(window.location.hostname)) {
1078
- return;
1079
- }
1080
-
1081
- createDevtool(appId, config);
1082
- }
1083
-
1084
- /**
1085
- * @deprecated
1086
- * `init_experimental` is deprecated. You can replace it with `init`.
1087
- *
1088
- * @example
1089
- *
1090
- * // Before
1091
- * import { init_experimental } from "@backendrelay/core"
1092
- * const db = init_experimental({ ... });
1093
- *
1094
- * // After
1095
- * import { init } from "@backendrelay/core"
1096
- * const db = init({ ... });
1097
- */
1098
- const init_experimental = init;
1099
-
1100
- export {
1101
- // bada bing bada boom
1102
- init,
1103
- init_experimental,
1104
- id,
1105
- tx,
1106
- txInit,
1107
- lookup,
1108
- validateQuery,
1109
- QueryValidationError,
1110
- validateTransactions,
1111
- parseSchemaFromJSON,
1112
- TransactionValidationError,
1113
- FrameworkClient,
1114
- Reactor,
1115
-
1116
- // error
1117
- BackendRelayAPIError,
1118
- BackendRelayError,
1119
- MissingApiURIError,
1120
- notifyError,
1121
- type BackendRelayErrorHandler,
1122
-
1123
- // config
1124
- requireApiURI,
1125
- deriveWebsocketURI,
1126
-
1127
- // warnings
1128
- setBackendRelayWarningsEnabled,
1129
-
1130
- // cli
1131
- i,
1132
-
1133
- // util
1134
- getOps,
1135
- coerceQuery,
1136
- weakHash,
1137
- coerceToDate,
1138
- IndexedDBStorage,
1139
- WindowNetworkListener,
1140
- BackendRelayCoreDatabase,
1141
- Auth,
1142
- Storage,
1143
- Streams,
1144
- version,
1145
-
1146
- // infinite query
1147
- getInfiniteQueryInitialSnapshot,
1148
-
1149
- // sync table enums
1150
- SyncTableCallbackEventType,
1151
-
1152
- // og types
1153
- type IDatabase,
1154
- type RoomSchemaShape,
1155
- type Query,
1156
- type QueryResponse,
1157
- type InstaQLResponse,
1158
- type PageInfoResponse,
1159
- type BackendRelayObject,
1160
- type Exactly,
1161
- type TransactionChunk,
1162
- type AuthState,
1163
- type ConnectionStatus,
1164
- type AppStatusState,
1165
- type User,
1166
- type AuthToken,
1167
- type TxChunk,
1168
- type SubscriptionState,
1169
- type InstaQLSubscriptionState,
1170
- type LifecycleSubscriptionState,
1171
- type InstaQLLifecycleState,
1172
-
1173
- // presence types
1174
- type PresenceOpts,
1175
- type PresenceSlice,
1176
- type PresenceResponse,
1177
- type PresencePeer,
1178
-
1179
- // new query types
1180
- type InstaQLParams,
1181
- type ValidQuery,
1182
- type Cursor,
1183
- type InstaQLOptions,
1184
- type InstaQLQueryParams,
1185
- type BackendRelayQuery,
1186
- type BackendRelayQueryResult,
1187
- type BackendRelaySchema,
1188
- type BackendRelayEntity,
1189
- type BackendRelaySchemaDatabase,
1190
- type InstaQLFields,
1191
- type Order,
1192
- type InstaQLQueryEntityResult,
1193
- type InfiniteQueryCallbackResponse,
1194
- type InfiniteQuerySubscription,
1195
-
1196
- // schema types
1197
- type AttrsDefs,
1198
- type CardinalityKind,
1199
- type DataAttrDef,
1200
- type EntitiesDef,
1201
- type BackendRelayUnknownSchemaDef,
1202
- type EntitiesWithLinks,
1203
- type EntityDef,
1204
- type RoomsDef,
1205
- type BackendRelayGraph,
1206
- type LinkAttrDef,
1207
- type LinkDef,
1208
- type LinksDef,
1209
- type ResolveAttrs,
1210
- type ValueTypes,
1211
- type RoomsOf,
1212
- type PresenceOf,
1213
- type TopicsOf,
1214
- type TopicOf,
1215
- type InstaQLEntity,
1216
- type InstaQLResult,
1217
- type InstaQLEntitySubquery,
1218
- type BackendRelaySchemaDef,
1219
- type BackendRelayUnknownSchema,
1220
- type IBackendRelayDatabase,
1221
- type BackwardsCompatibleSchema,
1222
- type BackendRelayRules,
1223
- type UpdateParams,
1224
- type LinkParams,
1225
- type CreateParams,
1226
- type RuleParams,
1227
-
1228
- // attr types
1229
- type BackendRelayDBAttr,
1230
- type BackendRelayDBAttrOnDelete,
1231
- type BackendRelayDBCheckedDataType,
1232
- type BackendRelayDBIdent,
1233
- type BackendRelayDBInferredType,
1234
-
1235
- // auth types
1236
- type CheckMagicCodeParams,
1237
- type CheckMagicCodeResponse,
1238
- type ExchangeCodeForTokenParams,
1239
- type SendMagicCodeParams,
1240
- type SendMagicCodeResponse,
1241
- type SignInAsGuestParams,
1242
- type SignInWithIdTokenParams,
1243
- type VerifyMagicCodeParams,
1244
- type VerifyResponse,
1245
-
1246
- // storage types
1247
- type FileOpts,
1248
- type UploadFileResponse,
1249
- type DeleteFileResponse,
1250
-
1251
- // SSE
1252
- SSEConnection,
1253
- type EventSourceType,
1254
- type FrameworkConfig,
1255
- type EventSourceConstructor,
1256
-
1257
- // streams
1258
- BackendRelayStream,
1259
- type WritableStreamCtor,
1260
- type ReadableStreamCtor,
1261
- type CreateReadStreamOpts,
1262
- type CreateWriteStreamOpts,
1263
- type BackendRelayWritableStream,
1264
- type BackendRelayReadableStream,
1265
-
1266
- // sync table types
1267
- type SyncTableCallback,
1268
- type SyncTableCallbackEvent,
1269
- type SyncTableInitialSyncBatch,
1270
- type SyncTableInitialSyncComplete,
1271
- type SyncTableSyncTransaction,
1272
- type SyncTableLoadFromStorage,
1273
- type SyncTableSetupError,
1274
-
1275
- // error types
1276
- type BackendRelayIssue,
1277
-
1278
- // store (e.g. indexeddb) interface
1279
- StoreInterface,
1280
- type StoreInterfaceClass,
1281
- type StoreInterfaceStoreName,
1282
- createBackendRelayRouteHandler,
1283
- type BackendRelayRouteHandlerPayloadByType,
1284
- type BackendRelayRouteHandlerType,
1285
- type BackendRelayRouteHandlerBody,
1286
- type Logger,
1287
- };
1288
-
1289
- /** @deprecated Use StoreInterface instead */
1290
- export const StorageInterface = StoreInterface;
1291
-
1292
- /** @deprecated Use StoreInterfaceStoreName instead */
1293
- export type StorageInterfaceStoreName = StoreInterfaceStoreName;