@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
@@ -0,0 +1,1146 @@
1
+ import { validate as uuidValidate } from 'uuid';
2
+ import { tx, lookup, getOps, i, id, txInit, version as coreVersion, BackendRelayAPIError, setBackendRelayWarningsEnabled, BackendRelayError, notifyError, requireApiURI, validateQuery, validateTransactions, createBackendRelayRouteHandler, SSEConnection, BackendRelayStream, } from '@backendrelay/core';
3
+ import version from "./version.js";
4
+ import { subscribe, } from "./subscribe.js";
5
+ import { parseCookie } from 'cookie';
6
+ import { EventSource } from '@instantdb/eventsource';
7
+ import { MessageEventPolyfill } from "./polyfill.js";
8
+ import { Webhooks, WebhooksManager, } from '@backendrelay/webhooks';
9
+ function configWithDefaults(config) {
10
+ return {
11
+ ...config,
12
+ apiURI: requireApiURI(config.apiURI, 'BackendRelay admin SDK'),
13
+ };
14
+ }
15
+ function backendrelayConfigWithDefaults(config) {
16
+ return {
17
+ ...config,
18
+ apiURI: requireApiURI(config.apiURI, 'BackendRelay admin SDK'),
19
+ };
20
+ }
21
+ function withImpersonation(headers, opts) {
22
+ if ('email' in opts) {
23
+ headers['as-email'] = opts.email;
24
+ }
25
+ else if ('token' in opts) {
26
+ headers['as-token'] = opts.token;
27
+ }
28
+ else if ('guest' in opts) {
29
+ headers['as-guest'] = 'true';
30
+ }
31
+ return headers;
32
+ }
33
+ function validateConfigAndImpersonation(config, impersonationOpts) {
34
+ if (impersonationOpts &&
35
+ ('token' in impersonationOpts || 'guest' in impersonationOpts)) {
36
+ // adminToken is not required for `token` or `guest` impersonation
37
+ return;
38
+ }
39
+ if (config.adminToken) {
40
+ // An adminToken is provided.
41
+ return;
42
+ }
43
+ if (impersonationOpts && 'email' in impersonationOpts) {
44
+ throw new Error('Admin token required. To impersonate users with an email you must pass `adminToken` to `init`.');
45
+ }
46
+ throw new Error('Admin token required. To run this operation pass `adminToken` to `init`, or use `db.asUser`.');
47
+ }
48
+ function authorizedHeaders(config, impersonationOpts) {
49
+ validateConfigAndImpersonation(config, impersonationOpts);
50
+ const { adminToken, appId } = config;
51
+ const headers = {
52
+ 'content-type': 'application/json',
53
+ 'app-id': appId,
54
+ };
55
+ if (adminToken) {
56
+ headers.authorization = `Bearer ${adminToken}`;
57
+ }
58
+ if (config.requestId) {
59
+ headers['x-request-id'] = config.requestId;
60
+ }
61
+ return impersonationOpts
62
+ ? withImpersonation(headers, impersonationOpts)
63
+ : headers;
64
+ }
65
+ // NextJS 13 and 14 cache fetch requests by default.
66
+ //
67
+ // Since adminDB.query uses fetch, this means that it would also cache by default.
68
+ //
69
+ // We don't want this behavior. `adminDB.query` should return the latest result by default.
70
+ //
71
+ // To get around this, we set an explicit `cache` header for NextJS 13 and 14.
72
+ // This is no longer needed in NextJS 15 onwards, as the default is `no-store` again.
73
+ // Once NextJS 13 and 14 are no longer common, we can remove this code.
74
+ function isNextJSVersionThatCachesFetchByDefault() {
75
+ return (
76
+ // NextJS 13 onwards added a `__nextPatched` property to the fetch function
77
+ fetch['__nextPatched'] &&
78
+ // NextJS 15 onwards _also_ added a global `next-patch` symbol.
79
+ !globalThis[Symbol.for('next-patch')]);
80
+ }
81
+ function getDefaultFetchOpts() {
82
+ return isNextJSVersionThatCachesFetchByDefault() ? { cache: 'no-store' } : {};
83
+ }
84
+ async function jsonReject(rejectFn, res) {
85
+ const body = await res.text();
86
+ try {
87
+ const json = JSON.parse(body);
88
+ return rejectFn(new BackendRelayAPIError({ status: res.status, body: json }));
89
+ }
90
+ catch (_e) {
91
+ return rejectFn(new BackendRelayAPIError({
92
+ status: res.status,
93
+ body: { type: undefined, message: body },
94
+ }));
95
+ }
96
+ }
97
+ async function rawJsonFetch(input, init, onError) {
98
+ try {
99
+ const defaultFetchOpts = getDefaultFetchOpts();
100
+ const headers = {
101
+ ...(init?.headers || {}),
102
+ 'BackendRelay-Admin-Version': version,
103
+ 'BackendRelay-Core-Version': coreVersion,
104
+ };
105
+ const res = await fetch(input, { ...defaultFetchOpts, ...init, headers });
106
+ if (res.status === 200) {
107
+ const json = await res.json();
108
+ return Promise.resolve(json);
109
+ }
110
+ return await jsonReject((x) => Promise.reject(x), res);
111
+ }
112
+ catch (error) {
113
+ notifyError(onError, error);
114
+ throw error;
115
+ }
116
+ }
117
+ function makeEventSourceWrapper(opts) {
118
+ return class EventSourceWrapper {
119
+ source;
120
+ static OPEN = EventSource.OPEN;
121
+ static CONNECTING = EventSource.CONNECTING;
122
+ static CLOSED = EventSource.CLOSED;
123
+ url;
124
+ constructor(url) {
125
+ this.url = url;
126
+ this.source = this.#createEventSource(url);
127
+ }
128
+ get onopen() {
129
+ return this.source.onopen;
130
+ }
131
+ set onopen(fn) {
132
+ this.source.onopen = fn;
133
+ }
134
+ get onmessage() {
135
+ return this.source.onmessage;
136
+ }
137
+ set onmessage(fn) {
138
+ this.source.onmessage = fn;
139
+ }
140
+ get onerror() {
141
+ return this.source.onerror;
142
+ }
143
+ set onerror(fn) {
144
+ this.source.onerror = fn;
145
+ }
146
+ get readyState() {
147
+ return this.source.readyState;
148
+ }
149
+ close() {
150
+ this.source.close();
151
+ }
152
+ #createEventSource(url) {
153
+ const es = new EventSource(url, {
154
+ messageEvent: MessageEventPolyfill,
155
+ fetch(input, init) {
156
+ return fetch(input, {
157
+ ...init,
158
+ method: 'POST',
159
+ headers: opts.headers,
160
+ body: JSON.stringify({
161
+ 'inference?': opts.inference,
162
+ versions: {
163
+ '@backendrelay/admin': version,
164
+ '@backendrelay/core': coreVersion,
165
+ },
166
+ }),
167
+ });
168
+ },
169
+ });
170
+ return es;
171
+ }
172
+ };
173
+ }
174
+ /**
175
+ *
176
+ * The first step: init your application!
177
+ *
178
+ * Visit your BackendRelay dashboard to get your `appId` and `adminToken`, and
179
+ * pass the API origin as `apiURI` :) The admin SDK no longer defaults to
180
+ * backendrelay.com.
181
+ *
182
+ * @example
183
+ * import { init } from "@backendrelay/admin"
184
+ *
185
+ * const db = init({
186
+ * appId: process.env.BACKENDRELAY_APP_ID!,
187
+ * adminToken: process.env.BACKENDRELAY_APP_ADMIN_TOKEN,
188
+ * apiURI: process.env.BACKENDRELAY_API_URI!,
189
+ * })
190
+ *
191
+ * // You can also provide a schema for type safety and editor autocomplete!
192
+ *
193
+ * import { init } from "@backendrelay/admin"
194
+ * import schema from ""../backendrelay.schema.ts";
195
+ *
196
+ * const db = init({
197
+ * appId: process.env.BACKENDRELAY_APP_ID!,
198
+ * adminToken: process.env.BACKENDRELAY_APP_ADMIN_TOKEN,
199
+ * apiURI: process.env.BACKENDRELAY_API_URI!,
200
+ * schema,
201
+ * })
202
+ */
203
+ function init(
204
+ // Allows config with missing `useDateObjects`, but keeps `UseDates`
205
+ // as a non-nullable in the BackendRelayConfig type.
206
+ config) {
207
+ if (!config.appId || !uuidValidate(config.appId)) {
208
+ console.warn('warning: BackendRelay Admin DB must be initialized with a valid appId. Received: ' +
209
+ JSON.stringify(config.appId));
210
+ }
211
+ const configStrict = {
212
+ ...config,
213
+ appId: config.appId?.trim(),
214
+ adminToken: config.adminToken?.trim(),
215
+ useDateObjects: (config.useDateObjects ?? false),
216
+ };
217
+ return new BackendRelayAdminDatabase(configStrict);
218
+ }
219
+ /**
220
+ * @deprecated
221
+ * `init_experimental` is deprecated. You can replace it with `init`.
222
+ *
223
+ * @example
224
+ *
225
+ * // Before
226
+ * import { init_experimental } from "@backendrelay/admin"
227
+ * const db = init_experimental({ ... });
228
+ *
229
+ * // After
230
+ * import { init } from "@backendrelay/admin"
231
+ * const db = init({ ... });
232
+ */
233
+ const init_experimental = init;
234
+ function steps(inputChunks) {
235
+ const chunks = Array.isArray(inputChunks) ? inputChunks : [inputChunks];
236
+ return chunks.flatMap(getOps);
237
+ }
238
+ class Rooms {
239
+ config;
240
+ _fetch = (input, init) => rawJsonFetch(input, init, this.config.onError);
241
+ constructor(config) {
242
+ this.config = config;
243
+ }
244
+ async getPresence(roomType, roomId) {
245
+ const res = await this._fetch(`${this.config.apiURI}/admin/rooms/presence?app_id=${this.config.appId}&room-type=${String(roomType)}&room-id=${roomId}`, {
246
+ method: 'GET',
247
+ headers: authorizedHeaders(this.config),
248
+ });
249
+ return res.sessions || {};
250
+ }
251
+ }
252
+ class Auth {
253
+ config;
254
+ _fetch = (input, init) => rawJsonFetch(input, init, this.config.onError);
255
+ constructor(config) {
256
+ this.config = config;
257
+ this.createToken = this.createToken.bind(this);
258
+ }
259
+ /**
260
+ * Generates a magic code for the user with the given email.
261
+ * This is useful if you want to use your own email provider
262
+ * to send magic codes.
263
+ *
264
+ * @example
265
+ * // Generate a magic code
266
+ * const { code } = await db.auth.generateMagicCode({ email })
267
+ * // Send the magic code to the user with your own email provider
268
+ * await customEmailProvider.sendMagicCode(email, code)
269
+ *
270
+ * @see https://backendrelay.com/docs/backend#custom-magic-codes
271
+ */
272
+ generateMagicCode = async (email) => {
273
+ return this._fetch(`${this.config.apiURI}/admin/magic_code?app_id=${this.config.appId}`, {
274
+ method: 'POST',
275
+ headers: authorizedHeaders(this.config),
276
+ body: JSON.stringify({ email }),
277
+ });
278
+ };
279
+ /**
280
+ * Sends a magic code to the user with the given email.
281
+ * This uses BackendRelay's built-in email provider.
282
+ *
283
+ * @example
284
+ * // Send an email to user with magic code
285
+ * await db.auth.sendMagicCode({ email })
286
+ *
287
+ * @see https://backendrelay.com/docs/backend#custom-magic-codes
288
+ */
289
+ sendMagicCode = async (email) => {
290
+ return this._fetch(`${this.config.apiURI}/admin/send_magic_code?app_id=${this.config.appId}`, {
291
+ method: 'POST',
292
+ headers: authorizedHeaders(this.config),
293
+ body: JSON.stringify({ email }),
294
+ });
295
+ };
296
+ /**
297
+ * @deprecated Use {@link checkMagicCode} instead to get the `created` field
298
+ * and support `extraFields`.
299
+ *
300
+ * @see https://backendrelay.com/docs/backend#custom-magic-codes
301
+ */
302
+ verifyMagicCode = async (email, code) => {
303
+ const { user } = await this._fetch(`${this.config.apiURI}/admin/verify_magic_code?app_id=${this.config.appId}`, {
304
+ method: 'POST',
305
+ headers: authorizedHeaders(this.config),
306
+ body: JSON.stringify({ email, code }),
307
+ });
308
+ return user;
309
+ };
310
+ /**
311
+ * Verifies a magic code and returns the user along with whether
312
+ * the user was newly created. Supports `extraFields` to set custom
313
+ * `$users` properties at signup.
314
+ *
315
+ * @example
316
+ * const { user, created } = await db.auth.checkMagicCode(
317
+ * email,
318
+ * code,
319
+ * { extraFields: { nickname: 'ari' } },
320
+ * );
321
+ *
322
+ * @see https://backendrelay.com/docs/backend#custom-magic-codes
323
+ */
324
+ checkMagicCode = async (email, code, options) => {
325
+ const res = await this._fetch(`${this.config.apiURI}/admin/verify_magic_code?app_id=${this.config.appId}`, {
326
+ method: 'POST',
327
+ headers: authorizedHeaders(this.config),
328
+ body: JSON.stringify({
329
+ email,
330
+ code,
331
+ ...(options?.extraFields
332
+ ? { 'extra-fields': options.extraFields }
333
+ : {}),
334
+ }),
335
+ });
336
+ return { user: res.user, created: res.created };
337
+ };
338
+ async createToken(input) {
339
+ const body = typeof input === 'string' ? { email: input } : input;
340
+ const ret = await this._fetch(`${this.config.apiURI}/admin/refresh_tokens?app_id=${this.config.appId}`, {
341
+ method: 'POST',
342
+ headers: authorizedHeaders(this.config),
343
+ body: JSON.stringify(body),
344
+ });
345
+ return ret.user.refresh_token;
346
+ }
347
+ /**
348
+ * Verifies a given token and returns the associated user.
349
+ *
350
+ * This is often useful for writing custom endpoints, where you need
351
+ * to authenticate users.
352
+ *
353
+ * @example
354
+ * app.post('/custom_endpoint', async (req, res) => {
355
+ * const user = await db.auth.verifyToken(req.headers['token'])
356
+ * if (!user) {
357
+ * return res.status(401).send('Uh oh, you are not authenticated')
358
+ * }
359
+ * // ...
360
+ * })
361
+ * @see https://backendrelay.com/docs/backend#custom-endpoints
362
+ */
363
+ verifyToken = async (token) => {
364
+ const res = await this._fetch(`${this.config.apiURI}/runtime/auth/verify_refresh_token?app_id=${this.config.appId}`, {
365
+ method: 'POST',
366
+ headers: { 'content-type': 'application/json' },
367
+ body: JSON.stringify({
368
+ 'app-id': this.config.appId,
369
+ 'refresh-token': token,
370
+ }),
371
+ });
372
+ return res.user;
373
+ };
374
+ /**
375
+ * Retrieves an app user by id, email, or refresh token.
376
+ * Resolves to `null` when no user matches; throws on malformed
377
+ * input or auth errors.
378
+ *
379
+ * @example
380
+ * const user = await db.auth.getUser({ email });
381
+ * if (!user) {
382
+ * console.log("No user found");
383
+ * return;
384
+ * }
385
+ * console.log("Found user:", user);
386
+ *
387
+ * @see https://backendrelay.com/docs/backend#retrieve-a-user
388
+ */
389
+ getUser = async (params) => {
390
+ const qs = new URLSearchParams(Object.entries(params)).toString();
391
+ const response = await this._fetch(`${this.config.apiURI}/admin/users?app_id=${this.config.appId}&${qs}`, {
392
+ method: 'GET',
393
+ headers: authorizedHeaders(this.config),
394
+ });
395
+ return response.user;
396
+ };
397
+ /**
398
+ * Deletes an app user by id, email, or refresh token.
399
+ * Resolves to `null` when no user matches; throws on malformed
400
+ * input or auth errors.
401
+ *
402
+ * NB: This _only_ deletes the user; it does not delete all user data.
403
+ * You will need to handle this manually.
404
+ *
405
+ * @example
406
+ * const deletedUser = await db.auth.deleteUser({ email });
407
+ * if (!deletedUser) {
408
+ * console.log("No user found to delete");
409
+ * return;
410
+ * }
411
+ * console.log("Deleted user:", deletedUser);
412
+ *
413
+ * @see https://backendrelay.com/docs/backend#delete-a-user
414
+ */
415
+ deleteUser = async (params) => {
416
+ const qs = new URLSearchParams(Object.entries(params)).toString();
417
+ const response = await this._fetch(`${this.config.apiURI}/admin/users?app_id=${this.config.appId}&${qs}`, {
418
+ method: 'DELETE',
419
+ headers: authorizedHeaders(this.config),
420
+ });
421
+ return response.deleted;
422
+ };
423
+ async signOut(input) {
424
+ // If input is a string, we assume it's an email.
425
+ // This is because of backwards compatibility: we used to only
426
+ // accept email strings. Eventually we can remove this
427
+ const params = typeof input === 'string' ? { email: input } : input;
428
+ const config = this.config;
429
+ await this._fetch(`${config.apiURI}/admin/sign_out?app_id=${this.config.appId}`, {
430
+ method: 'POST',
431
+ headers: authorizedHeaders(config),
432
+ body: JSON.stringify(params),
433
+ });
434
+ }
435
+ /**
436
+ * Get instant user from Request
437
+ *
438
+ * Reads cookies and gets a validated user
439
+ * @param req The request containing a cookie synced with createBackendRelayRouteHandler
440
+ * @param opts Allow disabling validation of refresh token
441
+ */
442
+ getUserFromRequest = async (req, opts) => {
443
+ const cookieHeader = req.headers.get('cookie') || '';
444
+ const parsedCookie = parseCookie(cookieHeader);
445
+ const cookieName = 'backendrelay_user_' + this.config.appId;
446
+ if (!parsedCookie[cookieName]) {
447
+ return null;
448
+ }
449
+ const value = parsedCookie[cookieName];
450
+ const user = JSON.parse(value);
451
+ if (!user?.refresh_token) {
452
+ return null;
453
+ }
454
+ if (opts?.disableValidation) {
455
+ return user;
456
+ }
457
+ const verified = await this.verifyToken(user.refresh_token);
458
+ return verified;
459
+ };
460
+ }
461
+ const isNodeReadable = (v) => v &&
462
+ typeof v === 'object' &&
463
+ typeof v.pipe === 'function' &&
464
+ typeof v.read === 'function';
465
+ const isWebReadable = (v) => v && typeof v.getReader === 'function';
466
+ function isHeaderSafe(value) {
467
+ return /^[\x20-\x7e]*$/.test(value);
468
+ }
469
+ /**
470
+ * Functions to manage file storage.
471
+ */
472
+ class Storage {
473
+ config;
474
+ impersonationOpts;
475
+ _fetch = (input, init) => rawJsonFetch(input, init, this.config.onError);
476
+ constructor(config, impersonationOpts) {
477
+ this.config = config;
478
+ this.impersonationOpts = impersonationOpts;
479
+ }
480
+ /**
481
+ * Uploads file at the provided path. Accepts bytes (`Uint8Array`, including
482
+ * Node's `Buffer`), a Node `Readable`, or a web `ReadableStream`.
483
+ *
484
+ * @see https://backendrelay.com/docs/storage
485
+ * @example
486
+ * const buffer = fs.readFileSync('demo.png');
487
+ * const isSuccess = await db.storage.uploadFile('photos/demo.png', buffer);
488
+ */
489
+ uploadFile = async (path, file, metadata = {}) => {
490
+ const headers = {
491
+ ...authorizedHeaders(this.config, this.impersonationOpts),
492
+ };
493
+ if (isHeaderSafe(path)) {
494
+ headers['path'] = path;
495
+ }
496
+ if (metadata.contentDisposition) {
497
+ if (isHeaderSafe(metadata.contentDisposition)) {
498
+ headers['content-disposition'] = metadata.contentDisposition;
499
+ }
500
+ }
501
+ // headers.content-type will become "undefined" (string)
502
+ // if not removed from the object
503
+ delete headers['content-type'];
504
+ if (metadata.contentType) {
505
+ headers['content-type'] = metadata.contentType;
506
+ }
507
+ let duplex;
508
+ if (isNodeReadable(file)) {
509
+ duplex = 'half'; // one-way stream
510
+ }
511
+ if (isNodeReadable(file) || isWebReadable(file)) {
512
+ if (!metadata.fileSize) {
513
+ throw new Error('fileSize is required in metadata when uploading streams');
514
+ }
515
+ headers['content-length'] = metadata.fileSize.toString();
516
+ }
517
+ let options = {
518
+ method: 'PUT',
519
+ headers,
520
+ body: file,
521
+ ...(duplex && { duplex }),
522
+ };
523
+ let url = `${this.config.apiURI}/admin/storage/upload?app_id=${encodeURIComponent(this.config.appId)}&path=${encodeURIComponent(path)}`;
524
+ if (metadata.contentDisposition) {
525
+ url += `&content-disposition=${encodeURIComponent(metadata.contentDisposition)}`;
526
+ }
527
+ return this._fetch(url, options);
528
+ };
529
+ /**
530
+ * Deletes a file by its path name (e.g. "photos/demo.png").
531
+ *
532
+ * @deprecated Use `db.transact` to delete files instead:
533
+ * @example
534
+ * // Delete by id
535
+ * await db.transact(db.tx.$files[fileId].delete());
536
+ *
537
+ * // Delete by path
538
+ * await db.transact(db.tx.$files[lookup('path', 'photos/demo.png')].delete());
539
+ *
540
+ * @see https://backendrelay.com/docs/storage
541
+ */
542
+ delete = async (pathname) => {
543
+ return this._fetch(`${this.config.apiURI}/admin/storage/files?app_id=${this.config.appId}&filename=${encodeURIComponent(pathname)}`, {
544
+ method: 'DELETE',
545
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
546
+ });
547
+ };
548
+ /**
549
+ * Deletes multiple files by their path names.
550
+ *
551
+ * @deprecated Use `db.transact` to delete files instead:
552
+ * @example
553
+ * // Delete multiple files by path
554
+ * const paths = ['images/1.png', 'images/2.png', 'images/3.png'];
555
+ * await db.transact(paths.map(p => db.tx.$files[lookup('path', p)].delete()));
556
+ *
557
+ * @see https://backendrelay.com/docs/storage
558
+ */
559
+ deleteMany = async (pathnames) => {
560
+ return this._fetch(`${this.config.apiURI}/admin/storage/files/delete?app_id=${this.config.appId}`, {
561
+ method: 'POST',
562
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
563
+ body: JSON.stringify({ filenames: pathnames }),
564
+ });
565
+ };
566
+ /**
567
+ * @deprecated. This method will be removed in the future. Use `uploadFile`
568
+ * instead
569
+ */
570
+ upload = async (pathname, file, metadata = {}) => {
571
+ const { data: presignedUrl } = await this._fetch(`${this.config.apiURI}/admin/storage/signed-upload-url?app_id=${this.config.appId}`, {
572
+ method: 'POST',
573
+ headers: authorizedHeaders(this.config),
574
+ body: JSON.stringify({
575
+ app_id: this.config.appId,
576
+ filename: pathname,
577
+ }),
578
+ });
579
+ const headers = {};
580
+ const contentType = metadata.contentType;
581
+ if (contentType) {
582
+ headers['Content-Type'] = contentType;
583
+ }
584
+ const { ok } = await fetch(presignedUrl, {
585
+ method: 'PUT',
586
+ body: file,
587
+ headers,
588
+ });
589
+ return ok;
590
+ };
591
+ /**
592
+ * @deprecated. This method will be removed in the future. Use `query` instead
593
+ * @example
594
+ * const files = await db.query({ $files: {}})
595
+ */
596
+ list = async () => {
597
+ const { data } = await this._fetch(`${this.config.apiURI}/admin/storage/files?app_id=${this.config.appId}`, {
598
+ method: 'GET',
599
+ headers: authorizedHeaders(this.config),
600
+ });
601
+ return data;
602
+ };
603
+ /**
604
+ * @deprecated. getDownloadUrl will be removed in the future.
605
+ * Use `query` instead to query and fetch for valid urls
606
+ *
607
+ * db.useQuery({
608
+ * $files: {
609
+ * $: {
610
+ * where: {
611
+ * path: "moop.png"
612
+ * }
613
+ * }
614
+ * }
615
+ * })
616
+ */
617
+ getDownloadUrl = async (pathname) => {
618
+ const { data } = await this._fetch(`${this.config.apiURI}/admin/storage/signed-download-url?app_id=${this.config.appId}&filename=${encodeURIComponent(pathname)}`, {
619
+ method: 'GET',
620
+ headers: authorizedHeaders(this.config),
621
+ });
622
+ return data;
623
+ };
624
+ }
625
+ /**
626
+ * Functions to manage streams.
627
+ */
628
+ class Streams {
629
+ #ensureBackendRelayStream;
630
+ constructor(ensureBackendRelayStream) {
631
+ this.#ensureBackendRelayStream = ensureBackendRelayStream;
632
+ }
633
+ /**
634
+ * Creates a new ReadableStream for the given clientId.
635
+ *
636
+ * @example
637
+ * const stream = db.streams.createReadStream({clientId: clientId})
638
+ * for await (const chunk of stream) {
639
+ * console.log(chunk);
640
+ * }
641
+ */
642
+ createReadStream = (opts) => {
643
+ return this.#ensureBackendRelayStream().createReadStream(opts);
644
+ };
645
+ /**
646
+ * Creates a new WritableStream for the given clientId.
647
+ *
648
+ * @example
649
+ * const writeStream = db.streams.createWriteStream({clientId: clientId})
650
+ * const writer = writeStream.getWriter();
651
+ * writer.write('Hello world');
652
+ * writer.close();
653
+ */
654
+ createWriteStream = (opts) => {
655
+ return this.#ensureBackendRelayStream().createWriteStream(opts);
656
+ };
657
+ }
658
+ function createLogger(isEnabled, baseLogger = console) {
659
+ return {
660
+ info: isEnabled ? (...args) => baseLogger.info(...args) : () => { },
661
+ debug: isEnabled ? (...args) => baseLogger.debug(...args) : () => { },
662
+ error: isEnabled ? (...args) => baseLogger.error(...args) : () => { },
663
+ };
664
+ }
665
+ /**
666
+ *
667
+ * The first step: init your application!
668
+ *
669
+ * Visit your BackendRelay dashboard to get your `appId` and `adminToken`, and
670
+ * pass the API origin as `apiURI` :) The admin SDK no longer defaults to
671
+ * backendrelay.com.
672
+ *
673
+ * @example
674
+ * const db = init({ appId: "my-app-id", adminToken: "my-admin-token", apiURI: "https://api.example.com" })
675
+ */
676
+ class BackendRelayAdminDatabase {
677
+ config;
678
+ auth;
679
+ storage;
680
+ streams;
681
+ rooms;
682
+ impersonationOpts;
683
+ webhooks;
684
+ hatchet;
685
+ #sseConnection = null;
686
+ #sseBackoff = 0;
687
+ #backendrelayStream = null;
688
+ #log;
689
+ _fetch = (input, init) => rawJsonFetch(input, init, this.config.onError);
690
+ tx = txInit();
691
+ constructor(_config) {
692
+ this.config = backendrelayConfigWithDefaults(_config);
693
+ this.auth = new Auth(this.config);
694
+ this.storage = new Storage(this.config, this.impersonationOpts);
695
+ this.streams = new Streams(this.#ensureBackendRelayStream.bind(this));
696
+ this.rooms = new Rooms(this.config);
697
+ this.webhooks = new Webhooks(this.config, (input, init) => rawJsonFetch(input, init, this.config.onError));
698
+ this.hatchet = {
699
+ credentials: () => this._fetch(`${this.config.apiURI}/dash/apps/${this.config.appId}/hatchet`, { headers: authorizedHeaders(this.config, this.impersonationOpts) }),
700
+ };
701
+ this.#log = createLogger(!!this.config.verbose, this.config.logger);
702
+ }
703
+ /**
704
+ * Sometimes you want to scope queries to a specific user.
705
+ *
706
+ * You can provide a user's auth token, email, or impersonate a guest.
707
+ *
708
+ * @see https://backendrelay.com/docs/backend#impersonating-users
709
+ * @example
710
+ * await db.asUser({email: "stopa@backendrelay.com"}).query({ goals: {} })
711
+ */
712
+ asUser = (opts) => {
713
+ const newClient = new BackendRelayAdminDatabase({
714
+ ...this.config,
715
+ });
716
+ newClient.impersonationOpts = opts;
717
+ newClient.storage = new Storage(this.config, opts);
718
+ return newClient;
719
+ };
720
+ /**
721
+ * Use this to query your data!
722
+ *
723
+ * @see https://backendrelay.com/docs/instaql
724
+ *
725
+ * @example
726
+ * // fetch all goals
727
+ * await db.query({ goals: {} })
728
+ *
729
+ * // goals where the title is "Get Fit"
730
+ * await db.query({ goals: { $: { where: { title: "Get Fit" } } } })
731
+ *
732
+ * // all goals, _alongside_ their todos
733
+ * await db.query({ goals: { todos: {} } })
734
+ */
735
+ query = (query, opts = {}) => {
736
+ if (query && opts && 'ruleParams' in opts) {
737
+ query = { $$ruleParams: opts['ruleParams'], ...query };
738
+ }
739
+ if (!this.config.disableValidation) {
740
+ validateQuery(query, this.config.schema);
741
+ }
742
+ const fetchOpts = opts.fetchOpts || {};
743
+ const fetchOptsHeaders = fetchOpts['headers'] || {};
744
+ return this._fetch(`${this.config.apiURI}/admin/query?app_id=${this.config.appId}`, {
745
+ ...fetchOpts,
746
+ method: 'POST',
747
+ headers: {
748
+ ...fetchOptsHeaders,
749
+ ...authorizedHeaders(this.config, this.impersonationOpts),
750
+ },
751
+ body: JSON.stringify({
752
+ query: query,
753
+ 'inference?': !!this.config.schema,
754
+ }),
755
+ });
756
+ };
757
+ /**
758
+ * Returns the current version counter for each entity id, defaulting to 0.
759
+ *
760
+ * Pass the versions returned here as `conditions.assert` version checks when
761
+ * another request writes the same entities.
762
+ */
763
+ versions = async (entityIds) => {
764
+ const res = await this._fetch(`${this.config.apiURI}/admin/versions?app_id=${this.config.appId}`, {
765
+ method: 'POST',
766
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
767
+ body: JSON.stringify({ 'entity-ids': entityIds }),
768
+ });
769
+ return res.versions ?? {};
770
+ };
771
+ /**
772
+ * Writes function log lines for a request. The functions runtime calls this
773
+ * with `ctx.log` output and the inbound `x-request-id`.
774
+ */
775
+ log = async (entries, requestId) => {
776
+ await this._fetch(`${this.config.apiURI}/admin/logs?app_id=${this.config.appId}`, {
777
+ method: 'POST',
778
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
779
+ body: JSON.stringify({
780
+ 'request-id': requestId ?? undefined,
781
+ entries,
782
+ }),
783
+ });
784
+ };
785
+ /** Returns the transactions, logs and webhook events for one request id. */
786
+ trace = (requestId) => {
787
+ return this._fetch(`${this.config.apiURI}/admin/traces/${encodeURIComponent(requestId)}?app_id=${this.config.appId}`, {
788
+ method: 'GET',
789
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
790
+ });
791
+ };
792
+ /**
793
+ * Runs count/sum/avg/min/max over one entity type, optionally grouped by an
794
+ * attribute. Aggregates are admin-only because per-record rules are not
795
+ * evaluated inside SQL aggregates.
796
+ */
797
+ aggregate = (params) => {
798
+ return this._fetch(`${this.config.apiURI}/admin/aggregate?app_id=${this.config.appId}`, {
799
+ method: 'POST',
800
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
801
+ body: JSON.stringify({
802
+ etype: params.etype,
803
+ filters: params.filters ?? {},
804
+ 'group-by': params.groupBy,
805
+ aggregate: {
806
+ field: params.field,
807
+ sum: params.sum,
808
+ avg: params.avg,
809
+ min: params.min,
810
+ max: params.max,
811
+ },
812
+ }),
813
+ });
814
+ };
815
+ /**
816
+ * Returns the nearest vectors for an attribute. Requires the pgvector
817
+ * extension on the database. Admin-only for the same reason as aggregate.
818
+ */
819
+ nearest = (params) => {
820
+ return this._fetch(`${this.config.apiURI}/admin/nearest?app_id=${this.config.appId}`, {
821
+ method: 'POST',
822
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
823
+ body: JSON.stringify({
824
+ etype: params.etype,
825
+ attr: params.attr,
826
+ vector: params.vector,
827
+ limit: params.limit ?? 10,
828
+ }),
829
+ });
830
+ };
831
+ /**
832
+ * Use this to to get a live view of your data!
833
+ *
834
+ * @see https://www.backendrelay.com/docs/backend
835
+ *
836
+ * @example
837
+ * // create a subscription to a query
838
+ * const query = { goals: { $: { where: { title: "Get Fit" } } } }
839
+ * const sub = db.subscribeQuery(query);
840
+ *
841
+ * // iterate through the results with an async iterator
842
+ * for await (const payload of sub) {
843
+ * if (payload.error) {
844
+ * console.log(payload.error);
845
+ * // Stop the subscription
846
+ * sub.close();
847
+ * } else {
848
+ * console.log(payload.data);
849
+ * }
850
+ * }
851
+ *
852
+ * // Stop the subscription
853
+ * sub.close();
854
+ *
855
+ * // Create a subscription with a callback
856
+ * const sub = db.subscribeQuery(query, (payload) => {
857
+ * if (payload.error) {
858
+ * console.log(payload.error);
859
+ * // Stop the subscription
860
+ * sub.close();
861
+ * } else {
862
+ * console.log(payload.data);
863
+ * }
864
+ * });
865
+ */
866
+ subscribeQuery(query, cb, opts = {}) {
867
+ if (query && opts && 'ruleParams' in opts) {
868
+ query = { $$ruleParams: opts['ruleParams'], ...query };
869
+ }
870
+ if (!this.config.disableValidation) {
871
+ validateQuery(query, this.config.schema);
872
+ }
873
+ const fetchOpts = opts.fetchOpts || {};
874
+ const fetchOptsHeaders = fetchOpts['headers'] || {};
875
+ const headers = {
876
+ ...fetchOptsHeaders,
877
+ ...authorizedHeaders(this.config, this.impersonationOpts),
878
+ };
879
+ const inference = !!this.config.schema;
880
+ return subscribe(query, cb, {
881
+ headers,
882
+ inference,
883
+ apiURI: this.config.apiURI,
884
+ });
885
+ }
886
+ /**
887
+ * Use this to write data! You can create, update, delete, and link objects
888
+ *
889
+ * @see https://backendrelay.com/docs/instaml
890
+ *
891
+ * @example
892
+ * // Create a new object in the `goals` namespace
893
+ * const goalId = id();
894
+ * db.transact(db.tx.goals[goalId].update({title: "Get fit"}))
895
+ *
896
+ * // Update the title
897
+ * db.transact(db.tx.goals[goalId].update({title: "Get super fit"}))
898
+ *
899
+ * // Delete it
900
+ * db.transact(db.tx.goals[goalId].delete())
901
+ *
902
+ * // Or create an association:
903
+ * todoId = id();
904
+ * db.transact([
905
+ * db.tx.todos[todoId].update({ title: 'Go on a run' }),
906
+ * db.tx.goals[goalId].link({todos: todoId}),
907
+ * ])
908
+ */
909
+ transact = (inputChunks, options) => {
910
+ // JavaScript callers may still pass the former enqueue options. Fail before
911
+ // writing data instead of silently discarding their requested background work.
912
+ if (options && 'enqueue' in options) {
913
+ return Promise.reject(new Error('Transaction options are no longer supported. Use db.transact(chunks).'));
914
+ }
915
+ if (!this.config.disableValidation) {
916
+ validateTransactions(inputChunks, this.config.schema);
917
+ }
918
+ return this._fetch(`${this.config.apiURI}/admin/transact?app_id=${this.config.appId}`, {
919
+ method: 'POST',
920
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
921
+ body: JSON.stringify({
922
+ steps: steps(inputChunks),
923
+ 'throw-on-missing-attrs?': !!this.config.schema,
924
+ conditions: options?.conditions,
925
+ }),
926
+ });
927
+ };
928
+ /**
929
+ * Like `query`, but returns debugging information
930
+ * for permissions checks along with the result.
931
+ * Useful for inspecting the values returned by the permissions checks.
932
+ * Note, this will return debug information for *all* entities
933
+ * that match the query's `where` clauses.
934
+ *
935
+ * Requires a user/guest context to be set with `asUser`,
936
+ * since permissions checks are user-specific.
937
+ *
938
+ * Accepts an optional configuration object with a `rules` key.
939
+ * The provided rules will override the rules in the database for the query.
940
+ *
941
+ * @see https://backendrelay.com/docs/instaql
942
+ *
943
+ * @example
944
+ * await db.asUser({ guest: true }).debugQuery(
945
+ * { goals: {} },
946
+ * { rules: { goals: { allow: { read: "auth.id != null" } } }
947
+ * )
948
+ */
949
+ debugQuery = async (query, opts) => {
950
+ if (query && opts && 'ruleParams' in opts) {
951
+ query = { $$ruleParams: opts['ruleParams'], ...query };
952
+ }
953
+ const body = {
954
+ query,
955
+ 'rules-override': opts?.rules,
956
+ 'inference?': opts?.cardinalityInference ?? !!this.config.schema,
957
+ };
958
+ if (opts?.ip) {
959
+ body['ip-override'] = opts.ip;
960
+ }
961
+ if (opts?.origin) {
962
+ body['origin-override'] = opts.origin;
963
+ }
964
+ const response = await this._fetch(`${this.config.apiURI}/admin/query_perms_check?app_id=${this.config.appId}`, {
965
+ method: 'POST',
966
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
967
+ body: JSON.stringify(body),
968
+ });
969
+ return {
970
+ result: response.result,
971
+ checkResults: response['check-results'],
972
+ };
973
+ };
974
+ /**
975
+ * Like `transact`, but does not write to the database.
976
+ * Returns debugging information for permissions checks.
977
+ * Useful for inspecting the values returned by the permissions checks.
978
+ *
979
+ * Requires a user/guest context to be set with `asUser`,
980
+ * since permissions checks are user-specific.
981
+ *
982
+ * Accepts an optional configuration object with a `rules` key.
983
+ * The provided rules will override the rules in the database for the duration of the transaction.
984
+ *
985
+ * @example
986
+ * const goalId = id();
987
+ * db.asUser({ guest: true }).debugTransact(
988
+ * [db.tx.goals[goalId].update({title: "Get fit"})],
989
+ * { rules: { goals: { allow: { update: "auth.id != null" } } }
990
+ * )
991
+ */
992
+ debugTransact = (inputChunks, opts) => {
993
+ const body = {
994
+ steps: steps(inputChunks),
995
+ 'rules-override': opts?.rules,
996
+ // @ts-expect-error because we're using a private API (for now)
997
+ 'dangerously-commit-tx': opts?.__dangerouslyCommit,
998
+ };
999
+ if (opts?.ip) {
1000
+ body['ip-override'] = opts.ip;
1001
+ }
1002
+ if (opts?.origin) {
1003
+ body['origin-override'] = opts.origin;
1004
+ }
1005
+ return this._fetch(`${this.config.apiURI}/admin/transact_perms_check?app_id=${this.config.appId}`, {
1006
+ method: 'POST',
1007
+ headers: authorizedHeaders(this.config, this.impersonationOpts),
1008
+ body: JSON.stringify(body),
1009
+ });
1010
+ };
1011
+ #setupSSEConnection() {
1012
+ if (this.#sseConnection) {
1013
+ this.#sseConnection.close();
1014
+ }
1015
+ const headers = {
1016
+ ...authorizedHeaders(this.config, this.impersonationOpts),
1017
+ };
1018
+ const inference = !!this.config.schema;
1019
+ const ES = makeEventSourceWrapper({ headers, inference });
1020
+ const conn = new SSEConnection(ES, `${this.config.apiURI}/admin/sse?app_id=${this.config.appId}`, `${this.config.apiURI}/admin/sse/push?app_id=${this.config.appId}`);
1021
+ conn.onopen = this.#onopen;
1022
+ conn.onmessage = this.#onmessage;
1023
+ conn.onclose = this.#onclose;
1024
+ conn.onerror = this.#onerror;
1025
+ this.#sseConnection = conn;
1026
+ return conn;
1027
+ }
1028
+ #ensureSSEConnection() {
1029
+ return this.#sseConnection || this.#setupSSEConnection();
1030
+ }
1031
+ #trySend(eventId, msg) {
1032
+ const sseConnection = this.#ensureSSEConnection();
1033
+ this.#log.info('[send]', eventId, msg, {
1034
+ isOpen: sseConnection.isOpen(),
1035
+ });
1036
+ if (sseConnection.isOpen()) {
1037
+ sseConnection.send({ 'client-event-id': eventId, ...msg });
1038
+ }
1039
+ }
1040
+ #setupBackendRelayStream() {
1041
+ this.#ensureSSEConnection();
1042
+ const backendrelayStream = new BackendRelayStream({
1043
+ WStream: this.config.WritableStream || WritableStream,
1044
+ RStream: this.config.ReadableStream || ReadableStream,
1045
+ trySend: (eventId, msg) => {
1046
+ this.#trySend(eventId, msg);
1047
+ },
1048
+ log: this.#log,
1049
+ });
1050
+ this.#backendrelayStream = backendrelayStream;
1051
+ return backendrelayStream;
1052
+ }
1053
+ #ensureBackendRelayStream() {
1054
+ return this.#backendrelayStream || this.#setupBackendRelayStream();
1055
+ }
1056
+ #onopen = (e) => {
1057
+ if (e.target !== this.#sseConnection) {
1058
+ this.#log.info('[socket][open]', e.target.id, 'skip; this is no longer the current transport');
1059
+ return;
1060
+ }
1061
+ this.#log.info('[socket][open]', e.target.id);
1062
+ this.#sseBackoff = 0;
1063
+ this.#backendrelayStream?.onConnectionStatusChange('authenticated');
1064
+ };
1065
+ #onclose = (e) => {
1066
+ if (e.target !== this.#sseConnection) {
1067
+ this.#log.info('[socket][close]', e.target.id, 'skip; this is no longer the current transport');
1068
+ return;
1069
+ }
1070
+ this.#log.info('[socket][close]', e.target.id);
1071
+ this.#backendrelayStream?.onConnectionStatusChange('closed');
1072
+ if (this.#sseConnection) {
1073
+ this.#sseConnection = null;
1074
+ if (!this.#connectionIsIdle()) {
1075
+ // We didn't remove the sse connection, and we have streams we care about, so let's try again
1076
+ setTimeout(() => this.#ensureSSEConnection(), this.#sseBackoff);
1077
+ this.#sseBackoff = Math.min(15000, Math.max(this.#sseBackoff, 500) * 2);
1078
+ }
1079
+ }
1080
+ };
1081
+ #onerror = (e) => {
1082
+ if (e.target !== this.#sseConnection) {
1083
+ this.#log.info('[socket][error]', e.target.id, 'skip; this is no longer the current transport');
1084
+ return;
1085
+ }
1086
+ this.#log.info('[socket][error]', e.target.id);
1087
+ this.#backendrelayStream?.onConnectionStatusChange('closed');
1088
+ };
1089
+ #connectionIsIdle() {
1090
+ return (!this.#backendrelayStream || !this.#backendrelayStream.hasActiveStreams());
1091
+ }
1092
+ #maybeShutdownConnection() {
1093
+ if (this.#sseConnection && this.#connectionIsIdle()) {
1094
+ const conn = this.#sseConnection;
1095
+ this.#log.info('cleaning up unused socket', conn.id);
1096
+ this.#sseConnection = null;
1097
+ conn.close();
1098
+ }
1099
+ }
1100
+ #onmessage = (e) => {
1101
+ if (e.target !== this.#sseConnection) {
1102
+ this.#log.info('[socket][message]', e.target.id, 'skip; this is no longer the current transport');
1103
+ return;
1104
+ }
1105
+ const msg = e.message;
1106
+ this.#log.info('[receive]', msg);
1107
+ switch (msg.op) {
1108
+ case 'start-stream-ok': {
1109
+ this.#backendrelayStream?.onStartStreamOk(msg);
1110
+ break;
1111
+ }
1112
+ case 'stream-flushed': {
1113
+ this.#backendrelayStream?.onStreamFlushed(msg);
1114
+ break;
1115
+ }
1116
+ case 'append-failed': {
1117
+ this.#backendrelayStream?.onAppendFailed(msg);
1118
+ break;
1119
+ }
1120
+ case 'stream-append': {
1121
+ this.#backendrelayStream?.onStreamAppend(msg);
1122
+ break;
1123
+ }
1124
+ case 'error': {
1125
+ switch (msg['original-event']?.op) {
1126
+ case 'start-stream':
1127
+ case 'append-stream':
1128
+ case 'subscribe-stream':
1129
+ case 'unsubscribe-stream': {
1130
+ this.#backendrelayStream?.onRecieveError(msg);
1131
+ break;
1132
+ }
1133
+ }
1134
+ break;
1135
+ }
1136
+ }
1137
+ // Closes the connection if we don't have any items pending
1138
+ this.#maybeShutdownConnection();
1139
+ };
1140
+ }
1141
+ export { init, init_experimental, id, tx, lookup, i, createBackendRelayRouteHandler, Webhooks, WebhooksManager,
1142
+ // error
1143
+ BackendRelayAPIError,
1144
+ // warnings
1145
+ setBackendRelayWarningsEnabled, BackendRelayError, };
1146
+ //# sourceMappingURL=index.js.map