@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/api/schema.ts"],"names":[],"mappings":";;AA6MA,0CAcC;AAED,oCAOC;AAED,8CA8GC;AAED,gDAKC;AAMD,8CAgCC;AAED,gDAMC;AAED,0CAOC;AAED,wCA2BC;AAED,0EAoCC;AAED,0DAkBC;AAED,0CAOC;AAED,0CAWC;AAED,oCAiDC;AAkFD,8BA2CC;AAED,kCAgCC;AAED,gCAwDC;AAED,kDA0DC;AA3zBD,4CAUsB;AACtB,8DAAwD;AAOxD,oDAK0B;AAC1B,uCAAsC;AACtC,yDAI4B;AAoKrB,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,KAAa,EACb,KAAa;IAEb,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,MA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AK,EAAE,OAAO;iBACf,CAAC;aACH,CACF,CAAC;YAEF,MAAM,YAAY,GAAG,IAAI,CAAC,eAAe,CAAC,CAAC;YAE3C,MAAM,IAAI,GAAG,CAAC,YAAY;gBACxB,CAAC,CAAC,EAAE;gBACJ,CAAC,CAAC,MAAM,YAAY,CAChB,MAAM,EACN,KAAK,EACL,KAAK,EACL,YAAY,CAAC,UAAU,CAAC,EACxB,YAAY,CAAC,MAAM,CAAC,EACpB,CAAC,IAAI,EAAE,EAAE;oBACP,QAAQ,CACN,WAAW,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CAAC,CAChE,CAAC;gBACJ,CAAC,CACF,CAAC;YAEN,MAAM,SAAS,GAAG,MAAM,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;YAC3D,OAAO,CAAC;gBACN,SAAS,EAAE,SAAS,CAAC,MAAM;gBAC3B,KAAK,EAAE,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC;gBACzD,OAAO,EAAE,WAAW,CAClB,kBAAkB,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,EAAE,YAAY,CAAC,CACnD;aACF,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,CAAC,CAAU,CAAC,CAAC;QACrB,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n BackendRelayAPIError,\n BackendRelayRules,\n BackendRelaySchemaDef,\n EntitiesDef,\n LinksDef,\n RoomsDef,\n BackendRelayDBAttr,\n BackendRelayDBIdent,\n BackendRelayDBCheckedDataType,\n BackendRelayDBIdent as Ident,\n} from '@backendrelay/core';\nimport {\n attrFwdLabel,\n attrFwdName,\n attrRevName,\n collectSystemCatalogIdentNames,\n identName,\n BackendRelayAPIPlatformSchema,\n BackendRelayAPISchemaPlanStep,\n BackendRelayAPISchemaPushStep,\n validateSchema,\n} from '../schema.ts';\nimport { ProgressPromise } from '../ProgressPromise.ts';\nimport {\n capitalizeFirstLetter,\n deriveClientType,\n rels,\n sortedEntries,\n} from '../util.ts';\nimport {\n buildAutoRenameSelector,\n convertTxSteps,\n diffSchemas,\n RenameCommand,\n} from '../migrations.ts';\nimport { jsonFetch } from './http.ts';\nimport {\n apiSchemaToAttrs,\n apiSchemaToBackendRelaySchemaDef,\n attrDefForType,\n} from './schema-coerce.ts';\n\nexport type BackendRelayAPIGetAppSchemaResponse = {\n schema: BackendRelaySchemaDef<EntitiesDef, LinksDef<EntitiesDef>, RoomsDef>;\n};\n\nexport type BackendRelayAPISchemaPushBody =\n | {\n schema: BackendRelaySchemaDef<\n EntitiesDef,\n LinksDef<EntitiesDef>,\n RoomsDef\n >;\n overwrite?: false;\n }\n | {\n schema: BackendRelaySchemaDef<\n EntitiesDef,\n LinksDef<EntitiesDef>,\n RoomsDef\n >;\n overwrite: true;\n renames?: RenameCommand[];\n };\n\nexport type PlanStep =\n | ['add-attr', BackendRelayDBAttr]\n | ['update-attr', Partial<BackendRelayDBAttr>]\n | ['index', { 'attr-id': string; 'forward-identity': BackendRelayDBIdent }]\n | [\n 'remove-index',\n { 'attr-id': string; 'forward-identity': BackendRelayDBIdent },\n ]\n | ['unique', { 'attr-id': string; 'forward-identity': BackendRelayDBIdent }]\n | [\n 'remove-unique',\n { 'attr-id': string; 'forward-identity': BackendRelayDBIdent },\n ]\n | ['required', { 'attr-id': string; 'forward-identity': BackendRelayDBIdent }]\n | [\n 'remove-required',\n { 'attr-id': string; 'forward-identity': BackendRelayDBIdent },\n ]\n | [\n 'check-data-type',\n {\n 'attr-id': string;\n 'forward-identity': BackendRelayDBIdent;\n 'checked-data-type': BackendRelayDBCheckedDataType;\n },\n ]\n | [\n 'remove-data-type',\n { 'attr-id': string; 'forward-identity': BackendRelayDBIdent },\n ]\n | ['delete-attr', string];\n\nexport type PlanReponseJSON = {\n 'new-schema': BackendRelayAPIPlatformSchema;\n 'current-schema': BackendRelayAPIPlatformSchema;\n 'current-attrs': BackendRelayDBAttr[];\n steps: PlanStep[];\n};\n\n// Same as PlanStep, but some background steps get a job-id\nexport type StepWithJobId<T> = T extends ['add-attr', infer P]\n ? ['add-attr', P]\n : T extends ['update-attr', infer P]\n ? ['update-attr', P]\n : T extends [infer K, infer P]\n ? [K, P & { 'job-id': string }]\n : never;\n\nexport type PushStep = StepWithJobId<PlanStep>;\n\nexport type IndexingJobJSON = {\n id: string;\n app_id: string;\n group_id: string;\n attr_id: string;\n attr_name: string;\n job_type:\n | 'check-data-type'\n | 'remove-data-type'\n | 'index'\n | 'remove-index'\n | 'unique'\n | 'remove-unique'\n | 'required'\n | 'remove-required';\n job_status: 'waiting' | 'processing' | 'completed' | 'errored';\n work_estimate: number | null;\n work_completed: number | null;\n error:\n | 'invalid-triple-error'\n | 'invalid-attr-state-error'\n | 'triple-not-unique-error'\n | 'triple-too-large-error'\n | 'missing-required-error'\n | 'unexpected-error';\n checked_data_type?: BackendRelayDBCheckedDataType;\n created_at: string;\n updated_at: string;\n done_at: string;\n invalid_unique_value: any;\n invalid_triples_sample: {\n entity_id: string;\n value: any;\n json_type:\n | 'string'\n | 'number'\n | 'boolean'\n | 'null'\n | 'object'\n | 'array'\n | 'date';\n }[];\n error_data: any;\n};\n\nexport type SchemaPushResponseJSON = {\n 'indexing-jobs'?: {\n 'group-id': string;\n jobs: IndexingJobJSON[];\n } | null;\n steps: PushStep[];\n};\n\nexport type BackendRelayAPIPlanSchemaPushResponse = {\n newSchema: BackendRelaySchemaDef<\n EntitiesDef,\n LinksDef<EntitiesDef>,\n RoomsDef\n >;\n currentSchema: BackendRelaySchemaDef<\n EntitiesDef,\n LinksDef<EntitiesDef>,\n RoomsDef\n >;\n steps: BackendRelayAPISchemaPlanStep[];\n};\n\nexport type InProgressStepsSummary = {\n friendlyDescription: string;\n totalCount: number;\n inProgressCount: number;\n completedCount: number;\n errorCount: number;\n steps: BackendRelayAPISchemaPushStep[];\n inProgressSteps: BackendRelayAPISchemaPushStep[];\n completedSteps: BackendRelayAPISchemaPushStep[];\n erroredSteps: BackendRelayAPISchemaPushStep[];\n};\n\nexport type BackendRelayAPISchemaPushResponse = {\n newSchema: BackendRelaySchemaDef<\n EntitiesDef,\n LinksDef<EntitiesDef>,\n RoomsDef\n >;\n steps: BackendRelayAPISchemaPushStep[];\n summary: InProgressStepsSummary;\n};\n\nexport async function getAppAPISchema(\n apiURI: string,\n token: string,\n appId: string,\n): Promise<BackendRelayAPIPlatformSchema> {\n const { schema: apiSchema } = await jsonFetch<{\n schema: BackendRelayAPIPlatformSchema;\n }>(`${apiURI}/superadmin/apps/${appId}/schema`, {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n });\n return apiSchema;\n}\n\nexport async function getAppSchema(\n apiURI: string,\n token: string,\n appId: string,\n): Promise<BackendRelayAPIGetAppSchemaResponse> {\n const apiSchema = await getAppAPISchema(apiURI, token, appId);\n return { schema: apiSchemaToBackendRelaySchemaDef(apiSchema) };\n}\n\nexport function translatePlanStep(\n apiStep: PlanStep,\n currentAttrs: BackendRelayDBAttr[],\n): BackendRelayAPISchemaPlanStep {\n const [stepType, stepParams] = apiStep;\n\n switch (stepType) {\n case 'add-attr': {\n const attr = stepParams;\n const attrName = attrFwdName(attr);\n const friendlyDescription =\n attr['value-type'] === 'blob'\n ? attrFwdLabel(attr) === 'id'\n ? `Create new entity ${attrName}.`\n : `Add attribute ${attrName}.`\n : `Link ${attrName} to ${attrRevName(attr)}.`;\n return { type: 'add-attr', friendlyDescription, attr };\n }\n case 'update-attr': {\n const attr = stepParams as BackendRelayDBAttr;\n return {\n type: 'update-attr',\n friendlyDescription: `Update attribute ${attrFwdName(attr)}.`,\n attr,\n };\n }\n case 'index': {\n return {\n type: 'index',\n friendlyDescription: `Add index to ${identName(stepParams['forward-identity'])}.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'remove-index': {\n return {\n type: 'remove-index',\n friendlyDescription: `Remove index from ${identName(stepParams['forward-identity'])}.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'unique': {\n return {\n type: 'unique',\n friendlyDescription: `Ensure that ${identName(stepParams['forward-identity'])} is unique.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'remove-unique': {\n return {\n type: 'remove-unique',\n friendlyDescription: `Remove uniqueness constraint from ${identName(stepParams['forward-identity'])}.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'required': {\n return {\n type: 'required',\n friendlyDescription: `Make ${identName(stepParams['forward-identity'])} a required attribute.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'remove-required': {\n return {\n type: 'remove-required',\n friendlyDescription: `Allow ${identName(stepParams['forward-identity'])} to be missing or null.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'check-data-type': {\n const forwardIdentity = stepParams['forward-identity'];\n const dataType = stepParams['checked-data-type'];\n return {\n type: 'check-data-type',\n friendlyDescription: `Enforce data type of ${identName(forwardIdentity)} as type ${dataType}.`,\n attrId: stepParams['attr-id'],\n forwardIdentity,\n checkedDataType: dataType,\n };\n }\n case 'remove-data-type': {\n const forwardIdentity = stepParams['forward-identity'];\n return {\n type: 'remove-data-type',\n friendlyDescription: `Stop enforcing data type of ${identName(forwardIdentity)}.`,\n attrId: stepParams['attr-id'],\n forwardIdentity: stepParams['forward-identity'],\n };\n }\n case 'delete-attr': {\n const attrId = stepParams;\n const attr = currentAttrs.find((a) => a.id === attrId);\n const friendlyName = attr ? identName(attr['forward-identity']) : attrId;\n return {\n type: 'delete-attr',\n attrId: stepParams,\n friendlyDescription: `Delete attribute ${friendlyName}.`,\n };\n }\n default: {\n // Get a type error if we ignore a case\n const unknownType: never = stepType;\n throw new Error(`Unknown schema operation ${unknownType}.`);\n }\n }\n}\n\nexport function translatePlanSteps(\n apiSteps: PlanStep[],\n currentAttrs: BackendRelayDBAttr[],\n): BackendRelayAPISchemaPlanStep[] {\n return apiSteps.map((step) => translatePlanStep(step, currentAttrs));\n}\n\nexport type PushObjOf<S extends PushStep> =\n // grab from the union the member whose discriminant matches S[0]\n Extract<BackendRelayAPISchemaPushStep, { type: S[0] }>;\n\nexport function translatePushStep<S extends PushStep>(\n apiStep: S,\n jobs: IndexingJobJSON[],\n currentAttrs: BackendRelayDBAttr[],\n): PushObjOf<S> {\n const [stepType, stepParams] = apiStep;\n if (\n stepType === 'add-attr' ||\n stepType === 'update-attr' ||\n stepType === 'delete-attr'\n ) {\n const planStep = translatePlanStep(apiStep, currentAttrs);\n if (\n planStep.type !== 'add-attr' &&\n planStep.type !== 'update-attr' &&\n planStep.type !== 'delete-attr'\n ) {\n // This is just here for typescript\n throw new Error('Invalid step.');\n }\n return planStep as PushObjOf<S>;\n }\n const jobId = stepParams['job-id'];\n const job = jobs.find((j) => j.id === jobId)!;\n const planStep = translatePlanStep(apiStep, currentAttrs);\n const backgroundJob = formatJob(job);\n\n if (planStep.type !== backgroundJob.type) {\n throw new Error('Invalid type');\n }\n\n return { ...planStep, backgroundJob } as PushObjOf<S>;\n}\n\nexport function translatePushSteps(\n apiSteps: PushStep[],\n jobs: IndexingJobJSON[],\n currentAttrs: BackendRelayDBAttr[],\n): BackendRelayAPISchemaPushStep[] {\n return apiSteps.map((step) => translatePushStep(step, jobs, currentAttrs));\n}\n\nexport function shouldOverwrite(body: BackendRelayAPISchemaPushBody) {\n if ('renames' in body && !body.overwrite) {\n throw new Error(\n 'If you pass in `renames`, you _must_ pass in `overwrite: true`',\n );\n }\n return !!body.overwrite;\n}\n\nexport async function planSchemaPush(\n apiURI: string,\n token: string,\n appId: string,\n body: BackendRelayAPISchemaPushBody,\n): Promise<BackendRelayAPIPlanSchemaPushResponse> {\n const resp = await jsonFetch<PlanReponseJSON>(\n `${apiURI}/superadmin/apps/${appId}/schema/push/plan`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n ...body,\n check_types: true,\n supports_background_updates: true,\n }),\n },\n );\n const currentAttrs = resp['current-attrs'];\n return {\n newSchema: apiSchemaToBackendRelaySchemaDef(resp['new-schema']),\n currentSchema: apiSchemaToBackendRelaySchemaDef(resp['current-schema']),\n steps: translatePlanSteps(resp['steps'], currentAttrs),\n };\n}\n\nexport async function planSchemaPushOverwriteInternal(\n apiURI: string,\n token: string,\n appId: string,\n body: BackendRelayAPISchemaPushBody,\n) {\n const apiSchema = await getAppAPISchema(apiURI, token, appId);\n\n const currentSchema = apiSchemaToBackendRelaySchemaDef(apiSchema);\n const currentAttrs = apiSchemaToAttrs(apiSchema);\n\n const systemCatalogIdentNames = collectSystemCatalogIdentNames(currentAttrs);\n\n const newSchema = body.schema;\n\n validateSchema(newSchema, systemCatalogIdentNames);\n\n const renames = ('renames' in body ? body.renames : null) || [];\n\n const renameSelector = buildAutoRenameSelector(renames);\n\n const diffResult = await diffSchemas(\n currentSchema,\n newSchema,\n renameSelector,\n systemCatalogIdentNames,\n );\n\n const txSteps = convertTxSteps(diffResult, currentAttrs);\n\n return {\n currentSchema,\n currentAttrs,\n txSteps: txSteps,\n steps: translatePlanSteps(txSteps, currentAttrs),\n };\n}\n\nexport async function planSchemaPushOverwrite(\n apiURI: string,\n token: string,\n appId: string,\n body: BackendRelayAPISchemaPushBody,\n): Promise<BackendRelayAPIPlanSchemaPushResponse> {\n const { currentSchema, steps } = await planSchemaPushOverwriteInternal(\n apiURI,\n token,\n appId,\n body,\n );\n\n return {\n newSchema: body.schema,\n currentSchema: currentSchema,\n steps: steps,\n };\n}\n\nexport function allJobsComplete(jobs: IndexingJobJSON[]): boolean {\n if (jobs.length === 0) {\n return true;\n }\n return jobs.every(\n (j) => j.job_status === 'completed' || j.job_status === 'errored',\n );\n}\n\nexport function latestJobUpdate(jobs: IndexingJobJSON[]): Date | null {\n const res = jobs.reduce((acc: Date | null, job) => {\n if (job.updated_at) {\n const d = new Date(job.updated_at);\n if (!acc || d > acc) {\n return d;\n }\n }\n return acc;\n }, null);\n return res;\n}\n\nexport async function jobFetchLoop(\n apiURI: string,\n token: string,\n appId: string,\n groupId: string,\n startingJobs: IndexingJobJSON[],\n onFetch: (jobs: IndexingJobJSON[]) => void,\n): Promise<IndexingJobJSON[]> {\n let interval = 100;\n let lastJobs = startingJobs;\n let errorCount = 0;\n\n while (!allJobsComplete(lastJobs)) {\n await new Promise((resolve) => setTimeout(resolve, interval));\n try {\n const nextJobs = (\n await jsonFetch<{ jobs: IndexingJobJSON[] }>(\n `${apiURI}/dash/apps/${appId}/indexing-jobs/group/${groupId}`,\n {\n method: 'GET',\n headers: {\n Authorization: `Bearer ${token}`,\n },\n },\n )\n ).jobs;\n onFetch(nextJobs);\n if (allJobsComplete(nextJobs)) {\n return nextJobs;\n }\n errorCount = 0;\n const lastUpdate = latestJobUpdate(lastJobs);\n const thisUpdate = latestJobUpdate(nextJobs);\n lastJobs = nextJobs;\n interval =\n thisUpdate === null || (lastUpdate && lastUpdate >= thisUpdate)\n ? Math.min(interval * 2, 10000)\n : 100;\n } catch (e) {\n if (errorCount > 3) {\n throw e;\n } else {\n errorCount++;\n interval = Math.min(interval * 2, 10000);\n }\n }\n }\n\n return lastJobs;\n}\n\nexport type BackendRelayBackgroundSchemaBaseJob = {\n id: string;\n createdAt: Date;\n updatedAt: Date;\n status: 'completed' | 'waiting' | 'processing' | 'errored';\n workEstimate: number | null;\n workCompleted: number | null;\n error?:\n | 'invalid-triple-error'\n | 'invalid-attr-state-error'\n | 'triple-not-unique-error'\n | 'triple-too-large-error'\n | 'missing-required-error'\n | 'unexpected-error';\n invalidTriplesSample?: {\n entityId: string;\n value: any;\n jsonType:\n | 'string'\n | 'number'\n | 'boolean'\n | 'null'\n | 'object'\n | 'array'\n | 'date';\n }[];\n};\n\nexport interface BackendRelayBackgroundSchemaRemoveDataTypeJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'remove-data-type';\n}\n\nexport interface BackendRelayBackgroundSchemaCheckDataTypeJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'check-data-type';\n checkedDataType: BackendRelayDBCheckedDataType;\n}\n\nexport interface BackendRelayBackgroundSchemaAddIndexJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'index';\n}\n\nexport interface BackendRelayBackgroundSchemaRemoveIndexJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'remove-index';\n}\n\nexport interface BackendRelayBackgroundSchemaAddUniqueJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'unique';\n invalidUniqueValue?: any;\n}\n\nexport interface BackendRelayBackgroundSchemaRemoveUniqueJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'remove-unique';\n}\n\nexport interface BackendRelayBackgroundSchemaAddRequiredJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'required';\n}\n\nexport interface BackendRelayBackgroundSchemaRemoveRequiredJob\n extends BackendRelayBackgroundSchemaBaseJob {\n type: 'remove-required';\n}\n\nexport type BackendRelayBackgroundSchemaJob =\n | BackendRelayBackgroundSchemaRemoveDataTypeJob\n | BackendRelayBackgroundSchemaCheckDataTypeJob\n | BackendRelayBackgroundSchemaAddIndexJob\n | BackendRelayBackgroundSchemaRemoveIndexJob\n | BackendRelayBackgroundSchemaAddUniqueJob\n | BackendRelayBackgroundSchemaRemoveUniqueJob\n | BackendRelayBackgroundSchemaAddRequiredJob\n | BackendRelayBackgroundSchemaRemoveRequiredJob;\n\nexport function formatJob(\n job: IndexingJobJSON,\n): BackendRelayBackgroundSchemaJob {\n const baseJob: BackendRelayBackgroundSchemaBaseJob = {\n id: job.id,\n createdAt: new Date(job.created_at),\n updatedAt: new Date(job.updated_at),\n status: job.job_status,\n workEstimate: job.work_estimate,\n workCompleted: job.work_completed,\n error: job.error,\n invalidTriplesSample: job.invalid_triples_sample?.map((s) => {\n return { entityId: s.entity_id, value: s.value, jsonType: s.json_type };\n }),\n };\n switch (job.job_type) {\n case 'remove-data-type':\n case 'index':\n case 'remove-index':\n case 'required':\n case 'remove-required':\n case 'remove-unique': {\n return { ...baseJob, type: job.job_type };\n }\n case 'check-data-type': {\n return {\n ...baseJob,\n type: job.job_type,\n checkedDataType: job.checked_data_type!,\n };\n }\n case 'unique': {\n return {\n ...baseJob,\n type: job.job_type,\n invalidUniqueValue: job.invalid_unique_value,\n };\n }\n default: {\n const neverType: never = job.job_type;\n throw new Error(`Unknown job type: ${neverType}.`);\n }\n }\n}\n\nexport function stepSummary(\n steps: BackendRelayAPISchemaPushStep[],\n): InProgressStepsSummary {\n const inProgress = steps.filter(\n (s) =>\n 'backgroundJob' in s &&\n (s.backgroundJob.status === 'processing' ||\n s.backgroundJob.status === 'waiting'),\n );\n const completed = steps.filter(\n (s) => !('backgroundJob' in s) || s.backgroundJob.status === 'completed',\n );\n const errored = steps.filter(\n (s) => 'backgroundJob' in s && s.backgroundJob.status === 'errored',\n );\n return {\n friendlyDescription: inProgress.length\n ? `Completing ${inProgress.length} of ${steps.length} schema operations.`\n : `Finished ${steps.length} schema operation${steps.length === 1 ? '' : 's'}${\n errored.length\n ? `, with ${errored.length} error${errored.length > 1 ? 's' : ''}`\n : '.'\n }`,\n totalCount: steps.length,\n inProgressCount: inProgress.length,\n completedCount: completed.length,\n errorCount: errored.length,\n steps,\n inProgressSteps: inProgress,\n completedSteps: completed,\n erroredSteps: errored,\n };\n}\n\nexport function schemaPush(\n apiURI: string,\n token: string,\n appId: string,\n body: BackendRelayAPISchemaPushBody,\n): ProgressPromise<InProgressStepsSummary, BackendRelayAPISchemaPushResponse> {\n return new ProgressPromise(async (progress, resolve, reject) => {\n try {\n const currentAPISchema = await getAppAPISchema(apiURI, token, appId);\n const currentAttrs = apiSchemaToAttrs(currentAPISchema);\n\n const resp = await jsonFetch<SchemaPushResponseJSON>(\n `${apiURI}/superadmin/apps/${appId}/schema/push/apply`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n ...body,\n check_types: true,\n supports_background_updates: true,\n }),\n },\n );\n\n const indexingJobs = resp['indexing-jobs'];\n\n const jobs = !indexingJobs\n ? []\n : await jobFetchLoop(\n apiURI,\n token,\n appId,\n indexingJobs['group-id'],\n indexingJobs['jobs'],\n (jobs) => {\n progress(\n stepSummary(translatePushSteps(resp.steps, jobs, currentAttrs)),\n );\n },\n );\n\n const schemaRes = await getAppSchema(apiURI, token, appId);\n resolve({\n newSchema: schemaRes.schema,\n steps: translatePushSteps(resp.steps, jobs, currentAttrs),\n summary: stepSummary(\n translatePushSteps(resp.steps, jobs, currentAttrs),\n ),\n });\n } catch (e) {\n reject(e as Error);\n }\n });\n}\n\nexport function schemaPushOverwrite(\n apiURI: string,\n token: string,\n appId: string,\n body: BackendRelayAPISchemaPushBody,\n): ProgressPromise<InProgressStepsSummary, BackendRelayAPISchemaPushResponse> {\n return new ProgressPromise(async (progress, resolve, reject) => {\n try {\n const { currentAttrs, txSteps } = await planSchemaPushOverwriteInternal(\n apiURI,\n token,\n appId,\n body,\n );\n\n const resp = await jsonFetch<SchemaPushResponseJSON>(\n `${apiURI}/dash/apps/${appId}/schema/steps/apply`,\n {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${token}`,\n },\n body: JSON.stringify({\n steps: txSteps,\n }),\n },\n );\n\n const indexingJobs = resp['indexing-jobs'];\n\n const jobs = !indexingJobs\n ? []\n : await jobFetchLoop(\n apiURI,\n token,\n appId,\n indexingJobs['group-id'],\n indexingJobs['jobs'],\n (jobs) => {\n progress(\n stepSummary(translatePushSteps(resp.steps, jobs, currentAttrs)),\n );\n },\n );\n\n const schemaRes = await getAppSchema(apiURI, token, appId);\n resolve({\n newSchema: schemaRes.schema,\n steps: translatePushSteps(resp.steps, jobs, currentAttrs),\n summary: stepSummary(\n translatePushSteps(resp.steps, jobs, currentAttrs),\n ),\n });\n } catch (e) {\n reject(e as Error);\n }\n });\n}\n"]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { BackendRelayAPIAppDetails, BackendRelayAPIOrgDetails, BackendRelayAPIGetAppResponse, BackendRelayAPIListAppsResponse, BackendRelayAPIListOrgsResponse, BackendRelayAPICreateAppBody, BackendRelayAPICreateTemporaryAppBody, BackendRelayAPICreateTemporaryAppResponse, BackendRelayAPICreateAppResponse, BackendRelayAPIUpdateAppBody, BackendRelayAPIUpdateAppResponse, BackendRelayAPIDeleteAppResponse, } from './api/apps.ts';
|
|
2
|
+
export type { BackendRelayAPIGetAppSchemaResponse, BackendRelayAPISchemaPushBody, PlanStep, BackendRelayAPIPlanSchemaPushResponse, BackendRelayAPISchemaPushResponse, BackendRelayBackgroundSchemaRemoveDataTypeJob, BackendRelayBackgroundSchemaCheckDataTypeJob, BackendRelayBackgroundSchemaAddIndexJob, BackendRelayBackgroundSchemaRemoveIndexJob, BackendRelayBackgroundSchemaAddUniqueJob, BackendRelayBackgroundSchemaRemoveUniqueJob, BackendRelayBackgroundSchemaAddRequiredJob, BackendRelayBackgroundSchemaRemoveRequiredJob, BackendRelayBackgroundSchemaJob, } from './api/schema.ts';
|
|
3
|
+
export { translatePlanSteps } from './api/schema.ts';
|
|
4
|
+
export { apiSchemaToAttrs, apiSchemaToBackendRelaySchemaDef, } from './api/schema-coerce.ts';
|
|
5
|
+
export type { BackendRelayAPIGetAppPermsResponse, BackendRelayAPIPushPermsBody, BackendRelayAPIPushPermsResponse, } from './api/perms.ts';
|
|
6
|
+
export type { BackendRelayAPITokenInfoResponse } from './api/auth.ts';
|
|
7
|
+
export type { PlatformApiAuth, PlatformApiConfig } from './api/platform-api.ts';
|
|
8
|
+
export { PlatformApi, PlatformApiMissingAuthError, } from './api/platform-api.ts';
|
|
9
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":"AAEA,YAAY,EACV,yBAAyB,EACzB,yBAAyB,EACzB,6BAA6B,EAC7B,+BAA+B,EAC/B,+BAA+B,EAC/B,4BAA4B,EAC5B,qCAAqC,EACrC,yCAAyC,EACzC,gCAAgC,EAChC,4BAA4B,EAC5B,gCAAgC,EAChC,gCAAgC,GACjC,MAAM,eAAe,CAAC;AAEvB,YAAY,EACV,mCAAmC,EACnC,6BAA6B,EAC7B,QAAQ,EACR,qCAAqC,EACrC,iCAAiC,EACjC,6CAA6C,EAC7C,4CAA4C,EAC5C,uCAAuC,EACvC,0CAA0C,EAC1C,wCAAwC,EACxC,2CAA2C,EAC3C,0CAA0C,EAC1C,6CAA6C,EAC7C,+BAA+B,GAChC,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EACL,gBAAgB,EAChB,gCAAgC,GACjC,MAAM,wBAAwB,CAAC;AAEhC,YAAY,EACV,kCAAkC,EAClC,4BAA4B,EAC5B,gCAAgC,GACjC,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,gCAAgC,EAAE,MAAM,eAAe,CAAC;AAEtE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAChF,OAAO,EACL,WAAW,EACX,2BAA2B,GAC5B,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PlatformApiMissingAuthError = exports.PlatformApi = exports.apiSchemaToBackendRelaySchemaDef = exports.apiSchemaToAttrs = exports.translatePlanSteps = void 0;
|
|
4
|
+
var schema_ts_1 = require("./api/schema.js");
|
|
5
|
+
Object.defineProperty(exports, "translatePlanSteps", { enumerable: true, get: function () { return schema_ts_1.translatePlanSteps; } });
|
|
6
|
+
var schema_coerce_ts_1 = require("./api/schema-coerce.js");
|
|
7
|
+
Object.defineProperty(exports, "apiSchemaToAttrs", { enumerable: true, get: function () { return schema_coerce_ts_1.apiSchemaToAttrs; } });
|
|
8
|
+
Object.defineProperty(exports, "apiSchemaToBackendRelaySchemaDef", { enumerable: true, get: function () { return schema_coerce_ts_1.apiSchemaToBackendRelaySchemaDef; } });
|
|
9
|
+
var platform_api_ts_1 = require("./api/platform-api.js");
|
|
10
|
+
Object.defineProperty(exports, "PlatformApi", { enumerable: true, get: function () { return platform_api_ts_1.PlatformApi; } });
|
|
11
|
+
Object.defineProperty(exports, "PlatformApiMissingAuthError", { enumerable: true, get: function () { return platform_api_ts_1.PlatformApiMissingAuthError; } });
|
|
12
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":";;;AAiCA,6CAAqD;AAA5C,+GAAA,kBAAkB,OAAA;AAE3B,2DAGgC;AAF9B,oHAAA,gBAAgB,OAAA;AAChB,oIAAA,gCAAgC,OAAA;AAYlC,yDAG+B;AAF7B,8GAAA,WAAW,OAAA;AACX,8HAAA,2BAA2B,OAAA","sourcesContent":["// Module root for the Platform API client. Each resource group lives in\n// ./api/*; this file only re-exports the public surface.\nexport type {\n BackendRelayAPIAppDetails,\n BackendRelayAPIOrgDetails,\n BackendRelayAPIGetAppResponse,\n BackendRelayAPIListAppsResponse,\n BackendRelayAPIListOrgsResponse,\n BackendRelayAPICreateAppBody,\n BackendRelayAPICreateTemporaryAppBody,\n BackendRelayAPICreateTemporaryAppResponse,\n BackendRelayAPICreateAppResponse,\n BackendRelayAPIUpdateAppBody,\n BackendRelayAPIUpdateAppResponse,\n BackendRelayAPIDeleteAppResponse,\n} from './api/apps.ts';\n\nexport type {\n BackendRelayAPIGetAppSchemaResponse,\n BackendRelayAPISchemaPushBody,\n PlanStep,\n BackendRelayAPIPlanSchemaPushResponse,\n BackendRelayAPISchemaPushResponse,\n BackendRelayBackgroundSchemaRemoveDataTypeJob,\n BackendRelayBackgroundSchemaCheckDataTypeJob,\n BackendRelayBackgroundSchemaAddIndexJob,\n BackendRelayBackgroundSchemaRemoveIndexJob,\n BackendRelayBackgroundSchemaAddUniqueJob,\n BackendRelayBackgroundSchemaRemoveUniqueJob,\n BackendRelayBackgroundSchemaAddRequiredJob,\n BackendRelayBackgroundSchemaRemoveRequiredJob,\n BackendRelayBackgroundSchemaJob,\n} from './api/schema.ts';\nexport { translatePlanSteps } from './api/schema.ts';\n\nexport {\n apiSchemaToAttrs,\n apiSchemaToBackendRelaySchemaDef,\n} from './api/schema-coerce.ts';\n\nexport type {\n BackendRelayAPIGetAppPermsResponse,\n BackendRelayAPIPushPermsBody,\n BackendRelayAPIPushPermsResponse,\n} from './api/perms.ts';\n\nexport type { BackendRelayAPITokenInfoResponse } from './api/auth.ts';\n\nexport type { PlatformApiAuth, PlatformApiConfig } from './api/platform-api.ts';\nexport {\n PlatformApi,\n PlatformApiMissingAuthError,\n} from './api/platform-api.ts';\n"]}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import type { AppBackup, BackupsManager } from './backups.ts';
|
|
2
|
+
export type BackupDownloadProgress = {
|
|
3
|
+
entitiesCompleted: number;
|
|
4
|
+
entitiesTotal: number | null;
|
|
5
|
+
filesCompleted: number;
|
|
6
|
+
filesTotal: number | null;
|
|
7
|
+
zipBytes: number;
|
|
8
|
+
bytesRead: number;
|
|
9
|
+
bytesTotal: number | null;
|
|
10
|
+
currentEntity: string;
|
|
11
|
+
currentFile: string;
|
|
12
|
+
};
|
|
13
|
+
export type BackupDownloadResult = {
|
|
14
|
+
entities: number;
|
|
15
|
+
files: number;
|
|
16
|
+
zipBytes: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The archive encoder {@link downloadBackupArchive} writes entries through,
|
|
20
|
+
* supplied by the caller so this package doesn't depend on a zip
|
|
21
|
+
* implementation. zip.js's `ZipWriter` satisfies it structurally, so
|
|
22
|
+
* `new ZipWriter(sink, { zip64: true, signal })` works without an adapter.
|
|
23
|
+
*
|
|
24
|
+
* Implementations must handle archives past 4GB — for zip that means zip64,
|
|
25
|
+
* without which the central-directory offsets wrap and the archive is
|
|
26
|
+
* silently unreadable.
|
|
27
|
+
*/
|
|
28
|
+
export type BackupArchiveWriter = {
|
|
29
|
+
add(name: string, input: ReadableStream<Uint8Array>, opts: {
|
|
30
|
+
lastModDate: Date;
|
|
31
|
+
}): Promise<unknown>;
|
|
32
|
+
close(): Promise<unknown>;
|
|
33
|
+
};
|
|
34
|
+
export type DownloadBackupArchiveOpts = {
|
|
35
|
+
backup: AppBackup;
|
|
36
|
+
/**
|
|
37
|
+
* Fetches a presigned URL, resolving with the response body and rejecting
|
|
38
|
+
* on a non-200 status. Put the status in the message (e.g. `HTTP 403`) —
|
|
39
|
+
* it's surfaced to the user alongside the failing entry's name. The entity
|
|
40
|
+
* files are served with `Content-Encoding: zstd`; browser fetch decodes
|
|
41
|
+
* that transparently, other runtimes must decompress explicitly.
|
|
42
|
+
*/
|
|
43
|
+
fetchBody: (url: string, signal: AbortSignal) => Promise<ReadableStream<Uint8Array>>;
|
|
44
|
+
/**
|
|
45
|
+
* Where the archive's bytes go. Closed after the last entry is written;
|
|
46
|
+
* aborted when the download fails or is cancelled, so the caller can
|
|
47
|
+
* discard partial output.
|
|
48
|
+
*/
|
|
49
|
+
sink: WritableStream<Uint8Array>;
|
|
50
|
+
/**
|
|
51
|
+
* Builds the archive encoder over a sink that already counts progress and
|
|
52
|
+
* carries the caller's sink's backpressure.
|
|
53
|
+
*/
|
|
54
|
+
createWriter: (sink: WritableStream<Uint8Array>, signal: AbortSignal) => Promise<BackupArchiveWriter>;
|
|
55
|
+
signal?: AbortSignal;
|
|
56
|
+
onProgress?: (progress: BackupDownloadProgress) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Retry policy for *opening* an entry's body (fetching its presigned URL and
|
|
59
|
+
* getting a live response).
|
|
60
|
+
* `attempts` is the total number of tries (default {@link DEFAULT_FETCH_ATTEMPTS});
|
|
61
|
+
* `delayMs` is the base for exponential backoff (default {@link DEFAULT_RETRY_DELAY_MS}).
|
|
62
|
+
*
|
|
63
|
+
* This only covers failures before the writer starts consuming the body.
|
|
64
|
+
* Once bytes have been written into the archive entry there's no way to
|
|
65
|
+
* restart it without HTTP range/resume support, so a mid-stream failure
|
|
66
|
+
* still fails the download.
|
|
67
|
+
*/
|
|
68
|
+
retry?: {
|
|
69
|
+
attempts?: number;
|
|
70
|
+
delayMs?: number;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
/**
|
|
74
|
+
* Downloads a backup into a single archive written to `opts.sink`: entries
|
|
75
|
+
* in the canonical restore order (`config.json`, then the
|
|
76
|
+
* `entities/<etype>.jsonl` shards, then `files/<locationId>` storage blobs —
|
|
77
|
+
* all entity files before any storage file), with the encoder writing
|
|
78
|
+
* through a counting sink that awaits the caller's sink, so a fast source
|
|
79
|
+
* can't outrun it and balloon memory.
|
|
80
|
+
*
|
|
81
|
+
* The runtime-specific pieces are injected: how to fetch a presigned URL
|
|
82
|
+
* (`fetchBody`), where the bytes go (`sink`), and the archive encoder
|
|
83
|
+
* (`createWriter`). Most callers reach this via
|
|
84
|
+
* {@link BackupsManager.downloadArchive}.
|
|
85
|
+
*/
|
|
86
|
+
export declare function downloadBackupArchive(opts: DownloadBackupArchiveOpts & {
|
|
87
|
+
manager: Pick<BackupsManager, 'listFiles' | 'getFileUrl' | 'streamStorageFiles'>;
|
|
88
|
+
}): Promise<BackupDownloadResult>;
|
|
89
|
+
//# sourceMappingURL=backupDownload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"backupDownload.d.ts","sourceRoot":"","sources":["../../src/backupDownload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAET,cAAc,EACf,MAAM,cAAc,CAAC;AAEtB,MAAM,MAAM,sBAAsB,GAAG;IACnC,i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I,CAAC;IACxD;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE;QAAE,QAAQ,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;CACjD,CAAC;AAiIF;;;;;;;;;;;;GAYG;AACH,wBAAsB,qBAAqB,CACzC,IAAI,EAAE,yBAAyB,GAAG;IAChC,OAAO,EAAE,IAAI,CACX,cAAc,EACd,WAAW,GAAG,YAAY,GAAG,oBAAoB,CAClD,CAAC;CACH,GACA,OAAO,CAAC,oBAAoB,CAAC,CAuR/B"}
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.downloadBackupArchive = downloadBackupArchive;
|
|
4
|
+
const DEFAULT_FETCH_ATTEMPTS = 3;
|
|
5
|
+
const DEFAULT_RETRY_DELAY_MS = 500;
|
|
6
|
+
const MAX_RETRY_DELAY_MS = 5000;
|
|
7
|
+
// Normalize caller-supplied numeric options so NaN/Infinity/non-integers can't
|
|
8
|
+
// alter retry counts or pipeline bounds — fall back to the default instead.
|
|
9
|
+
const finitePositiveInt = (v, fallback) => v != null && Number.isInteger(v) && v > 0 ? v : fallback;
|
|
10
|
+
const finiteNonNegative = (v, fallback) => v != null && Number.isFinite(v) && v >= 0 ? v : fallback;
|
|
11
|
+
const isAbortError = (e) => e?.name === 'AbortError';
|
|
12
|
+
const errorMessage = (e) => e instanceof Error ? e.message : String(e);
|
|
13
|
+
// A cancellable sleep: resolves after `ms`, or rejects if the signal aborts
|
|
14
|
+
// first so backoff between retries doesn't outlive a cancelled download.
|
|
15
|
+
const delay = (ms, signal) => new Promise((resolve, reject) => {
|
|
16
|
+
const onAbort = () => {
|
|
17
|
+
clearTimeout(timer);
|
|
18
|
+
reject(signal.reason ?? new DOMException('Aborted', 'AbortError'));
|
|
19
|
+
};
|
|
20
|
+
const timer = setTimeout(() => {
|
|
21
|
+
signal.removeEventListener('abort', onAbort);
|
|
22
|
+
resolve();
|
|
23
|
+
}, ms);
|
|
24
|
+
signal.addEventListener('abort', onAbort, { once: true });
|
|
25
|
+
});
|
|
26
|
+
// Re-emits an already-read first chunk, then streams the rest from `reader`.
|
|
27
|
+
// Past that first chunk read errors propagate to the consumer unchanged — by
|
|
28
|
+
// then bytes are in the archive entry and it can't be restarted.
|
|
29
|
+
function replayFrom(first, reader) {
|
|
30
|
+
let replayed = false;
|
|
31
|
+
return new ReadableStream({
|
|
32
|
+
async pull(controller) {
|
|
33
|
+
if (!replayed) {
|
|
34
|
+
replayed = true;
|
|
35
|
+
if (first.done) {
|
|
36
|
+
controller.close();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
controller.enqueue(first.value);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const { done, value } = await reader.read();
|
|
43
|
+
if (done)
|
|
44
|
+
controller.close();
|
|
45
|
+
else
|
|
46
|
+
controller.enqueue(value);
|
|
47
|
+
},
|
|
48
|
+
async cancel(reason) {
|
|
49
|
+
await reader.cancel(reason);
|
|
50
|
+
},
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Opens a body via `open`, retrying on transient failure with abortable
|
|
55
|
+
* exponential backoff. `open` is re-invoked from scratch each attempt, so an
|
|
56
|
+
* entity file re-mints its presigned URL. An abort propagates immediately; any
|
|
57
|
+
* other final failure is wrapped by `describe` into a user-facing message
|
|
58
|
+
* naming the entry.
|
|
59
|
+
*
|
|
60
|
+
* The first chunk is read inside the retry scope, so a body that connects but
|
|
61
|
+
* fails on its first read is re-fetched too, since nothing has been written
|
|
62
|
+
* to the archive yet. Only failures once bytes are flowing are treated as
|
|
63
|
+
* unrecoverable.
|
|
64
|
+
*/
|
|
65
|
+
async function openWithRetry(open, opts) {
|
|
66
|
+
let lastError;
|
|
67
|
+
for (let attempt = 1; attempt <= opts.attempts; attempt++) {
|
|
68
|
+
opts.signal.throwIfAborted();
|
|
69
|
+
let reader;
|
|
70
|
+
try {
|
|
71
|
+
const body = await open();
|
|
72
|
+
reader = body.getReader();
|
|
73
|
+
const first = await reader.read();
|
|
74
|
+
return replayFrom(first, reader);
|
|
75
|
+
}
|
|
76
|
+
catch (e) {
|
|
77
|
+
// Release the failed connection before retrying (or giving up).
|
|
78
|
+
if (reader)
|
|
79
|
+
reader.cancel().catch(() => { });
|
|
80
|
+
if (isAbortError(e))
|
|
81
|
+
throw e;
|
|
82
|
+
lastError = e;
|
|
83
|
+
if (attempt < opts.attempts) {
|
|
84
|
+
const backoff = Math.min(opts.delayMs * 2 ** (attempt - 1), MAX_RETRY_DELAY_MS);
|
|
85
|
+
await delay(backoff, opts.signal);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
throw new Error(opts.describe(lastError));
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Downloads a backup into a single archive written to `opts.sink`: entries
|
|
93
|
+
* in the canonical restore order (`config.json`, then the
|
|
94
|
+
* `entities/<etype>.jsonl` shards, then `files/<locationId>` storage blobs —
|
|
95
|
+
* all entity files before any storage file), with the encoder writing
|
|
96
|
+
* through a counting sink that awaits the caller's sink, so a fast source
|
|
97
|
+
* can't outrun it and balloon memory.
|
|
98
|
+
*
|
|
99
|
+
* The runtime-specific pieces are injected: how to fetch a presigned URL
|
|
100
|
+
* (`fetchBody`), where the bytes go (`sink`), and the archive encoder
|
|
101
|
+
* (`createWriter`). Most callers reach this via
|
|
102
|
+
* {@link BackupsManager.downloadArchive}.
|
|
103
|
+
*/
|
|
104
|
+
async function downloadBackupArchive(opts) {
|
|
105
|
+
const { manager, backup, fetchBody, createWriter, onProgress } = opts;
|
|
106
|
+
// Internal controller so a pipeline failure also tears down the
|
|
107
|
+
// storage-files discovery stream and any in-flight body fetches.
|
|
108
|
+
const abortController = new AbortController();
|
|
109
|
+
if (opts.signal?.aborted) {
|
|
110
|
+
abortController.abort();
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
opts.signal?.addEventListener('abort', () => abortController.abort(), {
|
|
114
|
+
once: true,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
const signal = abortController.signal;
|
|
118
|
+
let entitiesCompleted = 0;
|
|
119
|
+
let entitiesTotal = null;
|
|
120
|
+
let filesCompleted = 0;
|
|
121
|
+
let filesTotal = null;
|
|
122
|
+
let zipBytes = 0;
|
|
123
|
+
let bytesRead = 0;
|
|
124
|
+
let currentEntity = '';
|
|
125
|
+
let currentFile = '';
|
|
126
|
+
const bytesTotal = backup.uncompressedSize != null
|
|
127
|
+
? backup.uncompressedSize + (backup.filesSize ?? 0)
|
|
128
|
+
: null;
|
|
129
|
+
const retryAttempts = finitePositiveInt(opts.retry?.attempts, DEFAULT_FETCH_ATTEMPTS);
|
|
130
|
+
const retryDelayMs = finiteNonNegative(opts.retry?.delayMs, DEFAULT_RETRY_DELAY_MS);
|
|
131
|
+
const tick = () => onProgress?.({
|
|
132
|
+
entitiesCompleted,
|
|
133
|
+
entitiesTotal,
|
|
134
|
+
filesCompleted,
|
|
135
|
+
filesTotal,
|
|
136
|
+
zipBytes,
|
|
137
|
+
bytesRead,
|
|
138
|
+
bytesTotal,
|
|
139
|
+
currentEntity,
|
|
140
|
+
currentFile,
|
|
141
|
+
});
|
|
142
|
+
// Throttle by time: a large backup pushes many small chunks and ticking on
|
|
143
|
+
// every one is wasted work. Phase changes tick() directly so they're still
|
|
144
|
+
// immediate.
|
|
145
|
+
const TICK_INTERVAL_MS = 100;
|
|
146
|
+
let lastTickAt = 0;
|
|
147
|
+
const throttledTick = () => {
|
|
148
|
+
const now = Date.now();
|
|
149
|
+
if (now - lastTickAt >= TICK_INTERVAL_MS) {
|
|
150
|
+
lastTickAt = now;
|
|
151
|
+
tick();
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
// Count the uncompressed bytes of a source body for progress as it streams
|
|
155
|
+
// into the archive.
|
|
156
|
+
const countBytes = (body) => body.pipeThrough(new TransformStream({
|
|
157
|
+
transform(chunk, controller) {
|
|
158
|
+
bytesRead += chunk.byteLength;
|
|
159
|
+
throttledTick();
|
|
160
|
+
controller.enqueue(chunk);
|
|
161
|
+
},
|
|
162
|
+
}));
|
|
163
|
+
// Storage-files discovery runs concurrently with the entity phase and is
|
|
164
|
+
// drained eagerly into a queue. That isn't just overlap: it closes the
|
|
165
|
+
// NDJSON connection quickly instead of holding it open (and at the mercy of
|
|
166
|
+
// idle timeouts) while multi-GB blobs download. `queueHead` walks the array
|
|
167
|
+
// in place, freeing each slot as it's consumed.
|
|
168
|
+
const queue = [];
|
|
169
|
+
let queueHead = 0;
|
|
170
|
+
let storageDone = false;
|
|
171
|
+
let storageError = null;
|
|
172
|
+
let waitResolve = null;
|
|
173
|
+
const notify = () => {
|
|
174
|
+
const w = waitResolve;
|
|
175
|
+
waitResolve = null;
|
|
176
|
+
w?.();
|
|
177
|
+
};
|
|
178
|
+
// Never rejects: failures land in storageError for the drain loop to throw.
|
|
179
|
+
const discovery = (async () => {
|
|
180
|
+
let discoveryComplete = false;
|
|
181
|
+
try {
|
|
182
|
+
for await (const file of manager.streamStorageFiles(backup.id, {
|
|
183
|
+
signal,
|
|
184
|
+
})) {
|
|
185
|
+
queue.push(file);
|
|
186
|
+
filesTotal = (filesTotal ?? 0) + 1;
|
|
187
|
+
throttledTick();
|
|
188
|
+
notify();
|
|
189
|
+
}
|
|
190
|
+
discoveryComplete = true;
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
// The abort path is expected when the pipeline failed and we tore the
|
|
194
|
+
// discovery down.
|
|
195
|
+
if (!isAbortError(e)) {
|
|
196
|
+
storageError = e;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
finally {
|
|
200
|
+
// A failed listing keeps the total unknown rather than reading as an
|
|
201
|
+
// empty-but-complete storage phase.
|
|
202
|
+
if (discoveryComplete && filesTotal == null)
|
|
203
|
+
filesTotal = 0;
|
|
204
|
+
storageDone = true;
|
|
205
|
+
tick();
|
|
206
|
+
notify();
|
|
207
|
+
}
|
|
208
|
+
})();
|
|
209
|
+
// Entry write order is significant for restore: config.json first, then the
|
|
210
|
+
// entities/*.jsonl shards, then files/<locationId>. In particular ALL entity
|
|
211
|
+
// files must be written before ANY storage file. listFiles returns the
|
|
212
|
+
// entity files in write order; this generator yields thunks for them in
|
|
213
|
+
// order, then drains the storage queue. The consumer calls each thunk in turn
|
|
214
|
+
// and writes it to completion before the next, so bodies download one at a
|
|
215
|
+
// time and never ahead of the encoder.
|
|
216
|
+
const thunks = (async function* () {
|
|
217
|
+
const files = await manager.listFiles(backup.id, { signal });
|
|
218
|
+
if (files.length === 0) {
|
|
219
|
+
throw new Error('No files found for this backup.');
|
|
220
|
+
}
|
|
221
|
+
// We write entries in the order the server returns them, and restore
|
|
222
|
+
// requires config.json to be the first entry. Fail loudly rather than
|
|
223
|
+
// build a zip that can't be restored.
|
|
224
|
+
if (files[0].name !== 'config.json') {
|
|
225
|
+
throw new Error(`Backup files came back in an unexpected order (expected config.json first, got "${files[0].name}").`);
|
|
226
|
+
}
|
|
227
|
+
// config.json isn't a namespace — count only the entities/*.jsonl shards.
|
|
228
|
+
entitiesTotal = files.filter((f) => f.name !== 'config.json').length;
|
|
229
|
+
tick();
|
|
230
|
+
for (const f of files) {
|
|
231
|
+
yield async () => {
|
|
232
|
+
const body = await openWithRetry(async () => {
|
|
233
|
+
const url = await manager.getFileUrl(backup.id, f.name, { signal });
|
|
234
|
+
return fetchBody(url, signal);
|
|
235
|
+
}, {
|
|
236
|
+
signal,
|
|
237
|
+
attempts: retryAttempts,
|
|
238
|
+
delayMs: retryDelayMs,
|
|
239
|
+
describe: (e) => `Failed to fetch ${f.name}: ${errorMessage(e)}.`,
|
|
240
|
+
});
|
|
241
|
+
return {
|
|
242
|
+
name: f.name,
|
|
243
|
+
input: countBytes(body),
|
|
244
|
+
onWriting: () => {
|
|
245
|
+
currentEntity = f.name;
|
|
246
|
+
currentFile = '';
|
|
247
|
+
tick();
|
|
248
|
+
},
|
|
249
|
+
onAdded: () => {
|
|
250
|
+
if (f.name !== 'config.json')
|
|
251
|
+
entitiesCompleted++;
|
|
252
|
+
tick();
|
|
253
|
+
},
|
|
254
|
+
};
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
while (true) {
|
|
258
|
+
if (storageError)
|
|
259
|
+
throw storageError;
|
|
260
|
+
// A caller abort while no fetch is in flight surfaces only in the
|
|
261
|
+
// discovery stream, which swallows it as expected teardown — check
|
|
262
|
+
// explicitly so a cancellation can't read as a complete storage phase
|
|
263
|
+
// with files still undiscovered.
|
|
264
|
+
signal.throwIfAborted();
|
|
265
|
+
let file;
|
|
266
|
+
if (queueHead < queue.length) {
|
|
267
|
+
file = queue[queueHead];
|
|
268
|
+
queue[queueHead] = undefined;
|
|
269
|
+
queueHead++;
|
|
270
|
+
}
|
|
271
|
+
if (file) {
|
|
272
|
+
const storageFile = file;
|
|
273
|
+
const label = storageFile.path || storageFile.locationId;
|
|
274
|
+
yield async () => {
|
|
275
|
+
const body = await openWithRetry(() => fetchBody(storageFile.url, signal), {
|
|
276
|
+
signal,
|
|
277
|
+
attempts: retryAttempts,
|
|
278
|
+
delayMs: retryDelayMs,
|
|
279
|
+
describe: (e) => `Couldn't download storage file "${label}" (${errorMessage(e)}).`,
|
|
280
|
+
});
|
|
281
|
+
return {
|
|
282
|
+
name: `files/${storageFile.locationId}`,
|
|
283
|
+
input: countBytes(body),
|
|
284
|
+
onWriting: () => {
|
|
285
|
+
currentEntity = '';
|
|
286
|
+
currentFile = label;
|
|
287
|
+
tick();
|
|
288
|
+
},
|
|
289
|
+
onAdded: () => {
|
|
290
|
+
filesCompleted++;
|
|
291
|
+
tick();
|
|
292
|
+
},
|
|
293
|
+
};
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
else if (storageDone) {
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
await new Promise((resolve) => {
|
|
301
|
+
waitResolve = resolve;
|
|
302
|
+
});
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
if (storageError)
|
|
306
|
+
throw storageError;
|
|
307
|
+
})();
|
|
308
|
+
const sinkWriter = opts.sink.getWriter();
|
|
309
|
+
try {
|
|
310
|
+
// Sink the archive encoder writes into: it tallies the encoded size for
|
|
311
|
+
// progress, then forwards to the caller's sink. Awaiting the downstream
|
|
312
|
+
// write propagates backpressure up into the encoder, so a fast source
|
|
313
|
+
// can't outrun the sink and balloon memory.
|
|
314
|
+
const countingSink = new WritableStream({
|
|
315
|
+
async write(chunk) {
|
|
316
|
+
zipBytes += chunk.byteLength;
|
|
317
|
+
throttledTick();
|
|
318
|
+
await sinkWriter.write(chunk);
|
|
319
|
+
},
|
|
320
|
+
async close() {
|
|
321
|
+
await sinkWriter.close();
|
|
322
|
+
tick();
|
|
323
|
+
},
|
|
324
|
+
async abort(reason) {
|
|
325
|
+
await sinkWriter.abort(reason);
|
|
326
|
+
},
|
|
327
|
+
});
|
|
328
|
+
const writer = await createWriter(countingSink, signal);
|
|
329
|
+
for await (const thunk of thunks) {
|
|
330
|
+
const entry = await thunk();
|
|
331
|
+
entry.onWriting();
|
|
332
|
+
await writer.add(entry.name, entry.input, {
|
|
333
|
+
lastModDate: backup.backupAt,
|
|
334
|
+
});
|
|
335
|
+
entry.onAdded();
|
|
336
|
+
}
|
|
337
|
+
currentEntity = '';
|
|
338
|
+
currentFile = '';
|
|
339
|
+
tick();
|
|
340
|
+
// A caller abort that lands after the last entry lets the generator
|
|
341
|
+
// finish cleanly; don't close and return a complete-looking archive.
|
|
342
|
+
signal.throwIfAborted();
|
|
343
|
+
await writer.close();
|
|
344
|
+
await discovery;
|
|
345
|
+
tick();
|
|
346
|
+
return { entities: entitiesCompleted, files: filesCompleted, zipBytes };
|
|
347
|
+
}
|
|
348
|
+
catch (e) {
|
|
349
|
+
// Tear down the discovery stream and any in-flight body fetches so we
|
|
350
|
+
// don't keep pulling from S3, and abort the caller's sink so it can
|
|
351
|
+
// discard whatever it wrote.
|
|
352
|
+
abortController.abort();
|
|
353
|
+
await sinkWriter.abort(e).catch(() => { });
|
|
354
|
+
throw e;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
//# sourceMappingURL=backupDownload.js.map
|