simetra 0.3.0-next.11 → 0.3.0-next.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/compiler/index.d.ts +3 -3
- package/dist/compiler/index.js +18 -0
- package/dist/model/index.d.ts +36 -36
- package/dist/schema/index.d.ts +41 -2
- package/dist/schema/index.js +79 -30
- package/package.json +2 -2
package/dist/compiler/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { AttributeCase, CatalogTable, CatalogUnit, ClientCatalog, CustomTable, D
|
|
|
3
3
|
import { Constraint, IndexElem, IndexStmt, Node, Node as Node$1, RangeVar } from "libpg-query";
|
|
4
4
|
type Severity = "error" | "warning";
|
|
5
5
|
/** Коди правил самого компілятора; коди перевірок схем T0 — `SCHEMA_RULES`. */
|
|
6
|
-
export declare const COMPILER_RULES: readonly ["project.missing", "project.timezone-unknown", "project.database-required", "file.unknown-path", "file.orphan", "file.invalid-json", "file.schema", "file.unknown-key", "file.kind-mismatch", "file.name-mismatch", "file.movements-block", "file.movements-marker-indented", "sql.parse", "sql.statement-not-allowed", "sql.unit-duplicate", "sql.namespace-conflict", "sql.generated-grant", "sql.kind-table-verbatim", "sql.function-body-statement", "sql.function-body-session-setting", "sql.function-body-temp-type", "sql.function-body-session-builtin", "sql.platform-function-call", "sql.expression-call-not-allowed", "sql.dependency-cycle", "sql.closed-shell", "sql.command-context-write", "sql.head-not-allowed", "sql.domain-check-not-allowed", "sql.function-settings-shell", "sql.head-settings", "sql.function-overload", "sql.row-rule-grammar", "sql.row-rule-foreign-table", "sql.row-rule-outside-module", "sql.row-rule-name-taken", "sql.bare-current-user", "sql.debt-grows", "sql.debt-stale", "sql.debt-session-write", "sql.debt-extension-schema", "sql.definer-reads-rls", "sql.definer-caller-unchecked", "sql.policy-helper-correlated", "sql.declaration-target-missing", "sql.declaration-overload", "sql.declaration-duplicate", "sql.declaration-platform-form", "sql.declaration-platform-form-widens", "sql.declaration-execute-widened", "sql.declaration-check-missing", "sql.declaration-check-form", "sql.declaration-check-not-applied", "sql.declaration-anonymous-definer", "sql.default-privileges-execute", "sql.function-argument-type-reference", "rewrite.ambiguous-name", "rewrite.unqualified-table", "rewrite.unsupported", "rewrite.trigger-binding", "rewrite.label-literal", "rewrite.dynamic-sql", "rewrite.unresolved-type", "rewrite.body-quoting", "rewrite.verification-failed", "rewrite.contract-change", "rewrite.dynamic-sql-unscoped", "identity.id-missing", "identity.id-duplicate", "identity.physical-name-missing", "identity.kind-label-missing", "identity.kind-label-retained", "identity.kind-label-duplicate", "identity.assigned-once-changed", "identity.name-duplicate", "identity.name-case", "identity.name-reserved", "identity.name-structural", "reference.unresolved", "reference.ambiguous", "customTable.column-unknown", "customTable.index-derived-column", "register.balance-control-resource", "register.balance-control-duplicate", "posting.field-unknown", "posting.register-field-unknown", "posting.tabular-section-unknown", "scope.declaration-missing", "scope.unknown-kind", "scope.attribute-name-collision", "scope.root-duplicate", "scope.root-key", "scope.root-hierarchy", "scope.root-declaration", "scope.root-self-reference", "scope.root-cascade-not-kind", "scope.global-to-scoped", "scope.cross-kind", "scope.recorder-mismatch", "scope.custom-table-column", "scope.cross-scope-redundant", "scope.custom-table-cross-tenant", "scope.set-function-missing", "scope.set-function-signature", "scope.membership-missing", "storage.bucket-duplicate", "storage.scope-kind-unknown", "subscription.source-not-table", "subscription.provider-table-unknown", "subscription.when-changed-unknown", "subscription.when-changed-duplicate", "subscription.source-duplicate", "subscription.name-duplicate", "subscription.when-changed-on-delete", "subscription.handler-missing", "subscription.handler-signature", "subscription.handler-not-closed", "subscription.handler-assigns-mechanics", "subscription.handler-assigns-carrier", "subscription.handler-reads-carrier", "subscription.trigger-name-taken", "subscription.when-changed-mechanics", "users.catalog-duplicate", "users.scope-not-none", "users.description-required", "users.provision-unsafe", "users.catalog-missing", "languages.catalog-duplicate", "languages.scope-not-none", "languages.code-form", "languages.description-required", "languages.public-read", "languages.predefined-items", "languages.seed-unsafe", "languages.primary-missing", "languages.primary-without-catalog", "membership.not-scoped", "membership.user-not-users-ref", "membership.duplicate", "rights.action-unknown", "rights.custom-action-reserved", "rights.custom-action-effects", "rights.requires-cycle", "rights.attribute-unknown", "rights.carrier-not-ref", "rights.carrier-cross-tenant", "rights.carrier-column-taken", "rights.carrier-path-adopted", "rights.carrier-lazy", "rights.register-access-dimension", "rights.dimension-name-reserved", "rights.ownership-target", "rights.container-target", "rights.container-self", "rights.container-binding-cycle", "rights.dimension-unknown", "rights.dimension-target", "rights.dimension-relation", "rights.access-target", "rights.access-duplicate", "rights.dimension-function-missing", "rights.dimension-function-signature", "rights.dimension-function-reads-rights", "rights.source-table", "rights.source-forced-rls", "rights.source-member-key", "rights.source-member-unique", "rights.source-column-type", "rights.source-where", "rights.source-role-key", "rights.source-scope-column", "rights.membership-source-duplicate", "rights.source-container-column", "rights.scope-kind-unknown", "rights.users-missing", "rights.public-read-forbidden", "rights.public-read-published-kind", "rights.public-read-published-rights", "rights.public-read-published-read", "rights.include-target", "rights.include-cycle", "rights.scope-without-membership", "rights.full-access-level", "rights.root-creator-level", "rights.root-creator-duplicate", "rights.root-creator-membership", "rights.root-creator-set-function", "rights.root-creator-assignments", "rights.root-creator-assignment-required", "rights.root-creator-subscription", "rights.platform-action", "rights.invitations-unused", "rights.invitation-subscription", "rights.root-create-author", "rights.root-creator-no-admin", "rights.root-creator-unreachable", "rights.source-unknown", "rights.source-key-level", "rights.source-key-duplicate", "rights.grant-level", "rights.extent-unsupported", "rights.requires-missing", "rights.custom-table-no-contract", "rights.object-without-rights", "rights.custom-action-multi-object", "rights.system-catalog-missing", "rights.system-catalog-duplicate", "rights.system-catalog-scope", "rights.system-catalog-description", "rights.system-catalog-parallel", "rights.system-catalog-custom-action", "rights.adopted-source-writes", "rights.scope-kind-unread", "project.self-sign-up", "project.self-sign-up-role", "project.self-sign-up-stale", "rights.snapshot-source-unknown", "rights.snapshot-exempt-writer", "rights.signal-source-unknown", "reference.not-referenceable", "reference.custom-table-key", "reference.custom-table-deferrable-key", "reference.default-to-table", "reference.default-unknown-value", "reference.polymorphic-target-kind", "attribute.unique-within-place", "attribute.row-over-budget", "attribute.lazy-over-budget", "index.attribute-unknown", "index.attribute-duplicate", "index.attribute-rich-text", "search.field-unknown", "search.field-duplicate", "search.field-tabular", "search.field-ref", "search.field-generated", "search.field-rich-text", "catalog.owner-kind", "register.recorder-kind", "posting.register-kind", "posting.register-independent", "posting.register-undeclared", "posting.source-missing", "posting.source-ambiguous", "posting.query-not-select", "posting.query-order-missing", "posting.recorder-not-allowed", "posting.fields-incomplete", "posting.row-in-document-source", "posting.aggregate-in-section-source", "posting.movement-type", "posting.period-not-allowed", "posting.type-mismatch", "physical.table-duplicate", "physical.relation-duplicate", "physical.column-duplicate", "physical.function-duplicate", "physical.reserved-word", "physical.name-too-long", "physical.constraint-name-required", "customTable.foreign-key-arity", "customTable.foreign-key-deferrable-target", "customTable.fk-action-on-kind-table", "customTable.fk-target-not-key", "customTable.generated-conflict", "customTable.key-column-nullable", "presentation.unknown-standard-attribute", "operation.physical-name-too-long", "operation.input-invalid", "operation.target-not-found", "operation.object-exists", "operation.collection-unknown", "operation.delete-referenced", "promote.column-unplaced", "promote.mapping-unknown", "promote.unit-unsupported", "promote.reference-not-promoted", "promote.retired-referenced", "promote.unclassified", "promote.write-path", "promote.debt-writes-table", "promote.cascade-to-restrict", "promote.provider-user-reference", "promote.enum-labels", "promote.type-unsupported", "promote.default-unplaced", "promote.fill-missing", "promote.expression-invalid", "promote.debt-text-reference", "promote.text-conflict", "promote.property-not-equivalent", "engine.diagnostic", "engine.unmodeled-drift", "engine.shadow-load-failed", "engine.shadow-drop-failed", "engine.desired-rejected", "engine.clone-failed", "engine.environment-failed", "engine.preamble-unknown", "engine.unrepresentable", "engine.unmodeled-class", "engine.census-mismatch", "engine.unmodeled-property", "engine.out-of-scope", "engine.owner-not-member", "apply.state-format", "apply.ledger-without-marker", "apply.cascade", "apply.non-transactional", "apply.commit-boundary", "apply.permission-required", "apply.permission-unknown", "apply.first-apply", "apply.drift", "apply.drift-partial", "apply.drift-unverifiable", "apply.versions-changed", "apply.primary-language-changed", "apply.plan-versions", "apply.plan-format", "apply.plan-hash", "apply.plan-stale", "apply.busy", "apply.api-role", "apply.server-unsupported", "apply.role-mismatch", "apply.chain", "apply.target-changed", "apply.verify-failed", "apply.step-failed", "apply.lock-timeout", "apply.lock-privilege", "apply.lock-footprint-exceeded", "apply.connection-lost", "apply.type-narrowing", "apply.type-guard-failed", "apply.preservation-failed", "apply.preservation-measure-failed", "apply.function-check-failed", "apply.function-check-blind", "apply.deferred-constraint-failed", "apply.constraint-invalid", "apply.rehearsal-proof-failed", "apply.rehearsal-required", "apply.rehearsal-stale", "apply.rehearsal-copy-empty", "apply.rehearsal-fewer-rows", "apply.rehearsal-timeout-unbounded", "apply.temp-name-taken", "apply.plpgsql-check-unavailable", "apply.extension-unavailable", "apply.replication-role", "apply.data-step-failed", "apply.data-step-narrowing", "apply.data-write-mismatch", "apply.not-null-violation", "apply.backfill-rows-changed", "apply.backfill-triggers-changed", "plan.unparsable-step", "plan.clone-mismatch", "plan.proof-not-empty", "plan.fingerprint-disagrees", "plan.schema-only-proof", "plan.owner-mismatch", "plan.platform-role-missing", "plan.platform-role-shape", "plan.owner-not-bypassrls", "plan.owner-provider-login", "plan.shadow-base-unsupported", "plan.identity-table-missing", "plan.identity-trigger-locked", "plan.storage-added", "plan.storage-removed", "plan.type-guard-unsupported", "plan.type-change-dependent", "plan.promotion-record-missing", "plan.promotion-record-invalid", "plan.promotion-base", "plan.promotion-record-mismatch", "plan.promotion-record-stale", "plan.promotion-needs-marker", "plan.promotion-multiple", "plan.promotion-unsupported", "plan.promotion-applied", "plan.promotion-not-applicable", "plan.rename-not-realized", "plan.removal-unclassified", "plan.platform-replacement-missing", "plan.property-not-reproduced", "plan.write-path", "plan.service-role-access-lost", "plan.update-of-narrowed", "plan.foreign-exclusive-lock", "plan.plpgsql-check-unavailable", "plan.temp-name-taken", "plan.data-step-volatile", "plan.data-step-function-changed", "plan.temp-privilege", "plan.replication-role", "plan.preservation-type", "plan.provider-trigger-taken", "plan.provider-trigger-undeclared", "plan.trigger-function-unseedable", "plan.row-version-first", "plan.numbering-not-generated", "plan.not-null-violation", "plan.backfill-order", "plan.backfill-unique", "plan.backfill-check", "plan.backfill-carrier-source", "plan.backfill-rights-guard", "plan.backfill-count-failed", "plan.rights-source-access", "plan.rights-source-unknown-keys", "plan.rights-full-access-lost", "plan.rights-orphans", "database.failed", "data.scope-unspecified", "roles.create-role-denied", "roles.admin-option-missing", "roles.membership-grant-denied", "roles.superuser-required", "roles.unsafe-schema", "roles.unsafe-template", "roles.database-owner", "roles.database-locale", "roles.shared-cluster", "roles.extension-unavailable", "roles.dev-passwords-unsupported", "roles.dev-password-missing", "roles.dev-passwords-remote", "maintenance.model-mismatch", "maintenance.unknown-role", "maintenance.role-level", "maintenance.role-ambiguous", "maintenance.unknown-scope-kind", "maintenance.no-catalog", "maintenance.scope-missing", "maintenance.unknown-user", "maintenance.busy", "maintenance.not-first", "maintenance.holder-exists", "maintenance.not-effective", "maintenance.invalid-member", "maintenance.member-required", "maintenance.refused", "maintenance.outcome-unknown", "introspect.unrepresentable", "introspect.identity-conflict", "introspect.project-mismatch", "introspect.path-collision", "introspect.definer-check-unknown", "introspect.execute-narrowed", "introspect.definer-platform-form-candidate", "introspect.definer-foreign-grant", "introspect.definer-callers-drift", "introspect.definer-acl-changed"];
|
|
6
|
+
export declare const COMPILER_RULES: readonly ["project.missing", "project.timezone-unknown", "project.database-required", "file.unknown-path", "file.orphan", "file.invalid-json", "file.schema", "file.unknown-key", "file.kind-mismatch", "file.name-mismatch", "file.movements-block", "file.movements-marker-indented", "sql.parse", "sql.statement-not-allowed", "sql.unit-duplicate", "sql.namespace-conflict", "sql.generated-grant", "sql.kind-table-verbatim", "sql.function-body-statement", "sql.function-body-session-setting", "sql.function-body-temp-type", "sql.function-body-session-builtin", "sql.platform-function-call", "sql.expression-call-not-allowed", "sql.dependency-cycle", "sql.closed-shell", "sql.command-context-write", "sql.head-not-allowed", "sql.domain-check-not-allowed", "sql.function-settings-shell", "sql.head-settings", "sql.function-overload", "sql.row-rule-grammar", "sql.row-rule-foreign-table", "sql.row-rule-outside-module", "sql.row-rule-name-taken", "sql.bare-current-user", "sql.debt-grows", "sql.debt-stale", "sql.debt-session-write", "sql.debt-extension-schema", "sql.definer-reads-rls", "sql.definer-caller-unchecked", "sql.policy-helper-correlated", "sql.declaration-target-missing", "sql.declaration-overload", "sql.declaration-duplicate", "sql.declaration-platform-form", "sql.declaration-platform-form-widens", "sql.declaration-execute-widened", "sql.declaration-check-missing", "sql.declaration-check-form", "sql.declaration-check-not-applied", "sql.declaration-anonymous-definer", "sql.default-privileges-execute", "sql.function-argument-type-reference", "rewrite.ambiguous-name", "rewrite.unqualified-table", "rewrite.unsupported", "rewrite.trigger-binding", "rewrite.label-literal", "rewrite.dynamic-sql", "rewrite.unresolved-type", "rewrite.body-quoting", "rewrite.verification-failed", "rewrite.contract-change", "rewrite.dynamic-sql-unscoped", "identity.id-missing", "identity.id-duplicate", "identity.physical-name-missing", "identity.kind-label-missing", "identity.kind-label-retained", "identity.kind-label-duplicate", "identity.assigned-once-changed", "identity.name-duplicate", "identity.name-case", "identity.name-reserved", "identity.name-structural", "reference.unresolved", "reference.ambiguous", "customTable.column-unknown", "customTable.index-derived-column", "register.balance-control-resource", "register.balance-control-duplicate", "posting.field-unknown", "posting.register-field-unknown", "posting.tabular-section-unknown", "scope.declaration-missing", "scope.unknown-kind", "scope.attribute-name-collision", "scope.root-duplicate", "scope.root-key", "scope.root-hierarchy", "scope.root-declaration", "scope.root-self-reference", "scope.root-cascade-not-kind", "scope.global-to-scoped", "scope.cross-kind", "scope.recorder-mismatch", "scope.custom-table-column", "scope.cross-scope-redundant", "scope.custom-table-cross-tenant", "scope.set-function-missing", "scope.set-function-signature", "scope.membership-missing", "storage.bucket-duplicate", "storage.scope-kind-unknown", "subscription.source-not-table", "subscription.provider-table-unknown", "subscription.when-changed-unknown", "subscription.when-changed-duplicate", "subscription.source-duplicate", "subscription.name-duplicate", "subscription.when-changed-on-delete", "subscription.handler-missing", "subscription.handler-signature", "subscription.handler-not-closed", "subscription.handler-assigns-mechanics", "subscription.handler-assigns-carrier", "subscription.handler-reads-carrier", "subscription.trigger-name-taken", "subscription.when-changed-mechanics", "users.catalog-duplicate", "users.scope-not-none", "users.description-required", "users.provision-unsafe", "users.catalog-missing", "languages.catalog-duplicate", "languages.scope-not-none", "languages.code-form", "languages.description-required", "languages.public-read", "languages.predefined-items", "languages.seed-unsafe", "languages.primary-missing", "languages.primary-without-catalog", "membership.not-scoped", "membership.user-not-users-ref", "membership.duplicate", "rights.action-unknown", "rights.custom-action-reserved", "rights.custom-action-effects", "rights.requires-cycle", "rights.attribute-unknown", "rights.carrier-not-ref", "rights.carrier-cross-tenant", "rights.carrier-column-taken", "rights.carrier-path-adopted", "rights.carrier-lazy", "rights.register-access-dimension", "rights.dimension-name-reserved", "rights.ownership-target", "rights.container-target", "rights.container-self", "rights.container-binding-cycle", "rights.dimension-unknown", "rights.dimension-target", "rights.dimension-relation", "rights.access-target", "rights.access-duplicate", "rights.dimension-function-missing", "rights.dimension-function-signature", "rights.dimension-function-reads-rights", "rights.source-table", "rights.source-forced-rls", "rights.source-member-key", "rights.source-member-unique", "rights.source-column-type", "rights.source-where", "rights.source-role-key", "rights.source-scope-column", "rights.membership-source-duplicate", "rights.source-container-column", "rights.scope-kind-unknown", "rights.users-missing", "rights.public-read-forbidden", "rights.public-read-published-kind", "rights.public-read-published-rights", "rights.public-read-published-read", "rights.include-target", "rights.include-cycle", "rights.scope-without-membership", "rights.full-access-level", "rights.root-creator-level", "rights.root-creator-duplicate", "rights.root-creator-membership", "rights.root-creator-set-function", "rights.root-creator-assignments", "rights.root-creator-assignment-required", "rights.root-creator-subscription", "rights.platform-action", "rights.invitations-unused", "rights.invitation-subscription", "rights.root-create-author", "rights.root-creator-no-admin", "rights.root-creator-unreachable", "rights.source-unknown", "rights.source-key-level", "rights.source-key-duplicate", "rights.grant-level", "rights.extent-unsupported", "rights.requires-missing", "rights.custom-table-no-contract", "rights.object-without-rights", "rights.custom-action-multi-object", "rights.system-catalog-missing", "rights.system-catalog-duplicate", "rights.system-catalog-scope", "rights.system-catalog-description", "rights.system-catalog-parallel", "rights.system-catalog-custom-action", "rights.adopted-source-writes", "rights.scope-kind-unread", "project.self-sign-up", "project.self-sign-up-role", "project.self-sign-up-stale", "rights.snapshot-source-unknown", "rights.snapshot-exempt-writer", "rights.signal-source-unknown", "reference.not-referenceable", "reference.custom-table-key", "reference.custom-table-deferrable-key", "reference.default-to-table", "reference.default-unknown-value", "reference.polymorphic-target-kind", "attribute.unique-within-place", "attribute.row-over-budget", "attribute.lazy-over-budget", "index.attribute-unknown", "index.attribute-duplicate", "index.attribute-rich-text", "search.field-unknown", "search.field-duplicate", "search.field-tabular", "search.field-ref", "search.field-generated", "search.field-rich-text", "catalog.owner-kind", "register.recorder-kind", "posting.register-kind", "posting.register-independent", "posting.register-undeclared", "posting.source-missing", "posting.source-ambiguous", "posting.query-not-select", "posting.query-order-missing", "posting.recorder-not-allowed", "posting.fields-incomplete", "posting.row-in-document-source", "posting.aggregate-in-section-source", "posting.movement-type", "posting.period-not-allowed", "posting.type-mismatch", "physical.table-duplicate", "physical.relation-duplicate", "physical.column-duplicate", "physical.function-duplicate", "physical.reserved-word", "physical.name-too-long", "physical.constraint-name-required", "customTable.foreign-key-arity", "customTable.foreign-key-deferrable-target", "customTable.fk-action-on-kind-table", "customTable.fk-target-not-key", "customTable.generated-conflict", "customTable.key-column-nullable", "presentation.unknown-standard-attribute", "operation.physical-name-too-long", "operation.input-invalid", "operation.target-not-found", "operation.object-exists", "operation.collection-unknown", "operation.delete-referenced", "promote.column-unplaced", "promote.mapping-unknown", "promote.unit-unsupported", "promote.reference-not-promoted", "promote.retired-referenced", "promote.unclassified", "promote.write-path", "promote.debt-writes-table", "promote.cascade-to-restrict", "promote.provider-user-reference", "promote.enum-labels", "promote.type-unsupported", "promote.default-unplaced", "promote.fill-missing", "promote.expression-invalid", "promote.debt-text-reference", "promote.text-conflict", "promote.property-not-equivalent", "engine.diagnostic", "engine.unmodeled-drift", "engine.shadow-load-failed", "engine.shadow-drop-failed", "engine.desired-rejected", "engine.clone-failed", "engine.environment-failed", "engine.preamble-unknown", "engine.unrepresentable", "engine.unmodeled-class", "engine.census-mismatch", "engine.unmodeled-property", "engine.out-of-scope", "engine.owner-not-member", "apply.state-format", "apply.ledger-without-marker", "apply.cascade", "apply.non-transactional", "apply.commit-boundary", "apply.permission-required", "apply.permission-unknown", "apply.first-apply", "apply.drift", "apply.drift-partial", "apply.drift-unverifiable", "apply.versions-changed", "apply.primary-language-changed", "apply.plan-versions", "apply.plan-format", "apply.plan-hash", "apply.plan-stale", "apply.busy", "apply.api-role", "apply.server-unsupported", "apply.role-mismatch", "apply.chain", "apply.target-changed", "apply.verify-failed", "apply.step-failed", "apply.lock-timeout", "apply.lock-privilege", "apply.lock-footprint-exceeded", "apply.connection-lost", "apply.type-narrowing", "apply.type-guard-failed", "apply.preservation-failed", "apply.preservation-measure-failed", "apply.function-check-failed", "apply.function-check-blind", "apply.deferred-constraint-failed", "apply.constraint-invalid", "apply.rehearsal-proof-failed", "apply.rehearsal-required", "apply.rehearsal-stale", "apply.rehearsal-copy-empty", "apply.rehearsal-fewer-rows", "apply.rehearsal-timeout-unbounded", "apply.temp-name-taken", "apply.plpgsql-check-unavailable", "apply.extension-unavailable", "apply.replication-role", "apply.data-step-failed", "apply.data-step-narrowing", "apply.data-write-mismatch", "apply.not-null-violation", "apply.backfill-rows-changed", "apply.backfill-triggers-changed", "plan.unparsable-step", "plan.clone-mismatch", "plan.proof-not-empty", "plan.fingerprint-disagrees", "plan.schema-only-proof", "plan.owner-mismatch", "plan.platform-role-missing", "plan.platform-role-shape", "plan.owner-not-bypassrls", "plan.owner-provider-login", "plan.shadow-base-unsupported", "plan.identity-table-missing", "plan.identity-trigger-locked", "plan.storage-added", "plan.storage-removed", "plan.type-guard-unsupported", "plan.type-change-dependent", "plan.promotion-record-missing", "plan.promotion-record-invalid", "plan.promotion-base", "plan.promotion-record-mismatch", "plan.promotion-record-stale", "plan.promotion-needs-marker", "plan.promotion-multiple", "plan.promotion-unsupported", "plan.promotion-applied", "plan.promotion-not-applicable", "plan.rename-not-realized", "plan.removal-unclassified", "plan.platform-replacement-missing", "plan.property-not-reproduced", "plan.write-path", "plan.service-role-access-lost", "plan.update-of-narrowed", "plan.foreign-exclusive-lock", "plan.plpgsql-check-unavailable", "plan.temp-name-taken", "plan.data-step-volatile", "plan.data-step-function-changed", "plan.temp-privilege", "plan.replication-role", "plan.preservation-type", "plan.provider-trigger-taken", "plan.provider-trigger-undeclared", "plan.trigger-function-unseedable", "plan.row-version-first", "plan.numbering-not-generated", "plan.not-null-violation", "plan.backfill-order", "plan.backfill-unique", "plan.backfill-check", "plan.backfill-carrier-source", "plan.backfill-rights-guard", "plan.backfill-count-failed", "plan.rights-source-access", "plan.rights-source-unknown-keys", "plan.rights-full-access-lost", "plan.rights-orphans", "database.failed", "data.scope-unspecified", "roles.create-role-denied", "roles.admin-option-missing", "roles.membership-grant-denied", "roles.superuser-required", "roles.unsafe-schema", "roles.unsafe-template", "roles.database-owner", "roles.database-locale", "roles.shared-cluster", "roles.extension-unavailable", "roles.dev-passwords-unsupported", "roles.dev-password-missing", "roles.dev-passwords-remote", "maintenance.model-mismatch", "maintenance.unknown-role", "maintenance.role-level", "maintenance.role-ambiguous", "maintenance.unknown-scope-kind", "maintenance.no-catalog", "maintenance.scope-missing", "maintenance.unknown-user", "maintenance.busy", "maintenance.not-first", "maintenance.holder-exists", "maintenance.not-effective", "maintenance.invalid-member", "maintenance.member-required", "maintenance.refused", "maintenance.outcome-unknown", "maintenance.not-development", "maintenance.member-exists", "introspect.unrepresentable", "introspect.identity-conflict", "introspect.project-mismatch", "introspect.path-collision", "introspect.definer-check-unknown", "introspect.execute-narrowed", "introspect.definer-platform-form-candidate", "introspect.definer-foreign-grant", "introspect.definer-callers-drift", "introspect.definer-acl-changed"];
|
|
7
7
|
type CompilerRule = (typeof COMPILER_RULES)[number];
|
|
8
8
|
type RuleCode = SchemaRule | CompilerRule;
|
|
9
9
|
type DiagnosticParams = Record<string, string | number>;
|
|
@@ -2630,8 +2630,8 @@ export declare const promoteInput: z.ZodObject<{
|
|
|
2630
2630
|
to: z.ZodLiteral<"attribute">;
|
|
2631
2631
|
collection: z.ZodDefault<z.ZodEnum<{
|
|
2632
2632
|
attributes: "attributes";
|
|
2633
|
-
dimensions: "dimensions";
|
|
2634
2633
|
resources: "resources";
|
|
2634
|
+
dimensions: "dimensions";
|
|
2635
2635
|
}>>;
|
|
2636
2636
|
element: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2637
2637
|
}, z.core.$strict>, z.ZodObject<{
|
|
@@ -2650,8 +2650,8 @@ export declare const promoteInput: z.ZodObject<{
|
|
|
2650
2650
|
to: z.ZodLiteral<"attribute">;
|
|
2651
2651
|
collection: z.ZodDefault<z.ZodEnum<{
|
|
2652
2652
|
attributes: "attributes";
|
|
2653
|
-
dimensions: "dimensions";
|
|
2654
2653
|
resources: "resources";
|
|
2654
|
+
dimensions: "dimensions";
|
|
2655
2655
|
}>>;
|
|
2656
2656
|
element: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
2657
2657
|
}, z.core.$strict>, z.ZodObject<{
|
package/dist/compiler/index.js
CHANGED
|
@@ -4777,6 +4777,22 @@ const MESSAGES = {
|
|
|
4777
4777
|
uk: "Запустіть інструмент ще раз: він покаже поточний стан і відмовить у тому, що вже зроблено."
|
|
4778
4778
|
}
|
|
4779
4779
|
},
|
|
4780
|
+
"maintenance.not-development": {
|
|
4781
|
+
en: () => "The database does not carry the development flag simetra.environment = 'development'",
|
|
4782
|
+
uk: () => "База не має ознаки бази розробника simetra.environment = 'development'",
|
|
4783
|
+
hint: {
|
|
4784
|
+
en: "Nothing was written. Adding a member past the invitation is allowed only in a development database.",
|
|
4785
|
+
uk: "Нічого не записано. Додати учасника в обхід запрошення можна лише в базі розробника."
|
|
4786
|
+
}
|
|
4787
|
+
},
|
|
4788
|
+
"maintenance.member-exists": {
|
|
4789
|
+
en: (p) => `The user ${p.user} is already a member of this scope`,
|
|
4790
|
+
uk: (p) => `Користувач ${p.user} уже учасник цього скоупу`,
|
|
4791
|
+
hint: {
|
|
4792
|
+
en: "Nothing was written. Assign roles to an existing member through the rights administration commands.",
|
|
4793
|
+
uk: "Нічого не записано. Ролі наявному учаснику призначають команди адміністрування прав."
|
|
4794
|
+
}
|
|
4795
|
+
},
|
|
4780
4796
|
"introspect.unrepresentable": {
|
|
4781
4797
|
en: (p) => `${p.object}: ${p.property} cannot be represented in metadata files: ${p.detail}`,
|
|
4782
4798
|
uk: (p) => `${p.object}: ${p.property} не виражається у файлах метаданих: ${p.detail}`,
|
|
@@ -5349,6 +5365,8 @@ const COMPILER_RULES = [
|
|
|
5349
5365
|
"maintenance.member-required",
|
|
5350
5366
|
"maintenance.refused",
|
|
5351
5367
|
"maintenance.outcome-unknown",
|
|
5368
|
+
"maintenance.not-development",
|
|
5369
|
+
"maintenance.member-exists",
|
|
5352
5370
|
"introspect.unrepresentable",
|
|
5353
5371
|
"introspect.identity-conflict",
|
|
5354
5372
|
"introspect.project-mismatch",
|
package/dist/model/index.d.ts
CHANGED
|
@@ -87,12 +87,12 @@ export declare const attributeSchema: z.ZodObject<{
|
|
|
87
87
|
pattern: z.ZodOptional<z.ZodString>;
|
|
88
88
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
89
89
|
type: z.ZodEnum<{
|
|
90
|
+
BigInt: "BigInt";
|
|
90
91
|
UUID: "UUID";
|
|
91
92
|
String: "String";
|
|
92
93
|
Text: "Text";
|
|
93
94
|
Integer: "Integer";
|
|
94
95
|
SmallInt: "SmallInt";
|
|
95
|
-
BigInt: "BigInt";
|
|
96
96
|
Numeric: "Numeric";
|
|
97
97
|
Boolean: "Boolean";
|
|
98
98
|
Date: "Date";
|
|
@@ -189,12 +189,12 @@ export declare const catalogAttributeSchema: z.ZodObject<{
|
|
|
189
189
|
pattern: z.ZodOptional<z.ZodString>;
|
|
190
190
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
191
191
|
type: z.ZodEnum<{
|
|
192
|
+
BigInt: "BigInt";
|
|
192
193
|
UUID: "UUID";
|
|
193
194
|
String: "String";
|
|
194
195
|
Text: "Text";
|
|
195
196
|
Integer: "Integer";
|
|
196
197
|
SmallInt: "SmallInt";
|
|
197
|
-
BigInt: "BigInt";
|
|
198
198
|
Numeric: "Numeric";
|
|
199
199
|
Boolean: "Boolean";
|
|
200
200
|
Date: "Date";
|
|
@@ -322,12 +322,12 @@ export declare const tabularSectionSchema: z.ZodObject<{
|
|
|
322
322
|
pattern: z.ZodOptional<z.ZodString>;
|
|
323
323
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
324
324
|
type: z.ZodEnum<{
|
|
325
|
+
BigInt: "BigInt";
|
|
325
326
|
UUID: "UUID";
|
|
326
327
|
String: "String";
|
|
327
328
|
Text: "Text";
|
|
328
329
|
Integer: "Integer";
|
|
329
330
|
SmallInt: "SmallInt";
|
|
330
|
-
BigInt: "BigInt";
|
|
331
331
|
Numeric: "Numeric";
|
|
332
332
|
Boolean: "Boolean";
|
|
333
333
|
Date: "Date";
|
|
@@ -528,12 +528,12 @@ type LogicalType = (typeof LOGICAL_TYPES)[number];
|
|
|
528
528
|
/** Поля типу, спільні для реквізиту, константи й колонки. */
|
|
529
529
|
export declare const valueTypeShape: {
|
|
530
530
|
type: z.ZodEnum<{
|
|
531
|
+
BigInt: "BigInt";
|
|
531
532
|
UUID: "UUID";
|
|
532
533
|
String: "String";
|
|
533
534
|
Text: "Text";
|
|
534
535
|
Integer: "Integer";
|
|
535
536
|
SmallInt: "SmallInt";
|
|
536
|
-
BigInt: "BigInt";
|
|
537
537
|
Numeric: "Numeric";
|
|
538
538
|
Boolean: "Boolean";
|
|
539
539
|
Date: "Date";
|
|
@@ -800,12 +800,12 @@ export declare const catalogSchema: z.ZodObject<{
|
|
|
800
800
|
pattern: z.ZodOptional<z.ZodString>;
|
|
801
801
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
802
802
|
type: z.ZodEnum<{
|
|
803
|
+
BigInt: "BigInt";
|
|
803
804
|
UUID: "UUID";
|
|
804
805
|
String: "String";
|
|
805
806
|
Text: "Text";
|
|
806
807
|
Integer: "Integer";
|
|
807
808
|
SmallInt: "SmallInt";
|
|
808
|
-
BigInt: "BigInt";
|
|
809
809
|
Numeric: "Numeric";
|
|
810
810
|
Boolean: "Boolean";
|
|
811
811
|
Date: "Date";
|
|
@@ -911,12 +911,12 @@ export declare const catalogSchema: z.ZodObject<{
|
|
|
911
911
|
pattern: z.ZodOptional<z.ZodString>;
|
|
912
912
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
913
913
|
type: z.ZodEnum<{
|
|
914
|
+
BigInt: "BigInt";
|
|
914
915
|
UUID: "UUID";
|
|
915
916
|
String: "String";
|
|
916
917
|
Text: "Text";
|
|
917
918
|
Integer: "Integer";
|
|
918
919
|
SmallInt: "SmallInt";
|
|
919
|
-
BigInt: "BigInt";
|
|
920
920
|
Numeric: "Numeric";
|
|
921
921
|
Boolean: "Boolean";
|
|
922
922
|
Date: "Date";
|
|
@@ -1170,12 +1170,12 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
1170
1170
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1171
1171
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1172
1172
|
type: z.ZodEnum<{
|
|
1173
|
+
BigInt: "BigInt";
|
|
1173
1174
|
UUID: "UUID";
|
|
1174
1175
|
String: "String";
|
|
1175
1176
|
Text: "Text";
|
|
1176
1177
|
Integer: "Integer";
|
|
1177
1178
|
SmallInt: "SmallInt";
|
|
1178
|
-
BigInt: "BigInt";
|
|
1179
1179
|
Numeric: "Numeric";
|
|
1180
1180
|
Boolean: "Boolean";
|
|
1181
1181
|
Date: "Date";
|
|
@@ -1281,12 +1281,12 @@ export declare const documentSchema: z.ZodObject<{
|
|
|
1281
1281
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1282
1282
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1283
1283
|
type: z.ZodEnum<{
|
|
1284
|
+
BigInt: "BigInt";
|
|
1284
1285
|
UUID: "UUID";
|
|
1285
1286
|
String: "String";
|
|
1286
1287
|
Text: "Text";
|
|
1287
1288
|
Integer: "Integer";
|
|
1288
1289
|
SmallInt: "SmallInt";
|
|
1289
|
-
BigInt: "BigInt";
|
|
1290
1290
|
Numeric: "Numeric";
|
|
1291
1291
|
Boolean: "Boolean";
|
|
1292
1292
|
Date: "Date";
|
|
@@ -1509,12 +1509,12 @@ export declare const informationRegisterSchema: z.ZodObject<{
|
|
|
1509
1509
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1510
1510
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1511
1511
|
type: z.ZodEnum<{
|
|
1512
|
+
BigInt: "BigInt";
|
|
1512
1513
|
UUID: "UUID";
|
|
1513
1514
|
String: "String";
|
|
1514
1515
|
Text: "Text";
|
|
1515
1516
|
Integer: "Integer";
|
|
1516
1517
|
SmallInt: "SmallInt";
|
|
1517
|
-
BigInt: "BigInt";
|
|
1518
1518
|
Numeric: "Numeric";
|
|
1519
1519
|
Boolean: "Boolean";
|
|
1520
1520
|
Date: "Date";
|
|
@@ -1596,12 +1596,12 @@ export declare const informationRegisterSchema: z.ZodObject<{
|
|
|
1596
1596
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1597
1597
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1598
1598
|
type: z.ZodEnum<{
|
|
1599
|
+
BigInt: "BigInt";
|
|
1599
1600
|
UUID: "UUID";
|
|
1600
1601
|
String: "String";
|
|
1601
1602
|
Text: "Text";
|
|
1602
1603
|
Integer: "Integer";
|
|
1603
1604
|
SmallInt: "SmallInt";
|
|
1604
|
-
BigInt: "BigInt";
|
|
1605
1605
|
Numeric: "Numeric";
|
|
1606
1606
|
Boolean: "Boolean";
|
|
1607
1607
|
Date: "Date";
|
|
@@ -1689,12 +1689,12 @@ export declare const informationRegisterSchema: z.ZodObject<{
|
|
|
1689
1689
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1690
1690
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1691
1691
|
type: z.ZodEnum<{
|
|
1692
|
+
BigInt: "BigInt";
|
|
1692
1693
|
UUID: "UUID";
|
|
1693
1694
|
String: "String";
|
|
1694
1695
|
Text: "Text";
|
|
1695
1696
|
Integer: "Integer";
|
|
1696
1697
|
SmallInt: "SmallInt";
|
|
1697
|
-
BigInt: "BigInt";
|
|
1698
1698
|
Numeric: "Numeric";
|
|
1699
1699
|
Boolean: "Boolean";
|
|
1700
1700
|
Date: "Date";
|
|
@@ -1882,12 +1882,12 @@ export declare const accumulationRegisterSchema: z.ZodObject<{
|
|
|
1882
1882
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1883
1883
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1884
1884
|
type: z.ZodEnum<{
|
|
1885
|
+
BigInt: "BigInt";
|
|
1885
1886
|
UUID: "UUID";
|
|
1886
1887
|
String: "String";
|
|
1887
1888
|
Text: "Text";
|
|
1888
1889
|
Integer: "Integer";
|
|
1889
1890
|
SmallInt: "SmallInt";
|
|
1890
|
-
BigInt: "BigInt";
|
|
1891
1891
|
Numeric: "Numeric";
|
|
1892
1892
|
Boolean: "Boolean";
|
|
1893
1893
|
Date: "Date";
|
|
@@ -1994,12 +1994,12 @@ export declare const accumulationRegisterSchema: z.ZodObject<{
|
|
|
1994
1994
|
pattern: z.ZodOptional<z.ZodString>;
|
|
1995
1995
|
minLength: z.ZodOptional<z.ZodNumber>;
|
|
1996
1996
|
type: z.ZodEnum<{
|
|
1997
|
+
BigInt: "BigInt";
|
|
1997
1998
|
UUID: "UUID";
|
|
1998
1999
|
String: "String";
|
|
1999
2000
|
Text: "Text";
|
|
2000
2001
|
Integer: "Integer";
|
|
2001
2002
|
SmallInt: "SmallInt";
|
|
2002
|
-
BigInt: "BigInt";
|
|
2003
2003
|
Numeric: "Numeric";
|
|
2004
2004
|
Boolean: "Boolean";
|
|
2005
2005
|
Date: "Date";
|
|
@@ -2089,12 +2089,12 @@ export declare const constantSchema: z.ZodObject<{
|
|
|
2089
2089
|
}>]>;
|
|
2090
2090
|
}, z.core.$strict>]>>;
|
|
2091
2091
|
type: z.ZodEnum<{
|
|
2092
|
+
BigInt: "BigInt";
|
|
2092
2093
|
UUID: "UUID";
|
|
2093
2094
|
String: "String";
|
|
2094
2095
|
Text: "Text";
|
|
2095
2096
|
Integer: "Integer";
|
|
2096
2097
|
SmallInt: "SmallInt";
|
|
2097
|
-
BigInt: "BigInt";
|
|
2098
2098
|
Numeric: "Numeric";
|
|
2099
2099
|
Boolean: "Boolean";
|
|
2100
2100
|
Date: "Date";
|
|
@@ -2939,6 +2939,7 @@ export declare const customTableColumnSchema: z.ZodObject<{
|
|
|
2939
2939
|
name: z.ZodString;
|
|
2940
2940
|
}, z.core.$strict>>;
|
|
2941
2941
|
pgType: z.ZodOptional<z.ZodString>;
|
|
2942
|
+
length: z.ZodOptional<z.ZodNumber>;
|
|
2942
2943
|
array: z.ZodOptional<z.ZodBoolean>;
|
|
2943
2944
|
precision: z.ZodOptional<z.ZodNumber>;
|
|
2944
2945
|
scale: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2958,7 +2959,6 @@ export declare const customTableColumnSchema: z.ZodObject<{
|
|
|
2958
2959
|
}>;
|
|
2959
2960
|
name: z.ZodString;
|
|
2960
2961
|
}, z.core.$strict>>;
|
|
2961
|
-
length: z.ZodOptional<z.ZodNumber>;
|
|
2962
2962
|
allowedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
2963
2963
|
kind: z.ZodEnum<{
|
|
2964
2964
|
Catalog: "Catalog";
|
|
@@ -2997,13 +2997,13 @@ export declare const customTableColumnSchema: z.ZodObject<{
|
|
|
2997
2997
|
}, z.core.$strict>>;
|
|
2998
2998
|
comment: z.ZodOptional<z.ZodString>;
|
|
2999
2999
|
type: z.ZodEnum<{
|
|
3000
|
+
BigInt: "BigInt";
|
|
3000
3001
|
PgEnum: "PgEnum";
|
|
3001
3002
|
UUID: "UUID";
|
|
3002
3003
|
String: "String";
|
|
3003
3004
|
Text: "Text";
|
|
3004
3005
|
Integer: "Integer";
|
|
3005
3006
|
SmallInt: "SmallInt";
|
|
3006
|
-
BigInt: "BigInt";
|
|
3007
3007
|
Numeric: "Numeric";
|
|
3008
3008
|
Boolean: "Boolean";
|
|
3009
3009
|
Date: "Date";
|
|
@@ -3053,6 +3053,7 @@ export declare const customTableSchema: z.ZodObject<{
|
|
|
3053
3053
|
name: z.ZodString;
|
|
3054
3054
|
}, z.core.$strict>>;
|
|
3055
3055
|
pgType: z.ZodOptional<z.ZodString>;
|
|
3056
|
+
length: z.ZodOptional<z.ZodNumber>;
|
|
3056
3057
|
array: z.ZodOptional<z.ZodBoolean>;
|
|
3057
3058
|
precision: z.ZodOptional<z.ZodNumber>;
|
|
3058
3059
|
scale: z.ZodOptional<z.ZodNumber>;
|
|
@@ -3072,7 +3073,6 @@ export declare const customTableSchema: z.ZodObject<{
|
|
|
3072
3073
|
}>;
|
|
3073
3074
|
name: z.ZodString;
|
|
3074
3075
|
}, z.core.$strict>>;
|
|
3075
|
-
length: z.ZodOptional<z.ZodNumber>;
|
|
3076
3076
|
allowedTypes: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
3077
3077
|
kind: z.ZodEnum<{
|
|
3078
3078
|
Catalog: "Catalog";
|
|
@@ -3111,13 +3111,13 @@ export declare const customTableSchema: z.ZodObject<{
|
|
|
3111
3111
|
}, z.core.$strict>>;
|
|
3112
3112
|
comment: z.ZodOptional<z.ZodString>;
|
|
3113
3113
|
type: z.ZodEnum<{
|
|
3114
|
+
BigInt: "BigInt";
|
|
3114
3115
|
PgEnum: "PgEnum";
|
|
3115
3116
|
UUID: "UUID";
|
|
3116
3117
|
String: "String";
|
|
3117
3118
|
Text: "Text";
|
|
3118
3119
|
Integer: "Integer";
|
|
3119
3120
|
SmallInt: "SmallInt";
|
|
3120
|
-
BigInt: "BigInt";
|
|
3121
3121
|
Numeric: "Numeric";
|
|
3122
3122
|
Boolean: "Boolean";
|
|
3123
3123
|
Date: "Date";
|
|
@@ -3629,8 +3629,8 @@ export declare const projectSchema: z.ZodObject<{
|
|
|
3629
3629
|
en: z.ZodOptional<z.ZodString>;
|
|
3630
3630
|
}, z.core.$strict>>;
|
|
3631
3631
|
defaultLocale: z.ZodDefault<z.ZodEnum<{
|
|
3632
|
-
uk: "uk";
|
|
3633
3632
|
en: "en";
|
|
3633
|
+
uk: "uk";
|
|
3634
3634
|
}>>;
|
|
3635
3635
|
primaryDataLanguage: z.ZodOptional<z.ZodString>;
|
|
3636
3636
|
defaultSchema: z.ZodDefault<z.ZodString>;
|
|
@@ -3975,11 +3975,11 @@ export declare const pgEnumSchema: z.ZodObject<{
|
|
|
3975
3975
|
en: z.ZodOptional<z.ZodString>;
|
|
3976
3976
|
}, z.core.$strict>>;
|
|
3977
3977
|
id: z.ZodOptional<z.ZodUUID>;
|
|
3978
|
-
name: z.ZodString;
|
|
3979
3978
|
description: z.ZodOptional<z.ZodObject<{
|
|
3980
3979
|
uk: z.ZodOptional<z.ZodString>;
|
|
3981
3980
|
en: z.ZodOptional<z.ZodString>;
|
|
3982
3981
|
}, z.core.$strict>>;
|
|
3982
|
+
name: z.ZodString;
|
|
3983
3983
|
schema: z.ZodOptional<z.ZodString>;
|
|
3984
3984
|
$schema: z.ZodOptional<z.ZodString>;
|
|
3985
3985
|
physicalName: z.ZodOptional<z.ZodString>;
|
|
@@ -4035,11 +4035,11 @@ export declare const eventSubscriptionSchema: z.ZodObject<{
|
|
|
4035
4035
|
en: z.ZodOptional<z.ZodString>;
|
|
4036
4036
|
}, z.core.$strict>>;
|
|
4037
4037
|
id: z.ZodOptional<z.ZodUUID>;
|
|
4038
|
-
name: z.ZodString;
|
|
4039
4038
|
description: z.ZodOptional<z.ZodObject<{
|
|
4040
4039
|
uk: z.ZodOptional<z.ZodString>;
|
|
4041
4040
|
en: z.ZodOptional<z.ZodString>;
|
|
4042
4041
|
}, z.core.$strict>>;
|
|
4042
|
+
name: z.ZodString;
|
|
4043
4043
|
$schema: z.ZodOptional<z.ZodString>;
|
|
4044
4044
|
physicalName: z.ZodOptional<z.ZodString>;
|
|
4045
4045
|
}, z.core.$strict>;
|
|
@@ -5386,12 +5386,12 @@ export declare const catalogEntryAttributeSchema: z.ZodObject<{
|
|
|
5386
5386
|
name: z.ZodString;
|
|
5387
5387
|
column: z.ZodString;
|
|
5388
5388
|
type: z.ZodEnum<{
|
|
5389
|
+
BigInt: "BigInt";
|
|
5389
5390
|
UUID: "UUID";
|
|
5390
5391
|
String: "String";
|
|
5391
5392
|
Text: "Text";
|
|
5392
5393
|
Integer: "Integer";
|
|
5393
5394
|
SmallInt: "SmallInt";
|
|
5394
|
-
BigInt: "BigInt";
|
|
5395
5395
|
Numeric: "Numeric";
|
|
5396
5396
|
Boolean: "Boolean";
|
|
5397
5397
|
Date: "Date";
|
|
@@ -5450,12 +5450,12 @@ export declare const runtimeAttributeSchema: z.ZodObject<{
|
|
|
5450
5450
|
name: z.ZodString;
|
|
5451
5451
|
column: z.ZodString;
|
|
5452
5452
|
type: z.ZodEnum<{
|
|
5453
|
+
BigInt: "BigInt";
|
|
5453
5454
|
UUID: "UUID";
|
|
5454
5455
|
String: "String";
|
|
5455
5456
|
Text: "Text";
|
|
5456
5457
|
Integer: "Integer";
|
|
5457
5458
|
SmallInt: "SmallInt";
|
|
5458
|
-
BigInt: "BigInt";
|
|
5459
5459
|
Numeric: "Numeric";
|
|
5460
5460
|
Boolean: "Boolean";
|
|
5461
5461
|
Date: "Date";
|
|
@@ -5550,12 +5550,12 @@ export declare const catalogEntrySectionSchema: z.ZodObject<{
|
|
|
5550
5550
|
name: z.ZodString;
|
|
5551
5551
|
column: z.ZodString;
|
|
5552
5552
|
type: z.ZodEnum<{
|
|
5553
|
+
BigInt: "BigInt";
|
|
5553
5554
|
UUID: "UUID";
|
|
5554
5555
|
String: "String";
|
|
5555
5556
|
Text: "Text";
|
|
5556
5557
|
Integer: "Integer";
|
|
5557
5558
|
SmallInt: "SmallInt";
|
|
5558
|
-
BigInt: "BigInt";
|
|
5559
5559
|
Numeric: "Numeric";
|
|
5560
5560
|
Boolean: "Boolean";
|
|
5561
5561
|
Date: "Date";
|
|
@@ -5633,12 +5633,12 @@ export declare const runtimeSectionSchema: z.ZodObject<{
|
|
|
5633
5633
|
name: z.ZodString;
|
|
5634
5634
|
column: z.ZodString;
|
|
5635
5635
|
type: z.ZodEnum<{
|
|
5636
|
+
BigInt: "BigInt";
|
|
5636
5637
|
UUID: "UUID";
|
|
5637
5638
|
String: "String";
|
|
5638
5639
|
Text: "Text";
|
|
5639
5640
|
Integer: "Integer";
|
|
5640
5641
|
SmallInt: "SmallInt";
|
|
5641
|
-
BigInt: "BigInt";
|
|
5642
5642
|
Numeric: "Numeric";
|
|
5643
5643
|
Boolean: "Boolean";
|
|
5644
5644
|
Date: "Date";
|
|
@@ -5936,12 +5936,12 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
5936
5936
|
name: z.ZodString;
|
|
5937
5937
|
column: z.ZodString;
|
|
5938
5938
|
type: z.ZodEnum<{
|
|
5939
|
+
BigInt: "BigInt";
|
|
5939
5940
|
UUID: "UUID";
|
|
5940
5941
|
String: "String";
|
|
5941
5942
|
Text: "Text";
|
|
5942
5943
|
Integer: "Integer";
|
|
5943
5944
|
SmallInt: "SmallInt";
|
|
5944
|
-
BigInt: "BigInt";
|
|
5945
5945
|
Numeric: "Numeric";
|
|
5946
5946
|
Boolean: "Boolean";
|
|
5947
5947
|
Date: "Date";
|
|
@@ -6013,12 +6013,12 @@ export declare const catalogEntrySchema: z.ZodObject<{
|
|
|
6013
6013
|
name: z.ZodString;
|
|
6014
6014
|
column: z.ZodString;
|
|
6015
6015
|
type: z.ZodEnum<{
|
|
6016
|
+
BigInt: "BigInt";
|
|
6016
6017
|
UUID: "UUID";
|
|
6017
6018
|
String: "String";
|
|
6018
6019
|
Text: "Text";
|
|
6019
6020
|
Integer: "Integer";
|
|
6020
6021
|
SmallInt: "SmallInt";
|
|
6021
|
-
BigInt: "BigInt";
|
|
6022
6022
|
Numeric: "Numeric";
|
|
6023
6023
|
Boolean: "Boolean";
|
|
6024
6024
|
Date: "Date";
|
|
@@ -6200,12 +6200,12 @@ export declare const runtimeObjectSchema: z.ZodObject<{
|
|
|
6200
6200
|
name: z.ZodString;
|
|
6201
6201
|
column: z.ZodString;
|
|
6202
6202
|
type: z.ZodEnum<{
|
|
6203
|
+
BigInt: "BigInt";
|
|
6203
6204
|
UUID: "UUID";
|
|
6204
6205
|
String: "String";
|
|
6205
6206
|
Text: "Text";
|
|
6206
6207
|
Integer: "Integer";
|
|
6207
6208
|
SmallInt: "SmallInt";
|
|
6208
|
-
BigInt: "BigInt";
|
|
6209
6209
|
Numeric: "Numeric";
|
|
6210
6210
|
Boolean: "Boolean";
|
|
6211
6211
|
Date: "Date";
|
|
@@ -6292,12 +6292,12 @@ export declare const runtimeObjectSchema: z.ZodObject<{
|
|
|
6292
6292
|
name: z.ZodString;
|
|
6293
6293
|
column: z.ZodString;
|
|
6294
6294
|
type: z.ZodEnum<{
|
|
6295
|
+
BigInt: "BigInt";
|
|
6295
6296
|
UUID: "UUID";
|
|
6296
6297
|
String: "String";
|
|
6297
6298
|
Text: "Text";
|
|
6298
6299
|
Integer: "Integer";
|
|
6299
6300
|
SmallInt: "SmallInt";
|
|
6300
|
-
BigInt: "BigInt";
|
|
6301
6301
|
Numeric: "Numeric";
|
|
6302
6302
|
Boolean: "Boolean";
|
|
6303
6303
|
Date: "Date";
|
|
@@ -6648,12 +6648,12 @@ export declare const runtimeCatalogSchema: z.ZodObject<{
|
|
|
6648
6648
|
name: z.ZodString;
|
|
6649
6649
|
column: z.ZodString;
|
|
6650
6650
|
type: z.ZodEnum<{
|
|
6651
|
+
BigInt: "BigInt";
|
|
6651
6652
|
UUID: "UUID";
|
|
6652
6653
|
String: "String";
|
|
6653
6654
|
Text: "Text";
|
|
6654
6655
|
Integer: "Integer";
|
|
6655
6656
|
SmallInt: "SmallInt";
|
|
6656
|
-
BigInt: "BigInt";
|
|
6657
6657
|
Numeric: "Numeric";
|
|
6658
6658
|
Boolean: "Boolean";
|
|
6659
6659
|
Date: "Date";
|
|
@@ -6740,12 +6740,12 @@ export declare const runtimeCatalogSchema: z.ZodObject<{
|
|
|
6740
6740
|
name: z.ZodString;
|
|
6741
6741
|
column: z.ZodString;
|
|
6742
6742
|
type: z.ZodEnum<{
|
|
6743
|
+
BigInt: "BigInt";
|
|
6743
6744
|
UUID: "UUID";
|
|
6744
6745
|
String: "String";
|
|
6745
6746
|
Text: "Text";
|
|
6746
6747
|
Integer: "Integer";
|
|
6747
6748
|
SmallInt: "SmallInt";
|
|
6748
|
-
BigInt: "BigInt";
|
|
6749
6749
|
Numeric: "Numeric";
|
|
6750
6750
|
Boolean: "Boolean";
|
|
6751
6751
|
Date: "Date";
|
|
@@ -7061,12 +7061,12 @@ export declare const clientCatalogSchema: z.ZodObject<{
|
|
|
7061
7061
|
name: z.ZodString;
|
|
7062
7062
|
column: z.ZodString;
|
|
7063
7063
|
type: z.ZodEnum<{
|
|
7064
|
+
BigInt: "BigInt";
|
|
7064
7065
|
UUID: "UUID";
|
|
7065
7066
|
String: "String";
|
|
7066
7067
|
Text: "Text";
|
|
7067
7068
|
Integer: "Integer";
|
|
7068
7069
|
SmallInt: "SmallInt";
|
|
7069
|
-
BigInt: "BigInt";
|
|
7070
7070
|
Numeric: "Numeric";
|
|
7071
7071
|
Boolean: "Boolean";
|
|
7072
7072
|
Date: "Date";
|
|
@@ -7138,12 +7138,12 @@ export declare const clientCatalogSchema: z.ZodObject<{
|
|
|
7138
7138
|
name: z.ZodString;
|
|
7139
7139
|
column: z.ZodString;
|
|
7140
7140
|
type: z.ZodEnum<{
|
|
7141
|
+
BigInt: "BigInt";
|
|
7141
7142
|
UUID: "UUID";
|
|
7142
7143
|
String: "String";
|
|
7143
7144
|
Text: "Text";
|
|
7144
7145
|
Integer: "Integer";
|
|
7145
7146
|
SmallInt: "SmallInt";
|
|
7146
|
-
BigInt: "BigInt";
|
|
7147
7147
|
Numeric: "Numeric";
|
|
7148
7148
|
Boolean: "Boolean";
|
|
7149
7149
|
Date: "Date";
|
|
@@ -7393,9 +7393,9 @@ export declare const wireOperationSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
|
7393
7393
|
object: z.ZodGUID;
|
|
7394
7394
|
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodGUID, z.ZodString]>, z.ZodPreprocess<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>, unknown>>>;
|
|
7395
7395
|
}, z.core.$strict>, z.ZodObject<{
|
|
7396
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7396
7397
|
id: z.ZodGUID;
|
|
7397
7398
|
action: z.ZodLiteral<"update">;
|
|
7398
|
-
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7399
7399
|
expectedVersion: z.ZodInt;
|
|
7400
7400
|
expectedValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7401
7401
|
object: z.ZodGUID;
|
|
@@ -7854,9 +7854,9 @@ export declare const dataRequestSchema: z.ZodObject<{
|
|
|
7854
7854
|
object: z.ZodGUID;
|
|
7855
7855
|
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodGUID, z.ZodString]>, z.ZodPreprocess<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>, unknown>>>;
|
|
7856
7856
|
}, z.core.$strict>, z.ZodObject<{
|
|
7857
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7857
7858
|
id: z.ZodGUID;
|
|
7858
7859
|
action: z.ZodLiteral<"update">;
|
|
7859
|
-
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7860
7860
|
expectedVersion: z.ZodInt;
|
|
7861
7861
|
expectedValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7862
7862
|
object: z.ZodGUID;
|
|
@@ -7900,9 +7900,9 @@ export declare const dataRequestSchema: z.ZodObject<{
|
|
|
7900
7900
|
object: z.ZodGUID;
|
|
7901
7901
|
tabularSections: z.ZodOptional<z.ZodRecord<z.ZodUnion<readonly [z.ZodGUID, z.ZodString]>, z.ZodPreprocess<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>, unknown>>>;
|
|
7902
7902
|
}, z.core.$strict>, z.ZodObject<{
|
|
7903
|
+
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7903
7904
|
id: z.ZodGUID;
|
|
7904
7905
|
action: z.ZodLiteral<"update">;
|
|
7905
|
-
values: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7906
7906
|
expectedVersion: z.ZodInt;
|
|
7907
7907
|
expectedValues: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
7908
7908
|
object: z.ZodGUID;
|
package/dist/schema/index.d.ts
CHANGED
|
@@ -1021,7 +1021,17 @@ export declare function checkOwnerAttributes(tx: ApplyTransaction, provider: Dat
|
|
|
1021
1021
|
* тримає тест, а не читання маніфесту під час виконання: ярус не звертається
|
|
1022
1022
|
* до файлової системи.
|
|
1023
1023
|
*/
|
|
1024
|
-
export declare const PLATFORM_VERSION = "0.3.0-next.
|
|
1024
|
+
export declare const PLATFORM_VERSION = "0.3.0-next.12";
|
|
1025
|
+
/**
|
|
1026
|
+
* Whether a database carries the development flag: the database-level
|
|
1027
|
+
* setting `simetra.environment = 'development'` (`ALTER DATABASE … SET`,
|
|
1028
|
+
* `pg_db_role_setting` with `setrole = 0`). `$1` names the database through
|
|
1029
|
+
* the shared catalog (`pg_database`); `NULL` means the current database of the
|
|
1030
|
+
* connection. Returns one row `{ development: boolean }`.
|
|
1031
|
+
*
|
|
1032
|
+
* Spec: docs/superpowers/specs/2026-11-30-consumer-testing-design.md §3.
|
|
1033
|
+
*/
|
|
1034
|
+
export declare const DEVELOPMENT_DATABASE_SQL = "SELECT EXISTS (\n SELECT FROM pg_catalog.pg_db_role_setting d\n JOIN pg_catalog.pg_database b ON b.oid = d.setdatabase\n WHERE b.datname = COALESCE($1::pg_catalog.name, pg_catalog.current_database())\n AND d.setrole = 0\n AND 'simetra.environment=development' = ANY (d.setconfig)) AS development";
|
|
1025
1035
|
/**
|
|
1026
1036
|
* Структурний ключ таблиці для множин і мап: ім'я з крапкою не злипається зі
|
|
1027
1037
|
* схемою, як злиплося б у `schema.name`. Складені ключі підоб'єктів — так
|
|
@@ -3356,6 +3366,20 @@ export declare function postgresClusterSet(database: string): PostgresClusterSet
|
|
|
3356
3366
|
* which sets the same four GUCs to a command budget instead of 0.
|
|
3357
3367
|
*/
|
|
3358
3368
|
export declare const ENGINE_SESSION_TIMEOUTS: readonly string[];
|
|
3369
|
+
/**
|
|
3370
|
+
* The grants of the owner on the identity table: `USAGE` on its schema,
|
|
3371
|
+
* `TRIGGER, REFERENCES` on the table alone (the provision trigger and the
|
|
3372
|
+
* foreign key of the model). The single source of
|
|
3373
|
+
* this SQL: the `ensurePostgresCluster` write phase and the test helper of a
|
|
3374
|
+
* tagged copy database, which `roles` cannot prepare, both run it.
|
|
3375
|
+
*/
|
|
3376
|
+
export declare function identityGrantSql(owner: string, identity: {
|
|
3377
|
+
schema: string;
|
|
3378
|
+
name: string;
|
|
3379
|
+
}): {
|
|
3380
|
+
usage: string;
|
|
3381
|
+
table: string;
|
|
3382
|
+
};
|
|
3359
3383
|
/** З'єднання підготовки кластера: службова база, ціль, шаблон. */
|
|
3360
3384
|
interface ClusterConnections {
|
|
3361
3385
|
maintenance: DbConnection;
|
|
@@ -3390,13 +3414,28 @@ type RightsMaintenanceRequest = {
|
|
|
3390
3414
|
user: string;
|
|
3391
3415
|
role: string;
|
|
3392
3416
|
member?: Record<string, unknown>;
|
|
3417
|
+
} |
|
|
3418
|
+
/**
|
|
3419
|
+
* A new member of one scope with the named roles of that scope kind — only
|
|
3420
|
+
* for the designer `testing` entry, never exposed by the CLI tool; refused
|
|
3421
|
+
* outside a development database (`maintenance.not-development`).
|
|
3422
|
+
*/
|
|
3423
|
+
{
|
|
3424
|
+
action: "member";
|
|
3425
|
+
scopeKind: string;
|
|
3426
|
+
scope: string;
|
|
3427
|
+
user: string;
|
|
3428
|
+
roles: readonly string[];
|
|
3429
|
+
member?: Record<string, unknown>;
|
|
3393
3430
|
};
|
|
3394
3431
|
/**
|
|
3395
3432
|
* What the tool wrote: the new assignment and, on the scope level, the member
|
|
3396
|
-
* row the assignment addresses (new or existing).
|
|
3433
|
+
* row the assignment addresses (new or existing). The action `member` also
|
|
3434
|
+
* lists every assignment it wrote, in the order of `roles`.
|
|
3397
3435
|
*/
|
|
3398
3436
|
interface RightsMaintenanceDone {
|
|
3399
3437
|
assignment: string;
|
|
3438
|
+
assignments?: string[];
|
|
3400
3439
|
member?: string;
|
|
3401
3440
|
}
|
|
3402
3441
|
/**
|
package/dist/schema/index.js
CHANGED
|
@@ -3893,7 +3893,7 @@ async function readSessionSearchPath(tx) {
|
|
|
3893
3893
|
* тримає тест, а не читання маніфесту під час виконання: ярус не звертається
|
|
3894
3894
|
* до файлової системи.
|
|
3895
3895
|
*/
|
|
3896
|
-
const PLATFORM_VERSION = "0.3.0-next.
|
|
3896
|
+
const PLATFORM_VERSION = "0.3.0-next.12";
|
|
3897
3897
|
// src/schema/apply/state.ts
|
|
3898
3898
|
/**
|
|
3899
3899
|
* Форма стану застосування (платформна спека §6.1). Читач приймає лише її:
|
|
@@ -5043,6 +5043,22 @@ async function checkOwnerAttributes(tx, provider) {
|
|
|
5043
5043
|
const [row] = await tx.query("SELECT rolname AS role, rolbypassrls AS bypassrls, rolsuper AS superuser FROM pg_catalog.pg_roles WHERE rolname = current_user");
|
|
5044
5044
|
return ownerRefusal(row, provider);
|
|
5045
5045
|
}
|
|
5046
|
+
// src/schema/apply/development-database.ts
|
|
5047
|
+
/**
|
|
5048
|
+
* Whether a database carries the development flag: the database-level
|
|
5049
|
+
* setting `simetra.environment = 'development'` (`ALTER DATABASE … SET`,
|
|
5050
|
+
* `pg_db_role_setting` with `setrole = 0`). `$1` names the database through
|
|
5051
|
+
* the shared catalog (`pg_database`); `NULL` means the current database of the
|
|
5052
|
+
* connection. Returns one row `{ development: boolean }`.
|
|
5053
|
+
*
|
|
5054
|
+
* Spec: docs/superpowers/specs/2026-11-30-consumer-testing-design.md §3.
|
|
5055
|
+
*/
|
|
5056
|
+
const DEVELOPMENT_DATABASE_SQL = `SELECT EXISTS (
|
|
5057
|
+
SELECT FROM pg_catalog.pg_db_role_setting d
|
|
5058
|
+
JOIN pg_catalog.pg_database b ON b.oid = d.setdatabase
|
|
5059
|
+
WHERE b.datname = COALESCE($1::pg_catalog.name, pg_catalog.current_database())
|
|
5060
|
+
AND d.setrole = 0
|
|
5061
|
+
AND 'simetra.environment=development' = ANY (d.setconfig)) AS development`;
|
|
5046
5062
|
// src/schema/apply/locks.ts
|
|
5047
5063
|
/**
|
|
5048
5064
|
* Режими блокування таблиці сильніші за `ROW EXCLUSIVE`, від слабшого до
|
|
@@ -13804,29 +13820,46 @@ function prepare(model, request) {
|
|
|
13804
13820
|
switch (request.action) {
|
|
13805
13821
|
case "firstGlobalAssignment": return role.assignedOn.level === "global";
|
|
13806
13822
|
case "restoreGlobalFullAccess": return role.assignedOn.level === "global" && role.fullAccess;
|
|
13807
|
-
case "tenantFullAccess":
|
|
13823
|
+
case "tenantFullAccess":
|
|
13824
|
+
case "member": return role.assignedOn.level === "scope" && (request.action === "member" || role.fullAccess) && model.scopeKinds.find((k) => k.name === request.scopeKind)?.id === role.assignedOn.scopeKindId;
|
|
13808
13825
|
}
|
|
13809
13826
|
};
|
|
13810
|
-
const expected = request.action === "firstGlobalAssignment" ? "assignable on the global level" : request.action === "restoreGlobalFullAccess" ? "assignable on the global level with fullAccess" : `assignable on scope:${request.scopeKind} with fullAccess`;
|
|
13811
|
-
const
|
|
13812
|
-
|
|
13813
|
-
|
|
13814
|
-
|
|
13827
|
+
const expected = request.action === "firstGlobalAssignment" ? "assignable on the global level" : request.action === "restoreGlobalFullAccess" ? "assignable on the global level with fullAccess" : request.action === "member" ? `assignable on scope:${request.scopeKind}` : `assignable on scope:${request.scopeKind} with fullAccess`;
|
|
13828
|
+
const scoped = request.action === "tenantFullAccess" || request.action === "member";
|
|
13829
|
+
const kind = scoped ? model.scopeKinds.find((k) => k.name === request.scopeKind) : void 0;
|
|
13830
|
+
if (scoped && kind === void 0) return refusal("maintenance.unknown-scope-kind", { scopeKind: request.scopeKind });
|
|
13831
|
+
const named = (name) => {
|
|
13832
|
+
const role = roles.find((r) => r.name === name);
|
|
13833
|
+
if (role === void 0) return refusal("maintenance.unknown-role", { role: name });
|
|
13834
|
+
if (!fits(role)) return refusal("maintenance.role-level", {
|
|
13835
|
+
role: role.name,
|
|
13836
|
+
expected
|
|
13837
|
+
});
|
|
13838
|
+
return role;
|
|
13839
|
+
};
|
|
13840
|
+
const picked = [];
|
|
13841
|
+
if (request.action === "member") {
|
|
13842
|
+
if (request.roles.length === 0) return refusal("maintenance.role-level", {
|
|
13843
|
+
role: "(none)",
|
|
13844
|
+
expected
|
|
13845
|
+
});
|
|
13846
|
+
for (const name of request.roles) {
|
|
13847
|
+
const role = named(name);
|
|
13848
|
+
if (!("roleId" in role)) return role;
|
|
13849
|
+
picked.push(role);
|
|
13850
|
+
}
|
|
13851
|
+
} else if (request.role === void 0) {
|
|
13815
13852
|
const candidates = roles.filter(fits);
|
|
13816
13853
|
if (candidates.length > 1) return refusal("maintenance.role-ambiguous", { roles: candidates.map((r) => r.name).sort().join(", ") });
|
|
13817
13854
|
if (candidates.length === 0) return refusal("maintenance.role-level", {
|
|
13818
13855
|
role: "(none)",
|
|
13819
13856
|
expected
|
|
13820
13857
|
});
|
|
13821
|
-
|
|
13858
|
+
picked.push(candidates[0]);
|
|
13822
13859
|
} else {
|
|
13823
|
-
const
|
|
13824
|
-
if (
|
|
13825
|
-
|
|
13826
|
-
role: named.name,
|
|
13827
|
-
expected
|
|
13828
|
-
});
|
|
13829
|
-
role = named;
|
|
13860
|
+
const role = named(request.role);
|
|
13861
|
+
if (!("roleId" in role)) return role;
|
|
13862
|
+
picked.push(role);
|
|
13830
13863
|
}
|
|
13831
13864
|
const level = kind === void 0 ? { level: "global" } : {
|
|
13832
13865
|
level: "scope",
|
|
@@ -13836,11 +13869,11 @@ function prepare(model, request) {
|
|
|
13836
13869
|
if (catalog === void 0) return refusal("maintenance.no-catalog", { level: kind === void 0 ? "global" : `scope:${kind.name}` });
|
|
13837
13870
|
const prepared = {
|
|
13838
13871
|
user: request.user,
|
|
13839
|
-
|
|
13872
|
+
roles: picked,
|
|
13840
13873
|
catalog,
|
|
13841
13874
|
assignments: tableOf(model, catalog.assignments.table)
|
|
13842
13875
|
};
|
|
13843
|
-
if (
|
|
13876
|
+
if (!scoped || kind === void 0) return prepared;
|
|
13844
13877
|
const membership = membershipOf(model, kind);
|
|
13845
13878
|
if (membership === void 0) return refusal("maintenance.no-catalog", { level: `scope:${kind.name}` });
|
|
13846
13879
|
let member;
|
|
@@ -13877,6 +13910,10 @@ const found = async (tx, sql, params = []) => (await tx.query(sql, params)).leng
|
|
|
13877
13910
|
async function maintain(tx, model, request, p) {
|
|
13878
13911
|
const contracts = model.contracts;
|
|
13879
13912
|
const style = model.project.naming.attributeCase;
|
|
13913
|
+
if (request.action === "member") {
|
|
13914
|
+
const [flag] = await tx.query(DEVELOPMENT_DATABASE_SQL, [null]);
|
|
13915
|
+
if (flag?.development !== true) throw new Refusal(refusal("maintenance.not-development"));
|
|
13916
|
+
}
|
|
13880
13917
|
const [lock] = await tx.query(LOCK);
|
|
13881
13918
|
if (lock?.locked !== true) throw new Refusal(refusal("maintenance.busy"));
|
|
13882
13919
|
let applied = null;
|
|
@@ -13910,17 +13947,19 @@ async function maintain(tx, model, request, p) {
|
|
|
13910
13947
|
case "restoreGlobalFullAccess":
|
|
13911
13948
|
if (await found(tx, `SELECT 1 AS holder FROM (${holders}) h LIMIT 1`)) throw new Refusal(refusal("maintenance.holder-exists", { level }));
|
|
13912
13949
|
break;
|
|
13913
|
-
case "tenantFullAccess":
|
|
13950
|
+
case "tenantFullAccess":
|
|
13951
|
+
case "member": {
|
|
13914
13952
|
const scope = p.scope;
|
|
13915
13953
|
const { root, membership: m } = scope;
|
|
13916
13954
|
if (!await found(tx, `SELECT 1 AS root FROM ${qualified(root.table)} r WHERE r.${q(root.column)} = $1`, [scope.id])) throw new Refusal(refusal("maintenance.scope-missing", { scope: scope.id }));
|
|
13917
|
-
if (await found(tx, `SELECT 1 AS holder FROM (${holders}) h WHERE h.scope = $1 LIMIT 1`, [scope.id])) throw new Refusal(refusal("maintenance.holder-exists", { level }));
|
|
13955
|
+
if (request.action === "tenantFullAccess" && await found(tx, `SELECT 1 AS holder FROM (${holders}) h WHERE h.scope = $1 LIMIT 1`, [scope.id])) throw new Refusal(refusal("maintenance.holder-exists", { level }));
|
|
13918
13956
|
const [existing] = await tx.query([
|
|
13919
13957
|
`SELECT m.${q(m.key)} AS member FROM ${qualified(m.table)} m`,
|
|
13920
13958
|
`WHERE m.${q(m.scope)} = $1 AND m.${q(m.user)} = $2`,
|
|
13921
13959
|
...m.conditions.map((condition) => `AND ${condition}`),
|
|
13922
13960
|
`ORDER BY m.${q(m.key)} LIMIT 1`
|
|
13923
13961
|
].join(" "), [scope.id, p.user]);
|
|
13962
|
+
if (existing !== void 0 && request.action === "member") throw new Refusal(refusal("maintenance.member-exists", { user: p.user }));
|
|
13924
13963
|
if (existing !== void 0) {
|
|
13925
13964
|
if (scope.memberGiven) throw new Refusal(refusal("maintenance.invalid-member", { path: "member" }));
|
|
13926
13965
|
member = existing.member;
|
|
@@ -13949,17 +13988,27 @@ async function maintain(tx, model, request, p) {
|
|
|
13949
13988
|
await tx.query(`INSERT INTO ${table} (${columns}) SELECT ${columns} FROM jsonb_populate_record(NULL::${table}, $1::jsonb)`, [JSON.stringify(values)]);
|
|
13950
13989
|
}
|
|
13951
13990
|
if (member !== void 0) subject = member;
|
|
13952
|
-
const [row] = await tx.query(NEW_ID);
|
|
13953
|
-
const assignment = row.id;
|
|
13954
13991
|
const scopeColumn = p.assignments.columns.find((c) => c.origin.scopeKindId !== void 0)?.name;
|
|
13955
|
-
const
|
|
13956
|
-
|
|
13957
|
-
|
|
13958
|
-
|
|
13959
|
-
|
|
13960
|
-
|
|
13961
|
-
|
|
13962
|
-
|
|
13992
|
+
const written = [];
|
|
13993
|
+
for (const role of p.roles) {
|
|
13994
|
+
const [row] = await tx.query(NEW_ID);
|
|
13995
|
+
const id = row.id;
|
|
13996
|
+
written.push(id);
|
|
13997
|
+
const insert = [
|
|
13998
|
+
[column$1(model, p.assignments, keyColumn(false)), id],
|
|
13999
|
+
...p.scope === void 0 || scopeColumn === void 0 ? [] : [[scopeColumn, p.scope.id]],
|
|
14000
|
+
[column$1(model, p.assignments, R$1.subject), subject],
|
|
14001
|
+
[column$1(model, p.assignments, R$1.archetype), role.roleId]
|
|
14002
|
+
];
|
|
14003
|
+
await tx.query(`INSERT INTO ${assignments} (${insert.map(([name]) => q(name)).join(", ")}) VALUES (${insert.map((_, i) => `$${i + 1}`).join(", ")})`, insert.map(([, value]) => value));
|
|
14004
|
+
}
|
|
14005
|
+
const assignment = written[0];
|
|
14006
|
+
if (request.action === "member") return {
|
|
14007
|
+
assignment,
|
|
14008
|
+
assignments: written,
|
|
14009
|
+
member
|
|
14010
|
+
};
|
|
14011
|
+
if (!(request.action === "firstGlobalAssignment" ? await found(tx, `SELECT 1 AS effective FROM (${effectiveHolderRows(p.catalog, contracts, model.physical, style)}) h WHERE h.actor = $1 AND h.archetype = $2 LIMIT 1`, [p.user, p.roles[0].roleId]) : p.scope === void 0 ? await found(tx, `SELECT 1 AS effective FROM (${holders}) h WHERE h.actor = $1 LIMIT 1`, [p.user]) : await found(tx, `SELECT 1 AS effective FROM (${holders}) h WHERE h.scope = $1 AND h.actor = $2 LIMIT 1`, [p.scope.id, p.user]))) throw new Refusal(refusal("maintenance.not-effective", { user: p.user }));
|
|
13963
14012
|
return {
|
|
13964
14013
|
assignment,
|
|
13965
14014
|
...member === void 0 ? {} : { member }
|
|
@@ -16546,4 +16595,4 @@ function cloneMismatch(engine, scope, live, copy) {
|
|
|
16546
16595
|
if (sections.length > 0) out.push(mismatch("fingerprint", sections.join(", ")));
|
|
16547
16596
|
return out;
|
|
16548
16597
|
}
|
|
16549
|
-
export { ALL_PRIVILEGES, APPLY_ADVISORY_LOCK, APPLY_STATE_FORMAT, ApplyConnectionLost, ApplyDbError, BACKFILL_SETTINGS, CANONICAL_NAME_KINDS, CLUSTER_ADVISORY_LOCK, CheckNameTaken, DATA_SETTINGS, DATA_TRIGGER_MODES, DEFAULT_APPLY_TIMEOUTS, DEFAULT_PRIVILEGE_OBJTYPES, DRIFT_PERMISSION, DRIFT_REASONS, ENGINE_ACTION_VERBS, ENGINE_PREAMBLE_ALLOWED, ENGINE_SESSION_TIMEOUTS, ENGINE_TRANSACTIONALITIES, FINGERPRINT_SECTIONS, FINGERPRINT_VERSION, FUNCTION_ERROR_LIMIT, FUNCTION_SCOPE_SQL, GUARD_PAIR_SQLSTATES, LOCK_MODE_SQL, PLAN_FORMAT, PLATFORM_VERSION, PLPGSQL_CHECK_MODES, PROVIDER_ASSUMED_SCHEMAS, PROVIDER_BASE_EXTENSIONS, PROVIDER_EVENT_TRIGGERS, PROVIDER_EXPECTED_BLIND_FUNCTIONS, PROVIDER_IDENTITY_TRIGGER_LOCKED, PROVIDER_INSTALLABLE_EXTENSIONS, PROVIDER_LOCKS, PROVIDER_LOCK_STATEMENTS, PROVIDER_PUBLIC_SCHEMA_GRANTS, PROVIDER_SHADOW_TEMPLATES, PROVIDER_SURFACES, PROVIDER_SYSTEM_ROLES, PROVIDER_UNMANAGED_EXTENSIONS, PlpgsqlCheckUnavailable, REHEARSAL_FORMAT, REHEARSAL_PHASES, RETRYABLE_SQLSTATES, STEP_CLASSES, TABLE_LOCK_MODES, UNAPPLIED_FUNCTION_SETTINGS, accessChanges, adoptedReplacements, appliedCatalog, applyStateOf, applyStateOwnership, backfillAction, backfillStepRefusals, backfillTargetKey, backfillTargets, backfillTriggers, backfillWriteTables, buildPlan, canonicalRenames, carrierBackfillSteps, castGuardForms, castProbeQuery, censusDiagnostics, checkGuardCasts, checkOwnerAttributes, checkOwnerMembership, checkPermissions, checkPlatformRoles, classifyRemovals, classifySteps, columnKey, compareFingerprints, comparePermissionItems, compareWithDesired, conditionalToPlain, copiesShadowFromTemplate, countOf, coversMode, createdByPlan, dataComputeSql, dataCountSql, dataFactRefusals, dataGuardSql, dataPlan, dataStepRefusals, dataTableStep, dataWriteSql, defaultsBeforeNotNull, desiredForApply, driftGate, engineScope, ensurePlatformRoles, ensurePostgresCluster, environmentMismatch, environmentSteps, executePlan, findApply, folderReference, footprintSubjects, footprintTables, foreignChanges, foreignSequenceRefusals, functionChangeRefusals, hasIdentityTriggers, identityTableRefusal, identityTriggerLocks, intentStep, isPlatformTrigger, isRetryable, joinModes, lintSteps, lockPrivileges, lockRightsSql, newFunctionErrors, notNullColumns, numberingNotGenerated, ownerRefusal, parsePlan, parseRehearsal, pendingCarrierCopies, planArtifactSchema, planBackfills, planChange, planFileName, planFootprint, planFunctionChecks, planLocks, planPlatformFunctions, platformReplacements, platformRoleGate, platformRoleRefusals, platformRoleSet, postgresClusterSet, predefinedSeedSql, predefinedSeedSteps, preservationPlan, preservationQuery, preservationTypeRefusals, preservationTypeStepRefusals, promotionPermissionItems, promotionTransition, propertyReproductions, providerStatement, providerStatements, providerTableNames, providerTriggerConflicts, providerTriggerInBoundarySql, providerTriggerKey, readAccessDependents, readAppliedPromotions, readApplyState, readBackfillCounts, readBlindFunctions, readDataFacts, readEquivalenceObjects, readFingerprint, readGlobalDefaultPrivileges, readLedgerHead, readLiveForeignKeys, readLiveTriggers, readLockRights, readPlatformRoles, readPlpgsqlCheckMode, readPlpgsqlCheckPresence, readPlpgsqlErrors, readProviderLocks, readSeedTargetRows, readServerFacts, readServiceAccess, readSessionSearchPath, readShadowEnvironment, readTypeChangeDependents, readTypePresence, readUserTriggers, readValidatorErrors, readWriteFacts, readWritePath, reconcileCensus, rehearsalFileName, rehearsalHash, rehearsalRefusals, rehearsalReport, rehearsalReportSchema, renameIntent, renderApplyState, renderComments, renderDesiredState, renderEnumType, renderForeignKeys, renderGlobalDefaultPrivileges, renderIndexes, renderProviderSeed, renderRowLevelSecurity, renderTable, requiredPermissions, requiredPlatformRoles, revalidationSettings, reverseGenerate, runRightsMaintenance, sameDefault, seedVerdict, serializePlan, serializeRehearsal, stampPlan, statementSubjects, statementTimeoutFromReport, stepConversions, stepFootprint, tableKey, triggerReplacements, triggerSql, typeChangeRefusals, typeGuards, typeIdentity, unclassifiedRemovals, unmodeledClasses, unrealizedRenames, updateOfNarrowings, valueElementColumns, verifyPlanHash, withLocalSettings, withNotNullChecks, withShownTriggers, withTempNames, withTriggers, writeApplyStateStatements, writeFactRefusals };
|
|
16598
|
+
export { ALL_PRIVILEGES, APPLY_ADVISORY_LOCK, APPLY_STATE_FORMAT, ApplyConnectionLost, ApplyDbError, BACKFILL_SETTINGS, CANONICAL_NAME_KINDS, CLUSTER_ADVISORY_LOCK, CheckNameTaken, DATA_SETTINGS, DATA_TRIGGER_MODES, DEFAULT_APPLY_TIMEOUTS, DEFAULT_PRIVILEGE_OBJTYPES, DEVELOPMENT_DATABASE_SQL, DRIFT_PERMISSION, DRIFT_REASONS, ENGINE_ACTION_VERBS, ENGINE_PREAMBLE_ALLOWED, ENGINE_SESSION_TIMEOUTS, ENGINE_TRANSACTIONALITIES, FINGERPRINT_SECTIONS, FINGERPRINT_VERSION, FUNCTION_ERROR_LIMIT, FUNCTION_SCOPE_SQL, GUARD_PAIR_SQLSTATES, LOCK_MODE_SQL, PLAN_FORMAT, PLATFORM_VERSION, PLPGSQL_CHECK_MODES, PROVIDER_ASSUMED_SCHEMAS, PROVIDER_BASE_EXTENSIONS, PROVIDER_EVENT_TRIGGERS, PROVIDER_EXPECTED_BLIND_FUNCTIONS, PROVIDER_IDENTITY_TRIGGER_LOCKED, PROVIDER_INSTALLABLE_EXTENSIONS, PROVIDER_LOCKS, PROVIDER_LOCK_STATEMENTS, PROVIDER_PUBLIC_SCHEMA_GRANTS, PROVIDER_SHADOW_TEMPLATES, PROVIDER_SURFACES, PROVIDER_SYSTEM_ROLES, PROVIDER_UNMANAGED_EXTENSIONS, PlpgsqlCheckUnavailable, REHEARSAL_FORMAT, REHEARSAL_PHASES, RETRYABLE_SQLSTATES, STEP_CLASSES, TABLE_LOCK_MODES, UNAPPLIED_FUNCTION_SETTINGS, accessChanges, adoptedReplacements, appliedCatalog, applyStateOf, applyStateOwnership, backfillAction, backfillStepRefusals, backfillTargetKey, backfillTargets, backfillTriggers, backfillWriteTables, buildPlan, canonicalRenames, carrierBackfillSteps, castGuardForms, castProbeQuery, censusDiagnostics, checkGuardCasts, checkOwnerAttributes, checkOwnerMembership, checkPermissions, checkPlatformRoles, classifyRemovals, classifySteps, columnKey, compareFingerprints, comparePermissionItems, compareWithDesired, conditionalToPlain, copiesShadowFromTemplate, countOf, coversMode, createdByPlan, dataComputeSql, dataCountSql, dataFactRefusals, dataGuardSql, dataPlan, dataStepRefusals, dataTableStep, dataWriteSql, defaultsBeforeNotNull, desiredForApply, driftGate, engineScope, ensurePlatformRoles, ensurePostgresCluster, environmentMismatch, environmentSteps, executePlan, findApply, folderReference, footprintSubjects, footprintTables, foreignChanges, foreignSequenceRefusals, functionChangeRefusals, hasIdentityTriggers, identityGrantSql, identityTableRefusal, identityTriggerLocks, intentStep, isPlatformTrigger, isRetryable, joinModes, lintSteps, lockPrivileges, lockRightsSql, newFunctionErrors, notNullColumns, numberingNotGenerated, ownerRefusal, parsePlan, parseRehearsal, pendingCarrierCopies, planArtifactSchema, planBackfills, planChange, planFileName, planFootprint, planFunctionChecks, planLocks, planPlatformFunctions, platformReplacements, platformRoleGate, platformRoleRefusals, platformRoleSet, postgresClusterSet, predefinedSeedSql, predefinedSeedSteps, preservationPlan, preservationQuery, preservationTypeRefusals, preservationTypeStepRefusals, promotionPermissionItems, promotionTransition, propertyReproductions, providerStatement, providerStatements, providerTableNames, providerTriggerConflicts, providerTriggerInBoundarySql, providerTriggerKey, readAccessDependents, readAppliedPromotions, readApplyState, readBackfillCounts, readBlindFunctions, readDataFacts, readEquivalenceObjects, readFingerprint, readGlobalDefaultPrivileges, readLedgerHead, readLiveForeignKeys, readLiveTriggers, readLockRights, readPlatformRoles, readPlpgsqlCheckMode, readPlpgsqlCheckPresence, readPlpgsqlErrors, readProviderLocks, readSeedTargetRows, readServerFacts, readServiceAccess, readSessionSearchPath, readShadowEnvironment, readTypeChangeDependents, readTypePresence, readUserTriggers, readValidatorErrors, readWriteFacts, readWritePath, reconcileCensus, rehearsalFileName, rehearsalHash, rehearsalRefusals, rehearsalReport, rehearsalReportSchema, renameIntent, renderApplyState, renderComments, renderDesiredState, renderEnumType, renderForeignKeys, renderGlobalDefaultPrivileges, renderIndexes, renderProviderSeed, renderRowLevelSecurity, renderTable, requiredPermissions, requiredPlatformRoles, revalidationSettings, reverseGenerate, runRightsMaintenance, sameDefault, seedVerdict, serializePlan, serializeRehearsal, stampPlan, statementSubjects, statementTimeoutFromReport, stepConversions, stepFootprint, tableKey, triggerReplacements, triggerSql, typeChangeRefusals, typeGuards, typeIdentity, unclassifiedRemovals, unmodeledClasses, unrealizedRenames, updateOfNarrowings, valueElementColumns, verifyPlanHash, withLocalSettings, withNotNullChecks, withShownTriggers, withTempNames, withTriggers, writeApplyStateStatements, writeFactRefusals };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "simetra",
|
|
3
|
-
"version": "0.3.0-next.
|
|
3
|
+
"version": "0.3.0-next.12",
|
|
4
4
|
"description": "Metadata-driven platform for business applications on Postgres: metamodel, compiler and schema engine",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"metadata",
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
"publishConfig": {
|
|
136
136
|
"access": "public"
|
|
137
137
|
},
|
|
138
|
-
"gitHead": "
|
|
138
|
+
"gitHead": "b09f103cdc7ff0f10606b771f1619397699bddf0",
|
|
139
139
|
"scripts": {
|
|
140
140
|
"build": "tsc --noEmit",
|
|
141
141
|
"build:package": "tsdown",
|