@noodleseed/one 0.83.0 → 0.84.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +4 -1
- package/dist/cli.js.map +1 -1
- package/dist/commands/catalog-data-platform-auth.d.ts.map +1 -1
- package/dist/commands/catalog-data-platform-auth.js +70 -2
- package/dist/commands/catalog-data-platform-auth.js.map +1 -1
- package/dist/commands/platform-account-reset-args.d.ts +40 -0
- package/dist/commands/platform-account-reset-args.d.ts.map +1 -0
- package/dist/commands/platform-account-reset-args.js +181 -0
- package/dist/commands/platform-account-reset-args.js.map +1 -0
- package/dist/commands/platform-account-reset-files.d.ts +9 -0
- package/dist/commands/platform-account-reset-files.d.ts.map +1 -0
- package/dist/commands/platform-account-reset-files.js +45 -0
- package/dist/commands/platform-account-reset-files.js.map +1 -0
- package/dist/commands/platform-account-reset-ops.d.ts +3 -0
- package/dist/commands/platform-account-reset-ops.d.ts.map +1 -0
- package/dist/commands/platform-account-reset-ops.js +162 -0
- package/dist/commands/platform-account-reset-ops.js.map +1 -0
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/generated/example-files.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js +1 -1
- package/node_modules/@noodle-borg/agent-kit/dist/skill-embedded-assistant-ref.js.map +1 -1
- package/node_modules/@noodle-borg/agent-kit/package.json +1 -1
- package/node_modules/@noodle-borg/service/dist/billing/enforcement-activation.d.ts +4 -4
- package/node_modules/@noodle-borg/service/dist/billing/read-contract.d.ts +6 -6
- package/node_modules/@noodle-borg/service/dist/index.d.ts +4 -1
- package/node_modules/@noodle-borg/service/dist/index.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/index.js +2 -0
- package/node_modules/@noodle-borg/service/dist/index.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/main.js +5 -0
- package/node_modules/@noodle-borg/service/dist/main.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.js +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/developer-grant-flow.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js +1 -0
- package/node_modules/@noodle-borg/service/dist/oauth/provider.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js +17 -0
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres-schema.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts +2 -2
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js +25 -5
- package/node_modules/@noodle-borg/service/dist/oauth/store-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts +5 -3
- package/node_modules/@noodle-borg/service/dist/oauth/store.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/store.js +5 -5
- package/node_modules/@noodle-borg/service/dist/oauth/store.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js +7 -2
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-handler.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-callback-support.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-consent.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js +6 -1
- package/node_modules/@noodle-borg/service/dist/oauth/upstream-federation.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/options.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.d.ts +9 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.js +24 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-config.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.d.ts +12 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.js +110 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-dispatch-lock-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.d.ts +9 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.js +46 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-fingerprint.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.d.ts +77 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.js +144 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.js +59 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-operator.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.js +22 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.d.ts +41 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.js +314 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.d.ts +14 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.js +210 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-resources-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.js +71 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-rollback-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.d.ts +12 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.js +2 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-ports.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.js +177 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-evidence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.d.ts +35 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.js +184 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-local-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.d.ts +11 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.js +120 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-persistence-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.d.ts +79 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.js +286 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.d.ts +21 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.js +81 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-preview-result.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.d.ts +46 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.js +283 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-quarantine-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.d.ts +13 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.js +81 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-eligibility-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.d.ts +30 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.js +248 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-local-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.d.ts +29 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.js +281 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.d.ts +55 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.js +262 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-rollback-preview-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.d.ts +7 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.js +439 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset-schema-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.d.ts +276 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.js +141 -0
- package/node_modules/@noodle-borg/service/dist/platform-account-reset.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-configuration.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js +5 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-legacy-sources-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js +10 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-local-subjects-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts +5 -10
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js +86 -47
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.d.ts +17 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.js +240 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-inventory-source-fence-transaction-postgres.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-operator.d.ts +63 -63
- package/node_modules/@noodle-borg/service/dist/platform-auth-rollout-support.d.ts +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts +18 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js +97 -2
- package/node_modules/@noodle-borg/service/dist/platform-auth-runtime.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts +4 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js +4 -0
- package/node_modules/@noodle-borg/service/dist/platform-auth-service-bootstrap.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts +7 -2
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js +24 -2
- package/node_modules/@noodle-borg/service/dist/platform-identity-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js +4 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity-schema-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts +7 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js +121 -8
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js +11 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync-recovery-postgres.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts +5 -3
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js +15 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity-sync.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts +23 -2
- package/node_modules/@noodle-borg/service/dist/platform-identity.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/platform-identity.js +21 -0
- package/node_modules/@noodle-borg/service/dist/platform-identity.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-state.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/registry-state.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry-state.js +15 -2
- package/node_modules/@noodle-borg/service/dist/registry-state.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry.d.ts +2 -0
- package/node_modules/@noodle-borg/service/dist/registry.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/registry.js +4 -1
- package/node_modules/@noodle-borg/service/dist/registry.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.d.ts +8 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset-dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.d.ts +22 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.js +201 -0
- package/node_modules/@noodle-borg/service/dist/routes/platform-account-reset.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.d.ts +18 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.d.ts.map +1 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.js +36 -0
- package/node_modules/@noodle-borg/service/dist/routes/private-platform-auth-dispatch.js.map +1 -0
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts +2 -1
- package/node_modules/@noodle-borg/service/dist/serve-options.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/serve.js +16 -1
- package/node_modules/@noodle-borg/service/dist/serve.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/service.js +4 -5
- package/node_modules/@noodle-borg/service/dist/service.js.map +1 -1
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts +22 -3
- package/node_modules/@noodle-borg/service/dist/workos-directory.d.ts.map +1 -1
- package/node_modules/@noodle-borg/service/dist/workos-directory.js +56 -5
- package/node_modules/@noodle-borg/service/dist/workos-directory.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { createHash } from 'node:crypto';
|
|
2
|
+
import { PlatformAccountResetTargetSetSchema, } from './platform-account-reset.js';
|
|
3
|
+
/**
|
|
4
|
+
* Account-reset evidence uses sorted object keys and sorted arrays so database/query order cannot change a
|
|
5
|
+
* preview checksum. Callers include an explicit schema version and label at every independent fingerprint.
|
|
6
|
+
*/
|
|
7
|
+
export function sha256Canonical(value) {
|
|
8
|
+
return createHash('sha256')
|
|
9
|
+
.update(JSON.stringify(canonicalize(value)))
|
|
10
|
+
.digest('hex');
|
|
11
|
+
}
|
|
12
|
+
export function canonicalJson(value) {
|
|
13
|
+
return JSON.stringify(canonicalize(value));
|
|
14
|
+
}
|
|
15
|
+
export function platformAccountResetApprovedTargetSetFingerprint(targetSet) {
|
|
16
|
+
const approved = PlatformAccountResetTargetSetSchema.parse(targetSet);
|
|
17
|
+
return sha256Canonical({
|
|
18
|
+
schemaVersion: 1,
|
|
19
|
+
label: 'platform_account_reset_approved_target_set',
|
|
20
|
+
principalIds: [...approved.principalIds].sort(compareText),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function canonicalize(value) {
|
|
24
|
+
if (value === null ||
|
|
25
|
+
typeof value === 'boolean' ||
|
|
26
|
+
typeof value === 'string' ||
|
|
27
|
+
(typeof value === 'number' && Number.isFinite(value))) {
|
|
28
|
+
return value;
|
|
29
|
+
}
|
|
30
|
+
if (Array.isArray(value)) {
|
|
31
|
+
return value
|
|
32
|
+
.map(canonicalize)
|
|
33
|
+
.sort((left, right) => JSON.stringify(left).localeCompare(JSON.stringify(right)));
|
|
34
|
+
}
|
|
35
|
+
if (typeof value === 'object') {
|
|
36
|
+
const entries = Object.entries(value)
|
|
37
|
+
.filter(([, entry]) => entry !== undefined)
|
|
38
|
+
.sort(([left], [right]) => left.localeCompare(right));
|
|
39
|
+
return Object.fromEntries(entries.map(([key, entry]) => [key, canonicalize(entry)]));
|
|
40
|
+
}
|
|
41
|
+
throw new TypeError('account-reset fingerprint input is not canonical JSON');
|
|
42
|
+
}
|
|
43
|
+
function compareText(left, right) {
|
|
44
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=platform-account-reset-fingerprint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-fingerprint.js","sourceRoot":"","sources":["../src/platform-account-reset-fingerprint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAEL,mCAAmC,GACpC,MAAM,6BAA6B,CAAC;AAUrC;;;GAGG;AACH,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,UAAU,CAAC,QAAQ,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC;SAC3C,MAAM,CAAC,KAAK,CAAC,CAAC;AACnB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,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;QACxD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvF,CAAC;IACD,MAAM,IAAI,SAAS,CAAC,uDAAuD,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,WAAW,CAAC,IAAY,EAAE,KAAa;IAC9C,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type PlatformAccountResetExecuteRequest, type PlatformAccountResetResult } from './platform-account-reset.js';
|
|
2
|
+
import type { PlatformIdentityQueryable } from './platform-identity-postgres.js';
|
|
3
|
+
export type PlatformAccountResetConnection = PlatformIdentityQueryable & {
|
|
4
|
+
release?: (error?: Error) => void;
|
|
5
|
+
};
|
|
6
|
+
export type PlatformAccountResetPool = PlatformIdentityQueryable & {
|
|
7
|
+
connect?: () => Promise<PlatformAccountResetConnection>;
|
|
8
|
+
};
|
|
9
|
+
export interface PlatformAccountResetActionEvidence {
|
|
10
|
+
readonly actorFingerprint: string;
|
|
11
|
+
readonly idempotencyKeyHash: string;
|
|
12
|
+
readonly requestFingerprint: string;
|
|
13
|
+
readonly reasonFingerprint: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PlatformAccountResetRegistryPlan {
|
|
16
|
+
readonly action: 'quarantine' | 'rollback';
|
|
17
|
+
readonly apps: readonly {
|
|
18
|
+
readonly org: string;
|
|
19
|
+
readonly app: string;
|
|
20
|
+
}[];
|
|
21
|
+
readonly archivedAt: string;
|
|
22
|
+
}
|
|
23
|
+
export interface PlatformAccountResetMutationOutcome {
|
|
24
|
+
readonly result: PlatformAccountResetResult;
|
|
25
|
+
readonly registry: PlatformAccountResetRegistryPlan;
|
|
26
|
+
}
|
|
27
|
+
export interface PlatformAccountResetOperationRow {
|
|
28
|
+
readonly lifecycle: string;
|
|
29
|
+
readonly release_sha: string;
|
|
30
|
+
readonly rollout_generation: string;
|
|
31
|
+
readonly workos_realm: string;
|
|
32
|
+
readonly source_epoch: string;
|
|
33
|
+
readonly preview_checksum: string;
|
|
34
|
+
readonly target_set_fingerprint: string;
|
|
35
|
+
readonly approved_target_set_fingerprint: string | null;
|
|
36
|
+
readonly request_fingerprint: string;
|
|
37
|
+
readonly safe_result: unknown;
|
|
38
|
+
readonly preview_expires_at: Date | string;
|
|
39
|
+
readonly quarantined_at: Date | string | null;
|
|
40
|
+
readonly finalize_after: Date | string | null;
|
|
41
|
+
readonly quarantine_idempotency_key_hash: string | null;
|
|
42
|
+
readonly quarantine_request_fingerprint: string | null;
|
|
43
|
+
readonly quarantine_reason_fingerprint: string | null;
|
|
44
|
+
readonly quarantine_actor_fingerprint: string | null;
|
|
45
|
+
readonly quarantine_safe_result: unknown;
|
|
46
|
+
readonly rollback_idempotency_key_hash: string | null;
|
|
47
|
+
readonly rollback_request_fingerprint: string | null;
|
|
48
|
+
readonly rollback_reason_fingerprint: string | null;
|
|
49
|
+
readonly rollback_actor_fingerprint: string | null;
|
|
50
|
+
readonly rollback_safe_result: unknown;
|
|
51
|
+
}
|
|
52
|
+
export interface PlatformAccountResetFrozenResources {
|
|
53
|
+
readonly apps: readonly {
|
|
54
|
+
readonly org: string;
|
|
55
|
+
readonly app: string;
|
|
56
|
+
}[];
|
|
57
|
+
readonly deploymentIds: readonly string[];
|
|
58
|
+
readonly resourceCount: number;
|
|
59
|
+
}
|
|
60
|
+
export declare function platformAccountResetActionEvidence(request: PlatformAccountResetExecuteRequest, actorFingerprint: string): PlatformAccountResetActionEvidence;
|
|
61
|
+
export declare function lockPlatformAccountResetOperation(connection: PlatformIdentityQueryable, operationId: string): Promise<PlatformAccountResetOperationRow>;
|
|
62
|
+
export declare function assertPlatformAccountResetApprovedTargetSet(operation: PlatformAccountResetOperationRow, approvedTargetSetFingerprint: string): void;
|
|
63
|
+
export declare function loadPlatformAccountResetTargets(connection: PlatformIdentityQueryable, operationId: string, lifecycle: 'previewed' | 'quarantined'): Promise<readonly string[]>;
|
|
64
|
+
export declare function loadPlatformAccountResetFrozenResources(connection: PlatformIdentityQueryable, operationId: string): Promise<PlatformAccountResetFrozenResources>;
|
|
65
|
+
export declare function parsePlatformAccountResetSafeResult(value: unknown): PlatformAccountResetResult;
|
|
66
|
+
export declare function assertPlatformAccountResetRequestMatches(operation: PlatformAccountResetOperationRow, request: PlatformAccountResetExecuteRequest, options: {
|
|
67
|
+
readonly releaseSha: string;
|
|
68
|
+
readonly workosRealm: string;
|
|
69
|
+
}): void;
|
|
70
|
+
export declare function assertPlatformAccountResetActionReplay(evidence: PlatformAccountResetActionEvidence, stored: {
|
|
71
|
+
readonly idempotencyKeyHash: string | null;
|
|
72
|
+
readonly requestFingerprint: string | null;
|
|
73
|
+
readonly reasonFingerprint: string | null;
|
|
74
|
+
readonly actorFingerprint: string | null;
|
|
75
|
+
readonly safeResult: unknown;
|
|
76
|
+
}): PlatformAccountResetResult;
|
|
77
|
+
//# sourceMappingURL=platform-account-reset-operation-postgres.d.ts.map
|
package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-operation-postgres.d.ts","sourceRoot":"","sources":["../src/platform-account-reset-operation-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAEhC,MAAM,6BAA6B,CAAC;AAGrC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,MAAM,MAAM,8BAA8B,G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AAsB,iCAAiC,CACrD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,gCAAgC,CAAC,CAuB3C;AAED,wBAAgB,2CAA2C,CACzD,SAAS,EAAE,gCAAgC,EAC3C,4BAA4B,EAAE,MAAM,GACnC,IAAI,CAGN;AAED,wBAAsB,+BAA+B,CACnD,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,WAAW,GAAG,aAAa,GACrC,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC,CAW5B;AAED,wBAAsB,uCAAuC,CAC3D,UAAU,EAAE,yBAAyB,EACrC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,mCAAmC,CAAC,CAqD9C;AAED,wBAAgB,mCAAmC,CAAC,KAAK,EAAE,OAAO,GAAG,0BAA0B,CAI9F;AAED,wBAAgB,wCAAwC,CACtD,SAAS,EAAE,gCAAgC,EAC3C,OAAO,EAAE,kCAAkC,EAC3C,OAAO,EAAE;IAAE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAAE,GACrE,IAAI,CASN;AAED,wBAAgB,sCAAsC,CACpD,QAAQ,EAAE,kCAAkC,EAC5C,MAAM,EAAE;IACN,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1C,QAAQ,CAAC,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IACzC,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,GACA,0BAA0B,CAS5B"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import { PlatformAccountResetResultSchema, } from './platform-account-reset.js';
|
|
2
|
+
import { sha256Canonical } from './platform-account-reset-fingerprint.js';
|
|
3
|
+
import { PlatformAccountResetPreviewError } from './platform-account-reset-preview-result.js';
|
|
4
|
+
export function platformAccountResetActionEvidence(request, actorFingerprint) {
|
|
5
|
+
const idempotencyKeyHash = sha256Canonical({
|
|
6
|
+
schemaVersion: 1,
|
|
7
|
+
label: `platform_account_reset_idempotency:${request.action}`,
|
|
8
|
+
actorFingerprint,
|
|
9
|
+
idempotencyKey: request.idempotencyKey,
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
actorFingerprint,
|
|
13
|
+
idempotencyKeyHash,
|
|
14
|
+
reasonFingerprint: sha256Canonical({
|
|
15
|
+
schemaVersion: 1,
|
|
16
|
+
label: `platform_account_reset_reason:${request.action}`,
|
|
17
|
+
reason: request.reason,
|
|
18
|
+
}),
|
|
19
|
+
requestFingerprint: sha256Canonical({
|
|
20
|
+
schemaVersion: 1,
|
|
21
|
+
label: `platform_account_reset_request:${request.action}`,
|
|
22
|
+
operationId: request.operationId,
|
|
23
|
+
expectedGeneration: request.expectedGeneration,
|
|
24
|
+
releaseSha: request.releaseSha,
|
|
25
|
+
previewChecksum: request.previewChecksum,
|
|
26
|
+
actorFingerprint,
|
|
27
|
+
idempotencyKeyHash,
|
|
28
|
+
reason: request.reason,
|
|
29
|
+
confirmed: request.confirmed,
|
|
30
|
+
}),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
export async function lockPlatformAccountResetOperation(connection, operationId) {
|
|
34
|
+
await connection.query('SELECT pg_advisory_xact_lock(hashtextextended($1, 0))', [
|
|
35
|
+
`platform-account-reset:${operationId}`,
|
|
36
|
+
]);
|
|
37
|
+
const operation = await connection.query(`SELECT lifecycle, release_sha, rollout_generation::text, workos_realm,
|
|
38
|
+
source_epoch::text, preview_checksum, target_set_fingerprint,
|
|
39
|
+
approved_target_set_fingerprint, request_fingerprint, safe_result,
|
|
40
|
+
preview_expires_at, quarantined_at,
|
|
41
|
+
finalize_after, quarantine_idempotency_key_hash,
|
|
42
|
+
quarantine_request_fingerprint, quarantine_reason_fingerprint,
|
|
43
|
+
quarantine_actor_fingerprint, quarantine_safe_result,
|
|
44
|
+
rollback_idempotency_key_hash,
|
|
45
|
+
rollback_request_fingerprint, rollback_reason_fingerprint,
|
|
46
|
+
rollback_actor_fingerprint, rollback_safe_result
|
|
47
|
+
FROM platform_account_reset_operations
|
|
48
|
+
WHERE operation_id = $1
|
|
49
|
+
FOR UPDATE`, [operationId]);
|
|
50
|
+
const row = operation.rows[0];
|
|
51
|
+
if (row === undefined)
|
|
52
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
53
|
+
return row;
|
|
54
|
+
}
|
|
55
|
+
export function assertPlatformAccountResetApprovedTargetSet(operation, approvedTargetSetFingerprint) {
|
|
56
|
+
if (operation.approved_target_set_fingerprint !== approvedTargetSetFingerprint)
|
|
57
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
58
|
+
}
|
|
59
|
+
export async function loadPlatformAccountResetTargets(connection, operationId, lifecycle) {
|
|
60
|
+
const result = await connection.query(`SELECT principal_id
|
|
61
|
+
FROM platform_account_reset_targets
|
|
62
|
+
WHERE operation_id = $1 AND lifecycle = $2
|
|
63
|
+
ORDER BY principal_id
|
|
64
|
+
FOR UPDATE`, [operationId, lifecycle]);
|
|
65
|
+
if (result.rows.length !== 3)
|
|
66
|
+
throw new PlatformAccountResetPreviewError('target_count_invalid');
|
|
67
|
+
return result.rows.map((row) => row.principal_id);
|
|
68
|
+
}
|
|
69
|
+
export async function loadPlatformAccountResetFrozenResources(connection, operationId) {
|
|
70
|
+
const result = await connection.query(`SELECT provider, resource_kind, provider_locator, locator_fingerprint
|
|
71
|
+
FROM platform_account_reset_cleanup_ledger
|
|
72
|
+
WHERE operation_id = $1
|
|
73
|
+
ORDER BY provider, resource_kind, locator_fingerprint
|
|
74
|
+
FOR SHARE`, [operationId]);
|
|
75
|
+
const apps = new Map();
|
|
76
|
+
const deploymentIds = new Set();
|
|
77
|
+
for (const row of result.rows) {
|
|
78
|
+
let locator;
|
|
79
|
+
try {
|
|
80
|
+
locator = JSON.parse(row.provider_locator);
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
84
|
+
}
|
|
85
|
+
if (!isRecord(locator))
|
|
86
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
87
|
+
const actual = sha256Canonical({
|
|
88
|
+
schemaVersion: 1,
|
|
89
|
+
label: `platform_account_reset_locator:${row.provider}:${row.resource_kind}`,
|
|
90
|
+
locator,
|
|
91
|
+
});
|
|
92
|
+
if (actual !== row.locator_fingerprint)
|
|
93
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
94
|
+
if (row.provider !== 'postgres')
|
|
95
|
+
continue;
|
|
96
|
+
if (row.resource_kind === 'application') {
|
|
97
|
+
const org = locator.org;
|
|
98
|
+
const app = locator.app;
|
|
99
|
+
if (typeof org !== 'string' || typeof app !== 'string')
|
|
100
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
101
|
+
apps.set(`${org}\u0000${app}`, { org, app });
|
|
102
|
+
}
|
|
103
|
+
if (row.resource_kind === 'deployment') {
|
|
104
|
+
const deploymentId = locator.deploymentId;
|
|
105
|
+
if (typeof deploymentId !== 'string' || typeof locator.archived !== 'boolean')
|
|
106
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
107
|
+
if (!locator.archived)
|
|
108
|
+
deploymentIds.add(deploymentId);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
apps: [...apps.values()].sort((left, right) => `${left.org}/${left.app}`.localeCompare(`${right.org}/${right.app}`)),
|
|
113
|
+
deploymentIds: [...deploymentIds].sort(),
|
|
114
|
+
resourceCount: result.rows.length,
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
export function parsePlatformAccountResetSafeResult(value) {
|
|
118
|
+
const parsed = PlatformAccountResetResultSchema.safeParse(value);
|
|
119
|
+
if (!parsed.success)
|
|
120
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
121
|
+
return parsed.data;
|
|
122
|
+
}
|
|
123
|
+
export function assertPlatformAccountResetRequestMatches(operation, request, options) {
|
|
124
|
+
if (request.releaseSha !== options.releaseSha || operation.release_sha !== request.releaseSha)
|
|
125
|
+
throw new PlatformAccountResetPreviewError('release_mismatch');
|
|
126
|
+
if (Number(operation.rollout_generation) !== request.expectedGeneration)
|
|
127
|
+
throw new PlatformAccountResetPreviewError('generation_mismatch');
|
|
128
|
+
if (operation.preview_checksum !== request.previewChecksum)
|
|
129
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
130
|
+
if (operation.workos_realm !== options.workosRealm)
|
|
131
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
132
|
+
}
|
|
133
|
+
export function assertPlatformAccountResetActionReplay(evidence, stored) {
|
|
134
|
+
if (stored.actorFingerprint !== evidence.actorFingerprint ||
|
|
135
|
+
stored.idempotencyKeyHash !== evidence.idempotencyKeyHash ||
|
|
136
|
+
stored.requestFingerprint !== evidence.requestFingerprint ||
|
|
137
|
+
stored.reasonFingerprint !== evidence.reasonFingerprint)
|
|
138
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
139
|
+
return parsePlatformAccountResetSafeResult(stored.safeResult);
|
|
140
|
+
}
|
|
141
|
+
function isRecord(value) {
|
|
142
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=platform-account-reset-operation-postgres.js.map
|
package/node_modules/@noodle-borg/service/dist/platform-account-reset-operation-postgres.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-operation-postgres.js","sourceRoot":"","sources":["../src/platform-account-reset-operation-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,gCAAgC,GACjC,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,eAAe,EAA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AAM,CAAC,gBAAgB,KAAK,QAAQ,CAAC,gBAAgB;QACrD,MAAM,CAAC,kBAAkB,KAAK,QAAQ,CAAC,kBAAkB;QACzD,MAAM,CAAC,kBAAkB,KAAK,QAAQ,CAAC,kBAAkB;QACzD,MAAM,CAAC,iBAAiB,KAAK,QAAQ,CAAC,iBAAiB;QAEvD,MAAM,IAAI,gCAAgC,CAAC,oBAAoB,CAAC,CAAC;IACnE,OAAO,mCAAmC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PlatformAccountResetExecuteRequest, type PlatformAccountResetOperatorPreviewRequest, type PlatformAccountResetPreviewRequest, type PlatformAccountResetResult, type PlatformAccountResetRollbackPreviewRequest, type PlatformAccountResetStatusRequest } from './platform-account-reset.js';
|
|
2
|
+
import type { PlatformAccountResetMutationOutcome, PlatformAccountResetRegistryPlan } from './platform-account-reset-operation-postgres.js';
|
|
3
|
+
import type { PlatformAccountResetOperatorPort } from './platform-account-reset-ports.js';
|
|
4
|
+
import type { PlatformIdentityQueryable } from './platform-identity-postgres.js';
|
|
5
|
+
interface PlatformAccountResetOperatorOptions {
|
|
6
|
+
readonly preview: {
|
|
7
|
+
preview(input: PlatformAccountResetPreviewRequest): Promise<PlatformAccountResetResult>;
|
|
8
|
+
};
|
|
9
|
+
readonly rollbackPreview: {
|
|
10
|
+
preview(input: PlatformAccountResetRollbackPreviewRequest): Promise<PlatformAccountResetResult>;
|
|
11
|
+
};
|
|
12
|
+
readonly quarantine: {
|
|
13
|
+
apply(input: PlatformAccountResetExecuteRequest): Promise<PlatformAccountResetMutationOutcome>;
|
|
14
|
+
};
|
|
15
|
+
readonly rollback: {
|
|
16
|
+
apply(input: PlatformAccountResetExecuteRequest): Promise<PlatformAccountResetMutationOutcome>;
|
|
17
|
+
};
|
|
18
|
+
readonly statusStore: PlatformIdentityQueryable;
|
|
19
|
+
readonly reconcileRegistry?: (input: PlatformAccountResetRegistryPlan) => void | Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare class PlatformAccountResetOperator implements PlatformAccountResetOperatorPort {
|
|
22
|
+
#private;
|
|
23
|
+
constructor(options: PlatformAccountResetOperatorOptions);
|
|
24
|
+
preview(rawInput: PlatformAccountResetOperatorPreviewRequest): Promise<PlatformAccountResetResult>;
|
|
25
|
+
execute(rawInput: PlatformAccountResetExecuteRequest): Promise<PlatformAccountResetResult>;
|
|
26
|
+
status(rawInput: PlatformAccountResetStatusRequest): Promise<PlatformAccountResetResult | undefined>;
|
|
27
|
+
}
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=platform-account-reset-operator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-operator.d.ts","sourceRoot":"","sources":["../src/platform-account-reset-operator.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kCAAkC,EAEvC,KAAK,0CAA0C,EAE/C,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAE/B,KAAK,0CAA0C,EAC/C,KAAK,iCAAiC,EAEvC,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EACV,mCAAmC,EACnC,gCAAgC,EACjC,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AAE1F,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,UAAU,mCAAmC;IAC3C,QAAQ,CAAC,OAAO,EAAE;QAChB,OAAO,CAAC,KAAK,EAAE,kCAAkC,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;KACzF,CAAC;IACF,QAAQ,CAAC,eAAe,EAAE;QACxB,OAAO,CAAC,KAAK,EAAE,0CAA0C,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAAC;KACjG,CAAC;IACF,QAAQ,CAAC,UAAU,EAAE;QACnB,KAAK,CAAC,KAAK,EAAE,kCAAkC,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;KAChG,CAAC;IACF,QAAQ,CAAC,QAAQ,EAAE;QACjB,KAAK,CAAC,KAAK,EAAE,kCAAkC,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAAC;KAChG,CAAC;IACF,QAAQ,CAAC,WAAW,EAAE,yBAAyB,CAAC;IAChD,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,gCAAgC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAChG;AAUD,qBAAa,4BAA6B,YAAW,gCAAgC;;gBAGvE,OAAO,EAAE,mCAAmC;IAIxD,OAAO,CACL,QAAQ,EAAE,0CAA0C,GACnD,OAAO,CAAC,0BAA0B,CAAC;IAMhC,OAAO,CAAC,QAAQ,EAAE,kCAAkC,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAU1F,MAAM,CACV,QAAQ,EAAE,iCAAiC,GAC1C,OAAO,CAAC,0BAA0B,GAAG,SAAS,CAAC;CA8BnD"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { PlatformAccountResetExecuteRequestSchema, PlatformAccountResetOperatorPreviewRequestSchema, PlatformAccountResetResultSchema, PlatformAccountResetStatusRequestSchema, } from './platform-account-reset.js';
|
|
2
|
+
import { PlatformAccountResetPreviewError } from './platform-account-reset-preview-result.js';
|
|
3
|
+
export class PlatformAccountResetOperator {
|
|
4
|
+
#options;
|
|
5
|
+
constructor(options) {
|
|
6
|
+
this.#options = options;
|
|
7
|
+
}
|
|
8
|
+
preview(rawInput) {
|
|
9
|
+
const input = PlatformAccountResetOperatorPreviewRequestSchema.parse(rawInput);
|
|
10
|
+
if ('operation' in input)
|
|
11
|
+
return this.#options.rollbackPreview.preview(input);
|
|
12
|
+
return this.#options.preview.preview(input);
|
|
13
|
+
}
|
|
14
|
+
async execute(rawInput) {
|
|
15
|
+
const input = PlatformAccountResetExecuteRequestSchema.parse(rawInput);
|
|
16
|
+
let outcome;
|
|
17
|
+
if (input.action === 'quarantine')
|
|
18
|
+
outcome = await this.#options.quarantine.apply(input);
|
|
19
|
+
else if (input.action === 'rollback')
|
|
20
|
+
outcome = await this.#options.rollback.apply(input);
|
|
21
|
+
else
|
|
22
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
23
|
+
await this.#options.reconcileRegistry?.(outcome.registry);
|
|
24
|
+
return outcome.result;
|
|
25
|
+
}
|
|
26
|
+
async status(rawInput) {
|
|
27
|
+
const input = PlatformAccountResetStatusRequestSchema.parse(rawInput);
|
|
28
|
+
const status = await this.#options.statusStore.query(`SELECT operation.lifecycle, operation.safe_result,
|
|
29
|
+
operation.quarantine_safe_result, operation.rollback_safe_result,
|
|
30
|
+
count(*) FILTER (
|
|
31
|
+
WHERE cleanup.state IN ('pending', 'leased', 'failed')
|
|
32
|
+
)::int AS cleanup_pending_count
|
|
33
|
+
FROM platform_account_reset_operations operation
|
|
34
|
+
LEFT JOIN platform_account_reset_cleanup_ledger cleanup
|
|
35
|
+
ON cleanup.operation_id = operation.operation_id
|
|
36
|
+
WHERE operation.operation_id = $1
|
|
37
|
+
GROUP BY operation.operation_id`, [input.operationId]);
|
|
38
|
+
const row = status.rows[0];
|
|
39
|
+
if (row === undefined)
|
|
40
|
+
return undefined;
|
|
41
|
+
const value = row.rollback_safe_result ?? row.quarantine_safe_result ?? row.safe_result;
|
|
42
|
+
const result = PlatformAccountResetResultSchema.safeParse(value);
|
|
43
|
+
if (!result.success)
|
|
44
|
+
throw new PlatformAccountResetPreviewError('operation_conflict');
|
|
45
|
+
return {
|
|
46
|
+
...result.data,
|
|
47
|
+
lifecycle: row.lifecycle,
|
|
48
|
+
counts: {
|
|
49
|
+
...result.data.counts,
|
|
50
|
+
suspendedPrincipalCount: isSuspendedLifecycle(row.lifecycle) ? 3 : 0,
|
|
51
|
+
cleanupPendingCount: row.cleanup_pending_count,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
function isSuspendedLifecycle(lifecycle) {
|
|
57
|
+
return ['quarantined', 'finalizing', 'finalization_blocked'].includes(lifecycle);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=platform-account-reset-operator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-operator.js","sourceRoot":"","sources":["../src/platform-account-reset-operator.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,wCAAwC,EAExC,gDAAgD,EAGhD,gCAAgC,EAGhC,uCAAuC,GACxC,MAAM,6BAA6B,CAAC;AAMrC,OAAO,EAAE,gCAAgC,EAAE,MAAM,4CAA4C,CAAC;AA4B9F,MAAM,OAAO,4BAA4B;IAC9B,QAAQ,CAAsC;IAEvD,YAAY,OAA4C;QACtD,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;IAC1B,CAAC;IAED,OAAO,CACL,QAAoD;QAEpD,MAAM,KAAK,GAAG,gDAAgD,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QAC/E,IAAI,WAAW,IAAI,KAAK;YAAE,OAAO,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC9E,OAAO,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,QAA4C;QACxD,MAAM,KAAK,GAAG,wCAAwC,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACvE,IAAI,OAA4C,CAAC;QACjD,IAAI,KAAK,CAAC,MAAM,KAAK,YAAY;YAAE,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,UAAU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CAAC;gBACpE,mBAAmB,EAAE,GAAG,CAAC,qBAAqB;aAC/C;SACF,CAAC;IACJ,CAAC;CACF;AAED,SAAS,oBAAoB,CAAC,SAAkD;IAC9E,OAAO,CAAC,aAAa,EAAE,YAAY,EAAE,sBAAsB,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;AACnF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PlatformIdentityQueryable } from './platform-identity-postgres.js';
|
|
2
|
+
export declare function platformAccountResetAppKey(row: {
|
|
3
|
+
readonly org_slug: string;
|
|
4
|
+
readonly app_slug?: string;
|
|
5
|
+
readonly slug?: string;
|
|
6
|
+
}): string;
|
|
7
|
+
export declare function groupPlatformAccountResetRows<T>(values: readonly T[], key: (value: T) => string): Map<string, T[]>;
|
|
8
|
+
export declare function incrementPlatformAccountResetCount<T>(counts: Map<T, number>, key: T): void;
|
|
9
|
+
export declare function comparePlatformAccountResetText(left: string, right: string): number;
|
|
10
|
+
export declare function queryPlatformAccountResetRows<T>(pool: PlatformIdentityQueryable, sql: string, values?: readonly unknown[]): Promise<readonly T[]>;
|
|
11
|
+
//# sourceMappingURL=platform-account-reset-ownership-helpers.d.ts.map
|
package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-ownership-helpers.d.ts","sourceRoot":"","sources":["../src/platform-account-reset-ownership-helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,wBAAgB,0BAA0B,CAAC,GAAG,EAAE;IAC9C,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;CACxB,GAAG,MAAM,CAET;AAED,wBAAgB,6BAA6B,CAAC,CAAC,EAC7C,MAAM,EAAE,SAAS,CAAC,EAAE,EACpB,GAAG,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,GACxB,GAAG,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC,CAQlB;AAED,wBAAgB,kCAAkC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,IAAI,CAE1F;AAED,wBAAgB,+BAA+B,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAsB,6BAA6B,CAAC,CAAC,EACnD,IAAI,EAAE,yBAAyB,EAC/B,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,SAAS,OAAO,EAAE,GAC1B,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC,CAEvB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export function platformAccountResetAppKey(row) {
|
|
2
|
+
return `${row.org_slug}\0${row.app_slug ?? row.slug ?? ''}`;
|
|
3
|
+
}
|
|
4
|
+
export function groupPlatformAccountResetRows(values, key) {
|
|
5
|
+
const grouped = new Map();
|
|
6
|
+
for (const value of values) {
|
|
7
|
+
const bucket = grouped.get(key(value)) ?? [];
|
|
8
|
+
bucket.push(value);
|
|
9
|
+
grouped.set(key(value), bucket);
|
|
10
|
+
}
|
|
11
|
+
return grouped;
|
|
12
|
+
}
|
|
13
|
+
export function incrementPlatformAccountResetCount(counts, key) {
|
|
14
|
+
counts.set(key, (counts.get(key) ?? 0) + 1);
|
|
15
|
+
}
|
|
16
|
+
export function comparePlatformAccountResetText(left, right) {
|
|
17
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
18
|
+
}
|
|
19
|
+
export async function queryPlatformAccountResetRows(pool, sql, values) {
|
|
20
|
+
return (await pool.query(sql, values)).rows;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=platform-account-reset-ownership-helpers.js.map
|
package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-helpers.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-ownership-helpers.js","sourceRoot":"","sources":["../src/platform-account-reset-ownership-helpers.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,0BAA0B,CAAC,GAI1C;IACC,OAAO,GAAG,GAAG,CAAC,QAAQ,KAAK,GAAG,CAAC,QAAQ,IAAI,GAAG,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,UAAU,6BAA6B,CAC3C,MAAoB,EACpB,GAAyB;IAEzB,MAAM,OAAO,GAAG,IAAI,GAAG,EAAe,CAAC;IACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;QAC7C,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,kCAAkC,CAAI,MAAsB,EAAE,GAAM;IAClF,MAAM,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,IAAY,EAAE,KAAa;IACzE,OAAO,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,6BAA6B,CACjD,IAA+B,EAC/B,GAAW,EACX,MAA2B;IAE3B,OAAO,CAAC,MAAM,IAAI,CAAC,KAAK,CAAI,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACjD,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { PlatformAccountResetBlockerCode } from './platform-account-reset.js';
|
|
2
|
+
import type { PlatformIdentityQueryable } from './platform-identity-postgres.js';
|
|
3
|
+
export type ResetDisposition = 'personal_org' | 'sole_owned_org' | 'target_owner_only_app' | 'preserved_shared_org' | 'preserved_org_members_app' | 'blocker';
|
|
4
|
+
export interface PlatformAccountResetCleanupResource {
|
|
5
|
+
readonly provider: 'postgres' | 'object_storage' | 'github' | 'stripe' | 'workos';
|
|
6
|
+
readonly resourceKind: string;
|
|
7
|
+
readonly locator: Readonly<Record<string, unknown>>;
|
|
8
|
+
readonly locatorFingerprint: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PlatformAccountResetOwnershipSnapshot {
|
|
11
|
+
readonly counts: {
|
|
12
|
+
readonly personalOrganizationCount: number;
|
|
13
|
+
readonly soleOwnedOrganizationCount: number;
|
|
14
|
+
readonly ownerOnlyAppCount: number;
|
|
15
|
+
readonly preservedSharedOrganizationCount: number;
|
|
16
|
+
readonly membershipCount: number;
|
|
17
|
+
readonly billingAccountCount: number;
|
|
18
|
+
readonly credentialCount: number;
|
|
19
|
+
readonly providerObjectCount: number;
|
|
20
|
+
};
|
|
21
|
+
readonly blockers: readonly {
|
|
22
|
+
readonly code: Extract<PlatformAccountResetBlockerCode, 'ownership_ambiguous' | 'shared_org_owner_required'>;
|
|
23
|
+
readonly count: number;
|
|
24
|
+
}[];
|
|
25
|
+
readonly cleanupResources: readonly PlatformAccountResetCleanupResource[];
|
|
26
|
+
readonly ownershipFingerprint: string;
|
|
27
|
+
readonly cleanupSetFingerprint: string;
|
|
28
|
+
readonly fingerprint: string;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Classifies only explicit relational ownership. Email fields are deliberately absent from every ownership
|
|
32
|
+
* predicate; the preview layer handles contact hints separately as restrictive evidence.
|
|
33
|
+
*/
|
|
34
|
+
export declare function loadPlatformAccountResetOwnershipSnapshot(pool: PlatformIdentityQueryable, input: {
|
|
35
|
+
readonly targetPrincipalIds: readonly string[];
|
|
36
|
+
readonly quarantine?: {
|
|
37
|
+
readonly operationId: string;
|
|
38
|
+
readonly cleanupResources: readonly PlatformAccountResetCleanupResource[];
|
|
39
|
+
};
|
|
40
|
+
}): Promise<PlatformAccountResetOwnershipSnapshot>;
|
|
41
|
+
//# sourceMappingURL=platform-account-reset-ownership-postgres.d.ts.map
|
package/node_modules/@noodle-borg/service/dist/platform-account-reset-ownership-postgres.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"platform-account-reset-ownership-postgres.d.ts","sourceRoot":"","sources":["../src/platform-account-reset-ownership-postgres.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,6BAA6B,CAAC;AAkBnF,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAEjF,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,gBAAgB,GAChB,uBAAuB,GACvB,sBAAsB,GACtB,2BAA2B,GAC3B,SAAS,CAAC;AAEd,MAAM,WAAW,mCAAmC;IAClD,QAAQ,CAAC,QAAQ,EAAE,UAAU,GAAG,gBAAgB,GAAG,QAAQ,GAAG,QAAQ,GAAG,QAAQ,CAAC;IAClF,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACpD,QAAQ,CAAC,kBAAkB,EAAE,MAAM,CAAC;CACrC;AAED,MAAM,WAAW,qCAAqC;IACpD,QAAQ,CAAC,MAAM,EAAE;QACf,QAAQ,CAAC,yBAAyB,EAAE,MAA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