@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,355 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { PostgresPlatformAuthLegacyInventorySources } from './platform-auth-inventory-legacy-sources-postgres.js';
|
|
3
|
+
import { PostgresPlatformAuthInventoryLocalFreezer } from './platform-auth-inventory-local-postgres.js';
|
|
4
|
+
import { compareInventoryText, completedInventory, inventoryProgress, PLATFORM_AUTH_INVENTORY_REMOTE_PAGE_SIZE, } from './platform-auth-inventory-paging.js';
|
|
5
|
+
import { PostgresPlatformAuthInventoryProgressStore } from './platform-auth-inventory-progress-postgres.js';
|
|
6
|
+
import { PlatformAuthMigrationError, } from './platform-auth-migration.js';
|
|
7
|
+
import { normalizePlatformIdentityEmail } from './platform-identity.js';
|
|
8
|
+
export { PLATFORM_AUTH_INVENTORY_SOURCES, } from './platform-auth-inventory-sources.js';
|
|
9
|
+
/**
|
|
10
|
+
* Authoritative, repeatable-read inventory. Internal frozen rows retain the source universe for later fences;
|
|
11
|
+
* this boundary returns aggregate counts and digests only.
|
|
12
|
+
*/
|
|
13
|
+
export class PostgresPlatformAuthInventoryStore {
|
|
14
|
+
#pool;
|
|
15
|
+
#googleRealm;
|
|
16
|
+
#workosRealmFingerprint;
|
|
17
|
+
#loadWorkosUsers;
|
|
18
|
+
#workosPageSource;
|
|
19
|
+
#progressStore;
|
|
20
|
+
#localFreezer;
|
|
21
|
+
#legacySources;
|
|
22
|
+
constructor(pool, options = {}) {
|
|
23
|
+
this.#pool = pool;
|
|
24
|
+
this.#googleRealm = options.googleRealm ?? 'accounts.google.com';
|
|
25
|
+
this.#workosRealmFingerprint = hash(options.workosRealm ?? 'default');
|
|
26
|
+
const workosUsers = options.workosUsers ?? [];
|
|
27
|
+
this.#loadWorkosUsers =
|
|
28
|
+
typeof workosUsers === 'function' ? workosUsers : () => Promise.resolve(workosUsers);
|
|
29
|
+
this.#workosPageSource = options.workosPageSource;
|
|
30
|
+
const excludedSubjects = options.excludedSubjects ?? [];
|
|
31
|
+
this.#progressStore = new PostgresPlatformAuthInventoryProgressStore(pool);
|
|
32
|
+
this.#localFreezer = new PostgresPlatformAuthInventoryLocalFreezer(pool, {
|
|
33
|
+
googleRealm: this.#googleRealm,
|
|
34
|
+
workosRealmFingerprint: this.#workosRealmFingerprint,
|
|
35
|
+
...(options.sourceAvailability === undefined
|
|
36
|
+
? {}
|
|
37
|
+
: { sourceAvailability: options.sourceAvailability }),
|
|
38
|
+
excludedSubjects,
|
|
39
|
+
});
|
|
40
|
+
this.#legacySources = new PostgresPlatformAuthLegacyInventorySources({
|
|
41
|
+
googleRealm: this.#googleRealm,
|
|
42
|
+
...(options.sourceAvailability === undefined
|
|
43
|
+
? {}
|
|
44
|
+
: { sourceAvailability: options.sourceAvailability }),
|
|
45
|
+
excludedSubjects,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async inspect(runId) {
|
|
49
|
+
if (this.#workosPageSource !== undefined) {
|
|
50
|
+
const advanced = await this.advance(runId);
|
|
51
|
+
if (advanced.state !== 'completed' || advanced.checksum === null)
|
|
52
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
53
|
+
return {
|
|
54
|
+
candidateCount: advanced.candidateCount,
|
|
55
|
+
excludedCount: advanced.excludedCount,
|
|
56
|
+
blockers: advanced.blockers,
|
|
57
|
+
checksum: advanced.checksum,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
return this.#inspectLegacy(runId);
|
|
61
|
+
}
|
|
62
|
+
async advance(runId) {
|
|
63
|
+
if (this.#workosPageSource === undefined) {
|
|
64
|
+
const completed = await this.#inspectLegacy(runId);
|
|
65
|
+
return {
|
|
66
|
+
state: 'completed',
|
|
67
|
+
phase: 'completed',
|
|
68
|
+
remotePages: 0,
|
|
69
|
+
remoteUsers: 0,
|
|
70
|
+
localSubjects: completed.candidateCount + completed.excludedCount,
|
|
71
|
+
candidateCount: completed.candidateCount,
|
|
72
|
+
excludedCount: completed.excludedCount,
|
|
73
|
+
blockers: completed.blockers,
|
|
74
|
+
checksum: completed.checksum,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
await this.#bindPagedRun(runId);
|
|
78
|
+
const completed = await this.#completed(runId);
|
|
79
|
+
if (completed !== undefined)
|
|
80
|
+
return completed;
|
|
81
|
+
let claim;
|
|
82
|
+
try {
|
|
83
|
+
claim = await this.#progressStore.claim(runId);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
87
|
+
}
|
|
88
|
+
if (claim.kind === 'terminal')
|
|
89
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
90
|
+
if (claim.kind === 'busy')
|
|
91
|
+
return inventoryProgress(claim.progress);
|
|
92
|
+
if (claim.lease.progress.phase === 'local')
|
|
93
|
+
return this.#advanceLocal(runId, claim.lease.token);
|
|
94
|
+
if (claim.lease.progress.phase === 'completed')
|
|
95
|
+
return (await this.#completed(runId)) ?? inventoryProgress(claim.lease.progress);
|
|
96
|
+
const after = claim.lease.progress.remote_after ?? undefined;
|
|
97
|
+
let page;
|
|
98
|
+
try {
|
|
99
|
+
page = await this.#workosPageSource.listPage({
|
|
100
|
+
limit: PLATFORM_AUTH_INVENTORY_REMOTE_PAGE_SIZE,
|
|
101
|
+
...(after === undefined ? {} : { after }),
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
await this.#progressStore.release(runId, claim.lease.token).catch(() => undefined);
|
|
106
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
107
|
+
}
|
|
108
|
+
let committed;
|
|
109
|
+
try {
|
|
110
|
+
committed = await this.#progressStore.commitRemotePage({
|
|
111
|
+
runId,
|
|
112
|
+
leaseToken: claim.lease.token,
|
|
113
|
+
...(after === undefined ? {} : { after }),
|
|
114
|
+
users: page.users,
|
|
115
|
+
...(page.nextAfter === undefined ? {} : { nextAfter: page.nextAfter }),
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if (error instanceof Error && error.message === 'invalid_remote_inventory_page')
|
|
120
|
+
await this.#progressStore.markTerminal(runId, claim.lease.token).catch(() => undefined);
|
|
121
|
+
else
|
|
122
|
+
await this.#progressStore.release(runId, claim.lease.token).catch(() => undefined);
|
|
123
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
124
|
+
}
|
|
125
|
+
if (committed.terminal)
|
|
126
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
127
|
+
if (committed.progress.phase !== 'local')
|
|
128
|
+
return inventoryProgress(committed.progress);
|
|
129
|
+
const localClaim = await this.#progressStore.claim(runId).catch(() => undefined);
|
|
130
|
+
if (localClaim?.kind !== 'leased')
|
|
131
|
+
return inventoryProgress(committed.progress);
|
|
132
|
+
return this.#advanceLocal(runId, localClaim.lease.token);
|
|
133
|
+
}
|
|
134
|
+
async #advanceLocal(runId, leaseToken) {
|
|
135
|
+
try {
|
|
136
|
+
const result = await this.#localFreezer.advance({ runId, leaseToken });
|
|
137
|
+
return inventoryProgress(result.progress, result.checksum);
|
|
138
|
+
}
|
|
139
|
+
catch (error) {
|
|
140
|
+
await this.#progressStore.release(runId, leaseToken).catch(() => undefined);
|
|
141
|
+
if (error instanceof PlatformAuthMigrationError)
|
|
142
|
+
throw error;
|
|
143
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
async #completed(runId) {
|
|
147
|
+
const result = await this.#pool.query("SELECT state, frozen_checksum, safe_result FROM identity_migration_runs WHERE id = $1 AND kind = 'inventory'", [runId]);
|
|
148
|
+
const row = result.rows[0];
|
|
149
|
+
if (row?.state !== 'completed')
|
|
150
|
+
return undefined;
|
|
151
|
+
const completed = completedInventory(row.safe_result, row.frozen_checksum);
|
|
152
|
+
const progress = await this.#progressStore.read(runId);
|
|
153
|
+
return progress === undefined
|
|
154
|
+
? {
|
|
155
|
+
state: 'completed',
|
|
156
|
+
phase: 'completed',
|
|
157
|
+
remotePages: 0,
|
|
158
|
+
remoteUsers: 0,
|
|
159
|
+
localSubjects: completed.candidateCount + completed.excludedCount,
|
|
160
|
+
candidateCount: completed.candidateCount,
|
|
161
|
+
excludedCount: completed.excludedCount,
|
|
162
|
+
blockers: completed.blockers,
|
|
163
|
+
checksum: completed.checksum,
|
|
164
|
+
}
|
|
165
|
+
: inventoryProgress(progress, completed.checksum);
|
|
166
|
+
}
|
|
167
|
+
async #bindPagedRun(runId) {
|
|
168
|
+
const current = await this.#pool.query("SELECT state, workos_realm_fingerprint FROM identity_migration_runs WHERE id = $1 AND kind = 'inventory'", [runId]);
|
|
169
|
+
const row = current.rows[0];
|
|
170
|
+
if (row?.workos_realm_fingerprint === this.#workosRealmFingerprint)
|
|
171
|
+
return;
|
|
172
|
+
if (row?.state !== 'running' || row.workos_realm_fingerprint !== null)
|
|
173
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
174
|
+
const result = await this.#pool.query(`UPDATE identity_migration_runs SET workos_realm_fingerprint = $2
|
|
175
|
+
WHERE id = $1 AND kind = 'inventory' AND state = 'running'
|
|
176
|
+
AND workos_realm_fingerprint IS NULL
|
|
177
|
+
RETURNING workos_realm_fingerprint`, [runId, this.#workosRealmFingerprint]);
|
|
178
|
+
if (result.rows[0]?.workos_realm_fingerprint !== this.#workosRealmFingerprint)
|
|
179
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
180
|
+
}
|
|
181
|
+
async #inspectLegacy(runId) {
|
|
182
|
+
const existing = await this.#pool.query("SELECT state, frozen_checksum, safe_result FROM identity_migration_runs WHERE id = $1 AND kind = 'inventory' AND state IN ('running', 'completed')", [runId]);
|
|
183
|
+
const existingRun = existing.rows[0];
|
|
184
|
+
if (existingRun === undefined)
|
|
185
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
186
|
+
if (existingRun.state === 'completed') {
|
|
187
|
+
return completedInventory(existingRun.safe_result, existingRun.frozen_checksum);
|
|
188
|
+
}
|
|
189
|
+
let workosUsers;
|
|
190
|
+
try {
|
|
191
|
+
workosUsers = await this.#loadWorkosUsers();
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
195
|
+
}
|
|
196
|
+
// Build the remote lookup once. A migration may legitimately approach the documented
|
|
197
|
+
// 200,000-user coordination threshold, so scanning the complete WorkOS snapshot once per
|
|
198
|
+
// candidate would turn inventory into an accidental O(local users x remote users) operation.
|
|
199
|
+
const workosIndex = indexWorkosUsers(workosUsers);
|
|
200
|
+
const workosSnapshotFingerprint = hash(workosIndex.fingerprintRows);
|
|
201
|
+
const connection = this.#pool.connect === undefined ? this.#pool : await this.#pool.connect();
|
|
202
|
+
try {
|
|
203
|
+
await connection.query('BEGIN ISOLATION LEVEL REPEATABLE READ');
|
|
204
|
+
await connection.query('SELECT pg_advisory_xact_lock(hashtextextended($1, 0))', [
|
|
205
|
+
'platform-auth-inventory:v1',
|
|
206
|
+
]);
|
|
207
|
+
const run = await connection.query("SELECT id, state, frozen_checksum, safe_result FROM identity_migration_runs WHERE id = $1 AND kind = 'inventory' AND state IN ('running', 'completed') FOR UPDATE", [runId]);
|
|
208
|
+
const runRow = run.rows[0];
|
|
209
|
+
if (runRow === undefined)
|
|
210
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
211
|
+
if (runRow.state === 'completed') {
|
|
212
|
+
const safe = completedInventory(runRow.safe_result, runRow.frozen_checksum);
|
|
213
|
+
await connection.query('COMMIT');
|
|
214
|
+
return safe;
|
|
215
|
+
}
|
|
216
|
+
await this.#legacySources.assertManifest(connection);
|
|
217
|
+
const discovered = await this.#legacySources.discover(connection);
|
|
218
|
+
const sources = discovered.sources;
|
|
219
|
+
const emails = await this.#legacySources.emails(connection, [...sources.values()]);
|
|
220
|
+
const emailOwners = await this.#legacySources.emailOwners(connection);
|
|
221
|
+
const blockers = {};
|
|
222
|
+
const checksumEntries = [];
|
|
223
|
+
for (const source of [...sources.values()].sort((a, b) => compareInventoryText(a.subject, b.subject))) {
|
|
224
|
+
const currentEmails = [...new Set(emails.get(source.subject) ?? [])].sort(compareInventoryText);
|
|
225
|
+
const codes = [];
|
|
226
|
+
if (source.identityDrift || source.excludedEvidence)
|
|
227
|
+
codes.push('ambiguous_platform_customer_evidence');
|
|
228
|
+
if (currentEmails.length === 0)
|
|
229
|
+
codes.push('missing_verified_email');
|
|
230
|
+
if (currentEmails.length > 1)
|
|
231
|
+
codes.push('multiple_current_verified_emails');
|
|
232
|
+
if (source.subject.length > 64)
|
|
233
|
+
codes.push('external_id_too_long');
|
|
234
|
+
if (currentEmails.some((email) => (emailOwners.get(email)?.size ?? 0) > 1))
|
|
235
|
+
codes.push('shared_verified_email');
|
|
236
|
+
if (currentEmails.some((email) => workosConflict(workosIndex, source.subject, email)))
|
|
237
|
+
codes.push('conflicting_workos_user');
|
|
238
|
+
for (const code of codes)
|
|
239
|
+
blockers[code] = (blockers[code] ?? 0) + 1;
|
|
240
|
+
const provenance = [...source.provenance].sort();
|
|
241
|
+
const sourceFingerprint = hash({
|
|
242
|
+
subject: source.subject,
|
|
243
|
+
realm: source.realm,
|
|
244
|
+
provenance,
|
|
245
|
+
});
|
|
246
|
+
const email = currentEmails.length === 1 ? currentEmails[0] : undefined;
|
|
247
|
+
const candidateFingerprint = hash({
|
|
248
|
+
sourceFingerprint,
|
|
249
|
+
principalFingerprint: source.principalId === undefined ? undefined : hash(source.principalId),
|
|
250
|
+
emailFingerprint: email === undefined ? undefined : hash(email),
|
|
251
|
+
provenance,
|
|
252
|
+
blockerCodes: codes,
|
|
253
|
+
});
|
|
254
|
+
await connection.query(`INSERT INTO platform_auth_inventory_candidates
|
|
255
|
+
(migration_run_id, source_subject, source_realm, principal_id, normalized_email, email_fingerprint, provenance, blocker_codes, source_fingerprint, candidate_fingerprint)
|
|
256
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
|
|
257
|
+
ON CONFLICT (migration_run_id, source_subject) DO NOTHING`, [
|
|
258
|
+
runId,
|
|
259
|
+
source.subject,
|
|
260
|
+
source.realm ?? this.#googleRealm,
|
|
261
|
+
source.principalId ?? null,
|
|
262
|
+
email ?? null,
|
|
263
|
+
email === undefined ? null : hash(email),
|
|
264
|
+
provenance,
|
|
265
|
+
codes,
|
|
266
|
+
sourceFingerprint,
|
|
267
|
+
candidateFingerprint,
|
|
268
|
+
]);
|
|
269
|
+
checksumEntries.push({
|
|
270
|
+
sourceFingerprint,
|
|
271
|
+
emailFingerprint: email === undefined ? undefined : hash(email),
|
|
272
|
+
provenance,
|
|
273
|
+
blockerCodes: codes,
|
|
274
|
+
candidateFingerprint,
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
const safe = {
|
|
278
|
+
candidateCount: sources.size,
|
|
279
|
+
excludedCount: discovered.excludedCount,
|
|
280
|
+
blockers,
|
|
281
|
+
};
|
|
282
|
+
// The existing opaque evidence column now commits to both excluded actors and the complete remote
|
|
283
|
+
// snapshot. Downstream lineage recomputes the inventory checksum from this frozen digest without
|
|
284
|
+
// retaining provider identifiers or emails.
|
|
285
|
+
const inventoryEvidenceFingerprint = hash({
|
|
286
|
+
excluded: discovered.excludedFingerprint,
|
|
287
|
+
workosSnapshot: workosSnapshotFingerprint,
|
|
288
|
+
});
|
|
289
|
+
const checksum = hash({
|
|
290
|
+
algorithm: 'inventory-v1',
|
|
291
|
+
googleRealm: this.#googleRealm,
|
|
292
|
+
workosRealm: this.#workosRealmFingerprint,
|
|
293
|
+
safe,
|
|
294
|
+
excludedFingerprint: inventoryEvidenceFingerprint,
|
|
295
|
+
candidates: checksumEntries,
|
|
296
|
+
});
|
|
297
|
+
const completed = await connection.query(`UPDATE identity_migration_runs
|
|
298
|
+
SET frozen_checksum = $2, source_fingerprint = $3, excluded_fingerprint = $4,
|
|
299
|
+
workos_realm_fingerprint = $5, google_realm = $6,
|
|
300
|
+
inventory_format = 'v1', safe_result = $7, state = 'completed', completed_at = now()
|
|
301
|
+
WHERE id = $1 AND state = 'running' RETURNING id`, [
|
|
302
|
+
runId,
|
|
303
|
+
checksum,
|
|
304
|
+
hash(checksumEntries),
|
|
305
|
+
inventoryEvidenceFingerprint,
|
|
306
|
+
this.#workosRealmFingerprint,
|
|
307
|
+
this.#googleRealm,
|
|
308
|
+
JSON.stringify(safe),
|
|
309
|
+
]);
|
|
310
|
+
if (completed.rows[0] === undefined)
|
|
311
|
+
throw new PlatformAuthMigrationError('inventory_unavailable');
|
|
312
|
+
await connection.query('COMMIT');
|
|
313
|
+
return { ...safe, checksum };
|
|
314
|
+
}
|
|
315
|
+
catch (error) {
|
|
316
|
+
await connection.query('ROLLBACK').catch(() => undefined);
|
|
317
|
+
throw error;
|
|
318
|
+
}
|
|
319
|
+
finally {
|
|
320
|
+
connection.release?.();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function indexWorkosUsers(users) {
|
|
325
|
+
const byEmail = new Map();
|
|
326
|
+
const byExternalId = new Map();
|
|
327
|
+
const fingerprintRows = users.map((user) => {
|
|
328
|
+
const normalizedEmail = normalizePlatformIdentityEmail(user.normalizedEmail);
|
|
329
|
+
const normalized = { ...user, normalizedEmail };
|
|
330
|
+
const emailUsers = byEmail.get(normalizedEmail) ?? [];
|
|
331
|
+
emailUsers.push(normalized);
|
|
332
|
+
byEmail.set(normalizedEmail, emailUsers);
|
|
333
|
+
if (user.externalId !== undefined) {
|
|
334
|
+
const externalUsers = byExternalId.get(user.externalId) ?? [];
|
|
335
|
+
externalUsers.push(normalized);
|
|
336
|
+
byExternalId.set(user.externalId, externalUsers);
|
|
337
|
+
}
|
|
338
|
+
return { externalId: user.externalId, normalizedEmail, verified: user.verified };
|
|
339
|
+
});
|
|
340
|
+
fingerprintRows.sort((a, b) => compareInventoryText(a.externalId ?? '', b.externalId ?? '') ||
|
|
341
|
+
compareInventoryText(a.normalizedEmail, b.normalizedEmail) ||
|
|
342
|
+
Number(a.verified) - Number(b.verified));
|
|
343
|
+
return { byEmail, byExternalId, fingerprintRows };
|
|
344
|
+
}
|
|
345
|
+
function workosConflict(index, subject, email) {
|
|
346
|
+
const matches = index.byEmail.get(email) ?? [];
|
|
347
|
+
const externalMatches = index.byExternalId.get(subject) ?? [];
|
|
348
|
+
return (matches.length > 1 ||
|
|
349
|
+
matches.some((user) => !user.verified || user.externalId !== subject) ||
|
|
350
|
+
externalMatches.some((user) => !user.verified || user.normalizedEmail !== email));
|
|
351
|
+
}
|
|
352
|
+
function hash(value) {
|
|
353
|
+
return createHash('sha256').update(JSON.stringify(value)).digest('hex');
|
|
354
|
+
}
|
|
355
|
+
//# sourceMappingURL=platform-auth-inventory-postgres.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-inventory-postgres.js","sourceRoot":"","sources":["../src/platform-auth-inventory-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,0CAA0C,EAAE,MAAM,sDAAsD,CAAC;AAClH,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AACxG,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,wCAAwC,GAGzC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,0CAA0C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AAC,KAAK,CAAC,CAAC;AAC1E,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type InventoryLease, type InventoryProgressRow, type PlatformAuthInventoryRemoteUser } from './platform-auth-inventory-paging.js';
|
|
2
|
+
import type { PlatformIdentityQueryable } from './platform-identity-postgres.js';
|
|
3
|
+
type Connection = PlatformIdentityQueryable & {
|
|
4
|
+
release?: () => void;
|
|
5
|
+
};
|
|
6
|
+
type Pool = PlatformIdentityQueryable & {
|
|
7
|
+
connect?: () => Promise<Connection>;
|
|
8
|
+
};
|
|
9
|
+
export type InventoryLeaseClaim = {
|
|
10
|
+
readonly kind: 'leased';
|
|
11
|
+
readonly lease: InventoryLease;
|
|
12
|
+
} | {
|
|
13
|
+
readonly kind: 'busy';
|
|
14
|
+
readonly progress: InventoryProgressRow;
|
|
15
|
+
} | {
|
|
16
|
+
readonly kind: 'terminal';
|
|
17
|
+
readonly progress: InventoryProgressRow;
|
|
18
|
+
};
|
|
19
|
+
export declare class PostgresPlatformAuthInventoryProgressStore {
|
|
20
|
+
#private;
|
|
21
|
+
constructor(pool: Pool);
|
|
22
|
+
claim(runId: string): Promise<InventoryLeaseClaim>;
|
|
23
|
+
release(runId: string, leaseToken: string): Promise<void>;
|
|
24
|
+
markTerminal(runId: string, leaseToken: string): Promise<InventoryProgressRow>;
|
|
25
|
+
commitRemotePage(input: {
|
|
26
|
+
readonly runId: string;
|
|
27
|
+
readonly leaseToken: string;
|
|
28
|
+
readonly after?: string;
|
|
29
|
+
readonly users: readonly PlatformAuthInventoryRemoteUser[];
|
|
30
|
+
readonly nextAfter?: string;
|
|
31
|
+
}): Promise<{
|
|
32
|
+
readonly progress: InventoryProgressRow;
|
|
33
|
+
readonly terminal: boolean;
|
|
34
|
+
}>;
|
|
35
|
+
read(runId: string): Promise<InventoryProgressRow | undefined>;
|
|
36
|
+
}
|
|
37
|
+
export declare const PROGRESS_COLUMNS = "phase, remote_after, remote_page_count, remote_user_count,\n remote_chain_hash, local_after_subject, local_source_epoch, local_snapshot_at,\n local_subject_count, candidate_count, excluded_count, candidate_chain_hash,\n excluded_chain_hash, artifact_counts, blocker_counts, terminal_error, lease_token_hash,\n lease_expires_at";
|
|
38
|
+
export declare function markPlatformAuthInventoryTerminal(pool: PlatformIdentityQueryable, runId: string, leaseToken: string): Promise<InventoryProgressRow>;
|
|
39
|
+
export declare function lockPlatformAuthInventoryLocalProgress(pool: PlatformIdentityQueryable, runId: string, leaseToken: string): Promise<InventoryProgressRow>;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=platform-auth-inventory-progress-postgres.d.ts.map
|
package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-progress-postgres.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-auth-inventory-progress-postgres.d.ts","sourceRoot":"","sources":["../src/platform-auth-inventory-progress-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,oBAAoB,EAQzB,KAAK,+BAA+B,EACrC,MAAM,qCAAqC,CAAC;AAE7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,KAAK,UAAU,GAAG,yBAAyB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CAAE,CAAC;AACvE,KAAK,IAAI,GAAG,yBAAyB,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,OAAO,CAAC,UAAU,CAAC,CAAA;CAAE,CAAC;AAEhF,MAAM,MAAM,mBAAmB,GAC3B;IAAE,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAA;CAAE,GAC3D;IAAE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAA;CAAE,GAClE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,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oryHash, newInventoryLeaseToken, PLATFORM_AUTH_INVENTORY_LEASE_SECONDS, PLATFORM_AUTH_INVENTORY_REMOTE_PAGE_SIZE, PLATFORM_AUTH_INVENTORY_REMOTE_USER_LIMIT, } from './platform-auth-inventory-paging.js';
|
|
2
|
+
import { normalizePlatformIdentityEmail } from './platform-identity.js';
|
|
3
|
+
export class PostgresPlatformAuthInventoryProgressStore {
|
|
4
|
+
#pool;
|
|
5
|
+
constructor(pool) {
|
|
6
|
+
this.#pool = pool;
|
|
7
|
+
}
|
|
8
|
+
async claim(runId) {
|
|
9
|
+
return this.#transaction(async (connection) => {
|
|
10
|
+
const run = await connection.query("SELECT state FROM identity_migration_runs WHERE id = $1 AND kind = 'inventory' FOR UPDATE", [runId]);
|
|
11
|
+
if (run.rows[0]?.state !== 'running')
|
|
12
|
+
throw new Error('inventory_run_unavailable');
|
|
13
|
+
await connection.query(`INSERT INTO platform_auth_inventory_progress
|
|
14
|
+
(migration_run_id, phase, remote_chain_hash, candidate_chain_hash, excluded_chain_hash)
|
|
15
|
+
VALUES ($1, 'remote', $2, $3, $4)
|
|
16
|
+
ON CONFLICT (migration_run_id) DO NOTHING`, [
|
|
17
|
+
runId,
|
|
18
|
+
inventoryChainSeed('remote'),
|
|
19
|
+
inventoryChainSeed('candidate'),
|
|
20
|
+
inventoryChainSeed('excluded'),
|
|
21
|
+
]);
|
|
22
|
+
const progress = await this.#lockedProgress(connection, runId);
|
|
23
|
+
if (progress.terminal_error !== null)
|
|
24
|
+
return { kind: 'terminal', progress };
|
|
25
|
+
const token = newInventoryLeaseToken();
|
|
26
|
+
const claimed = await connection.query(`UPDATE platform_auth_inventory_progress
|
|
27
|
+
SET lease_token_hash = $2,
|
|
28
|
+
lease_expires_at = now() + ($3::text || ' seconds')::interval,
|
|
29
|
+
updated_at = now()
|
|
30
|
+
WHERE migration_run_id = $1
|
|
31
|
+
AND (lease_token_hash IS NULL OR lease_expires_at <= now())
|
|
32
|
+
RETURNING ${PROGRESS_COLUMNS}`, [runId, inventoryHash(token), PLATFORM_AUTH_INVENTORY_LEASE_SECONDS]);
|
|
33
|
+
const row = claimed.rows[0];
|
|
34
|
+
return row === undefined
|
|
35
|
+
? { kind: 'busy', progress }
|
|
36
|
+
: { kind: 'leased', lease: { token, progress: row } };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async release(runId, leaseToken) {
|
|
40
|
+
await this.#pool.query(`UPDATE platform_auth_inventory_progress
|
|
41
|
+
SET lease_token_hash = NULL, lease_expires_at = NULL, updated_at = now()
|
|
42
|
+
WHERE migration_run_id = $1 AND lease_token_hash = $2`, [runId, inventoryHash(leaseToken)]);
|
|
43
|
+
}
|
|
44
|
+
async markTerminal(runId, leaseToken) {
|
|
45
|
+
return markPlatformAuthInventoryTerminal(this.#pool, runId, leaseToken);
|
|
46
|
+
}
|
|
47
|
+
async commitRemotePage(input) {
|
|
48
|
+
const normalized = normalizeRemotePage(input.users);
|
|
49
|
+
return this.#transaction(async (connection) => {
|
|
50
|
+
const progress = await this.#lockedProgress(connection, input.runId);
|
|
51
|
+
assertLease(progress, input.leaseToken, 'remote');
|
|
52
|
+
if ((progress.remote_after ?? undefined) !== input.after)
|
|
53
|
+
throw new Error('stale_inventory_lease');
|
|
54
|
+
const inputCursorFingerprint = inventoryHash(input.after ?? null);
|
|
55
|
+
const nextCursorFingerprint = input.nextAfter === undefined ? undefined : inventoryHash(input.nextAfter);
|
|
56
|
+
const invalidShape = normalized.length > PLATFORM_AUTH_INVENTORY_REMOTE_PAGE_SIZE ||
|
|
57
|
+
(normalized.length === 0 && input.nextAfter !== undefined) ||
|
|
58
|
+
(input.nextAfter !== undefined && input.nextAfter === input.after) ||
|
|
59
|
+
progress.remote_user_count + normalized.length >
|
|
60
|
+
PLATFORM_AUTH_INVENTORY_REMOTE_USER_LIMIT ||
|
|
61
|
+
(progress.remote_user_count + normalized.length >=
|
|
62
|
+
PLATFORM_AUTH_INVENTORY_REMOTE_USER_LIMIT &&
|
|
63
|
+
input.nextAfter !== undefined);
|
|
64
|
+
const seenCursor = nextCursorFingerprint === undefined
|
|
65
|
+
? false
|
|
66
|
+
: (await connection.query(`SELECT 1 FROM platform_auth_inventory_remote_pages
|
|
67
|
+
WHERE migration_run_id = $1 AND input_cursor_fingerprint = $2 LIMIT 1`, [input.runId, nextCursorFingerprint])).rows[0] !== undefined;
|
|
68
|
+
const duplicateRemote = normalized.length === 0
|
|
69
|
+
? false
|
|
70
|
+
: (await connection.query(`SELECT 1 FROM platform_auth_inventory_remote_users
|
|
71
|
+
WHERE migration_run_id = $1 AND remote_user_id = ANY($2::text[]) LIMIT 1`, [input.runId, normalized.map((user) => user.id)])).rows[0] !== undefined;
|
|
72
|
+
if (invalidShape || seenCursor || duplicateRemote || duplicateIds(normalized)) {
|
|
73
|
+
const terminal = await connection.query(`UPDATE platform_auth_inventory_progress
|
|
74
|
+
SET terminal_error = 'inventory_unavailable', lease_token_hash = NULL,
|
|
75
|
+
lease_expires_at = NULL, updated_at = now()
|
|
76
|
+
WHERE migration_run_id = $1 AND lease_token_hash = $2
|
|
77
|
+
RETURNING ${PROGRESS_COLUMNS}`, [input.runId, inventoryHash(input.leaseToken)]);
|
|
78
|
+
const row = terminal.rows[0];
|
|
79
|
+
if (row === undefined)
|
|
80
|
+
throw new Error('stale_inventory_lease');
|
|
81
|
+
return { progress: row, terminal: true };
|
|
82
|
+
}
|
|
83
|
+
const pageNumber = progress.remote_page_count;
|
|
84
|
+
const pageFingerprint = inventoryHash({
|
|
85
|
+
inputCursorFingerprint,
|
|
86
|
+
nextCursorFingerprint,
|
|
87
|
+
users: normalized.map(remoteFingerprintEntry),
|
|
88
|
+
});
|
|
89
|
+
await connection.query(`INSERT INTO platform_auth_inventory_remote_pages
|
|
90
|
+
(migration_run_id, page_number, input_cursor_fingerprint, next_cursor,
|
|
91
|
+
next_cursor_fingerprint, row_count, page_fingerprint)
|
|
92
|
+
VALUES ($1, $2, $3, $4, $5, $6, $7)`, [
|
|
93
|
+
input.runId,
|
|
94
|
+
pageNumber,
|
|
95
|
+
inputCursorFingerprint,
|
|
96
|
+
input.nextAfter ?? null,
|
|
97
|
+
nextCursorFingerprint ?? null,
|
|
98
|
+
normalized.length,
|
|
99
|
+
pageFingerprint,
|
|
100
|
+
]);
|
|
101
|
+
if (normalized.length > 0) {
|
|
102
|
+
await connection.query(`INSERT INTO platform_auth_inventory_remote_users
|
|
103
|
+
(migration_run_id, remote_user_id, external_id, normalized_email, verified,
|
|
104
|
+
page_number, ordinal, row_fingerprint)
|
|
105
|
+
SELECT $1, remote.id, remote.external_id, remote.email, remote.verified,
|
|
106
|
+
$2, remote.ordinal, remote.row_fingerprint
|
|
107
|
+
FROM unnest($3::text[], $4::text[], $5::text[], $6::boolean[], $7::integer[], $8::text[])
|
|
108
|
+
AS remote(id, external_id, email, verified, ordinal, row_fingerprint)`, [
|
|
109
|
+
input.runId,
|
|
110
|
+
pageNumber,
|
|
111
|
+
normalized.map((user) => user.id),
|
|
112
|
+
normalized.map((user) => user.externalId ?? null),
|
|
113
|
+
normalized.map((user) => user.normalizedEmail),
|
|
114
|
+
normalized.map((user) => user.verified),
|
|
115
|
+
normalized.map((_, ordinal) => ordinal),
|
|
116
|
+
normalized.map((user) => inventoryHash(remoteFingerprintEntry(user))),
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
let chain = progress.remote_chain_hash;
|
|
120
|
+
for (const user of normalized)
|
|
121
|
+
chain = inventoryChain(chain, remoteFingerprintEntry(user));
|
|
122
|
+
const updated = await connection.query(`UPDATE platform_auth_inventory_progress
|
|
123
|
+
SET phase = $3, remote_after = $4, remote_page_count = remote_page_count + 1,
|
|
124
|
+
remote_user_count = remote_user_count + $5, remote_chain_hash = $6,
|
|
125
|
+
lease_token_hash = NULL, lease_expires_at = NULL, updated_at = now()
|
|
126
|
+
WHERE migration_run_id = $1 AND lease_token_hash = $2
|
|
127
|
+
RETURNING ${PROGRESS_COLUMNS}`, [
|
|
128
|
+
input.runId,
|
|
129
|
+
inventoryHash(input.leaseToken),
|
|
130
|
+
input.nextAfter === undefined ? 'local' : 'remote',
|
|
131
|
+
input.nextAfter ?? null,
|
|
132
|
+
normalized.length,
|
|
133
|
+
chain,
|
|
134
|
+
]);
|
|
135
|
+
const row = updated.rows[0];
|
|
136
|
+
if (row === undefined)
|
|
137
|
+
throw new Error('stale_inventory_lease');
|
|
138
|
+
return { progress: row, terminal: false };
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async read(runId) {
|
|
142
|
+
const result = await this.#pool.query(`SELECT ${PROGRESS_COLUMNS} FROM platform_auth_inventory_progress
|
|
143
|
+
WHERE migration_run_id = $1`, [runId]);
|
|
144
|
+
return result.rows[0];
|
|
145
|
+
}
|
|
146
|
+
async #lockedProgress(connection, runId) {
|
|
147
|
+
const result = await connection.query(`SELECT ${PROGRESS_COLUMNS} FROM platform_auth_inventory_progress
|
|
148
|
+
WHERE migration_run_id = $1 FOR UPDATE`, [runId]);
|
|
149
|
+
const row = result.rows[0];
|
|
150
|
+
if (row === undefined)
|
|
151
|
+
throw new Error('inventory_progress_unavailable');
|
|
152
|
+
return row;
|
|
153
|
+
}
|
|
154
|
+
async #transaction(task) {
|
|
155
|
+
const connection = this.#pool.connect === undefined ? this.#pool : await this.#pool.connect();
|
|
156
|
+
try {
|
|
157
|
+
await connection.query('BEGIN');
|
|
158
|
+
const result = await task(connection);
|
|
159
|
+
await connection.query('COMMIT');
|
|
160
|
+
return result;
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
await connection.query('ROLLBACK').catch(() => undefined);
|
|
164
|
+
throw error;
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
connection.release?.();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
export const PROGRESS_COLUMNS = `phase, remote_after, remote_page_count, remote_user_count,
|
|
172
|
+
remote_chain_hash, local_after_subject, local_source_epoch, local_snapshot_at,
|
|
173
|
+
local_subject_count, candidate_count, excluded_count, candidate_chain_hash,
|
|
174
|
+
excluded_chain_hash, artifact_counts, blocker_counts, terminal_error, lease_token_hash,
|
|
175
|
+
lease_expires_at`;
|
|
176
|
+
export async function markPlatformAuthInventoryTerminal(pool, runId, leaseToken) {
|
|
177
|
+
const result = await pool.query(`UPDATE platform_auth_inventory_progress
|
|
178
|
+
SET terminal_error = 'inventory_unavailable', lease_token_hash = NULL,
|
|
179
|
+
lease_expires_at = NULL, updated_at = now()
|
|
180
|
+
WHERE migration_run_id = $1 AND lease_token_hash = $2
|
|
181
|
+
RETURNING ${PROGRESS_COLUMNS}`, [runId, inventoryHash(leaseToken)]);
|
|
182
|
+
const row = result.rows[0];
|
|
183
|
+
if (row === undefined)
|
|
184
|
+
throw new Error('stale_inventory_lease');
|
|
185
|
+
return row;
|
|
186
|
+
}
|
|
187
|
+
export async function lockPlatformAuthInventoryLocalProgress(pool, runId, leaseToken) {
|
|
188
|
+
const result = await pool.query(`SELECT ${PROGRESS_COLUMNS} FROM platform_auth_inventory_progress
|
|
189
|
+
WHERE migration_run_id = $1 FOR UPDATE`, [runId]);
|
|
190
|
+
const row = result.rows[0];
|
|
191
|
+
if (row === undefined ||
|
|
192
|
+
row.phase !== 'local' ||
|
|
193
|
+
row.terminal_error !== null ||
|
|
194
|
+
row.lease_token_hash !== inventoryHash(leaseToken) ||
|
|
195
|
+
row.lease_expires_at === null ||
|
|
196
|
+
new Date(row.lease_expires_at).getTime() <= Date.now())
|
|
197
|
+
throw new Error('stale_inventory_lease');
|
|
198
|
+
return row;
|
|
199
|
+
}
|
|
200
|
+
function normalizeRemotePage(users) {
|
|
201
|
+
return users.map((user) => {
|
|
202
|
+
if (user.id.trim() !== user.id ||
|
|
203
|
+
user.id.length === 0 ||
|
|
204
|
+
user.id.length > 256 ||
|
|
205
|
+
(user.externalId !== undefined &&
|
|
206
|
+
(user.externalId.trim() !== user.externalId || user.externalId.length === 0)))
|
|
207
|
+
throw new Error('invalid_remote_inventory_page');
|
|
208
|
+
return { ...user, normalizedEmail: normalizePlatformIdentityEmail(user.normalizedEmail) };
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
function remoteFingerprintEntry(user) {
|
|
212
|
+
return {
|
|
213
|
+
idFingerprint: inventoryHash(user.id),
|
|
214
|
+
externalId: user.externalId,
|
|
215
|
+
normalizedEmail: user.normalizedEmail,
|
|
216
|
+
verified: user.verified,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
219
|
+
function duplicateIds(users) {
|
|
220
|
+
return new Set(users.map((user) => user.id)).size !== users.length;
|
|
221
|
+
}
|
|
222
|
+
function assertLease(progress, leaseToken, phase) {
|
|
223
|
+
if (progress.phase !== phase ||
|
|
224
|
+
progress.terminal_error !== null ||
|
|
225
|
+
progress.lease_token_hash !== inventoryHash(leaseToken) ||
|
|
226
|
+
progress.lease_expires_at === null ||
|
|
227
|
+
new Date(progress.lease_expires_at).getTime() <= Date.now())
|
|
228
|
+
throw new Error('stale_inventory_lease');
|
|
229
|
+
}
|
|
230
|
+
//# sourceMappingURL=platform-auth-inventory-progress-postgres.js.map
|