@homeflare/alchemy 0.43.0 → 0.45.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/README.md +10 -1
- package/dist/caddy/index.js +35 -1
- package/dist/caddy/index.js.map +3 -3
- package/dist/launchd/index.js +35 -1
- package/dist/launchd/index.js.map +3 -3
- package/dist/linux/index.js +35 -1
- package/dist/linux/index.js.map +3 -3
- package/dist/litellm/access-group-form.d.ts +26 -0
- package/dist/litellm/access-group-form.d.ts.map +1 -0
- package/dist/litellm/access-group-operations.d.ts +37 -0
- package/dist/litellm/access-group-operations.d.ts.map +1 -0
- package/dist/litellm/access-group-types.d.ts +49 -0
- package/dist/litellm/access-group-types.d.ts.map +1 -0
- package/dist/litellm/access-group.d.ts +55 -0
- package/dist/litellm/access-group.d.ts.map +1 -0
- package/dist/litellm/credential-errors.d.ts +131 -0
- package/dist/litellm/credential-errors.d.ts.map +1 -0
- package/dist/litellm/credential-form.d.ts +79 -0
- package/dist/litellm/credential-form.d.ts.map +1 -0
- package/dist/litellm/credential-operations.d.ts +84 -0
- package/dist/litellm/credential-operations.d.ts.map +1 -0
- package/dist/litellm/credential-rewrite.d.ts +6 -0
- package/dist/litellm/credential-rewrite.d.ts.map +1 -0
- package/dist/litellm/credential-types.d.ts +87 -0
- package/dist/litellm/credential-types.d.ts.map +1 -0
- package/dist/litellm/credential-values.d.ts +53 -0
- package/dist/litellm/credential-values.d.ts.map +1 -0
- package/dist/litellm/credential.d.ts +83 -0
- package/dist/litellm/credential.d.ts.map +1 -0
- package/dist/litellm/fake-access-group-litellm.d.ts +34 -0
- package/dist/litellm/fake-access-group-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-credential-litellm.d.ts +54 -0
- package/dist/litellm/fake-credential-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-keys.d.ts +53 -0
- package/dist/litellm/fake-keys.d.ts.map +1 -0
- package/dist/litellm/fake-litellm.d.ts +4 -1
- package/dist/litellm/fake-litellm.d.ts.map +1 -1
- package/dist/litellm/fake-mcp-litellm.d.ts +67 -0
- package/dist/litellm/fake-mcp-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-model-litellm-post-update.d.ts +49 -0
- package/dist/litellm/fake-model-litellm-post-update.d.ts.map +1 -0
- package/dist/litellm/fake-model-litellm.d.ts +48 -0
- package/dist/litellm/fake-model-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-policy-attachment-litellm.d.ts +33 -0
- package/dist/litellm/fake-policy-attachment-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-policy-litellm.d.ts +32 -0
- package/dist/litellm/fake-policy-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-registry-base.d.ts +42 -0
- package/dist/litellm/fake-registry-base.d.ts.map +1 -0
- package/dist/litellm/fake-stack.d.ts +8 -1
- package/dist/litellm/fake-stack.d.ts.map +1 -1
- package/dist/litellm/fake-team-litellm.d.ts +47 -0
- package/dist/litellm/fake-team-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-tool-litellm.d.ts +28 -0
- package/dist/litellm/fake-tool-litellm.d.ts.map +1 -0
- package/dist/litellm/fake-toolset-litellm.d.ts +29 -0
- package/dist/litellm/fake-toolset-litellm.d.ts.map +1 -0
- package/dist/litellm/index.d.ts +18 -0
- package/dist/litellm/index.d.ts.map +1 -1
- package/dist/litellm/index.js +3078 -2
- package/dist/litellm/index.js.map +65 -4
- package/dist/litellm/key-errors.d.ts +169 -0
- package/dist/litellm/key-errors.d.ts.map +1 -0
- package/dist/litellm/key-form.d.ts +119 -0
- package/dist/litellm/key-form.d.ts.map +1 -0
- package/dist/litellm/key-harness.d.ts +41 -0
- package/dist/litellm/key-harness.d.ts.map +1 -0
- package/dist/litellm/key-metadata-errors.d.ts +30 -0
- package/dist/litellm/key-metadata-errors.d.ts.map +1 -0
- package/dist/litellm/key-metadata.d.ts +22 -0
- package/dist/litellm/key-metadata.d.ts.map +1 -0
- package/dist/litellm/key-operations.d.ts +63 -0
- package/dist/litellm/key-operations.d.ts.map +1 -0
- package/dist/litellm/key-secret.d.ts +33 -0
- package/dist/litellm/key-secret.d.ts.map +1 -0
- package/dist/litellm/key.d.ts +78 -0
- package/dist/litellm/key.d.ts.map +1 -0
- package/dist/litellm/mcp-server-credential.d.ts +50 -0
- package/dist/litellm/mcp-server-credential.d.ts.map +1 -0
- package/dist/litellm/mcp-server-errors.d.ts +101 -0
- package/dist/litellm/mcp-server-errors.d.ts.map +1 -0
- package/dist/litellm/mcp-server-form.d.ts +56 -0
- package/dist/litellm/mcp-server-form.d.ts.map +1 -0
- package/dist/litellm/mcp-server-locate.d.ts +26 -0
- package/dist/litellm/mcp-server-locate.d.ts.map +1 -0
- package/dist/litellm/mcp-server-operations.d.ts +63 -0
- package/dist/litellm/mcp-server-operations.d.ts.map +1 -0
- package/dist/litellm/mcp-server-shadow.d.ts +24 -0
- package/dist/litellm/mcp-server-shadow.d.ts.map +1 -0
- package/dist/litellm/mcp-server-types.d.ts +118 -0
- package/dist/litellm/mcp-server-types.d.ts.map +1 -0
- package/dist/litellm/mcp-server-url.d.ts +11 -0
- package/dist/litellm/mcp-server-url.d.ts.map +1 -0
- package/dist/litellm/mcp-server.d.ts +95 -0
- package/dist/litellm/mcp-server.d.ts.map +1 -0
- package/dist/litellm/model-claim.d.ts +24 -0
- package/dist/litellm/model-claim.d.ts.map +1 -0
- package/dist/litellm/model-credential.d.ts +12 -0
- package/dist/litellm/model-credential.d.ts.map +1 -0
- package/dist/litellm/model-errors.d.ts +119 -0
- package/dist/litellm/model-errors.d.ts.map +1 -0
- package/dist/litellm/model-form.d.ts +78 -0
- package/dist/litellm/model-form.d.ts.map +1 -0
- package/dist/litellm/model-locate.d.ts +13 -0
- package/dist/litellm/model-locate.d.ts.map +1 -0
- package/dist/litellm/model-operations.d.ts +59 -0
- package/dist/litellm/model-operations.d.ts.map +1 -0
- package/dist/litellm/model-types.d.ts +91 -0
- package/dist/litellm/model-types.d.ts.map +1 -0
- package/dist/litellm/model.d.ts +88 -0
- package/dist/litellm/model.d.ts.map +1 -0
- package/dist/litellm/policy-attachment-form.d.ts +19 -0
- package/dist/litellm/policy-attachment-form.d.ts.map +1 -0
- package/dist/litellm/policy-attachment-operations.d.ts +31 -0
- package/dist/litellm/policy-attachment-operations.d.ts.map +1 -0
- package/dist/litellm/policy-attachment-types.d.ts +48 -0
- package/dist/litellm/policy-attachment-types.d.ts.map +1 -0
- package/dist/litellm/policy-attachment.d.ts +61 -0
- package/dist/litellm/policy-attachment.d.ts.map +1 -0
- package/dist/litellm/policy-form.d.ts +22 -0
- package/dist/litellm/policy-form.d.ts.map +1 -0
- package/dist/litellm/policy-operations.d.ts +42 -0
- package/dist/litellm/policy-operations.d.ts.map +1 -0
- package/dist/litellm/policy-types.d.ts +57 -0
- package/dist/litellm/policy-types.d.ts.map +1 -0
- package/dist/litellm/policy.d.ts +65 -0
- package/dist/litellm/policy.d.ts.map +1 -0
- package/dist/litellm/providers.d.ts +1 -1
- package/dist/litellm/providers.d.ts.map +1 -1
- package/dist/litellm/registry-errors.d.ts +62 -0
- package/dist/litellm/registry-errors.d.ts.map +1 -0
- package/dist/litellm/registry-support.d.ts +42 -0
- package/dist/litellm/registry-support.d.ts.map +1 -0
- package/dist/litellm/team-form.d.ts +26 -0
- package/dist/litellm/team-form.d.ts.map +1 -0
- package/dist/litellm/team-members.d.ts +10 -0
- package/dist/litellm/team-members.d.ts.map +1 -0
- package/dist/litellm/team-operations.d.ts +38 -0
- package/dist/litellm/team-operations.d.ts.map +1 -0
- package/dist/litellm/team-permission.d.ts +35 -0
- package/dist/litellm/team-permission.d.ts.map +1 -0
- package/dist/litellm/team-types.d.ts +101 -0
- package/dist/litellm/team-types.d.ts.map +1 -0
- package/dist/litellm/team.d.ts +67 -0
- package/dist/litellm/team.d.ts.map +1 -0
- package/dist/litellm/tool-policy-form.d.ts +21 -0
- package/dist/litellm/tool-policy-form.d.ts.map +1 -0
- package/dist/litellm/tool-policy-operations.d.ts +30 -0
- package/dist/litellm/tool-policy-operations.d.ts.map +1 -0
- package/dist/litellm/tool-policy-types.d.ts +46 -0
- package/dist/litellm/tool-policy-types.d.ts.map +1 -0
- package/dist/litellm/tool-policy.d.ts +62 -0
- package/dist/litellm/tool-policy.d.ts.map +1 -0
- package/dist/litellm/toolset-form.d.ts +20 -0
- package/dist/litellm/toolset-form.d.ts.map +1 -0
- package/dist/litellm/toolset-operations.d.ts +39 -0
- package/dist/litellm/toolset-operations.d.ts.map +1 -0
- package/dist/litellm/toolset-types.d.ts +46 -0
- package/dist/litellm/toolset-types.d.ts.map +1 -0
- package/dist/litellm/toolset.d.ts +55 -0
- package/dist/litellm/toolset.d.ts.map +1 -0
- package/dist/openbao/index.js +35 -1
- package/dist/openbao/index.js.map +3 -3
- package/dist/ownership/rows.d.ts +11 -0
- package/dist/ownership/rows.d.ts.map +1 -1
- package/dist/postgres/connection.d.ts +14 -2
- package/dist/postgres/connection.d.ts.map +1 -1
- package/dist/postgres/database-sql.d.ts +27 -8
- package/dist/postgres/database-sql.d.ts.map +1 -1
- package/dist/postgres/fake-grants-parse.d.ts +37 -0
- package/dist/postgres/fake-grants-parse.d.ts.map +1 -0
- package/dist/postgres/fake-grants-read.d.ts +61 -0
- package/dist/postgres/fake-grants-read.d.ts.map +1 -0
- package/dist/postgres/fake-grants-sql.d.ts +46 -0
- package/dist/postgres/fake-grants-sql.d.ts.map +1 -0
- package/dist/postgres/fake-grants-write.d.ts +29 -0
- package/dist/postgres/fake-grants-write.d.ts.map +1 -0
- package/dist/postgres/fake-role-sql.d.ts +41 -0
- package/dist/postgres/fake-role-sql.d.ts.map +1 -0
- package/dist/postgres/fake-schema-sql.d.ts +42 -0
- package/dist/postgres/fake-schema-sql.d.ts.map +1 -0
- package/dist/postgres/fake-sql-parse.d.ts +23 -0
- package/dist/postgres/fake-sql-parse.d.ts.map +1 -0
- package/dist/postgres/fake-sql-quote.d.ts +12 -0
- package/dist/postgres/fake-sql-quote.d.ts.map +1 -0
- package/dist/postgres/fake-sql.d.ts +42 -0
- package/dist/postgres/fake-sql.d.ts.map +1 -1
- package/dist/postgres/grants-attrs.d.ts +115 -0
- package/dist/postgres/grants-attrs.d.ts.map +1 -0
- package/dist/postgres/grants-declare.d.ts +88 -0
- package/dist/postgres/grants-declare.d.ts.map +1 -0
- package/dist/postgres/grants-diff.d.ts +25 -0
- package/dist/postgres/grants-diff.d.ts.map +1 -0
- package/dist/postgres/grants-errors.d.ts +137 -0
- package/dist/postgres/grants-errors.d.ts.map +1 -0
- package/dist/postgres/grants-existence.d.ts +14 -0
- package/dist/postgres/grants-existence.d.ts.map +1 -0
- package/dist/postgres/grants-ops.d.ts +65 -0
- package/dist/postgres/grants-ops.d.ts.map +1 -0
- package/dist/postgres/grants-ownership.d.ts +18 -0
- package/dist/postgres/grants-ownership.d.ts.map +1 -0
- package/dist/postgres/grants-plan-restore.d.ts +22 -0
- package/dist/postgres/grants-plan-restore.d.ts.map +1 -0
- package/dist/postgres/grants-plan.d.ts +65 -0
- package/dist/postgres/grants-plan.d.ts.map +1 -0
- package/dist/postgres/grants-read-defaults.d.ts +17 -0
- package/dist/postgres/grants-read-defaults.d.ts.map +1 -0
- package/dist/postgres/grants-read.d.ts +77 -0
- package/dist/postgres/grants-read.d.ts.map +1 -0
- package/dist/postgres/grants-refuse.d.ts +25 -0
- package/dist/postgres/grants-refuse.d.ts.map +1 -0
- package/dist/postgres/grants-sql.d.ts +42 -0
- package/dist/postgres/grants-sql.d.ts.map +1 -0
- package/dist/postgres/grants-words.d.ts +29 -0
- package/dist/postgres/grants-words.d.ts.map +1 -0
- package/dist/postgres/grants.d.ts +37 -0
- package/dist/postgres/grants.d.ts.map +1 -0
- package/dist/postgres/index.d.ts +31 -6
- package/dist/postgres/index.d.ts.map +1 -1
- package/dist/postgres/index.js +1998 -37
- package/dist/postgres/index.js.map +46 -7
- package/dist/postgres/installed-classifier.d.ts +13 -0
- package/dist/postgres/installed-classifier.d.ts.map +1 -0
- package/dist/postgres/providers.d.ts +16 -8
- package/dist/postgres/providers.d.ts.map +1 -1
- package/dist/postgres/psql-executor.d.ts +4 -0
- package/dist/postgres/psql-executor.d.ts.map +1 -1
- package/dist/postgres/role-attrs.d.ts +112 -0
- package/dist/postgres/role-attrs.d.ts.map +1 -0
- package/dist/postgres/role-diff.d.ts +22 -0
- package/dist/postgres/role-diff.d.ts.map +1 -0
- package/dist/postgres/role-errors.d.ts +132 -0
- package/dist/postgres/role-errors.d.ts.map +1 -0
- package/dist/postgres/role-membership-sql.d.ts +78 -0
- package/dist/postgres/role-membership-sql.d.ts.map +1 -0
- package/dist/postgres/role-provider.d.ts +11 -0
- package/dist/postgres/role-provider.d.ts.map +1 -0
- package/dist/postgres/role-scram.d.ts +8 -0
- package/dist/postgres/role-scram.d.ts.map +1 -0
- package/dist/postgres/role-secrets.d.ts +38 -0
- package/dist/postgres/role-secrets.d.ts.map +1 -0
- package/dist/postgres/role-sql.d.ts +68 -0
- package/dist/postgres/role-sql.d.ts.map +1 -0
- package/dist/postgres/role.d.ts +57 -0
- package/dist/postgres/role.d.ts.map +1 -0
- package/dist/postgres/schema-assert.d.ts +50 -0
- package/dist/postgres/schema-assert.d.ts.map +1 -0
- package/dist/postgres/schema-attrs.d.ts +51 -0
- package/dist/postgres/schema-attrs.d.ts.map +1 -0
- package/dist/postgres/schema-delete.d.ts +28 -0
- package/dist/postgres/schema-delete.d.ts.map +1 -0
- package/dist/postgres/schema-diff.d.ts +14 -0
- package/dist/postgres/schema-diff.d.ts.map +1 -0
- package/dist/postgres/schema-errors.d.ts +139 -0
- package/dist/postgres/schema-errors.d.ts.map +1 -0
- package/dist/postgres/schema-identity.d.ts +8 -0
- package/dist/postgres/schema-identity.d.ts.map +1 -0
- package/dist/postgres/schema-reconcile.d.ts +12 -0
- package/dist/postgres/schema-reconcile.d.ts.map +1 -0
- package/dist/postgres/schema-sql.d.ts +45 -0
- package/dist/postgres/schema-sql.d.ts.map +1 -0
- package/dist/postgres/schema-test-kit.d.ts +67 -0
- package/dist/postgres/schema-test-kit.d.ts.map +1 -0
- package/dist/postgres/schema.d.ts +54 -0
- package/dist/postgres/schema.d.ts.map +1 -0
- package/dist/proxmox/index.js +35 -1
- package/dist/proxmox/index.js.map +3 -3
- package/dist/release/fake-engine.d.ts +10 -0
- package/dist/release/fake-engine.d.ts.map +1 -1
- package/dist/release/index.js +35 -1
- package/dist/release/index.js.map +3 -3
- package/dist/valkey/acl-attrs.d.ts +94 -0
- package/dist/valkey/acl-attrs.d.ts.map +1 -0
- package/dist/valkey/acl-compare.d.ts +28 -0
- package/dist/valkey/acl-compare.d.ts.map +1 -0
- package/dist/valkey/acl-connection.d.ts +6 -0
- package/dist/valkey/acl-connection.d.ts.map +1 -0
- package/dist/valkey/acl-form.d.ts +62 -0
- package/dist/valkey/acl-form.d.ts.map +1 -0
- package/dist/valkey/acl-managed.d.ts +4 -0
- package/dist/valkey/acl-managed.d.ts.map +1 -0
- package/dist/valkey/acl-ops.d.ts +37 -0
- package/dist/valkey/acl-ops.d.ts.map +1 -0
- package/dist/valkey/acl-profiles.d.ts +53 -0
- package/dist/valkey/acl-profiles.d.ts.map +1 -0
- package/dist/valkey/acl-reconcile.d.ts +26 -0
- package/dist/valkey/acl-reconcile.d.ts.map +1 -0
- package/dist/valkey/acl.d.ts +24 -0
- package/dist/valkey/acl.d.ts.map +1 -0
- package/dist/valkey/connection-service.d.ts +22 -0
- package/dist/valkey/connection-service.d.ts.map +1 -0
- package/dist/valkey/connection.d.ts +59 -0
- package/dist/valkey/connection.d.ts.map +1 -0
- package/dist/valkey/errors.d.ts +165 -0
- package/dist/valkey/errors.d.ts.map +1 -0
- package/dist/valkey/fake-acl.d.ts +29 -0
- package/dist/valkey/fake-acl.d.ts.map +1 -0
- package/dist/valkey/fake-valkey.d.ts +35 -0
- package/dist/valkey/fake-valkey.d.ts.map +1 -0
- package/dist/valkey/handler-test-fixture.d.ts +20 -0
- package/dist/valkey/handler-test-fixture.d.ts.map +1 -0
- package/dist/valkey/index.d.ts +18 -0
- package/dist/valkey/index.d.ts.map +1 -0
- package/dist/valkey/index.js +964 -0
- package/dist/valkey/index.js.map +27 -0
- package/dist/valkey/instance-attrs.d.ts +46 -0
- package/dist/valkey/instance-attrs.d.ts.map +1 -0
- package/dist/valkey/instance-form.d.ts +22 -0
- package/dist/valkey/instance-form.d.ts.map +1 -0
- package/dist/valkey/instance.d.ts +48 -0
- package/dist/valkey/instance.d.ts.map +1 -0
- package/dist/valkey/provider-socket-fixture.d.ts +8 -0
- package/dist/valkey/provider-socket-fixture.d.ts.map +1 -0
- package/dist/valkey/providers.d.ts +16 -0
- package/dist/valkey/providers.d.ts.map +1 -0
- package/dist/valkey/resp.d.ts +38 -0
- package/dist/valkey/resp.d.ts.map +1 -0
- package/dist/valkey/transport-error.d.ts +36 -0
- package/dist/valkey/transport-error.d.ts.map +1 -0
- package/dist/valkey/transport.d.ts +50 -0
- package/dist/valkey/transport.d.ts.map +1 -0
- package/docs/litellm-access-group.md +105 -0
- package/docs/litellm-credential.md +60 -0
- package/docs/litellm-key-metadata.md +56 -0
- package/docs/litellm-key.md +194 -0
- package/docs/litellm-mcp.md +187 -0
- package/docs/litellm-model.md +111 -0
- package/docs/litellm-policy-attachment.md +86 -0
- package/docs/litellm-policy.md +103 -0
- package/docs/litellm-team.md +117 -0
- package/docs/litellm-tool-policy.md +90 -0
- package/docs/litellm-toolset.md +92 -0
- package/docs/litellm.md +16 -9
- package/docs/peers.md +15 -6
- package/docs/postgres-grants-example.md +55 -0
- package/docs/postgres-grants.md +157 -0
- package/docs/postgres-role.md +126 -0
- package/docs/postgres-schema.md +139 -0
- package/docs/postgres.md +20 -3
- package/docs/valkey-transport.md +29 -0
- package/docs/valkey.md +187 -0
- package/package.json +6 -2
- package/src/ceph/ceph-argv.test.ts +1 -1
- package/src/launchd/sudo-allowlist.test.ts +2 -2
- package/src/linux/sudo-allowlist.test.ts +3 -3
- package/src/linux/sudo-runner.test.ts +2 -2
- package/src/litellm/access-group-form.ts +105 -0
- package/src/litellm/access-group-operations.ts +92 -0
- package/src/litellm/access-group-types.ts +49 -0
- package/src/litellm/access-group.test.ts +197 -0
- package/src/litellm/access-group.ts +151 -0
- package/src/litellm/credential-errors.ts +183 -0
- package/src/litellm/credential-form.test.ts +151 -0
- package/src/litellm/credential-form.ts +211 -0
- package/src/litellm/credential-guards.test.ts +241 -0
- package/src/litellm/credential-operations.ts +208 -0
- package/src/litellm/credential-recovery.test.ts +93 -0
- package/src/litellm/credential-rewrite.test.ts +164 -0
- package/src/litellm/credential-rewrite.ts +50 -0
- package/src/litellm/credential-types.ts +117 -0
- package/src/litellm/credential-values.ts +94 -0
- package/src/litellm/credential.test.ts +218 -0
- package/src/litellm/credential.ts +227 -0
- package/src/litellm/fake-access-group-litellm.ts +127 -0
- package/src/litellm/fake-credential-litellm.ts +216 -0
- package/src/litellm/fake-keys.ts +190 -0
- package/src/litellm/fake-litellm.ts +19 -9
- package/src/litellm/fake-mcp-litellm.ts +214 -0
- package/src/litellm/fake-model-litellm-post-update.ts +103 -0
- package/src/litellm/fake-model-litellm.ts +233 -0
- package/src/litellm/fake-policy-attachment-litellm.ts +97 -0
- package/src/litellm/fake-policy-litellm.ts +186 -0
- package/src/litellm/fake-registry-base.ts +69 -0
- package/src/litellm/fake-stack.ts +17 -1
- package/src/litellm/fake-team-litellm.ts +229 -0
- package/src/litellm/fake-tool-litellm.ts +88 -0
- package/src/litellm/fake-toolset-litellm.ts +110 -0
- package/src/litellm/index.ts +140 -0
- package/src/litellm/key-delete.test.ts +212 -0
- package/src/litellm/key-errors.ts +241 -0
- package/src/litellm/key-form.ts +200 -0
- package/src/litellm/key-harness.ts +121 -0
- package/src/litellm/key-metadata-errors.ts +49 -0
- package/src/litellm/key-metadata.test.ts +156 -0
- package/src/litellm/key-metadata.ts +74 -0
- package/src/litellm/key-operations.ts +184 -0
- package/src/litellm/key-rotation.test.ts +110 -0
- package/src/litellm/key-scope.test.ts +135 -0
- package/src/litellm/key-secret.test.ts +248 -0
- package/src/litellm/key-secret.ts +137 -0
- package/src/litellm/key-transport.test.ts +166 -0
- package/src/litellm/key.test.ts +231 -0
- package/src/litellm/key.ts +213 -0
- package/src/litellm/mcp-server-adopt.test.ts +86 -0
- package/src/litellm/mcp-server-alias.test.ts +184 -0
- package/src/litellm/mcp-server-credential.ts +85 -0
- package/src/litellm/mcp-server-errors.ts +141 -0
- package/src/litellm/mcp-server-exports.test.ts +15 -0
- package/src/litellm/mcp-server-form.test.ts +241 -0
- package/src/litellm/mcp-server-form.ts +233 -0
- package/src/litellm/mcp-server-handlers.test.ts +150 -0
- package/src/litellm/mcp-server-locate.ts +66 -0
- package/src/litellm/mcp-server-operations.ts +111 -0
- package/src/litellm/mcp-server-registry.test.ts +146 -0
- package/src/litellm/mcp-server-retype.test.ts +114 -0
- package/src/litellm/mcp-server-shadow.test.ts +91 -0
- package/src/litellm/mcp-server-shadow.ts +45 -0
- package/src/litellm/mcp-server-tools.test.ts +85 -0
- package/src/litellm/mcp-server-types.ts +143 -0
- package/src/litellm/mcp-server-url.ts +66 -0
- package/src/litellm/mcp-server.test.ts +213 -0
- package/src/litellm/mcp-server.ts +225 -0
- package/src/litellm/model-claim.ts +69 -0
- package/src/litellm/model-credential.ts +45 -0
- package/src/litellm/model-errors.ts +168 -0
- package/src/litellm/model-foreign-row.test.ts +173 -0
- package/src/litellm/model-form.test.ts +228 -0
- package/src/litellm/model-form.ts +223 -0
- package/src/litellm/model-locate.test.ts +128 -0
- package/src/litellm/model-locate.ts +67 -0
- package/src/litellm/model-operations.test.ts +93 -0
- package/src/litellm/model-operations.ts +146 -0
- package/src/litellm/model-params-preserve.test.ts +119 -0
- package/src/litellm/model-recovery.test.ts +57 -0
- package/src/litellm/model-types.ts +112 -0
- package/src/litellm/model.test.ts +222 -0
- package/src/litellm/model.ts +237 -0
- package/src/litellm/policy-attachment-form.ts +103 -0
- package/src/litellm/policy-attachment-operations.ts +74 -0
- package/src/litellm/policy-attachment-types.ts +48 -0
- package/src/litellm/policy-attachment.test.ts +198 -0
- package/src/litellm/policy-attachment.ts +178 -0
- package/src/litellm/policy-form.ts +122 -0
- package/src/litellm/policy-operations.ts +112 -0
- package/src/litellm/policy-types.ts +58 -0
- package/src/litellm/policy.test.ts +214 -0
- package/src/litellm/policy.ts +146 -0
- package/src/litellm/providers.ts +24 -3
- package/src/litellm/registry-errors.ts +88 -0
- package/src/litellm/registry-exports.test.ts +66 -0
- package/src/litellm/registry-support.ts +109 -0
- package/src/litellm/team-form.ts +140 -0
- package/src/litellm/team-members.test.ts +150 -0
- package/src/litellm/team-members.ts +58 -0
- package/src/litellm/team-operations.ts +90 -0
- package/src/litellm/team-permission.ts +159 -0
- package/src/litellm/team-read.test.ts +89 -0
- package/src/litellm/team-types.ts +106 -0
- package/src/litellm/team.test.ts +206 -0
- package/src/litellm/team.ts +159 -0
- package/src/litellm/tool-policy-form.ts +94 -0
- package/src/litellm/tool-policy-operations.ts +58 -0
- package/src/litellm/tool-policy-types.ts +48 -0
- package/src/litellm/tool-policy.test.ts +172 -0
- package/src/litellm/tool-policy.ts +125 -0
- package/src/litellm/toolset-form.ts +104 -0
- package/src/litellm/toolset-operations.ts +90 -0
- package/src/litellm/toolset-types.ts +47 -0
- package/src/litellm/toolset.test.ts +198 -0
- package/src/litellm/toolset.ts +151 -0
- package/src/ownership/ownership.test.ts +33 -1
- package/src/ownership/rows.ts +53 -0
- package/src/postgres/connection.ts +42 -7
- package/src/postgres/database-bigint-serialization.test.ts +1 -0
- package/src/postgres/database-refusals.test.ts +2 -2
- package/src/postgres/database-sql.ts +36 -9
- package/src/postgres/fake-grants-parse.ts +189 -0
- package/src/postgres/fake-grants-read.ts +250 -0
- package/src/postgres/fake-grants-sql.ts +207 -0
- package/src/postgres/fake-grants-write.ts +90 -0
- package/src/postgres/fake-role-sql.ts +240 -0
- package/src/postgres/fake-schema-semantics.test.ts +36 -0
- package/src/postgres/fake-schema-sql.ts +146 -0
- package/src/postgres/fake-sql-parse.ts +86 -0
- package/src/postgres/fake-sql-quote.ts +36 -0
- package/src/postgres/fake-sql.ts +166 -46
- package/src/postgres/fixtures/pg-REL_18_6-acl.h.txt +147 -0
- package/src/postgres/fixtures/pg-REL_18_6-aclexplode-func.txt +31 -0
- package/src/postgres/fixtures/pg-REL_18_6-alter-default-privileges-synopsis.txt +82 -0
- package/src/postgres/fixtures/pg-REL_18_6-alter_role.sgml.txt +44 -0
- package/src/postgres/fixtures/pg-REL_18_6-create_role.sgml.txt +26 -0
- package/src/postgres/fixtures/pg-REL_18_6-grant-synopsis.txt +95 -0
- package/src/postgres/fixtures/pg-REL_18_6-pg_attribute.h.txt +24 -0
- package/src/postgres/fixtures/pg-REL_18_6-pg_auth_members.h.txt +62 -0
- package/src/postgres/fixtures/pg-REL_18_6-pg_authid.h.txt +70 -0
- package/src/postgres/fixtures/pg-REL_18_6-pg_class.h.txt +33 -0
- package/src/postgres/fixtures/pg-REL_18_6-pg_default_acl.h.txt +81 -0
- package/src/postgres/fixtures/pg-REL_18_6-pg_namespace.h.txt +28 -0
- package/src/postgres/fixtures/pg-REL_18_6-revoke-synopsis.txt +124 -0
- package/src/postgres/grants-acl.test.ts +61 -0
- package/src/postgres/grants-attrs.ts +185 -0
- package/src/postgres/grants-database.test.ts +158 -0
- package/src/postgres/grants-declare.ts +172 -0
- package/src/postgres/grants-delete-proof.test.ts +154 -0
- package/src/postgres/grants-diff.ts +101 -0
- package/src/postgres/grants-errors.ts +215 -0
- package/src/postgres/grants-existence-guards.test.ts +113 -0
- package/src/postgres/grants-existence.ts +101 -0
- package/src/postgres/grants-lifecycle-guards.test.ts +208 -0
- package/src/postgres/grants-lifecycle-repair.test.ts +208 -0
- package/src/postgres/grants-lifecycle.test.ts +181 -0
- package/src/postgres/grants-ops.ts +229 -0
- package/src/postgres/grants-owner-revoke.test.ts +121 -0
- package/src/postgres/grants-ownership.ts +49 -0
- package/src/postgres/grants-plan-collateral.test.ts +202 -0
- package/src/postgres/grants-plan-diff.test.ts +204 -0
- package/src/postgres/grants-plan-restore.ts +43 -0
- package/src/postgres/grants-plan-revocations.test.ts +69 -0
- package/src/postgres/grants-plan.test.ts +148 -0
- package/src/postgres/grants-plan.ts +245 -0
- package/src/postgres/grants-provenance.test.ts +134 -0
- package/src/postgres/grants-psql-lifecycle.test.ts +105 -0
- package/src/postgres/grants-read-absent.test.ts +91 -0
- package/src/postgres/grants-read-defaults.ts +51 -0
- package/src/postgres/grants-read.ts +250 -0
- package/src/postgres/grants-refusals.test.ts +136 -0
- package/src/postgres/grants-refuse.ts +119 -0
- package/src/postgres/grants-relkind-wire.test.ts +111 -0
- package/src/postgres/grants-repair-plan.test.ts +201 -0
- package/src/postgres/grants-sql.test.ts +128 -0
- package/src/postgres/grants-sql.ts +144 -0
- package/src/postgres/grants-words.ts +34 -0
- package/src/postgres/grants.ts +110 -0
- package/src/postgres/index.ts +129 -5
- package/src/postgres/installed-classifier.ts +36 -0
- package/src/postgres/providers.ts +33 -9
- package/src/postgres/psql-executor-escaping.test.ts +67 -0
- package/src/postgres/psql-executor.test.ts +63 -2
- package/src/postgres/psql-executor.ts +74 -34
- package/src/postgres/role-adopt.test.ts +98 -0
- package/src/postgres/role-attrs.ts +137 -0
- package/src/postgres/role-diff.ts +93 -0
- package/src/postgres/role-errors.ts +206 -0
- package/src/postgres/role-guard.test.ts +60 -0
- package/src/postgres/role-identity.test.ts +197 -0
- package/src/postgres/role-lifecycle.test.ts +228 -0
- package/src/postgres/role-membership-options.test.ts +73 -0
- package/src/postgres/role-membership-repair.test.ts +153 -0
- package/src/postgres/role-membership-sql.ts +223 -0
- package/src/postgres/role-password-ascii.test.ts +53 -0
- package/src/postgres/role-password-transports.test.ts +123 -0
- package/src/postgres/role-password.test.ts +158 -0
- package/src/postgres/role-privilege.test.ts +107 -0
- package/src/postgres/role-provenance.test.ts +200 -0
- package/src/postgres/role-provider.ts +105 -0
- package/src/postgres/role-refusals.test.ts +225 -0
- package/src/postgres/role-scram.test.ts +38 -0
- package/src/postgres/role-scram.ts +40 -0
- package/src/postgres/role-secrets.ts +61 -0
- package/src/postgres/role-sql.ts +213 -0
- package/src/postgres/role-valid-until.test.ts +68 -0
- package/src/postgres/role.ts +226 -0
- package/src/postgres/schema-assert.ts +139 -0
- package/src/postgres/schema-attrs.ts +71 -0
- package/src/postgres/schema-delete-proofs.test.ts +192 -0
- package/src/postgres/schema-delete.ts +96 -0
- package/src/postgres/schema-diff.ts +44 -0
- package/src/postgres/schema-drop-2bp01.test.ts +146 -0
- package/src/postgres/schema-errors.ts +209 -0
- package/src/postgres/schema-handlers.test.ts +193 -0
- package/src/postgres/schema-identity.ts +39 -0
- package/src/postgres/schema-lifecycle.test.ts +246 -0
- package/src/postgres/schema-race.test.ts +70 -0
- package/src/postgres/schema-reconcile.ts +100 -0
- package/src/postgres/schema-refusals.test.ts +144 -0
- package/src/postgres/schema-socket.test.ts +162 -0
- package/src/postgres/schema-sql.ts +130 -0
- package/src/postgres/schema-takeover.test.ts +149 -0
- package/src/postgres/schema-test-kit.ts +85 -0
- package/src/postgres/schema.ts +130 -0
- package/src/release/binary-alias.test.ts +3 -3
- package/src/release/binary-claims.test.ts +3 -3
- package/src/release/binary-directory-umask.test.ts +65 -0
- package/src/release/fake-engine.ts +15 -0
- package/src/valkey/acl-attrs.ts +98 -0
- package/src/valkey/acl-compare.ts +57 -0
- package/src/valkey/acl-connection.ts +13 -0
- package/src/valkey/acl-delete.test.ts +127 -0
- package/src/valkey/acl-form.ts +239 -0
- package/src/valkey/acl-managed.ts +13 -0
- package/src/valkey/acl-ops.ts +122 -0
- package/src/valkey/acl-ownership.test.ts +118 -0
- package/src/valkey/acl-prefix.test.ts +38 -0
- package/src/valkey/acl-profiles.ts +81 -0
- package/src/valkey/acl-reconcile.ts +180 -0
- package/src/valkey/acl-reserved.test.ts +69 -0
- package/src/valkey/acl-revocation.test.ts +94 -0
- package/src/valkey/acl-seat-prefix.test.ts +111 -0
- package/src/valkey/acl-validation.test.ts +54 -0
- package/src/valkey/acl.test.ts +215 -0
- package/src/valkey/acl.ts +169 -0
- package/src/valkey/connection-service.ts +46 -0
- package/src/valkey/connection.ts +180 -0
- package/src/valkey/errors.ts +239 -0
- package/src/valkey/fake-acl.ts +128 -0
- package/src/valkey/fake-valkey.ts +224 -0
- package/src/valkey/handler-test-fixture.ts +43 -0
- package/src/valkey/handlers.test.ts +205 -0
- package/src/valkey/index.ts +54 -0
- package/src/valkey/instance-attrs.ts +48 -0
- package/src/valkey/instance-form.ts +104 -0
- package/src/valkey/instance.test.ts +108 -0
- package/src/valkey/instance.ts +160 -0
- package/src/valkey/provider-socket-fixture.ts +71 -0
- package/src/valkey/providers.test.ts +129 -0
- package/src/valkey/providers.ts +21 -0
- package/src/valkey/resp.ts +212 -0
- package/src/valkey/transport-bounds.test.ts +150 -0
- package/src/valkey/transport-error.ts +37 -0
- package/src/valkey/transport.test.ts +158 -0
- package/src/valkey/transport.ts +109 -0
- package/src/valkey/upstream-bounds.test.ts +14 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/** Every schema privilege `GRANT … ON SCHEMA` accepts at REL_18_6 (`ACL_ALL_RIGHTS_SCHEMA`).
|
|
2
|
+
* `CREATE` lets the role create objects IN the schema; `USAGE` lets it use objects already
|
|
3
|
+
* there. `schemaUsage` defaults true (a role declared into a schema it cannot even resolve
|
|
4
|
+
* is almost always a mistake), `schemaCreate` defaults false (create is a real power). */
|
|
5
|
+
export declare const SCHEMA_PRIVILEGES: readonly ['usage', 'create'];
|
|
6
|
+
export type SchemaPrivilege = (typeof SCHEMA_PRIVILEGES)[number];
|
|
7
|
+
/** Every table privilege `GRANT … ON TABLE` accepts at REL_18_6
|
|
8
|
+
* (`ACL_ALL_RIGHTS_RELATION`). Views are relations with these same letters. */
|
|
9
|
+
export declare const TABLE_PRIVILEGES: readonly ['select', 'insert', 'update', 'delete', 'truncate', 'references', 'trigger', 'maintain'];
|
|
10
|
+
export type TablePrivilege = (typeof TABLE_PRIVILEGES)[number];
|
|
11
|
+
/** Every column privilege the column synopsis accepts at REL_18_6
|
|
12
|
+
* (`ACL_ALL_RIGHTS_COLUMN`) — the intersection of the table set with what a single column
|
|
13
|
+
* can carry, measured from `grant.sgml`'s own column form, asserted in
|
|
14
|
+
* `grants-provenance.test.ts`. */
|
|
15
|
+
export declare const COLUMN_PRIVILEGES: readonly ['select', 'insert', 'update', 'references'];
|
|
16
|
+
export type ColumnPrivilege = (typeof COLUMN_PRIVILEGES)[number];
|
|
17
|
+
/** Every word across the three vocabularies — the superset the statement builders
|
|
18
|
+
* (`grants-sql.ts`) validate each privilege against before it ever reaches a `GRANT`
|
|
19
|
+
* clause, so a word that no class declares can never be concatenated into SQL. */
|
|
20
|
+
export declare const ALL_GRANT_WORDS: ReadonlyArray<string>;
|
|
21
|
+
export declare const letterForPrivilege: (word: string) => string;
|
|
22
|
+
/** One declared table grant. `privileges` holds words; a trailing `*` on a word means
|
|
23
|
+
* WITH GRANT OPTION for that privilege. Default privileges (for future tables) are a
|
|
24
|
+
* separate prop — this one never touches `pg_default_acl`. */
|
|
25
|
+
export interface PostgresGrantsTable {
|
|
26
|
+
readonly table: string;
|
|
27
|
+
readonly privileges: ReadonlyArray<string>;
|
|
28
|
+
}
|
|
29
|
+
/** One declared column grant, from the synopsis' own column form:
|
|
30
|
+
* `GRANT … ON TABLE t ( c )` (`grant.sgml@REL_18_6`). */
|
|
31
|
+
export interface PostgresGrantsColumn {
|
|
32
|
+
readonly table: string;
|
|
33
|
+
readonly column: string;
|
|
34
|
+
readonly privileges: ReadonlyArray<string>;
|
|
35
|
+
}
|
|
36
|
+
/** One declared default-privileges entry. PostgreSQL records one
|
|
37
|
+
* `pg_default_acl` row per (defaclrole, defaclnamespace, defaclobjtype); `forRole` is the
|
|
38
|
+
* role whose FUTURE objects get the privilege (`FOR ROLE <target_role>` in
|
|
39
|
+
* `ALTER DEFAULT PRIVILEGES`) and is REQUIRED — the resource never infers the connecting
|
|
40
|
+
* role, so every entry reads back as exactly the role it names. The privileges apply to
|
|
41
|
+
* future TABLES (DEFACLOBJ_RELATION `'r'`, the only objtype this family writes). */
|
|
42
|
+
export interface PostgresGrantsDefault {
|
|
43
|
+
readonly forRole: string;
|
|
44
|
+
readonly privileges: ReadonlyArray<string>;
|
|
45
|
+
}
|
|
46
|
+
/** The declared grant set: one role, in one schema of one database.
|
|
47
|
+
*
|
|
48
|
+
* `role` is a group role a human owns the membership of — roles come from elsewhere (the
|
|
49
|
+
* operator, or a role resource in this family once one lands); this resource only writes
|
|
50
|
+
* ACL rows. `database` names the cluster-side database the statements run IN — never
|
|
51
|
+
* `ALTER DATABASE` privileges, which this family does not issue — and `reconcile` refuses
|
|
52
|
+
* a declaration whose `database` differs from the one the connection actually opened. `revokeFromPublic` strips PUBLIC's default USAGE on schema `public`
|
|
53
|
+
* and any default SELECT that might exist (PG15 stopped granting PUBLIC CREATE on `public`,
|
|
54
|
+
* `ddl.sgml@REL_15_1`; PostgreSQL never grants PUBLIC SELECT on tables by default).
|
|
55
|
+
*/
|
|
56
|
+
export interface PostgresGrantsProps {
|
|
57
|
+
readonly role: string;
|
|
58
|
+
readonly database: string;
|
|
59
|
+
readonly schema: string;
|
|
60
|
+
/** `GRANT USAGE ON SCHEMA` (`pg_namespace.nspacl`). @default true */
|
|
61
|
+
readonly schemaUsage?: boolean;
|
|
62
|
+
/** `GRANT CREATE ON SCHEMA` (`pg_namespace.nspacl`). @default false */
|
|
63
|
+
readonly schemaCreate?: boolean;
|
|
64
|
+
readonly tables?: ReadonlyArray<PostgresGrantsTable>;
|
|
65
|
+
readonly columnGrants?: ReadonlyArray<PostgresGrantsColumn>;
|
|
66
|
+
readonly defaultPrivileges?: ReadonlyArray<PostgresGrantsDefault>;
|
|
67
|
+
/** `REVOKE ALL ON SCHEMA/ALL TABLES IN SCHEMA FROM PUBLIC` (ddl.sgml: an empty grantee
|
|
68
|
+
* stands for PUBLIC). @default false */
|
|
69
|
+
readonly revokeFromPublic?: boolean;
|
|
70
|
+
}
|
|
71
|
+
/** Live attributes, read back from the catalogs after reconcile. Arrays are sorted
|
|
72
|
+
* (schema tables, then columns) so a persisted state file compares stably, and every word
|
|
73
|
+
* set is restricted to the objects THIS declaration names (see `attributesOf` in
|
|
74
|
+
* `grants-plan.ts`). `publicSchemaRevoked`/`publicTablesRevoked` record the one-directional
|
|
75
|
+
* PUBLIC fact the catalogs answer: PUBLIC holds nothing on the schema itself / on any
|
|
76
|
+
* relation or column in it. `schemaOwnedByRole`/`ownedTables` record the ownership facts
|
|
77
|
+
* the catalogs answer: the declared role OWNS the schema / those relations, so it holds
|
|
78
|
+
* every privilege on them implicitly — the projection records an empty word list for an
|
|
79
|
+
* owned object (the ACL rows say nothing) and the repair leaves owned objects' ACL rows
|
|
80
|
+
* alone, because a `REVOKE` cannot take an owner's implicit rights away. */
|
|
81
|
+
export interface PostgresGrantsAttributes {
|
|
82
|
+
readonly role: string;
|
|
83
|
+
readonly database: string;
|
|
84
|
+
readonly schema: string;
|
|
85
|
+
readonly schemaPrivileges: ReadonlyArray<string>;
|
|
86
|
+
readonly tables: ReadonlyArray<PostgresGrantsAttributesTable>;
|
|
87
|
+
readonly columns: ReadonlyArray<PostgresGrantsAttributesColumn>;
|
|
88
|
+
readonly defaults: ReadonlyArray<PostgresGrantsAttributesDefault>;
|
|
89
|
+
readonly publicSchemaRevoked: boolean;
|
|
90
|
+
readonly publicTablesRevoked: boolean;
|
|
91
|
+
readonly schemaOwnedByRole: boolean;
|
|
92
|
+
readonly ownedTables: ReadonlyArray<string>;
|
|
93
|
+
}
|
|
94
|
+
export interface PostgresGrantsAttributesTable {
|
|
95
|
+
readonly table: string;
|
|
96
|
+
readonly privileges: ReadonlyArray<string>;
|
|
97
|
+
}
|
|
98
|
+
export interface PostgresGrantsAttributesColumn {
|
|
99
|
+
readonly table: string;
|
|
100
|
+
readonly column: string;
|
|
101
|
+
readonly privileges: ReadonlyArray<string>;
|
|
102
|
+
}
|
|
103
|
+
export interface PostgresGrantsAttributesDefault {
|
|
104
|
+
readonly forRole: string;
|
|
105
|
+
readonly privileges: ReadonlyArray<string>;
|
|
106
|
+
}
|
|
107
|
+
/** Refuse a name the server would truncate (`NAMEDATALEN`, the same limit
|
|
108
|
+
* `Postgres.Database` enforces — roles, schemas, tables and columns are all `NameData`).
|
|
109
|
+
* Named `grantsNameByteRefusal` so the barrel can export it beside database-attrs' own
|
|
110
|
+
* `nameByteRefusal` without a collision. */
|
|
111
|
+
export declare const grantsNameByteRefusal: (name: string) => {
|
|
112
|
+
readonly byteLength: number;
|
|
113
|
+
readonly limit: number;
|
|
114
|
+
} | undefined;
|
|
115
|
+
//# sourceMappingURL=grants-attrs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-attrs.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-attrs.ts"],"names":[],"mappings":"AAwBA;;;0FAG0F;AAC1F,eAAO,MAAM,iBAAiB,YAAI,OAAO,EAAE,QAAQ,CAAU,CAAC;AAC9D,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;+EAC+E;AAC/E,eAAO,MAAM,gBAAgB,YAC3B,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,UAAU,EACV,YAAY,EACZ,SAAS,EACT,UAAU,CACF,CAAC;AACX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/D;;;kCAGkC;AAClC,eAAO,MAAM,iBAAiB,YAAI,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,CAAU,CAAC;AACvF,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE;;kFAEkF;AAClF,eAAO,MAAM,eAAe,EAAE,aAAa,CAAC,MAAM,CAA+C,CAAC;AAmBlG,eAAO,MAAM,kBAAkB,SAAU,MAAM,KAAG,MAIjD,CAAC;AAEF;;8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
3
|
+
* the names recovered from the persisted attributes, the cleared twin `delete` replays and
|
|
4
|
+
* the entries an update removed. Pure — no client, no `Effect` — so `reconcile`, the
|
|
5
|
+
* engine's `diff` and the tests share one implementation. Word validation and the refusals
|
|
6
|
+
* live in `grants-refuse.ts`; the comparison against live catalogs and the read-back
|
|
7
|
+
* projection in `grants-plan.ts` and `grants-diff.ts`.
|
|
8
|
+
*
|
|
9
|
+
* ★ WHAT THE RESOURCE OWNS, PRECISELY. For every object the declaration NAMES — the schema,
|
|
10
|
+
* each table, each column, each (`forRole`) default — the role's full privilege set is
|
|
11
|
+
* declared; an object the declaration does not name is NEVER touched. PUBLIC's privileges
|
|
12
|
+
* are touched only when `revokeFromPublic` says so, and only by clearing: this family
|
|
13
|
+
* never issues a `GRANT … TO PUBLIC`.
|
|
14
|
+
*/
|
|
15
|
+
import type { PostgresGrantsAttributes, PostgresGrantsProps } from './grants-attrs.ts';
|
|
16
|
+
/** The resolved declaration: every default applied, every word validated, every list
|
|
17
|
+
* sorted. Both the live bundle (`grants-read.ts`) and the persisted attributes are already
|
|
18
|
+
* in these shapes. */
|
|
19
|
+
export interface DeclaredGrants {
|
|
20
|
+
readonly role: string;
|
|
21
|
+
readonly database: string;
|
|
22
|
+
readonly schema: string;
|
|
23
|
+
readonly schemaPrivileges: ReadonlyArray<string>;
|
|
24
|
+
readonly tables: ReadonlyArray<{
|
|
25
|
+
readonly table: string;
|
|
26
|
+
readonly privileges: ReadonlyArray<string>;
|
|
27
|
+
}>;
|
|
28
|
+
readonly columns: ReadonlyArray<{
|
|
29
|
+
readonly table: string;
|
|
30
|
+
readonly column: string;
|
|
31
|
+
readonly privileges: ReadonlyArray<string>;
|
|
32
|
+
}>;
|
|
33
|
+
readonly defaults: ReadonlyArray<{
|
|
34
|
+
readonly forRole: string;
|
|
35
|
+
readonly privileges: ReadonlyArray<string>;
|
|
36
|
+
}>;
|
|
37
|
+
readonly publicSchemaRevoked: boolean;
|
|
38
|
+
readonly publicTablesRevoked: boolean;
|
|
39
|
+
}
|
|
40
|
+
export declare const baseWord: (word: string) => string;
|
|
41
|
+
/** The one place defaults resolve to values: `schemaUsage` true, `schemaCreate` false, the
|
|
42
|
+
* PUBLIC revokes false. Every caller — plan, reconcile, diff — normalizes through here so
|
|
43
|
+
* the three never disagree on what an omitted prop means. */
|
|
44
|
+
export declare const resolveProps: (props: PostgresGrantsProps) => DeclaredGrants;
|
|
45
|
+
/** Split one validated word list by its grant-option mark: a mixed list cannot be a single
|
|
46
|
+
* `GRANT` (one `WITH GRANT OPTION` clause would grant the option to every listed
|
|
47
|
+
* privilege, `grants-sql.ts`'s header), so the repair issues one statement per group. */
|
|
48
|
+
export declare const splitGrantWords: (words: ReadonlyArray<string>) => {
|
|
49
|
+
readonly plain: ReadonlyArray<string>;
|
|
50
|
+
readonly grantable: ReadonlyArray<string>;
|
|
51
|
+
};
|
|
52
|
+
/** The names the live read is PROJECTED onto — attributes record what the catalogs say,
|
|
53
|
+
* restricted to the objects one declaration names (an object the declaration never named
|
|
54
|
+
* must not appear in them: the engine's diff would read it as drift the repair is forbidden
|
|
55
|
+
* to touch). */
|
|
56
|
+
export interface DeclaredNames {
|
|
57
|
+
readonly role: string;
|
|
58
|
+
readonly database: string;
|
|
59
|
+
readonly schema: string;
|
|
60
|
+
readonly tables: ReadonlyArray<string>;
|
|
61
|
+
readonly columns: ReadonlyArray<{
|
|
62
|
+
readonly table: string;
|
|
63
|
+
readonly column: string;
|
|
64
|
+
}>;
|
|
65
|
+
readonly defaults: ReadonlyArray<string>;
|
|
66
|
+
}
|
|
67
|
+
export declare const declaredNames: (declared: DeclaredGrants) => DeclaredNames;
|
|
68
|
+
/** Recover the last declaration's names from the persisted attributes, for `read`'s
|
|
69
|
+
* projection when a state file exists (`attributesOf` uses only the names; the recorded
|
|
70
|
+
* words are the catalogs' to decide). */
|
|
71
|
+
export declare const namesFromAttrs: (attrs: PostgresGrantsAttributes) => DeclaredNames;
|
|
72
|
+
/** The `delete` twin of a declaration: the same names, every privilege list emptied, the
|
|
73
|
+
* PUBLIC flags off. `planRepair` turns it into exactly the revoke set delete may issue —
|
|
74
|
+
* one revoke per named object where live still shows the role words, nothing for PUBLIC.
|
|
75
|
+
* A table revoke still restores the column collateral it clears (`grants-plan.ts`), so a
|
|
76
|
+
* delete takes away what the declaration managed and leaves a DBA's or another resource's
|
|
77
|
+
* undeclared column grant untouched. */
|
|
78
|
+
export declare const clearedDeclaration: (declared: DeclaredGrants) => DeclaredGrants;
|
|
79
|
+
/** The entries an update REMOVED from the last applied declaration: the names in
|
|
80
|
+
* `output` (the persisted attributes) that the new declaration no longer names, every
|
|
81
|
+
* word list emptied — the input `grants-plan.ts#planRevocations` turns into the revoke set
|
|
82
|
+
* the reconcile runs before the new declaration's repair, so removing an entry takes the
|
|
83
|
+
* privilege away instead of silently retaining it. `undefined` when `output` is undefined
|
|
84
|
+
* (first apply) or nothing was removed. The `database`-mismatch and retarget guards run
|
|
85
|
+
* first, so the removed set can only ever hold tables, columns and defaults — the schema
|
|
86
|
+
* class never gains or loses an entry. */
|
|
87
|
+
export declare const removedNames: (output: PostgresGrantsAttributes | undefined, declared: DeclaredGrants) => Pick<DeclaredGrants, 'schema' | 'role' | 'tables' | 'columns' | 'defaults'> | undefined;
|
|
88
|
+
//# sourceMappingURL=grants-declare.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-declare.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-declare.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEvF;;sBAEsB;AACtB,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,E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Aa,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACrF,QAAQ,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC1C;AAED,eAAO,MAAM,aAAa,aAAc,cAAc,KAAG,aAOvD,CAAC;AAEH;;yCAEyC;AACzC,eAAO,MAAM,cAAc,UAAW,wBAAwB,KAAG,aAO/D,CAAC;AAEH;;;;;wCAKwC;AACxC,eAAO,MAAM,kBAAkB,aAAc,cAAc,KAAG,cAY5D,CAAC;AAEH;;;;;;;0CAO0C;AAC1C,eAAO,MAAM,YAAY,WACf,wBAAwB,GAAG,SAAS,YAClC,cAAc,KACvB,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,UAAU,CAAC,GAAG,SAsBhF,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The offline half of `Postgres.Grants`' diff engine: the read-back projection
|
|
3
|
+
* (`attributesOf`) and the plan-time comparison (`grantsDiffer`). Pure — no client, no
|
|
4
|
+
* `Effect` — so `reconcile`'s read-back and the engine's `diff` project and compare one
|
|
5
|
+
* way. The repair and revocation statement lists live in `grants-plan.ts`.
|
|
6
|
+
*/
|
|
7
|
+
import type { PostgresGrantsAttributes } from './grants-attrs.ts';
|
|
8
|
+
import type { DeclaredGrants, DeclaredNames } from './grants-declare.ts';
|
|
9
|
+
import type { LiveGrants } from './grants-read.ts';
|
|
10
|
+
/** The read-back projection: live catalog words, restricted to the names this declaration
|
|
11
|
+
* (or, for `read`, the last one) claims — plus the one-directional PUBLIC fact and the
|
|
12
|
+
* ownership facts. The PUBLIC-tables fact is scoped to the relkinds the bulk revoke
|
|
13
|
+
* statement actually reaches; an owned object records an empty word list (the ACL rows say
|
|
14
|
+
* nothing; ownership carries the privileges). */
|
|
15
|
+
export declare const attributesOf: (live: LiveGrants, names: DeclaredNames) => PostgresGrantsAttributes;
|
|
16
|
+
/** The engine's plan-time comparison: the new declaration against the recorded (or freshly
|
|
17
|
+
* read) attributes. PUBLIC is one-directional — a declaration that does not revoke
|
|
18
|
+
* PUBLIC leaves whatever it holds alone, so live PUBLIC privileges with
|
|
19
|
+
* `revokeFromPublic: false` are never drift. Everything else is full equality, grant-option
|
|
20
|
+
* marks included; a changed NAME SET (a table added to or removed from the declaration)
|
|
21
|
+
* answers `true` so one reconcile re-records the projection in the new shape. Owned objects
|
|
22
|
+
* are skipped exactly as the repair skips them: their word list is meaningless (the owner
|
|
23
|
+
* holds everything implicitly), so only a name-set change on one can answer `true`. */
|
|
24
|
+
export declare const grantsDiffer: (declared: DeclaredGrants, live: PostgresGrantsAttributes) => boolean;
|
|
25
|
+
//# sourceMappingURL=grants-diff.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-diff.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-diff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD;;;;iDAIiD;AACjD,eAAO,MAAM,YAAY,SAAU,UAAU,SAAS,aAAa,KAAG,wBAyBpE,CAAC;AAEH;;;;;;;uFAOuF;AACvF,eAAO,MAAM,YAAY,aAAc,cAAc,QAAQ,wBAAwB,KAAG,OAgDvF,CAAC"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
declare const PostgresGrantsPrivilegeRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
2
|
+
readonly _tag: "PostgresGrantsPrivilegeRefused";
|
|
3
|
+
} & Readonly<A>;
|
|
4
|
+
/** A declared privilege word is outside the vocabulary its prop draws from — e.g. `TRUNCATE`
|
|
5
|
+
* on a column grant (table-wide only at REL_18_6) or `EXECUTE` anywhere (this family never
|
|
6
|
+
* leaves the table/schema/column words). */
|
|
7
|
+
export declare class PostgresGrantsPrivilegeRefused extends PostgresGrantsPrivilegeRefused_base<{
|
|
8
|
+
readonly prop: string;
|
|
9
|
+
readonly word: string;
|
|
10
|
+
}> {
|
|
11
|
+
get message(): string;
|
|
12
|
+
}
|
|
13
|
+
declare const PostgresGrantsNameRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
14
|
+
readonly _tag: "PostgresGrantsNameRefused";
|
|
15
|
+
} & Readonly<A>;
|
|
16
|
+
/** A declared name would be silently truncated (same rule as `PostgresDatabaseNameRefused`):
|
|
17
|
+
* roles, schemas, tables and columns are all `NameData`. */
|
|
18
|
+
export declare class PostgresGrantsNameRefused extends PostgresGrantsNameRefused_base<{
|
|
19
|
+
readonly name: string;
|
|
20
|
+
readonly byteLength: number;
|
|
21
|
+
readonly limit: number;
|
|
22
|
+
}> {
|
|
23
|
+
get message(): string;
|
|
24
|
+
}
|
|
25
|
+
declare const PostgresGrantsDuplicateObject_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
26
|
+
readonly _tag: "PostgresGrantsDuplicateObject";
|
|
27
|
+
} & Readonly<A>;
|
|
28
|
+
/** Two declaration entries name the same object (one table twice, one column pair twice,
|
|
29
|
+
* one `forRole` twice) — silently merging them would hide which entry the operator meant.
|
|
30
|
+
* The same refusal fires when one word list declares a base word both plain and
|
|
31
|
+
* `*`-marked: the server keeps ONE aclitem per grantee per grantor, so those two states
|
|
32
|
+
* can never both hold and the set would never converge. */
|
|
33
|
+
export declare class PostgresGrantsDuplicateObject extends PostgresGrantsDuplicateObject_base<{
|
|
34
|
+
readonly prop: string;
|
|
35
|
+
readonly name: string;
|
|
36
|
+
}> {
|
|
37
|
+
get message(): string;
|
|
38
|
+
}
|
|
39
|
+
declare const PostgresGrantsRetargetRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
40
|
+
readonly _tag: "PostgresGrantsRetargetRefused";
|
|
41
|
+
} & Readonly<A>;
|
|
42
|
+
/** A logical id's `role`, `database` or `schema` changed. Those three name WHAT the grant set
|
|
43
|
+
* is about; changing one is a different grant set, not an edit of this one. */
|
|
44
|
+
export declare class PostgresGrantsRetargetRefused extends PostgresGrantsRetargetRefused_base<{
|
|
45
|
+
readonly prop: string;
|
|
46
|
+
readonly from: string;
|
|
47
|
+
readonly to: string;
|
|
48
|
+
}> {
|
|
49
|
+
get message(): string;
|
|
50
|
+
}
|
|
51
|
+
declare const PostgresGrantsDatabaseMismatch_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
52
|
+
readonly _tag: "PostgresGrantsDatabaseMismatch";
|
|
53
|
+
} & Readonly<A>;
|
|
54
|
+
/** `current_database()` is not the database the declaration names. The handlers open the
|
|
55
|
+
* declared database (`withPg`'s override — the family connection stays on the maintenance
|
|
56
|
+
* database); this fires when that open did not land there. Granting in the wrong database
|
|
57
|
+
* would succeed silently and read back as drift forever. */
|
|
58
|
+
export declare class PostgresGrantsDatabaseMismatch extends PostgresGrantsDatabaseMismatch_base<{
|
|
59
|
+
readonly declared: string;
|
|
60
|
+
readonly connected: string;
|
|
61
|
+
}> {
|
|
62
|
+
get message(): string;
|
|
63
|
+
}
|
|
64
|
+
declare const PostgresGrantsSchemaMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
65
|
+
readonly _tag: "PostgresGrantsSchemaMissing";
|
|
66
|
+
} & Readonly<A>;
|
|
67
|
+
/** `reconcile` refuses to repair into a schema the catalogs do not have: grants belong to an
|
|
68
|
+
* existing container (`Postgres.Schema` creates one; this family never creates anything). */
|
|
69
|
+
export declare class PostgresGrantsSchemaMissing extends PostgresGrantsSchemaMissing_base<{
|
|
70
|
+
readonly schema: string;
|
|
71
|
+
}> {
|
|
72
|
+
get message(): string;
|
|
73
|
+
}
|
|
74
|
+
declare const PostgresGrantsDatabaseMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
75
|
+
readonly _tag: "PostgresGrantsDatabaseMissing";
|
|
76
|
+
} & Readonly<A>;
|
|
77
|
+
/** `reconcile` refuses to apply into a database `pg_database` does not have. `read` and `delete`
|
|
78
|
+
* treat a missing database as absence (first create / no-op), but a reconcile names a container
|
|
79
|
+
* it must write into — probing first turns what would be an untyped connect failure
|
|
80
|
+
* (`ConnectionError` over psql, `UnknownError` 3D000 over the socket) into a typed refusal. */
|
|
81
|
+
export declare class PostgresGrantsDatabaseMissing extends PostgresGrantsDatabaseMissing_base<{
|
|
82
|
+
readonly database: string;
|
|
83
|
+
}> {
|
|
84
|
+
get message(): string;
|
|
85
|
+
}
|
|
86
|
+
declare const PostgresGrantsRoleMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
87
|
+
readonly _tag: "PostgresGrantsRoleMissing";
|
|
88
|
+
} & Readonly<A>;
|
|
89
|
+
/** The grantee role, or a default-privileges `forRole` creator, is not in `pg_roles` —
|
|
90
|
+
* checked before any statement runs, the way `Postgres.Schema` checks its `AUTHORIZATION`
|
|
91
|
+
* owner. */
|
|
92
|
+
export declare class PostgresGrantsRoleMissing extends PostgresGrantsRoleMissing_base<{
|
|
93
|
+
readonly role: string;
|
|
94
|
+
}> {
|
|
95
|
+
get message(): string;
|
|
96
|
+
}
|
|
97
|
+
declare const PostgresGrantsTableMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
98
|
+
readonly _tag: "PostgresGrantsTableMissing";
|
|
99
|
+
} & Readonly<A>;
|
|
100
|
+
/** A declared table is not a relation in the schema. The resource refuses before any
|
|
101
|
+
* statement, because a GRANT/REVOKE on a missing relation would surface as a raw 42P01
|
|
102
|
+
* after earlier statements had already landed — and the state row would stay `creating`. */
|
|
103
|
+
export declare class PostgresGrantsTableMissing extends PostgresGrantsTableMissing_base<{
|
|
104
|
+
readonly schema: string;
|
|
105
|
+
readonly table: string;
|
|
106
|
+
}> {
|
|
107
|
+
get message(): string;
|
|
108
|
+
}
|
|
109
|
+
declare const PostgresGrantsColumnMissing_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
110
|
+
readonly _tag: "PostgresGrantsColumnMissing";
|
|
111
|
+
} & Readonly<A>;
|
|
112
|
+
/** A declared column is not an attribute of its table. The resource refuses before any
|
|
113
|
+
* statement, matching the table-missing guard. */
|
|
114
|
+
export declare class PostgresGrantsColumnMissing extends PostgresGrantsColumnMissing_base<{
|
|
115
|
+
readonly schema: string;
|
|
116
|
+
readonly table: string;
|
|
117
|
+
readonly column: string;
|
|
118
|
+
}> {
|
|
119
|
+
get message(): string;
|
|
120
|
+
}
|
|
121
|
+
declare const PostgresGrantsRepairRefused_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
122
|
+
readonly _tag: "PostgresGrantsRepairRefused";
|
|
123
|
+
} & Readonly<A>;
|
|
124
|
+
/** The repair ran clean, but the immediate re-read (S10) still plans statements: a grant this
|
|
125
|
+
* family cannot revoke survived (its grantor still holds the grant option, or the executing
|
|
126
|
+
* role is neither the owner nor that grantor). Re-planning forever would hide it as silent
|
|
127
|
+
* drift, so it fails loud with the surviving statements. */
|
|
128
|
+
export declare class PostgresGrantsRepairRefused extends PostgresGrantsRepairRefused_base<{
|
|
129
|
+
readonly schema: string;
|
|
130
|
+
readonly role: string;
|
|
131
|
+
readonly remaining: ReadonlyArray<string>;
|
|
132
|
+
}> {
|
|
133
|
+
get message(): string;
|
|
134
|
+
}
|
|
135
|
+
export type PostgresGrantsError = PostgresGrantsPrivilegeRefused | PostgresGrantsNameRefused | PostgresGrantsDuplicateObject | PostgresGrantsRetargetRefused | PostgresGrantsDatabaseMismatch | PostgresGrantsDatabaseMissing | PostgresGrantsSchemaMissing | PostgresGrantsRoleMissing | PostgresGrantsTableMissing | PostgresGrantsColumnMissing | PostgresGrantsRepairRefused;
|
|
136
|
+
export {};
|
|
137
|
+
//# sourceMappingURL=grants-errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-errors.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-errors.ts"],"names":[],"mappings":";;;AAYA;;4CAE4C;AAC5C,qBAAa,8BAA+B,SAAQ,oCAElD;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAO7B;CACF;;;;AAED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F,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAM7B;CACF;;;;AAED;;4FAE4F;AAC5F,qBAAa,0BAA2B,SAAQ,gCAA+C;IAC7F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAK7B;CACF;;;;AAED;kDACkD;AAClD,qBAAa,2BAA4B,SAAQ,iCAAgD;IAC/F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAK7B;CACF;;;;AAED;;;4DAG4D;AAC5D,qBAAa,2BAA4B,SAAQ,iCAAgD;IAC/F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CAC3C,CAAC;IACA,IAAa,OAAO,IAAI,MAAM,CAQ7B;CACF;AAED,MAAM,MAAM,mBAAmB,GAC3B,8BAA8B,GAC9B,yBAAyB,GACzB,6BAA6B,GAC7B,6BAA6B,GAC7B,8BAA8B,GAC9B,6BAA6B,GAC7B,2BAA2B,GAC3B,yBAAyB,GACzB,0BAA0B,GAC1B,2BAA2B,GAC3B,2BAA2B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pre-statement existence guards for `Postgres.Grants`: every declared table and column
|
|
3
|
+
* must exist in the schema before any GRANT/REVOKE runs. A missing object would fail
|
|
4
|
+
* as a raw 42P01/42703 after earlier statements had already landed, leaving the state
|
|
5
|
+
* row `creating` and the resume failing OwnedBySomeoneElse.
|
|
6
|
+
*/
|
|
7
|
+
import * as Effect from 'effect/Effect';
|
|
8
|
+
import type { SqlError } from 'effect/unstable/sql/SqlError';
|
|
9
|
+
import type { PgExecutor } from './database-sql.ts';
|
|
10
|
+
import type { DeclaredGrants } from './grants-declare.ts';
|
|
11
|
+
import { PostgresGrantsColumnMissing, PostgresGrantsTableMissing } from './grants-errors.ts';
|
|
12
|
+
/** Fail typed before any statement if a declared table or column does not exist. */
|
|
13
|
+
export declare const requireDeclaredObjectsExist: (pg: PgExecutor, declared: DeclaredGrants) => Effect.Effect<void, PostgresGrantsTableMissing | PostgresGrantsColumnMissing | SqlError>;
|
|
14
|
+
//# sourceMappingURL=grants-existence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-existence.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-existence.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,2BAA2B,EAAE,0BAA0B,EAAE,MAAM,oBAAoB,CAAC;AA4D7F,oFAAoF;AACpF,eAAO,MAAM,2BAA2B,OAClC,UAAU,YACJ,cAAc,KACvB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,0BAA0B,GAAG,2BAA2B,GAAG,QAAQ,CA0BtF,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lifecycle cores of `Postgres.Grants`, against any `PgExecutor` — the real pooled
|
|
3
|
+
* client through `withPg`, or the recording fake in tests: `reconcile`, `read`, `delete`
|
|
4
|
+
* and the plan-time `diff`. The resource declaration and its doctrine header live in
|
|
5
|
+
* `grants.ts`.
|
|
6
|
+
*
|
|
7
|
+
* ★ VALIDATE BEFORE ANY STATEMENT. The declaration refusals and the name-length check are
|
|
8
|
+
* pure and run first, then the container guards (schema in `pg_namespace`, the grantee
|
|
9
|
+
* role and every default-privileges creator in `pg_roles`), then — and only then — the
|
|
10
|
+
* repair's statements.
|
|
11
|
+
* ★ `reconcile` CONVERGES BY PROOF, NOT TRUST (S10): read → plan → execute → re-read →
|
|
12
|
+
* re-plan; an EMPTY second plan is the success condition and a non-empty one fails loud
|
|
13
|
+
* with the surviving statements (`PostgresGrantsRepairRefused`).
|
|
14
|
+
* ★ `output` (the last applied attributes) drives the two update-path repairs: the
|
|
15
|
+
* RETARGET guard (the plan-time one can be bypassed when `news` was unresolved at diff
|
|
16
|
+
* time — a role created in the same deploy) and the REMOVED-entries revoke set, run
|
|
17
|
+
* before the new declaration's plan and re-read after, because the server's `REVOKE ALL`
|
|
18
|
+
* on a table also clears that grantee's column entries on it.
|
|
19
|
+
* ★ `read` answers `undefined` for a target that holds NOTHING anywhere and has no stored
|
|
20
|
+
* output: that is a first create, never an adoption of an empty schema (H1: only grants
|
|
21
|
+
* mark the target as live). On the update path — the resource already has applied state
|
|
22
|
+
* — an all-empty projection is a real answer (the grantee owns everything outright, so
|
|
23
|
+
* `aclexplode` has no rows) and is returned as the projection, not as absent. No role
|
|
24
|
+
* check — the aclexplode reads are missing-role-safe by construction (`grants-read.ts`).
|
|
25
|
+
* ★ `delete` NEVER RE-GRANTS THE DECLARATION, NEVER CASCADES. The `retain` policy is the
|
|
26
|
+
* default; the revokes are idempotent; the delete then re-reads and re-plans like
|
|
27
|
+
* `reconcile` does (S10), so a third grantor's grant that a revoke cannot clear fails loud
|
|
28
|
+
* with the surviving statements (`PostgresGrantsRepairRefused`) instead of surviving
|
|
29
|
+
* silently (`REVOKE … CASCADE` is never issued). The one re-grant a delete still makes is
|
|
30
|
+
* the collateral a table `REVOKE ALL` clears on columns the declaration never named (a
|
|
31
|
+
* DBA's or another Grants resource's column grant): `planRepair` restores those as it does
|
|
32
|
+
* on the reconcile path (`grants.ts:17-18`, `grants-plan.ts:12-14`), so a delete takes
|
|
33
|
+
* away what the declaration managed and leaves everything else exactly as it was.
|
|
34
|
+
* ★ THE REPAIR'S WRITES ARE ONE TRANSACTION. `unsafe` is still one command — the socket
|
|
35
|
+
* path's prepared statement cannot carry several, and each psql `unsafe` is its own
|
|
36
|
+
* process — but `pg.transaction` is `BEGIN`…`COMMIT` on both transports (one reserved
|
|
37
|
+
* connection on the socket, one psql script on the runner; `psql-executor.ts`). GRANT
|
|
38
|
+
* and REVOKE do not call `PreventInTransactionBlock` (`database-sql.ts` cites the same
|
|
39
|
+
* rule for role membership). Removal revokes and the repair are planned together
|
|
40
|
+
* against one read (`planReconcile`: removed tables count as revoked) and committed
|
|
41
|
+
* together, so a live grantee never observes the gap between a `REVOKE ALL` and the
|
|
42
|
+
* grants that restore it. The convergence re-read runs after that commit.
|
|
43
|
+
*/
|
|
44
|
+
import type { Input } from 'alchemy/Input';
|
|
45
|
+
import * as Effect from 'effect/Effect';
|
|
46
|
+
import type { SqlError } from 'effect/unstable/sql/SqlError';
|
|
47
|
+
import type { PostgresGrantsAttributes, PostgresGrantsProps } from './grants-attrs.ts';
|
|
48
|
+
import type { PgExecutor } from './database-sql.ts';
|
|
49
|
+
import type { namesFromAttrs } from './grants-declare.ts';
|
|
50
|
+
import { PostgresGrantsDatabaseMismatch, PostgresGrantsDuplicateObject, type PostgresGrantsError, PostgresGrantsNameRefused, PostgresGrantsPrivilegeRefused, PostgresGrantsRepairRefused, PostgresGrantsRetargetRefused } from './grants-errors.ts';
|
|
51
|
+
export declare const reconcileWithClient: (pg: PgExecutor, props: PostgresGrantsProps, output: PostgresGrantsAttributes | undefined) => Effect.Effect<PostgresGrantsAttributes, PostgresGrantsError | SqlError>;
|
|
52
|
+
export declare const readWithClient: (pg: PgExecutor, names: ReturnType<typeof namesFromAttrs>, stored: boolean) => Effect.Effect<PostgresGrantsAttributes | undefined, PostgresGrantsDatabaseMismatch | SqlError>;
|
|
53
|
+
export declare const deleteWithClient: (pg: PgExecutor, props: PostgresGrantsProps) => Effect.Effect<void, PostgresGrantsDatabaseMismatch | PostgresGrantsRepairRefused | SqlError>;
|
|
54
|
+
/** Plan-time only, entirely offline: a retarget of `role`/`database`/`schema` is a refusal
|
|
55
|
+
* (those three name WHAT the grant set is about); everything else validates the same way
|
|
56
|
+
* `reconcileWithClient` does, then answers `update` on any drift or `noop` on equality.
|
|
57
|
+
* Unresolved news answers `undefined` (the engine falls back to its own comparison) — the
|
|
58
|
+
* retarget is then re-checked inside `reconcile`, where news is resolved, so the bypass a
|
|
59
|
+
* same-deploy role would otherwise get is closed. */
|
|
60
|
+
export declare const diffPostgresGrants: (news: Input<PostgresGrantsProps>, output: PostgresGrantsAttributes | undefined) => Effect.Effect<{
|
|
61
|
+
readonly action: 'update';
|
|
62
|
+
} | {
|
|
63
|
+
readonly action: 'noop';
|
|
64
|
+
} | undefined, PostgresGrantsDuplicateObject | PostgresGrantsNameRefused | PostgresGrantsPrivilegeRefused | PostgresGrantsRetargetRefused, never>;
|
|
65
|
+
//# sourceMappingURL=grants-ops.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-ops.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-ops.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAW1D,OAAO,EACL,8BAA8B,EAC9B,6BAA6B,EAC7B,KAAK,mBAAmB,EACxB,yBAAyB,EACzB,8BAA8B,EAC9B,2BAA2B,EAC3B,6BAA6B,EAG9B,MAAM,oBAAoB,CAAC;AA+B5B,eAAO,MAAM,mBAAmB,OAC1B,UAAU,SACP,mBAAmB,UAClB,wBAAwB,GAAG,SAAS,KAC3C,MAAM,CAAC,MAAM,CAAC,wBAAwB,EAAE,mBAAmB,GAAG,QAAQ,CA+CrE,CAAC;AAEL,eAAO,MAAM,cAAc,OACrB,UAAU,SACP,UAAU,CAAC,OAAO,cAAc,CAAC,UAChC,OAAO,KACd,MAAM,CAAC,MAAM,CAAC,wBAAwB,GAAG,SAAS,EAAE,8BAA8B,GAAG,QAAQ,CAY5F,CAAC;AAEL,eAAO,MAAM,gBAAgB,OACvB,UAAU,SACP,mBAAmB,KACzB,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,8BAA8B,GAAG,2BAA2B,GAAG,QAAQ,CAoB1F,CAAC;AAEL;;;;;qDAKqD;AACrD,eAAO,MAAM,kBAAkB,SACvB,KAAK,CAAC,mBAAmB,CAAC,UACxB,wBAAwB,GAAG,SAAS;qBAmB3B,QAAQ;;qBACR,MAAM;iJACrB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The ownership reads of `Postgres.Grants`: `pg_namespace.nspowner` and `pg_class.relowner`
|
|
3
|
+
* for the declared role, in one schema. The repair and the delete need these to LEAVE
|
|
4
|
+
* objects the grantee owns alone (H2, `grants-plan.ts`): an owner holds every privilege
|
|
5
|
+
* implicitly and a `REVOKE` cannot take that away, so neither writes nor clears ACL rows
|
|
6
|
+
* on an owned object — measured on PG 18.6, where the docs' own seat example had its
|
|
7
|
+
* owner rights churned by the table-level `REVOKE ALL`.
|
|
8
|
+
*
|
|
9
|
+
* ★ A fresh schema or table the role owns carries NO ACL rows at all, so the ownership
|
|
10
|
+
* facts cannot ride the `aclexplode` reads (`grants-read.ts`) — they are separate
|
|
11
|
+
* queries, still inside the read's one bounded burst.
|
|
12
|
+
*/
|
|
13
|
+
import * as Effect from 'effect/Effect';
|
|
14
|
+
import type { SqlError } from 'effect/unstable/sql/SqlError';
|
|
15
|
+
import type { PgExecutor } from './database-sql.ts';
|
|
16
|
+
export declare const readSchemaOwnership: (pg: PgExecutor, schema: string, role: string) => Effect.Effect<boolean, SqlError>;
|
|
17
|
+
export declare const readOwnedTables: (pg: PgExecutor, schema: string, role: string) => Effect.Effect<ReadonlyArray<string>, SqlError>;
|
|
18
|
+
//# sourceMappingURL=grants-ownership.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-ownership.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-ownership.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AASpD,eAAO,MAAM,mBAAmB,OAC1B,UAAU,UACN,MAAM,QACR,MAAM,KACX,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,QAAQ,CAI/B,CAAC;AAUJ,eAAO,MAAM,eAAe,OACtB,UAAU,UACN,MAAM,QACR,MAAM,KACX,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,QAAQ,CAG7C,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which removed entries a reconcile's `REVOKE ALL` will actually emit.
|
|
3
|
+
*
|
|
4
|
+
* Pure — the statement text stays in `grants-plan.ts`. `planRepair` counts the tables
|
|
5
|
+
* returned here as already revoked, so it re-grants the column entries that revoke
|
|
6
|
+
* clears and plans any still-declared columns of those tables against an empty set,
|
|
7
|
+
* all from the pre-revoke read (the writes then share one transaction).
|
|
8
|
+
*/
|
|
9
|
+
import type { DeclaredGrants } from './grants-declare.ts';
|
|
10
|
+
import type { LiveGrants } from './grants-read.ts';
|
|
11
|
+
export interface RemovalRevokes {
|
|
12
|
+
readonly tables: ReadonlyArray<string>;
|
|
13
|
+
readonly columns: ReadonlyArray<{
|
|
14
|
+
readonly table: string;
|
|
15
|
+
readonly column: string;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
/** Tables and columns an update removed that still show the role's words and that the
|
|
19
|
+
* role does not own. An empty catalog entry emits no revoke — and must not be counted
|
|
20
|
+
* as revoked, or the repair would re-grant columns the revoke never cleared. */
|
|
21
|
+
export declare const removalRevokes: (removed: Pick<DeclaredGrants, 'tables' | 'columns'>, live: LiveGrants) => RemovalRevokes;
|
|
22
|
+
//# sourceMappingURL=grants-plan-restore.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-plan-restore.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-plan-restore.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACtF;AAQD;;gFAEgF;AAChF,eAAO,MAAM,cAAc,YAChB,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,SAAS,CAAC,QAC7C,UAAU,KACf,cAcF,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The repair plan: the statement list a reconcile executes, as one pure function of the
|
|
3
|
+
* declared grant set and the live catalogs — no client, no `Effect` — so `reconcile`, the
|
|
4
|
+
* engine's `diff` and the tests share one implementation (the family's S10 rule holds at
|
|
5
|
+
* the callers: `reconcile` re-reads live after the statements run, and re-plans: an EMPTY
|
|
6
|
+
* plan is the no-op proof). The read-back projection and the plan-time comparison live in
|
|
7
|
+
* `grants-diff.ts`.
|
|
8
|
+
*
|
|
9
|
+
* ★ REPAIR SHAPE PER CLASS: on drift, `REVOKE ALL` (clears extras and grant options) then
|
|
10
|
+
* `GRANT` the declared words (only when any are declared), split by the grant-option
|
|
11
|
+
* flag. A class that declares nothing and holds nothing live is a no-op; a class that
|
|
12
|
+
* declares nothing but holds live grants gets only the revoke — that is how `delete`
|
|
13
|
+
* (a cleared declaration, `grants-declare.ts`) revokes exactly what the old declaration
|
|
14
|
+
* named. The one thing it restores is the collateral a table `REVOKE ALL` clears on
|
|
15
|
+
* columns the declaration never named (see `restoredColumnGrants` below): a delete takes
|
|
16
|
+
* away what it managed and leaves a DBA's or another resource's column grant untouched.
|
|
17
|
+
* ★ OBJECTS THE DECLARED ROLE OWNS ARE LEFT ALONE (H2): an owner holds every privilege
|
|
18
|
+
* implicitly and a `REVOKE` cannot take that away, so both plans skip owned objects —
|
|
19
|
+
* repairing them would only add ACL rows the state can never converge on, and revoking
|
|
20
|
+
* them would strip rights that existed before the resource (measured on PG 18.6: the
|
|
21
|
+
* docs' own seat example had its owner rights churned). The projection
|
|
22
|
+
* (`grants-diff.ts`) records the ownership facts so the plan-time diff skips the same
|
|
23
|
+
* objects.
|
|
24
|
+
* ★ A TABLE'S `REVOKE ALL` ALSO CLEARS THAT GRANTEE'S COLUMN ENTRIES ON IT (measured on
|
|
25
|
+
* PG 18.6, and cited by the resource's own convergence check): every declared column of
|
|
26
|
+
* a table whose revoke this plan emits is therefore planned against an empty column
|
|
27
|
+
* set, so the declared words are re-granted after the table revoke in the SAME pass —
|
|
28
|
+
* without this, the re-read would answer drift and the repair would refuse.
|
|
29
|
+
*/
|
|
30
|
+
import type { DeclaredGrants } from './grants-declare.ts';
|
|
31
|
+
import type { LiveGrants } from './grants-read.ts';
|
|
32
|
+
/** Both sides are sorted by construction (declared by `cleanWords`, live by the reads), so
|
|
33
|
+
* set equality is positional — grant-option marks included: `select` and `select*` are
|
|
34
|
+
* DIFFERENT states and the repair must converge on the declared one. */
|
|
35
|
+
export declare const wordsDiffer: (declared: ReadonlyArray<string>, live: ReadonlyArray<string>) => boolean;
|
|
36
|
+
export declare const liveTableWords: (live: LiveGrants, table: string) => ReadonlyArray<string>;
|
|
37
|
+
export declare const liveColumnWords: (live: LiveGrants, table: string, column: string) => ReadonlyArray<string>;
|
|
38
|
+
export declare const liveDefaultWords: (live: LiveGrants, forRole: string) => ReadonlyArray<string>;
|
|
39
|
+
/** Every statement the repair runs, in order. Classes whose live set already equals the
|
|
40
|
+
* declared one contribute NOTHING — an already-correct declaration emits zero statements,
|
|
41
|
+
* which is the re-run-is-a-no-op rule; the same function re-planned against the post-repair
|
|
42
|
+
* read-back is the convergence proof (`PostgresGrantsRepairRefused` when it is not empty). */
|
|
43
|
+
export declare const planRepair: (declared: DeclaredGrants, live: LiveGrants, prior?: {
|
|
44
|
+
/** Tables whose `REVOKE ALL` this same plan already emits (an update removed them). */
|
|
45
|
+
readonly revokedTables?: ReadonlyArray<string>;
|
|
46
|
+
/** Columns that removal is revoking on purpose — do not restore them. */
|
|
47
|
+
readonly revokedColumns?: ReadonlyArray<{
|
|
48
|
+
readonly table: string;
|
|
49
|
+
readonly column: string;
|
|
50
|
+
}>;
|
|
51
|
+
}) => ReadonlyArray<string>;
|
|
52
|
+
/** Revoke-only statements for the entries an update REMOVED from the declaration: one
|
|
53
|
+
* `REVOKE ALL` per removed object where the catalogs still show the role's words, so
|
|
54
|
+
* taking an entry away takes the privilege away (a removal is a drift this resource
|
|
55
|
+
* repairs, never a silent retention). Never the schema class (a role/database/schema
|
|
56
|
+
* retarget is refused, so the schema can never gain or lose an entry), never PUBLIC,
|
|
57
|
+
* never a grant, never an object the role OWNS (an owner's implicit rights are not this
|
|
58
|
+
* resource's to revoke), and nothing for an object that no longer exists — it shows no
|
|
59
|
+
* words. */
|
|
60
|
+
export declare const planRevocations: (removed: Pick<DeclaredGrants, 'schema' | 'role' | 'tables' | 'columns' | 'defaults'>, live: LiveGrants) => ReadonlyArray<string>;
|
|
61
|
+
/** Removal revokes and the new declaration's repair, planned against one read. Removed
|
|
62
|
+
* tables count as revoked inside `planRepair`, so the column re-grants that follow a
|
|
63
|
+
* table `REVOKE ALL` are in this list — the caller runs it as one transaction. */
|
|
64
|
+
export declare const planReconcile: (declared: DeclaredGrants, live: LiveGrants, removed: Pick<DeclaredGrants, 'schema' | 'role' | 'tables' | 'columns' | 'defaults'> | undefined) => ReadonlyArray<string>;
|
|
65
|
+
//# sourceMappingURL=grants-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"grants-plan.d.ts","sourceRoot":"","sources":["../../src/postgres/grants-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAgBnD;;wEAEwE;AACxE,eAAO,MAAM,WAAW,aACZ,aAAa,CAAC,MAAM,CAAC,QACzB,aAAa,CAAC,MAAM,CAAC,KAC1B,OACsF,CAAC;AAa1F,eAAO,MAAM,cAAc,SAAU,UAAU,SAAS,MAAM,KAAG,aAAa,CAAC,MAAM,CACrB,CAAC;AAEjE,eAAO,MAAM,eAAe,SACpB,UAAU,SACT,MAAM,UACL,MAAM,KACb,aAAa,CAAC,MAAM,CACqE,CAAC;AAE7F,eAAO,MAAM,gBAAgB,SAAU,UAAU,WAAW,MAAM,KAAG,aAAa,CAAC,MAAM,CACnB,CAAC;AA2BvE;;;8FAG8F;AAC9F,eAAO,MAAM,UAA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