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