simetra 0.3.0-next.10 → 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 +1 -1
- package/dist/compiler/index.js +18 -0
- package/dist/data/index.js +29 -6
- package/dist/model/index.d.ts +1 -1
- package/dist/schema/index.d.ts +41 -2
- package/dist/schema/index.js +79 -30
- package/dist/ui/index.js +4 -1
- 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>;
|
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/data/index.js
CHANGED
|
@@ -4139,7 +4139,7 @@ const FLIGHT_KIND_RULES = {
|
|
|
4139
4139
|
],
|
|
4140
4140
|
confirms: "view-with-composition",
|
|
4141
4141
|
successMovesDeadline: true,
|
|
4142
|
-
failureCounts: "
|
|
4142
|
+
failureCounts: "always",
|
|
4143
4143
|
liftsBanners: true,
|
|
4144
4144
|
setsBanners: false,
|
|
4145
4145
|
discarded: "pause-then-retry"
|
|
@@ -4555,7 +4555,7 @@ function settleFlight(state, input) {
|
|
|
4555
4555
|
failures: 0,
|
|
4556
4556
|
failedAt: void 0
|
|
4557
4557
|
};
|
|
4558
|
-
if (input.outcome === "failed" && input.applyFailed !== true &&
|
|
4558
|
+
if (input.outcome === "failed" && input.applyFailed !== true && rules.failureCounts === "always") next = {
|
|
4559
4559
|
...next,
|
|
4560
4560
|
failures: next.failures + 1,
|
|
4561
4561
|
failedAt: input.startedAt
|
|
@@ -5438,8 +5438,7 @@ function settleTarget(s, flight, outcome, failure, context) {
|
|
|
5438
5438
|
return false;
|
|
5439
5439
|
}
|
|
5440
5440
|
const rules = rulesOf(flight);
|
|
5441
|
-
const
|
|
5442
|
-
const counts = (applied) => applied ? rules.successMovesDeadline : context.readFailed && (rules.failureCounts === "always" || rules.failureCounts === "if-loaded" && loadedBefore);
|
|
5441
|
+
const counts = (applied) => applied ? rules.successMovesDeadline : context.readFailed && rules.failureCounts === "always";
|
|
5443
5442
|
const sentAt = "part" in s && s.part === "rights" ? s.targetState.refreshedAt : void 0;
|
|
5444
5443
|
const settle = (applied) => ({
|
|
5445
5444
|
outcome: applied ? "applied" : "failed",
|
|
@@ -5452,7 +5451,6 @@ function settleTarget(s, flight, outcome, failure, context) {
|
|
|
5452
5451
|
epoch: required(flight.epoch, "its start epoch"),
|
|
5453
5452
|
...flight.kind === "load" && s.targetState.flightRevision !== void 0 ? { headerRevision: s.targetState.flightRevision } : {},
|
|
5454
5453
|
startedAt: sentAt ?? (counts(applied) ? required(flight.startedAt, "its start time") : flight.startedAt ?? 0),
|
|
5455
|
-
loaded: loadedBefore,
|
|
5456
5454
|
applyFailed: !context.readFailed,
|
|
5457
5455
|
...context.report?.sectionRead === void 0 ? {} : { sectionRead: context.report.sectionRead },
|
|
5458
5456
|
...context.report?.carriedHeader === true ? { carriedHeader: true } : {}
|
|
@@ -7035,6 +7033,23 @@ function eligible(ctx, s, options) {
|
|
|
7035
7033
|
return s.alive && !s.purged && s.loaded && (!options.visibleOnly || isVisible(s) || options.alsoViews?.has(s) === true) && (minAgeMs === void 0 || ctx.defects.has("min-age-ignored") || ctx.defects.has("min-age-ignored-sections") && s.form.spec.kind === "section" || (s.targetState.refreshedAt !== void 0 && ctx.defects.has("min-age-all-young") ? false : ctx.now() >= dueOf(ctx, s, minAgeMs))) && (s.form.spec.kind !== "section" || s.listeners.size > 0 || options.alsoViews?.has(s) === true);
|
|
7036
7034
|
}
|
|
7037
7035
|
/**
|
|
7036
|
+
* A view whose first load failed and stands idle (row 18): no row, so it is
|
|
7037
|
+
* not {@link eligible} for `revalidate` — its read is a load, not a re-read.
|
|
7038
|
+
* The failure pause (`viewDue`) is its only due time.
|
|
7039
|
+
*/
|
|
7040
|
+
const failedFirstLoad = (s) => s.alive && !s.purged && !s.loaded && s.status === "error" && s.targetState.failures > 0 && s.targetState.flight === void 0;
|
|
7041
|
+
/**
|
|
7042
|
+
* The failed first loads whose pause ended: the tick loads them again
|
|
7043
|
+
* without a user action (row 18). The gate judges the read itself (M7).
|
|
7044
|
+
*/
|
|
7045
|
+
function dueFirstLoads(ctx, object) {
|
|
7046
|
+
return [...ctx.registry.subsets()].filter((s) => {
|
|
7047
|
+
if (s.form.object.name !== object || !failedFirstLoad(s)) return false;
|
|
7048
|
+
const at = viewDue(ctx, s);
|
|
7049
|
+
return at !== void 0 && ctx.now() >= at;
|
|
7050
|
+
});
|
|
7051
|
+
}
|
|
7052
|
+
/**
|
|
7038
7053
|
* The earliest due time of the object's views the interval tick would read
|
|
7039
7054
|
* (P4-B spec §6.7): visible, loaded, not in flight, not out of the discard
|
|
7040
7055
|
* limit — the same filter `revalidate` applies with `minAgeMs`, so the timer
|
|
@@ -7053,6 +7068,7 @@ function nextViewDue(ctx, object) {
|
|
|
7053
7068
|
* reads it then); `undefined` — the tick does not read it.
|
|
7054
7069
|
*/
|
|
7055
7070
|
function viewDue(ctx, s) {
|
|
7071
|
+
if (failedFirstLoad(s)) return isVisible(s) && !unavailable(s) ? dueOf(ctx, s) : void 0;
|
|
7056
7072
|
if (!eligible(ctx, s, { visibleOnly: true })) return void 0;
|
|
7057
7073
|
if (inFlight(s) || unavailable(s) && !ctx.defects.has("scheduler-reads-unavailable")) return void 0;
|
|
7058
7074
|
const at = dueOf(ctx, s);
|
|
@@ -9196,7 +9212,14 @@ function createCore(options) {
|
|
|
9196
9212
|
}
|
|
9197
9213
|
const minAgeMs = .9 * limits.revalidateIntervalMs;
|
|
9198
9214
|
let read = false;
|
|
9199
|
-
for (const o of objects.values())
|
|
9215
|
+
for (const o of objects.values()) {
|
|
9216
|
+
if (gate.staleObject(o.name)) continue;
|
|
9217
|
+
if (hasDueViews(writerContext, o.name, minAgeMs)) read = true;
|
|
9218
|
+
for (const s of dueFirstLoads(writerContext, o.name)) registry.load(s, {
|
|
9219
|
+
reason: "retry",
|
|
9220
|
+
site: "M7"
|
|
9221
|
+
});
|
|
9222
|
+
}
|
|
9200
9223
|
if (runDue()) read = true;
|
|
9201
9224
|
if (wave !== void 0 && wave.at <= now()) fireWave();
|
|
9202
9225
|
receiver?.tick();
|
package/dist/model/index.d.ts
CHANGED
|
@@ -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>;
|
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/dist/ui/index.js
CHANGED
|
@@ -1076,7 +1076,10 @@ function CardBody(props) {
|
|
|
1076
1076
|
}, createElement("div", { "data-region": "card-status" }, createElement("span", {
|
|
1077
1077
|
"aria-live": "polite",
|
|
1078
1078
|
"data-card": "status"
|
|
1079
|
-
}, key === void 0 || key === "state.purged" ? null : createElement(Text, { messageKey: key }), staleHint ? createElement("span", { "data-hint": "stale" }, createElement(Text, { messageKey: "state.stale" })) : null, card.status === "error" && card.error !== void 0 && !("reason" in card.error && card.error.reason === "tabular-too-large") ? createElement("span", { "data-error": card.error.code }, card.error.code) : null),
|
|
1079
|
+
}, key === void 0 || key === "state.purged" ? null : createElement(Text, { messageKey: key }), staleHint ? createElement("span", { "data-hint": "stale" }, createElement(Text, { messageKey: "state.stale" })) : null, card.status === "error" && card.error !== void 0 && !("reason" in card.error && card.error.reason === "tabular-too-large") ? createElement("span", { "data-error": card.error.code }, card.error.code) : null), card.status === "error" && card.error !== void 0 && !card.isStale && !("reason" in card.error && card.error.reason === "tabular-too-large") ? createElement(Button, {
|
|
1080
|
+
messageKey: "action.retry",
|
|
1081
|
+
onClick: card.refresh
|
|
1082
|
+
}) : null, createElement("span", {
|
|
1080
1083
|
"aria-live": "assertive",
|
|
1081
1084
|
"data-card": "security",
|
|
1082
1085
|
"data-reason": card.status === "purged" ? card.reason : void 0
|
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",
|