@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,612 +0,0 @@
|
|
|
1
|
-
// PersistedObjects save data outside of memory.
|
|
2
|
-
//
|
|
3
|
-
// When we load a persisted object, it's possible we call `set`
|
|
4
|
-
// before we finish loading. To address we handle set in two ways:
|
|
5
|
-
//
|
|
6
|
-
// 1. Before load
|
|
7
|
-
// We simply update currentValue in memory
|
|
8
|
-
//
|
|
9
|
-
// 2. After load
|
|
10
|
-
// We update currentValue in memory and in storage
|
|
11
|
-
//
|
|
12
|
-
// Each PersistedObject provides it's own `onMerge`
|
|
13
|
-
// function to handle the merge of data from storage and memory
|
|
14
|
-
// on load
|
|
15
|
-
|
|
16
|
-
// Uses `requestIdleCallback` if available, otherwise calls the
|
|
17
|
-
// callback immediately
|
|
18
|
-
|
|
19
|
-
import { create } from 'mutative';
|
|
20
|
-
import type { Logger } from './log.ts';
|
|
21
|
-
|
|
22
|
-
function safeIdleCallback(cb, timeout: number) {
|
|
23
|
-
if (typeof requestIdleCallback === 'undefined') {
|
|
24
|
-
cb();
|
|
25
|
-
} else {
|
|
26
|
-
requestIdleCallback(cb, { timeout });
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export const META_KEY = '__meta';
|
|
31
|
-
|
|
32
|
-
// A meta read that fails is retried from the write path. Past this many
|
|
33
|
-
// failures the store is treated as broken and writes stop deferring.
|
|
34
|
-
const META_LOAD_MAX_ATTEMPTS = 5;
|
|
35
|
-
|
|
36
|
-
export type ObjectMeta = { createdAt: number; updatedAt: number; size: number };
|
|
37
|
-
|
|
38
|
-
export type Meta<K extends string> = {
|
|
39
|
-
objects: Record<K, ObjectMeta>;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
export type StoreInterfaceStoreName =
|
|
43
|
-
| 'kv'
|
|
44
|
-
| 'querySubs'
|
|
45
|
-
| 'syncSubs'
|
|
46
|
-
| 'mutations';
|
|
47
|
-
|
|
48
|
-
export abstract class StoreInterface {
|
|
49
|
-
constructor(appId: string, storeName: StoreInterfaceStoreName) {}
|
|
50
|
-
abstract getItem(key: string): Promise<any>;
|
|
51
|
-
abstract removeItem(key: string): Promise<void>;
|
|
52
|
-
abstract multiSet(keyValuePairs: Array<[string, any]>): Promise<void>;
|
|
53
|
-
abstract getAllKeys(): Promise<string[]>;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export type StoreInterfaceClass = new (
|
|
57
|
-
appId: string,
|
|
58
|
-
storeName: StoreInterfaceStoreName,
|
|
59
|
-
) => StoreInterface;
|
|
60
|
-
|
|
61
|
-
export type GCOpts = {
|
|
62
|
-
maxSize: number;
|
|
63
|
-
maxAgeMs: number;
|
|
64
|
-
maxEntries: number;
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
export type Opts<K, T, SerializedT> = {
|
|
68
|
-
persister: StoreInterface;
|
|
69
|
-
/**
|
|
70
|
-
* Merges data from storage with in-memory value on load.
|
|
71
|
-
* The value returned from merge will become the current value.
|
|
72
|
-
*/
|
|
73
|
-
merge: (
|
|
74
|
-
key: K,
|
|
75
|
-
fromStorage: T | null | undefined,
|
|
76
|
-
inMemoryValue: T | null | undefined,
|
|
77
|
-
) => T;
|
|
78
|
-
serialize: (key: K, input: T) => SerializedT;
|
|
79
|
-
parse: (key: K, value: SerializedT) => T;
|
|
80
|
-
objectSize: (x: SerializedT) => number;
|
|
81
|
-
logger: Logger;
|
|
82
|
-
gc: GCOpts | null | undefined;
|
|
83
|
-
saveThrottleMs?: number | null | undefined;
|
|
84
|
-
idleCallbackMaxWaitMs?: number | null | undefined;
|
|
85
|
-
preloadEntryCount?: number | null | undefined;
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
export class PersistedObject<K extends string, T, SerializedT> {
|
|
89
|
-
currentValue: Record<K, T>;
|
|
90
|
-
private _subs: ((value: Record<K, T>) => void)[] = [];
|
|
91
|
-
private _persister: StoreInterface;
|
|
92
|
-
private _merge: (key: K, fromStorage: T, inMemoryValue: T) => T;
|
|
93
|
-
private serialize: (key: K, input: T) => SerializedT;
|
|
94
|
-
private parse: (key: K, value: SerializedT) => T;
|
|
95
|
-
private _saveThrottleMs: number;
|
|
96
|
-
private _idleCallbackMaxWaitMs: number;
|
|
97
|
-
private _nextSave: null | NodeJS.Timeout = null;
|
|
98
|
-
private _nextGc: null | NodeJS.Timeout = null;
|
|
99
|
-
private _pendingSaveKeys: Set<K> = new Set();
|
|
100
|
-
private _loadedKeys: Set<K> = new Set();
|
|
101
|
-
private _loadingKeys: Record<K, Promise<T>>;
|
|
102
|
-
private _objectSize: (serializedObject: SerializedT) => number;
|
|
103
|
-
private _log: Logger;
|
|
104
|
-
|
|
105
|
-
onKeyLoaded: (key: string) => void | null | undefined;
|
|
106
|
-
private _version = 0;
|
|
107
|
-
private _meta: {
|
|
108
|
-
isLoading: boolean;
|
|
109
|
-
onLoadCbs: Array<() => void>;
|
|
110
|
-
value: null | Meta<K>;
|
|
111
|
-
error: null | Error;
|
|
112
|
-
attempts: number;
|
|
113
|
-
loadingPromise?: Promise<Meta<K>> | null | undefined;
|
|
114
|
-
} = {
|
|
115
|
-
isLoading: true,
|
|
116
|
-
onLoadCbs: [],
|
|
117
|
-
value: null,
|
|
118
|
-
error: null,
|
|
119
|
-
attempts: 0,
|
|
120
|
-
};
|
|
121
|
-
private _gcOpts: GCOpts | null | undefined;
|
|
122
|
-
|
|
123
|
-
constructor(opts: Opts<K, T, SerializedT>) {
|
|
124
|
-
this._persister = opts.persister;
|
|
125
|
-
this._merge = opts.merge;
|
|
126
|
-
this.serialize = opts.serialize;
|
|
127
|
-
this.parse = opts.parse;
|
|
128
|
-
this._objectSize = opts.objectSize;
|
|
129
|
-
this._log = opts.logger;
|
|
130
|
-
this._saveThrottleMs = opts.saveThrottleMs ?? 100;
|
|
131
|
-
this._idleCallbackMaxWaitMs = opts.idleCallbackMaxWaitMs ?? 1000;
|
|
132
|
-
this._gcOpts = opts.gc;
|
|
133
|
-
this.currentValue = {} as Record<K, T>;
|
|
134
|
-
this._loadedKeys = new Set();
|
|
135
|
-
this._loadingKeys = {} as Record<K, Promise<T>>;
|
|
136
|
-
this._initMeta();
|
|
137
|
-
if (opts.preloadEntryCount) {
|
|
138
|
-
this._preloadEntries(opts.preloadEntryCount);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
private async _initMeta() {
|
|
143
|
-
if (this._meta.loadingPromise) {
|
|
144
|
-
await this._meta.loadingPromise;
|
|
145
|
-
}
|
|
146
|
-
try {
|
|
147
|
-
const p = this._persister.getItem(META_KEY);
|
|
148
|
-
this._meta.loadingPromise = p;
|
|
149
|
-
const v = await p;
|
|
150
|
-
this._meta.isLoading = false;
|
|
151
|
-
this._meta.error = null;
|
|
152
|
-
this._meta.loadingPromise = null;
|
|
153
|
-
this._meta.attempts = 0;
|
|
154
|
-
const existingObjects = this._meta.value?.objects ?? {};
|
|
155
|
-
const value = v ?? {};
|
|
156
|
-
const objects = value.objects ?? {};
|
|
157
|
-
// Merge the values from storage with in-memory values
|
|
158
|
-
this._meta.value = {
|
|
159
|
-
...value,
|
|
160
|
-
objects: { ...existingObjects, ...objects },
|
|
161
|
-
} as Meta<K>;
|
|
162
|
-
} catch (e) {
|
|
163
|
-
this._meta.error = e;
|
|
164
|
-
this._meta.attempts++;
|
|
165
|
-
this._meta.loadingPromise = null;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
/**
|
|
170
|
-
* Retries a meta read that failed. `_writeToStorage` defers every write while
|
|
171
|
-
* meta is loading, so a read that failed once — a transient IndexedDB error at
|
|
172
|
-
* boot is the common case — would otherwise defer persistence for the life of
|
|
173
|
-
* the tab. Bounded: a store that keeps failing is a real problem, and the
|
|
174
|
-
* write path keeps its own backoff.
|
|
175
|
-
*/
|
|
176
|
-
private _retryFailedMetaLoad() {
|
|
177
|
-
if (
|
|
178
|
-
!this._meta.error ||
|
|
179
|
-
this._meta.loadingPromise ||
|
|
180
|
-
this._meta.attempts > META_LOAD_MAX_ATTEMPTS
|
|
181
|
-
) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
void this._initMeta();
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
private async _getMeta(): Promise<Meta<K> | null> {
|
|
188
|
-
if (this._meta.value) {
|
|
189
|
-
return this._meta.value;
|
|
190
|
-
}
|
|
191
|
-
if (this._meta.loadingPromise) {
|
|
192
|
-
await this._meta.loadingPromise;
|
|
193
|
-
return this._meta.value;
|
|
194
|
-
}
|
|
195
|
-
this._initMeta();
|
|
196
|
-
await this._meta.loadingPromise;
|
|
197
|
-
return this._meta.value;
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
private async _refreshMeta(): Promise<Meta<K> | null> {
|
|
201
|
-
await this._initMeta();
|
|
202
|
-
return this._meta.value;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
private async _preloadEntries(n: number) {
|
|
206
|
-
const meta = await this.waitForMetaToLoad();
|
|
207
|
-
if (!meta) return;
|
|
208
|
-
const entries = Object.entries(meta.objects) as Array<[K, ObjectMeta]>;
|
|
209
|
-
entries.sort(([_k_a, a_meta], [_k_b, b_meta]) => {
|
|
210
|
-
return b_meta.updatedAt - a_meta.updatedAt;
|
|
211
|
-
});
|
|
212
|
-
for (const [k] of entries.slice(0, n)) {
|
|
213
|
-
this._loadKey(k);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
private async _getFromStorage(key: K) {
|
|
218
|
-
try {
|
|
219
|
-
const data = await this._persister.getItem(key);
|
|
220
|
-
if (!data) {
|
|
221
|
-
return data;
|
|
222
|
-
}
|
|
223
|
-
const parsed = this.parse(key, data as SerializedT);
|
|
224
|
-
return parsed;
|
|
225
|
-
} catch (e) {
|
|
226
|
-
console.error(`Unable to read from storage for key=${key}`, e);
|
|
227
|
-
return null;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
public async waitForKeyToLoad(k: K) {
|
|
232
|
-
if (this._loadedKeys.has(k)) {
|
|
233
|
-
return this.currentValue[k];
|
|
234
|
-
}
|
|
235
|
-
await (this._loadingKeys[k] || this._loadKey(k));
|
|
236
|
-
return this.currentValue[k];
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
// Loads every key we know about from meta and resolves once they have
|
|
240
|
-
// all been merged into currentValue. Used by stores that need their full
|
|
241
|
-
// contents at boot, like pending mutations.
|
|
242
|
-
public async waitForAllKeysToLoad(): Promise<Record<K, T>> {
|
|
243
|
-
const meta = await this._getMeta();
|
|
244
|
-
const keys = Object.keys(meta?.objects ?? {}) as K[];
|
|
245
|
-
await Promise.all(keys.map((k) => this.waitForKeyToLoad(k)));
|
|
246
|
-
return this.currentValue;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Used for tests
|
|
250
|
-
public async waitForMetaToLoad() {
|
|
251
|
-
return this._getMeta();
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
// Unloads the key so that it can be garbage collected, but does not
|
|
255
|
-
// delete it. Removes the key from currentValue.
|
|
256
|
-
public unloadKey(k: K) {
|
|
257
|
-
this._loadedKeys.delete(k);
|
|
258
|
-
delete this._loadingKeys[k];
|
|
259
|
-
delete this.currentValue[k];
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
private async _loadKey(k: K) {
|
|
263
|
-
if (this._loadedKeys.has(k) || k in this._loadingKeys) return;
|
|
264
|
-
const p = this._getFromStorage(k);
|
|
265
|
-
this._loadingKeys[k] = p;
|
|
266
|
-
const value = await p;
|
|
267
|
-
delete this._loadingKeys[k];
|
|
268
|
-
this._loadedKeys.add(k);
|
|
269
|
-
|
|
270
|
-
if (value) {
|
|
271
|
-
const merged = this._merge(k, value, this.currentValue[k]);
|
|
272
|
-
if (merged) {
|
|
273
|
-
this.currentValue[k] = merged;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
this.onKeyLoaded && this.onKeyLoaded(k);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
// Returns a promise with a number so that we can wait for flush
|
|
280
|
-
// to finish in the tests. The number is the number of operations
|
|
281
|
-
// it performed, but it's mostly there so that typescript will warn
|
|
282
|
-
// us if we forget to retun the promise from the function.
|
|
283
|
-
private _writeToStorage(opts?: {
|
|
284
|
-
skipGc?: boolean | null | undefined;
|
|
285
|
-
attempts?: number | null | undefined;
|
|
286
|
-
}): Promise<number> {
|
|
287
|
-
const promises: Promise<number>[] = [];
|
|
288
|
-
const skipGc = opts?.skipGc;
|
|
289
|
-
if (this._meta.isLoading) {
|
|
290
|
-
// Deferring is only correct while meta is genuinely loading. If an
|
|
291
|
-
// earlier read failed, this is the only place that notices, so kick a
|
|
292
|
-
// retry here; otherwise every write defers forever.
|
|
293
|
-
this._retryFailedMetaLoad();
|
|
294
|
-
// Wait for meta to load and try again, give it a delay so that
|
|
295
|
-
// we don't spend too much time retrying
|
|
296
|
-
const p: Promise<number> = new Promise((resolve, reject) => {
|
|
297
|
-
setTimeout(
|
|
298
|
-
() =>
|
|
299
|
-
this._enqueuePersist(
|
|
300
|
-
opts
|
|
301
|
-
? { ...opts, attempts: (opts.attempts || 0) + 1 }
|
|
302
|
-
: { attempts: 1 },
|
|
303
|
-
)
|
|
304
|
-
.then(resolve)
|
|
305
|
-
.catch(reject),
|
|
306
|
-
10 + (opts?.attempts ?? 0) * 1000,
|
|
307
|
-
);
|
|
308
|
-
});
|
|
309
|
-
promises.push(p);
|
|
310
|
-
return Promise.all(promises).then((vs) =>
|
|
311
|
-
vs.reduce((acc, x) => acc + x, 0),
|
|
312
|
-
);
|
|
313
|
-
}
|
|
314
|
-
const metaValue = this._meta.value;
|
|
315
|
-
if (!metaValue) {
|
|
316
|
-
// If it's not loading and we don't have the data, then there
|
|
317
|
-
// must be an error and we're not going to be able to save until
|
|
318
|
-
// the error is resolved elsewhere.
|
|
319
|
-
return Promise.resolve(0);
|
|
320
|
-
}
|
|
321
|
-
const keysToDelete: K[] = [];
|
|
322
|
-
const keysToUpdate: K[] = [];
|
|
323
|
-
for (const k of this._pendingSaveKeys) {
|
|
324
|
-
if (!(k in this.currentValue)) {
|
|
325
|
-
keysToDelete.push(k);
|
|
326
|
-
delete metaValue.objects[k];
|
|
327
|
-
} else {
|
|
328
|
-
keysToUpdate.push(k);
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
for (const k of keysToDelete) {
|
|
333
|
-
const p = this._persister.removeItem(k);
|
|
334
|
-
promises.push(p.then(() => 1));
|
|
335
|
-
this._loadedKeys.delete(k);
|
|
336
|
-
this._pendingSaveKeys.delete(k);
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
const keysToLoad: K[] = [];
|
|
340
|
-
|
|
341
|
-
const kvPairs: Array<[string, any]> = [[META_KEY, metaValue]];
|
|
342
|
-
const metaObjects: Meta<K>['objects'] =
|
|
343
|
-
metaValue.objects ?? ({} as Meta<K>['objects']);
|
|
344
|
-
metaValue.objects = metaObjects;
|
|
345
|
-
for (const k of keysToUpdate) {
|
|
346
|
-
if (this._loadedKeys.has(k)) {
|
|
347
|
-
const serializedV = this.serialize(k, this.currentValue[k]);
|
|
348
|
-
kvPairs.push([k, serializedV]);
|
|
349
|
-
const size = this._objectSize(serializedV);
|
|
350
|
-
const m = metaObjects[k] ?? {
|
|
351
|
-
createdAt: Date.now(),
|
|
352
|
-
updatedAt: Date.now(),
|
|
353
|
-
size,
|
|
354
|
-
};
|
|
355
|
-
m.updatedAt = Date.now();
|
|
356
|
-
m.size = size;
|
|
357
|
-
metaObjects[k] = m;
|
|
358
|
-
this._pendingSaveKeys.delete(k);
|
|
359
|
-
} else {
|
|
360
|
-
keysToLoad.push(k);
|
|
361
|
-
}
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
const p = this._persister.multiSet(kvPairs);
|
|
365
|
-
promises.push(p.then(() => 1));
|
|
366
|
-
|
|
367
|
-
// For the keys that haven't loaded, load the key then try
|
|
368
|
-
// persisting again. We don't want to do any async work here
|
|
369
|
-
// or else we might end up saving older copies of the data to
|
|
370
|
-
// the store.
|
|
371
|
-
for (const k of keysToLoad) {
|
|
372
|
-
const p = this._loadKey(k).then(() => this._enqueuePersist(opts));
|
|
373
|
-
promises.push(p);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
if (!skipGc) {
|
|
377
|
-
this.gc();
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
return Promise.all(promises).then((vs) => {
|
|
381
|
-
return vs.reduce((acc, x) => acc + x, 0);
|
|
382
|
-
});
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
async flush() {
|
|
386
|
-
if (!this._nextSave) {
|
|
387
|
-
return;
|
|
388
|
-
}
|
|
389
|
-
clearTimeout(this._nextSave);
|
|
390
|
-
this._nextSave = null;
|
|
391
|
-
const p = this._writeToStorage();
|
|
392
|
-
return p;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
private async _gc() {
|
|
396
|
-
if (!this._gcOpts) {
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
const keys = new Set(await this._persister.getAllKeys());
|
|
400
|
-
keys.delete(META_KEY);
|
|
401
|
-
|
|
402
|
-
// Keys we can't delete
|
|
403
|
-
const sacredKeys = new Set(Object.keys(this.currentValue));
|
|
404
|
-
for (const k of Object.keys(this._loadingKeys)) {
|
|
405
|
-
sacredKeys.add(k);
|
|
406
|
-
}
|
|
407
|
-
for (const k of this._loadedKeys) {
|
|
408
|
-
sacredKeys.add(k);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
// Refresh meta from the store so that we're less likely to
|
|
412
|
-
// clobber data from other tabs
|
|
413
|
-
const meta = await this._refreshMeta();
|
|
414
|
-
if (!meta) {
|
|
415
|
-
this._log.info('Could not gc because we were not able to load meta');
|
|
416
|
-
return;
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
const promises: Promise<any>[] = [];
|
|
420
|
-
|
|
421
|
-
const deets = {
|
|
422
|
-
gcOpts: this._gcOpts,
|
|
423
|
-
keys,
|
|
424
|
-
sacredKeys,
|
|
425
|
-
removed: [] as string[],
|
|
426
|
-
metaRemoved: [],
|
|
427
|
-
removedMissingCount: 0,
|
|
428
|
-
removedOldCount: 0,
|
|
429
|
-
removedThresholdCount: 0,
|
|
430
|
-
removedSizeCount: 0,
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
// First, remove all keys we don't know about
|
|
434
|
-
for (const key of keys) {
|
|
435
|
-
if (sacredKeys.has(key) || key in meta.objects) {
|
|
436
|
-
continue;
|
|
437
|
-
}
|
|
438
|
-
this._log.info('Lost track of key in meta', key);
|
|
439
|
-
promises.push(this._persister.removeItem(key));
|
|
440
|
-
deets.removed.push(key);
|
|
441
|
-
deets.removedMissingCount++;
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
// Remove anything over the max age
|
|
445
|
-
const now = Date.now();
|
|
446
|
-
for (const [k, m] of Object.entries(meta.objects)) {
|
|
447
|
-
if (
|
|
448
|
-
!sacredKeys.has(k) &&
|
|
449
|
-
(m as ObjectMeta).updatedAt < now - this._gcOpts.maxAgeMs
|
|
450
|
-
) {
|
|
451
|
-
promises.push(this._persister.removeItem(k));
|
|
452
|
-
delete meta.objects[k];
|
|
453
|
-
deets.removed.push(k);
|
|
454
|
-
deets.removedOldCount++;
|
|
455
|
-
}
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
// Keep queries under max queries
|
|
459
|
-
const maxEntries = Object.entries(meta.objects) as Array<[K, ObjectMeta]>;
|
|
460
|
-
maxEntries.sort(([_k_a, a_meta], [_k_b, b_meta]) => {
|
|
461
|
-
return a_meta.updatedAt - b_meta.updatedAt;
|
|
462
|
-
});
|
|
463
|
-
|
|
464
|
-
const deletableMaxEntries = maxEntries.filter(([x]) => !sacredKeys.has(x));
|
|
465
|
-
if (maxEntries.length > this._gcOpts.maxEntries) {
|
|
466
|
-
for (const [k] of deletableMaxEntries.slice(
|
|
467
|
-
0,
|
|
468
|
-
maxEntries.length - this._gcOpts.maxEntries,
|
|
469
|
-
)) {
|
|
470
|
-
promises.push(this._persister.removeItem(k));
|
|
471
|
-
delete meta.objects[k];
|
|
472
|
-
deets.removed.push(k);
|
|
473
|
-
deets.removedThresholdCount++;
|
|
474
|
-
}
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
// Remove oldest entries until we are under max size
|
|
478
|
-
const delEntries = Object.entries(meta.objects) as Array<[K, ObjectMeta]>;
|
|
479
|
-
delEntries.sort(([_k_a, a_meta], [_k_b, b_meta]) => {
|
|
480
|
-
return a_meta.updatedAt - b_meta.updatedAt;
|
|
481
|
-
});
|
|
482
|
-
const deletableDelEntries = delEntries.filter(([x]) => !sacredKeys.has(x));
|
|
483
|
-
|
|
484
|
-
let currentSize = delEntries.reduce((acc, [_k, m]) => {
|
|
485
|
-
return acc + m.size;
|
|
486
|
-
}, 0);
|
|
487
|
-
|
|
488
|
-
while (
|
|
489
|
-
currentSize > 0 &&
|
|
490
|
-
currentSize > this._gcOpts.maxSize &&
|
|
491
|
-
deletableDelEntries.length
|
|
492
|
-
) {
|
|
493
|
-
const [[k, m]] = deletableDelEntries.splice(0, 1);
|
|
494
|
-
currentSize -= m.size;
|
|
495
|
-
promises.push(this._persister.removeItem(k));
|
|
496
|
-
delete meta.objects[k];
|
|
497
|
-
deets.removed.push(k);
|
|
498
|
-
deets.removedSizeCount++;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// Update meta to remove keys that are no longer in the store
|
|
502
|
-
for (const k of Object.keys(meta.objects)) {
|
|
503
|
-
if (!keys.has(k) && !sacredKeys.has(k)) {
|
|
504
|
-
delete meta.objects[k];
|
|
505
|
-
}
|
|
506
|
-
}
|
|
507
|
-
|
|
508
|
-
if (deets.removed.length || deets.metaRemoved.length) {
|
|
509
|
-
// Trigger a flush of the meta
|
|
510
|
-
promises.push(this._enqueuePersist({ skipGc: true }));
|
|
511
|
-
}
|
|
512
|
-
|
|
513
|
-
this._log.info('Completed GC', deets);
|
|
514
|
-
|
|
515
|
-
await Promise.all(promises);
|
|
516
|
-
return deets;
|
|
517
|
-
}
|
|
518
|
-
|
|
519
|
-
// Schedules a GC to run in one minute (unless it is already scheduled)
|
|
520
|
-
gc() {
|
|
521
|
-
if (this._nextGc) {
|
|
522
|
-
return;
|
|
523
|
-
}
|
|
524
|
-
this._nextGc = setTimeout(
|
|
525
|
-
() => {
|
|
526
|
-
safeIdleCallback(() => {
|
|
527
|
-
this._nextGc = null;
|
|
528
|
-
this._gc().catch((e) =>
|
|
529
|
-
this._log.error('Persisted Object GC Failed:', e),
|
|
530
|
-
);
|
|
531
|
-
}, 30 * 1000);
|
|
532
|
-
},
|
|
533
|
-
// 1 minute + some jitter to keep multiple tabs from running at same time
|
|
534
|
-
1000 * 60 + Math.random() * 500,
|
|
535
|
-
);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
private _enqueuePersist(opts?: {
|
|
539
|
-
skipGc?: boolean | null | undefined;
|
|
540
|
-
attempts?: number | null | undefined;
|
|
541
|
-
}): Promise<number> {
|
|
542
|
-
return new Promise((resolve, reject) => {
|
|
543
|
-
if (this._nextSave) {
|
|
544
|
-
resolve(0);
|
|
545
|
-
return;
|
|
546
|
-
}
|
|
547
|
-
|
|
548
|
-
this._nextSave = setTimeout(() => {
|
|
549
|
-
safeIdleCallback(() => {
|
|
550
|
-
this._nextSave = null;
|
|
551
|
-
this._writeToStorage(opts).then(resolve).catch(reject);
|
|
552
|
-
}, this._idleCallbackMaxWaitMs);
|
|
553
|
-
}, this._saveThrottleMs);
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
version() {
|
|
558
|
-
return this._version;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
// Takes a function that updates the store in place.
|
|
562
|
-
// Uses `mutative` to get a list of keys that were changed
|
|
563
|
-
// so that we know which entries we need to persist to the store.
|
|
564
|
-
public updateInPlace(f: (prev: Record<string, T>) => void) {
|
|
565
|
-
this._version++;
|
|
566
|
-
const [state, patches] = create(this.currentValue, f, {
|
|
567
|
-
enablePatches: true,
|
|
568
|
-
});
|
|
569
|
-
for (const patch of patches) {
|
|
570
|
-
const k = patch.path[0];
|
|
571
|
-
if (k && typeof k === 'string') {
|
|
572
|
-
this._pendingSaveKeys.add(k as K);
|
|
573
|
-
if (!this._loadedKeys.has(k as K)) {
|
|
574
|
-
this._loadKey(k as K);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
this.currentValue = state;
|
|
580
|
-
this._enqueuePersist();
|
|
581
|
-
for (const cb of this._subs) {
|
|
582
|
-
cb(this.currentValue);
|
|
583
|
-
}
|
|
584
|
-
return state;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
public subscribe(cb: (value: Record<K, T>) => void) {
|
|
588
|
-
this._subs.push(cb);
|
|
589
|
-
cb(this.currentValue);
|
|
590
|
-
|
|
591
|
-
return () => {
|
|
592
|
-
this._subs = this._subs.filter((x) => x !== cb);
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
// Removes any keys that we haven't loaded--used when
|
|
597
|
-
// changing users to make sure we clean out all user data
|
|
598
|
-
public async clearUnloadedKeys(): Promise<void> {
|
|
599
|
-
let needsPersist = false;
|
|
600
|
-
for (const key of await this._persister.getAllKeys()) {
|
|
601
|
-
if (key === META_KEY || key in this.currentValue) {
|
|
602
|
-
continue;
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
this._pendingSaveKeys.add(key as K);
|
|
606
|
-
needsPersist = true;
|
|
607
|
-
}
|
|
608
|
-
if (needsPersist) {
|
|
609
|
-
await this._enqueuePersist();
|
|
610
|
-
}
|
|
611
|
-
}
|
|
612
|
-
}
|