@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,209 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Postgres.Schema`'s failures as typed tags, following the `Postgres.Database` pattern (S21).
|
|
3
|
+
*
|
|
4
|
+
* Refusals use checked catalog facts or raw SQLSTATE (42P06 / 2BP01), never driver message text.
|
|
5
|
+
*/
|
|
6
|
+
import * as Data from 'effect/Data';
|
|
7
|
+
|
|
8
|
+
/** A declared name would be silently truncated (same as `PostgresDatabaseNameRefused`). */
|
|
9
|
+
export class PostgresSchemaNameRefused extends Data.TaggedError('PostgresSchemaNameRefused')<{
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly byteLength: number;
|
|
12
|
+
readonly limit: number;
|
|
13
|
+
}> {
|
|
14
|
+
override get message(): string {
|
|
15
|
+
return (
|
|
16
|
+
`Postgres.Schema "${this.name}": ${String(this.byteLength)} UTF-8 bytes, over the ` +
|
|
17
|
+
`${String(this.limit)}-byte limit (NAMEDATALEN 64, minus the terminator). PostgreSQL would ` +
|
|
18
|
+
'accept the CREATE and silently truncate the name with only a NOTICE, so this plan refuses ' +
|
|
19
|
+
'it instead of creating a schema no later read will ever find again.'
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** A logical id's `name` changed. A schema's name is its identity; this family has no
|
|
25
|
+
* `ALTER SCHEMA … RENAME`. */
|
|
26
|
+
export class PostgresSchemaRenameRefused extends Data.TaggedError('PostgresSchemaRenameRefused')<{
|
|
27
|
+
readonly from: string;
|
|
28
|
+
readonly to: string;
|
|
29
|
+
}> {
|
|
30
|
+
override get message(): string {
|
|
31
|
+
return (
|
|
32
|
+
`Postgres.Schema: the declared name changed from "${this.from}" to "${this.to}". A ` +
|
|
33
|
+
'rename is refused during plan or apply — this provider never runs ALTER SCHEMA … RENAME. Declare a new ' +
|
|
34
|
+
'logical id for the new name and remove the old one once its contents have moved.'
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** `owner` names a role `pg_roles` does not have, checked before the `CREATE SCHEMA`. */
|
|
40
|
+
export class PostgresSchemaOwnerMissing extends Data.TaggedError('PostgresSchemaOwnerMissing')<{
|
|
41
|
+
readonly schema: string;
|
|
42
|
+
readonly owner: string;
|
|
43
|
+
}> {
|
|
44
|
+
override get message(): string {
|
|
45
|
+
return `Postgres.Schema "${this.schema}": AUTHORIZATION "${this.owner}" is not a role in pg_roles.`;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** A live asserted prop no longer matches the declaration (`owner` or `comment`). */
|
|
50
|
+
export class PostgresSchemaDrift extends Data.TaggedError('PostgresSchemaDrift')<{
|
|
51
|
+
readonly schema: string;
|
|
52
|
+
readonly prop: string;
|
|
53
|
+
readonly declared: unknown;
|
|
54
|
+
readonly live: unknown;
|
|
55
|
+
}> {
|
|
56
|
+
override get message(): string {
|
|
57
|
+
return (
|
|
58
|
+
`Postgres.Schema "${this.schema}": ${this.prop} is declared as ` +
|
|
59
|
+
`${JSON.stringify(this.declared)} but the live schema has ${JSON.stringify(this.live)}. ` +
|
|
60
|
+
'This provider never issues ALTER SCHEMA — update the declaration to match the live value, ' +
|
|
61
|
+
'or change it by hand and re-plan.'
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/** `CREATE SCHEMA` raised no error, but the immediate re-read (S10) still finds nothing. */
|
|
67
|
+
export class PostgresSchemaCreateVanished extends Data.TaggedError('PostgresSchemaCreateVanished')<{
|
|
68
|
+
readonly schema: string;
|
|
69
|
+
}> {
|
|
70
|
+
override get message(): string {
|
|
71
|
+
return (
|
|
72
|
+
`Postgres.Schema "${this.schema}": CREATE SCHEMA raised no error, but the schema is still ` +
|
|
73
|
+
'absent on the immediate re-read. Re-plan — this is not a state this provider expects to reach.'
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* `delete` with `cascade: false` refuses a schema that still has relations. The same refusal
|
|
80
|
+
* answers a plain `DROP SCHEMA` the server rejected with SQLSTATE `2BP01`
|
|
81
|
+
* (`dependent_objects_still_exist`) — an object kind the emptiness check's four catalogs do not
|
|
82
|
+
* cover (an extension, a collation) — so no "empty" path escapes the typed tag.
|
|
83
|
+
*/
|
|
84
|
+
export class PostgresSchemaDropNotEmptyError extends Data.TaggedError(
|
|
85
|
+
'PostgresSchemaDropNotEmptyError',
|
|
86
|
+
)<{
|
|
87
|
+
readonly schema: string;
|
|
88
|
+
}> {
|
|
89
|
+
override get message(): string {
|
|
90
|
+
return (
|
|
91
|
+
`Postgres.Schema "${this.schema}": DROP SCHEMA refused because the schema is not empty and ` +
|
|
92
|
+
'cascade is false. Declare cascade: true to drop its contents, or empty it by hand first.'
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Every statement this resource issues must run against the DECLARED database. The family
|
|
98
|
+
* connection points at a maintenance database, so the schema handlers open `props.database`
|
|
99
|
+
* themselves (`withPg`'s database override); this failure means the server answered
|
|
100
|
+
* `current_database()` with something else — the override was ignored, and no read or write
|
|
101
|
+
* ran against the schema's real home. */
|
|
102
|
+
export class PostgresSchemaWrongDatabase extends Data.TaggedError('PostgresSchemaWrongDatabase')<{
|
|
103
|
+
readonly schema: string;
|
|
104
|
+
readonly declared: string;
|
|
105
|
+
readonly connected: string;
|
|
106
|
+
}> {
|
|
107
|
+
override get message(): string {
|
|
108
|
+
return (
|
|
109
|
+
`Postgres.Schema "${this.schema}": declared in database "${this.declared}" but the ` +
|
|
110
|
+
`connection answers current_database() "${this.connected}". The handlers open the declared ` +
|
|
111
|
+
'database themselves, so this points at broken provider wiring — fix it before touching any ' +
|
|
112
|
+
'schema, or the next create would land in the wrong database.'
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* `delete` refuses to drop a live schema that is not the one this resource created. The
|
|
119
|
+
* engine hands `delete` the persisted state (`output`, with the `oid` and `owner` the last
|
|
120
|
+
* assert proved), and the provider re-reads `pg_namespace` before any `DROP` — a live row that
|
|
121
|
+
* no longer matches that proof is someone else's schema wearing the same name (the old row was
|
|
122
|
+
* dropped out of band and the name recreated), and `DROP SCHEMA` would remove their objects.
|
|
123
|
+
* Nothing is dropped: clear the out-of-band schema by hand, or adopt it.
|
|
124
|
+
*/
|
|
125
|
+
export class PostgresSchemaDeleteForeignRefused extends Data.TaggedError(
|
|
126
|
+
'PostgresSchemaDeleteForeignRefused',
|
|
127
|
+
)<{
|
|
128
|
+
readonly schema: string;
|
|
129
|
+
readonly database: string;
|
|
130
|
+
readonly liveOid: number;
|
|
131
|
+
readonly liveOwner: string;
|
|
132
|
+
/** The proof the persisted state carries; both `undefined` when no state was handed over. */
|
|
133
|
+
readonly lastOid: number | undefined;
|
|
134
|
+
readonly lastOwner: string | undefined;
|
|
135
|
+
}> {
|
|
136
|
+
override get message(): string {
|
|
137
|
+
const proof =
|
|
138
|
+
this.lastOid === undefined || this.lastOwner === undefined
|
|
139
|
+
? 'delete carried no persisted oid/owner to prove ownership'
|
|
140
|
+
: `the persisted proof is oid ${String(this.lastOid)}, owner "${this.lastOwner}"`;
|
|
141
|
+
return (
|
|
142
|
+
`Postgres.Schema "${this.schema}": the live schema in database "${this.database}" (oid ` +
|
|
143
|
+
`${String(this.liveOid)}, owner "${this.liveOwner}") is not the one this resource created — ` +
|
|
144
|
+
`${proof}. No DROP was issued: a schema with this name was created out of band. Drop it by ` +
|
|
145
|
+
'hand, or adopt it on a resource whose declared props match it.'
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** A logical id's `database` changed. A schema lives in one database and this family never
|
|
151
|
+
* moves one: `DROP SCHEMA` in the old database plus a new declaration is the only path. */
|
|
152
|
+
export class PostgresSchemaDatabaseRefused extends Data.TaggedError(
|
|
153
|
+
'PostgresSchemaDatabaseRefused',
|
|
154
|
+
)<{
|
|
155
|
+
readonly from: string;
|
|
156
|
+
readonly to: string;
|
|
157
|
+
}> {
|
|
158
|
+
override get message(): string {
|
|
159
|
+
return (
|
|
160
|
+
`Postgres.Schema: the declared database changed from "${this.from}" to "${this.to}". A ` +
|
|
161
|
+
'schema is never moved across databases — declare a new logical id in the new database and ' +
|
|
162
|
+
'remove the old one once its contents have moved.'
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/** No persisted proof: even a same-owner schema needs explicit adoption, including recovery. */
|
|
168
|
+
export class PostgresSchemaExistsRefused extends Data.TaggedError('PostgresSchemaExistsRefused')<{
|
|
169
|
+
readonly schema: string;
|
|
170
|
+
readonly database: string;
|
|
171
|
+
}> {
|
|
172
|
+
override get message(): string {
|
|
173
|
+
return (
|
|
174
|
+
`Postgres.Schema "${this.schema}" in "${this.database}" already exists. Re-plan with ` +
|
|
175
|
+
'--adopt (adopt(true)) to adopt it explicitly; crash recovery also requires adoption. ' +
|
|
176
|
+
'No existing schema was changed.'
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/** Reconcile must not replace the oid delete relies on with an out-of-band replacement's oid. */
|
|
182
|
+
export class PostgresSchemaIdentityRefused extends Data.TaggedError(
|
|
183
|
+
'PostgresSchemaIdentityRefused',
|
|
184
|
+
)<{
|
|
185
|
+
readonly schema: string;
|
|
186
|
+
readonly storedOid: number;
|
|
187
|
+
readonly liveOid: number;
|
|
188
|
+
}> {
|
|
189
|
+
override get message(): string {
|
|
190
|
+
return (
|
|
191
|
+
`Postgres.Schema "${this.schema}": live oid ${String(this.liveOid)} differs from stored oid ` +
|
|
192
|
+
`${String(this.storedOid)}. The schema was dropped and recreated outside this stack. ` +
|
|
193
|
+
'Remove stale state and explicitly adopt the replacement before managing it.'
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
export type PostgresSchemaError =
|
|
199
|
+
| PostgresSchemaExistsRefused
|
|
200
|
+
| PostgresSchemaIdentityRefused
|
|
201
|
+
| PostgresSchemaNameRefused
|
|
202
|
+
| PostgresSchemaRenameRefused
|
|
203
|
+
| PostgresSchemaOwnerMissing
|
|
204
|
+
| PostgresSchemaDrift
|
|
205
|
+
| PostgresSchemaCreateVanished
|
|
206
|
+
| PostgresSchemaDropNotEmptyError
|
|
207
|
+
| PostgresSchemaDeleteForeignRefused
|
|
208
|
+
| PostgresSchemaWrongDatabase
|
|
209
|
+
| PostgresSchemaDatabaseRefused;
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The real `Postgres.Schema` lifecycle handlers, driven directly over the loopback runner
|
|
3
|
+
* transport — no live database, the same wiring `psql-executor.test.ts` uses: the delete path
|
|
4
|
+
* (drop, non-empty refusal, wrong-database proof, the retain default) and `read`'s `Unowned`
|
|
5
|
+
* adopt branding. Plan-time refusals live in `schema-refusals.test.ts`; the fake-driven
|
|
6
|
+
* create/adopt/drop lifecycle in `schema-lifecycle.test.ts`.
|
|
7
|
+
*/
|
|
8
|
+
import { describe, expect, test } from 'bun:test';
|
|
9
|
+
import { readFileSync } from 'node:fs';
|
|
10
|
+
import * as Effect from 'effect/Effect';
|
|
11
|
+
import { postgresRunnerConnection } from './connection.ts';
|
|
12
|
+
import type { PsqlRunner } from './psql-executor.ts';
|
|
13
|
+
import type { PostgresSchemaAttributes, PostgresSchemaProps } from './schema-attrs.ts';
|
|
14
|
+
import { Unowned } from 'alchemy/AdoptPolicy';
|
|
15
|
+
import { postgresSchemaHandlers } from './schema.ts';
|
|
16
|
+
import { PostgresSchemaDropNotEmptyError, PostgresSchemaWrongDatabase } from './schema-errors.ts';
|
|
17
|
+
import { deleteArgs, ok, readArgs, route, router, runnerWith } from './schema-test-kit.ts';
|
|
18
|
+
|
|
19
|
+
const sampleOutput: PostgresSchemaAttributes = {
|
|
20
|
+
name: 'ledger',
|
|
21
|
+
database: 'postgres',
|
|
22
|
+
oid: 1,
|
|
23
|
+
owner: 'tim',
|
|
24
|
+
comment: null,
|
|
25
|
+
};
|
|
26
|
+
const base: PostgresSchemaProps = { name: 'ledger', database: 'postgres', owner: 'tim' };
|
|
27
|
+
|
|
28
|
+
// `read` is optional on the service type; these tests drive the real one.
|
|
29
|
+
if (postgresSchemaHandlers.read === undefined) {
|
|
30
|
+
throw new Error('Postgres.Schema is missing its read handler');
|
|
31
|
+
}
|
|
32
|
+
const schemaRead = postgresSchemaHandlers.read;
|
|
33
|
+
const proof = '[{"database":"postgres"}]';
|
|
34
|
+
|
|
35
|
+
describe('delete handler (runner transport)', () => {
|
|
36
|
+
test('the real handler drops an empty schema over the runner transport, with CASCADE', async () => {
|
|
37
|
+
const { run, stdins, argvs } = runnerWith(
|
|
38
|
+
router({
|
|
39
|
+
probe: '[{"present":1}]',
|
|
40
|
+
schema: '[{"name":"ledger","oid":1,"owner":"tim"}]',
|
|
41
|
+
empty: '[{"empty":true}]',
|
|
42
|
+
proof,
|
|
43
|
+
}),
|
|
44
|
+
);
|
|
45
|
+
await Effect.runPromise(
|
|
46
|
+
postgresSchemaHandlers
|
|
47
|
+
.delete(deleteArgs({ ...base, cascade: true }, sampleOutput))
|
|
48
|
+
.pipe(
|
|
49
|
+
Effect.provide(
|
|
50
|
+
postgresRunnerConnection({ run, database: 'postgres', username: 'postgres' }),
|
|
51
|
+
),
|
|
52
|
+
),
|
|
53
|
+
);
|
|
54
|
+
expect(stdins.find((s) => s.startsWith('DROP SCHEMA'))).toBe(
|
|
55
|
+
'DROP SCHEMA IF EXISTS "ledger" CASCADE;',
|
|
56
|
+
);
|
|
57
|
+
// One `psql` argv per STATEMENT: probe, proof, ownership re-read, drop. The probe's argv
|
|
58
|
+
// targets the family database; the delete's argvs target the declared one — the `-d` value
|
|
59
|
+
// is the argv's last element.
|
|
60
|
+
expect(argvs.length).toBe(4);
|
|
61
|
+
expect(argvs[0]?.at(-1)).toBe('postgres');
|
|
62
|
+
expect(argvs.slice(1).every((argv) => argv.at(-1) === 'postgres')).toBe(true);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
test('the real handler drops an empty schema without CASCADE — a plain DROP', async () => {
|
|
66
|
+
const { run, stdins } = runnerWith(
|
|
67
|
+
router({
|
|
68
|
+
probe: '[{"present":1}]',
|
|
69
|
+
schema: '[{"name":"ledger","oid":1,"owner":"tim"}]',
|
|
70
|
+
empty: '[{"empty":true}]',
|
|
71
|
+
proof,
|
|
72
|
+
}),
|
|
73
|
+
);
|
|
74
|
+
await Effect.runPromise(
|
|
75
|
+
postgresSchemaHandlers
|
|
76
|
+
.delete(deleteArgs(base, sampleOutput))
|
|
77
|
+
.pipe(
|
|
78
|
+
Effect.provide(
|
|
79
|
+
postgresRunnerConnection({ run, database: 'postgres', username: 'postgres' }),
|
|
80
|
+
),
|
|
81
|
+
),
|
|
82
|
+
);
|
|
83
|
+
expect(stdins.find((s) => s.startsWith('DROP SCHEMA'))).toBe('DROP SCHEMA IF EXISTS "ledger";');
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('the real handler refuses a non-empty schema over the runner transport, no DROP issued', async () => {
|
|
87
|
+
const { run, stdins } = runnerWith(
|
|
88
|
+
router({
|
|
89
|
+
probe: '[{"present":1}]',
|
|
90
|
+
schema: '[{"name":"ledger","oid":1,"owner":"tim"}]',
|
|
91
|
+
empty: '[{"empty":false}]',
|
|
92
|
+
proof,
|
|
93
|
+
}),
|
|
94
|
+
);
|
|
95
|
+
const error = await Effect.runPromise(
|
|
96
|
+
Effect.flip(
|
|
97
|
+
postgresSchemaHandlers
|
|
98
|
+
.delete(deleteArgs(base, sampleOutput))
|
|
99
|
+
.pipe(
|
|
100
|
+
Effect.provide(
|
|
101
|
+
postgresRunnerConnection({ run, database: 'postgres', username: 'postgres' }),
|
|
102
|
+
),
|
|
103
|
+
),
|
|
104
|
+
),
|
|
105
|
+
);
|
|
106
|
+
expect(error).toBeInstanceOf(PostgresSchemaDropNotEmptyError);
|
|
107
|
+
expect(stdins.some((s) => s.startsWith('DROP SCHEMA'))).toBe(false);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('the real handler refuses a wrong connected database before any DROP', async () => {
|
|
111
|
+
// The connection targets `postgres` while the declaration says `agents` — the proof must
|
|
112
|
+
// fail the delete before anything is dropped. The database probe answers PRESENT, so the
|
|
113
|
+
// absent-database short-circuit does not swallow the wrong-database refusal.
|
|
114
|
+
const { run, stdins } = runnerWith(
|
|
115
|
+
router({ probe: '[{"present":1}]', proof: '[{"database":"postgres"}]' }),
|
|
116
|
+
);
|
|
117
|
+
const error = await Effect.runPromise(
|
|
118
|
+
Effect.flip(
|
|
119
|
+
postgresSchemaHandlers
|
|
120
|
+
.delete(
|
|
121
|
+
deleteArgs({ ...base, database: 'agents' }, { ...sampleOutput, database: 'agents' }),
|
|
122
|
+
)
|
|
123
|
+
.pipe(
|
|
124
|
+
Effect.provide(
|
|
125
|
+
postgresRunnerConnection({ run, database: 'postgres', username: 'postgres' }),
|
|
126
|
+
),
|
|
127
|
+
),
|
|
128
|
+
),
|
|
129
|
+
);
|
|
130
|
+
expect(error).toBeInstanceOf(PostgresSchemaWrongDatabase);
|
|
131
|
+
expect(stdins.some((s) => s.startsWith('DROP SCHEMA'))).toBe(false);
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test('defaultRemovalPolicy is retain — declared on the Resource for Postgres.Schema itself', () => {
|
|
135
|
+
// The engine keeps the default in a closure, not on the constructor, so the source IS the
|
|
136
|
+
// assertable fact — anchored to this resource's own declaration, not any string in the file.
|
|
137
|
+
const source = readFileSync(new URL('./schema.ts', import.meta.url), 'utf8');
|
|
138
|
+
expect(source).toMatch(
|
|
139
|
+
/Resource<PostgresSchema>\('Postgres\.Schema', \{\s*\n\s*defaultRemovalPolicy: 'retain',/,
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
describe('read handler (runner transport)', () => {
|
|
145
|
+
test('answers Unowned for a live row — the adopt-path branding a stack needs', async () => {
|
|
146
|
+
const run: PsqlRunner = ({ stdin }) => {
|
|
147
|
+
const r = route(stdin, {
|
|
148
|
+
probe: '[{"present":1}]',
|
|
149
|
+
schema:
|
|
150
|
+
'[{"name":"ledger","oid":"16384","owner":"tim","comment":null,"database":"postgres"}]',
|
|
151
|
+
proof,
|
|
152
|
+
});
|
|
153
|
+
if (r !== undefined) return ok(r);
|
|
154
|
+
return ok('');
|
|
155
|
+
};
|
|
156
|
+
const result = await Effect.runPromise(
|
|
157
|
+
schemaRead(readArgs(base)).pipe(
|
|
158
|
+
Effect.provide(
|
|
159
|
+
postgresRunnerConnection({ run, database: 'postgres', username: 'postgres' }),
|
|
160
|
+
),
|
|
161
|
+
),
|
|
162
|
+
);
|
|
163
|
+
expect(Unowned.is(result)).toBe(true);
|
|
164
|
+
// The brand is a non-enumerable symbol that bun's toEqual compares; spread it off.
|
|
165
|
+
expect({ ...result }).toEqual({ ...sampleOutput, oid: 16384 });
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
test('refuses with the typed wrong-database tag when the row was read from another database', async () => {
|
|
169
|
+
const run: PsqlRunner = ({ stdin }) =>
|
|
170
|
+
Promise.resolve({
|
|
171
|
+
code: 0,
|
|
172
|
+
stdout:
|
|
173
|
+
route(stdin, {
|
|
174
|
+
probe: '[{"present":1}]',
|
|
175
|
+
schema:
|
|
176
|
+
'[{"name":"ledger","oid":"16384","owner":"tim","comment":null,"database":"agents"}]',
|
|
177
|
+
proof: '[{"database":"agents"}]',
|
|
178
|
+
}) ?? '',
|
|
179
|
+
stderr: '',
|
|
180
|
+
});
|
|
181
|
+
const error = await Effect.runPromise(
|
|
182
|
+
Effect.flip(
|
|
183
|
+
schemaRead(readArgs(base)).pipe(
|
|
184
|
+
Effect.provide(
|
|
185
|
+
postgresRunnerConnection({ run, database: 'postgres', username: 'postgres' }),
|
|
186
|
+
),
|
|
187
|
+
),
|
|
188
|
+
),
|
|
189
|
+
);
|
|
190
|
+
expect(error).toBeInstanceOf(PostgresSchemaWrongDatabase);
|
|
191
|
+
expect((error as PostgresSchemaWrongDatabase).connected).toBe('agents');
|
|
192
|
+
});
|
|
193
|
+
});
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Apply repeats plan guards: unresolved Outputs can skip both diff and the adoption probe. */
|
|
2
|
+
import * as Effect from 'effect/Effect';
|
|
3
|
+
import type { PostgresSchemaAttributes, PostgresSchemaProps } from './schema-attrs.ts';
|
|
4
|
+
import {
|
|
5
|
+
PostgresSchemaDatabaseRefused,
|
|
6
|
+
PostgresSchemaIdentityRefused,
|
|
7
|
+
PostgresSchemaRenameRefused,
|
|
8
|
+
} from './schema-errors.ts';
|
|
9
|
+
|
|
10
|
+
export const assertSchemaTarget = (
|
|
11
|
+
props: PostgresSchemaProps,
|
|
12
|
+
output: PostgresSchemaAttributes | undefined,
|
|
13
|
+
): Effect.Effect<void, PostgresSchemaRenameRefused | PostgresSchemaDatabaseRefused> =>
|
|
14
|
+
Effect.gen(function* () {
|
|
15
|
+
if (output === undefined) return;
|
|
16
|
+
if (props.name !== output.name)
|
|
17
|
+
return yield* Effect.fail(
|
|
18
|
+
new PostgresSchemaRenameRefused({ from: output.name, to: props.name }),
|
|
19
|
+
);
|
|
20
|
+
if (props.database !== output.database)
|
|
21
|
+
return yield* Effect.fail(
|
|
22
|
+
new PostgresSchemaDatabaseRefused({ from: output.database, to: props.database }),
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/** Like Role, refuse recycled names on read as well: drift must not refresh away the proof. */
|
|
27
|
+
export const assertSchemaIdentity = (
|
|
28
|
+
live: PostgresSchemaAttributes,
|
|
29
|
+
output: PostgresSchemaAttributes,
|
|
30
|
+
): Effect.Effect<void, PostgresSchemaIdentityRefused> =>
|
|
31
|
+
live.oid === output.oid
|
|
32
|
+
? Effect.void
|
|
33
|
+
: Effect.fail(
|
|
34
|
+
new PostgresSchemaIdentityRefused({
|
|
35
|
+
schema: live.name,
|
|
36
|
+
storedOid: output.oid,
|
|
37
|
+
liveOid: live.oid,
|
|
38
|
+
}),
|
|
39
|
+
);
|