@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.
- package/dist/standalone/index.js +1 -1
- package/dist/standalone/index.umd.cjs +1 -1
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts +20 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js +5 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typeUtils.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js +88 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/__types__/typesTests.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js +131 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/byop.live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/config.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js +65 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/config.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts +725 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/index.js +1159 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js +91 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts +17 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js +26 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/polyfill.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js +50 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/removed-features.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js +33 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/storage-upload.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts +39 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js +306 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/subscribe.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts +3 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/version.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/version.js +5 -0
- package/node_modules/@backendrelay/admin/dist/commonjs/version.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts +20 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js +4 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typeUtils.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js +86 -0
- package/node_modules/@backendrelay/admin/dist/esm/__types__/typesTests.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js +129 -0
- package/node_modules/@backendrelay/admin/dist/esm/byop.live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/esm/config.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/config.test.js +63 -0
- package/node_modules/@backendrelay/admin/dist/esm/config.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/index.d.ts +725 -0
- package/node_modules/@backendrelay/admin/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/index.js +1146 -0
- package/node_modules/@backendrelay/admin/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js +89 -0
- package/node_modules/@backendrelay/admin/dist/esm/live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts +17 -0
- package/node_modules/@backendrelay/admin/dist/esm/polyfill.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/polyfill.js +22 -0
- package/node_modules/@backendrelay/admin/dist/esm/polyfill.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js +48 -0
- package/node_modules/@backendrelay/admin/dist/esm/removed-features.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts +2 -0
- package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js +31 -0
- package/node_modules/@backendrelay/admin/dist/esm/storage-upload.test.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts +39 -0
- package/node_modules/@backendrelay/admin/dist/esm/subscribe.d.ts.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/subscribe.js +300 -0
- package/node_modules/@backendrelay/admin/dist/esm/subscribe.js.map +1 -0
- package/node_modules/@backendrelay/admin/dist/esm/version.d.ts +3 -0
- package/node_modules/@backendrelay/admin/dist/esm/version.d.ts.map +1 -0
- package/{src/version.ts → node_modules/@backendrelay/admin/dist/esm/version.js} +1 -1
- package/node_modules/@backendrelay/admin/dist/esm/version.js.map +1 -0
- package/node_modules/@backendrelay/admin/package.json +52 -0
- package/node_modules/@backendrelay/functions/README.md +131 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts +3 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js +3 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typeUtils.js.map +1 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts +2 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js +51 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/__types__/typesTests.js.map +1 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts +230 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/index.js +415 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/functions/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts +3 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js +2 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typeUtils.js.map +1 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts +2 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.d.ts.map +1 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js +49 -0
- package/node_modules/@backendrelay/functions/dist/esm/__types__/typesTests.js.map +1 -0
- package/node_modules/@backendrelay/functions/dist/esm/index.d.ts +230 -0
- package/node_modules/@backendrelay/functions/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/functions/dist/esm/index.js +403 -0
- package/node_modules/@backendrelay/functions/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/functions/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/functions/package.json +49 -0
- package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts +43 -0
- package/node_modules/@backendrelay/hatchet/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js +63 -0
- package/node_modules/@backendrelay/hatchet/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/hatchet/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts +43 -0
- package/node_modules/@backendrelay/hatchet/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/hatchet/dist/esm/index.js +59 -0
- package/node_modules/@backendrelay/hatchet/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/hatchet/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/hatchet/package.json +46 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts +18 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js +77 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/ProgressPromise.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts +99 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js +177 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/apps.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts +7 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js +15 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/auth.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts +3 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/http.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js +46 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/http.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts +13 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js +25 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/perms.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts +285 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js +426 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/platform-api.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts +24 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js +108 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema-coerce.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts +188 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js +412 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api/schema.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts +9 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api.js +12 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/api.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts +89 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js +357 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backupDownload.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts +146 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backups.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backups.js +251 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/backups.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts +2 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/clerk.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js +29 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/clerk.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts +11 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/consts.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/consts.js +17 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/consts.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts +4 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/crypto.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js +26 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/crypto.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts +19 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/index.js +76 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts +4 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js +52 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrationUtils.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts +99 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrations.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js +597 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/migrations.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts +98 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauth.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js +275 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauth.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts +12 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js +26 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/oauthCommon.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts +3 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/perms.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/perms.js +66 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/perms.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts +13 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js +31 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/privateFields.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts +7 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/relationships.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js +46 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/relationships.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts +161 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/schema.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/schema.js +174 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/schema.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts +25 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js +68 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/serverOAuth.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts +17 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js +314 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/typescript-schema.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts +13 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/util.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/util.js +55 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/util.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts +3 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/version.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/version.js +5 -0
- package/node_modules/@backendrelay/platform/dist/commonjs/version.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts +18 -0
- package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js +73 -0
- package/node_modules/@backendrelay/platform/dist/esm/ProgressPromise.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts +99 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/apps.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/apps.js +165 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/apps.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts +7 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/auth.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/auth.js +12 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/auth.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts +3 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/http.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/http.js +39 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/http.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts +13 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/perms.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/perms.js +21 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/perms.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts +285 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js +421 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/platform-api.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts +24 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js +99 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema-coerce.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts +188 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema.js +393 -0
- package/node_modules/@backendrelay/platform/dist/esm/api/schema.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api.d.ts +9 -0
- package/node_modules/@backendrelay/platform/dist/esm/api.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/api.js +4 -0
- package/node_modules/@backendrelay/platform/dist/esm/api.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts +89 -0
- package/node_modules/@backendrelay/platform/dist/esm/backupDownload.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js +354 -0
- package/node_modules/@backendrelay/platform/dist/esm/backupDownload.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts +146 -0
- package/node_modules/@backendrelay/platform/dist/esm/backups.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/backups.js +240 -0
- package/node_modules/@backendrelay/platform/dist/esm/backups.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts +2 -0
- package/node_modules/@backendrelay/platform/dist/esm/clerk.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/clerk.js +26 -0
- package/node_modules/@backendrelay/platform/dist/esm/clerk.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts +11 -0
- package/node_modules/@backendrelay/platform/dist/esm/consts.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/consts.js +13 -0
- package/node_modules/@backendrelay/platform/dist/esm/consts.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts +4 -0
- package/node_modules/@backendrelay/platform/dist/esm/crypto.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/crypto.js +21 -0
- package/node_modules/@backendrelay/platform/dist/esm/crypto.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/index.d.ts +19 -0
- package/node_modules/@backendrelay/platform/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/index.js +18 -0
- package/node_modules/@backendrelay/platform/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts +4 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js +47 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrationUtils.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts +99 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrations.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrations.js +588 -0
- package/node_modules/@backendrelay/platform/dist/esm/migrations.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts +98 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauth.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauth.js +266 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauth.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts +12 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js +22 -0
- package/node_modules/@backendrelay/platform/dist/esm/oauthCommon.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts +3 -0
- package/node_modules/@backendrelay/platform/dist/esm/perms.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/perms.js +62 -0
- package/node_modules/@backendrelay/platform/dist/esm/perms.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts +13 -0
- package/node_modules/@backendrelay/platform/dist/esm/privateFields.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/privateFields.js +28 -0
- package/node_modules/@backendrelay/platform/dist/esm/privateFields.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts +7 -0
- package/node_modules/@backendrelay/platform/dist/esm/relationships.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/relationships.js +43 -0
- package/node_modules/@backendrelay/platform/dist/esm/relationships.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts +161 -0
- package/node_modules/@backendrelay/platform/dist/esm/schema.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/schema.js +158 -0
- package/node_modules/@backendrelay/platform/dist/esm/schema.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts +25 -0
- package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js +64 -0
- package/node_modules/@backendrelay/platform/dist/esm/serverOAuth.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts +17 -0
- package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js +310 -0
- package/node_modules/@backendrelay/platform/dist/esm/typescript-schema.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/util.d.ts +13 -0
- package/node_modules/@backendrelay/platform/dist/esm/util.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/util.js +46 -0
- package/node_modules/@backendrelay/platform/dist/esm/util.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/version.d.ts +3 -0
- package/node_modules/@backendrelay/platform/dist/esm/version.d.ts.map +1 -0
- package/node_modules/@backendrelay/platform/dist/esm/version.js +3 -0
- package/node_modules/@backendrelay/platform/dist/esm/version.js.map +1 -0
- package/node_modules/@backendrelay/platform/dist/standalone/index.js +13738 -0
- package/node_modules/@backendrelay/platform/dist/standalone/index.umd.cjs +72 -0
- package/node_modules/@backendrelay/platform/package.json +51 -0
- package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts +67 -0
- package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js +129 -0
- package/node_modules/@backendrelay/resumable-stream/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/resumable-stream/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts +67 -0
- package/node_modules/@backendrelay/resumable-stream/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js +126 -0
- package/node_modules/@backendrelay/resumable-stream/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/resumable-stream/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.js +4354 -0
- package/node_modules/@backendrelay/resumable-stream/dist/standalone/index.umd.cjs +6 -0
- package/node_modules/@backendrelay/resumable-stream/package.json +47 -0
- package/node_modules/@backendrelay/rules/README.md +34 -0
- package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts +117 -0
- package/node_modules/@backendrelay/rules/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/rules/dist/commonjs/index.js +68 -0
- package/node_modules/@backendrelay/rules/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/rules/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/rules/dist/esm/index.d.ts +117 -0
- package/node_modules/@backendrelay/rules/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/rules/dist/esm/index.js +64 -0
- package/node_modules/@backendrelay/rules/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/rules/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/rules/package.json +46 -0
- package/node_modules/@backendrelay/test/README.md +75 -0
- package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts +74 -0
- package/node_modules/@backendrelay/test/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/test/dist/commonjs/index.js +197 -0
- package/node_modules/@backendrelay/test/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js +45 -0
- package/node_modules/@backendrelay/test/dist/commonjs/live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/test/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/test/dist/esm/index.d.ts +74 -0
- package/node_modules/@backendrelay/test/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/test/dist/esm/index.js +192 -0
- package/node_modules/@backendrelay/test/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js +43 -0
- package/node_modules/@backendrelay/test/dist/esm/live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/test/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/test/package.json +49 -0
- package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts +3 -0
- package/node_modules/@backendrelay/version/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/version/dist/commonjs/index.js +6 -0
- package/node_modules/@backendrelay/version/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/version/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts +3 -0
- package/node_modules/@backendrelay/version/dist/commonjs/version.d.ts.map +1 -0
- package/node_modules/@backendrelay/version/dist/commonjs/version.js +10 -0
- package/node_modules/@backendrelay/version/dist/commonjs/version.js.map +1 -0
- package/node_modules/@backendrelay/version/dist/esm/index.d.ts +3 -0
- package/node_modules/@backendrelay/version/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/version/dist/esm/index.js +3 -0
- package/node_modules/@backendrelay/version/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/version/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/version/dist/esm/version.d.ts +3 -0
- package/node_modules/@backendrelay/version/dist/esm/version.d.ts.map +1 -0
- package/node_modules/@backendrelay/version/dist/esm/version.js +7 -0
- package/node_modules/@backendrelay/version/dist/esm/version.js.map +1 -0
- package/node_modules/@backendrelay/version/dist/standalone/index.js +4 -0
- package/node_modules/@backendrelay/version/dist/standalone/index.umd.cjs +1 -0
- package/node_modules/@backendrelay/version/package.json +44 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts +12 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js +5 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typeUtils.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts +2 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js +82 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/__types__/typesTests.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts +607 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js +830 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/index.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js +139 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/commonjs/package.json +3 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts +12 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js +4 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typeUtils.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts +2 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js +80 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/__types__/typesTests.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts +607 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/index.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/index.js +825 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/index.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts +2 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.d.ts.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js +137 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/live.e2e.test.js.map +1 -0
- package/node_modules/@backendrelay/webhooks/dist/esm/package.json +3 -0
- package/node_modules/@backendrelay/webhooks/package.json +46 -0
- package/package.json +129 -56
- package/subpaths/admin/index.cjs +1 -0
- package/subpaths/admin/index.d.ts +1 -0
- package/subpaths/admin/index.mjs +3 -0
- package/subpaths/functions/index.cjs +1 -0
- package/subpaths/functions/index.d.ts +1 -0
- package/subpaths/functions/index.mjs +3 -0
- package/subpaths/hatchet/index.cjs +1 -0
- package/subpaths/hatchet/index.d.ts +1 -0
- package/subpaths/hatchet/index.mjs +3 -0
- package/subpaths/platform/index.cjs +1 -0
- package/subpaths/platform/index.d.ts +1 -0
- package/subpaths/platform/index.mjs +3 -0
- package/subpaths/resumable-stream/index.cjs +1 -0
- package/subpaths/resumable-stream/index.d.ts +1 -0
- package/subpaths/resumable-stream/index.mjs +3 -0
- package/subpaths/rules/index.cjs +1 -0
- package/subpaths/rules/index.d.ts +1 -0
- package/subpaths/rules/index.mjs +3 -0
- package/subpaths/test/index.cjs +1 -0
- package/subpaths/test/index.d.ts +1 -0
- package/subpaths/test/index.mjs +3 -0
- package/subpaths/version/index.cjs +1 -0
- package/subpaths/version/index.d.ts +1 -0
- package/subpaths/version/index.mjs +3 -0
- package/subpaths/webhooks/index.cjs +1 -0
- package/subpaths/webhooks/index.d.ts +1 -0
- package/subpaths/webhooks/index.mjs +3 -0
- package/.tshy/build.json +0 -8
- package/.tshy/commonjs.json +0 -16
- package/.tshy/esm.json +0 -15
- package/__example__/standalone.esm.html +0 -23
- package/__example__/standalone.umd.html +0 -21
- package/__tests__/src/Connection.test.ts +0 -292
- package/__tests__/src/IndexedDBStorage.test.ts +0 -96
- package/__tests__/src/Reactor.test.ts +0 -1179
- package/__tests__/src/auth-extra-fields.e2e.test.ts +0 -160
- package/__tests__/src/byop.e2e.test.ts +0 -762
- package/__tests__/src/config.test.ts +0 -85
- package/__tests__/src/cookieSync.e2e.test.ts +0 -163
- package/__tests__/src/data/movies/attrs.json +0 -145
- package/__tests__/src/data/movies/triples.json +0 -1507
- package/__tests__/src/data/zeneca/attrs.json +0 -251
- package/__tests__/src/data/zeneca/triples.json +0 -15854
- package/__tests__/src/datalog.test.ts +0 -175
- package/__tests__/src/devtool.test.ts +0 -23
- package/__tests__/src/framework.test.ts +0 -173
- package/__tests__/src/infiniteQuery.e2e.test.ts +0 -467
- package/__tests__/src/instaml.test.ts +0 -1593
- package/__tests__/src/instaql.bench.ts +0 -34
- package/__tests__/src/instaql.test.ts +0 -1497
- package/__tests__/src/instaqlInference.test.ts +0 -243
- package/__tests__/src/presence.test.ts +0 -49
- package/__tests__/src/queryValidation.test.ts +0 -1101
- package/__tests__/src/schema.test.ts +0 -653
- package/__tests__/src/serializeSchema.test.ts +0 -123
- package/__tests__/src/simple.e2e.test.ts +0 -133
- package/__tests__/src/storage-upload.test.ts +0 -37
- package/__tests__/src/store.test.ts +0 -960
- package/__tests__/src/syncTable.e2e.test.ts +0 -245
- package/__tests__/src/syncTable.test.ts +0 -235
- package/__tests__/src/transactionValidation.test.ts +0 -450
- package/__tests__/src/typeUtils.ts +0 -39
- package/__tests__/src/upstream-improvements.e2e.test.ts +0 -54
- package/__tests__/src/utils/MutationStorage.test.ts +0 -77
- package/__tests__/src/utils/PersistedObject.test.ts +0 -569
- package/__tests__/src/utils/dates.test.ts +0 -111
- package/__tests__/src/utils/e2e.ts +0 -100
- package/__tests__/src/utils/msw.ts +0 -3
- package/__tests__/src/utils/object.test.ts +0 -78
- package/__tests__/src/utils/weakHash.test.ts +0 -68
- package/__tests__/src/utils/weakHashLegacy.test.ts +0 -22
- package/__tests__/src/vite.env.d.ts +0 -1
- package/src/BackendRelayError.ts +0 -50
- package/src/Connection.ts +0 -361
- package/src/InMemoryStorage.ts +0 -34
- package/src/IndexedDBStorage.ts +0 -398
- package/src/Reactor.js +0 -1541
- package/src/StorageAPI.ts +0 -147
- package/src/Stream.ts +0 -1252
- package/src/SyncTable.ts +0 -750
- package/src/WindowNetworkListener.js +0 -19
- package/src/__types__/fieldsTypeTest.ts +0 -111
- package/src/__types__/typeUtils.ts +0 -39
- package/src/__types__/useDatesTypeTest.ts +0 -66
- package/src/attrTypes.ts +0 -37
- package/src/authAPI.ts +0 -205
- package/src/clientTypes.ts +0 -28
- package/src/coreTypes.ts +0 -58
- package/src/createRouteHandler.ts +0 -68
- package/src/datalog.js +0 -116
- package/src/devtool.ts +0 -179
- package/src/framework.ts +0 -450
- package/src/helperTypes.ts +0 -117
- package/src/index.ts +0 -1293
- package/src/infiniteQuery.ts +0 -599
- package/src/instaml.ts +0 -676
- package/src/instaql.ts +0 -999
- package/src/instatx.ts +0 -265
- package/src/model/instaqlResult.js +0 -25
- package/src/parseSchemaFromJSON.ts +0 -176
- package/src/presence.ts +0 -123
- package/src/presenceTypes.ts +0 -19
- package/src/queryTypes.ts +0 -749
- package/src/queryValidation.ts +0 -598
- package/src/reactorAuth.js +0 -236
- package/src/reactorEvents.js +0 -414
- package/src/reactorMutations.js +0 -354
- package/src/reactorRooms.js +0 -297
- package/src/reactorStorage.js +0 -180
- package/src/reactorSubs.js +0 -275
- package/src/reactorTransport.js +0 -391
- package/src/reactorTypes.ts +0 -41
- package/src/routeHandlerProtocol.ts +0 -25
- package/src/rulesTypes.ts +0 -132
- package/src/sanityCheckQueries.ts +0 -191
- package/src/schema.ts +0 -206
- package/src/schemaTypes.ts +0 -664
- package/src/store.ts +0 -1165
- package/src/transactionValidation.ts +0 -204
- package/src/urls.ts +0 -50
- package/src/utils/Deferred.ts +0 -20
- package/src/utils/MutationStorage.ts +0 -89
- package/src/utils/PersistedObject.ts +0 -612
- package/src/utils/dates.ts +0 -269
- package/src/utils/error.ts +0 -9
- package/src/utils/fetch.ts +0 -131
- package/src/utils/flags.ts +0 -14
- package/src/utils/id.ts +0 -28
- package/src/utils/linkIndex.ts +0 -33
- package/src/utils/log.ts +0 -23
- package/src/utils/object.js +0 -180
- package/src/utils/pgtime.ts +0 -199
- package/src/utils/pick.js +0 -9
- package/src/utils/strings.ts +0 -19
- package/src/utils/weakHash.ts +0 -77
- package/src/utils/weakHashLegacy.ts +0 -75
- package/src/warningToggle.ts +0 -5
- package/tsconfig.cjs.dev.json +0 -15
- package/tsconfig.dev.json +0 -14
- package/tsconfig.json +0 -13
- package/tsconfig.test.json +0 -5
- package/vite.config.ts +0 -19
- package/vitest.config.ts +0 -54
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { test as baseTest } from 'vitest';
|
|
2
|
-
import {
|
|
3
|
-
init,
|
|
4
|
-
BackendRelayConfig,
|
|
5
|
-
BackendRelayCoreDatabase,
|
|
6
|
-
BackendRelayRules,
|
|
7
|
-
BackendRelaySchemaDef,
|
|
8
|
-
} from '../../../src';
|
|
9
|
-
import { worker } from './msw';
|
|
10
|
-
|
|
11
|
-
// __DEV_LOCAL_PORT__ is set by vitest.config.ts.
|
|
12
|
-
// This allows us to run tests against mulutple checkouts
|
|
13
|
-
// If CI=1 then __DEV_LOCAL_PORT__ will be falsey and tests will hit prod.
|
|
14
|
-
// Otherwise they will hit localhost at the specified port.
|
|
15
|
-
declare const __DEV_LOCAL_PORT__: number;
|
|
16
|
-
// Set BACKENDRELAY_E2E_API_URL to target an explicitly configured local Rust server.
|
|
17
|
-
declare const __E2E_API_URL__: string;
|
|
18
|
-
|
|
19
|
-
const apiUrl =
|
|
20
|
-
__E2E_API_URL__ ||
|
|
21
|
-
(__DEV_LOCAL_PORT__
|
|
22
|
-
? `http://localhost:${__DEV_LOCAL_PORT__}`
|
|
23
|
-
: 'https://api.backendrelay.com');
|
|
24
|
-
|
|
25
|
-
const websocketURI = __E2E_API_URL__
|
|
26
|
-
? `${__E2E_API_URL__.replace(/^http/, 'ws')}/runtime/session`
|
|
27
|
-
: __DEV_LOCAL_PORT__
|
|
28
|
-
? `ws://localhost:${__DEV_LOCAL_PORT__}/runtime/session`
|
|
29
|
-
: 'wss://api.backendrelay.com/runtime/session';
|
|
30
|
-
|
|
31
|
-
// Make a factory function that returns a typed test instance
|
|
32
|
-
export function makeE2ETest<
|
|
33
|
-
Schema extends BackendRelaySchemaDef<any, any, any>,
|
|
34
|
-
>({
|
|
35
|
-
schema,
|
|
36
|
-
rules,
|
|
37
|
-
config,
|
|
38
|
-
}: {
|
|
39
|
-
schema?: Schema;
|
|
40
|
-
rules?: {
|
|
41
|
-
code: BackendRelayRules;
|
|
42
|
-
};
|
|
43
|
-
config?: Partial<BackendRelayConfig<Schema, any>>;
|
|
44
|
-
}) {
|
|
45
|
-
return baseTest.extend<{
|
|
46
|
-
db: BackendRelayCoreDatabase<Schema, false>;
|
|
47
|
-
appId: string;
|
|
48
|
-
adminToken: string;
|
|
49
|
-
worker: typeof worker;
|
|
50
|
-
}>({
|
|
51
|
-
db: async ({ task, signal }, use) => {
|
|
52
|
-
const response = await fetch(`${apiUrl}/dash/apps/ephemeral`, {
|
|
53
|
-
body: JSON.stringify({ title: `e2e-${task.id}`, schema, rules }),
|
|
54
|
-
headers: { 'Content-Type': 'application/json' },
|
|
55
|
-
method: 'POST',
|
|
56
|
-
signal: AbortSignal.any([signal, AbortSignal.timeout(4000)]),
|
|
57
|
-
});
|
|
58
|
-
if (!response.ok) {
|
|
59
|
-
throw new Error(await response.text());
|
|
60
|
-
}
|
|
61
|
-
const { app } = await response.json();
|
|
62
|
-
const db = init<Schema>({
|
|
63
|
-
...config,
|
|
64
|
-
appId: app.id,
|
|
65
|
-
apiURI: apiUrl,
|
|
66
|
-
websocketURI,
|
|
67
|
-
schema,
|
|
68
|
-
});
|
|
69
|
-
(db as any)._testApp = app;
|
|
70
|
-
await use(db);
|
|
71
|
-
},
|
|
72
|
-
appId: async ({ db }, use) => {
|
|
73
|
-
await use((db as any)._testApp.id);
|
|
74
|
-
},
|
|
75
|
-
adminToken: async ({ db }, use) => {
|
|
76
|
-
await use((db as any)._testApp['admin-token']);
|
|
77
|
-
},
|
|
78
|
-
// https://mswjs.io/docs/integrations/browser
|
|
79
|
-
worker: [
|
|
80
|
-
async ({}, use) => {
|
|
81
|
-
// Start the worker before the test.
|
|
82
|
-
await worker.start({ quiet: true });
|
|
83
|
-
|
|
84
|
-
// Expose the worker object on the test's context.
|
|
85
|
-
await use(worker);
|
|
86
|
-
|
|
87
|
-
// Remove any request handlers added in individual test cases.
|
|
88
|
-
// This prevents them from affecting unrelated tests.
|
|
89
|
-
worker.resetHandlers();
|
|
90
|
-
},
|
|
91
|
-
{
|
|
92
|
-
auto: true,
|
|
93
|
-
},
|
|
94
|
-
],
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
export { apiUrl };
|
|
99
|
-
|
|
100
|
-
export const e2eTest = makeE2ETest({});
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { test, expect, describe } from 'vitest';
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
assocInMutative,
|
|
5
|
-
dissocInMutative,
|
|
6
|
-
insertInMutative,
|
|
7
|
-
} from '../../../src/utils/object';
|
|
8
|
-
|
|
9
|
-
describe('assocInMutative', () => {
|
|
10
|
-
test('adds value at a shallow path', () => {
|
|
11
|
-
const obj = { a: 1 };
|
|
12
|
-
assocInMutative(obj, ['b'], 2);
|
|
13
|
-
expect(obj).toEqual({ a: 1, b: 2 });
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('adds value at a nested path', () => {
|
|
17
|
-
const obj = { a: {} };
|
|
18
|
-
assocInMutative(obj, ['a', 'b', 'c'], 3);
|
|
19
|
-
expect(obj).toEqual({ a: { b: { c: 3 } } });
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
describe('insertInMutative', () => {
|
|
24
|
-
test('it works on normal objects', () => {
|
|
25
|
-
const obj1 = { a: 1 };
|
|
26
|
-
insertInMutative(obj1, ['b'], 2);
|
|
27
|
-
expect(obj1).toEqual({ a: 1, b: 2 });
|
|
28
|
-
|
|
29
|
-
const obj2 = { a: {} };
|
|
30
|
-
assocInMutative(obj2, ['a', 'b', 'c'], 3);
|
|
31
|
-
expect(obj2).toEqual({ a: { b: { c: 3 } } });
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
test('inserts on arrays', () => {
|
|
35
|
-
const obj0 = [];
|
|
36
|
-
insertInMutative(obj0, [0], 'a');
|
|
37
|
-
expect(obj0).toEqual(['a']);
|
|
38
|
-
|
|
39
|
-
const obj1 = ['b'];
|
|
40
|
-
insertInMutative(obj1, [0], 'a');
|
|
41
|
-
expect(obj1).toEqual(['a', 'b']);
|
|
42
|
-
|
|
43
|
-
const obj2 = ['b'];
|
|
44
|
-
insertInMutative(obj2, [1], 'a');
|
|
45
|
-
expect(obj2).toEqual(['b', 'a']);
|
|
46
|
-
|
|
47
|
-
const obj3 = { x: ['b'] };
|
|
48
|
-
insertInMutative(obj3, ['x', 0], 'a');
|
|
49
|
-
expect(obj3).toEqual({ x: ['a', 'b'] });
|
|
50
|
-
|
|
51
|
-
const obj4 = { w: { x: { y: ['a', 'b', 'c', 'd'], z: 4 } } };
|
|
52
|
-
insertInMutative(obj4, ['w', 'x', 'y', 1], 'a');
|
|
53
|
-
expect(obj4).toEqual({ w: { x: { y: ['a', 'a', 'b', 'c', 'd'], z: 4 } } });
|
|
54
|
-
|
|
55
|
-
const obj5 = { w: { x: { y: ['a', 'b', 'c', 'd'], z: 4 } } };
|
|
56
|
-
insertInMutative(obj5, ['w', 'x', 'z'], 'a');
|
|
57
|
-
expect(obj5).toEqual({ w: { x: { y: ['a', 'b', 'c', 'd'], z: 'a' } } });
|
|
58
|
-
});
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
describe('dissocInMutative', () => {
|
|
62
|
-
test('deletes a shallow property', () => {
|
|
63
|
-
const obj = { a: 1, b: 2 };
|
|
64
|
-
dissocInMutative(obj, ['a']);
|
|
65
|
-
expect(obj).toEqual({ b: 2 });
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
test('deletes a nested property', () => {
|
|
69
|
-
const obj = { a: { b: { c: 3, d: 4 } } };
|
|
70
|
-
dissocInMutative(obj, ['a', 'b', 'c']);
|
|
71
|
-
expect(obj).toEqual({ a: { b: { d: 4 } } });
|
|
72
|
-
});
|
|
73
|
-
test('works on arrays', () => {
|
|
74
|
-
const obj = { a: { b: { c: ['a', 'b', 'c', 'd'] } } };
|
|
75
|
-
dissocInMutative(obj, ['a', 'b', 'c', 1]);
|
|
76
|
-
expect(obj).toEqual({ a: { b: { c: ['a', 'c', 'd'] } } });
|
|
77
|
-
});
|
|
78
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import weakHash from '../../../src/utils/weakHash';
|
|
3
|
-
|
|
4
|
-
// Skipping this test because it times out in CI.
|
|
5
|
-
// It should be run manually any time we make changes to weakHash.
|
|
6
|
-
test.skip('no collisions across many integer-varying queries', () => {
|
|
7
|
-
const shapes = [
|
|
8
|
-
(i: number) => ({ users: { $: { where: { id: i } } } }),
|
|
9
|
-
(i: number) => ({ posts: { $: { where: { authorId: i } }, author: {} } }),
|
|
10
|
-
(i: number) => ({
|
|
11
|
-
items: {
|
|
12
|
-
$: {
|
|
13
|
-
where: {
|
|
14
|
-
tag: 'b14fae2f-ce9b-4677-b6a9-6dddd81914d0',
|
|
15
|
-
n: i,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
}),
|
|
20
|
-
];
|
|
21
|
-
|
|
22
|
-
for (const shape of shapes) {
|
|
23
|
-
const hashes = new Set<string>();
|
|
24
|
-
let firstCollisionAt: number | null = null;
|
|
25
|
-
for (let i = 0; i < 50_000; i++) {
|
|
26
|
-
const hash = weakHash(shape(i));
|
|
27
|
-
if (hashes.has(hash)) {
|
|
28
|
-
firstCollisionAt = i;
|
|
29
|
-
break;
|
|
30
|
-
}
|
|
31
|
-
hashes.add(hash);
|
|
32
|
-
}
|
|
33
|
-
expect(firstCollisionAt, `collision at i=${firstCollisionAt}`).toBeNull();
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
test('is stable across object key order and undefined values', () => {
|
|
38
|
-
expect(weakHash({ b: 2, a: 1, c: undefined })).toBe(weakHash({ a: 1, b: 2 }));
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('keeps array and top-level undefined explicit', () => {
|
|
42
|
-
expect(weakHash([undefined])).not.toBe(weakHash([]));
|
|
43
|
-
expect(weakHash([undefined])).not.toBe(weakHash([null]));
|
|
44
|
-
expect(weakHash(undefined)).not.toBe(weakHash(null));
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
test('distinguishes objects by their toJSON output', () => {
|
|
48
|
-
expect(weakHash({ $gt: new Date(1) })).not.toBe(
|
|
49
|
-
weakHash({ $gt: new Date(2) }),
|
|
50
|
-
);
|
|
51
|
-
expect(weakHash(new Date(1))).toBe(weakHash(new Date(1).toISOString()));
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('handles bigint values without throwing', () => {
|
|
55
|
-
expect(() => weakHash({ id: 123n })).not.toThrow();
|
|
56
|
-
expect(weakHash(123n)).not.toBe(weakHash(123));
|
|
57
|
-
expect(weakHash(123n)).not.toBe(weakHash('123'));
|
|
58
|
-
expect(weakHash(123n)).not.toBe(weakHash('123n'));
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// Smoke test: pins the output for a known query so any accidental
|
|
62
|
-
// regression in the hash function (e.g. changed constants) trips here
|
|
63
|
-
// before silently invalidating every existing IndexedDB cache.
|
|
64
|
-
test('produces a stable hash for a known query', () => {
|
|
65
|
-
expect(weakHash({ users: { $: { where: { id: 42 } } } })).toBe(
|
|
66
|
-
'c1413dfe29f87b89',
|
|
67
|
-
);
|
|
68
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import weakHashLegacy from '../../../src/utils/weakHashLegacy';
|
|
3
|
-
|
|
4
|
-
// Smoke test: pins the legacy hash output. Existing clients have
|
|
5
|
-
// persisted querySubs / syncSubs in IndexedDB under these exact keys,
|
|
6
|
-
// so any accidental change to the legacy implementation would silently
|
|
7
|
-
// break the one-time migration in Reactor / SyncTable.
|
|
8
|
-
test('produces a stable hash for a known query', () => {
|
|
9
|
-
expect(
|
|
10
|
-
weakHashLegacy({
|
|
11
|
-
pro_search_properties: {
|
|
12
|
-
$: {
|
|
13
|
-
where: {
|
|
14
|
-
pro_searches: 'b14fae2f-ce9b-4677-b6a9-6dddd81914d0',
|
|
15
|
-
propertyId: 936,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
pro_searches: {},
|
|
19
|
-
},
|
|
20
|
-
}),
|
|
21
|
-
).toBe('dcb9614');
|
|
22
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/// <reference types="vite/client" />
|
package/src/BackendRelayError.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
export type BackendRelayErrorHandler = (error: Error) => void;
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Sends an error to the app's `onError` hook without letting a broken hook
|
|
5
|
-
* mask or replace the original failure.
|
|
6
|
-
*/
|
|
7
|
-
export function notifyError(
|
|
8
|
-
handler: BackendRelayErrorHandler | null | undefined,
|
|
9
|
-
error: unknown,
|
|
10
|
-
): void {
|
|
11
|
-
if (typeof handler !== 'function') {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const normalized =
|
|
15
|
-
error instanceof Error ? error : new BackendRelayError(String(error));
|
|
16
|
-
try {
|
|
17
|
-
handler(normalized);
|
|
18
|
-
} catch (_e) {
|
|
19
|
-
// The hook is for reporting; it must never break the SDK.
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class BackendRelayError extends Error {
|
|
24
|
-
hint?: unknown;
|
|
25
|
-
traceId?: string;
|
|
26
|
-
|
|
27
|
-
constructor(message: string, hint?: unknown, traceId?: string) {
|
|
28
|
-
super(message);
|
|
29
|
-
this.hint = hint;
|
|
30
|
-
if (traceId) {
|
|
31
|
-
this.traceId = traceId;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const actualProto = new.target.prototype;
|
|
35
|
-
if (Object.setPrototypeOf) {
|
|
36
|
-
Object.setPrototypeOf(this, actualProto);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Maintain proper stack trace for where our error was thrown
|
|
40
|
-
if (Error.captureStackTrace) {
|
|
41
|
-
Error.captureStackTrace(this, BackendRelayError);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
this.name = 'BackendRelayError';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
get [Symbol.toStringTag]() {
|
|
48
|
-
return 'BackendRelayError';
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/Connection.ts
DELETED
|
@@ -1,361 +0,0 @@
|
|
|
1
|
-
export interface EventSourceType {
|
|
2
|
-
readonly url: string;
|
|
3
|
-
readonly readyState: number;
|
|
4
|
-
|
|
5
|
-
onopen: ((this: EventSourceType, ev: Event) => any) | null;
|
|
6
|
-
onmessage: ((this: EventSourceType, ev: MessageEvent) => any) | null;
|
|
7
|
-
onerror: ((this: EventSourceType, ev: Event) => any) | null;
|
|
8
|
-
|
|
9
|
-
close(): void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface EventSourceConstructor {
|
|
13
|
-
OPEN: number;
|
|
14
|
-
CONNECTING: number;
|
|
15
|
-
CLOSED: number;
|
|
16
|
-
new (url: string): EventSourceType;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
let _connId = 0;
|
|
20
|
-
|
|
21
|
-
type Conn = EventSourceType | WebSocket;
|
|
22
|
-
|
|
23
|
-
type OpenEvent<T extends Conn> = {
|
|
24
|
-
target: Connection<T>;
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
type MessageData = {
|
|
28
|
-
op: string;
|
|
29
|
-
[key: string]: any;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
type SendMessageData = {
|
|
33
|
-
'client-event-id': string;
|
|
34
|
-
[key: string]: any;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
type MsgEvent<T extends Conn> = {
|
|
38
|
-
target: Connection<T>;
|
|
39
|
-
message: MessageData | MessageData[];
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
type CloseEvent<T extends Conn> = {
|
|
43
|
-
target: Connection<T>;
|
|
44
|
-
/**
|
|
45
|
-
* WebSocket close code, when the transport reports one. Used to recognise
|
|
46
|
-
* an operator restart (1012) so reconnection can start immediately.
|
|
47
|
-
*/
|
|
48
|
-
code?: number;
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
interface ErrorEvent<T extends Conn> {
|
|
52
|
-
target: Connection<T>;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export type TransportType = 'ws' | 'sse';
|
|
56
|
-
|
|
57
|
-
export interface Connection<T extends Conn> {
|
|
58
|
-
conn: T;
|
|
59
|
-
type: 'ws' | 'sse';
|
|
60
|
-
id: string;
|
|
61
|
-
close(): void;
|
|
62
|
-
isOpen(): boolean;
|
|
63
|
-
isConnecting(): boolean;
|
|
64
|
-
send(msg: SendMessageData): void;
|
|
65
|
-
onopen: ((event: OpenEvent<T>) => void) | null;
|
|
66
|
-
onmessage: ((event: MsgEvent<T>) => void) | null;
|
|
67
|
-
onclose: ((event: CloseEvent<T>) => void) | null;
|
|
68
|
-
onerror: ((event: ErrorEvent<T>) => void) | null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export class WSConnection implements Connection<WebSocket> {
|
|
72
|
-
type: TransportType = 'ws';
|
|
73
|
-
conn: WebSocket;
|
|
74
|
-
id: string;
|
|
75
|
-
onopen: (event: OpenEvent<WebSocket>) => void;
|
|
76
|
-
onmessage: (event: MsgEvent<WebSocket>) => void;
|
|
77
|
-
onclose: (event: CloseEvent<WebSocket>) => void;
|
|
78
|
-
onerror: (event: ErrorEvent<WebSocket>) => void;
|
|
79
|
-
constructor(url: string) {
|
|
80
|
-
this.id = `${this.type}_${_connId++}`;
|
|
81
|
-
this.conn = new WebSocket(url);
|
|
82
|
-
this.conn.onopen = (_e) => {
|
|
83
|
-
if (this.onopen) {
|
|
84
|
-
this.onopen({ target: this });
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
this.conn.onmessage = (e) => {
|
|
88
|
-
if (this.onmessage) {
|
|
89
|
-
this.onmessage({
|
|
90
|
-
target: this,
|
|
91
|
-
message: JSON.parse(e.data.toString()),
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
this.conn.onclose = (e) => {
|
|
96
|
-
if (this.onclose) {
|
|
97
|
-
this.onclose({ target: this, code: e.code });
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
this.conn.onerror = (_e) => {
|
|
101
|
-
if (this.onerror) {
|
|
102
|
-
this.onerror({ target: this });
|
|
103
|
-
}
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
close() {
|
|
108
|
-
this.conn.close();
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
isOpen(): boolean {
|
|
112
|
-
return this.conn.readyState === (WebSocket.OPEN ?? 1);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
isConnecting(): boolean {
|
|
116
|
-
return this.conn.readyState === (WebSocket.CONNECTING ?? 0);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
send(msg: SendMessageData) {
|
|
120
|
-
return this.conn.send(JSON.stringify(msg));
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
type SSEInitParams = {
|
|
125
|
-
machineId: string;
|
|
126
|
-
sessionId: string;
|
|
127
|
-
sseToken: string;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
const SSE_PUSH_FORMAT_HEADER = 'X-BackendRelay-SSE-Push-Format';
|
|
131
|
-
const SSE_PUSH_NDJSON = 'ndjson';
|
|
132
|
-
const SSE_PUSH_BATCH_SIZE = 100;
|
|
133
|
-
const SSE_PUSH_TIMEOUT_MS = 10_000;
|
|
134
|
-
|
|
135
|
-
export class SSEConnection implements Connection<EventSourceType> {
|
|
136
|
-
type: TransportType = 'sse';
|
|
137
|
-
private initParams: SSEInitParams | null = null;
|
|
138
|
-
private sendQueue: SendMessageData[] = [];
|
|
139
|
-
private sendPromise: Promise<void> | null;
|
|
140
|
-
private flushScheduled = false;
|
|
141
|
-
private supportsNdjson = false;
|
|
142
|
-
private closeFired: boolean = false;
|
|
143
|
-
private sseInitTimeout: ReturnType<typeof setTimeout> | undefined = undefined;
|
|
144
|
-
private pushTimeout: ReturnType<typeof setTimeout> | undefined;
|
|
145
|
-
private pushController: AbortController | null = null;
|
|
146
|
-
private ES: EventSourceConstructor;
|
|
147
|
-
private messageUrl: string;
|
|
148
|
-
conn: EventSourceType;
|
|
149
|
-
url: string;
|
|
150
|
-
id: string;
|
|
151
|
-
onopen: (event: OpenEvent<EventSourceType>) => void;
|
|
152
|
-
onmessage: (event: MsgEvent<EventSourceType>) => void;
|
|
153
|
-
onclose: (event: CloseEvent<EventSourceType>) => void;
|
|
154
|
-
onerror: (event: ErrorEvent<EventSourceType>) => void;
|
|
155
|
-
|
|
156
|
-
constructor(ES: EventSourceConstructor, url: string, messageUrl?: string) {
|
|
157
|
-
this.id = `${this.type}_${_connId++}`;
|
|
158
|
-
this.url = url;
|
|
159
|
-
this.messageUrl = messageUrl || this.url;
|
|
160
|
-
this.ES = ES;
|
|
161
|
-
this.conn = new ES(url);
|
|
162
|
-
|
|
163
|
-
// Close the connection if we didn't get an init within 10 seconds
|
|
164
|
-
this.sseInitTimeout = setTimeout(() => {
|
|
165
|
-
if (!this.initParams) {
|
|
166
|
-
this.handleError();
|
|
167
|
-
}
|
|
168
|
-
}, 10000);
|
|
169
|
-
|
|
170
|
-
this.conn.onmessage = (e) => {
|
|
171
|
-
const message = JSON.parse(e.data);
|
|
172
|
-
if (Array.isArray(message)) {
|
|
173
|
-
for (const msg of message) {
|
|
174
|
-
this.handleMessage(msg);
|
|
175
|
-
}
|
|
176
|
-
} else {
|
|
177
|
-
this.handleMessage(message);
|
|
178
|
-
}
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
this.conn.onerror = (e) => {
|
|
182
|
-
this.handleError();
|
|
183
|
-
};
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
private handleMessage(msg: MessageData) {
|
|
187
|
-
if (this.closeFired) return;
|
|
188
|
-
if (msg.op === 'sse-init') {
|
|
189
|
-
this.initParams = {
|
|
190
|
-
machineId: msg['machine-id'],
|
|
191
|
-
sessionId: msg['session-id'],
|
|
192
|
-
sseToken: msg['sse-token'],
|
|
193
|
-
};
|
|
194
|
-
if (this.onopen) {
|
|
195
|
-
this.onopen({ target: this });
|
|
196
|
-
}
|
|
197
|
-
clearTimeout(this.sseInitTimeout);
|
|
198
|
-
return;
|
|
199
|
-
}
|
|
200
|
-
if (this.onmessage) {
|
|
201
|
-
this.onmessage({
|
|
202
|
-
target: this,
|
|
203
|
-
message: msg,
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Runs the onerror and closes the connection
|
|
209
|
-
private handleError() {
|
|
210
|
-
if (this.closeFired) return;
|
|
211
|
-
try {
|
|
212
|
-
if (this.onerror) {
|
|
213
|
-
this.onerror({ target: this });
|
|
214
|
-
}
|
|
215
|
-
} finally {
|
|
216
|
-
this.handleClose();
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
private handleClose() {
|
|
221
|
-
if (this.closeFired) return;
|
|
222
|
-
this.closeFired = true;
|
|
223
|
-
clearTimeout(this.sseInitTimeout);
|
|
224
|
-
clearTimeout(this.pushTimeout);
|
|
225
|
-
this.sendQueue = [];
|
|
226
|
-
this.pushController?.abort();
|
|
227
|
-
this.pushController = null;
|
|
228
|
-
this.conn.close();
|
|
229
|
-
if (this.onclose) {
|
|
230
|
-
this.onclose({ target: this });
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
|
|
234
|
-
private post(
|
|
235
|
-
messages: SendMessageData[],
|
|
236
|
-
ndjson: boolean,
|
|
237
|
-
signal: AbortSignal,
|
|
238
|
-
) {
|
|
239
|
-
const initParams = this.initParams;
|
|
240
|
-
const body = ndjson
|
|
241
|
-
? [
|
|
242
|
-
JSON.stringify({
|
|
243
|
-
machine_id: initParams?.machineId,
|
|
244
|
-
session_id: initParams?.sessionId,
|
|
245
|
-
sse_token: initParams?.sseToken,
|
|
246
|
-
}),
|
|
247
|
-
...messages.map((message) => JSON.stringify(message)),
|
|
248
|
-
'',
|
|
249
|
-
].join('\n')
|
|
250
|
-
: JSON.stringify({
|
|
251
|
-
machine_id: initParams?.machineId,
|
|
252
|
-
session_id: initParams?.sessionId,
|
|
253
|
-
sse_token: initParams?.sseToken,
|
|
254
|
-
messages,
|
|
255
|
-
});
|
|
256
|
-
return fetch(this.messageUrl, {
|
|
257
|
-
method: 'POST',
|
|
258
|
-
headers: {
|
|
259
|
-
Accept: 'application/x-ndjson, application/json',
|
|
260
|
-
'Content-Type': ndjson ? 'application/x-ndjson' : 'application/json',
|
|
261
|
-
},
|
|
262
|
-
body,
|
|
263
|
-
signal,
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
private async postMessages(messages: SendMessageData[]): Promise<void> {
|
|
268
|
-
const controller = new AbortController();
|
|
269
|
-
this.pushController = controller;
|
|
270
|
-
// Delivery may already have happened: close on timeout, never replay.
|
|
271
|
-
this.pushTimeout = setTimeout(
|
|
272
|
-
() => this.handleError(),
|
|
273
|
-
SSE_PUSH_TIMEOUT_MS,
|
|
274
|
-
);
|
|
275
|
-
try {
|
|
276
|
-
let resp = await this.post(
|
|
277
|
-
messages,
|
|
278
|
-
this.supportsNdjson,
|
|
279
|
-
controller.signal,
|
|
280
|
-
);
|
|
281
|
-
if (this.closeFired) return;
|
|
282
|
-
// An older endpoint cannot parse NDJSON. Retrying only an explicit
|
|
283
|
-
// format rejection avoids replaying a batch after an ambiguous failure.
|
|
284
|
-
if (this.supportsNdjson && (resp.status === 406 || resp.status === 415)) {
|
|
285
|
-
this.supportsNdjson = false;
|
|
286
|
-
resp = await this.post(messages, false, controller.signal);
|
|
287
|
-
if (this.closeFired) return;
|
|
288
|
-
}
|
|
289
|
-
if (!resp.ok) {
|
|
290
|
-
this.handleError();
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
this.supportsNdjson =
|
|
294
|
-
resp.headers.get(SSE_PUSH_FORMAT_HEADER) === SSE_PUSH_NDJSON;
|
|
295
|
-
} catch (e) {
|
|
296
|
-
this.handleError();
|
|
297
|
-
} finally {
|
|
298
|
-
clearTimeout(this.pushTimeout);
|
|
299
|
-
this.pushController = null;
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
private async flushQueue() {
|
|
304
|
-
if (!this.isOpen() || this.sendPromise || !this.sendQueue.length) return;
|
|
305
|
-
|
|
306
|
-
const messages = this.sendQueue.splice(0, SSE_PUSH_BATCH_SIZE);
|
|
307
|
-
const sendPromise = this.postMessages(messages);
|
|
308
|
-
this.sendPromise = sendPromise;
|
|
309
|
-
sendPromise.then(() => {
|
|
310
|
-
this.sendPromise = null;
|
|
311
|
-
if (this.isOpen()) {
|
|
312
|
-
this.flushQueue();
|
|
313
|
-
}
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
private scheduleFlush() {
|
|
318
|
-
if (this.flushScheduled) return;
|
|
319
|
-
this.flushScheduled = true;
|
|
320
|
-
Promise.resolve().then(() => {
|
|
321
|
-
this.flushScheduled = false;
|
|
322
|
-
this.flushQueue();
|
|
323
|
-
});
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
send(msg: SendMessageData) {
|
|
327
|
-
if (!this.isOpen() || !this.initParams) {
|
|
328
|
-
if (this.isConnecting()) {
|
|
329
|
-
throw new Error(
|
|
330
|
-
`Failed to execute 'send' on 'EventSource': Still in CONNECTING state.`,
|
|
331
|
-
);
|
|
332
|
-
}
|
|
333
|
-
if (this.conn.readyState === this.ES.CLOSED) {
|
|
334
|
-
throw new Error(`EventSource is already in CLOSING or CLOSED state.`);
|
|
335
|
-
}
|
|
336
|
-
throw new Error(`EventSource is in invalid state.`);
|
|
337
|
-
}
|
|
338
|
-
this.sendQueue.push(msg);
|
|
339
|
-
this.scheduleFlush();
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
isOpen(): boolean {
|
|
343
|
-
return (
|
|
344
|
-
!this.closeFired &&
|
|
345
|
-
this.conn.readyState === this.ES.OPEN &&
|
|
346
|
-
this.initParams !== null
|
|
347
|
-
);
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
isConnecting(): boolean {
|
|
351
|
-
return (
|
|
352
|
-
!this.closeFired &&
|
|
353
|
-
(this.conn.readyState === this.ES.CONNECTING ||
|
|
354
|
-
(this.conn.readyState === this.ES.OPEN && this.initParams === null))
|
|
355
|
-
);
|
|
356
|
-
}
|
|
357
|
-
|
|
358
|
-
close() {
|
|
359
|
-
this.handleClose();
|
|
360
|
-
}
|
|
361
|
-
}
|