@noodleseed/one 0.82.0 → 0.84.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/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.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/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-embedded-assistant-ref.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +39 -3
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.js +1 -0
- package/node_modules/@noodle-borg/service/dist/assistant-interactive.js.map +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/assistant-agent.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.js +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/assistant-agent.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/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts +7 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.d.ts.map +1 -1
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js +5 -0
- package/node_modules/@noodle-borg/wire-contracts/dist/assistant.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,439 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Additive, service-only persistence for the exact-three account reset. Sensitive reservation and locator
|
|
3
|
+
* fields never appear in the append-only event table or the public result contract.
|
|
4
|
+
*/
|
|
5
|
+
export async function ensurePlatformAccountResetSchema(pool) {
|
|
6
|
+
await pool.query(`
|
|
7
|
+
CREATE TABLE IF NOT EXISTS platform_account_reset_operations (
|
|
8
|
+
operation_id text PRIMARY KEY,
|
|
9
|
+
lifecycle text NOT NULL CHECK (lifecycle IN (
|
|
10
|
+
'previewed', 'quarantined', 'rolled_back',
|
|
11
|
+
'finalizing', 'finalization_blocked', 'finalized'
|
|
12
|
+
)),
|
|
13
|
+
release_sha text NOT NULL CHECK (release_sha ~ '^[0-9a-f]{40}$'),
|
|
14
|
+
rollout_generation bigint NOT NULL CHECK (rollout_generation >= 0),
|
|
15
|
+
workos_realm text NOT NULL,
|
|
16
|
+
source_epoch bigint NOT NULL CHECK (source_epoch >= 0),
|
|
17
|
+
preview_checksum text NOT NULL CHECK (preview_checksum ~ '^[0-9a-f]{64}$'),
|
|
18
|
+
target_set_fingerprint text NOT NULL CHECK (target_set_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
19
|
+
approved_target_set_fingerprint text NOT NULL
|
|
20
|
+
CHECK (approved_target_set_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
21
|
+
request_fingerprint text NOT NULL CHECK (request_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
22
|
+
idempotency_key_hash text CHECK (idempotency_key_hash IS NULL OR idempotency_key_hash ~ '^[0-9a-f]{64}$'),
|
|
23
|
+
actor_fingerprint text NOT NULL CHECK (actor_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
24
|
+
reason_fingerprint text CHECK (reason_fingerprint IS NULL OR reason_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
25
|
+
safe_result jsonb NOT NULL,
|
|
26
|
+
preview_expires_at timestamptz NOT NULL,
|
|
27
|
+
quarantined_at timestamptz,
|
|
28
|
+
finalize_after timestamptz,
|
|
29
|
+
finalized_at timestamptz,
|
|
30
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
31
|
+
updated_at timestamptz NOT NULL DEFAULT now()
|
|
32
|
+
)
|
|
33
|
+
`);
|
|
34
|
+
await pool.query('ALTER TABLE platform_account_reset_operations ADD COLUMN IF NOT EXISTS idempotency_key_hash text, ADD COLUMN IF NOT EXISTS actor_fingerprint text, ADD COLUMN IF NOT EXISTS reason_fingerprint text, ADD COLUMN IF NOT EXISTS safe_result jsonb, ADD COLUMN IF NOT EXISTS preview_expires_at timestamptz, ADD COLUMN IF NOT EXISTS quarantined_at timestamptz, ADD COLUMN IF NOT EXISTS finalize_after timestamptz, ADD COLUMN IF NOT EXISTS finalized_at timestamptz, ADD COLUMN IF NOT EXISTS updated_at timestamptz NOT NULL DEFAULT now()');
|
|
35
|
+
await pool.query(`
|
|
36
|
+
ALTER TABLE platform_account_reset_operations
|
|
37
|
+
ADD COLUMN IF NOT EXISTS quarantine_idempotency_key_hash text
|
|
38
|
+
CHECK (quarantine_idempotency_key_hash IS NULL
|
|
39
|
+
OR quarantine_idempotency_key_hash ~ '^[0-9a-f]{64}$'),
|
|
40
|
+
ADD COLUMN IF NOT EXISTS quarantine_request_fingerprint text
|
|
41
|
+
CHECK (quarantine_request_fingerprint IS NULL
|
|
42
|
+
OR quarantine_request_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
43
|
+
ADD COLUMN IF NOT EXISTS quarantine_reason_fingerprint text
|
|
44
|
+
CHECK (quarantine_reason_fingerprint IS NULL
|
|
45
|
+
OR quarantine_reason_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
46
|
+
ADD COLUMN IF NOT EXISTS quarantine_actor_fingerprint text
|
|
47
|
+
CHECK (quarantine_actor_fingerprint IS NULL
|
|
48
|
+
OR quarantine_actor_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
49
|
+
ADD COLUMN IF NOT EXISTS quarantine_safe_result jsonb,
|
|
50
|
+
ADD COLUMN IF NOT EXISTS rollback_idempotency_key_hash text
|
|
51
|
+
CHECK (rollback_idempotency_key_hash IS NULL
|
|
52
|
+
OR rollback_idempotency_key_hash ~ '^[0-9a-f]{64}$'),
|
|
53
|
+
ADD COLUMN IF NOT EXISTS rollback_request_fingerprint text
|
|
54
|
+
CHECK (rollback_request_fingerprint IS NULL
|
|
55
|
+
OR rollback_request_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
56
|
+
ADD COLUMN IF NOT EXISTS rollback_reason_fingerprint text
|
|
57
|
+
CHECK (rollback_reason_fingerprint IS NULL
|
|
58
|
+
OR rollback_reason_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
59
|
+
ADD COLUMN IF NOT EXISTS rollback_actor_fingerprint text
|
|
60
|
+
CHECK (rollback_actor_fingerprint IS NULL
|
|
61
|
+
OR rollback_actor_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
62
|
+
ADD COLUMN IF NOT EXISTS rollback_safe_result jsonb
|
|
63
|
+
`);
|
|
64
|
+
await pool.query(`
|
|
65
|
+
ALTER TABLE platform_account_reset_operations
|
|
66
|
+
ADD COLUMN IF NOT EXISTS approved_target_set_fingerprint text
|
|
67
|
+
CHECK (approved_target_set_fingerprint IS NULL
|
|
68
|
+
OR approved_target_set_fingerprint ~ '^[0-9a-f]{64}$')
|
|
69
|
+
`);
|
|
70
|
+
await pool.query(`
|
|
71
|
+
CREATE TABLE IF NOT EXISTS platform_account_reset_targets (
|
|
72
|
+
operation_id text NOT NULL REFERENCES platform_account_reset_operations(operation_id) ON DELETE RESTRICT,
|
|
73
|
+
principal_id text NOT NULL REFERENCES platform_principals(principal_id) ON DELETE RESTRICT,
|
|
74
|
+
target_fingerprint text NOT NULL CHECK (target_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
75
|
+
source_snapshot_fingerprint text NOT NULL CHECK (source_snapshot_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
76
|
+
lifecycle text NOT NULL CHECK (lifecycle IN (
|
|
77
|
+
'previewed', 'quarantined', 'rolled_back',
|
|
78
|
+
'finalizing', 'finalization_blocked', 'finalized'
|
|
79
|
+
)),
|
|
80
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
81
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
82
|
+
PRIMARY KEY (operation_id, principal_id)
|
|
83
|
+
)
|
|
84
|
+
`);
|
|
85
|
+
await pool.query(`
|
|
86
|
+
CREATE TABLE IF NOT EXISTS platform_account_reset_email_reservations (
|
|
87
|
+
operation_id text NOT NULL REFERENCES platform_account_reset_operations(operation_id) ON DELETE RESTRICT,
|
|
88
|
+
realm text NOT NULL,
|
|
89
|
+
normalized_email text NOT NULL,
|
|
90
|
+
principal_id text NOT NULL REFERENCES platform_principals(principal_id) ON DELETE RESTRICT,
|
|
91
|
+
expires_at timestamptz NOT NULL,
|
|
92
|
+
released_at timestamptz,
|
|
93
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
94
|
+
PRIMARY KEY (operation_id, realm, normalized_email)
|
|
95
|
+
)
|
|
96
|
+
`);
|
|
97
|
+
await pool.query(`
|
|
98
|
+
CREATE TABLE IF NOT EXISTS platform_account_reset_cleanup_ledger (
|
|
99
|
+
ledger_id bigserial PRIMARY KEY,
|
|
100
|
+
operation_id text NOT NULL REFERENCES platform_account_reset_operations(operation_id) ON DELETE RESTRICT,
|
|
101
|
+
provider text NOT NULL,
|
|
102
|
+
resource_kind text NOT NULL,
|
|
103
|
+
provider_locator text NOT NULL,
|
|
104
|
+
locator_fingerprint text NOT NULL CHECK (locator_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
105
|
+
state text NOT NULL DEFAULT 'pending' CHECK (state IN ('pending', 'leased', 'completed', 'blocked', 'failed')),
|
|
106
|
+
lease_token_hash text CHECK (lease_token_hash IS NULL OR lease_token_hash ~ '^[0-9a-f]{64}$'),
|
|
107
|
+
lease_expires_at timestamptz,
|
|
108
|
+
attempt_count integer NOT NULL DEFAULT 0 CHECK (attempt_count >= 0),
|
|
109
|
+
retry_at timestamptz,
|
|
110
|
+
outcome_code text,
|
|
111
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
112
|
+
updated_at timestamptz NOT NULL DEFAULT now(),
|
|
113
|
+
UNIQUE (operation_id, provider, resource_kind, locator_fingerprint)
|
|
114
|
+
)
|
|
115
|
+
`);
|
|
116
|
+
await pool.query(`
|
|
117
|
+
CREATE TABLE IF NOT EXISTS platform_account_reset_events (
|
|
118
|
+
event_id bigserial PRIMARY KEY,
|
|
119
|
+
operation_id text NOT NULL REFERENCES platform_account_reset_operations(operation_id) ON DELETE RESTRICT,
|
|
120
|
+
event_type text NOT NULL CHECK (event_type IN (
|
|
121
|
+
'previewed', 'quarantined', 'provider_attempt', 'rolled_back',
|
|
122
|
+
'finalizing', 'finalization_blocked', 'finalized'
|
|
123
|
+
)),
|
|
124
|
+
target_set_fingerprint text NOT NULL CHECK (target_set_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
125
|
+
event_fingerprint text NOT NULL CHECK (event_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
126
|
+
target_count integer NOT NULL CHECK (target_count >= 0),
|
|
127
|
+
resource_count integer NOT NULL CHECK (resource_count >= 0),
|
|
128
|
+
blocker_count integer NOT NULL CHECK (blocker_count >= 0),
|
|
129
|
+
created_at timestamptz NOT NULL DEFAULT now()
|
|
130
|
+
)
|
|
131
|
+
`);
|
|
132
|
+
await pool.query(`
|
|
133
|
+
CREATE TABLE IF NOT EXISTS platform_account_reset_rollback_previews (
|
|
134
|
+
operation_id text NOT NULL
|
|
135
|
+
REFERENCES platform_account_reset_operations(operation_id) ON DELETE RESTRICT,
|
|
136
|
+
preview_checksum text NOT NULL CHECK (preview_checksum ~ '^[0-9a-f]{64}$'),
|
|
137
|
+
source_epoch bigint NOT NULL CHECK (source_epoch >= 0),
|
|
138
|
+
release_sha text NOT NULL CHECK (release_sha ~ '^[0-9a-f]{40}$'),
|
|
139
|
+
rollout_generation bigint NOT NULL CHECK (rollout_generation >= 0),
|
|
140
|
+
source_manifest_fingerprint text NOT NULL
|
|
141
|
+
CHECK (source_manifest_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
142
|
+
evidence_fingerprint text NOT NULL CHECK (evidence_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
143
|
+
safe_result jsonb NOT NULL,
|
|
144
|
+
preview_expires_at timestamptz NOT NULL,
|
|
145
|
+
created_at timestamptz NOT NULL DEFAULT now(),
|
|
146
|
+
PRIMARY KEY (operation_id, preview_checksum)
|
|
147
|
+
)
|
|
148
|
+
`);
|
|
149
|
+
await pool.query(`
|
|
150
|
+
ALTER TABLE platform_account_reset_cleanup_ledger
|
|
151
|
+
ADD COLUMN IF NOT EXISTS quarantine_archive_at timestamptz
|
|
152
|
+
`);
|
|
153
|
+
await pool.query(`
|
|
154
|
+
DROP INDEX IF EXISTS platform_account_reset_active_principal_unique;
|
|
155
|
+
CREATE UNIQUE INDEX platform_account_reset_active_principal_unique
|
|
156
|
+
ON platform_account_reset_targets (principal_id)
|
|
157
|
+
WHERE lifecycle IN ('quarantined', 'finalizing', 'finalization_blocked')
|
|
158
|
+
`);
|
|
159
|
+
await pool.query(`
|
|
160
|
+
CREATE UNIQUE INDEX IF NOT EXISTS platform_account_reset_active_email_reservation_unique
|
|
161
|
+
ON platform_account_reset_email_reservations (realm, normalized_email)
|
|
162
|
+
WHERE released_at IS NULL
|
|
163
|
+
`);
|
|
164
|
+
await pool.query(`
|
|
165
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_transition_allowed(
|
|
166
|
+
prior_lifecycle text, next_lifecycle text
|
|
167
|
+
) RETURNS boolean AS $$
|
|
168
|
+
SELECT prior_lifecycle = next_lifecycle OR (prior_lifecycle, next_lifecycle) IN (
|
|
169
|
+
('previewed', 'quarantined'),
|
|
170
|
+
('quarantined', 'rolled_back'),
|
|
171
|
+
('quarantined', 'finalizing'),
|
|
172
|
+
('finalizing', 'finalization_blocked'),
|
|
173
|
+
('finalizing', 'finalized'),
|
|
174
|
+
('finalization_blocked', 'finalizing')
|
|
175
|
+
)
|
|
176
|
+
$$ LANGUAGE sql IMMUTABLE
|
|
177
|
+
`);
|
|
178
|
+
await pool.query(`
|
|
179
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_operation_guard() RETURNS trigger AS $$
|
|
180
|
+
BEGIN
|
|
181
|
+
IF TG_OP = 'DELETE' THEN
|
|
182
|
+
RAISE EXCEPTION 'platform account reset operations cannot be deleted';
|
|
183
|
+
END IF;
|
|
184
|
+
IF OLD.operation_id IS DISTINCT FROM NEW.operation_id
|
|
185
|
+
OR OLD.release_sha IS DISTINCT FROM NEW.release_sha
|
|
186
|
+
OR OLD.rollout_generation IS DISTINCT FROM NEW.rollout_generation
|
|
187
|
+
OR OLD.workos_realm IS DISTINCT FROM NEW.workos_realm
|
|
188
|
+
OR OLD.source_epoch IS DISTINCT FROM NEW.source_epoch
|
|
189
|
+
OR OLD.preview_checksum IS DISTINCT FROM NEW.preview_checksum
|
|
190
|
+
OR OLD.target_set_fingerprint IS DISTINCT FROM NEW.target_set_fingerprint
|
|
191
|
+
OR OLD.approved_target_set_fingerprint
|
|
192
|
+
IS DISTINCT FROM NEW.approved_target_set_fingerprint
|
|
193
|
+
OR OLD.request_fingerprint IS DISTINCT FROM NEW.request_fingerprint
|
|
194
|
+
OR OLD.idempotency_key_hash IS DISTINCT FROM NEW.idempotency_key_hash
|
|
195
|
+
OR OLD.actor_fingerprint IS DISTINCT FROM NEW.actor_fingerprint
|
|
196
|
+
OR OLD.reason_fingerprint IS DISTINCT FROM NEW.reason_fingerprint
|
|
197
|
+
OR OLD.safe_result IS DISTINCT FROM NEW.safe_result
|
|
198
|
+
OR OLD.preview_expires_at IS DISTINCT FROM NEW.preview_expires_at
|
|
199
|
+
OR (OLD.quarantine_idempotency_key_hash IS NOT NULL
|
|
200
|
+
AND OLD.quarantine_idempotency_key_hash IS DISTINCT FROM NEW.quarantine_idempotency_key_hash)
|
|
201
|
+
OR (OLD.quarantine_request_fingerprint IS NOT NULL
|
|
202
|
+
AND OLD.quarantine_request_fingerprint IS DISTINCT FROM NEW.quarantine_request_fingerprint)
|
|
203
|
+
OR (OLD.quarantine_reason_fingerprint IS NOT NULL
|
|
204
|
+
AND OLD.quarantine_reason_fingerprint IS DISTINCT FROM NEW.quarantine_reason_fingerprint)
|
|
205
|
+
OR (OLD.quarantine_actor_fingerprint IS NOT NULL
|
|
206
|
+
AND OLD.quarantine_actor_fingerprint IS DISTINCT FROM NEW.quarantine_actor_fingerprint)
|
|
207
|
+
OR (OLD.quarantine_safe_result IS NOT NULL
|
|
208
|
+
AND OLD.quarantine_safe_result IS DISTINCT FROM NEW.quarantine_safe_result)
|
|
209
|
+
OR (OLD.rollback_idempotency_key_hash IS NOT NULL
|
|
210
|
+
AND OLD.rollback_idempotency_key_hash IS DISTINCT FROM NEW.rollback_idempotency_key_hash)
|
|
211
|
+
OR (OLD.rollback_request_fingerprint IS NOT NULL
|
|
212
|
+
AND OLD.rollback_request_fingerprint IS DISTINCT FROM NEW.rollback_request_fingerprint)
|
|
213
|
+
OR (OLD.rollback_reason_fingerprint IS NOT NULL
|
|
214
|
+
AND OLD.rollback_reason_fingerprint IS DISTINCT FROM NEW.rollback_reason_fingerprint)
|
|
215
|
+
OR (OLD.rollback_actor_fingerprint IS NOT NULL
|
|
216
|
+
AND OLD.rollback_actor_fingerprint IS DISTINCT FROM NEW.rollback_actor_fingerprint)
|
|
217
|
+
OR (OLD.rollback_safe_result IS NOT NULL
|
|
218
|
+
AND OLD.rollback_safe_result IS DISTINCT FROM NEW.rollback_safe_result) THEN
|
|
219
|
+
RAISE EXCEPTION 'platform account reset operation evidence is immutable';
|
|
220
|
+
END IF;
|
|
221
|
+
IF NOT platform_account_reset_transition_allowed(OLD.lifecycle, NEW.lifecycle) THEN
|
|
222
|
+
RAISE EXCEPTION 'platform account reset lifecycle transition is invalid';
|
|
223
|
+
END IF;
|
|
224
|
+
RETURN NEW;
|
|
225
|
+
END;
|
|
226
|
+
$$ LANGUAGE plpgsql
|
|
227
|
+
`);
|
|
228
|
+
await pool.query(`
|
|
229
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_cleanup_guard() RETURNS trigger AS $$
|
|
230
|
+
BEGIN
|
|
231
|
+
IF TG_OP = 'DELETE' THEN
|
|
232
|
+
RAISE EXCEPTION 'platform account reset cleanup identity is immutable';
|
|
233
|
+
END IF;
|
|
234
|
+
IF OLD.ledger_id IS DISTINCT FROM NEW.ledger_id
|
|
235
|
+
OR OLD.operation_id IS DISTINCT FROM NEW.operation_id
|
|
236
|
+
OR OLD.provider IS DISTINCT FROM NEW.provider
|
|
237
|
+
OR OLD.resource_kind IS DISTINCT FROM NEW.resource_kind
|
|
238
|
+
OR OLD.provider_locator IS DISTINCT FROM NEW.provider_locator
|
|
239
|
+
OR OLD.locator_fingerprint IS DISTINCT FROM NEW.locator_fingerprint
|
|
240
|
+
OR OLD.created_at IS DISTINCT FROM NEW.created_at
|
|
241
|
+
OR (OLD.quarantine_archive_at IS NOT NULL
|
|
242
|
+
AND OLD.quarantine_archive_at IS DISTINCT FROM NEW.quarantine_archive_at) THEN
|
|
243
|
+
RAISE EXCEPTION 'platform account reset cleanup identity is immutable';
|
|
244
|
+
END IF;
|
|
245
|
+
RETURN NEW;
|
|
246
|
+
END;
|
|
247
|
+
$$ LANGUAGE plpgsql
|
|
248
|
+
`);
|
|
249
|
+
await pool.query(`
|
|
250
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_action_evidence_guard_v1()
|
|
251
|
+
RETURNS trigger AS $$
|
|
252
|
+
BEGIN
|
|
253
|
+
IF (OLD.quarantine_idempotency_key_hash IS NOT NULL
|
|
254
|
+
AND OLD.quarantine_idempotency_key_hash IS DISTINCT FROM NEW.quarantine_idempotency_key_hash)
|
|
255
|
+
OR (OLD.quarantine_request_fingerprint IS NOT NULL
|
|
256
|
+
AND OLD.quarantine_request_fingerprint IS DISTINCT FROM NEW.quarantine_request_fingerprint)
|
|
257
|
+
OR (OLD.quarantine_reason_fingerprint IS NOT NULL
|
|
258
|
+
AND OLD.quarantine_reason_fingerprint IS DISTINCT FROM NEW.quarantine_reason_fingerprint)
|
|
259
|
+
OR (OLD.quarantine_actor_fingerprint IS NOT NULL
|
|
260
|
+
AND OLD.quarantine_actor_fingerprint IS DISTINCT FROM NEW.quarantine_actor_fingerprint)
|
|
261
|
+
OR (OLD.quarantine_safe_result IS NOT NULL
|
|
262
|
+
AND OLD.quarantine_safe_result IS DISTINCT FROM NEW.quarantine_safe_result)
|
|
263
|
+
OR (OLD.rollback_idempotency_key_hash IS NOT NULL
|
|
264
|
+
AND OLD.rollback_idempotency_key_hash IS DISTINCT FROM NEW.rollback_idempotency_key_hash)
|
|
265
|
+
OR (OLD.rollback_request_fingerprint IS NOT NULL
|
|
266
|
+
AND OLD.rollback_request_fingerprint IS DISTINCT FROM NEW.rollback_request_fingerprint)
|
|
267
|
+
OR (OLD.rollback_reason_fingerprint IS NOT NULL
|
|
268
|
+
AND OLD.rollback_reason_fingerprint IS DISTINCT FROM NEW.rollback_reason_fingerprint)
|
|
269
|
+
OR (OLD.rollback_actor_fingerprint IS NOT NULL
|
|
270
|
+
AND OLD.rollback_actor_fingerprint IS DISTINCT FROM NEW.rollback_actor_fingerprint)
|
|
271
|
+
OR (OLD.rollback_safe_result IS NOT NULL
|
|
272
|
+
AND OLD.rollback_safe_result IS DISTINCT FROM NEW.rollback_safe_result) THEN
|
|
273
|
+
RAISE EXCEPTION 'platform account reset action evidence is immutable';
|
|
274
|
+
END IF;
|
|
275
|
+
RETURN NEW;
|
|
276
|
+
END;
|
|
277
|
+
$$ LANGUAGE plpgsql
|
|
278
|
+
`);
|
|
279
|
+
await pool.query(`
|
|
280
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_archive_stamp_guard_v1()
|
|
281
|
+
RETURNS trigger AS $$
|
|
282
|
+
BEGIN
|
|
283
|
+
IF OLD.quarantine_archive_at IS NOT NULL
|
|
284
|
+
AND OLD.quarantine_archive_at IS DISTINCT FROM NEW.quarantine_archive_at THEN
|
|
285
|
+
RAISE EXCEPTION 'platform account reset archive stamp is immutable';
|
|
286
|
+
END IF;
|
|
287
|
+
RETURN NEW;
|
|
288
|
+
END;
|
|
289
|
+
$$ LANGUAGE plpgsql
|
|
290
|
+
`);
|
|
291
|
+
await pool.query(`
|
|
292
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_rollback_preview_append_only_v1()
|
|
293
|
+
RETURNS trigger AS $$
|
|
294
|
+
BEGIN
|
|
295
|
+
RAISE EXCEPTION 'platform account reset rollback previews are append-only';
|
|
296
|
+
END;
|
|
297
|
+
$$ LANGUAGE plpgsql
|
|
298
|
+
`);
|
|
299
|
+
await pool.query(`
|
|
300
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_target_guard() RETURNS trigger AS $$
|
|
301
|
+
BEGIN
|
|
302
|
+
IF TG_OP = 'DELETE' THEN
|
|
303
|
+
RAISE EXCEPTION 'platform account reset targets cannot be deleted';
|
|
304
|
+
END IF;
|
|
305
|
+
IF OLD.operation_id IS DISTINCT FROM NEW.operation_id
|
|
306
|
+
OR OLD.principal_id IS DISTINCT FROM NEW.principal_id
|
|
307
|
+
OR OLD.target_fingerprint IS DISTINCT FROM NEW.target_fingerprint
|
|
308
|
+
OR OLD.source_snapshot_fingerprint IS DISTINCT FROM NEW.source_snapshot_fingerprint THEN
|
|
309
|
+
RAISE EXCEPTION 'platform account reset target identity is immutable';
|
|
310
|
+
END IF;
|
|
311
|
+
IF NOT platform_account_reset_transition_allowed(OLD.lifecycle, NEW.lifecycle) THEN
|
|
312
|
+
RAISE EXCEPTION 'platform account reset target lifecycle transition is invalid';
|
|
313
|
+
END IF;
|
|
314
|
+
RETURN NEW;
|
|
315
|
+
END;
|
|
316
|
+
$$ LANGUAGE plpgsql
|
|
317
|
+
`);
|
|
318
|
+
await pool.query(`
|
|
319
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_event_append_only() RETURNS trigger AS $$
|
|
320
|
+
BEGIN
|
|
321
|
+
RAISE EXCEPTION 'platform account reset events are append-only';
|
|
322
|
+
END;
|
|
323
|
+
$$ LANGUAGE plpgsql
|
|
324
|
+
`);
|
|
325
|
+
await pool.query(`
|
|
326
|
+
CREATE OR REPLACE FUNCTION platform_signup_email_lock_key(
|
|
327
|
+
realm text, normalized_email text
|
|
328
|
+
) RETURNS text AS $$
|
|
329
|
+
SELECT 'platform-email:'
|
|
330
|
+
|| octet_length(convert_to(realm, 'UTF8'))::text
|
|
331
|
+
|| ':' || realm || ':' || normalized_email
|
|
332
|
+
$$ LANGUAGE sql IMMUTABLE STRICT
|
|
333
|
+
`);
|
|
334
|
+
await pool.query(`
|
|
335
|
+
CREATE OR REPLACE FUNCTION platform_account_reset_reservation_fence() RETURNS trigger AS $$
|
|
336
|
+
BEGIN
|
|
337
|
+
PERFORM pg_advisory_xact_lock(
|
|
338
|
+
hashtextextended(platform_signup_email_lock_key(NEW.realm, NEW.normalized_email), 0)
|
|
339
|
+
);
|
|
340
|
+
IF to_regclass('platform_identity_sync_outbox') IS NOT NULL
|
|
341
|
+
AND EXISTS (
|
|
342
|
+
SELECT 1
|
|
343
|
+
FROM platform_identity_sync_outbox o
|
|
344
|
+
WHERE o.delivered_at IS NULL
|
|
345
|
+
AND o.failed_at IS NULL
|
|
346
|
+
AND o.lease_token IS NOT NULL
|
|
347
|
+
AND (
|
|
348
|
+
o.lease_workos_realm IS NULL
|
|
349
|
+
OR o.lease_normalized_email IS NULL
|
|
350
|
+
OR o.lease_mode IS NULL
|
|
351
|
+
OR (
|
|
352
|
+
o.lease_mode = 'unlinked_create'
|
|
353
|
+
AND o.lease_workos_realm = NEW.realm
|
|
354
|
+
AND o.lease_normalized_email = NEW.normalized_email
|
|
355
|
+
)
|
|
356
|
+
)
|
|
357
|
+
) THEN
|
|
358
|
+
RAISE EXCEPTION 'identity sync create is in flight';
|
|
359
|
+
END IF;
|
|
360
|
+
IF to_regclass('platform_identity_links') IS NOT NULL
|
|
361
|
+
AND to_regclass('platform_verified_emails') IS NOT NULL
|
|
362
|
+
AND (
|
|
363
|
+
EXISTS (
|
|
364
|
+
SELECT 1
|
|
365
|
+
FROM platform_identity_links l
|
|
366
|
+
WHERE l.principal_id = NEW.principal_id
|
|
367
|
+
AND l.provider = 'workos'
|
|
368
|
+
AND l.realm = NEW.realm
|
|
369
|
+
AND l.disabled_at IS NULL
|
|
370
|
+
)
|
|
371
|
+
OR EXISTS (
|
|
372
|
+
SELECT 1
|
|
373
|
+
FROM platform_identity_links l
|
|
374
|
+
JOIN platform_verified_emails e ON e.principal_id = l.principal_id
|
|
375
|
+
WHERE l.provider = 'workos'
|
|
376
|
+
AND l.realm = NEW.realm
|
|
377
|
+
AND l.disabled_at IS NULL
|
|
378
|
+
AND e.normalized_email = NEW.normalized_email
|
|
379
|
+
AND e.status = 'active'
|
|
380
|
+
)
|
|
381
|
+
) THEN
|
|
382
|
+
RAISE EXCEPTION 'platform account reset reservation identity drift';
|
|
383
|
+
END IF;
|
|
384
|
+
RETURN NEW;
|
|
385
|
+
END;
|
|
386
|
+
$$ LANGUAGE plpgsql
|
|
387
|
+
`);
|
|
388
|
+
await pool.query(`
|
|
389
|
+
DROP TRIGGER IF EXISTS platform_account_reset_operation_guard_trigger
|
|
390
|
+
ON platform_account_reset_operations;
|
|
391
|
+
CREATE TRIGGER platform_account_reset_operation_guard_trigger
|
|
392
|
+
BEFORE UPDATE OR DELETE ON platform_account_reset_operations
|
|
393
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_operation_guard();
|
|
394
|
+
DROP TRIGGER IF EXISTS platform_account_reset_target_guard_trigger
|
|
395
|
+
ON platform_account_reset_targets;
|
|
396
|
+
CREATE TRIGGER platform_account_reset_target_guard_trigger
|
|
397
|
+
BEFORE UPDATE OR DELETE ON platform_account_reset_targets
|
|
398
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_target_guard();
|
|
399
|
+
DROP TRIGGER IF EXISTS platform_account_reset_cleanup_guard_trigger
|
|
400
|
+
ON platform_account_reset_cleanup_ledger;
|
|
401
|
+
CREATE TRIGGER platform_account_reset_cleanup_guard_trigger
|
|
402
|
+
BEFORE UPDATE OR DELETE ON platform_account_reset_cleanup_ledger
|
|
403
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_cleanup_guard();
|
|
404
|
+
DROP TRIGGER IF EXISTS platform_account_reset_action_evidence_guard_v1_trigger
|
|
405
|
+
ON platform_account_reset_operations;
|
|
406
|
+
CREATE TRIGGER platform_account_reset_action_evidence_guard_v1_trigger
|
|
407
|
+
BEFORE UPDATE ON platform_account_reset_operations
|
|
408
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_action_evidence_guard_v1();
|
|
409
|
+
DROP TRIGGER IF EXISTS platform_account_reset_archive_stamp_guard_v1_trigger
|
|
410
|
+
ON platform_account_reset_cleanup_ledger;
|
|
411
|
+
CREATE TRIGGER platform_account_reset_archive_stamp_guard_v1_trigger
|
|
412
|
+
BEFORE UPDATE ON platform_account_reset_cleanup_ledger
|
|
413
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_archive_stamp_guard_v1();
|
|
414
|
+
DROP TRIGGER IF EXISTS platform_account_reset_rollback_preview_append_only_v1_trigger
|
|
415
|
+
ON platform_account_reset_rollback_previews;
|
|
416
|
+
CREATE TRIGGER platform_account_reset_rollback_preview_append_only_v1_trigger
|
|
417
|
+
BEFORE UPDATE OR DELETE ON platform_account_reset_rollback_previews
|
|
418
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_rollback_preview_append_only_v1();
|
|
419
|
+
DROP TRIGGER IF EXISTS platform_account_reset_event_append_only_trigger
|
|
420
|
+
ON platform_account_reset_events;
|
|
421
|
+
CREATE TRIGGER platform_account_reset_event_append_only_trigger
|
|
422
|
+
BEFORE UPDATE OR DELETE ON platform_account_reset_events
|
|
423
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_event_append_only();
|
|
424
|
+
DROP TRIGGER IF EXISTS platform_account_reset_reservation_fence_trigger
|
|
425
|
+
ON platform_account_reset_email_reservations;
|
|
426
|
+
CREATE TRIGGER platform_account_reset_reservation_fence_trigger
|
|
427
|
+
BEFORE INSERT ON platform_account_reset_email_reservations
|
|
428
|
+
FOR EACH ROW EXECUTE FUNCTION platform_account_reset_reservation_fence()
|
|
429
|
+
`);
|
|
430
|
+
await pool.query(`
|
|
431
|
+
REVOKE ALL ON platform_account_reset_operations,
|
|
432
|
+
platform_account_reset_targets,
|
|
433
|
+
platform_account_reset_email_reservations,
|
|
434
|
+
platform_account_reset_cleanup_ledger,
|
|
435
|
+
platform_account_reset_events,
|
|
436
|
+
platform_account_reset_rollback_previews FROM PUBLIC
|
|
437
|
+
`);
|
|
438
|
+
}
|
|
439
|
+
//# sourceMappingURL=platform-account-reset-schema-postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-schema-postgres.js","sourceRoot":"","sources":["../src/platform-account-reset-schema-postgres.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC,CACpD,IAA+B;IAE/B,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CACd,+gBAA+gB,CAChhB,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;GAKhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;GAchB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;GAWhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;GAkBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;GAehB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;GAgBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;GAGhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;GAKhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;GAIhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;GAahB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;GAoBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;GAWhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;GAOhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;GAkBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;GAMhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;GAQhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyChB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;GAOhB,CAAC,CAAC;AACL,CAAC"}
|