@noodleseed/one 0.83.0 → 0.84.1
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/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/author-loop.d.ts.map +1 -1
- package/dist/commands/author-loop.js +7 -7
- package/dist/commands/author-loop.js.map +1 -1
- package/dist/commands/catalog-data-platform-auth.d.ts.map +1 -1
- package/dist/commands/catalog-data-platform-auth.js +70 -2
- package/dist/commands/catalog-data-platform-auth.js.map +1 -1
- package/dist/commands/platform-account-reset-args.d.ts +40 -0
- package/dist/commands/platform-account-reset-args.d.ts.map +1 -0
- package/dist/commands/platform-account-reset-args.js +181 -0
- package/dist/commands/platform-account-reset-args.js.map +1 -0
- package/dist/commands/platform-account-reset-files.d.ts +9 -0
- package/dist/commands/platform-account-reset-files.d.ts.map +1 -0
- package/dist/commands/platform-account-reset-files.js +45 -0
- package/dist/commands/platform-account-reset-files.js.map +1 -0
- package/dist/commands/platform-account-reset-ops.d.ts +3 -0
- package/dist/commands/platform-account-reset-ops.d.ts.map +1 -0
- package/dist/commands/platform-account-reset-ops.js +162 -0
- package/dist/commands/platform-account-reset-ops.js.map +1 -0
- package/dist/plugin-mode/build-readiness-recorder.d.ts.map +1 -1
- package/dist/plugin-mode/build-readiness-recorder.js +3 -1
- package/dist/plugin-mode/build-readiness-recorder.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js +3 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-authoring-refs.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js +2 -2
- package/node_modules/@noodle-borg/agent-kit/dist/skill-operations-refs.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/enforcement-activation.d.ts +4 -4
- package/node_modules/@noodle-borg/service/dist/billing/read-contract.d.ts +6 -6
- package/node_modules/@noodle-borg/service/dist/index.d.ts +4 -1
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +2 -0
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/main.js +5 -0
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.js +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js +17 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +2 -2
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +25 -5
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +5 -3
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.js +5 -5
- package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js +7 -2
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js +6 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/options.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.d.ts +9 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.js +24 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.d.ts +12 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.js +110 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.d.ts +9 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.js +46 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.d.ts +77 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.js +144 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.js +59 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.js +22 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.js +314 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.d.ts +14 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.js +210 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.js +71 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.d.ts +12 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.js +2 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.js +177 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.d.ts +35 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.js +184 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.js +120 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.d.ts +79 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.js +286 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.d.ts +21 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.js +81 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.d.ts +46 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.js +283 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.js +81 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.d.ts +30 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.js +248 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.js +281 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.d.ts +55 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.js +262 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.d.ts +7 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.js +439 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.d.ts +276 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.js +141 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js +5 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js +10 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts +5 -10
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js +86 -47
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.js +240 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts +63 -63
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts +18 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js +97 -2
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts +4 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js +4 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts +7 -2
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js +24 -2
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js +4 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts +7 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js +121 -8
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js +11 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts +5 -3
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js +15 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts +23 -2
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity.js +21 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-state.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/registry-state.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-state.js +15 -2
- package/node_modules/@noodle-borg/service/dist/registry-state.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/registry.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry.js +4 -1
- package/node_modules/@noodle-borg/service/dist/registry.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.js +201 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +2 -1
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.js +16 -1
- package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +4 -5
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts +22 -3
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/workos-directory.js +56 -5
- package/node_modules/@noodle-borg/service/dist/workos-directory.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { canonicalJson, sha256Canonical } from './platform-account-reset-fingerprint.js';
|
|
2
|
+
import { PlatformAccountResetPreviewError, } from './platform-account-reset-preview-result.js';
|
|
3
|
+
export async function persistPlatformAccountResetPreview(connection, inspection, options) {
|
|
4
|
+
const result = inspection.result;
|
|
5
|
+
if (result.blockers.length !== 0)
|
|
6
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
7
|
+
await connection.query(`INSERT INTO platform_account_reset_operations
|
|
8
|
+
(operation_id, lifecycle, release_sha, rollout_generation, workos_realm,
|
|
9
|
+
source_epoch, preview_checksum, target_set_fingerprint, request_fingerprint,
|
|
10
|
+
approved_target_set_fingerprint, actor_fingerprint, safe_result,
|
|
11
|
+
preview_expires_at, created_at, updated_at)
|
|
12
|
+
VALUES ($1, 'previewed', $2, $3, $4, $5, $6, $7, $8, $9, $10, $11::jsonb,
|
|
13
|
+
$12, $13, $13)`, [
|
|
14
|
+
result.operationId,
|
|
15
|
+
result.releaseSha,
|
|
16
|
+
result.rolloutGeneration,
|
|
17
|
+
options.workosRealm,
|
|
18
|
+
result.sourceEpoch,
|
|
19
|
+
result.previewChecksum,
|
|
20
|
+
result.targetSetFingerprint,
|
|
21
|
+
result.requestFingerprint,
|
|
22
|
+
options.approvedTargetSetFingerprint,
|
|
23
|
+
options.actorFingerprint,
|
|
24
|
+
JSON.stringify(inspection.safeResult),
|
|
25
|
+
options.previewExpiresAt,
|
|
26
|
+
options.createdAt,
|
|
27
|
+
]);
|
|
28
|
+
for (const [principalId, sourceSnapshotFingerprint] of inspection.targetSnapshots) {
|
|
29
|
+
await connection.query(`INSERT INTO platform_account_reset_targets
|
|
30
|
+
(operation_id, principal_id, target_fingerprint,
|
|
31
|
+
source_snapshot_fingerprint, lifecycle)
|
|
32
|
+
VALUES ($1, $2, $3, $4, 'previewed')`, [
|
|
33
|
+
result.operationId,
|
|
34
|
+
principalId,
|
|
35
|
+
sha256Canonical({ schemaVersion: 1, principalId }),
|
|
36
|
+
sourceSnapshotFingerprint,
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
for (const resource of inspection.cleanupResources) {
|
|
40
|
+
await connection.query(`INSERT INTO platform_account_reset_cleanup_ledger
|
|
41
|
+
(operation_id, provider, resource_kind, provider_locator,
|
|
42
|
+
locator_fingerprint, state, created_at, updated_at)
|
|
43
|
+
VALUES ($1, $2, $3, $4, $5, 'pending', $6, $6)`, [
|
|
44
|
+
result.operationId,
|
|
45
|
+
resource.provider,
|
|
46
|
+
resource.resourceKind,
|
|
47
|
+
canonicalJson(resource.locator),
|
|
48
|
+
resource.locatorFingerprint,
|
|
49
|
+
options.createdAt,
|
|
50
|
+
]);
|
|
51
|
+
}
|
|
52
|
+
const eventFingerprint = sha256Canonical({
|
|
53
|
+
schemaVersion: 1,
|
|
54
|
+
label: 'platform_account_reset_event:previewed',
|
|
55
|
+
operationId: result.operationId,
|
|
56
|
+
previewChecksum: result.previewChecksum,
|
|
57
|
+
targetSetFingerprint: result.targetSetFingerprint,
|
|
58
|
+
targetCount: result.counts.targetCount,
|
|
59
|
+
resourceCount: inspection.cleanupResources.length,
|
|
60
|
+
blockerCount: 0,
|
|
61
|
+
});
|
|
62
|
+
await connection.query(`INSERT INTO platform_account_reset_events
|
|
63
|
+
(operation_id, event_type, target_set_fingerprint, event_fingerprint,
|
|
64
|
+
target_count, resource_count, blocker_count, created_at)
|
|
65
|
+
VALUES ($1, 'previewed', $2, $3, $4, $5, 0, $6)`, [
|
|
66
|
+
result.operationId,
|
|
67
|
+
result.targetSetFingerprint,
|
|
68
|
+
eventFingerprint,
|
|
69
|
+
result.counts.targetCount,
|
|
70
|
+
inspection.cleanupResources.length,
|
|
71
|
+
options.createdAt,
|
|
72
|
+
]);
|
|
73
|
+
}
|
|
74
|
+
export async function assertPlatformAccountResetCleanupEvidence(connection, operationId, inspection) {
|
|
75
|
+
const ledger = await connection.query(`SELECT provider, resource_kind, provider_locator, locator_fingerprint
|
|
76
|
+
FROM platform_account_reset_cleanup_ledger
|
|
77
|
+
WHERE operation_id = $1
|
|
78
|
+
ORDER BY provider, resource_kind, locator_fingerprint
|
|
79
|
+
FOR SHARE`, [operationId]);
|
|
80
|
+
const storedResources = [];
|
|
81
|
+
for (const row of ledger.rows) {
|
|
82
|
+
let locator;
|
|
83
|
+
try {
|
|
84
|
+
locator = JSON.parse(row.provider_locator);
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
88
|
+
}
|
|
89
|
+
if (!isCleanupProvider(row.provider) || !isRecord(locator))
|
|
90
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
91
|
+
const fingerprint = sha256Canonical({
|
|
92
|
+
schemaVersion: 1,
|
|
93
|
+
label: `platform_account_reset_locator:${row.provider}:${row.resource_kind}`,
|
|
94
|
+
locator,
|
|
95
|
+
});
|
|
96
|
+
if (fingerprint !== row.locator_fingerprint)
|
|
97
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
98
|
+
storedResources.push({
|
|
99
|
+
provider: row.provider,
|
|
100
|
+
resourceKind: row.resource_kind,
|
|
101
|
+
locator,
|
|
102
|
+
locatorFingerprint: row.locator_fingerprint,
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
const storedFingerprint = sha256Canonical({
|
|
106
|
+
schemaVersion: 1,
|
|
107
|
+
label: 'platform_account_reset_cleanup_set',
|
|
108
|
+
resources: storedResources,
|
|
109
|
+
});
|
|
110
|
+
if (storedFingerprint !== inspection.cleanupSetFingerprint ||
|
|
111
|
+
canonicalJson(storedResources) !== canonicalJson(inspection.cleanupResources))
|
|
112
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
113
|
+
}
|
|
114
|
+
function isCleanupProvider(value) {
|
|
115
|
+
return ['postgres', 'object_storage', 'github', 'stripe', 'workos'].includes(value);
|
|
116
|
+
}
|
|
117
|
+
function isRecord(value) {
|
|
118
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=platform-account-reset-preview-persistence-postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-preview-persistence-postgres.js","sourceRoot":"","sources":["../src/platform-account-reset-preview-persistence-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAEzF,OAAO,EAEL,gCAAgC,GACjC,MAAM,4CAA4C,CAAC;AAGpD,MAAM,CAAC,KAAK,UAAU,kCAAkC,CACtD,UAAqC,EACrC,UAAgD,EAChD,OAMC;IAED,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IACjC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;QAC9B,MAAM,IAAI,gCAAgC,CAAC,oBAAoB,CAAC,CAAC;IACnE,MAAM,UAAU,CAAC,KAAK,CACpB;;;;;;4BAMwB,EACxB;QACE,MAAM,CAAC,WAAW;QAClB,MAAM,CAAC,UAAU;QACjB,MAAM,CAAC,iBAAiB;QACxB,OAAO,CAAC,WAAW;QACnB,MAAM,CAAC,WAAW;QAClB,MAAM,CAAC,eAAe;QACtB,MAAM,CAAC,oBAAoB;QAC3B,MAAM,CAAC,kBAAkB;QACzB,OAAO,CAAC,4BAA4B;QACpC,OAAO,CAAC,gBAAgB;QACxB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,UAAU,CAAC;QACrC,OAAO,CAAC,gBAAgB;QACxB,OAAO,CAAC,SAAS;KAClB,CACF,CAAC;IACF,KAAK,MAAM,CAAC,WAAW,EAAE,yBAAyB,CAAC,IAAI,UAAU,CAAC,eAAe,EAAE,CAAC;QAClF,MAAM,UAAU,CAAC,KAAK,CACpB;;;4CAGsC,EACtC;YACE,MAAM,CAAC,WAAW;YAClB,WAAW;YACX,eAAe,CAAC,EAAE,aAAa,EAAE,CAAC,EAAE,WAAW,EAAE,CAAC;YAClD,yBAAyB;SAC1B,CACF,CAAC;IACJ,CAAC;IACD,KAAK,MAAM,QAAQ,IAAI,UAAU,CAAC,gBAAgB,EAAE,CAAC;QACnD,MAA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AAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { type PlatformAccountResetPreviewRequest } from './platform-account-reset.js';
|
|
2
|
+
import { type PlatformAccountResetWorkosEvidence } from './platform-account-reset-preview-evidence-postgres.js';
|
|
3
|
+
import { type PlatformAccountResetLocalInspection } from './platform-account-reset-preview-local-postgres.js';
|
|
4
|
+
import { type PlatformAccountResetPreviewResult } from './platform-account-reset-preview-result.js';
|
|
5
|
+
import type { PlatformAuthInventorySourceManifest } from './platform-auth-inventory-sources.js';
|
|
6
|
+
import type { PlatformIdentityQueryable } from './platform-identity-postgres.js';
|
|
7
|
+
import type { PlatformAccountResetDirectory } from './workos-directory.js';
|
|
8
|
+
export { PlatformAccountResetPreviewError, type PlatformAccountResetPreviewResult, } from './platform-account-reset-preview-result.js';
|
|
9
|
+
type PreviewConnection = PlatformIdentityQueryable & {
|
|
10
|
+
release?: () => void;
|
|
11
|
+
};
|
|
12
|
+
type PreviewPool = PlatformIdentityQueryable & {
|
|
13
|
+
connect?: () => Promise<PreviewConnection>;
|
|
14
|
+
};
|
|
15
|
+
export interface PlatformAccountResetPreviewEvidence {
|
|
16
|
+
readonly operationId: string;
|
|
17
|
+
readonly releaseSha: string;
|
|
18
|
+
readonly expectedGeneration: number;
|
|
19
|
+
readonly previewChecksum: string | null;
|
|
20
|
+
}
|
|
21
|
+
interface PreviewOptions {
|
|
22
|
+
readonly directory: PlatformAccountResetDirectory;
|
|
23
|
+
readonly sourceAvailability: PlatformAuthInventorySourceManifest;
|
|
24
|
+
readonly googleRealm: string;
|
|
25
|
+
readonly workosRealm: string;
|
|
26
|
+
readonly releaseSha: string;
|
|
27
|
+
readonly actorFingerprint: string;
|
|
28
|
+
readonly approvedTargetSetFingerprint: string;
|
|
29
|
+
readonly excludedSubjects: readonly {
|
|
30
|
+
readonly subject: string;
|
|
31
|
+
readonly kind: 'workload' | 'synthetic';
|
|
32
|
+
}[];
|
|
33
|
+
readonly now?: () => Date;
|
|
34
|
+
readonly operationId?: () => string;
|
|
35
|
+
readonly providerTimeoutMs?: number;
|
|
36
|
+
readonly localCaptureTimeoutMs?: number;
|
|
37
|
+
readonly previewTtlMs?: number;
|
|
38
|
+
}
|
|
39
|
+
interface StoredOperationRow {
|
|
40
|
+
readonly lifecycle: string;
|
|
41
|
+
readonly release_sha: string;
|
|
42
|
+
readonly rollout_generation: string;
|
|
43
|
+
readonly workos_realm: string;
|
|
44
|
+
readonly source_epoch: string;
|
|
45
|
+
readonly preview_checksum: string;
|
|
46
|
+
readonly target_set_fingerprint: string;
|
|
47
|
+
readonly request_fingerprint: string;
|
|
48
|
+
readonly safe_result: unknown;
|
|
49
|
+
readonly preview_expires_at: Date | string;
|
|
50
|
+
readonly created_at: Date | string;
|
|
51
|
+
}
|
|
52
|
+
interface StoredTargetRow {
|
|
53
|
+
readonly principal_id: string;
|
|
54
|
+
readonly source_snapshot_fingerprint: string;
|
|
55
|
+
}
|
|
56
|
+
interface StoredSnapshot {
|
|
57
|
+
readonly stored: StoredOperationRow;
|
|
58
|
+
readonly targetRows: readonly StoredTargetRow[];
|
|
59
|
+
readonly request: PlatformAccountResetPreviewRequest;
|
|
60
|
+
readonly previewExpiresAt: Date;
|
|
61
|
+
readonly fingerprint: string;
|
|
62
|
+
}
|
|
63
|
+
export interface PlatformAccountResetPreparedPreviewValidation extends StoredSnapshot {
|
|
64
|
+
readonly local: PlatformAccountResetLocalInspection;
|
|
65
|
+
readonly remote: PlatformAccountResetWorkosEvidence;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Release-A preview store. Local evidence is captured twice in short fenced transactions. WorkOS reads are
|
|
69
|
+
* bounded and happen between those transactions, with no database transaction or table lock held.
|
|
70
|
+
*/
|
|
71
|
+
export declare class PostgresPlatformAccountResetPreviewStore {
|
|
72
|
+
#private;
|
|
73
|
+
constructor(pool: PreviewPool, options: PreviewOptions);
|
|
74
|
+
preview(rawRequest: PlatformAccountResetPreviewRequest): Promise<PlatformAccountResetPreviewResult>;
|
|
75
|
+
assertUsable(evidence: PlatformAccountResetPreviewEvidence): Promise<PlatformAccountResetPreviewResult>;
|
|
76
|
+
prepareUsable(evidence: PlatformAccountResetPreviewEvidence, deadline?: number): Promise<PlatformAccountResetPreparedPreviewValidation>;
|
|
77
|
+
assertPrepared(connection: PlatformIdentityQueryable, evidence: PlatformAccountResetPreviewEvidence, prepared: PlatformAccountResetPreparedPreviewValidation): Promise<PlatformAccountResetPreviewResult>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=platform-account-reset-preview-postgres.d.ts.map
|
package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-preview-postgres.d.ts","sourceRoot":"","sources":["../src/platform-account-reset-preview-postgres.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,kCAAkC,EAGxC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,EAEL,KAAK,kCAAkC,EACxC,MAAM,uDAAuD,CAAC;AAC/D,OAAO,EAEL,KAAK,mCAAmC,EACzC,MAAM,oDAAoD,CAAC;AAK5D,OAAO,EAGL,KAAK,iCAAiC,EACvC,MAAM,4CAA4C,CAAC;AASpD,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAChG,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,uBAAuB,CAAC;AAE3E,OAAO,EACL,gCAAgC,EAChC,KAAK,iCAAiC,GACvC,MAAM,4CAA4C,CAAC;AAEpD,KAAK,iBAAiB,GAAG,yBAAyB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AAC9E,KAAK,WAAW,G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C,6CAA6C,CAAC;IAYnD,cAAc,CAClB,UAAU,EAAE,yBAAyB,EACrC,QAAQ,EAAE,mCAAmC,EAC7C,QAAQ,EAAE,6CAA6C,GACtD,OAAO,CAAC,iCAAiC,CAAC;CAkS9C"}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { PlatformAccountResetPreviewRequestSchema, PlatformAccountResetResultSchema, } from './platform-account-reset.js';
|
|
3
|
+
import { remainingPlatformAccountResetDispatchMilliseconds } from './platform-account-reset-dispatch-lock-postgres.js';
|
|
4
|
+
import { canonicalJson, sha256Canonical } from './platform-account-reset-fingerprint.js';
|
|
5
|
+
import { loadPlatformAccountResetWorkosEvidence, } from './platform-account-reset-preview-evidence-postgres.js';
|
|
6
|
+
import { inspectPlatformAccountResetLocalEvidence, } from './platform-account-reset-preview-local-postgres.js';
|
|
7
|
+
import { assertPlatformAccountResetCleanupEvidence, persistPlatformAccountResetPreview, } from './platform-account-reset-preview-persistence-postgres.js';
|
|
8
|
+
import { combinePlatformAccountResetEvidence, PlatformAccountResetPreviewError, } from './platform-account-reset-preview-result.js';
|
|
9
|
+
import { PostgresPlatformAuthLegacyInventorySources } from './platform-auth-inventory-legacy-sources-postgres.js';
|
|
10
|
+
import { assertPlatformAuthInventorySourceFence, lockPlatformAuthInventorySourceFenceTargets, PLATFORM_ACCOUNT_RESET_PREVIEW_TABLES, readPlatformAuthInventorySourceEpoch, runPlatformAuthInventorySourceFenceTransaction, } from './platform-auth-inventory-source-fence-postgres.js';
|
|
11
|
+
export { PlatformAccountResetPreviewError, } from './platform-account-reset-preview-result.js';
|
|
12
|
+
const PREVIEW_TTL_MS = 15 * 60 * 1000;
|
|
13
|
+
const DEFAULT_PROVIDER_TIMEOUT_MS = 5_000;
|
|
14
|
+
const DEFAULT_LOCAL_CAPTURE_TIMEOUT_MS = 5_000;
|
|
15
|
+
const MAX_LOCAL_CAPTURE_TIMEOUT_MS = 60_000;
|
|
16
|
+
const ASSERTION_TABLES = [
|
|
17
|
+
...PLATFORM_ACCOUNT_RESET_PREVIEW_TABLES,
|
|
18
|
+
'platform_account_reset_cleanup_ledger',
|
|
19
|
+
];
|
|
20
|
+
const EMPTY_REMOTE_EVIDENCE = {
|
|
21
|
+
resources: [],
|
|
22
|
+
providerUnavailableCount: 0,
|
|
23
|
+
conflictCount: 0,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Release-A preview store. Local evidence is captured twice in short fenced transactions. WorkOS reads are
|
|
27
|
+
* bounded and happen between those transactions, with no database transaction or table lock held.
|
|
28
|
+
*/
|
|
29
|
+
export class PostgresPlatformAccountResetPreviewStore {
|
|
30
|
+
#pool;
|
|
31
|
+
#options;
|
|
32
|
+
constructor(pool, options) {
|
|
33
|
+
this.#pool = pool;
|
|
34
|
+
this.#options = {
|
|
35
|
+
...options,
|
|
36
|
+
now: options.now ?? (() => new Date()),
|
|
37
|
+
operationId: options.operationId ?? (() => `reset-${randomUUID()}`),
|
|
38
|
+
providerTimeoutMs: validTimeout(options.providerTimeoutMs),
|
|
39
|
+
localCaptureTimeoutMs: validLocalCaptureTimeout(options.localCaptureTimeoutMs),
|
|
40
|
+
previewTtlMs: validPreviewTtl(options.previewTtlMs),
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
async preview(rawRequest) {
|
|
44
|
+
const request = PlatformAccountResetPreviewRequestSchema.parse(rawRequest);
|
|
45
|
+
const operationId = this.#options.operationId();
|
|
46
|
+
const first = await this.#captureLocal(request, operationId);
|
|
47
|
+
const previewExpiresAt = validTimestamp(first.previewExpiresAt);
|
|
48
|
+
if (first.local.blockers.length !== 0)
|
|
49
|
+
return combinePlatformAccountResetEvidence(first.local, EMPTY_REMOTE_EVIDENCE, previewExpiresAt).result;
|
|
50
|
+
const remote = await this.#readRemote(first.local);
|
|
51
|
+
return runPlatformAuthInventorySourceFenceTransaction(this.#pool, async (connection) => {
|
|
52
|
+
await this.#assertSourceFence(connection);
|
|
53
|
+
await lockPlatformAuthInventorySourceFenceTargets(connection, first.local.targets);
|
|
54
|
+
await this.#assertDatabaseDeadline(connection, first.previewExpiresAt);
|
|
55
|
+
const second = await this.#inspectLocal(connection, request, operationId);
|
|
56
|
+
this.#assertSameLocalEvidence(first.local, second);
|
|
57
|
+
const inspection = combinePlatformAccountResetEvidence(second, remote, previewExpiresAt);
|
|
58
|
+
if (inspection.result.blockers.length !== 0)
|
|
59
|
+
return inspection.result;
|
|
60
|
+
await persistPlatformAccountResetPreview(connection, inspection, {
|
|
61
|
+
actorFingerprint: this.#options.actorFingerprint,
|
|
62
|
+
approvedTargetSetFingerprint: this.#options.approvedTargetSetFingerprint,
|
|
63
|
+
workosRealm: this.#options.workosRealm,
|
|
64
|
+
createdAt: first.createdAt,
|
|
65
|
+
previewExpiresAt: first.previewExpiresAt,
|
|
66
|
+
});
|
|
67
|
+
await this.#assertDatabaseDeadline(connection, first.previewExpiresAt);
|
|
68
|
+
return inspection.result;
|
|
69
|
+
}, this.#transactionOptions(PLATFORM_ACCOUNT_RESET_PREVIEW_TABLES));
|
|
70
|
+
}
|
|
71
|
+
async assertUsable(evidence) {
|
|
72
|
+
const prepared = await this.prepareUsable(evidence);
|
|
73
|
+
return runPlatformAuthInventorySourceFenceTransaction(this.#pool, (connection) => this.assertPrepared(connection, evidence, prepared), this.#transactionOptions(ASSERTION_TABLES));
|
|
74
|
+
}
|
|
75
|
+
async prepareUsable(evidence, deadline) {
|
|
76
|
+
const first = await this.#captureUsability(evidence, PLATFORM_ACCOUNT_RESET_PREVIEW_TABLES, deadline);
|
|
77
|
+
const remote = await this.#readRemote(first.local, deadline);
|
|
78
|
+
if (deadline !== undefined)
|
|
79
|
+
remainingPlatformAccountResetDispatchMilliseconds(deadline, Number.MAX_SAFE_INTEGER);
|
|
80
|
+
return { ...first, remote };
|
|
81
|
+
}
|
|
82
|
+
async assertPrepared(connection, evidence, prepared) {
|
|
83
|
+
await this.#assertSourceFence(connection);
|
|
84
|
+
const stored = await this.#loadStoredSnapshot(connection, evidence);
|
|
85
|
+
if (stored.fingerprint !== prepared.fingerprint)
|
|
86
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
87
|
+
await lockPlatformAuthInventorySourceFenceTargets(connection, stored.targetRows.map((row) => row.principal_id));
|
|
88
|
+
const local = await this.#inspectLocal(connection, stored.request, evidence.operationId, true);
|
|
89
|
+
this.#assertSameLocalEvidence(prepared.local, local);
|
|
90
|
+
const inspection = combinePlatformAccountResetEvidence(local, prepared.remote, stored.previewExpiresAt);
|
|
91
|
+
if (inspection.result.blockers.length !== 0)
|
|
92
|
+
throw new PlatformAccountResetPreviewError(inspection.result.blockers[0]?.code ?? 'operation_conflict');
|
|
93
|
+
this.#assertStoredInspection(stored, inspection);
|
|
94
|
+
await assertPlatformAccountResetCleanupEvidence(connection, evidence.operationId, inspection);
|
|
95
|
+
const parsedSafeResult = PlatformAccountResetResultSchema.safeParse(stored.stored.safe_result);
|
|
96
|
+
if (!parsedSafeResult.success ||
|
|
97
|
+
canonicalJson(parsedSafeResult.data) !== canonicalJson(inspection.safeResult))
|
|
98
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
99
|
+
return {
|
|
100
|
+
...parsedSafeResult.data,
|
|
101
|
+
workosRealmFingerprint: local.workosRealmFingerprint,
|
|
102
|
+
previewExpiresAt: stored.previewExpiresAt.toISOString(),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
async #captureLocal(request, operationId) {
|
|
106
|
+
return runPlatformAuthInventorySourceFenceTransaction(this.#pool, async (connection) => {
|
|
107
|
+
await this.#assertSourceFence(connection);
|
|
108
|
+
await lockPlatformAuthInventorySourceFenceTargets(connection, request.targetSet.principalIds);
|
|
109
|
+
const authority = await connection.query(`WITH authority AS MATERIALIZED (
|
|
110
|
+
SELECT clock_timestamp() AS created_at
|
|
111
|
+
)
|
|
112
|
+
SELECT authority.created_at::text AS created_at,
|
|
113
|
+
(authority.created_at + $1::bigint * interval '1 millisecond')::text
|
|
114
|
+
AS preview_expires_at
|
|
115
|
+
FROM authority`, [this.#options.previewTtlMs]);
|
|
116
|
+
const timestamp = authority.rows[0];
|
|
117
|
+
if (timestamp === undefined)
|
|
118
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
119
|
+
const local = await this.#inspectLocal(connection, request, operationId);
|
|
120
|
+
return {
|
|
121
|
+
local,
|
|
122
|
+
createdAt: timestamp.created_at,
|
|
123
|
+
previewExpiresAt: timestamp.preview_expires_at,
|
|
124
|
+
};
|
|
125
|
+
}, this.#transactionOptions(PLATFORM_ACCOUNT_RESET_PREVIEW_TABLES));
|
|
126
|
+
}
|
|
127
|
+
async #captureUsability(evidence, lockTables, deadline) {
|
|
128
|
+
return runPlatformAuthInventorySourceFenceTransaction(this.#pool, async (connection) => {
|
|
129
|
+
await this.#assertSourceFence(connection);
|
|
130
|
+
const stored = await this.#loadStoredSnapshot(connection, evidence);
|
|
131
|
+
await lockPlatformAuthInventorySourceFenceTargets(connection, stored.targetRows.map((row) => row.principal_id));
|
|
132
|
+
const local = await this.#inspectLocal(connection, stored.request, evidence.operationId, true);
|
|
133
|
+
return { ...stored, local };
|
|
134
|
+
}, this.#transactionOptions(lockTables, deadline));
|
|
135
|
+
}
|
|
136
|
+
#inspectLocal(connection, request, operationId, ignoreCurrentOperation = false) {
|
|
137
|
+
return inspectPlatformAccountResetLocalEvidence(connection, request, operationId, {
|
|
138
|
+
sourceAvailability: this.#options.sourceAvailability,
|
|
139
|
+
googleRealm: this.#options.googleRealm,
|
|
140
|
+
workosRealm: this.#options.workosRealm,
|
|
141
|
+
releaseSha: this.#options.releaseSha,
|
|
142
|
+
excludedSubjects: this.#options.excludedSubjects,
|
|
143
|
+
ignoreCurrentOperation,
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
async #readRemote(local, dispatchDeadline) {
|
|
147
|
+
const providerTimeoutMs = dispatchDeadline === undefined
|
|
148
|
+
? this.#options.providerTimeoutMs
|
|
149
|
+
: remainingPlatformAccountResetDispatchMilliseconds(dispatchDeadline, this.#options.providerTimeoutMs);
|
|
150
|
+
const controller = new AbortController();
|
|
151
|
+
const deadline = new Date(Date.now() + providerTimeoutMs);
|
|
152
|
+
let timeout;
|
|
153
|
+
try {
|
|
154
|
+
timeout = setTimeout(() => controller.abort(new DOMException('account reset provider deadline exceeded', 'AbortError')), providerTimeoutMs);
|
|
155
|
+
return await loadPlatformAccountResetWorkosEvidence(local.normalizedContacts, this.#options.directory, this.#options.workosRealm, { signal: controller.signal, deadline });
|
|
156
|
+
}
|
|
157
|
+
finally {
|
|
158
|
+
if (timeout !== undefined)
|
|
159
|
+
clearTimeout(timeout);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async #loadStoredSnapshot(connection, evidence) {
|
|
163
|
+
const operation = await connection.query(`SELECT lifecycle, release_sha, rollout_generation::text, workos_realm,
|
|
164
|
+
source_epoch::text, preview_checksum, target_set_fingerprint,
|
|
165
|
+
request_fingerprint, safe_result, preview_expires_at, created_at
|
|
166
|
+
FROM platform_account_reset_operations
|
|
167
|
+
WHERE operation_id = $1
|
|
168
|
+
AND preview_expires_at > clock_timestamp()
|
|
169
|
+
AND preview_expires_at =
|
|
170
|
+
created_at + $2::bigint * interval '1 millisecond'
|
|
171
|
+
FOR SHARE`, [evidence.operationId, this.#options.previewTtlMs]);
|
|
172
|
+
const stored = operation.rows[0];
|
|
173
|
+
if (stored === undefined || stored.lifecycle !== 'previewed')
|
|
174
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
175
|
+
if (stored.release_sha !== evidence.releaseSha ||
|
|
176
|
+
evidence.releaseSha !== this.#options.releaseSha)
|
|
177
|
+
throw new PlatformAccountResetPreviewError('release_mismatch');
|
|
178
|
+
if (Number(stored.rollout_generation) !== evidence.expectedGeneration)
|
|
179
|
+
throw new PlatformAccountResetPreviewError('generation_mismatch');
|
|
180
|
+
if (evidence.previewChecksum === null || stored.preview_checksum !== evidence.previewChecksum)
|
|
181
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
182
|
+
if (stored.workos_realm !== this.#options.workosRealm)
|
|
183
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
184
|
+
const previewExpiresAt = new Date(stored.preview_expires_at);
|
|
185
|
+
const createdAt = new Date(stored.created_at);
|
|
186
|
+
if (!Number.isFinite(previewExpiresAt.getTime()) ||
|
|
187
|
+
!Number.isFinite(createdAt.getTime()) ||
|
|
188
|
+
previewExpiresAt.getTime() - createdAt.getTime() !== this.#options.previewTtlMs)
|
|
189
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
190
|
+
const targetRows = await connection.query(`SELECT principal_id, source_snapshot_fingerprint
|
|
191
|
+
FROM platform_account_reset_targets
|
|
192
|
+
WHERE operation_id = $1 AND lifecycle = 'previewed'
|
|
193
|
+
ORDER BY principal_id
|
|
194
|
+
FOR SHARE`, [evidence.operationId]);
|
|
195
|
+
if (targetRows.rows.length !== 3)
|
|
196
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
197
|
+
const currentEpoch = Number(await readPlatformAuthInventorySourceEpoch(connection));
|
|
198
|
+
if (currentEpoch !== Number(stored.source_epoch))
|
|
199
|
+
throw new PlatformAccountResetPreviewError('source_epoch_mismatch');
|
|
200
|
+
const request = {
|
|
201
|
+
schemaVersion: 1,
|
|
202
|
+
targetSet: {
|
|
203
|
+
schemaVersion: 1,
|
|
204
|
+
principalIds: targetRows.rows.map((row) => row.principal_id),
|
|
205
|
+
},
|
|
206
|
+
releaseSha: stored.release_sha,
|
|
207
|
+
expectedGeneration: Number(stored.rollout_generation),
|
|
208
|
+
sourceEpoch: Number(stored.source_epoch),
|
|
209
|
+
workosRealm: stored.workos_realm,
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
stored,
|
|
213
|
+
targetRows: targetRows.rows,
|
|
214
|
+
request,
|
|
215
|
+
previewExpiresAt,
|
|
216
|
+
fingerprint: sha256Canonical({
|
|
217
|
+
schemaVersion: 1,
|
|
218
|
+
label: 'platform_account_reset_stored_preview',
|
|
219
|
+
stored: {
|
|
220
|
+
...stored,
|
|
221
|
+
preview_expires_at: previewExpiresAt.toISOString(),
|
|
222
|
+
created_at: createdAt.toISOString(),
|
|
223
|
+
},
|
|
224
|
+
targetRows: targetRows.rows,
|
|
225
|
+
}),
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
async #assertSourceFence(connection) {
|
|
229
|
+
const sources = new PostgresPlatformAuthLegacyInventorySources({
|
|
230
|
+
googleRealm: this.#options.googleRealm,
|
|
231
|
+
sourceAvailability: this.#options.sourceAvailability,
|
|
232
|
+
excludedSubjects: this.#options.excludedSubjects,
|
|
233
|
+
});
|
|
234
|
+
await sources.assertManifest(connection);
|
|
235
|
+
await assertPlatformAuthInventorySourceFence(connection, this.#options.sourceAvailability);
|
|
236
|
+
}
|
|
237
|
+
#assertSameLocalEvidence(first, second) {
|
|
238
|
+
if (first.evidenceFingerprint !== second.evidenceFingerprint)
|
|
239
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
240
|
+
}
|
|
241
|
+
#assertStoredInspection(stored, inspection) {
|
|
242
|
+
if (inspection.result.previewChecksum !== stored.stored.preview_checksum ||
|
|
243
|
+
inspection.result.targetSetFingerprint !== stored.stored.target_set_fingerprint ||
|
|
244
|
+
inspection.result.requestFingerprint !== stored.stored.request_fingerprint)
|
|
245
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
246
|
+
for (const row of stored.targetRows) {
|
|
247
|
+
if (inspection.targetSnapshots.get(row.principal_id) !== row.source_snapshot_fingerprint)
|
|
248
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
async #assertDatabaseDeadline(connection, previewExpiresAt) {
|
|
252
|
+
const live = await connection.query('SELECT $1::timestamptz > clock_timestamp() AS live', [previewExpiresAt]);
|
|
253
|
+
if (live.rows[0]?.live !== true)
|
|
254
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
255
|
+
}
|
|
256
|
+
#transactionOptions(lockTables, deadline) {
|
|
257
|
+
const timeout = deadline === undefined
|
|
258
|
+
? this.#options.localCaptureTimeoutMs
|
|
259
|
+
: remainingPlatformAccountResetDispatchMilliseconds(deadline, this.#options.localCaptureTimeoutMs);
|
|
260
|
+
return {
|
|
261
|
+
lockTables,
|
|
262
|
+
lockTimeoutMs: timeout,
|
|
263
|
+
statementTimeoutMs: timeout,
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
function validTimeout(value) {
|
|
268
|
+
return value !== undefined && Number.isFinite(value) && value > 0
|
|
269
|
+
? Math.floor(value)
|
|
270
|
+
: DEFAULT_PROVIDER_TIMEOUT_MS;
|
|
271
|
+
}
|
|
272
|
+
function validLocalCaptureTimeout(value) {
|
|
273
|
+
return value !== undefined && Number.isSafeInteger(value) && value > 0
|
|
274
|
+
? Math.min(value, MAX_LOCAL_CAPTURE_TIMEOUT_MS)
|
|
275
|
+
: DEFAULT_LOCAL_CAPTURE_TIMEOUT_MS;
|
|
276
|
+
}
|
|
277
|
+
function validPreviewTtl(value) {
|
|
278
|
+
return value !== undefined && Number.isSafeInteger(value) && value > 0 ? value : PREVIEW_TTL_MS;
|
|
279
|
+
}
|
|
280
|
+
function validTimestamp(value) {
|
|
281
|
+
const timestamp = new Date(value);
|
|
282
|
+
if (!Number.isFinite(timestamp.getTime()))
|
|
283
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
284
|
+
return timestamp;
|
|
285
|
+
}
|
|
286
|
+
//# sourceMappingURL=platform-account-reset-preview-postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-preview-postgres.js","sourceRoot":"","sources":["../src/platform-account-reset-preview-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAEL,wCAAw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AAS,cAAc,CAAC,KAAa;IACnC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;QACvC,MAAM,IAAI,gCAAgC,CAAC,oBAAoB,CAAC,CAAC;IACnE,OAAO,SAAS,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { PlatformAccountResetBlockerCode, PlatformAccountResetResult } from './platform-account-reset.js';
|
|
2
|
+
import type { PlatformAccountResetCleanupResource } from './platform-account-reset-ownership-postgres.js';
|
|
3
|
+
import type { PlatformAccountResetWorkosEvidence } from './platform-account-reset-preview-evidence-postgres.js';
|
|
4
|
+
import type { PlatformAccountResetLocalInspection } from './platform-account-reset-preview-local-postgres.js';
|
|
5
|
+
export interface PlatformAccountResetPreviewResult extends PlatformAccountResetResult {
|
|
6
|
+
readonly workosRealmFingerprint: string;
|
|
7
|
+
readonly previewExpiresAt: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class PlatformAccountResetPreviewError extends Error {
|
|
10
|
+
readonly code: PlatformAccountResetBlockerCode;
|
|
11
|
+
constructor(code: PlatformAccountResetBlockerCode);
|
|
12
|
+
}
|
|
13
|
+
export interface PlatformAccountResetFrozenInspection {
|
|
14
|
+
readonly result: PlatformAccountResetPreviewResult;
|
|
15
|
+
readonly safeResult: PlatformAccountResetResult;
|
|
16
|
+
readonly targetSnapshots: ReadonlyMap<string, string>;
|
|
17
|
+
readonly cleanupResources: readonly PlatformAccountResetCleanupResource[];
|
|
18
|
+
readonly cleanupSetFingerprint: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function combinePlatformAccountResetEvidence(local: PlatformAccountResetLocalInspection, remote: PlatformAccountResetWorkosEvidence, previewExpiresAt: Date): PlatformAccountResetFrozenInspection;
|
|
21
|
+
//# sourceMappingURL=platform-account-reset-preview-result.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-preview-result.d.ts","sourceRoot":"","sources":["../src/platform-account-reset-preview-result.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,+BAA+B,EAC/B,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AAErC,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,gDAAgD,CAAC;AAC1G,OAAO,KAAK,EAAE,kCAAkC,EAAE,MAAM,uDAAuD,CAAC;AAChH,OAAO,KAAK,EAAE,mCAAmC,EAAE,MAAM,oDAAoD,CAAC;AAE9G,MAAM,WAAW,iCAAkC,SAAQ,0BAA0B;IACnF,QAAQ,CAAC,sBAAsB,EAAE,MAAM,CAAC;IACxC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;CACnC;AAED,qBAAa,gCAAiC,SAAQ,KAAK;IACzD,QAAQ,CAAC,IAAI,EAAE,+BAA+B,CAAC;gBAEnC,IAAI,EAAE,+BAA+B;CAKlD;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,MAAM,EAAE,iCAAiC,CAAC;IACnD,QAAQ,CAAC,UAAU,EAAE,0BAA0B,CAAC;IAChD,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtD,QAAQ,CAAC,gBAAgB,EAAE,SAAS,mCAAmC,EAAE,CAAC;IAC1E,QAAQ,CAAC,qBAAqB,EAAE,MAAM,CAAC;CACxC;AAED,wBAAgB,mCAAmC,CACjD,KAAK,EAAE,mCAAmC,EAC1C,MAAM,EAAE,kCAAkC,EAC1C,gBAAgB,EAAE,IAAI,GACrB,oCAAoC,CA4EtC"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { canonicalJson, sha256Canonical } from './platform-account-reset-fingerprint.js';
|
|
2
|
+
export class PlatformAccountResetPreviewError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
constructor(code) {
|
|
5
|
+
super(`Platform account-reset preview rejected: ${code}`);
|
|
6
|
+
this.name = 'PlatformAccountResetPreviewError';
|
|
7
|
+
this.code = code;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
export function combinePlatformAccountResetEvidence(local, remote, previewExpiresAt) {
|
|
11
|
+
const blockers = new Map(local.blockers.map((entry) => [entry.code, entry.count]));
|
|
12
|
+
if (remote.providerUnavailableCount !== 0)
|
|
13
|
+
blockers.set('provider_cleanup_pending', remote.providerUnavailableCount);
|
|
14
|
+
if (remote.conflictCount !== 0)
|
|
15
|
+
blockers.set('workos_user_conflict', remote.conflictCount);
|
|
16
|
+
const cleanupResources = [...local.cleanupResources, ...remote.resources].sort((left, right) => canonicalJson(left).localeCompare(canonicalJson(right)));
|
|
17
|
+
const cleanupSetFingerprint = sha256Canonical({
|
|
18
|
+
schemaVersion: 1,
|
|
19
|
+
label: 'platform_account_reset_cleanup_set',
|
|
20
|
+
resources: cleanupResources,
|
|
21
|
+
});
|
|
22
|
+
const targetSnapshots = new Map();
|
|
23
|
+
for (const target of local.targets) {
|
|
24
|
+
targetSnapshots.set(target, sha256Canonical({
|
|
25
|
+
...(local.targetEvidence.get(target) ?? {}),
|
|
26
|
+
workos: remote.resources.filter((resource) => resource.locator.principalId === target),
|
|
27
|
+
}));
|
|
28
|
+
}
|
|
29
|
+
const eligibilityFingerprint = sha256Canonical({
|
|
30
|
+
schemaVersion: 1,
|
|
31
|
+
label: 'platform_account_reset_eligibility',
|
|
32
|
+
targetSnapshots: [...targetSnapshots],
|
|
33
|
+
});
|
|
34
|
+
const targetSetFingerprint = sha256Canonical({
|
|
35
|
+
schemaVersion: 1,
|
|
36
|
+
label: 'platform_account_reset_target_set',
|
|
37
|
+
principalIds: local.targets,
|
|
38
|
+
eligibilityFingerprint,
|
|
39
|
+
});
|
|
40
|
+
const previewChecksum = sha256Canonical({
|
|
41
|
+
schemaVersion: 1,
|
|
42
|
+
releaseSha: local.request.releaseSha,
|
|
43
|
+
rolloutGeneration: local.request.expectedGeneration,
|
|
44
|
+
workosRealmFingerprint: local.workosRealmFingerprint,
|
|
45
|
+
sourceEpoch: local.request.sourceEpoch,
|
|
46
|
+
targetSetFingerprint,
|
|
47
|
+
ownershipFingerprint: local.ownershipFingerprint,
|
|
48
|
+
cleanupSetFingerprint,
|
|
49
|
+
});
|
|
50
|
+
const blockerList = [...blockers]
|
|
51
|
+
.map(([code, count]) => ({ code, count }))
|
|
52
|
+
.sort((left, right) => left.code.localeCompare(right.code));
|
|
53
|
+
const safeResult = {
|
|
54
|
+
schemaVersion: 1,
|
|
55
|
+
operationId: local.operationId,
|
|
56
|
+
lifecycle: 'previewed',
|
|
57
|
+
releaseSha: local.request.releaseSha,
|
|
58
|
+
rolloutGeneration: local.request.expectedGeneration,
|
|
59
|
+
sourceEpoch: local.request.sourceEpoch,
|
|
60
|
+
previewChecksum,
|
|
61
|
+
targetSetFingerprint,
|
|
62
|
+
requestFingerprint: local.requestFingerprint,
|
|
63
|
+
counts: {
|
|
64
|
+
...local.counts,
|
|
65
|
+
providerObjectCount: local.counts.providerObjectCount + remote.resources.length,
|
|
66
|
+
},
|
|
67
|
+
blockers: blockerList,
|
|
68
|
+
};
|
|
69
|
+
return {
|
|
70
|
+
safeResult,
|
|
71
|
+
result: {
|
|
72
|
+
...safeResult,
|
|
73
|
+
workosRealmFingerprint: local.workosRealmFingerprint,
|
|
74
|
+
previewExpiresAt: previewExpiresAt.toISOString(),
|
|
75
|
+
},
|
|
76
|
+
targetSnapshots,
|
|
77
|
+
cleanupResources,
|
|
78
|
+
cleanupSetFingerprint,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=platform-account-reset-preview-result.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-preview-result.js","sourceRoot":"","sources":["../src/platform-account-reset-preview-result.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yCAAyC,CAAC;AAUzF,MAAM,OAA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