@noodleseed/one 0.63.0 → 0.64.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/auth-discovery.d.ts +17 -0
- package/dist/auth-discovery.d.ts.map +1 -0
- package/dist/auth-discovery.js +54 -0
- package/dist/auth-discovery.js.map +1 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/catalog-data-platform-auth.d.ts +7 -0
- package/dist/commands/catalog-data-platform-auth.d.ts.map +1 -0
- package/dist/commands/catalog-data-platform-auth.js +47 -0
- package/dist/commands/catalog-data-platform-auth.js.map +1 -0
- package/dist/commands/catalog.d.ts.map +1 -1
- package/dist/commands/catalog.js +6 -3
- package/dist/commands/catalog.js.map +1 -1
- package/dist/commands/docs-mcp.d.ts +3 -3
- package/dist/commands/docs-mcp.js +3 -3
- package/dist/commands/platform-auth-finalization-args.d.ts +13 -0
- package/dist/commands/platform-auth-finalization-args.d.ts.map +1 -0
- package/dist/commands/platform-auth-finalization-args.js +29 -0
- package/dist/commands/platform-auth-finalization-args.js.map +1 -0
- package/dist/commands/platform-auth-migration-args.d.ts +71 -0
- package/dist/commands/platform-auth-migration-args.d.ts.map +1 -0
- package/dist/commands/platform-auth-migration-args.js +320 -0
- package/dist/commands/platform-auth-migration-args.js.map +1 -0
- package/dist/commands/platform-auth-migration-ops.d.ts +3 -0
- package/dist/commands/platform-auth-migration-ops.d.ts.map +1 -0
- package/dist/commands/platform-auth-migration-ops.js +369 -0
- package/dist/commands/platform-auth-migration-ops.js.map +1 -0
- package/dist/commands/project-setup.js +1 -1
- package/dist/commands/project-setup.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/control-plane.d.ts +0 -11
- package/dist/control-plane.d.ts.map +1 -1
- package/dist/control-plane.js +1 -8
- package/dist/control-plane.js.map +1 -1
- package/dist/doctor.d.ts.map +1 -1
- package/dist/doctor.js +3 -5
- package/dist/doctor.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js +4 -0
- package/node_modules/@noodle-borg/agent-kit/dist/curated/command-groups.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.d.ts.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js +1 -0
- package/node_modules/@noodle-borg/agent-kit/dist/generated/surface.js.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts +2 -2
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.d.ts.map +1 -1
- package/node_modules/@noodle-borg/auth/dist/jwt-issuer.js +1 -1
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts +1 -1
- package/node_modules/@noodle-borg/auth/dist/verify.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts +26 -0
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js +105 -1
- package/node_modules/@noodle-borg/service/dist/auth/deploy-gate.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js +99 -0
- package/node_modules/@noodle-borg/service/dist/control-plane-auth-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/index.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +15 -0
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/main.js +112 -19
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.js +9 -1
- package/node_modules/@noodle-borg/service/dist/oauth/app.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts +24 -0
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js +88 -0
- package/node_modules/@noodle-borg/service/dist/oauth/authorization-initiation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/branding.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/oauth/branding.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/branding.js +3 -2
- package/node_modules/@noodle-borg/service/dist/oauth/branding.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-claims.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts +5 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js +19 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent-token.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/consent.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js +216 -28
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-page.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js +62 -0
- package/node_modules/@noodle-borg/service/dist/oauth/first-party-client.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.js +20 -0
- package/node_modules/@noodle-borg/service/dist/oauth/metadata.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/paths.js +2 -0
- package/node_modules/@noodle-borg/service/dist/oauth/paths.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js +58 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-guard.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js +49 -0
- package/node_modules/@noodle-borg/service/dist/oauth/platform-principal-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js +7 -0
- package/node_modules/@noodle-borg/service/dist/oauth/postgres-time.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts +20 -25
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js +105 -196
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js +157 -0
- package/node_modules/@noodle-borg/service/dist/oauth/service-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js +110 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +7 -4
- 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 +63 -120
- 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 +19 -6
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.js +24 -2
- package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/tokens.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js +8 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-availability.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js +109 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js +30 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts +21 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +56 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts +30 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js +94 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts +33 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js +27 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-human.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js +63 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-provider-choice.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js +40 -0
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-rollout-store.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts +115 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js +310 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos-events.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts +65 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.js +85 -0
- package/node_modules/@noodle-borg/service/dist/oauth/workos.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/options.d.ts +11 -2
- package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/personal-workspace.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/personal-workspace.js +8 -2
- package/node_modules/@noodle-borg/service/dist/personal-workspace.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts +67 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js +54 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts +25 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js +61 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-frozen-candidate-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts +32 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js +231 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js +350 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts +50 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js +239 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts +66 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js +77 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-paging.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts +40 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js +355 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js +230 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts +20 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js +126 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js +86 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-sources.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts +42 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js +368 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts +86 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js +474 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-runs-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js +435 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts +202 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js +313 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-migration.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts +48 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js +158 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-batches.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts +43 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js +92 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-effects.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts +31 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js +94 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-operation-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts +102 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js +2 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-ports.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js +367 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts +10 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js +37 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-remote-status.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js +156 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-rollout.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts +4 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js +162 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts +92 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js +271 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js +67 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-state-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js +47 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts +1569 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js +274 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js +163 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js +274 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts +3 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js +120 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts +79 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js +88 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js +38 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollback-guard.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts +61 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js +292 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts +19 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js +121 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-readiness-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts +119 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js +194 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js +93 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts +32 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js +68 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts +36 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js +92 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-maintenance.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts +23 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js +231 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js +399 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js +25 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-enqueue.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts +15 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js +74 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-evidence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts +19 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js +249 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts +34 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js +275 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts +98 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js +179 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts +110 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.js +312 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts +6 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/auth-discovery.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/billing-read.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-read.js +3 -9
- package/node_modules/@noodle-borg/service/dist/routes/billing-read.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js +3 -3
- package/node_modules/@noodle-borg/service/dist/routes/billing-stripe.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js +3 -1
- package/node_modules/@noodle-borg/service/dist/routes/github-run-claim.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js +40 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration-dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js +158 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-auth-migration.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +21 -3
- 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 +61 -146
- package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts +1 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.js +3 -0
- package/node_modules/@noodle-borg/service/dist/service-resource-cleanup.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 +17 -29
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/control-plane.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/control-plane.js +60 -19
- package/node_modules/@noodle-borg/service/dist/store/control-plane.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts +1 -2
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js +0 -40
- package/node_modules/@noodle-borg/service/dist/store/postgres-control-plane.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts +5 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js +176 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-personal-workspace.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js +43 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-schema.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js +2 -1
- package/node_modules/@noodle-borg/service/dist/store/postgres-signup.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts +71 -0
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/workos-directory.js +175 -0
- package/node_modules/@noodle-borg/service/dist/workos-directory.js.map +1 -0
- package/node_modules/@noodle-borg/service/package.json +1 -0
- package/node_modules/@workos-inc/node/LICENSE +21 -0
- package/node_modules/@workos-inc/node/README.md +140 -0
- package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.cts +9727 -0
- package/node_modules/@workos-inc/node/lib/factory-B8vTFojy.d.mts +9727 -0
- package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs +8426 -0
- package/node_modules/@workos-inc/node/lib/factory-CoKXdPX2.cjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs +8241 -0
- package/node_modules/@workos-inc/node/lib/factory-MKPb5Egh.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.cjs +449 -0
- package/node_modules/@workos-inc/node/lib/index.cjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.d.cts +478 -0
- package/node_modules/@workos-inc/node/lib/index.d.mts +478 -0
- package/node_modules/@workos-inc/node/lib/index.mjs +394 -0
- package/node_modules/@workos-inc/node/lib/index.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.worker.cjs +60 -0
- package/node_modules/@workos-inc/node/lib/index.worker.cjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/index.worker.d.cts +16 -0
- package/node_modules/@workos-inc/node/lib/index.worker.d.mts +16 -0
- package/node_modules/@workos-inc/node/lib/index.worker.mjs +35 -0
- package/node_modules/@workos-inc/node/lib/index.worker.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs +3224 -0
- package/node_modules/@workos-inc/node/lib/webapi-BgpV54gi.mjs.map +1 -0
- package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs +3271 -0
- package/node_modules/@workos-inc/node/lib/webapi-BzGFatFp.cjs.map +1 -0
- package/node_modules/@workos-inc/node/package.json +96 -0
- package/package.json +2 -1
|
@@ -0,0 +1,274 @@
|
|
|
1
|
+
import { randomUUID } from 'node:crypto';
|
|
2
|
+
import { PlatformAuthMigrationError } from './platform-auth-migration.js';
|
|
3
|
+
import { assertRemoteVerificationRunBinding as assertRunBinding, remoteVerificationCandidateCount as candidateCount, remoteVerificationEvidenceParameters as evidenceParameters, remoteVerificationFingerprint as fingerprint, remoteVerificationProgress as progressFor, REMOTE_VERIFICATION_SWEEP_SELECT as SWEEP_SELECT, REMOTE_VERIFICATION_TARGET_SELECT as TARGET_SELECT, remoteVerificationTarget as targetFromRow, validateRemoteVerificationEvidence as validateEvidence, validateRemoteVerificationScope as validateScope, validRemoteVerificationSweepId as validSweepId, } from './platform-auth-remote-verification-postgres-support.js';
|
|
4
|
+
const MAX_BATCH_SIZE = 100;
|
|
5
|
+
const BATCH_LEASE_SECONDS = 15 * 60;
|
|
6
|
+
export class PostgresPlatformAuthRemoteVerificationStore {
|
|
7
|
+
#pool;
|
|
8
|
+
constructor(pool) {
|
|
9
|
+
this.#pool = pool;
|
|
10
|
+
}
|
|
11
|
+
async beginOrResumeSweep(scope, freshAfter) {
|
|
12
|
+
validateScope(scope, freshAfter);
|
|
13
|
+
const connection = await this.#connection();
|
|
14
|
+
try {
|
|
15
|
+
await connection.query('BEGIN');
|
|
16
|
+
await connection.query('SELECT pg_advisory_xact_lock(hashtextextended($1, 0))', [
|
|
17
|
+
`platform-auth-remote-verification:${fingerprint(scope)}`,
|
|
18
|
+
]);
|
|
19
|
+
await assertRunBinding(connection, scope);
|
|
20
|
+
const latest = await connection.query(`${SWEEP_SELECT} WHERE inventory_run_id = $1 AND import_run_id = $2
|
|
21
|
+
AND provider = $3 AND realm_fingerprint = $4 ORDER BY id DESC LIMIT 1 FOR UPDATE`, [scope.inventoryRunId, scope.importRunId, scope.provider, fingerprint(scope.realm)]);
|
|
22
|
+
const current = latest.rows[0];
|
|
23
|
+
if (current !== undefined) {
|
|
24
|
+
const completedFresh = current.completed_at !== null && current.completed_at.getTime() >= freshAfter.getTime();
|
|
25
|
+
const mismatchRetryPending = current.state === 'completed' &&
|
|
26
|
+
current.verified_count < current.candidate_count &&
|
|
27
|
+
current.retry_at !== null &&
|
|
28
|
+
current.retry_at.getTime() > Date.now();
|
|
29
|
+
if (current.state === 'running' ||
|
|
30
|
+
(current.verified_count === current.candidate_count && completedFresh) ||
|
|
31
|
+
mismatchRetryPending) {
|
|
32
|
+
const progress = await progressFor(connection, current);
|
|
33
|
+
await connection.query('COMMIT');
|
|
34
|
+
return progress;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const count = await candidateCount(connection, scope.inventoryRunId);
|
|
38
|
+
const inserted = await connection.query(`INSERT INTO platform_auth_remote_verification_sweeps
|
|
39
|
+
(inventory_run_id, import_run_id, provider, realm, realm_fingerprint, candidate_count)
|
|
40
|
+
VALUES ($1, $2, $3, $4, $5, $6)
|
|
41
|
+
RETURNING id::text, state, started_at, completed_at, retry_at,
|
|
42
|
+
candidate_count, verified_count`, [
|
|
43
|
+
scope.inventoryRunId,
|
|
44
|
+
scope.importRunId,
|
|
45
|
+
scope.provider,
|
|
46
|
+
scope.realm,
|
|
47
|
+
fingerprint(scope.realm),
|
|
48
|
+
count,
|
|
49
|
+
]);
|
|
50
|
+
const row = inserted.rows[0];
|
|
51
|
+
if (row === undefined)
|
|
52
|
+
throw new PlatformAuthMigrationError('reconciliation_drift');
|
|
53
|
+
await connection.query('COMMIT');
|
|
54
|
+
return {
|
|
55
|
+
sweepId: row.id,
|
|
56
|
+
state: row.state,
|
|
57
|
+
startedAt: row.started_at,
|
|
58
|
+
candidateCount: row.candidate_count,
|
|
59
|
+
checkedCount: 0,
|
|
60
|
+
verifiedCount: 0,
|
|
61
|
+
allVerified: false,
|
|
62
|
+
hasMore: true,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (error) {
|
|
66
|
+
await connection.query('ROLLBACK').catch(() => undefined);
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
69
|
+
finally {
|
|
70
|
+
connection.release?.();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async claimBatch(sweepId, limit) {
|
|
74
|
+
if (!validSweepId(sweepId) || !Number.isInteger(limit) || limit < 1 || limit > MAX_BATCH_SIZE)
|
|
75
|
+
throw new PlatformAuthMigrationError('invalid_import');
|
|
76
|
+
const connection = await this.#connection();
|
|
77
|
+
try {
|
|
78
|
+
await connection.query('BEGIN');
|
|
79
|
+
const sweeps = await connection.query(`SELECT id::text, state, started_at, completed_at, retry_at,
|
|
80
|
+
candidate_count, verified_count,
|
|
81
|
+
provider, realm, inventory_run_id, import_run_id
|
|
82
|
+
FROM platform_auth_remote_verification_sweeps sweep
|
|
83
|
+
WHERE id = $1 AND state = 'running' AND NOT EXISTS (
|
|
84
|
+
SELECT 1 FROM platform_auth_remote_verification_sweeps newer
|
|
85
|
+
WHERE newer.inventory_run_id = sweep.inventory_run_id
|
|
86
|
+
AND newer.import_run_id = sweep.import_run_id AND newer.provider = sweep.provider
|
|
87
|
+
AND newer.realm_fingerprint = sweep.realm_fingerprint AND newer.id > sweep.id)
|
|
88
|
+
FOR UPDATE`, [sweepId]);
|
|
89
|
+
const sweep = sweeps.rows[0];
|
|
90
|
+
if (sweep?.provider === undefined ||
|
|
91
|
+
sweep.realm === undefined ||
|
|
92
|
+
sweep.inventory_run_id === undefined ||
|
|
93
|
+
sweep.import_run_id === undefined)
|
|
94
|
+
throw new PlatformAuthMigrationError('stale_lease');
|
|
95
|
+
const rows = await connection.query(`${TARGET_SELECT}
|
|
96
|
+
LEFT JOIN platform_auth_remote_verification_targets claimed
|
|
97
|
+
ON claimed.sweep_id = $4 AND claimed.candidate_fingerprint = candidate.candidate_fingerprint
|
|
98
|
+
LEFT JOIN platform_auth_remote_verification_evidence evidence
|
|
99
|
+
ON evidence.sweep_id = $4 AND evidence.candidate_fingerprint = candidate.candidate_fingerprint
|
|
100
|
+
WHERE candidate.migration_run_id = $1 AND evidence.sweep_id IS NULL
|
|
101
|
+
AND (claimed.sweep_id IS NULL OR (
|
|
102
|
+
(claimed.lease_token IS NULL OR claimed.lease_expires_at <= now())
|
|
103
|
+
AND (claimed.retry_at IS NULL OR claimed.retry_at <= now())))
|
|
104
|
+
ORDER BY candidate.candidate_fingerprint
|
|
105
|
+
LIMIT $5 FOR UPDATE OF candidate SKIP LOCKED`, [sweep.inventory_run_id, sweep.import_run_id, sweep.realm, sweepId, limit]);
|
|
106
|
+
const leases = [];
|
|
107
|
+
for (const row of rows.rows) {
|
|
108
|
+
const target = targetFromRow(row);
|
|
109
|
+
const leaseToken = randomUUID();
|
|
110
|
+
const claimed = await connection.query(`INSERT INTO platform_auth_remote_verification_targets
|
|
111
|
+
(sweep_id, candidate_fingerprint, lease_token, lease_expires_at, attempt_count)
|
|
112
|
+
VALUES ($1, $2, $3, now() + make_interval(secs => $4), 1)
|
|
113
|
+
ON CONFLICT (sweep_id, candidate_fingerprint) DO UPDATE
|
|
114
|
+
SET lease_token = EXCLUDED.lease_token, lease_expires_at = EXCLUDED.lease_expires_at,
|
|
115
|
+
retry_at = NULL,
|
|
116
|
+
attempt_count = platform_auth_remote_verification_targets.attempt_count + 1
|
|
117
|
+
WHERE (platform_auth_remote_verification_targets.lease_token IS NULL
|
|
118
|
+
OR platform_auth_remote_verification_targets.lease_expires_at <= now())
|
|
119
|
+
AND (platform_auth_remote_verification_targets.retry_at IS NULL
|
|
120
|
+
OR platform_auth_remote_verification_targets.retry_at <= now())
|
|
121
|
+
RETURNING attempt_count`, [sweepId, target.candidateFingerprint, leaseToken, BATCH_LEASE_SECONDS]);
|
|
122
|
+
const attempt = claimed.rows[0]?.attempt_count;
|
|
123
|
+
if (attempt !== undefined)
|
|
124
|
+
leases.push({ sweepId, leaseToken, attempt, target });
|
|
125
|
+
}
|
|
126
|
+
await connection.query('COMMIT');
|
|
127
|
+
return leases;
|
|
128
|
+
}
|
|
129
|
+
catch (error) {
|
|
130
|
+
await connection.query('ROLLBACK').catch(() => undefined);
|
|
131
|
+
throw error;
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
connection.release?.();
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async recordEvidence(input) {
|
|
138
|
+
validateEvidence(input);
|
|
139
|
+
const inserted = await this.#pool.query(`WITH released AS (
|
|
140
|
+
UPDATE platform_auth_remote_verification_targets
|
|
141
|
+
SET lease_token = NULL, lease_expires_at = NULL, retry_at = NULL
|
|
142
|
+
WHERE sweep_id = $1 AND candidate_fingerprint = $2 AND lease_token = $3
|
|
143
|
+
AND attempt_count = $4 AND lease_expires_at > now()
|
|
144
|
+
RETURNING sweep_id, candidate_fingerprint
|
|
145
|
+
) INSERT INTO platform_auth_remote_verification_evidence
|
|
146
|
+
(sweep_id, candidate_fingerprint, outcome_code, principal_id, external_id,
|
|
147
|
+
normalized_email, remote_user_id, local_binding_ready, principal_fingerprint,
|
|
148
|
+
external_id_fingerprint, email_fingerprint, expected_remote_user_fingerprint,
|
|
149
|
+
observed_remote_user_fingerprint, observed_external_id_fingerprint,
|
|
150
|
+
observed_email_fingerprint, observed_email_verified)
|
|
151
|
+
SELECT sweep_id, candidate_fingerprint, $5, $6, $7, $8, $9, $10,
|
|
152
|
+
$11, $12, $13, $14, $15, $16, $17, $18 FROM released
|
|
153
|
+
RETURNING candidate_fingerprint`, evidenceParameters(input));
|
|
154
|
+
if (inserted.rows[0] === undefined)
|
|
155
|
+
throw new PlatformAuthMigrationError('stale_lease');
|
|
156
|
+
}
|
|
157
|
+
async deferVerification(input) {
|
|
158
|
+
if (!Number.isFinite(input.retryAt.getTime()))
|
|
159
|
+
throw new PlatformAuthMigrationError('invalid_import');
|
|
160
|
+
const updated = await this.#pool.query(`UPDATE platform_auth_remote_verification_targets
|
|
161
|
+
SET lease_token = NULL, lease_expires_at = NULL, retry_at = $5
|
|
162
|
+
WHERE sweep_id = $1 AND candidate_fingerprint = $2 AND lease_token = $3
|
|
163
|
+
AND attempt_count = $4 AND lease_expires_at > now()
|
|
164
|
+
RETURNING candidate_fingerprint`, [
|
|
165
|
+
input.lease.sweepId,
|
|
166
|
+
input.lease.target.candidateFingerprint,
|
|
167
|
+
input.lease.leaseToken,
|
|
168
|
+
input.lease.attempt,
|
|
169
|
+
input.retryAt,
|
|
170
|
+
]);
|
|
171
|
+
if (updated.rows[0] === undefined)
|
|
172
|
+
throw new PlatformAuthMigrationError('stale_lease');
|
|
173
|
+
}
|
|
174
|
+
async progress(sweepId) {
|
|
175
|
+
if (!validSweepId(sweepId))
|
|
176
|
+
throw new PlatformAuthMigrationError('invalid_import');
|
|
177
|
+
const connection = await this.#connection();
|
|
178
|
+
try {
|
|
179
|
+
await connection.query('BEGIN');
|
|
180
|
+
const result = await connection.query(`${SWEEP_SELECT} WHERE id = $1 FOR UPDATE`, [
|
|
181
|
+
sweepId,
|
|
182
|
+
]);
|
|
183
|
+
const sweep = result.rows[0];
|
|
184
|
+
if (sweep === undefined)
|
|
185
|
+
throw new PlatformAuthMigrationError('invalid_import');
|
|
186
|
+
const progress = await progressFor(connection, sweep);
|
|
187
|
+
await connection.query('COMMIT');
|
|
188
|
+
return progress;
|
|
189
|
+
}
|
|
190
|
+
catch (error) {
|
|
191
|
+
await connection.query('ROLLBACK').catch(() => undefined);
|
|
192
|
+
throw error;
|
|
193
|
+
}
|
|
194
|
+
finally {
|
|
195
|
+
connection.release?.();
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
async readiness(scope) {
|
|
199
|
+
validateScope(scope, scope.freshAfter);
|
|
200
|
+
await assertRunBinding(this.#pool, scope);
|
|
201
|
+
const latest = await this.#pool.query(`${SWEEP_SELECT} WHERE inventory_run_id = $1 AND import_run_id = $2
|
|
202
|
+
AND provider = $3 AND realm_fingerprint = $4 ORDER BY id DESC LIMIT 1`, [scope.inventoryRunId, scope.importRunId, scope.provider, fingerprint(scope.realm)]);
|
|
203
|
+
const sweep = latest.rows[0];
|
|
204
|
+
if (sweep === undefined)
|
|
205
|
+
return {
|
|
206
|
+
state: 'not_started',
|
|
207
|
+
checkedCount: 0,
|
|
208
|
+
candidateCount: await candidateCount(this.#pool, scope.inventoryRunId),
|
|
209
|
+
verifiedCount: 0,
|
|
210
|
+
ready: false,
|
|
211
|
+
};
|
|
212
|
+
const aggregate = await this.#pool.query(`SELECT count(*)::int AS candidates,
|
|
213
|
+
count(*) FILTER (WHERE evidence.outcome_code = 'verified'
|
|
214
|
+
AND evidence.principal_id = COALESCE(candidate.principal_id, candidate.source_subject)
|
|
215
|
+
AND evidence.external_id = ledger.external_id
|
|
216
|
+
AND evidence.normalized_email = candidate.normalized_email
|
|
217
|
+
AND evidence.remote_user_id = ledger.remote_user_id AND evidence.local_binding_ready
|
|
218
|
+
AND evidence.observed_email_verified
|
|
219
|
+
AND cardinality(candidate.blocker_codes) = 0 AND candidate.normalized_email IS NOT NULL
|
|
220
|
+
AND ledger.state = 'linked' AND ledger.external_id = COALESCE(candidate.principal_id, candidate.source_subject)
|
|
221
|
+
AND ledger.remote_user_id IS NOT NULL AND ledger.lease_token IS NULL
|
|
222
|
+
AND ledger.lease_expires_at IS NULL AND link.principal_id IS NOT NULL
|
|
223
|
+
AND link.disabled_at IS NULL)::int AS exact,
|
|
224
|
+
(SELECT count(*)::int FROM platform_auth_remote_verification_evidence all_evidence
|
|
225
|
+
WHERE all_evidence.sweep_id = $4) AS evidence,
|
|
226
|
+
(SELECT count(*) FILTER (WHERE all_evidence.outcome_code = 'verified')::int
|
|
227
|
+
FROM platform_auth_remote_verification_evidence all_evidence
|
|
228
|
+
WHERE all_evidence.sweep_id = $4) AS verified,
|
|
229
|
+
(SELECT min(COALESCE(target.retry_at, target.lease_expires_at))
|
|
230
|
+
FROM platform_auth_remote_verification_targets target
|
|
231
|
+
LEFT JOIN platform_auth_remote_verification_evidence target_evidence
|
|
232
|
+
ON target_evidence.sweep_id = target.sweep_id
|
|
233
|
+
AND target_evidence.candidate_fingerprint = target.candidate_fingerprint
|
|
234
|
+
WHERE target.sweep_id = $4 AND target_evidence.sweep_id IS NULL) AS retry_at
|
|
235
|
+
FROM platform_auth_inventory_candidates candidate
|
|
236
|
+
LEFT JOIN workos_import_ledger ledger
|
|
237
|
+
ON ledger.principal_id = COALESCE(candidate.principal_id, candidate.source_subject)
|
|
238
|
+
AND ledger.migration_run_id = $2 AND ledger.realm = $3
|
|
239
|
+
LEFT JOIN platform_identity_links link
|
|
240
|
+
ON link.provider = $5 AND link.realm = $3 AND link.external_id = ledger.remote_user_id
|
|
241
|
+
AND link.principal_id = COALESCE(candidate.principal_id, candidate.source_subject)
|
|
242
|
+
LEFT JOIN platform_auth_remote_verification_evidence evidence
|
|
243
|
+
ON evidence.sweep_id = $4 AND evidence.candidate_fingerprint = candidate.candidate_fingerprint
|
|
244
|
+
WHERE candidate.migration_run_id = $1`, [scope.inventoryRunId, scope.importRunId, scope.realm, sweep.id, scope.provider]);
|
|
245
|
+
const row = aggregate.rows[0] ?? {
|
|
246
|
+
candidates: 0,
|
|
247
|
+
verified: 0,
|
|
248
|
+
exact: 0,
|
|
249
|
+
evidence: 0,
|
|
250
|
+
retry_at: null,
|
|
251
|
+
};
|
|
252
|
+
const ready = sweep.state === 'completed' &&
|
|
253
|
+
sweep.completed_at !== null &&
|
|
254
|
+
sweep.completed_at.getTime() >= scope.freshAfter.getTime() &&
|
|
255
|
+
row.candidates === sweep.candidate_count &&
|
|
256
|
+
row.evidence === sweep.candidate_count &&
|
|
257
|
+
row.exact === sweep.candidate_count &&
|
|
258
|
+
sweep.verified_count === sweep.candidate_count;
|
|
259
|
+
const retryAt = sweep.retry_at ?? row.retry_at ?? undefined;
|
|
260
|
+
return {
|
|
261
|
+
sweepId: sweep.id,
|
|
262
|
+
state: ready ? 'ready' : sweep.state === 'running' ? 'running' : 'blocked',
|
|
263
|
+
checkedCount: row.evidence,
|
|
264
|
+
candidateCount: row.candidates,
|
|
265
|
+
verifiedCount: row.verified,
|
|
266
|
+
ready,
|
|
267
|
+
...(retryAt === undefined ? {} : { retryAt }),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
async #connection() {
|
|
271
|
+
return this.#pool.connect === undefined ? this.#pool : this.#pool.connect();
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
//# sourceMappingURL=platform-auth-remote-verification-postgres.js.map
|
package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-postgres.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-remote-verification-postgres.js","sourceRoot":"","sources":["../src/platform-auth-remote-verification-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0BAA0B,EAAE,MAAM,8BAA8B,CAAC;AAS1E,OAAO,EACL,kCAAkC,IAAI,gBAAgB,EACtD,gCAAgC,IAAI,cAAc,EAClD,oCAAoC,IAAI,kBAAkB,EAC1D,6BAA6B,IAAI,WAAW,EAC5C,0BAA0B,IAAI,WAAW,EACzC,gCAAgC,IAAI,YAAY,EAEhD,iCAAiC,IAAI,aAAa,EAElD,wBAAwB,IAAI,aAAa,EACzC,kCAAkC,IAAI,gBAAgB,EACtD,+BAA+B,IAAI,aAAa,EAChD,8BAA8B,IAAI,YAAY,GAC/C,MAAM,yDAAyD,CAAC;AAGjE,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,M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_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-remote-verification-schema.d.ts","sourceRoot":"","sources":["../src/platform-auth-remote-verification-schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,wBAAsB,0CAA0C,CAC9D,IAAI,EAAE,yBAAyB,GAC9B,OAAO,CAAC,IAAI,CAAC,CA4Hf"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
export async function ensurePlatformAuthRemoteVerificationSchema(pool) {
|
|
2
|
+
await pool.query(`
|
|
3
|
+
CREATE TABLE IF NOT EXISTS platform_auth_remote_verification_sweeps (
|
|
4
|
+
id bigserial PRIMARY KEY,
|
|
5
|
+
inventory_run_id text NOT NULL REFERENCES identity_migration_runs(id) ON DELETE RESTRICT,
|
|
6
|
+
import_run_id text NOT NULL REFERENCES identity_migration_runs(id) ON DELETE RESTRICT,
|
|
7
|
+
provider text NOT NULL,
|
|
8
|
+
realm text NOT NULL,
|
|
9
|
+
realm_fingerprint text NOT NULL CHECK (realm_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
10
|
+
state text NOT NULL DEFAULT 'running' CHECK (state IN ('running', 'completed')),
|
|
11
|
+
candidate_count integer NOT NULL CHECK (candidate_count >= 0),
|
|
12
|
+
verified_count integer NOT NULL DEFAULT 0
|
|
13
|
+
CHECK (verified_count >= 0 AND verified_count <= candidate_count),
|
|
14
|
+
started_at timestamptz NOT NULL DEFAULT now(),
|
|
15
|
+
completed_at timestamptz,
|
|
16
|
+
retry_at timestamptz,
|
|
17
|
+
CHECK ((state = 'running' AND completed_at IS NULL) OR
|
|
18
|
+
(state = 'completed' AND completed_at IS NOT NULL))
|
|
19
|
+
)
|
|
20
|
+
`);
|
|
21
|
+
await pool.query(`
|
|
22
|
+
CREATE INDEX IF NOT EXISTS platform_auth_remote_verification_sweeps_scope_idx
|
|
23
|
+
ON platform_auth_remote_verification_sweeps
|
|
24
|
+
(inventory_run_id, import_run_id, provider, realm_fingerprint, id DESC)
|
|
25
|
+
`);
|
|
26
|
+
await pool.query(`
|
|
27
|
+
CREATE TABLE IF NOT EXISTS platform_auth_remote_verification_targets (
|
|
28
|
+
sweep_id bigint NOT NULL REFERENCES platform_auth_remote_verification_sweeps(id) ON DELETE RESTRICT,
|
|
29
|
+
candidate_fingerprint text NOT NULL CHECK (candidate_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
30
|
+
lease_token text,
|
|
31
|
+
lease_expires_at timestamptz,
|
|
32
|
+
retry_at timestamptz,
|
|
33
|
+
attempt_count integer NOT NULL DEFAULT 0 CHECK (attempt_count >= 0),
|
|
34
|
+
PRIMARY KEY (sweep_id, candidate_fingerprint)
|
|
35
|
+
)
|
|
36
|
+
`);
|
|
37
|
+
await pool.query(`
|
|
38
|
+
CREATE TABLE IF NOT EXISTS platform_auth_remote_verification_evidence (
|
|
39
|
+
sweep_id bigint NOT NULL,
|
|
40
|
+
candidate_fingerprint text NOT NULL,
|
|
41
|
+
outcome_code text NOT NULL CHECK (outcome_code IN (
|
|
42
|
+
'verified', 'local_binding_invalid', 'not_found', 'remote_id_mismatch',
|
|
43
|
+
'external_id_mismatch', 'email_unverified', 'email_mismatch'
|
|
44
|
+
)),
|
|
45
|
+
principal_id text NOT NULL,
|
|
46
|
+
external_id text NOT NULL,
|
|
47
|
+
normalized_email text NOT NULL,
|
|
48
|
+
remote_user_id text,
|
|
49
|
+
local_binding_ready boolean NOT NULL,
|
|
50
|
+
principal_fingerprint text NOT NULL CHECK (principal_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
51
|
+
external_id_fingerprint text NOT NULL CHECK (external_id_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
52
|
+
email_fingerprint text NOT NULL CHECK (email_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
53
|
+
expected_remote_user_fingerprint text
|
|
54
|
+
CHECK (expected_remote_user_fingerprint IS NULL OR expected_remote_user_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
55
|
+
observed_remote_user_fingerprint text
|
|
56
|
+
CHECK (observed_remote_user_fingerprint IS NULL OR observed_remote_user_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
57
|
+
observed_external_id_fingerprint text
|
|
58
|
+
CHECK (observed_external_id_fingerprint IS NULL OR observed_external_id_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
59
|
+
observed_email_fingerprint text
|
|
60
|
+
CHECK (observed_email_fingerprint IS NULL OR observed_email_fingerprint ~ '^[0-9a-f]{64}$'),
|
|
61
|
+
observed_email_verified boolean,
|
|
62
|
+
checked_at timestamptz NOT NULL DEFAULT now(),
|
|
63
|
+
PRIMARY KEY (sweep_id, candidate_fingerprint),
|
|
64
|
+
FOREIGN KEY (sweep_id, candidate_fingerprint)
|
|
65
|
+
REFERENCES platform_auth_remote_verification_targets(sweep_id, candidate_fingerprint)
|
|
66
|
+
ON DELETE RESTRICT
|
|
67
|
+
)
|
|
68
|
+
`);
|
|
69
|
+
await pool.query(`
|
|
70
|
+
CREATE OR REPLACE FUNCTION reject_platform_auth_remote_verification_evidence_mutation()
|
|
71
|
+
RETURNS trigger LANGUAGE plpgsql AS $$
|
|
72
|
+
BEGIN
|
|
73
|
+
RAISE EXCEPTION 'platform auth remote verification evidence is append-only';
|
|
74
|
+
END;
|
|
75
|
+
$$
|
|
76
|
+
`);
|
|
77
|
+
await pool.query(`
|
|
78
|
+
CREATE OR REPLACE FUNCTION enforce_platform_auth_remote_verification_target_lease()
|
|
79
|
+
RETURNS trigger LANGUAGE plpgsql AS $$
|
|
80
|
+
BEGIN
|
|
81
|
+
IF TG_OP = 'DELETE' OR OLD.sweep_id IS DISTINCT FROM NEW.sweep_id
|
|
82
|
+
OR OLD.candidate_fingerprint IS DISTINCT FROM NEW.candidate_fingerprint THEN
|
|
83
|
+
RAISE EXCEPTION 'platform auth remote verification target is immutable';
|
|
84
|
+
END IF;
|
|
85
|
+
RETURN NEW;
|
|
86
|
+
END;
|
|
87
|
+
$$
|
|
88
|
+
`);
|
|
89
|
+
await pool.query(`
|
|
90
|
+
CREATE OR REPLACE FUNCTION enforce_platform_auth_remote_verification_sweep_transition()
|
|
91
|
+
RETURNS trigger LANGUAGE plpgsql AS $$
|
|
92
|
+
BEGIN
|
|
93
|
+
IF TG_OP = 'DELETE' OR OLD.state = 'completed'
|
|
94
|
+
OR OLD.inventory_run_id IS DISTINCT FROM NEW.inventory_run_id
|
|
95
|
+
OR OLD.import_run_id IS DISTINCT FROM NEW.import_run_id
|
|
96
|
+
OR OLD.provider IS DISTINCT FROM NEW.provider OR OLD.realm IS DISTINCT FROM NEW.realm
|
|
97
|
+
OR OLD.realm_fingerprint IS DISTINCT FROM NEW.realm_fingerprint
|
|
98
|
+
OR OLD.candidate_count IS DISTINCT FROM NEW.candidate_count
|
|
99
|
+
OR OLD.started_at IS DISTINCT FROM NEW.started_at
|
|
100
|
+
OR NEW.state <> 'completed' OR NEW.completed_at IS NULL THEN
|
|
101
|
+
RAISE EXCEPTION 'platform auth remote verification sweep is immutable';
|
|
102
|
+
END IF;
|
|
103
|
+
RETURN NEW;
|
|
104
|
+
END;
|
|
105
|
+
$$
|
|
106
|
+
`);
|
|
107
|
+
await pool.query('DROP TRIGGER IF EXISTS platform_auth_remote_verification_target_lease ON platform_auth_remote_verification_targets');
|
|
108
|
+
await pool.query(`CREATE TRIGGER platform_auth_remote_verification_target_lease
|
|
109
|
+
BEFORE UPDATE OR DELETE ON platform_auth_remote_verification_targets
|
|
110
|
+
FOR EACH ROW EXECUTE FUNCTION enforce_platform_auth_remote_verification_target_lease()`);
|
|
111
|
+
await pool.query('DROP TRIGGER IF EXISTS platform_auth_remote_verification_evidence_append_only ON platform_auth_remote_verification_evidence');
|
|
112
|
+
await pool.query(`CREATE TRIGGER platform_auth_remote_verification_evidence_append_only
|
|
113
|
+
BEFORE UPDATE OR DELETE ON platform_auth_remote_verification_evidence
|
|
114
|
+
FOR EACH ROW EXECUTE FUNCTION reject_platform_auth_remote_verification_evidence_mutation()`);
|
|
115
|
+
await pool.query('DROP TRIGGER IF EXISTS platform_auth_remote_verification_sweep_transition ON platform_auth_remote_verification_sweeps');
|
|
116
|
+
await pool.query(`CREATE TRIGGER platform_auth_remote_verification_sweep_transition
|
|
117
|
+
BEFORE UPDATE OR DELETE ON platform_auth_remote_verification_sweeps
|
|
118
|
+
FOR EACH ROW EXECUTE FUNCTION enforce_platform_auth_remote_verification_sweep_transition()`);
|
|
119
|
+
}
|
|
120
|
+
//# sourceMappingURL=platform-auth-remote-verification-schema.js.map
|
package/node_modules/@noodle-borg/service/dist/platform-auth-remote-verification-schema.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-remote-verification-schema.js","sourceRoot":"","sources":["../src/platform-auth-remote-verification-schema.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,KAAK,UAAU,0CAA0C,CAC9D,IAA+B;IAE/B,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;GAkBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;GAIhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;GAUhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;GAOhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;GAWhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CAAC;;;;;;;;;;;;;;;;;GAiBhB,CAAC,CAAC;IACH,MAAM,IAAI,CAAC,KAAK,CACd,oHAAoH,CACrH,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC;;2FAEwE,CAAC,CAAC;IAC3F,MAAM,IAAI,CAAC,KAAK,CACd,6HAA6H,CAC9H,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC;;+FAE4E,CAAC,CAAC;IAC/F,MAAM,IAAI,CAAC,KAAK,CACd,uHAAuH,CACxH,CAAC;IACF,MAAM,IAAI,CAAC,KAAK,CAAC;;+FAE4E,CAAC,CAAC;AACjG,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import type { PlatformAuthDirectory } from './platform-auth-migration.js';
|
|
2
|
+
export declare const PLATFORM_AUTH_REMOTE_VERIFICATION_FRESHNESS_MS: number;
|
|
3
|
+
export declare function platformAuthRemoteVerificationFreshAfter(now?: Date): Date;
|
|
4
|
+
export type PlatformAuthRemoteVerificationOutcome = 'verified' | 'local_binding_invalid' | 'not_found' | 'remote_id_mismatch' | 'external_id_mismatch' | 'email_unverified' | 'email_mismatch';
|
|
5
|
+
export interface PlatformAuthRemoteVerificationScope {
|
|
6
|
+
readonly inventoryRunId: string;
|
|
7
|
+
readonly importRunId: string;
|
|
8
|
+
readonly provider: string;
|
|
9
|
+
readonly realm: string;
|
|
10
|
+
}
|
|
11
|
+
export interface PlatformAuthRemoteVerificationTarget {
|
|
12
|
+
readonly candidateFingerprint: string;
|
|
13
|
+
readonly principalId: string;
|
|
14
|
+
readonly externalId: string;
|
|
15
|
+
readonly verifiedEmail: string;
|
|
16
|
+
readonly remoteUserId?: string;
|
|
17
|
+
readonly localBindingReady: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface PlatformAuthRemoteVerificationLease {
|
|
20
|
+
readonly sweepId: string;
|
|
21
|
+
readonly leaseToken: string;
|
|
22
|
+
readonly attempt: number;
|
|
23
|
+
readonly target: PlatformAuthRemoteVerificationTarget;
|
|
24
|
+
}
|
|
25
|
+
export interface PlatformAuthRemoteVerificationSweepProgress {
|
|
26
|
+
readonly sweepId: string;
|
|
27
|
+
readonly state: 'running' | 'completed';
|
|
28
|
+
readonly startedAt: Date;
|
|
29
|
+
readonly candidateCount: number;
|
|
30
|
+
readonly checkedCount: number;
|
|
31
|
+
readonly verifiedCount: number;
|
|
32
|
+
readonly allVerified: boolean;
|
|
33
|
+
readonly hasMore: boolean;
|
|
34
|
+
readonly retryAt?: Date;
|
|
35
|
+
}
|
|
36
|
+
export interface PlatformAuthRemoteVerificationBatchResult extends PlatformAuthRemoteVerificationSweepProgress {
|
|
37
|
+
readonly processedCount: number;
|
|
38
|
+
}
|
|
39
|
+
export interface PlatformAuthRemoteVerificationReadiness {
|
|
40
|
+
readonly sweepId?: string;
|
|
41
|
+
readonly state: 'not_started' | 'running' | 'ready' | 'blocked';
|
|
42
|
+
readonly checkedCount: number;
|
|
43
|
+
readonly candidateCount: number;
|
|
44
|
+
readonly verifiedCount: number;
|
|
45
|
+
readonly ready: boolean;
|
|
46
|
+
readonly retryAt?: Date;
|
|
47
|
+
}
|
|
48
|
+
export interface PlatformAuthRemoteVerificationStore {
|
|
49
|
+
beginOrResumeSweep(scope: PlatformAuthRemoteVerificationScope, freshAfter: Date): Promise<PlatformAuthRemoteVerificationSweepProgress>;
|
|
50
|
+
claimBatch(sweepId: string, limit: number): Promise<readonly PlatformAuthRemoteVerificationLease[]>;
|
|
51
|
+
recordEvidence(input: {
|
|
52
|
+
readonly lease: PlatformAuthRemoteVerificationLease;
|
|
53
|
+
readonly outcome: PlatformAuthRemoteVerificationOutcome;
|
|
54
|
+
readonly observed?: {
|
|
55
|
+
readonly remoteUserId: string;
|
|
56
|
+
readonly externalId?: string;
|
|
57
|
+
readonly normalizedEmail: string;
|
|
58
|
+
readonly emailVerified: boolean;
|
|
59
|
+
};
|
|
60
|
+
}): Promise<void>;
|
|
61
|
+
deferVerification(input: {
|
|
62
|
+
readonly lease: PlatformAuthRemoteVerificationLease;
|
|
63
|
+
readonly retryAt: Date;
|
|
64
|
+
}): Promise<void>;
|
|
65
|
+
progress(sweepId: string): Promise<PlatformAuthRemoteVerificationSweepProgress>;
|
|
66
|
+
readiness(scope: PlatformAuthRemoteVerificationScope & {
|
|
67
|
+
readonly freshAfter: Date;
|
|
68
|
+
}): Promise<PlatformAuthRemoteVerificationReadiness>;
|
|
69
|
+
}
|
|
70
|
+
/** Advances one resumable WorkOS verification sweep by at most the requested bounded batch. */
|
|
71
|
+
export declare class WorkOSLinkedCandidateVerificationWorker {
|
|
72
|
+
#private;
|
|
73
|
+
constructor(store: PlatformAuthRemoteVerificationStore, directory: PlatformAuthDirectory, now?: () => Date);
|
|
74
|
+
verify(input: Omit<PlatformAuthRemoteVerificationScope, 'provider'> & {
|
|
75
|
+
readonly freshAfter: Date;
|
|
76
|
+
readonly limit: number;
|
|
77
|
+
}): Promise<PlatformAuthRemoteVerificationBatchResult>;
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=platform-auth-remote-verification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-remote-verification.d.ts","sourceRoot":"","sources":["../src/platform-auth-remote-verification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAG1E,eAAO,MAAM,8CAA8C,QAAkB,CAAC;AAI9E,wBAAgB,wCAAwC,CAAC,GAAG,OAAa,GAAG,IAAI,CAE/E;AAED,MAAM,MAAM,qCAAqC,GAC7C,UAAU,GACV,uBAAuB,GACvB,WAAW,GACX,oBAAoB,GACpB,sBAAsB,GACtB,kBAAkB,GAClB,gBAAgB,CAAC;AAErB,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,oBAAoB,EAAE,MAAM,CAAC;IACtC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC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AAM,CACV,KAAK,EAAE,IAAI,CAAC,mCAAmC,EAAE,UAAU,CAAC,GAAG;QAC7D,QAAQ,CAAC,UAAU,EAAE,IAAI,CAAC;QAC1B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;KACxB,GACA,OAAO,CAAC,yCAAyC,CAAC;CAyCtD"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { normalizePlatformIdentityEmail } from './platform-identity.js';
|
|
2
|
+
export const PLATFORM_AUTH_REMOTE_VERIFICATION_FRESHNESS_MS = 60 * 60 * 1_000;
|
|
3
|
+
const REMOTE_VERIFICATION_RETRY_BASE_MS = 5_000;
|
|
4
|
+
const REMOTE_VERIFICATION_RETRY_MAX_MS = 5 * 60 * 1_000;
|
|
5
|
+
export function platformAuthRemoteVerificationFreshAfter(now = new Date()) {
|
|
6
|
+
return new Date(now.getTime() - PLATFORM_AUTH_REMOTE_VERIFICATION_FRESHNESS_MS);
|
|
7
|
+
}
|
|
8
|
+
/** Advances one resumable WorkOS verification sweep by at most the requested bounded batch. */
|
|
9
|
+
export class WorkOSLinkedCandidateVerificationWorker {
|
|
10
|
+
#store;
|
|
11
|
+
#directory;
|
|
12
|
+
#now;
|
|
13
|
+
constructor(store, directory, now = () => new Date()) {
|
|
14
|
+
this.#store = store;
|
|
15
|
+
this.#directory = directory;
|
|
16
|
+
this.#now = now;
|
|
17
|
+
}
|
|
18
|
+
async verify(input) {
|
|
19
|
+
const scope = { ...input, provider: 'workos' };
|
|
20
|
+
const sweep = await this.#store.beginOrResumeSweep(scope, input.freshAfter);
|
|
21
|
+
if (sweep.state === 'completed')
|
|
22
|
+
return { ...sweep, processedCount: 0 };
|
|
23
|
+
const leases = await this.#store.claimBatch(sweep.sweepId, input.limit);
|
|
24
|
+
for (const lease of leases)
|
|
25
|
+
await this.#verifyOne(lease);
|
|
26
|
+
return { ...(await this.#store.progress(sweep.sweepId)), processedCount: leases.length };
|
|
27
|
+
}
|
|
28
|
+
async #verifyOne(lease) {
|
|
29
|
+
const { target } = lease;
|
|
30
|
+
if (!target.localBindingReady || target.remoteUserId === undefined) {
|
|
31
|
+
await this.#store.recordEvidence({ lease, outcome: 'local_binding_invalid' });
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
let remote;
|
|
35
|
+
try {
|
|
36
|
+
remote = await this.#directory.findUserByExternalId(target.externalId);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
await this.#store.deferVerification({
|
|
40
|
+
lease,
|
|
41
|
+
retryAt: retryAtFor(error, lease.attempt, this.#now()),
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const outcome = verificationOutcome(target, remote);
|
|
46
|
+
await this.#store.recordEvidence({
|
|
47
|
+
lease,
|
|
48
|
+
outcome,
|
|
49
|
+
...(remote === undefined
|
|
50
|
+
? {}
|
|
51
|
+
: {
|
|
52
|
+
observed: {
|
|
53
|
+
remoteUserId: remote.id,
|
|
54
|
+
...(remote.externalId === undefined ? {} : { externalId: remote.externalId }),
|
|
55
|
+
normalizedEmail: remote.normalizedEmail,
|
|
56
|
+
emailVerified: remote.verified,
|
|
57
|
+
},
|
|
58
|
+
}),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function verificationOutcome(target, remote) {
|
|
63
|
+
if (remote === undefined)
|
|
64
|
+
return 'not_found';
|
|
65
|
+
if (remote.id !== target.remoteUserId)
|
|
66
|
+
return 'remote_id_mismatch';
|
|
67
|
+
if (remote.externalId !== target.externalId)
|
|
68
|
+
return 'external_id_mismatch';
|
|
69
|
+
if (!remote.verified)
|
|
70
|
+
return 'email_unverified';
|
|
71
|
+
if (normalizePlatformIdentityEmail(remote.normalizedEmail) !== target.verifiedEmail)
|
|
72
|
+
return 'email_mismatch';
|
|
73
|
+
return 'verified';
|
|
74
|
+
}
|
|
75
|
+
function retryAtFor(error, attempt, now) {
|
|
76
|
+
if (typeof error === 'object' && error !== null && 'retryAt' in error) {
|
|
77
|
+
const retryAt = error.retryAt;
|
|
78
|
+
if (typeof retryAt === 'string') {
|
|
79
|
+
const parsed = Date.parse(retryAt);
|
|
80
|
+
if (Number.isFinite(parsed) && parsed > now.getTime())
|
|
81
|
+
return new Date(parsed);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
const exponent = Math.min(Math.max(attempt - 1, 0), 8);
|
|
85
|
+
const delay = Math.min(REMOTE_VERIFICATION_RETRY_BASE_MS * 2 ** exponent, REMOTE_VERIFICATION_RETRY_MAX_MS);
|
|
86
|
+
return new Date(now.getTime() + delay);
|
|
87
|
+
}
|
|
88
|
+
//# sourceMappingURL=platform-auth-remote-verification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-remote-verification.js","sourceRoot":"","sources":["../src/platform-auth-remote-verification.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,MAAM,wBAAwB,CAAC;AAExE,MAAM,CAAC,MAAM,8CAA8C,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,CAAC;AAC9E,MAAM,iCAAiC,GAAG,KAAK,CAAC;AAChD,MAAM,gCAAgC,GAAG,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;AAExD,MAAM,UAAU,wCAAwC,CAAC,GAAG,GAAG,IAAI,IAAI,EAAE;IACvE,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,8CAA8C,CAAC,CAAC;AAClF,CAAC;AA0FD,+FAA+F;AAC/F,MAAM,OAAO,uCAAuC;IACzC,MAAM,CAAsC;IAC5C,UAAU,CAAwB;IAClC,IAAI,CAAa;IAE1B,YACE,KAA0C,EAC1C,SAAgC,EAChC,MAAkB,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE;QAElC,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,IAAI,CAAC,IAAI,GAAG,GAAG,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S;IAC5D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,SAAS,IAAI,KAAK,EAAE,CAAC;QACtE,MAAM,OAAO,GAAI,KAAwC,CAAC,OAAO,CAAC;QAClE,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YACnC,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,MAAM,GAAG,GAAG,CAAC,OAAO,EAAE;gBAAE,OAAO,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;QACjF,CAAC;IACH,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACpB,iCAAiC,GAAG,CAAC,IAAI,QAAQ,EACjD,gCAAgC,CACjC,CAAC;IACF,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,KAAK,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type PlatformAuthOperator } from './platform-auth-operator.js';
|
|
2
|
+
/** Prevent an ordinary provider rollback from selecting Google after its human authenticator is removed. */
|
|
3
|
+
export declare function guardPlatformAuthRollback(operator: PlatformAuthOperator, options: {
|
|
4
|
+
readonly googleHumanAuthAvailable: boolean;
|
|
5
|
+
}): PlatformAuthOperator;
|
|
6
|
+
//# sourceMappingURL=platform-auth-rollback-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-rollback-guard.d.ts","sourceRoot":"","sources":["../src/platform-auth-rollback-guard.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,oBAAoB,EAI1B,MAAM,6BAA6B,CAAC;AAGrC,4GAA4G;AAC5G,wBAAgB,yBAAyB,CACvC,QAAQ,EAAE,oBAAoB,EAC9B,OAAO,EAAE;IAAE,QAAQ,CAAC,wBAAwB,EAAE,OAAO,CAAA;CAAE,GACtD,oBAAoB,CAEtB"}
|