@wildo-ai/saas-backend-lib 1.1.2 → 1.1.3
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/esm/applications/services/worker-remote-client-factory.backend.service.d.ts.map +1 -1
- package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js +19 -1
- package/dist/esm/applications/services/worker-remote-client-factory.backend.service.js.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.d.ts.map +1 -1
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js +4 -0
- package/dist/esm/base-classes/models/manual-controllers.backend.definition.js.map +1 -1
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts +35 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js +111 -0
- package/dist/esm/base-classes/services/batches/child-lifecycle-teardown.batch.backend.service.js.map +1 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts +50 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js +199 -0
- package/dist/esm/base-classes/services/batches/credential-expiry-sweep.batch.backend.service.js.map +1 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts +111 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.d.ts.map +1 -1
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js +140 -0
- package/dist/esm/base-classes/services/batches/engine-custom-batch-manifests.js.map +1 -1
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js +27 -6
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts +124 -13
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js +207 -21
- package/dist/esm/base-classes/services/repositories/http-api/http-api-provider-access.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts +60 -8
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js +174 -26
- package/dist/esm/base-classes/services/repositories/http-api/http-api-read-client.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +47 -4
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js +96 -29
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts +55 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.d.ts.map +1 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js +114 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-rest-operation-reference.backend.js.map +1 -0
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts +89 -14
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js +84 -11
- package/dist/esm/base-classes/services/repositories/http-api/http-api-transport.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js +9 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +49 -0
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js +171 -18
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js +23 -3
- package/dist/esm/base-classes/services/repositories/repositories-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js +20 -0
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts +22 -0
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-custom-implementation-base.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js +4 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts +11 -0
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js +39 -5
- package/dist/esm/base-classes/services/services/resource-status-transition.definitions.backend.js.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts +181 -2
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js +529 -41
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts +36 -3
- package/dist/esm/base-classes/services/services/system-access.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/system-access.backend.service.js +70 -8
- package/dist/esm/base-classes/services/services/system-access.backend.service.js.map +1 -1
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts +28 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js +90 -0
- package/dist/esm/billing/batches/billing-reconciliation.batch.backend.service.js.map +1 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts +44 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.js +99 -0
- package/dist/esm/billing/batches/usage-flush.batch.backend.service.js.map +1 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts +91 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.d.ts.map +1 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js +152 -0
- package/dist/esm/billing/models/billing-provider-event-settlement.backend.schemas.js.map +1 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts +186 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.d.ts.map +1 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js +474 -0
- package/dist/esm/billing/services/back-office/billing-reconciliation.backend.service.js.map +1 -0
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts +100 -0
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js +209 -6
- package/dist/esm/billing/services/back-office/product-catalog-sync.backend.service.js.map +1 -1
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts +200 -4
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.js +593 -64
- package/dist/esm/billing/services/back-office/usage-metering.backend.service.js.map +1 -1
- package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts +36 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.d.ts.map +1 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.js +83 -0
- package/dist/esm/billing/services/billing-adapter-registry.backend.js.map +1 -0
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts +9 -0
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.d.ts.map +1 -1
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js +11 -1
- package/dist/esm/billing/services/billing-checkout-metadata.backend.utils.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +48 -7
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts +38 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js +67 -2
- package/dist/esm/billing/services/custom-impl/billing-custom-impl-utils.backend.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts +30 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js +43 -1
- package/dist/esm/billing/services/custom-impl/billing-custom-implementations.backend.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts +11 -3
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js +30 -16
- package/dist/esm/billing/services/custom-impl/promotion.custom-ops.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js +104 -25
- package/dist/esm/billing/services/custom-impl/subscription.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts +18 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js +106 -2
- package/dist/esm/billing/services/stripe-standard-billing-provider.backend.service.js.map +1 -1
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts +52 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.d.ts.map +1 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js +74 -0
- package/dist/esm/billing/services/webhooks/__tests__/settlement-ledger.test-double.js.map +1 -0
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts +104 -11
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.d.ts.map +1 -1
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js +260 -26
- package/dist/esm/billing/services/webhooks/billing-webhook-event-router.backend.service.js.map +1 -1
- package/dist/esm/billing/testing/mock-billing-provider.d.ts +30 -1
- package/dist/esm/billing/testing/mock-billing-provider.d.ts.map +1 -1
- package/dist/esm/billing/testing/mock-billing-provider.js +25 -0
- package/dist/esm/billing/testing/mock-billing-provider.js.map +1 -1
- package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js +11 -4
- package/dist/esm/compliance/audit-trails/batches/audit-logs-archive.batch.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +225 -13
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js +340 -62
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts +244 -7
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js +386 -5
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js +7 -1
- package/dist/esm/compliance/audit-trails/services/composite-audit-log-sink.backend.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +6 -2
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +31 -9
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts +42 -0
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js +57 -1
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts +110 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js +192 -0
- package/dist/esm/compliance/audit-trails/services/utils/leased-value-cache.backend.utils.js.map +1 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js +31 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts +5 -0
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.d.ts.map +1 -1
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.js +6 -0
- package/dist/esm/config/bootstrap/application-runtime-profile.backend.js.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.d.ts +142 -46
- package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.js +121 -12
- package/dist/esm/config/models/app-config.backend.schemas.js.map +1 -1
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts +38 -15
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js +17 -2
- package/dist/esm/config/models/provider-runtime-artifact.backend.schemas.js.map +1 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts +0 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration-loader.backend.service.js +68 -76
- package/dist/esm/config/services/app-configuration-loader.backend.service.js.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.service.js +23 -1
- package/dist/esm/config/services/app-configuration.backend.service.js.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts +33 -0
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.js +39 -1
- package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts +25 -0
- package/dist/esm/config/services/application-startup-config-validator.backend.service.d.ts.map +1 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.js +41 -1
- package/dist/esm/config/services/application-startup-config-validator.backend.service.js.map +1 -1
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.d.ts.map +1 -1
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js +48 -0
- package/dist/esm/databases/services/postgresql-schema-plan-diff.backend.js.map +1 -1
- package/dist/esm/errors/services/error-builder.backend.service.d.ts +13 -1
- package/dist/esm/errors/services/error-builder.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-builder.backend.service.js +13 -1
- package/dist/esm/errors/services/error-builder.backend.service.js.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.d.ts +70 -7
- package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.js +129 -8
- package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
- package/dist/esm/errors/services/rate-limit.backend.service.d.ts +66 -0
- package/dist/esm/errors/services/rate-limit.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/rate-limit.backend.service.js +102 -25
- package/dist/esm/errors/services/rate-limit.backend.service.js.map +1 -1
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts +5 -0
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.d.ts.map +1 -1
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js +25 -0
- package/dist/esm/errors/utils/error-log-level-classification.backend.utils.js.map +1 -1
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts +33 -0
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.d.ts.map +1 -1
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js +40 -0
- package/dist/esm/errors/utils/rate-limit-environment-relaxation.backend.utils.js.map +1 -1
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +59 -2
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js +52 -17
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts +4 -2
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.d.ts.map +1 -1
- package/dist/esm/external-providers/models/provider-selection-resolution-evidence.backend.definitions.js.map +1 -1
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts +256 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js +333 -0
- package/dist/esm/external-providers/operations/provider-operation-executor.backend.service.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts +56 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.js +211 -0
- package/dist/esm/external-providers/operations/provider-operation-request.backend.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts +45 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.js +216 -0
- package/dist/esm/external-providers/operations/provider-request-signing.backend.js.map +1 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts +56 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.d.ts.map +1 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js +78 -0
- package/dist/esm/external-providers/operations/provider-rest-call-client.backend.js.map +1 -0
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts +1 -1
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js +2 -2
- package/dist/esm/external-providers/services/__tests__/mock-external-providers-registry.service.js.map +1 -1
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts +89 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.d.ts.map +1 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js +164 -0
- package/dist/esm/external-providers/services/backend-provider-loader.backend.service.js.map +1 -0
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts +26 -27
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js +50 -64
- package/dist/esm/external-providers/services/backend-provider-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/document-extraction.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/document-extraction.backend.service.js +3 -3
- package/dist/esm/external-providers/services/document-extraction.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/embeddings.backend.service.js +4 -4
- package/dist/esm/external-providers/services/embeddings.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +292 -7
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js +533 -45
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.d.ts.map +1 -1
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js +25 -2
- package/dist/esm/external-providers/services/frontend-bootstrap.backend.service.js.map +1 -1
- package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
- package/dist/esm/files/controllers/file.controller.js +21 -13
- package/dist/esm/files/controllers/file.controller.js.map +1 -1
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js +39 -15
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-scanning.backend.service.d.ts +94 -9
- package/dist/esm/files/services/file-scanning.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-scanning.backend.service.js +197 -17
- package/dist/esm/files/services/file-scanning.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.d.ts +60 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-text-extraction.backend.service.js +167 -8
- package/dist/esm/files/services/file-text-extraction.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +53 -2
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-upload-grant.backend.service.js +127 -3
- package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -1
- package/dist/esm/files/services/files.backend.service.d.ts +68 -0
- package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/files.backend.service.js +175 -5
- package/dist/esm/files/services/files.backend.service.js.map +1 -1
- package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts +109 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.d.ts.map +1 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.js +123 -0
- package/dist/esm/files/storage/application-storage-key.backend.utils.js.map +1 -0
- package/dist/esm/files/storage/file-storage-provider.types.d.ts +16 -10
- package/dist/esm/files/storage/file-storage-provider.types.d.ts.map +1 -1
- package/dist/esm/files/storage/file-storage-provider.types.js.map +1 -1
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts +67 -8
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js +101 -28
- package/dist/esm/files/storage/local-directory-storage-provider.backend.service.js.map +1 -1
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.d.ts.map +1 -1
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js +8 -55
- package/dist/esm/files/storage/wildo-managed-storage-provider.backend.service.js.map +1 -1
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.d.ts.map +1 -1
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.js +20 -0
- package/dist/esm/files/utils/file-field-schema-path.backend.utils.js.map +1 -1
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts +86 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.d.ts.map +1 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js +288 -0
- package/dist/esm/files/utils/office-document-text-extraction.backend.utils.js.map +1 -0
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts +15 -0
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js +76 -5
- package/dist/esm/flows-actors/a2a/batches/a2a-abandoned-task-sweep.batch.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js +6 -1
- package/dist/esm/flows-actors/a2a/controllers/a2a.controller.js.map +1 -1
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts +60 -0
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js +63 -0
- package/dist/esm/flows-actors/a2a/models/a2a.backend.schemas.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts +74 -0
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +196 -40
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts +7 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js +53 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts +18 -0
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js +18 -0
- package/dist/esm/flows-actors/a2a/services/a2a-token-budget.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts +12 -7
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts +0 -13
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js +14 -22
- package/dist/esm/flows-actors/models/agent-catalogs.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts +8 -3
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.js +25 -15
- package/dist/esm/flows-actors/models/core-facets.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts +13 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/flows-actors.backend.schemas.js.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts +88 -8
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js +333 -31
- package/dist/esm/flows-actors/models/function-tools.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.d.ts.map +1 -1
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js +4 -2
- package/dist/esm/flows-actors/models/market-generation.actors-system.backend.definitions.js.map +1 -1
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts +113 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.d.ts.map +1 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js +62 -0
- package/dist/esm/flows-actors/models/mcp-client.backend.definitions.js.map +1 -0
- package/dist/esm/flows-actors/services/actors-system.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/actors-system.backend.service.js +0 -2
- package/dist/esm/flows-actors/services/actors-system.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +28 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +204 -18
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts +5 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js +79 -16
- package/dist/esm/flows-actors/services/conversational-execution.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts +34 -5
- package/dist/esm/flows-actors/services/flows-actors-registry.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js +154 -20
- package/dist/esm/flows-actors/services/flows-actors-registry.service.js.map +1 -1
- package/dist/esm/flows-actors/services/flows.backend.services.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/flows.backend.services.js +27 -23
- package/dist/esm/flows-actors/services/flows.backend.services.js.map +1 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js +7 -1
- package/dist/esm/flows-actors/services/llm-observability-agent-call-trace-sink.backend.js.map +1 -1
- package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts +90 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.d.ts.map +1 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.js +368 -0
- package/dist/esm/flows-actors/services/mcp-client.backend.service.js.map +1 -0
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts +9 -5
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js +12 -17
- package/dist/esm/flows-actors/services/prompt-compiler.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js +8 -4
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts +0 -207
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js +8 -243
- package/dist/esm/flows-actors/utils/meta-workflow-canonical-json.backend.utils.js.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.d.ts.map +1 -1
- package/dist/esm/flows-actors/utils/meta-workflow-structured-generation-plan.backend.utils.js.map +1 -1
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts +9 -14
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.d.ts.map +1 -1
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.js +18 -89
- package/dist/esm/guidance/services/milestone-evaluator.backend.service.js.map +1 -1
- package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts +86 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.d.ts.map +1 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.js +155 -0
- package/dist/esm/guidance/services/progression-state-store.backend.service.js.map +1 -0
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts +10 -0
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.js +55 -5
- package/dist/esm/i18n/controllers/i18n-controller.backend.service.js.map +1 -1
- package/dist/esm/index.d.ts +11 -4
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +31 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/inject/models/container.d.ts.map +1 -1
- package/dist/esm/inject/models/container.js +78 -10
- package/dist/esm/inject/models/container.js.map +1 -1
- package/dist/esm/inject/models/service-types.d.ts +17 -3
- package/dist/esm/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/inject/models/service-types.js +19 -3
- package/dist/esm/inject/models/service-types.js.map +1 -1
- package/dist/esm/mcp/controllers/mcp.controller.d.ts.map +1 -1
- package/dist/esm/mcp/controllers/mcp.controller.js +20 -0
- package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +56 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.js +107 -11
- package/dist/esm/mcp/services/mcp-server.backend.service.js.map +1 -1
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.d.ts.map +1 -1
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js +22 -0
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js +49 -4
- package/dist/esm/monitoring/analytics/controllers/analytics.backend.controller.js.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts +66 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.d.ts.map +1 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js +199 -0
- package/dist/esm/monitoring/analytics/services/value-moment-definition-registry.backend.service.js.map +1 -0
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts +149 -13
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js +411 -19
- package/dist/esm/monitoring/analytics/services/value-moment-engine.backend.service.js.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts +11 -2
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/monitoring/analytics/services/value-moment-handler-registry.backend.service.js.map +1 -1
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts +28 -9
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.js +30 -10
- package/dist/esm/monitoring/logger/models/logger.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/logger/services/logger.service.d.ts +12 -0
- package/dist/esm/monitoring/logger/services/logger.service.d.ts.map +1 -1
- package/dist/esm/monitoring/logger/services/logger.service.js +52 -11
- package/dist/esm/monitoring/logger/services/logger.service.js.map +1 -1
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts +62 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.d.ts.map +1 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js +78 -0
- package/dist/esm/monitoring/logger/utils/log-severity-floor.backend.utils.js.map +1 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts +309 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.d.ts.map +1 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.js +385 -0
- package/dist/esm/monitoring/observability/audit-observation-emission.backend.js.map +1 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts +1 -0
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/models/observability.backend.schemas.js.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts +21 -0
- package/dist/esm/monitoring/observability/services/metrics.service.d.ts.map +1 -1
- package/dist/esm/monitoring/observability/services/metrics.service.js +38 -0
- package/dist/esm/monitoring/observability/services/metrics.service.js.map +1 -1
- package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts +0 -80
- package/dist/esm/notifications/email/models/email-context-provider.interface.d.ts.map +0 -1
- package/dist/esm/notifications/email/models/email-context-provider.interface.js +0 -25
- package/dist/esm/notifications/email/models/email-context-provider.interface.js.map +0 -1
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts +0 -49
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js +0 -141
- package/dist/esm/notifications/email/services/email-context-provider-registry.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts +0 -37
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js +0 -121
- package/dist/esm/notifications/email/services/email-template-compiler.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts +66 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.js +105 -10
- package/dist/esm/notifications/email/services/email-template-registry.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts +0 -58
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.d.ts.map +0 -1
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js +0 -223
- package/dist/esm/notifications/email/services/email-template-sandbox.backend.service.js.map +0 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.js +10 -1
- package/dist/esm/notifications/email/services/email-template-validator.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/services/email.backend.service.d.ts +60 -4
- package/dist/esm/notifications/email/services/email.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/email/services/email.backend.service.js +145 -43
- package/dist/esm/notifications/email/services/email.backend.service.js.map +1 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts +0 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.d.ts.map +1 -1
- package/dist/esm/notifications/email/utils/color-conversion.utils.js.map +1 -1
- package/dist/esm/notifications/services/notification-badge.backend.service.d.ts +142 -21
- package/dist/esm/notifications/services/notification-badge.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notification-badge.backend.service.js +283 -58
- package/dist/esm/notifications/services/notification-badge.backend.service.js.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +99 -13
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +422 -66
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
- package/dist/esm/notifications/sms/services/sms.backend.service.d.ts +2 -2
- package/dist/esm/notifications/sms/services/sms.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/sms/services/sms.backend.service.js +5 -5
- package/dist/esm/notifications/sms/services/sms.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts +117 -5
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js +164 -6
- package/dist/esm/notifications/webhooks/controllers/webhook-auto-controller.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts +0 -6
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js +46 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js +16 -6
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js +12 -12
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts +16 -0
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js +18 -0
- package/dist/esm/notifications/webhooks/services/webhook-handler.backend.service.js.map +1 -1
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.d.ts +2 -2
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js +2 -2
- package/dist/esm/organizations/batches/organization-purge.batch.backend.service.js.map +1 -1
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js +63 -2
- package/dist/esm/organizations/services/organization-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts +66 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.d.ts.map +1 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js +257 -0
- package/dist/esm/queue/adapters/in-memory-queue-adapter.backend.service.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts +12 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.js +47 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.binding.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts +87 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.js +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.interface.js.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts +31 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.d.ts.map +1 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.js +13 -0
- package/dist/esm/queue/adapters/queue-adapter.backend.options.js.map +1 -0
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts +19 -25
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js +33 -0
- package/dist/esm/queue/adapters/rabbitmq-adapter.backend.service.js.map +1 -1
- package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts +2 -2
- package/dist/esm/queue/domain-queue-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/domain-queue-consumer.backend.service.js +1 -4
- package/dist/esm/queue/domain-queue-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.d.ts +2 -2
- package/dist/esm/queue/job-consumer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-consumer.backend.service.js +1 -4
- package/dist/esm/queue/job-consumer.backend.service.js.map +1 -1
- package/dist/esm/queue/job-executor.backend.service.d.ts +2 -2
- package/dist/esm/queue/job-executor.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/job-executor.backend.service.js +1 -4
- package/dist/esm/queue/job-executor.backend.service.js.map +1 -1
- package/dist/esm/queue/queue-monitoring.backend.service.d.ts +8 -4
- package/dist/esm/queue/queue-monitoring.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue-monitoring.backend.service.js +25 -17
- package/dist/esm/queue/queue-monitoring.backend.service.js.map +1 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts +16 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.js +16 -1
- package/dist/esm/queue/queue-worker-initializer.backend.service.js.map +1 -1
- package/dist/esm/queue/queue.backend.service.d.ts +3 -3
- package/dist/esm/queue/queue.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/queue.backend.service.js +26 -4
- package/dist/esm/queue/queue.backend.service.js.map +1 -1
- package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts +2 -2
- package/dist/esm/queue/worker-shutdown-manager.backend.service.d.ts.map +1 -1
- package/dist/esm/queue/worker-shutdown-manager.backend.service.js +18 -3
- package/dist/esm/queue/worker-shutdown-manager.backend.service.js.map +1 -1
- package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts +50 -25
- package/dist/esm/rag/utils/rag-chunking.backend.utils.d.ts.map +1 -1
- package/dist/esm/rag/utils/rag-chunking.backend.utils.js +147 -39
- package/dist/esm/rag/utils/rag-chunking.backend.utils.js.map +1 -1
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts +12 -3
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.d.ts.map +1 -1
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js +12 -3
- package/dist/esm/rag/utils/rag-context-assembly.backend.utils.js.map +1 -1
- package/dist/esm/requests/service/websocket.service.d.ts +9 -0
- package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
- package/dist/esm/requests/service/websocket.service.js +32 -8
- package/dist/esm/requests/service/websocket.service.js.map +1 -1
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map +1 -1
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js +14 -2
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
- package/dist/esm/resources/models/resources-operations.backend.definitions.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-operations.backend.definitions.js +2 -0
- package/dist/esm/resources/models/resources-operations.backend.definitions.js.map +1 -1
- package/dist/esm/resources/models/resources-relationships.backend.definitions.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-relationships.backend.definitions.js +14 -0
- package/dist/esm/resources/models/resources-relationships.backend.definitions.js.map +1 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.d.ts +2 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.d.ts.map +1 -1
- package/dist/esm/resources/models/resources-types.backend.schemas.js +8 -0
- package/dist/esm/resources/models/resources-types.backend.schemas.js.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.d.ts +60 -5
- package/dist/esm/resources/services/resources-registry.backend.service.d.ts.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.js +90 -6
- package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
- package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts +36 -3
- package/dist/esm/runtime/controllers/health-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/controllers/health-controller.backend.service.js +32 -10
- package/dist/esm/runtime/controllers/health-controller.backend.service.js.map +1 -1
- package/dist/esm/runtime/domain-module.backend.definitions.d.ts +24 -0
- package/dist/esm/runtime/domain-module.backend.definitions.d.ts.map +1 -1
- package/dist/esm/runtime/domain-module.backend.definitions.js +24 -0
- package/dist/esm/runtime/domain-module.backend.definitions.js.map +1 -1
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts +51 -0
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.d.ts.map +1 -1
- package/dist/esm/runtime/services/health-readiness-contributor.backend.interface.js.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.d.ts +26 -0
- package/dist/esm/runtime/services/http-server.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/http-server.backend.service.js +181 -1
- package/dist/esm/runtime/services/http-server.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts +19 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.js +261 -77
- package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts +15 -0
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js +28 -0
- package/dist/esm/security/api-keys/api-keys.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts +5 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js +24 -4
- package/dist/esm/security/authentications/batches/anonymous-session-cleanup.batch.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js +29 -4
- package/dist/esm/security/authentications/controllers/authentication-controller.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts +114 -0
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js +354 -3
- package/dist/esm/security/authentications/controllers/oauth-provider-controller.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts +1 -0
- package/dist/esm/security/authentications/models/cimd.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/cimd.backend.schemas.js +22 -0
- package/dist/esm/security/authentications/models/cimd.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts +15 -0
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/oauth2-connection.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts +0 -2
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js +23 -14
- package/dist/esm/security/authentications/services/admin-config/auth-organization-configuration.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts +0 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js +15 -12
- package/dist/esm/security/authentications/services/admin-config/domain-to-org-lookup.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts +113 -3
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js +207 -30
- package/dist/esm/security/authentications/services/admin-config/domain-verification.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts +95 -2
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js +153 -9
- package/dist/esm/security/authentications/services/admin-config/enterprise-user-provisioning.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts +190 -0
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.js +377 -53
- package/dist/esm/security/authentications/services/anonymous-session.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js +68 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts +41 -0
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js +202 -23
- package/dist/esm/security/authentications/services/auth-methods/auth-registration.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js +42 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-authentication.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js +34 -4
- package/dist/esm/security/authentications/services/auth-methods/oauth2-connection-resolver.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts +29 -5
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js +77 -5
- package/dist/esm/security/authentications/services/auth-methods/webauthn.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +17 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js +49 -17
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts +43 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js +277 -97
- package/dist/esm/security/authentications/services/authentication-orchestrator.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts +28 -5
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js +72 -12
- package/dist/esm/security/authentications/services/cimd-client-metadata.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js +3 -0
- package/dist/esm/security/authentications/services/custom-impls/auth-custom-implementations.backend.js.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts +28 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js +283 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config-domain-verification.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts +4 -3
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js +4 -3
- package/dist/esm/security/authentications/services/custom-impls/sso-config.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts +35 -0
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js +111 -21
- package/dist/esm/security/authentications/services/oauth-provider-token.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts +14 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js +49 -8
- package/dist/esm/security/authentications/services/oidc-authorization-code.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js +4 -0
- package/dist/esm/security/authentications/services/utils/auth-policy-resolution.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js +6 -0
- package/dist/esm/security/authentications/services/utils/auth-user-lookup.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts +37 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js +51 -0
- package/dist/esm/security/authentications/services/utils/external-turn-rate-limit.backend.utils.js.map +1 -1
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts +41 -0
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js +45 -0
- package/dist/esm/security/authentications/utils/enterprise-sso-enforcement.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts +116 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.d.ts.map +1 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js +162 -0
- package/dist/esm/security/authorizations/cross-tenant-read-observation.backend.js.map +1 -0
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts +20 -20
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js +27 -28
- package/dist/esm/security/authorizations/organization-owner-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js +77 -3
- package/dist/esm/security/authorizations/platform-access-grant-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts +4 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.js +4 -0
- package/dist/esm/security/authorizations/role-ceiling.backend.utils.js.map +1 -1
- package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts +93 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.js +95 -0
- package/dist/esm/security/authorizations/role-conferral.backend.utils.js.map +1 -0
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts +124 -1
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.d.ts.map +1 -1
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js +142 -5
- package/dist/esm/security/authorizations/scope-root-collection-confinement.backend.js.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +74 -8
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js +175 -19
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts +6 -14
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js +13 -22
- package/dist/esm/security/authorizations/super-admin-floor.backend.utils.js.map +1 -1
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts +60 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js +79 -0
- package/dist/esm/security/connected-accounts/connection-target-authorization.backend.js.map +1 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts +161 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js +512 -0
- package/dist/esm/security/connected-accounts/controllers/provider-connection.controller.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts +59 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js +22 -0
- package/dist/esm/security/connected-accounts/organization-provider-credential-resolver.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts +44 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js +20 -0
- package/dist/esm/security/connected-accounts/provider-oauth2-refresher.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts +191 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js +385 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credential-store.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts +41 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js +358 -0
- package/dist/esm/security/connected-accounts/services/organization-provider-credentials.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts +160 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js +266 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-exchange.backend.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts +111 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js +107 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-pending-authorization.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts +54 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js +153 -0
- package/dist/esm/security/connected-accounts/services/provider-oauth2-refresher.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts +195 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js +387 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credential-store.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts +45 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js +291 -0
- package/dist/esm/security/connected-accounts/services/user-provider-credentials.custom-impl.backend.service.js.map +1 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts +62 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js +29 -0
- package/dist/esm/security/connected-accounts/user-provider-credential-resolver.port.js.map +1 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts +127 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js +277 -0
- package/dist/esm/security/connected-accounts/utils/provider-credential-envelope.backend.utils.js.map +1 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts +66 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js +75 -0
- package/dist/esm/security/connected-accounts/utils/stored-credential-value.backend.utils.js.map +1 -0
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +21 -3
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js +26 -16
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
- package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts +9 -4
- package/dist/esm/security/credential-rotation-grace.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/credential-rotation-grace.backend.utils.js +9 -4
- package/dist/esm/security/credential-rotation-grace.backend.utils.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts +26 -0
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js +43 -0
- package/dist/esm/security/oauth-clients/oauth-client-generation.backend.utils.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts +8 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js +49 -0
- package/dist/esm/security/oauth-clients/oauth-clients.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/security/scim/controllers/scim.backend.controller.d.ts.map +1 -1
- package/dist/esm/security/scim/controllers/scim.backend.controller.js +17 -5
- package/dist/esm/security/scim/controllers/scim.backend.controller.js.map +1 -1
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts +67 -29
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js +47 -25
- package/dist/esm/security/scim/models/scim-protocol.backend.schemas.js.map +1 -1
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts +10 -2
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.d.ts.map +1 -1
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js +10 -2
- package/dist/esm/security/ssrf/outbound-target-guard.backend.utils.js.map +1 -1
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts +143 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js +258 -0
- package/dist/esm/security/ssrf/pinned-outbound-fetch.backend.utils.js.map +1 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts +39 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js +159 -0
- package/dist/esm/users/services/user-read-retained.custom-impl.backend.service.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +11 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgresql-resource-repository.backend.service.js","sourceRoot":"","sources":["../../../../../../src/base-classes/services/repositories/postgresql-resource-repository.backend.service.ts"],"names":[],"mappings":"AAMA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EAET,kBAAkB,EAClB,iCAAiC,EACjC,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,GAGnC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,8CAA8C,EAAE,MAAM,uFAAuF,CAAC;AACvJ,OAAO,EAAE,4CAA4C,EAAE,MAAM,sFAAsF,CAAC;AACpJ,OAAO,EAAE,+BAA+B,EAAE,MAAM,wEAAwE,CAAC;AACzH,OAAO,EACL,wBAAwB,EACxB,qCAAqC,GACtC,MAAM,8EAA8E,CAAC;AACtF,OAAO,EAAE,2CAA2C,EAAE,MAAM,oFAAoF,CAAC;AACjJ,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,sBAAsB,EAAmC,MAAM,wFAAwF,CAAC;AACzN,OAAO,EACL,uCAAuC,EACvC,0CAA0C,EAC1C,6CAA6C,EAC7C,8CAA8C,EAC9C,+CAA+C,GAChD,MAAM,4FAA4F,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8EAA8E,CAAC;AACnH,OAAO,EAAE,sCAAsC,EAAE,MAAM,oGAAoG,CAAC;AAC5J,OAAO,EACL,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,2EAA2E,CAAC;AACnF,OAAO,EACL,gCAAgC,GAEjC,MAAM,8EAA8E,CAAC;AAEtF,OAAO,EAAE,yBAAyB,EAAE,MAAM,4DAA4D,CAAC;AAGvG,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAc7D,OAAO,EAAE,8BAA8B,EAAE,MAAM,yEAAyE,CAAC;AAGzH,OAAO,EAAE,GAAG,EAAE,MAAM,Q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AI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB;gBAAE,GAAG,CAAC,mBAAmB,GAAG,MAAM,CAAC;QAChI,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["import type {\n ResourceConfiguration,\n ResourceConfiguration_Operation,\n ResourceConfiguration_OperationRepositoryPath,\n ResourceType,\n} from '@wildo-ai/saas-models';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ErrorCustomMessageReference,\n ErrorType,\n type WildoError_Backend,\n PersistenceAdapter,\n PRIMARY_SCOPE_TO_FIELD_IDENTIFIER,\n ResourceOperationsUtils,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n Resources_PaginationRequest,\n Resources_PaginatedResult,\n} from '@wildo-ai/saas-models';\nimport { assignInitiatorOrganizationConfinementToFilter } from '~wildo-backend-lib/security/authorizations/initiator-organization-confinement.backend';\nimport { assignScopeRootCollectionConfinementToFilter } from '~wildo-backend-lib/security/authorizations/scope-root-collection-confinement.backend';\nimport { assignRetentionHideForOperation } from '~wildo-backend-lib/compliance/privacy/retention-hide-predicate.backend';\nimport {\n applyJunctionScopeFilter,\n collectJunctionScopedFieldIdentifiers,\n} from '~wildo-backend-lib/security/authorizations/junction-scope-resolution.backend';\nimport { assignRelationshipForeignKeyFiltersToFilter } from '~wildo-backend-lib/security/authorizations/relationship-foreign-key-filter.backend';\nimport { assertCreateWriteIntegrity, assertUpdateWriteIntegrity, referenceConstraintsOf, type ResourceWriteIntegrityDeps } from '~wildo-backend-lib/base-classes/services/repositories/resource-write-integrity.backend';\nimport {\n assignOrganizationUnitNarrowingToFilter,\n isOrganizationUnitNarrowingExemptExecution,\n OrganizationUnitNarrowingWriteViolationReason,\n resolveOrganizationUnitNarrowingWriteViolation,\n resolveSuppliedOrganizationUnitIdForTenantCheck,\n} from '~wildo-backend-lib/security/authorizations/organization-unit-narrowing-enforcement.backend';\nimport { describeCaughtError } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { resolveDeclaredUniqueConflictReference } from '~wildo-backend-lib/base-classes/services/repositories/unique-constraint-conflict-reference.backend';\nimport {\n buildBusinessKeyFilter,\n BUSINESS_KEY_ERROR_PREFIX,\n} from '~wildo-backend-lib/data-seeding/models/business-key-resolver.shared.utils';\nimport {\n DATA_SEED_ROW_METADATA_FIELD_KEY,\n type DataSeedRowMetadata,\n} from '~wildo-backend-lib/data-seeding/models/data-seed-row-metadata.shared.schemas';\nimport type { ResourceFilter } from '~wildo-backend-lib/databases/models/filter.backend.schemas';\nimport { normalizeDateRangeFilters } from '~wildo-backend-lib/databases/models/filter.backend.schemas';\nimport type { TransactionContext } from '~wildo-backend-lib/databases/models/transaction.shared.schemas';\nimport type { EnumLikeType } from '@wildo-ai/zod-decorators';\nimport { z } from 'zod';\nimport { getZodObjectShape } from '@wildo-ai/zod-decorators';\n\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport type {\n IdOrFilterType,\n IdOrIdsOrFilterType,\n IdsOrFilterType,\n RepositoryOptions,\n} from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport type { SqlWhereExpression } from '~wildo-backend-lib/databases/models/sql.backend.schemas';\nimport type { PostgreSQLDatabaseBackendService } from '~wildo-backend-lib/databases/services/postgresql-database.backend.service';\nimport { PostgreSQLFilterBackendService } from '~wildo-backend-lib/databases/services/postgresql-filter.backend.service';\nimport { ZodToSqlHybridSchemaPlannerBackendService } from '~wildo-backend-lib/databases/services/zod-to-sql-hybrid-schema.planner';\nimport type { ResourceIdBackendService } from '~wildo-backend-lib/resources/services/resource-id.backend.service';\nimport { sql } from 'kysely';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { normalizeRepositoryVersionMetadata } from '~wildo-backend-lib/base-classes/services/repositories/repository-version-metadata.backend.utils';\n\n// Forward declaration to avoid circular dependency (matches Mongo repository style)\ntype RepositoriesRegistryHandlerBackendService = any;\n\n/**\n * PostgreSQL Repository Skeleton (Hybrid JSONB + Kysely)\n *\n * NOTE:\n * - This is a scaffolding class to be completed in the next steps.\n * - It mirrors `RepositoryResourceBackendService` construction (per resourceType),\n * but targets PostgreSQL via Kysely.\n * - Migrations/DDL are owned by apps-manager.\n */\nimport type { BackendResourceRepository } from './repositories-registry-handler.backend.service';\nimport { isEngineReservedFieldName } from './field-clearing-partition.backend';\nimport type {\n ConditionalArrayReturnType,\n ConditionalNullableReturnType,\n ConditionalReturnType,\n MainSchemaArrayType,\n MainSchemaType,\n PartialMainSchemaType,\n} from '~wildo-backend-lib/base-classes/utils/backend-type-utils';\nimport {\n buildRetentionVisibleRowsSqlPredicate,\n isRetentionGovernedResource,\n withRetentionHideApplied,\n} from '~wildo-backend-lib/compliance/privacy/retention-hide-predicate.backend';\nimport {\n quotePostgresColumnOf,\n quotePostgresIdentifier,\n} from '~wildo-backend-lib/databases/utils/postgresql-identifier.backend.utils';\nimport {\n guardedMutationHasWork,\n RepositoryArrayAdditionPlacement,\n type RepositoryArrayAddition,\n type RepositoryGuardedMutation,\n} from './repository-guarded-mutation.backend.types';\n\n/**\n * The empty jsonb container a mutation falls back to when the column (or an ancestor inside it) is\n * absent. Two of them because the fallback carries a TYPE: coalescing an array path to `'{}'` would\n * make the very next `||` concatenate onto an object and fail the statement.\n */\nconst OBJECT_JSONB_LITERAL = sql`'{}'::jsonb`;\nconst ARRAY_JSONB_LITERAL = sql`'[]'::jsonb`;\n\n/**\n * A stable, order-insensitive key for a SET of column names.\n *\n * ONE function because the two sides of the comparison — the plan's declared composite constraints\n * and a caller's `ON CONFLICT` target — must key identically, and the first version of this did not:\n * one side joined on a separator, the other on a space, so the lookup could never hit and every\n * multi-column upsert was refused with a message claiming a constraint was missing when it was\n * present. That is the same \"one fact expressed twice\" shape the retention authority exists to stop,\n * so it gets the same treatment rather than a matching pair of `.join()` calls.\n *\n * `JSON.stringify` over the sorted names, deliberately: it cannot be confused by an identifier that\n * itself contains the separator (a quoted PostgreSQL identifier may legally contain a space or a\n * comma), and unlike a control-character separator it survives every tool that touches this file.\n */\nfunction uniqueColumnSetKey(columns: readonly string[]): string {\n return JSON.stringify([...columns].sort());\n}\n\n\n/**\n * The id of a deleted row, from whatever `_doDelete` answered.\n *\n * ONE function because there are TWO doors into the same delete — the typed `delete()` wrapper and\n * the `doOperation` dispatch — and for as long as only one of them unwrapped, the shape a caller got\n * depended on which door it came through. That is the adapter/door-conditional guarantee this file\n * has now been bitten by twice; keeping the unwrap in a single place is what stops a third.\n *\n * `_id` first, `id` second: PostgreSQL tables carry the framework's `_id`, and the `id` fallback is\n * kept for a row shape that predates it. `''` for \"nothing matched\" is the contract both adapters\n * already answer, and it is what lets the service distinguish a no-op delete from a successful one.\n */\nexport function extractDeletedRowId(deletedRow: unknown): string {\n if (!deletedRow || typeof deletedRow !== 'object') return '';\n const row = deletedRow as { _id?: unknown; id?: unknown };\n const identity = row._id ?? row.id;\n return typeof identity === 'string' && identity.length > 0 ? identity : '';\n}\n\nexport class PostgreSQLResourceRepositoryBackendService<\n TCustomOperationEnum extends EnumLikeType | undefined = undefined,\n TCoreOperationEnum extends Partial<CoreResourceOperation> | undefined = undefined,\n TMainSchema extends z.ZodTypeAny = z.ZodTypeAny\n> implements BackendResourceRepository<TCustomOperationEnum, TCoreOperationEnum, TMainSchema> {\n private readonly resourceConfiguration: ResourceConfiguration<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>;\n private readonly filterService: PostgreSQLFilterBackendService;\n private readonly jsonbRoots: Set<string>;\n private readonly tableName: string;\n private readonly operationsMap: Map<string, ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>>;\n private readonly plannedFieldNames: Set<string>;\n /**\n * Planned columns carrying a UNIQUE constraint — the only legal `ON CONFLICT` targets.\n *\n * A singleton ledger's scope FK is unique because its relationship is 1:1, which the planner\n * records. Reading it here is what lets `upsertByFilter` verify that the caller's filter names a\n * real constraint rather than emitting SQL PostgreSQL will reject at runtime.\n */\n private readonly uniqueFieldNames: Set<string>;\n /** Sorted column-set keys of the plan's COMPOSITE unique constraints — see the constructor. */\n private readonly uniqueConstraintKeys: Set<string>;\n /** Whether the plan scopes this table's unique indexes to non-retained rows. */\n private readonly retentionScopedUniqueIndexes: boolean;\n /**\n * The AUTHORED name of a surrogate primary key, or `null`.\n *\n * A resource may declare its own primary key (FILES declares `fileId`) which the framework\n * persists as `_id`. MongoDB reconciles the two with a virtual projection registered by the\n * zod→mongoose convertor; this adapter has no virtuals, so the translation is explicit and\n * lives at the two chokepoints every statement already passes through.\n */\n private readonly surrogatePrimaryKeyFieldName: string | null;\n\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n resourceType: ResourceType,\n private readonly dbService: PostgreSQLDatabaseBackendService,\n private readonly logger: LoggerService,\n private readonly errorBuilder: ErrorBuilderBackendService,\n private readonly resourceRegistry: ResourcesRegistryBackendService,\n private readonly resourceOperationHelper: ResourceOperationHelperBackendService,\n private readonly repositoriesRegistry: RepositoriesRegistryHandlerBackendService,\n private readonly sqlPlanner: ZodToSqlHybridSchemaPlannerBackendService,\n private readonly resourceIdService?: ResourceIdBackendService\n ) {\n this.resourceConfiguration = this.resourceRegistry.getResourceConfiguration(resourceType);\n this.logDebug = this.logger.debugByType(`PostgreSQLRepositoryResource_${resourceType}`);\n this.logger.setDebugTypeLogging(`PostgreSQLRepositoryResource_${resourceType}`, false);\n\n // Configure JSONB roots for dot-notation support:\n // - always include variantConfig for hybrid inheritance\n // - include any object/array fields planned as JSONB\n const planned = this.sqlPlanner.planSqlHybridTable(\n this.resourceConfiguration as any,\n this.resourceConfiguration.mainSchema as any\n );\n this.jsonbRoots = new Set<string>(\n planned.fields.filter((f) => f.storage === 'jsonb').map((f) => f.name)\n );\n this.jsonbRoots.add('variantConfig');\n this.plannedFieldNames = new Set<string>(planned.fields.map((f) => f.name));\n this.uniqueFieldNames = new Set<string>(\n planned.fields.filter((f) => f.isUnique || f.isPrimaryKey).map((f) => f.name),\n );\n /**\n * Composite unique constraints, as SORTED column-set keys.\n *\n * `ON CONFLICT (a, b)` needs a unique index on that exact SET — two individually-unique columns\n * do not make one — so a multi-column conflict target is validated against these rather than\n * against `uniqueFieldNames`.\n */\n this.uniqueConstraintKeys = new Set<string>(\n (planned.uniqueConstraints ?? []).map((constraint) => uniqueColumnSetKey(constraint.fields)),\n );\n /**\n * Whether every unique index on this table is scoped to non-retained rows.\n *\n * Taken from the PLAN because that is what `postgresql-schema-ddl` keys the index predicate off,\n * so a statement inferring a partial index and the index itself are one decision. It also stays\n * correct for a shared table: a `USER_SELF*` repository issues against its twin's table, planned\n * from the twin's configuration.\n */\n this.retentionScopedUniqueIndexes = planned.uniquenessExcludesErasureRetainedRows === true;\n\n this.filterService = new PostgreSQLFilterBackendService(this.logger, this.errorBuilder);\n this.filterService.setJsonbFields(this.jsonbRoots);\n\n // Alias-aware: a `USER_SELF*` resource is a different DOOR onto its non-SELF counterpart's rows,\n // so it must issue its statements against the SHARED table (the Mongo model builder resolves the\n // same way). Deriving from `resourceIdentifier` alone pointed the self door at a disjoint table.\n this.tableName = PostgreSQLFilterBackendService.resolveTableNameForResource(String(this.resourceConfiguration.resourceIdentifier));\n\n /**\n * Read from the PLAN, not re-derived and not asked of the operation helper.\n *\n * The planner has already made this determination — it is what makes it emit the column as\n * `_id` — so taking the answer from `planned` keeps one authority. Asking the helper here\n * instead added a CONSTRUCTOR-time dependency, and a constructor-time dependency has a blast\n * radius nothing local reveals: every fixture that stubs the helper stopped being able to build\n * a PostgreSQL repository AT ALL, in suites with no connection to surrogate keys. Fifty-two of\n * them, found only by the full suite.\n */\n this.surrogatePrimaryKeyFieldName = planned.surrogatePrimaryKeyFieldName ?? null;\n\n this.operationsMap = new Map();\n this.initializeOperationsMap();\n\n this.logDebug('PostgreSQL repository skeleton created', {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n tableName: this.tableName,\n jsonbRoots: Array.from(this.jsonbRoots),\n });\n }\n\n /**\n * Extract native SQL transaction client from RepositoryOptions (if any).\n * Includes a runtime safety check similar to Mongo repository.\n */\n protected getTransaction(options?: RepositoryOptions): TransactionContext | undefined {\n if (!options?.transaction) return undefined;\n if (options.transaction.databaseType !== PersistenceAdapter.POSTGRESQL) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n context: {\n // diagnostic (log-only): wrong persistence adapter wired for this resource (framework config bug).\n expectedDatabaseType: PersistenceAdapter.POSTGRESQL,\n receivedDatabaseType: options.transaction.databaseType,\n },\n });\n }\n return options.transaction;\n }\n\n /**\n * Canonical persistence-to-domain transform for every PostgreSQL row.\n *\n * `_version_db_doc` is an adapter-internal storage name. Mongo already maps\n * it to the public repository metadata field `_version`; PostgreSQL must\n * expose the exact same contract or consumers (optimistic locking, token\n * authorization fencing, mutation state) become adapter-dependent.\n *\n * Keep this normalization after the hybrid SQL transform so inheritance and\n * JSONB reconstruction still see the physical row shape. Return a fresh\n * object to avoid mutating Kysely/planner-owned values.\n */\n private transformPersistenceRow<T>(\n row: unknown,\n inheritanceDefinition: unknown,\n ): T {\n const transformed = this.sqlPlanner.transformFromSqlRead(\n row as any,\n inheritanceDefinition as any,\n this.declaredBaseFieldNames(),\n ) as unknown;\n return normalizeRepositoryVersionMetadata(\n this.projectSurrogatePrimaryKey(this.omitUnsetColumns(transformed)),\n ) as T;\n }\n\n /**\n * Present an UNSET column the way MongoDB presents an unset field: ABSENT.\n *\n * ## Why this is a translation, not a convenience\n *\n * SQL has no \"absent\" — a row has every column, and a value that was never written is NULL. On\n * MongoDB the same row simply has no such key. So the identical logical state arrives at the DTO\n * as `null` on one adapter and `undefined` on the other, and Zod treats those as different: a\n * `z.enum([...]).optional()` accepts absent and REJECTS null.\n *\n * That is not a corner case. It fires for EVERY optional field that is not explicitly `.nullish()`,\n * on every read, so a service-tier operation against PostgreSQL failed with\n * `service_resource_transformation_failed` naming the resource and nothing else. It was invisible\n * until one lane ran on both adapters — no PostgreSQL lane had ever gone through the service tier,\n * and the repository-tier lanes read rows with raw SQL, which never meets the DTO.\n *\n * ## Why dropping is the FAITHFUL choice, including for `.nullish()` fields\n *\n * This repository already decided the same thing for the write side: a `clear` compiles to\n * `SET col = NULL` precisely because \"a SQL column cannot be removed from a row at all, so absent\n * and NULL are the same state on this adapter by construction\". Reading it back as absent is that\n * decision applied consistently. A `.nullish()` field parses either way, so nothing that could\n * legitimately distinguish them loses information — and on MongoDB `$unset` collapses the same\n * pair anyway.\n *\n * `_id` and the surrogate key are left alone: they are never legitimately absent, and dropping one\n * would turn a corrupt row into a silently id-less object rather than a loud failure.\n */\n private omitUnsetColumns(row: unknown): unknown {\n if (!row || typeof row !== 'object' || Array.isArray(row)) return row;\n const record = row as Record<string, unknown>;\n const isDroppable = (field: string, value: unknown): boolean =>\n value === null && field !== '_id' && field !== this.surrogatePrimaryKeyFieldName;\n\n // Return the SAME OBJECT when nothing is dropped. Not an optimisation: callers (and one existing\n // pin) rely on the read path handing back the row it was given, and allocating a copy on every\n // read would change that contract for the majority of rows that have no unset column at all.\n if (!Object.entries(record).some(([field, value]) => isDroppable(field, value))) return row;\n\n const projected: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(record)) {\n if (isDroppable(field, value)) continue;\n projected[field] = value;\n }\n return projected;\n }\n\n /**\n * Surface a SURROGATE primary key on a row read back from SQL.\n *\n * The physical column is `_id`; the authored name (`fileId`) is what every caller, DTO and\n * schema refers to. MongoDB supplies it as a virtual, so a caller reading a FILES row gets both\n * — and code written against that contract (`createdFile.fileId`) simply returned `undefined`\n * here, silently, with no error anywhere. `_id` is KEPT alongside it, matching the Mongo shape\n * rather than choosing between the two.\n *\n * This is the READ half of one invariant. Its WRITE half is {@link foldSurrogatePrimaryKey}; the\n * FILTER half is `resolveQueryableFilterPath` (divergence D2); the MIGRATION half is the SQL\n * planner emitting the column as `_id`. All four are the same rule, and the first three were\n * each found only after the one before it was fixed.\n */\n private projectSurrogatePrimaryKey(row: unknown): unknown {\n if (!this.surrogatePrimaryKeyFieldName || !row || typeof row !== 'object') return row;\n const record = row as Record<string, unknown>;\n if (record._id === undefined || record[this.surrogatePrimaryKeyFieldName] !== undefined) return row;\n return { ...record, [this.surrogatePrimaryKeyFieldName]: record._id };\n }\n\n /**\n * Fold an authored SURROGATE primary key back onto the physical `_id` column before writing.\n *\n * Without this a payload carrying `fileId` targets a column that does not exist, which SQL\n * reports as an unknown-column error rather than anything naming the surrogate. The WRITE half\n * of the invariant documented on {@link projectSurrogatePrimaryKey}.\n */\n /**\n * THE write chokepoint: fold the surrogate primary key, then apply the SQL write transform.\n *\n * Every statement that writes app-layer data goes through here, because applying the fold at\n * each call site is the shape that keeps failing. A review of the first attempt found it applied\n * at ONE of NINE sites (`_doCreate`), leaving bulk create, both upsert branches, seed metadata,\n * both update paths and the two guarded primitives untranslated — an authored `fileId` in any of\n * those payloads targets a column that does not exist.\n *\n * See `.claude/rules/invariant-call-site-enumeration.md`: the answer it prescribes is to make the\n * invariant unbypassable rather than to apply it N times.\n *\n * **The fold itself is DEFENSIVE and currently unpinned** — stated because a mutation that kills\n * nothing is not evidence. Neutering it here reddens no test: the CREATE/UPDATE DTOs strip a\n * primary key from authored payloads (correctly — the surrogate is a virtual on MongoDB too), so\n * no operation-lifecycle caller can carry one. It remains because the INTERNAL primitives bypass\n * that validation — `updateSeedMetadata`, the `businessKeyShape` merged into an upsert insert, and\n * the caller-built `setFields` of both guarded writes — and there a stray surrogate would target a\n * column that does not exist. Pinning it needs a caller that legitimately writes one; none exists\n * today.\n */\n private toSqlWriteRow<T extends Record<string, any>>(data: T, inheritanceDefinition: unknown): unknown {\n return this.serializeJsonbColumns(\n this.sqlPlanner.transformForSqlWrite(\n this.foldSurrogatePrimaryKey(data),\n inheritanceDefinition as any,\n this.declaredBaseFieldNames(),\n ),\n );\n }\n\n /**\n * Render every JSONB-backed column's value as JSON TEXT, so PostgreSQL parses it as `jsonb`.\n *\n * ## Why this is required rather than defensive\n *\n * `pg` decides a parameter's wire form from the JAVASCRIPT value, knowing nothing about the target\n * column. Its `prepareValue` (`pg/lib/utils.js`) makes three different decisions for values this\n * repository routinely writes into one `jsonb` column:\n *\n * | app-layer value | what `pg` sends | result in a `jsonb` column |\n * |---|---|---|\n * | plain object | `JSON.stringify(val)` | parses — **by accident**, not by design |\n * | `['APP_USER']` | `{\"APP_USER\"}` — a POSTGRES ARRAY literal | `22P02 invalid input syntax for type json` |\n * | `[]` | `{}` | parses, as an **OBJECT** — silently persists `{}` where `[]` was written |\n * | `Date` | `2026-08-19 07:37:46+00` | `22P02` |\n *\n * So the previous behaviour was not \"arrays are broken\": it was that objects happened to work, empty\n * arrays SILENTLY CHANGED TYPE, and non-empty arrays failed loudly. Which of the three a field got\n * depended on its runtime value, not on anything declared.\n *\n * Measured on 2026-08-19: `wildo local dev` could not initialize an application on PostgreSQL because\n * the platform user's `appRoles` — declared `z.array(AppRolesSchema)` in `users.shared.schemas.ts`\n * and correctly planned `storage: 'jsonb'` — reached `INSERT` as `{\"APP_USER\"}`. The declaration, the\n * planner and the DDL were all right; nothing turned the value into JSON.\n *\n * ## Why the PLAN is the authority, and not `Array.isArray`\n *\n * Membership is decided by {@link jsonbRoots} — the planner's `storage === 'jsonb'` classification —\n * because that is the same fact the DDL renders the column from. Sniffing the JS type instead would\n * ask a different question than the one the column was created from, and would get both edges wrong:\n * a `z.unknown()` field (planned `json`) holding the string `'hello'` must persist as the jsonb\n * string `\"hello\"`, and a value that merely LOOKS like an array must not be re-typed by a heuristic.\n *\n * ## Two deliberate exclusions\n *\n * `null`/`undefined` are left alone, so a null lands as SQL `NULL` rather than as the jsonb scalar\n * `'null'`. The distinction is observable — `IS NULL` matches the first and not the second — and SQL\n * `NULL` is what MongoDB's absent/null field means, so this is adapter parity, not convenience.\n *\n * A Kysely expression is skipped. `plainSets` cannot contain one today (every SQL expression is\n * routed through `columnAssignments`, which builds its own `::jsonb` cast), so this branch is\n * DEFENSIVE and unpinned — stated plainly because a guard no test can kill is not evidence. It earns\n * its place because the failure mode is silent rather than loud: `JSON.stringify` of a `RawBuilder`\n * yields a plausible-looking object literal that would be persisted instead of executed, and the\n * caller-built rows reaching `insertRawDocument` / `updateSeedMetadata` are outside DTO validation.\n *\n * Applied HERE because {@link toSqlWriteRow} is the single write chokepoint all twelve statements in\n * this class pass through — see `.claude/rules/invariant-call-site-enumeration.md`, whose prescribed\n * answer is to make the invariant unbypassable rather than to apply it at N sites.\n */\n private serializeJsonbColumns<T>(row: T): T {\n if (!row || typeof row !== 'object') return row;\n\n const source = row as Record<string, unknown>;\n let output: Record<string, unknown> | undefined;\n\n for (const column of this.jsonbRoots) {\n if (!(column in source)) continue;\n const value = source[column];\n if (value === null || value === undefined) continue;\n if (\n typeof value === 'object'\n && typeof (value as { toOperationNode?: unknown }).toOperationNode === 'function'\n ) continue;\n\n // Copy lazily: a row with no jsonb column — the common case — is returned untouched.\n output ??= { ...source };\n output[column] = JSON.stringify(value);\n }\n\n return (output ?? source) as T;\n }\n\n /**\n * The resource's DECLARED base fields, for the hybrid variant split.\n *\n * The planner otherwise INFERS the base as the intersection of the variant schemas, which is wrong\n * for a family with exactly one extending variant — the intersection is then that variant's own key\n * set, so nothing is treated as variant-specific and `variantConfig` is neither filled on write nor\n * hoisted on read. Measured on `CONSUMABLE_TOKENS`, whose `BOUNDED_REUSE` is the only extending\n * variant: `maxUses` round-tripped as ABSENT, and the token consumed on its first use instead of\n * its third. See `getBaseFieldNames`.\n *\n * `mainSchema` is the base for a family-backed resource (the factory takes `mainSchema` alongside\n * `inheritenceSchemaDefinition`). Anything that is not a plain object — a union-shaped main schema,\n * say — yields an empty set, which leaves the planner on its previous inference rather than\n * asserting a base it cannot read.\n */\n private declaredBaseFieldNames(): ReadonlySet<string> | undefined {\n const mainSchema = (this.resourceConfiguration as { mainSchema?: unknown })?.mainSchema;\n if (!(mainSchema instanceof z.ZodObject)) return undefined;\n return new Set(Object.keys(getZodObjectShape(mainSchema)));\n }\n\n /**\n * Mint the row identity when the payload does not carry one — the INSERT-only half.\n *\n * MongoDB needs no equivalent because mongoose mints `_id` in the driver on every insert.\n * PostgreSQL has no such hook, so an INSERT omitting `_id` is answered with\n * `null value in column \"_id\" … violates not-null constraint`.\n *\n * Identity is minted through `ResourceIdBackendService`, NOT delegated to a column default: the\n * format is a per-resource framework decision (ObjectId or UUID) that the same service already\n * enforces on read, and pushing it into DDL would split one rule across the migration and the\n * engine, where the two can disagree silently.\n */\n private withGeneratedRowIdentity<T extends Record<string, any>>(data: T): T {\n if (!this.resourceIdService || (data._id !== undefined && data._id !== null)) return data;\n return {\n ...data,\n _id: this.resourceIdService.generateForResource(String(this.resourceConfiguration.resourceIdentifier)),\n };\n }\n\n private foldSurrogatePrimaryKey<T extends Record<string, any>>(data: T): T {\n if (!this.surrogatePrimaryKeyFieldName) return data;\n const authored = data[this.surrogatePrimaryKeyFieldName];\n if (authored === undefined) return data;\n const { [this.surrogatePrimaryKeyFieldName]: _folded, ...rest } = data;\n return { ...rest, ...(data._id === undefined ? { _id: authored } : {}) } as T;\n }\n\n /**\n * Build a SQL where expression from a Mongo-style filter.\n */\n protected buildWhere(filter: ResourceFilter | null | undefined): SqlWhereExpression | null {\n return this.filterService.buildWhereExpression(filter);\n }\n\n // ===========================================================================\n // Operation routing (align with Mongo repository surface)\n // ===========================================================================\n\n public async doByPath<T = any, U = any>(\n operationRepositoryPath: ResourceConfiguration_OperationRepositoryPath,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter?: IdOrIdsOrFilterType,\n data?: U,\n options?: RepositoryOptions\n ): Promise<T> {\n const key = ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKey(operationRepositoryPath);\n return this.doByKey<T, U>(key, executionContext, id_or_ids_or_filter, data, options);\n }\n\n public async doByKey<T = any, U = any>(\n operationRepositoryPathKey: string,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter?: IdOrIdsOrFilterType,\n data?: U,\n options?: RepositoryOptions\n ): Promise<T> {\n ResourcesConfig_OperationPathUtils.validateOperationRepositoryPathKey(operationRepositoryPathKey);\n\n const operation = this.operationsMap.get(operationRepositoryPathKey);\n if (!operation) {\n // CONFIGURATION, not NOT_FOUND — the same structural fault as the Mongo arm, fixed with it\n // rather than after it. Both persistence adapters carry this lookup, which is the shape\n // `invariant-call-site-enumeration.md` records for a port: a fix applied to one side leaves\n // the other answering the old way.\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey },\n });\n }\n\n return (await this.doOperation(operation, executionContext, id_or_ids_or_filter, data, options)) as T;\n }\n\n public async doByExecutionContext<T = any>(\n executionContext: ExecutionContext<ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>>,\n data?: any,\n options?: RepositoryOptions\n ): Promise<T> {\n const operation = executionContext.operation;\n const id_or_ids_or_filter = this.resourceOperationHelper.extractIdsFromExecutionContext(\n executionContext,\n this.resourceConfiguration.resourceFieldIdentifier\n );\n return (await this.doOperation(operation, executionContext, id_or_ids_or_filter as any, data, options)) as T;\n }\n\n private async doOperation(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter?: IdOrIdsOrFilterType,\n data?: any,\n options?: RepositoryOptions\n ): Promise<any> {\n const operationRepositoryPathKey = ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKeyFromOperation(operation);\n\n if (operation.resourceIdentifier !== this.resourceConfiguration.resourceIdentifier) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, resourceIdentifier: this.resourceConfiguration.resourceIdentifier },\n });\n }\n\n const opIdentifier = ResourceOperationsUtils.getCoreResourceOperationFromOperation(operation);\n if (!opIdentifier) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey },\n });\n }\n\n switch (opIdentifier) {\n case CoreResourceOperation.CREATE:\n return this._doCreate(operation, executionContext, data, options);\n case CoreResourceOperation.CREATE_MANY:\n return this._doCreateMany(operation, executionContext, data, options);\n case CoreResourceOperation.READ:\n if (Array.isArray(id_or_ids_or_filter)) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, id_or_ids_or_filter },\n });\n }\n return this._doRead(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.UPDATE:\n if (Array.isArray(id_or_ids_or_filter)) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, id_or_ids_or_filter },\n });\n }\n return this._doUpdate(operation, executionContext, id_or_ids_or_filter as any, data, options);\n case CoreResourceOperation.UPDATE_MANY:\n return this._doUpdateMany(operation, executionContext, id_or_ids_or_filter as IdsOrFilterType, data, options);\n case CoreResourceOperation.DELETE:\n if (Array.isArray(id_or_ids_or_filter)) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, id_or_ids_or_filter },\n });\n }\n /*\n * UNWRAPPED, exactly as the `delete()` wrapper does.\n *\n * `_doDelete` uses `.returningAll()` and answers the whole deleted ROW, while the DELETE\n * contract — `Promise<string>` on both adapters — is the id. `delete()` unwrapped it and this\n * dispatch did not, so which shape a caller got depended on WHICH DOOR it came through. The\n * service layer comes through here, so every single DELETE on a PostgreSQL-backed resource\n * returned a row; `composeDefaultOperationResponse` then built `{ id: <row> }`, the DELETE DTO\n * refused it, and the request answered 500 AFTER the row was already gone.\n *\n * MongoDB's `_doDelete` returns the id directly, so its dispatch was correct and this was\n * adapter-conditional — the failure shape this file's own `_doDelete` comment calls \"worse than\n * no guarantee\". Both doors now go through one function so they cannot drift apart again.\n */\n return extractDeletedRowId(\n await this._doDelete(operation, executionContext, id_or_ids_or_filter as any, options),\n );\n case CoreResourceOperation.DELETE_MANY:\n return this._doDeleteMany(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.LIST:\n return this._doList(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.COUNT:\n return this._doCount(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.SEARCH:\n return this._doSearch(operation, executionContext, data?.query || '', {}, options as any);\n default:\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { resourceIdentifier: this.resourceConfiguration.resourceIdentifier, opIdentifier },\n });\n }\n }\n\n /**\n * Build the repository dispatch map.\n *\n * **A key collision here is NORMAL and is not reported as an anomaly.** The REPOSITORY path key is\n * deliberately coarser than the operation path key: it is\n * `resource | operation | operationRef | isBulk`, while the full operation key is\n * `resource | operation | variantType | (isDefault|variantKey) | isBulk`. Dropping the variant is\n * the point — several API-level variants (an admin read, a self read, an organization-scoped read)\n * describe ONE repository behaviour, so they are meant to converge on one entry.\n *\n * This used to `logger.warn` on every collision. The MongoDB base class\n * (`repository-resource.backend.service.ts`) performs the IDENTICAL last-wins `set()` with the\n * same key function and says nothing, so the warning was never reporting an adapter difference —\n * only a logging one. It became visible the moment a platform first ran on PostgreSQL and emitted\n * **16,665 WARN lines in a single boot**, which buried the three-line `REQUIRED_ADAPTER_MISMATCH`\n * that was the actual failure. A diagnostic that hides the defect it sits next to is worse than no\n * diagnostic.\n *\n * Demoted rather than deleted: the collapse is still worth being able to SEE when chasing a\n * dispatch problem, and `logDebug` is where the base class puts the same information.\n */\n private initializeOperationsMap(): void {\n const ops = this.resourceConfiguration.operations || [];\n for (const operation of ops) {\n const key = ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKeyFromOperation(operation);\n if (this.operationsMap.has(key)) {\n this.logDebug(`Repository operation key '${key}' for resource '${String(this.resourceConfiguration.resourceIdentifier)}' is served by more than one operation variant. Last operation wins (by design — the repository key drops variant).`);\n }\n this.operationsMap.set(key, operation);\n }\n }\n\n // The method surface should mirror the Mongo repository public API so the\n // service layer can remain database-agnostic.\n //\n // Implementation will:\n // - Use this.dbService.getDb() to get a Kysely instance\n // - Apply SqlWhereExpression compilation to Kysely query builder\n // - Apply hybrid transforms via sqlPlanner.transformForSqlWrite/transformFromSqlRead\n // - Respect RepositoryOptions.transaction (nativeSession contains transaction client)\n\n // NOTE: These signatures are intentionally aligned with the resource-system expectations\n // but kept minimal for initial PostgreSQL adapter bring-up.\n\n public async create<T = undefined>(\n executionContext: ExecutionContext<any>,\n data: MainSchemaType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.CREATE && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.CREATE },\n });\n }\n return this._doCreate(operation as any, executionContext, data, options);\n }\n\n public async createMany<T = undefined>(\n executionContext: ExecutionContext<any>,\n data: MainSchemaArrayType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.CREATE_MANY && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.CREATE_MANY },\n });\n }\n // The private `_do*` layer is untyped against the schema; the cast is the ONE\n // place that adaptation happens, so the public surface can stay schema-derived.\n return this._doCreateMany(operation as any, executionContext, data, options) as Promise<\n ConditionalArrayReturnType<T, TMainSchema>\n >;\n }\n\n public async read<T = undefined>(\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n options?: RepositoryOptions\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.READ && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.READ },\n });\n }\n return this._doRead(operation as any, executionContext, id_or_filter, options);\n }\n\n /**\n * Adapter-parity counterpart of Mongo `readForInternalScan`. Framework\n * maintenance/reconciliation callers use one canonical persisted-truth read\n * contract regardless of the selected resource adapter.\n */\n public async readForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n options?: RepositoryOptions,\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const syntheticReadOperation = {\n operationIdentifier: CoreResourceOperation.READ,\n variantType: ResourceOperationVariantType.REPOSITORY_ONLY,\n isOperationDefault: true,\n } as unknown as ResourceConfiguration_Operation<\n TCustomOperationEnum,\n TCoreOperationEnum,\n TMainSchema\n >;\n return this._doRead(\n syntheticReadOperation,\n executionContext,\n id_or_filter,\n options,\n );\n }\n\n public async update<T = undefined>(\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n data: PartialMainSchemaType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.UPDATE && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.UPDATE },\n });\n }\n return this._doUpdate(operation as any, executionContext, id_or_filter, data, options);\n }\n\n public async updateMany<T = undefined>(\n executionContext: ExecutionContext<any>,\n data: PartialMainSchemaType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.UPDATE_MANY && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.UPDATE_MANY },\n });\n }\n return this._doUpdateMany(operation as any, executionContext, undefined, data, options) as Promise<\n ConditionalArrayReturnType<T, TMainSchema>\n >;\n }\n\n public async delete(\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter: IdOrIdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<string> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.DELETE && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.DELETE },\n });\n }\n const deleted = await this._doDelete(operation as any, executionContext, id_or_ids_or_filter, options);\n return extractDeletedRowId(deleted);\n }\n\n public async deleteMany(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<string[]> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.DELETE_MANY && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.DELETE_MANY },\n });\n }\n return this._doDeleteMany(operation as any, executionContext, ids_or_filter, options);\n }\n\n public async list<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>>;\n public async list<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options: RepositoryOptions & { paginated: true; listOptions?: Partial<Resources_PaginationRequest> }\n ): Promise<Resources_PaginatedResult<ConditionalReturnType<T, TMainSchema>>>;\n public async list<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions & { listOptions?: Partial<Resources_PaginationRequest>; paginated?: boolean }\n ): Promise<any[] | Resources_PaginatedResult<any>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.LIST && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.LIST },\n });\n }\n return this._doList(operation as any, executionContext, ids_or_filter, options);\n }\n\n public async search<T = any>(\n executionContext: ExecutionContext<any>,\n searchQuery: string,\n filter: any = {},\n searchOptions: any = {},\n options?: RepositoryOptions\n ): Promise<Resources_PaginatedResult<T>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.SEARCH && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.SEARCH },\n });\n }\n return this._doSearch(operation as any, executionContext, searchQuery, filter, { ...options, searchOptions } as any);\n }\n\n public async count(\n executionContext: ExecutionContext<any>,\n filter: any = {},\n options?: RepositoryOptions\n ): Promise<{ count: number }> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.COUNT && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.COUNT },\n });\n }\n return this._doCount(operation as any, executionContext, filter, options);\n }\n\n public supportsOperation(operationIdentifier: string): boolean {\n return this.resourceConfiguration.operations.some(\n (op) => op.operationIdentifier === operationIdentifier && op.isOperationDefault === true\n );\n }\n\n // ===========================================================================\n // Business-Key Helpers (data-seeding) — mirror Mongo repository surface\n // ===========================================================================\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.findByBusinessKey`.\n * Same contract: derive a flat filter from the schema's declared business\n * key, layer in the contextual filter, run a single SELECT.\n *\n * Returns `null` when no row matches.\n */\n public async findByBusinessKey<T = undefined>(\n executionContext: ExecutionContext<any>,\n businessKeyShape: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const baseFilter = this._tryBuildBusinessKeyFilter(executionContext, businessKeyShape);\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter as any, CoreResourceOperation.READ, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const row = await qb.executeTakeFirst();\n if (!row) return null as ConditionalNullableReturnType<T, TMainSchema>;\n return this.transformPersistenceRow<ConditionalNullableReturnType<T, TMainSchema>>(row, inheritanceDef);\n }\n\n /**\n * ADAPTER-NEUTRAL atomic counter primitive (PostgreSQL arm) — see the MongoDB arm on\n * `RepositoryResourceBackendService.atomicIncrementField` for the contract. A shorthand over\n * {@link atomicGuardedMutation}, which is where the arithmetic and the missing-is-zero parity live.\n */\n public async atomicIncrementField<T = any>(\n filter: Record<string, unknown>,\n field: string,\n delta: number,\n setFields?: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n // `delta === 0` omits the increment, degrading the call to a GUARDED SET — the counter-reset\n // case (e.g. rolling a budget period), where the field must be overwritten rather than added to.\n // Mirrors the MongoDB arm, where the same omission also avoids an `$inc`/`$set` path conflict.\n return this.atomicGuardedMutation<T>(\n filter,\n { ...(delta === 0 ? {} : { increment: { [field]: delta } }), set: setFields },\n options,\n );\n }\n\n /**\n * SINGLE-ROW SEMANTICS + a REAL compare-and-set, matching the MongoDB arm's `findOneAndUpdate`.\n *\n * Shared by every adapter-neutral guarded-write primitive on this repository\n * ({@link atomicIncrementField}, {@link atomicConditionalSet}). The reasoning below is the\n * hard part of each of them, and it is the LAST thing that should exist in two copies — a\n * second primitive that re-derived it and got the recheck subtly wrong would look correct and\n * lose concurrent updates in exactly the case the guard exists for.\n *\n * Two predicates are applied, and BOTH are load-bearing:\n *\n * 1. `_id = (SELECT _id … LIMIT 1)` bounds the statement to at most ONE row. A bare\n * `UPDATE … WHERE <filter>` would touch EVERY match, so a filter that turned out to be\n * non-unique would apply the same write repeatedly and diverge from Mongo.\n * 2. The caller's ORIGINAL filter is ALSO applied to the UPDATE itself. This is the part that\n * makes it a compare-and-set. The sub-select is UNCORRELATED, so PostgreSQL evaluates it\n * once as a cached InitPlan; under READ COMMITTED the row-lock recheck (EvalPlanQual)\n * re-evaluates only the UPDATE's own predicate against the newly-committed row version. If\n * that predicate were `_id = <cached constant>` alone it would be trivially true, and a\n * concurrent writer that had just changed a guard column (e.g. rolled `periodKey`, or moved\n * a file out of `PENDING`) would be silently overwritten — the exact lost-update the guard\n * exists to prevent. Re-asserting the filter columns means the recheck fails and this\n * returns null, so the caller takes its fallback path exactly as it does on MongoDB.\n *\n * retention-gate: N/A — takes an ALREADY-COMPILED `where` rather than building one. Its only\n * caller is `atomicGuardedMutation`, whose filter the registry handler has already passed through\n * `applyRetentionHideToRawFilter`; re-applying the hide here would need the raw filter this method\n * deliberately no longer has.\n */\n private async executeGuardedSingleRowUpdate<T = any>(\n db: any,\n where: any,\n updates: Record<string, unknown>,\n inheritanceDef: unknown,\n ): Promise<T | null> {\n const targetIdSubquery = this.filterService\n .applyWhere(db.selectFrom(this.tableName).select('_id' as any), where)\n .limit(1);\n\n const updated = await this.filterService\n .applyWhere(\n db.updateTable(this.tableName).set(updates as any).where('_id' as any, '=', targetIdSubquery as any),\n where,\n )\n .returningAll()\n .executeTakeFirst();\n\n if (!updated) return null;\n return this.transformPersistenceRow<T>(updated, inheritanceDef);\n }\n\n /**\n * ADAPTER-NEUTRAL guarded set-and-clear (PostgreSQL arm) — see the MongoDB arm on\n * `RepositoryResourceBackendService.atomicConditionalSet` for the contract.\n *\n * `clearFields` compiles to `SET col = NULL`, which is the faithful counterpart of MongoDB's\n * `$unset` here rather than an approximation of it: the PostgreSQL filter service already\n * translates `{ $exists: false }` to `IS NULL` (and `{ $exists: true }` to `IS NOT NULL`), so a\n * cleared field is observationally identical through the one predicate that asks about\n * presence. A SQL column cannot be removed from a row at all, so \"absent\" and \"NULL\" are the\n * same state on this adapter by construction.\n */\n public async atomicConditionalSet<T = any>(\n filter: Record<string, unknown>,\n setFields: Record<string, unknown> | undefined,\n clearFields: readonly string[] | undefined,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n return this.atomicGuardedMutation<T>(filter, { set: setFields, clear: clearFields }, options);\n }\n\n /**\n * ADAPTER-NEUTRAL guarded mutation (PostgreSQL arm) — the ONE compiler both primitives above are\n * shorthands over. See `RepositoryGuardedMutation` for the vocabulary and the reasoning.\n *\n * ## The part that is genuinely PostgreSQL work: dotted paths\n *\n * MongoDB reads `engagement.activeDates` natively. Here the root is a `jsonb` COLUMN and the rest\n * is a path inside it, so every mutation on the same root must fold into ONE expression —\n * `SET col = …, col = …` is not \"last one wins\", it is a SQL error (\"multiple assignments to same\n * column\"). The accumulator below is that fold, and it is why this is one compiler rather than a\n * per-operator helper each caller composes.\n *\n * Two behaviours were MEASURED against PostgreSQL 16 rather than assumed, because both diverge\n * from the obvious reading of the documentation:\n *\n * - **`jsonb_set` cannot create intermediate levels**, `create_missing` notwithstanding:\n * `jsonb_set('{}', '{a,b}', '5', true)` returns `{}` UNCHANGED, where MongoDB's `$set` would\n * have created `{a:{b:5}}`. A silent no-op is the worst possible divergence for a counter, so\n * {@link buildJsonbPathAssignment} materialises every missing ancestor first.\n * - **A path through a MISSING array index is a no-op** (`jsonb_set('[{…}]', '{1,exitedAt}', …)`\n * leaves the array untouched) rather than an error or an append. That matches what the\n * lifecycle evaluator's `stageHistory.1` guard already requires, and is recorded here so the\n * next reader does not have to rediscover it.\n */\n /**\n * INSERT one already-built document, below the operation tier.\n *\n * The PostgreSQL arm of the MongoDB base class's `insertRawDocument`. The document is passed\n * through `toSqlWriteRow` — the same projection every other write here uses — because a caller on\n * this tier hands over a DOMAIN document, and the column mapping (JSONB packing, the framework\n * columns) is this adapter's business, not the caller's.\n *\n * Unique violations are translated to the CONFLICT contract, exactly as `_doCreate` does: a caller\n * that inserts a row carrying a declared unique key must receive the same conflict on either\n * adapter, or the classification is adapter-dependent again.\n *\n * retention-gate: N/A — INSERTs a brand-new row, so there is no existing row for a hide to\n * protect.\n */\n public async insertRawDocument<T = any>(document: Record<string, unknown>, options?: RepositoryOptions): Promise<T> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toWrite = this.toSqlWriteRow(document, inheritanceDef);\n\n let inserted: any;\n try {\n inserted = await db\n .insertInto(this.tableName)\n .values(toWrite as any)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error);\n }\n\n return this.transformPersistenceRow<T>(inserted, inheritanceDef);\n }\n\n /**\n * READ many rows matching an already-built filter, below the operation tier.\n *\n * The multi-row counterpart of `readUnscopedByKey`, and the PostgreSQL arm of the base class's\n * `findManyByRawFilter`.\n *\n * An EMPTY filter selects the whole table, deliberately — the same reasoning as `countByRawFilter`:\n * a read has no side effect, so the fail-closed rule that guards an unfiltered UPDATE would only\n * refuse a legitimate question here.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller on this tier.\n */\n public async findManyByRawFilter<T = any>(filter: Record<string, unknown>, options?: RepositoryOptions): Promise<T[]> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const where = this.buildWhere(filter as any);\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const rows = await qb.execute();\n return (rows ?? []).map((row: any) => this.transformPersistenceRow<T>(row, inheritanceDef));\n }\n\n /**\n * Count rows matching an ALREADY-BUILT filter, with no operation and no authorization.\n *\n * The PostgreSQL arm of the MongoDB base class's `countByRawFilter`. Before this existed, the\n * handler's infrastructure count reached `(repository as any).mongooseModel` and threw here, so\n * field-uniqueness validation was broken for every PostgreSQL-backed resource.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller\n * (`countDocumentsForInfrastructure`), matching the MongoDB arm. Applying it again here would put\n * the predicate in two places.\n *\n * An EMPTY filter counts the whole table, deliberately: unlike a guarded UPDATE — where an absent\n * predicate is a fail-closed error because it would rewrite every row — an unfiltered COUNT is a\n * legitimate question with no side effect.\n */\n public async countByRawFilter(filter: Record<string, unknown>, options?: RepositoryOptions): Promise<number> {\n const db = await this.getDbOrTrx(options);\n const where = this.buildWhere(filter as any);\n const qb = this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where,\n );\n const row = await qb.executeTakeFirst();\n // `count(*)` returns bigint, which the driver surfaces as a string — coerce so callers get the\n // number the signature promises rather than a string that compares wrong.\n return Number((row as { count?: unknown } | undefined)?.count ?? 0);\n }\n\n /**\n * @see BackendResourceRepository.readUnscopedByKey — the contract carries the reasoning.\n *\n * The mirror of the MongoDB arm: the caller's filter is the whole confinement (no\n * `buildContextualFilter`), and the retention hide is applied once at the registry dispatch point.\n *\n * `transformPersistenceRow` is NOT optional here even though nothing is projected away: it is what\n * re-hydrates `variantConfig` into top-level variant fields and presents unset columns as ABSENT\n * rather than NULL. A raw row would hand the caller `maxUses: undefined` on a BOUNDED_REUSE token\n * and `revokedAt: null` where MongoDB has no key — the NULL-vs-ABSENT divergence that broke every\n * service-tier read on this adapter once already.\n *\n * retention-gate: N/A — applied at `RepositoriesRegistryHandlerBackendService.readUnscopedByKey`.\n */\n public async readUnscopedByKey<T = any>(\n filter: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const where = this.buildWhere(filter as never);\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const row = await qb.executeTakeFirst();\n\n if (!row) return null;\n return this.transformPersistenceRow<T>(row, inheritanceDef);\n }\n\n /**\n * Compile a guarded mutation into column assignments, shared by the SINGLE-row and MULTI-row\n * writes.\n *\n * Split out so the two cannot drift. The descriptor's rationale is that \"each adapter now has a\n * single place where guarded-write semantics are decided, rather than three places that must\n * agree\" — two inline copies of this compilation (JSONB path assignment, planned-column gating,\n * the `updatedAt` parity rule) would have reinstated exactly what it set out to remove.\n *\n * Returns `null` when the descriptor asks for no expressible change, which BOTH callers translate\n * into their own no-op (`null` / `0`).\n */\n private async prepareGuardedUpdate(\n filter: Record<string, unknown>,\n mutation: RepositoryGuardedMutation,\n options?: RepositoryOptions,\n ): Promise<{ db: any; where: any; updates: Record<string, unknown>; inheritanceDef: any } | null> {\n const where = this.buildWhere(filter as any);\n // FAIL-CLOSED on an unfiltered update. `applyWhere` returns the builder UNCHANGED for a null\n // where-expression, and `buildWhere` yields null for an empty/unusable filter — so without this\n // guard an empty filter would silently become `UPDATE <table> SET …` across the WHOLE TABLE.\n // MongoDB's `findOneAndUpdate` would have touched at most one row, so this is precisely the kind\n // of adapter divergence a \"neutral\" primitive must not hide.\n if (!where) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.tableName,\n reason: 'atomicGuardedMutation requires a non-empty filter — refusing an unfiltered UPDATE',\n },\n });\n }\n\n // NO-OP PARITY with the MongoDB arm: an empty descriptor issues no write and returns null,\n // rather than emitting an `UPDATE … SET \"updatedAt\" = …` that would touch a row (and bump its\n // timestamp) on one adapter only.\n if (!guardedMutationHasWork(mutation)) return null;\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n /**\n * Column → the expression that column will be assigned.\n *\n * Reading through {@link currentColumnExpression} rather than from `sql.ref` directly is what\n * makes several mutations on one jsonb root COMPOSE: the second one wraps the first one's\n * expression instead of replacing it.\n */\n const columnAssignments = new Map<string, unknown>();\n\n const plainSets: Record<string, unknown> = {};\n for (const [path, value] of Object.entries(mutation.set ?? {})) {\n const segments = path.split('.');\n if (segments.length === 1) {\n plainSets[path] = value;\n continue;\n }\n const [root, ...rest] = segments;\n this.assertJsonbPathRoot(root, path, 'set');\n columnAssignments.set(root, this.buildJsonbPathAssignment(\n this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL),\n rest,\n sql`${sql.val(JSON.stringify(value ?? null))}::jsonb`,\n ));\n }\n\n for (const [path, delta] of Object.entries(mutation.increment ?? {})) {\n const segments = path.split('.');\n if (segments.length === 1) {\n // `COALESCE(col, 0)` is parity, not defensiveness: MongoDB's `$inc` treats a missing field\n // as 0 and sets it to `delta`, whereas SQL `NULL + delta` is NULL — without it a first\n // increment on a nullable column would silently blank the counter instead of starting it.\n columnAssignments.set(path, sql`COALESCE(${sql.ref(path)}, 0) + ${delta}`);\n continue;\n }\n const [root, ...rest] = segments;\n this.assertJsonbPathRoot(root, path, 'increment');\n const rootExpression = this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL);\n const pathLiteral = sql`${sql.val(rest)}::text[]`;\n columnAssignments.set(root, this.buildJsonbPathAssignment(\n rootExpression,\n rest,\n // Same missing-is-zero parity as the column case above, expressed through the jsonb path.\n sql`to_jsonb(COALESCE((${rootExpression} #>> ${pathLiteral})::numeric, 0) + ${delta})`,\n ));\n }\n\n for (const addition of mutation.arrayAdditions ?? []) {\n if (addition.values.length === 0) continue;\n const segments = addition.path.split('.');\n const [root, ...rest] = segments;\n this.assertJsonbPathRoot(root, addition.path, 'array addition');\n\n if (rest.length === 0) {\n // The array IS the column, so it coalesces to an empty ARRAY rather than an empty object.\n columnAssignments.set(root, this.buildJsonbArrayAddition(\n this.currentColumnExpression(columnAssignments, root, ARRAY_JSONB_LITERAL),\n addition,\n ));\n continue;\n }\n\n const rootExpression = this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL);\n const pathLiteral = sql`${sql.val(rest)}::text[]`;\n columnAssignments.set(root, this.buildJsonbPathAssignment(\n rootExpression,\n rest,\n this.buildJsonbArrayAddition(sql`COALESCE(${rootExpression} #> ${pathLiteral}, ${ARRAY_JSONB_LITERAL})`, addition),\n ));\n }\n\n for (const path of mutation.clear ?? []) {\n const segments = path.split('.');\n if (segments.length === 1) {\n /**\n * A clear targeting a field with NO PLANNED COLUMN is dropped rather than emitted.\n *\n * On MongoDB `$unset` of an absent path is a silent no-op; here it would be\n * `column \"x\" does not exist` and would fail the whole statement. Dropping keeps the\n * primitive's promise — the field ends up absent either way — instead of turning a\n * harmless no-op into an adapter-specific hard failure.\n */\n if (this.plannedFieldNames.has(path)) columnAssignments.set(path, null);\n continue;\n }\n const [root, ...rest] = segments;\n // Dropped for the same reason as the column case: `$unset` inside a document MongoDB does not\n // have is a no-op there, and must not become a hard failure here.\n if (!this.jsonbRoots.has(root)) continue;\n // `#-` removes the key outright, which is `$unset`'s meaning; assigning JSON null would leave\n // the key PRESENT and make `{ $exists: false }` disagree across adapters.\n columnAssignments.set(root, sql`${this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL)} #- ${sql`${sql.val(rest)}::text[]`}`);\n }\n\n // Route the plain-column sets through the same write transform every other update path uses\n // (variant sweep / inheritance handling); path expressions are already SQL and bypass it.\n const transformedPlainSets = Object.keys(plainSets).length > 0\n ? this.toSqlWriteRow(plainSets, inheritanceDef) as Record<string, unknown>\n : {};\n\n // Every part was dropped as unplanned (see the clear rules above), so this would emit an empty\n // statement. Same NO-OP PARITY reasoning as the descriptor check at the top.\n if (columnAssignments.size === 0 && Object.keys(transformedPlainSets).length === 0) return null;\n\n const updates: Record<string, unknown> = {\n // Parity with the MongoDB arm, where mongoose's `timestamps` bumps `updatedAt` on every\n // write. PostgreSQL has no such hook, so without this a mutated row would keep a stale\n // `updatedAt` on one adapter and a fresh one on the other.\n //\n // GATED on the planned columns, and that gate is load-bearing rather than defensive. Mongoose\n // applies `timestamps` GLOBALLY (`SCHEMA_DEFAULT_OPTIONS`), but the SQL planner emits a column\n // only when the resource's Zod schema declares the field. So on any resource that omits\n // `updatedAt`, an unconditional write here succeeds on MongoDB and hard-fails on PostgreSQL\n // with `column \"updatedAt\" does not exist` — an adapter divergence in the exact primitive that\n // exists to be adapter-neutral. The lifecycle / progression states are precisely that case:\n // neither declares `updatedAt`. Mirrors the gating every other write path here already uses.\n ...(this.plannedFieldNames.has('updatedAt') ? { updatedAt: new Date() } : {}),\n ...transformedPlainSets,\n ...Object.fromEntries(columnAssignments),\n };\n\n return { db, where, updates, inheritanceDef };\n }\n\n /**\n * The single-row guarded write — set, clear, increment and array-add on the ONE matching row.\n *\n * retention-gate: N/A — the hide is applied ONCE at the registry dispatch point\n * (`RepositoriesRegistryHandlerBackendService.atomicGuardedMutation` passes the caller's filter\n * through `applyRetentionHideToRawFilter`), which is the only route services take.\n */\n public async atomicGuardedMutation<T = any>(\n filter: Record<string, unknown>,\n mutation: RepositoryGuardedMutation,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n const prepared = await this.prepareGuardedUpdate(filter, mutation, options);\n if (!prepared) return null;\n return this.executeGuardedSingleRowUpdate<T>(prepared.db, prepared.where, prepared.updates, prepared.inheritanceDef);\n }\n\n /**\n * The MULTI-row guarded write: one mutation applied to EVERY matching row, returning how many\n * rows changed.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller\n * (`bulkUpdateForInfrastructure`), matching the single-row path above.\n *\n * The COUNT is the contract, not a convenience: its billing caller reports usage to a provider and\n * then marks those records reported, so a PARTIAL update is a duplicate-charge condition — the\n * unmarked records are selected again by the next sweep. `numUpdatedRows` is what makes that\n * detectable.\n */\n public async updateManyByRawFilter(\n filter: Record<string, unknown>,\n mutation: RepositoryGuardedMutation,\n options?: RepositoryOptions,\n ): Promise<number> {\n const prepared = await this.prepareGuardedUpdate(filter, mutation, options);\n if (!prepared) return 0;\n\n const result = await this.filterService\n .applyWhere(prepared.db.updateTable(this.tableName).set(prepared.updates as any), prepared.where)\n .executeTakeFirst();\n // Kysely reports affected rows as a bigint; coerce so callers compare a number, not a string.\n return Number((result as { numUpdatedRows?: unknown } | undefined)?.numUpdatedRows ?? 0);\n }\n\n /**\n * The MULTI-row DELETE below the operation tier: destroy every row matching an already-built\n * filter, returning how many went.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller\n * (`deleteManyForInfrastructure`), matching every sibling on this tier.\n *\n * rag-removal-gate: N/A — a raw repository door, bounded by the hourly RAG reconciliation sweep's\n * orphan reconciliation, exactly as `_doDelete` / `_doDeleteMany` are.\n *\n * **The empty-filter refusal is contract, not local defensiveness** — see the same guard in\n * `prepareGuardedUpdate`, and the reason it is stricter here than in `countByRawFilter` /\n * `findManyByRawFilter`: `applyWhere` returns the builder UNCHANGED for a null where-expression\n * and `buildWhere` yields null for an empty or unusable filter, so without this a caller whose\n * predicate came out empty would emit `DELETE FROM <table>` and get a cheerful count back. A read\n * can legitimately ask a whole-table question; a delete cannot.\n */\n public async deleteManyByRawFilter(\n filter: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<number> {\n const where = this.buildWhere(filter as any);\n if (!where) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.tableName,\n reason: 'deleteManyByRawFilter requires a non-empty filter — refusing an unfiltered DELETE',\n },\n });\n }\n\n const db = await this.getDbOrTrx(options);\n const result = await this.filterService\n .applyWhere(db.deleteFrom(this.tableName), where)\n .executeTakeFirst();\n // Kysely reports affected rows as a bigint; coerce so callers compare a number, not a string.\n return Number((result as { numDeletedRows?: unknown } | undefined)?.numDeletedRows ?? 0);\n }\n\n /**\n * The expression a column currently carries in this statement, or its base value when nothing has\n * touched it yet.\n *\n * `COALESCE` at the base is what lets a mutation land on a row whose jsonb column is NULL — the\n * state a freshly-created row is in for any field the schema defaults lazily.\n */\n private currentColumnExpression(assignments: Map<string, unknown>, column: string, emptyLiteral: any): any {\n return assignments.get(column) ?? sql`COALESCE(${sql.ref(column)}, ${emptyLiteral})`;\n }\n\n /**\n * Refuse a dotted path whose ROOT is not a jsonb column.\n *\n * Deliberately loud where an unplanned CLEAR is silently dropped: dropping a clear still leaves\n * the field absent, which is what the caller asked for, whereas dropping a set or an increment\n * loses the write and reports success. A path into a scalar column has no meaning at all.\n */\n private assertJsonbPathRoot(root: string, path: string, operation: string): void {\n if (this.jsonbRoots.has(root)) return;\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.tableName,\n reason: `Guarded mutation ${operation} targets \"${path}\", whose root column \"${root}\" is not jsonb-backed`,\n },\n });\n }\n\n /**\n * `jsonb_set` at `segments`, having first MATERIALISED every missing ancestor.\n *\n * The ancestor walk exists because `jsonb_set(target, path, value, true)` creates only the LAST\n * path element: with `{a}` absent, setting `{a,b}` returns the document unchanged (measured — see\n * the class-level note). MongoDB creates the whole chain, so without this an increment on a\n * lazily-defaulted nested counter would report success and write nothing.\n *\n * Each ancestor step repeats the accumulated expression once, so the SQL grows with path DEPTH,\n * not with the number of mutations. Real paths here are one or two levels\n * (`engagement.activeDates`, `stageHistory.1.exitedAt`).\n */\n private buildJsonbPathAssignment(baseExpression: any, segments: string[], valueExpression: any): any {\n let expression = baseExpression;\n for (let depth = 1; depth < segments.length; depth += 1) {\n const ancestorLiteral = sql`${sql.val(segments.slice(0, depth))}::text[]`;\n expression = sql`jsonb_set(${expression}, ${ancestorLiteral}, COALESCE(${expression} #> ${ancestorLiteral}, ${OBJECT_JSONB_LITERAL}), true)`;\n }\n return sql`jsonb_set(${expression}, ${sql`${sql.val(segments)}::text[]`}, ${valueExpression}, true)`;\n }\n\n /**\n * One array addition applied to `arrayExpression`, which must already evaluate to a jsonb ARRAY.\n *\n * `distinctOnly` folds ONE `CASE` per value rather than concatenating and de-duplicating\n * afterwards, because `@>` asks exactly the question `$addToSet` asks — \"is this value already in\n * the array?\" — and a de-duplicating rewrite would also drop pre-existing duplicates the caller\n * never asked to touch.\n *\n * `maxLength` uses `jsonb_path_query_array`, whose LAX mode (the default) tolerates a range wider\n * than the array instead of erroring — measured, since an out-of-range subscript is exactly the\n * case a short history hits on every early write.\n */\n private buildJsonbArrayAddition(arrayExpression: any, addition: RepositoryArrayAddition): any {\n let expression = arrayExpression;\n\n if (addition.distinctOnly) {\n // TAIL-only, and never capped: the registry's expressibility rule refuses the other\n // combinations for every adapter, because MongoDB's `$addToSet` cannot express them.\n for (const value of addition.values) {\n const valueLiteral = sql`${sql.val(JSON.stringify(value ?? null))}::jsonb`;\n expression = sql`CASE WHEN ${expression} @> ${valueLiteral} THEN ${expression} ELSE ${expression} || jsonb_build_array(${valueLiteral}) END`;\n }\n return expression;\n }\n\n const valuesLiteral = sql`${sql.val(JSON.stringify([...addition.values]))}::jsonb`;\n expression = addition.placement === RepositoryArrayAdditionPlacement.HEAD\n ? sql`${valuesLiteral} || ${expression}`\n : sql`${expression} || ${valuesLiteral}`;\n\n if (addition.maxLength === undefined) return expression;\n\n // Keep the elements nearest the addition's own end, which is what MongoDB's `$slice` sign means.\n return addition.placement === RepositoryArrayAdditionPlacement.HEAD\n ? sql`jsonb_path_query_array(${expression}, ${sql.lit(`$[0 to ${addition.maxLength - 1}]`)})`\n : sql`jsonb_path_query_array(${expression}, ${sql.lit(`$[last-${addition.maxLength - 1} to last]`)})`;\n }\n\n /**\n * PG counterpart of `findManyByBusinessKeys`. Compiles to a single SELECT\n * with an OR-of-AND-of-equalities composed via Mongo-shape filter\n * (`{ $or: [ {fieldA, fieldB}, ... ] }`) so the existing PG filter service\n * can translate it without special-casing.\n *\n * Empty input returns `[]` immediately (no DB call).\n */\n public async findManyByBusinessKeys<T = undefined>(\n executionContext: ExecutionContext<any>,\n businessKeyShapes: Array<Record<string, unknown>>,\n options?: RepositoryOptions,\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>> {\n if (businessKeyShapes.length === 0) return [] as ConditionalArrayReturnType<T, TMainSchema>;\n\n const orBranches = businessKeyShapes.map((shape) =>\n this._tryBuildBusinessKeyFilter(executionContext, shape),\n );\n const baseFilter: any = orBranches.length === 1\n ? orBranches[0]\n : { $or: orBranches };\n\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter, CoreResourceOperation.READ, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const rows = await qb.execute();\n return (rows ?? []).map((row: any) =>\n this.transformPersistenceRow<T>(row, inheritanceDef),\n );\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.upsertByBusinessKey`.\n *\n * Spec refs: data-seeding-as-first-class-feature plan §3.7 (atomic\n * upsert + ledger), §5 (Phase 2 repository contract), and decision\n * P2-B (PostgreSQL sibling parity). See\n * `business-key-resolver.shared.utils.ts` for the business-key\n * resolution contract this method consumes.\n *\n * Implemented as a two-phase transactional read-then-insert/update\n * because:\n * - Postgres `ON CONFLICT (...)` requires a known unique constraint on\n * exactly the business-key columns; we cannot guarantee that exists in\n * a generic way at this layer (apps-manager owns DDL). Phase 4+ may\n * harden this once seeds drive their own indexes.\n * - The Mongo path uses a single `findOneAndUpdate({upsert:true})` which\n * is atomic at the document level; the PG fallback wraps the read +\n * write in a transaction (or piggy-backs on the caller's transaction)\n * to retain the same effective semantics.\n *\n * **Race window (R-6):** when the caller does NOT pass a transaction in\n * `options.transaction`, the SELECT and the subsequent INSERT/UPDATE run\n * on independent connections. Two concurrent dispatcher passes for the\n * same business key can therefore both observe `existing === null` and\n * race to INSERT. The first write wins; the second surfaces as a\n * unique-constraint violation **iff** the table actually carries a\n * unique index on the business-key columns. Without that index the\n * race produces duplicate rows (same business key, different `_id`).\n * The data-seeding dispatcher always wraps a seed pass in a transaction\n * (`DataSeedDispatcherBackendService.runAdditiveSeed`), so this race is\n * mitigated for seeds; for ad-hoc callers, prefer passing a transaction\n * or guaranteeing a unique constraint on the business-key columns.\n *\n * **Optimistic-locking parity (R-10):** the Mongo path bumps\n * `_version_db_doc` via `$inc` on every upsert so subsequent\n * `_doUpdate(ifMatchVersion: …)` calls keep working. PG must mirror\n * this behavior so seed-managed rows also expose a monotonically\n * increasing `_version_db_doc`. We initialize the column to `1` on\n * INSERT and `coalesce(_version_db_doc, 0) + 1` on UPDATE — the\n * `coalesce` is defensive in case the row pre-existed without the\n * column being populated. The full PG `ifMatchVersion`-aware\n * `_doUpdate` integration is a separate concern tracked outside the\n * Phase 2 seed scope (the column being kept in sync is the\n * prerequisite for it to land later without a data-migration).\n *\n * Always returns a non-null `row`; `inserted` flips on the create branch.\n */\n public async upsertByBusinessKey<T = undefined>(\n executionContext: ExecutionContext<any>,\n businessKeyShape: Record<string, unknown>,\n payload: Record<string, unknown>,\n seedMetadata: DataSeedRowMetadata,\n options?: RepositoryOptions,\n ): Promise<{ inserted: boolean; row: ConditionalReturnType<T, TMainSchema> }> {\n const baseFilter = this._tryBuildBusinessKeyFilter(executionContext, businessKeyShape);\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter as any, CoreResourceOperation.UPDATE, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Read first inside the same client (or transaction if the caller passed one).\n const existing = await this.filterService\n .applyWhere(db.selectFrom(this.tableName).selectAll(), where)\n .executeTakeFirst();\n\n // WS-C: this upsert can INSERT, so it is governed by the row-creating rule. In practice seeding\n // runs under an internal system context, which narrowing exempts — the guard is here so that\n // coverage of the write surface is a PROPERTY of the chokepoint set rather than a consequence of\n // who happens to call it today.\n await this.assertOrganizationUnitWriteWithinGrant(payload, CoreResourceOperation.CREATE, executionContext);\n\n // Engine-reserved metadata is stripped from the CALLER's payload before anything else — the\n // 7th site of an invariant the six sibling write paths already apply by hand (`_doCreate`,\n // `_doCreateMany`, `_doUpdate`, `_doUpdateMany`, and both `upsertByFilter` branches each\n // `delete ..._version`). This one was missed, and it is the ONLY write path data-seeding uses.\n //\n // It matters because a seed UPGRADE's payload is a READ PROJECTION: the managed-field overlay\n // is the persisted row with managed paths replaced, and `transformPersistenceRow` publishes\n // `_version_db_doc` as the public read-only `_version`. Writing that back names a column this\n // table does not have — `column \"_version\" of relation \"...\" does not exist` — so every\n // PostgreSQL seed upgrade failed. Applied via the named rule rather than a seventh hand-list so\n // a future engine-owned key is covered without another enumeration.\n const callerAuthoredPayload: Record<string, unknown> = {};\n for (const key of Object.keys(payload as Record<string, unknown>)) {\n if (isEngineReservedFieldName(key)) continue;\n callerAuthoredPayload[key] = (payload as Record<string, unknown>)[key];\n }\n const writePayload: Record<string, unknown> = {\n ...callerAuthoredPayload,\n [DATA_SEED_ROW_METADATA_FIELD_KEY]: seedMetadata,\n };\n const trackedPayload = this.addUserTrackingAndTimestamps(\n writePayload,\n executionContext,\n existing ? CoreResourceOperation.UPDATE : CoreResourceOperation.CREATE,\n );\n\n if (existing) {\n // Defensive: never let the caller's payload overwrite the version\n // column directly (the Mongo path strips `_version_db_doc` from\n // `$set` for the same reason — see repository-resource.backend.service.ts).\n delete (trackedPayload as Record<string, unknown>)._version_db_doc;\n const previousVersion = typeof (existing as any)._version_db_doc === 'number'\n ? (existing as any)._version_db_doc\n : 0;\n const nextVersion = previousVersion + 1;\n const toWrite = this.toSqlWriteRow(\n { ...trackedPayload, _version_db_doc: nextVersion },\n inheritanceDef,\n );\n // Unique-violation → CONFLICT, mirroring the Mongo arm. WRITE only; the pre-read above is\n // deliberately left unwrapped so a failed lookup is never reported as a duplicate.\n let updated: any;\n try {\n updated = await this.filterService\n .applyWhere(db.updateTable(this.tableName).set(toWrite as any), where)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n const row = this.transformPersistenceRow<ConditionalReturnType<T, TMainSchema>>(updated, inheritanceDef);\n return { inserted: false, row };\n }\n\n // Defensive: stamp the business-key columns onto the row in case the\n // caller's payload omitted them (parity with Mongo $setOnInsert), and\n // initialize `_version_db_doc` to 1 so subsequent updates can $inc it\n // monotonically — same convention as Mongo (versionKey: _version_db_doc).\n delete (trackedPayload as Record<string, unknown>)._version_db_doc;\n const insertRow = { ...businessKeyShape, ...trackedPayload, _version_db_doc: 1 };\n // This branch is the upsert's INSERT — governed by the same create-time rules as `_doCreate`\n // (same adapter-neutral authority). Exempt seed contexts return immediately; a future non-exempt\n // upsert-create inherits FK-existence + top-level-check enforcement for free.\n await assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n insertRow,\n CoreResourceOperation.CREATE,\n seedMetadata.seedKey,\n executionContext,\n options,\n );\n const toInsert = this.toSqlWriteRow(this.withGeneratedRowIdentity(insertRow), inheritanceDef);\n let inserted: any;\n try {\n inserted = await db\n .insertInto(this.tableName)\n .values(toInsert as any)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n // The upsert lost the insert race, or a DIFFERENT unique constraint was violated — the caller\n // branches on CONFLICT either way, so it must not receive a raw driver error.\n throw this.handlePostgresError(error, executionContext);\n }\n const row = this.transformPersistenceRow<ConditionalReturnType<T, TMainSchema>>(inserted, inheritanceDef);\n return { inserted: true, row };\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.upsertByFilter` — a race-free singleton\n * upsert, expressed as `INSERT … ON CONFLICT (<filter columns>) DO UPDATE`.\n *\n * **Why this could not be written before.** It used to throw, citing \"relationship FK DDL and\n * ON CONFLICT support\", and that was accurate: a scope-feature ledger declares NO scope FK in its\n * schema — the column is relationship-injected — so the SQL planner never planned it, and without\n * the column and its unique constraint there is no conflict target. The planner now plans injected\n * FKs and marks a 1:1 relationship's FK unique, which is exactly the constraint this needs.\n *\n * **Atomicity comes from the constraint, not from a read.** A read-then-insert would reintroduce\n * the duplicate-singleton race this API exists to prevent: two callers both see no row, both\n * insert, and the ledger ends up with two. `ON CONFLICT` makes the database arbitrate.\n *\n * Semantics mirrored from the MongoDB arm rather than approximated:\n * - only EXPLICITLY authored keys are updated. Zod CREATE validation materializes defaults that\n * are right for a new row and wrong on the update branch — Mongo keeps them insert-only via\n * `$setOnInsert` + `setDefaultsOnInsert`, and here they simply never enter the `DO UPDATE` set.\n * - the filter's own columns are never in the update set: they identify the row.\n * - `_version_db_doc` increments on the update branch and starts at 1 on insert, matching `$inc`.\n * - the return distinguishes insert from update, via `xmax = 0` — PostgreSQL's standard signal for\n * \"this row was inserted by THIS statement\" rather than updated by it.\n */\n public async upsertByFilter<T = undefined>(\n executionContext: ExecutionContext<any>,\n filterShape: Record<string, unknown>,\n payload: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<{ inserted: boolean; row: ConditionalReturnType<T, TMainSchema> }> {\n const isConcreteSingletonFilterValue = (value: unknown): boolean => {\n if (value === undefined || value === null) return false;\n if (typeof value === 'string') return value.length > 0;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value === 'boolean') return true;\n if (value instanceof Date) return !Number.isNaN(value.getTime());\n return false;\n };\n const filterKeys = Object.keys(filterShape);\n const invalidFilterEntries = Object.entries(filterShape)\n .filter(([, value]) => !isConcreteSingletonFilterValue(value));\n if (filterKeys.length === 0 || invalidFilterEntries.length > 0) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message: 'upsertByFilter requires a non-empty filter with concrete singleton key values.',\n invalidFilterFields: invalidFilterEntries.map(([key]) => key),\n },\n });\n }\n\n /**\n * FAIL CLOSED when the filter does not name a real UNIQUE constraint.\n *\n * `ON CONFLICT` needs a target the database can arbitrate on. Emitting it against unconstrained\n * columns is not a weaker guarantee — PostgreSQL rejects the statement outright, and doing it\n * silently would turn a missing migration into a runtime error at the worst moment. Refusing\n * here names the actual cause instead.\n *\n * **Single vs multi-column are different questions.** One column needs its OWN unique index;\n * `ON CONFLICT (a, b)` needs a unique index on the exact SET `{a, b}` — two individually-unique\n * columns do not make one, and checking them one at a time would pass and then hand PostgreSQL a\n * statement it rejects, which is precisely the late runtime error this guard exists to pre-empt.\n */\n if (filterKeys.length === 1) {\n const [onlyFilterKey] = filterKeys as [string];\n if (!this.uniqueFieldNames.has(onlyFilterKey)) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message: 'upsertByFilter requires every filter column to carry a UNIQUE constraint to serve as an ON CONFLICT target.',\n unconstrainedFilterFields: [onlyFilterKey],\n },\n });\n }\n } else if (!this.uniqueConstraintKeys.has(uniqueColumnSetKey(filterKeys))) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message:\n 'upsertByFilter requires a COMPOSITE unique constraint covering exactly the filter columns to serve as an '\n + 'ON CONFLICT target. Individually-unique columns do not compose into one.',\n unconstrainedFilterFields: filterKeys,\n },\n });\n }\n\n /**\n * FAIL CLOSED on the SCOPE half of this method's divergence from the MongoDB arm.\n *\n * The Mongo twin runs its filter through `buildContextualFilter(… UPDATE …)`, so it gets tenant\n * confinement on the update branch. This arm builds its statement directly and cannot: an\n * `ON CONFLICT` target must name a UNIQUE constraint, and a scope predicate is not part of one,\n * so the arbitration happens on the business key ALONE. A caller that expected scope confinement\n * would therefore update another tenant's row here and be confined on MongoDB — the exact\n * silent, one-adapter divergence this method already produced once for retention.\n *\n * Rather than leave that as a documented residual, the method refuses any caller that has NOT\n * explicitly waived contextual filtering. Every caller today passes `excludeContextualFilter: true`\n * (the feature-admin sync, billing, the milestone evaluator, and the platform apps-manager singleton\n * materializers — each keyed on its scope FK), so this costs nothing now and converts a future\n * silent leak into a loud refusal naming the cause.\n *\n * An ARRAY value is refused too: it asks for PARTIAL scope filtering, which is exactly the thing\n * that cannot be expressed here. RETENTION is unaffected — it is applied unconditionally below,\n * because a retained row must stay immutable no matter what the caller waived.\n */\n if (options?.excludeContextualFilter !== true) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message:\n 'upsertByFilter on PostgreSQL cannot apply contextual (scope) filtering — ON CONFLICT arbitrates on the '\n + 'unique key alone — so it requires `excludeContextualFilter: true` from the caller. Use a filter that '\n + 'already names the scope, or perform a scoped read-then-write instead. Retention hiding is always applied '\n + 'and is not affected by this flag.',\n excludeContextualFilter: options?.excludeContextualFilter ?? null,\n },\n });\n }\n\n const cleaned = this.resourceOperationHelper.cleanInputData(payload, CoreResourceOperation.CREATE);\n const validated = this.repositoriesRegistry.validateRequestData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n CoreResourceOperation.CREATE,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.CREATE,\n options,\n );\n\n // An upsert can INSERT, so it is governed by the row-CREATING rule: the filter constrains which\n // row is matched, never the unit a newly inserted row would land in.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.CREATE, executionContext);\n\n // Create-time write integrity for the INSERT branch — the adapter-neutral twin of the Mongo\n // `upsertByFilter` call, and the same rule `upsertByBusinessKey` applies. Without it this insert\n // path silently skipped FK-existence / scope-membership / top-level checks. Exempt callers (the\n // internal singleton materializers) return immediately; no `operation` → relationship baseline.\n await assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n { ...enriched, ...filterShape },\n CoreResourceOperation.CREATE,\n CoreResourceOperation.CREATE,\n executionContext,\n options,\n );\n\n if (executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable) {\n enriched.userId = null;\n }\n\n const withLiterals = this.resourceOperationHelper.injectNonDiscriminatorLiteralValues(\n enriched,\n this.resourceConfiguration.mainSchema,\n );\n\n // Only what the CALLER authored may be updated; everything else is insert-only, exactly as the\n // MongoDB arm splits `$set` from `$setOnInsert`.\n const explicitKeys = new Set(Object.keys(payload));\n const updateFields = this.addUserTrackingAndTimestamps(\n Object.fromEntries(\n Object.entries(withLiterals).filter(([key]) => explicitKeys.has(key) && !(key in filterShape)),\n ),\n executionContext,\n CoreResourceOperation.UPDATE,\n );\n delete (updateFields as Record<string, unknown>)._version;\n delete (updateFields as Record<string, unknown>)._version_db_doc;\n\n const insertFields = this.addUserTrackingAndTimestamps(\n { ...withLiterals, ...filterShape },\n executionContext,\n CoreResourceOperation.CREATE,\n );\n delete (insertFields as Record<string, unknown>)._version;\n (insertFields as Record<string, unknown>)._version_db_doc = 1;\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toInsert = this.toSqlWriteRow(\n this.withGeneratedRowIdentity(insertFields as Record<string, any>),\n inheritanceDef,\n ) as Record<string, unknown>;\n const toUpdate = this.toSqlWriteRow(updateFields as Record<string, any>, inheritanceDef) as Record<string, unknown>;\n\n /**\n * The conflict target must mirror the index PREDICATE, not merely its columns.\n *\n * On a retention-governed resource every unique index this framework emits is PARTIAL — the\n * planner sets `uniquenessExcludesErasureRetainedRows` and `postgresql-schema-ddl` renders\n * `… where \"retentionStatus\" is distinct from 'retained'` — because a full-table index would\n * abort the SECOND erasure of a subject (the mask writes ONE shared value to every retained row).\n * PostgreSQL will not infer a partial index from a bare `on conflict (cols)`; it answers\n * \"there is no unique or exclusion constraint matching the ON CONFLICT specification\". So the\n * predicate has to be repeated here, and it is taken from the retention authority — the same\n * emitter the DDL renderer uses — rather than re-typed, so the statement and the index it must\n * match can never disagree.\n *\n * **Repeating it is also what closes the retention hole, and those are one fact rather than two\n * fixes.** With the arbiter index scoped to VISIBLE rows, a RETAINED row holding the caller's\n * business key simply does not conflict: the insert proceeds and a new live row is created —\n * exactly what the MongoDB arm does once its own partial index excludes the retained row. Without\n * this, `do update … returning *` would REWRITE that retained row and hand it back to the caller,\n * breaking both halves of the \"hidden and immutable\" contract, on one adapter only. This method\n * was the last write path on either adapter that did not reach the hide (found 2026-08-09).\n */\n /**\n * Read from the PLAN, not re-derived from the config.\n *\n * `uniquenessExcludesErasureRetainedRows` is the exact flag the DDL renderer keys the index\n * predicate off, so reading it here makes the statement and the index provably ONE decision\n * rather than two that agree today. It also covers the shared-table alias case that a config\n * lookup would get wrong: `resolveTableNameForResource` points a `USER_SELF*` repository at its\n * twin's table, whose index was planned from the TWIN's configuration.\n */\n const retentionScopedUniqueness = this.retentionScopedUniqueIndexes;\n /**\n * The SAME predicate rendered against two different column SCOPES — which is precisely the seam\n * the authority's `quoteIdentifier` callback exists for, so the predicate itself is still spelled\n * in exactly one place.\n *\n * - The **index-inference** predicate must be UNQUALIFIED, because it has to match the index's own\n * predicate expression as `postgresql-schema-ddl` renders it.\n * - The **update-condition** predicate must be TABLE-QUALIFIED. Inside `do update`, both the target\n * row and `excluded` are in scope, so a bare `\"retentionStatus\"` is ambiguous and PostgreSQL\n * rejects the statement with `42702` (found by the integration pin, not by review). Qualifying\n * with the table names the EXISTING row, which is the one that must not be retained.\n *\n * A fresh node per use — a Kysely fragment is consumed by the builder it is handed to.\n */\n const indexInferencePredicate = () => sql<boolean>`${sql.raw(buildRetentionVisibleRowsSqlPredicate(quotePostgresIdentifier))}`;\n const existingRowIsVisible = () => sql<boolean>`${sql.raw(buildRetentionVisibleRowsSqlPredicate(\n (identifier) => quotePostgresColumnOf(this.tableName, identifier),\n ))}`;\n\n // Unique-violation → CONFLICT, mirroring the Mongo arm. `ON CONFLICT` arbitrates the TARGET\n // index only; a violation of a DIFFERENT unique constraint still surfaces here and must not\n // reach the caller as a raw driver error.\n let upserted: any;\n try {\n upserted = await db\n .insertInto(this.tableName)\n .values(toInsert as any)\n .onConflict((oc: any) => {\n // `where` BEFORE `doUpdateSet` is the index-inference predicate (which index to arbitrate on);\n // `where` AFTER it is the update condition (which conflicting rows may be written).\n const target = retentionScopedUniqueness ? oc.columns(filterKeys as any).where(indexInferencePredicate()) : oc.columns(filterKeys as any);\n const updated = target.doUpdateSet({\n ...toUpdate,\n // Mirrors `$inc: { _version_db_doc: 1 }`. `EXCLUDED` is NOT usable here — it holds the value\n // this statement PROPOSED (always 1), not the row's current one, so it would reset the\n // version on every update instead of advancing it.\n _version_db_doc: sql`coalesce(${sql.ref(this.tableName)}.\"_version_db_doc\", 0) + 1`,\n });\n // Defence in depth: unreachable while the arbiter index is correctly partial, but it makes a\n // table whose index was hand-provisioned WITHOUT the predicate fail CLOSED (nothing updated,\n // nothing returned — see the guard below) instead of silently mutating a retained row.\n return retentionScopedUniqueness ? updated.where(existingRowIsVisible()) : updated;\n })\n // `xmax = 0` is PostgreSQL's standard discriminator for a row this statement INSERTED versus\n // one it updated: an inserted tuple has no updating transaction stamped on it.\n .returningAll()\n .returning(sql<boolean>`(xmax = 0)`.as('__wildo_inserted'))\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n\n /**\n * `do update … where <false>` updates nothing and returns nothing. Every other path here yields a\n * row, so an empty result means the update branch was refused — on a retention-governed resource\n * that means the conflicting row is RETAINED and the table's unique index is NOT retention-scoped.\n * Fail loudly naming that, rather than returning an undefined row a caller would dereference.\n */\n if (!upserted) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message:\n 'upsertByFilter matched a row it is not allowed to write. On a retention-governed resource this means the '\n + 'conflicting row is impersonalized-and-retained while the table\\'s unique index still covers retained rows — '\n + 'provision it with the retention-scoped predicate the schema plan declares.',\n filterFields: filterKeys,\n retentionScopedUniqueness,\n },\n });\n }\n\n const inserted = Boolean(upserted?.__wildo_inserted);\n if (upserted) delete upserted.__wildo_inserted;\n return {\n inserted,\n row: this.transformPersistenceRow<ConditionalReturnType<T, TMainSchema>>(upserted, inheritanceDef),\n };\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.updateSeedMetadata`.\n *\n * Privileged write path for the `__seed` row-metadata ledger ONLY.\n * See the interface JSDoc on `BackendResourceRepository.updateSeedMetadata`\n * (in `repositories-registry-handler.backend.service.ts`) for the full\n * rationale (R3-1, Phase-4 deep-review hotfix). Short version: the\n * standard `update(...)` path runs the patch through `validateRequestData`\n * which `.strip()`s `__seed` because no app resource declares that\n * system-managed field on its UPDATE DTO. This method bypasses the\n * DTO and writes directly via Kysely.\n *\n * Optimistic-locking parity (mirrors `upsertByBusinessKey`'s R-10\n * convention): `_version_db_doc` is bumped via\n * `coalesce(_version_db_doc, 0) + 1` so subsequent updates can keep\n * relying on the same monotonic counter.\n *\n * Defensive scoping: applies `buildContextualFilter` even though the\n * dispatcher always uses an internal super-admin context that\n * bypasses scope filters — same R3-1 review note as the Mongo sibling.\n *\n * @throws WildoError_Backend(NOT_FOUND) when the `_id` doesn't match.\n */\n // rag-ingestion-gate: N/A — writes only the engine-reserved `__seed` ledger (plan §3.c M5), so no\n // `.ragSource()` corpus text ever passes through this door; any drift class it could theoretically\n // join is bounded by the hourly RAG reconciliation sweep's contentHash comparison.\n public async updateSeedMetadata(\n executionContext: ExecutionContext<any>,\n id: string,\n seedMetadata: DataSeedRowMetadata,\n options?: RepositoryOptions,\n ): Promise<void> {\n const baseFilter = { _id: id };\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter as any, CoreResourceOperation.UPDATE, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Read existing for `_version_db_doc` baseline (parity with\n // `upsertByBusinessKey`'s \"+1\" convention).\n const existing = await this.filterService\n .applyWhere(db.selectFrom(this.tableName).selectAll(), where)\n .executeTakeFirst();\n if (!existing) {\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_SEED_METADATA_NOT_FOUND,\n context: {\n // diagnostic (log-only)\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n id,\n },\n },\n );\n }\n\n const previousVersion = typeof (existing as any)._version_db_doc === 'number'\n ? (existing as any)._version_db_doc\n : 0;\n const nextVersion = previousVersion + 1;\n\n // User-tracking only (no body fields).\n const trackedPayload: Record<string, unknown> = this.addUserTrackingAndTimestamps(\n {} as Record<string, unknown>,\n executionContext,\n CoreResourceOperation.UPDATE,\n );\n\n const writeRow: Record<string, unknown> = {\n ...trackedPayload,\n [DATA_SEED_ROW_METADATA_FIELD_KEY]: seedMetadata,\n _version_db_doc: nextVersion,\n };\n const toWrite = this.toSqlWriteRow(writeRow, inheritanceDef);\n try {\n await this.filterService\n .applyWhere(db.updateTable(this.tableName).set(toWrite as any), where)\n .execute();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService._tryBuildBusinessKeyFilter`.\n *\n * Bridges every `BUSINESS_KEY_ERROR_PREFIX`-tagged failure (no business\n * key declared, shape missing/extra fields, undefined values) to an\n * `INTERNAL` repository error — these are all programmer mistakes since\n * the dispatcher constructs the shape from the seed's own declaration,\n * never from user input. See `business-key-resolver.shared.utils.ts`\n * and audit finding R-3 for the full rationale.\n */\n private _tryBuildBusinessKeyFilter(\n executionContext: ExecutionContext<any>,\n businessKeyShape: Record<string, unknown>,\n ): Record<string, unknown> {\n try {\n return buildBusinessKeyFilter(this.resourceConfiguration.mainSchema, businessKeyShape);\n } catch (error) {\n const message = describeCaughtError(error);\n const isTagged = message.startsWith(BUSINESS_KEY_ERROR_PREFIX);\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: {\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n message: isTagged ? message : `[business-key:untagged] ${message}`,\n },\n },\n );\n }\n }\n\n /**\n * Every column covered by the UNIQUE constraint a PostgreSQL duplicate-key error violated.\n *\n * The MongoDB arm answers this from the driver's structured `keyPattern`. PostgreSQL's equivalent\n * is `detail`, which the server formats as `Key (col_a, col_b)=(v1, v2) already exists.` — a\n * server-supplied answer, not a reconstruction, which is what keeps this comparable to the Mongo\n * side rather than a second implementation of index naming.\n *\n * **Deliberately NOT derived from `error.constraint`.** Mapping a constraint NAME back to columns\n * would mean re-deriving the schema convertor's naming rule (scope prefixes, `compoundWith`, key\n * order) in a second place free to drift from the first — exactly what\n * `resolveDeclaredUniqueConflictReference` refuses to do, and for the same reason.\n *\n * FAIL-SAFE, never fail-guessing: anything unparseable yields `[]`, so the caller keeps the\n * generic conflict code. A wrong-but-specific error code is worse than a correct generic one,\n * because an integrator branching on it takes the wrong recovery path.\n */\n private extractViolatedUniqueColumns(error: unknown): string[] {\n const detail = (error as { detail?: unknown } | null)?.detail;\n if (typeof detail !== 'string') return [];\n // `Key (a, b)=(1, 2) already exists.` — only the key list is read; the VALUES are deliberately\n // not parsed here (they can contain commas and parentheses of their own).\n const keyMatch = /^Key \\(([^)]*)\\)=/.exec(detail);\n if (!keyMatch?.[1]) return [];\n return keyMatch[1]\n .split(',')\n .map((column) => column.trim().replace(/^\"|\"$/g, ''))\n .filter((column) => column.length > 0);\n }\n\n /**\n * Translate a PostgreSQL driver error into the engine's conflict contract.\n *\n * **The MIRROR of `handleMongoDBError`, and until now it did not exist.** The declared-conflict\n * resolver's own docstring states that resolution by field names is \"adapter-neutral — a SQL\n * adapter reporting a violated constraint's columns resolves through the same path\". That was\n * ASPIRATIONAL: the extraction existed only on the MongoDB base class, so on a PostgreSQL-backed\n * resource every unique violation escaped as a raw driver error. A resource that had carefully\n * declared `.isUnique({ conflictMessageReference })` got the generic code — or no conflict\n * classification at all — for every write.\n *\n * Found while porting consumable tokens (plan item A-2): `createToken` turns a duplicate\n * `activeGenerationKey` into a CONFLICT the caller branches on, and MongoDB's `code: 11000` /\n * `keyPattern` have no PostgreSQL counterpart. But the gap is engine-wide, not token-specific —\n * every resource on this adapter was affected.\n *\n * `23505` is `unique_violation`. Anything else is returned untouched: a connection reset must not\n * be reported to a caller as \"that value is taken\".\n */\n private handlePostgresError(error: unknown, executionContext?: ExecutionContext<any>): Error | WildoError_Backend {\n const code = (error as { code?: unknown } | null)?.code;\n if (code !== '23505') {\n return error instanceof Error ? error : new Error(describeCaughtError(error));\n }\n\n const violatedFieldNames = this.extractViolatedUniqueColumns(error);\n const declaredConflictReference = resolveDeclaredUniqueConflictReference(\n this.resourceConfiguration.mainSchema as any,\n violatedFieldNames,\n );\n\n return this.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: declaredConflictReference ?? ErrorCustomMessageReference.UNIQUE_CONSTRAINT_VIOLATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n // Named as on the Mongo arm so a consumer reading either adapter's conflict sees one shape.\n fieldName: violatedFieldNames[0] ?? 'unknown',\n violatedFields: violatedFieldNames,\n originalError: (error as { message?: unknown } | null)?.message ?? describeCaughtError(error),\n },\n });\n }\n\n // ===========================================================================\n // Core private ops (initial subset)\n // ===========================================================================\n\n /**\n * retention-gate: N/A — INSERTs a brand-new row, so there is no existing row for a hide to protect.\n * A retained row is reached only through a filter, and this statement carries none.\n */\n private async _doCreate(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n data: any,\n options?: RepositoryOptions\n ): Promise<any> {\n const cleaned = this.resourceOperationHelper.cleanInputData(data, CoreResourceOperation.CREATE);\n const validated = this.repositoriesRegistry.validateRequestData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n CoreResourceOperation.CREATE,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.CREATE,\n options\n );\n\n // WS-C: no filter can constrain a create, so the unit the row lands in is checked here.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.CREATE, executionContext);\n\n if (executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable) {\n enriched.userId = null;\n }\n\n const withLiterals = this.resourceOperationHelper.injectNonDiscriminatorLiteralValues(\n enriched,\n this.resourceConfiguration.mainSchema\n );\n\n const withTracking = this.addUserTrackingAndTimestamps(withLiterals, executionContext, CoreResourceOperation.CREATE);\n // The repository version is framework-owned. Seed it explicitly so all\n // PostgreSQL deployments expose a durable version even when table DDL\n // predates a database-level default.\n delete withTracking._version;\n delete withTracking._version_db_doc;\n withTracking._version_db_doc = 1;\n\n // Create-time write integrity (SAME adapter-neutral authority as the MongoDB repository): FK\n // existence-in-scope + top-level mainSchema checks against the fully-enriched row, before the id is\n // folded to its physical column. A create has no filter/pre-image, so this is the only place a\n // dangling or cross-tenant FK is caught on a PostgreSQL-backed resource.\n await assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n withTracking,\n CoreResourceOperation.CREATE,\n operation.operationIdentifier,\n executionContext,\n options,\n referenceConstraintsOf(operation),\n );\n\n const withPhysicalId = this.withGeneratedRowIdentity(this.foldSurrogatePrimaryKey(withTracking));\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toWrite = this.toSqlWriteRow(withPhysicalId, inheritanceDef);\n\n // Unique violations are translated to the engine's CONFLICT contract here, mirroring the Mongo\n // arm's `handleMongoDBError`. Only the WRITE is wrapped: a read failing must not be reported as\n // a duplicate.\n let inserted: any;\n try {\n inserted = await db\n .insertInto(this.tableName)\n .values(toWrite as any)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n\n if (!inserted) return null;\n return this.transformPersistenceRow(inserted, inheritanceDef);\n }\n\n /** retention-gate: N/A — bulk INSERT of brand-new rows; see `_doCreate`. */\n private async _doCreateMany(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n data: any,\n options?: RepositoryOptions\n ): Promise<any[]> {\n const dataArray = Array.isArray(data) ? data : [];\n const cleanedArray = this.resourceOperationHelper.cleanInputDataArray(dataArray, CoreResourceOperation.CREATE_MANY);\n const isBulkOperation = 'isBulkOperation' in operation && operation.isBulkOperation === true;\n const validatedArray = cleanedArray.map((item) =>\n this.repositoriesRegistry.validateRepositoryWriteData(\n item,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n String(operation.operationIdentifier),\n isBulkOperation,\n options,\n )\n ) as any[];\n\n const isAnonymousCreate = executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable;\n // `async` + `Promise.all`, mirroring the MongoDB adapter: the per-row narrowing guard now performs\n // a scoped tenant read. Kept PER ROW — a bulk create must not let one out-of-tenant row ride in.\n const enrichedArray = await Promise.all((Array.isArray(validatedArray) ? validatedArray : []).map(async (item) => {\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n item,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.CREATE_MANY,\n options\n );\n // WS-C: checked PER ROW — a bulk create must not let one out-of-grant row ride in on a batch.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.CREATE_MANY, executionContext);\n if (isAnonymousCreate) { enriched.userId = null; }\n return enriched;\n }));\n\n const withLiteralsArray = enrichedArray.map((item) =>\n this.resourceOperationHelper.injectNonDiscriminatorLiteralValues(item, this.resourceConfiguration.mainSchema)\n );\n\n const withTrackingArray = withLiteralsArray.map((item) => {\n const tracked = this.addUserTrackingAndTimestamps(\n item,\n executionContext,\n CoreResourceOperation.CREATE,\n );\n delete tracked._version;\n delete tracked._version_db_doc;\n tracked._version_db_doc = 1;\n return tracked;\n });\n\n // Create-time write integrity PER ROW (same authority as MongoDB) — one dangling/cross-tenant FK or\n // invalid cross-field row must not ride in on a batch.\n await Promise.all(withTrackingArray.map((row) => assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n row,\n CoreResourceOperation.CREATE_MANY,\n operation.operationIdentifier,\n executionContext,\n options,\n referenceConstraintsOf(operation),\n )));\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toWriteArray = withTrackingArray.map((item) => this.toSqlWriteRow(this.withGeneratedRowIdentity(item), inheritanceDef));\n\n if (toWriteArray.length === 0) return [];\n\n const insertedRows = await db.insertInto(this.tableName).values(toWriteArray as any).returningAll().execute();\n return insertedRows.map((row: any) =>\n this.transformPersistenceRow(row, inheritanceDef),\n );\n }\n\n private async _doRead(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n options?: RepositoryOptions\n ): Promise<any> {\n // Align with Mongo behavior: READ requires an id or filter.\n if (!id_or_filter) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.READ }, // diagnostic (log-only)\n });\n }\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const { baseFilter } = this.buildBaseFilterFromIdOrFilter(id_or_filter, executionContext);\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter, CoreResourceOperation.READ, options);\n const where = this.buildWhere(contextualFilter);\n\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const row = await qb.executeTakeFirst();\n\n if (!row) return null;\n return this.transformPersistenceRow(row, inheritanceDef);\n }\n\n private async _doUpdate(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n data: any,\n options?: RepositoryOptions\n ): Promise<any> {\n const { baseFilter } = this.buildBaseFilterFromIdOrFilter(id_or_filter, executionContext);\n const id = await this.resolveSingleId(executionContext, baseFilter, CoreResourceOperation.UPDATE, options);\n if (!id) return null;\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const cleaned = this.resourceOperationHelper.cleanInputData(data, CoreResourceOperation.UPDATE);\n const isBulkOperation = 'isBulkOperation' in operation && operation.isBulkOperation === true;\n const validated = this.repositoriesRegistry.validateRepositoryWriteData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n String(operation.operationIdentifier),\n isBulkOperation,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.UPDATE,\n options\n );\n\n // WS-C: the contextual filter already confines WHICH row is updated; this confines the unit the\n // update may move it TO. An update that does not touch the unit field is unaffected.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.UPDATE, executionContext);\n\n // Referential + scope-via-junction integrity for any FK this update REASSIGNS (adapter-neutral twin\n // of the Mongo `_doUpdate` check — one authority, both adapters). Absent FKs skipped; exempt at entry.\n await assertUpdateWriteIntegrity(this.writeIntegrityDeps, enriched, CoreResourceOperation.UPDATE, executionContext, options, referenceConstraintsOf(operation));\n\n const withTracking = this.addUserTrackingAndTimestamps(enriched, executionContext, CoreResourceOperation.UPDATE);\n delete withTracking._version;\n delete withTracking._version_db_doc;\n // FIELD-CLEARING CONTRACT — deliberately no adapter work here, stated so its absence reads as a\n // decision rather than as the Mongo arm's twin having been forgotten (these repositories share\n // no base class, so a rule applied in one is invisible from the other).\n //\n // A `null` in this payload means \"this field has no value\". The Mongo arm MUST translate that\n // into `$unset`, because storing a literal null in a field declared `.optional()` produces a row\n // its own read projection then rejects. Here the same null compiles to `SET \"col\" = NULL`, and\n // `omitUnsetColumns` on the read path already turns a NULL column back into an ABSENT key — so\n // for a CLEARED field the observable round trip is identical with no partition, for exactly the\n // reason `atomicConditionalSet`'s `clearFields` needs none on this adapter either.\n //\n // SCOPE, corrected after an independent review flagged the earlier wording as over-broad: that\n // equivalence holds for the CLEARING half of the contract, not for all of it. A field authored\n // `.nullish()` keeps a readable stored `null` on MongoDB and is flattened to an absent key here,\n // because `omitUnsetColumns` drops every null column by design. That divergence pre-dates this\n // contract; what is new is that the contract now says so out loud instead of implying parity.\n // See the table on `partitionNullClearedFields`.\n const toWrite = this.toSqlWriteRow(\n withTracking,\n inheritanceDef,\n ) as Record<string, unknown>;\n // One atomic SQL UPDATE changes the business fields and advances the\n // authorization/optimistic-locking version. A read-then-set increment would\n // lose updates under concurrency.\n toWrite._version_db_doc =\n sql<number>`coalesce(\"_version_db_doc\", 0) + 1`;\n\n // ── The UPDATE re-asserts the CALLER'S predicates, not just the resolved id ────────────────\n //\n // This WHERE used to be built from `{ _id: id }` alone, which silently discarded every\n // predicate the caller supplied beyond identity — so a COMPARE-AND-SWAP such as\n // `update({ taskId, status: { $in: [...] } }, { status: FAILED })` degraded on PostgreSQL into\n // exactly the check-then-act it exists to eliminate: the predicate was evaluated in the SELECT\n // that resolved the id (`resolveSingleId`), then dropped from the statement that writes. Any\n // concurrent writer landing in that gap wins silently.\n //\n // Two consequences made this worth fixing at the root rather than papering over per caller:\n //\n // 1. **MongoDB does NOT behave this way** — it passes the whole filter to `findOneAndUpdate`,\n // so the same code was atomic on one adapter and racy on the other, while the contracts\n // built on top claimed the guarantee unconditionally. An adapter-conditional guarantee is\n // worse than no guarantee, because callers cannot see which one they have.\n // 2. `resolveSingleId` returns EARLY when `_id` is a plain string, without querying at all —\n // so for a `{ _id, status }` filter the extra predicates were dropped from BOTH statements\n // and the swap never happened anywhere. Carrying the base filter here closes that too.\n //\n // Re-asserting is safe: the same filter already compiled through `buildWhere` for the SELECT,\n // and SQL evaluates a WHERE against the PRE-update row, so filtering on a column this statement\n // is also writing is exactly the compare-and-swap semantics intended.\n const baseFilterCarriesPredicates = !!baseFilter\n && typeof baseFilter === 'object'\n && !Array.isArray(baseFilter)\n && Object.keys(baseFilter).length > 0;\n const updateSubject = baseFilterCarriesPredicates\n ? ({ $and: [baseFilter, { _id: id }] } as any)\n : ({ _id: id } as any);\n\n const contextualFilter = this.buildContextualFilter(executionContext, updateSubject, CoreResourceOperation.UPDATE, options);\n if (options?.ifMatchVersion !== undefined) {\n contextualFilter._version_db_doc = options.ifMatchVersion;\n }\n const scopedWhere = this.buildWhere(contextualFilter);\n\n // Same translation as `_doCreate`: an UPDATE can violate a unique constraint too (moving a row\n // onto a value another row already holds), and the Mongo arm wraps its update for that reason.\n let updated: any;\n try {\n updated = await db\n .updateTable(this.tableName)\n .set(toWrite as any)\n .$call((qb: any) => this.filterService.applyWhere(qb, scopedWhere))\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n\n if (!updated) return null;\n return this.transformPersistenceRow(updated, inheritanceDef);\n }\n\n private async _doDelete(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter: IdOrIdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<any> {\n const { baseFilter } = this.buildBaseFilterFromIdOrFilter(id_or_ids_or_filter as any, executionContext);\n const id = await this.resolveSingleId(executionContext, baseFilter, CoreResourceOperation.DELETE, options);\n if (!id) return null;\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Same carry as `_doUpdate` (review finding F5-7). The DELETE's WHERE was built from\n // `{ _id: id }` alone, so a caller's guard predicate survived only in the SELECT that resolved\n // the id — and on the `resolveSingleId` short-circuit (a plain-string `_id`) it was dropped from\n // BOTH statements. MongoDB's `_doDelete` passes the whole filter, so the guarantee was\n // adapter-conditional, which the update fix called \"worse than no guarantee\". Tenancy is\n // re-applied either way, so this was never a scope bypass — but a guarded single delete\n // (`delete({ _id, status: 'draft' })`) silently ignored its guard, and the same file taught two\n // different answers for two verbs.\n const baseFilterCarriesPredicates = !!baseFilter\n && typeof baseFilter === 'object'\n && !Array.isArray(baseFilter)\n && Object.keys(baseFilter).length > 0;\n const deleteSubject = baseFilterCarriesPredicates\n ? ({ $and: [baseFilter, { _id: id }] } as any)\n : ({ _id: id } as any);\n\n const contextualFilter = this.buildContextualFilter(executionContext, deleteSubject, CoreResourceOperation.DELETE, options);\n const scopedWhere = this.buildWhere(contextualFilter);\n\n const deleted = await db\n .deleteFrom(this.tableName)\n .$call((qb: any) => this.filterService.applyWhere(qb, scopedWhere))\n .returningAll()\n .executeTakeFirst();\n\n if (!deleted) return null;\n return this.transformPersistenceRow(deleted, inheritanceDef);\n }\n\n private async _doDeleteMany(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<string[]> {\n const db = await this.getDbOrTrx(options);\n\n const filter = this.normalizeIdsOrFilter(ids_or_filter);\n const contextualFilter = this.buildContextualFilter(executionContext, filter, CoreResourceOperation.DELETE_MANY, options);\n const where = this.buildWhere(contextualFilter);\n\n // Return deleted ids (best-effort; depends on table having _id)\n const deletedRows = await db\n .deleteFrom(this.tableName)\n .$call((qb: any) => this.filterService.applyWhere(qb, where))\n .returning(['_id' as any])\n .execute();\n\n return (deletedRows || [])\n .map((r: any) => r?._id)\n .filter((v: any) => typeof v === 'string' && v.length > 0);\n }\n\n private async _doUpdateMany(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType | undefined,\n data: any,\n options?: RepositoryOptions\n ): Promise<any[]> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const cleaned = this.resourceOperationHelper.cleanInputData(data, CoreResourceOperation.UPDATE_MANY);\n const isBulkOperation = 'isBulkOperation' in operation && operation.isBulkOperation === true;\n const validated = this.repositoriesRegistry.validateRepositoryWriteData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n String(operation.operationIdentifier),\n isBulkOperation,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.UPDATE_MANY,\n options\n );\n\n // WS-C: one patch applied to many rows — an out-of-grant unit value here would move EVERY matched\n // row out of the caller's grant at once, so the same value check applies.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.UPDATE_MANY, executionContext);\n\n // Referential + scope-via-junction integrity for any FK this bulk patch REASSIGNS (adapter-neutral\n // twin of the Mongo `_doUpdateMany` check). Absent FKs skipped; exempt executions exempt at entry.\n await assertUpdateWriteIntegrity(this.writeIntegrityDeps, enriched, CoreResourceOperation.UPDATE_MANY, executionContext, options, referenceConstraintsOf(operation));\n\n const withTracking = this.addUserTrackingAndTimestamps(enriched, executionContext, CoreResourceOperation.UPDATE);\n delete withTracking._version;\n delete withTracking._version_db_doc;\n // Field-clearing contract: a `null` here compiles to `SET \"col\" = NULL` and reads back as an\n // ABSENT key — no partition needed on this adapter. See the full reasoning in `_doUpdate`.\n const toWrite = this.toSqlWriteRow(\n withTracking,\n inheritanceDef,\n ) as Record<string, unknown>;\n toWrite._version_db_doc =\n sql<number>`coalesce(\"_version_db_doc\", 0) + 1`;\n\n const filter = this.normalizeIdsOrFilter(ids_or_filter);\n const contextualFilter = this.buildContextualFilter(executionContext, filter, CoreResourceOperation.UPDATE_MANY, options);\n const where = this.buildWhere(contextualFilter);\n\n const updatedRows = await db\n .updateTable(this.tableName)\n .set(toWrite as any)\n .$call((qb: any) => this.filterService.applyWhere(qb, where))\n .returningAll()\n .execute();\n\n return (updatedRows || []).map((row: any) =>\n this.transformPersistenceRow(row, inheritanceDef),\n );\n }\n\n private async _doList(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n ids_or_filter?: IdsOrFilterType,\n options?: RepositoryOptions & { listOptions?: { page?: number; limit?: number; sort?: Record<string, 1 | -1> }; paginated?: boolean }\n ): Promise<any[] | Resources_PaginatedResult<any>> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const filter = this.normalizeIdsOrFilter(ids_or_filter);\n const contextualFilter = this.buildContextualFilter(executionContext, filter, CoreResourceOperation.LIST, options);\n const where = this.buildWhere(contextualFilter);\n\n const paginated = (options as any)?.paginated ?? false;\n const listOptions = (options as any)?.listOptions;\n const hasPagination = paginated || listOptions?.page !== undefined || listOptions?.limit !== undefined;\n\n let page = 1;\n let limit = 0;\n let offset = 0;\n let total = 0;\n let totalPages = 1;\n\n if (paginated || hasPagination) {\n const countRow = await this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where\n ).executeTakeFirst();\n\n const countVal = (countRow as any)?.count;\n total = typeof countVal === 'number' ? countVal : typeof countVal === 'string' ? Number(countVal) : 0;\n page = Math.max(1, listOptions?.page || 1);\n // Mongo sibling of the same rule. This adapter already defaulted to 20 (so it never produced\n // the whole-collection page the Mongo `_doList` did), but it capped at a hard-coded 100 while\n // ignoring the operation's declared `maxPaginatedResultPerPageLimit` — so an operation\n // declaring 50 could still be asked for 100, and one declaring 200 was silently held to 100.\n // Both adapters now read the same declared ceiling, defaulting to the 100 that was already\n // hard-coded on BOTH sides of this line — see the Mongo sibling for why the default is 100\n // rather than SEARCH's 50.\n const maxLimit = (operation as { maxPaginatedResultPerPageLimit?: number }).maxPaginatedResultPerPageLimit || 100;\n limit = Math.min(maxLimit, Math.max(1, listOptions?.limit || 20));\n offset = (page - 1) * limit;\n totalPages = limit > 0 ? Math.max(1, Math.ceil(total / limit)) : 1;\n }\n\n // Sort mirrors SEARCH (and the mongo adapter): validate the caller-supplied\n // multi-sort against the operation's `sortFields` in priority order, then\n // fall back to createdAt-desc when nothing is requested/configured so an\n // absent `sort` preserves the prior newest-first default.\n const listSortOptions = this.constructValidatedSortOptions(listOptions?.sort, operation);\n let qb: any = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n if (listSortOptions.length > 0) {\n listSortOptions.forEach((s) => {\n qb = qb.orderBy(s.field, s.direction);\n });\n } else if (this.plannedFieldNames.has('createdAt')) {\n qb = qb.orderBy('createdAt', 'desc');\n }\n if (hasPagination) {\n qb = qb.limit(limit).offset(offset);\n }\n\n const rows = await qb.execute();\n const dataRows = rows.map((row: any) =>\n this.transformPersistenceRow(row, inheritanceDef),\n );\n\n if (paginated) {\n return {\n data: dataRows,\n pagination: { page, limit: limit || dataRows.length, total: total || dataRows.length, totalPages },\n };\n }\n\n return dataRows;\n }\n\n private async _doSearch<T = any>(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n searchQuery: string,\n filter: any = {},\n options?: RepositoryOptions & { searchOptions?: { fieldsToSearch?: string[]; page?: number; limit?: number; sort?: any } }\n ): Promise<Resources_PaginatedResult<T>> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Search metadata must come from the same routed operation that controls\n // response shaping. Falling back to a default SEARCH is only for direct\n // helper paths that did not carry the full operation object.\n const searchConfig = ResourceOperationsUtils.getCoreResourceOperationFromOperation(operation) === CoreResourceOperation.SEARCH\n ? operation\n : this.findSearchOperationConfiguration();\n if (!searchConfig) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_SEARCH_NOT_CONFIGURED,\n });\n }\n\n const op = searchConfig as unknown as {\n isSearchable?: boolean;\n maxPaginatedResultPerPageLimit?: number;\n };\n\n if (!op.isSearchable) {\n throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_SEARCH_NOT_ENABLED,\n });\n }\n\n const trimmed = String(searchQuery || '').trim();\n const baseFilter = this.sanitizeRequestFilter(filter, searchConfig);\n\n const page = Math.max(1, options?.searchOptions?.page || 1);\n const maxLimit = op.maxPaginatedResultPerPageLimit || 50;\n const limit = Math.min(maxLimit, Math.max(1, options?.searchOptions?.limit || 20));\n const offset = (page - 1) * limit;\n\n const searchFilter = trimmed\n ? this.constructSearchQuery(trimmed, searchConfig, options?.searchOptions?.fieldsToSearch)\n : {};\n const combinedFilter = trimmed ? ({ $and: [baseFilter, searchFilter] } as any) : baseFilter;\n let contextualFilter = this.buildContextualFilter(executionContext, combinedFilter, CoreResourceOperation.SEARCH, options);\n contextualFilter = await this.applyJunctionScopeFilter(executionContext, contextualFilter);\n const where = this.buildWhere(contextualFilter);\n\n const sortOptions = this.constructValidatedSortOptions(options?.searchOptions?.sort, searchConfig);\n\n let qb: any = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n if (sortOptions.length > 0) {\n sortOptions.forEach((s) => {\n qb = qb.orderBy(s.field, s.direction);\n });\n } else if (this.plannedFieldNames.has('createdAt')) {\n qb = qb.orderBy('createdAt', 'desc');\n }\n\n qb = qb.limit(limit).offset(offset);\n\n const countRow = await this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where\n ).executeTakeFirst();\n\n const countVal = (countRow as any)?.count;\n const total = typeof countVal === 'number' ? countVal : typeof countVal === 'string' ? Number(countVal) : 0;\n\n const rows = await qb.execute();\n const data = rows.map((row: any) =>\n this.transformPersistenceRow<T>(row, inheritanceDef),\n );\n\n return {\n data,\n pagination: { page, limit, total, totalPages: Math.ceil(total / limit) },\n };\n }\n\n private async _doCount(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n filter: any = {},\n options?: RepositoryOptions\n ): Promise<{ count: number }> {\n const db = await this.getDbOrTrx(options);\n let contextualFilter = this.buildContextualFilter(executionContext, filter as any, CoreResourceOperation.COUNT, options);\n contextualFilter = await this.applyJunctionScopeFilter(executionContext, contextualFilter);\n const where = this.buildWhere(contextualFilter);\n\n const qb = this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where\n );\n\n const row = await qb.executeTakeFirst();\n const countVal = (row as any)?.count;\n if (typeof countVal === 'number') return { count: countVal };\n if (typeof countVal === 'string') return { count: Number(countVal) };\n return { count: 0 };\n }\n\n // ===========================================================================\n // DB client resolution\n // ===========================================================================\n\n /**\n * Framework-internal LIST that does NOT require a declared LIST operation.\n *\n * PostgreSQL sibling of the MongoDB method, and the reason it cannot simply call\n * `list()`: that method throws when the resource declares no default LIST, which is\n * exactly the case this exists to serve (data-seed scans by `__seed.seedKey`, and the\n * controller's context-addressed-singleton authorization resolving a singleton id by\n * parent FK). A resource with no user-facing LIST surface must still be listable by\n * framework machinery.\n *\n * The synthetic operation is REPOSITORY_ONLY so it can never be mistaken for an\n * API-facing surface. Contextual filtering still applies — `_doList` builds it — so\n * this bypasses the OPERATION requirement, never the tenant boundary.\n */\n public async listForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>>;\n public async listForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options: RepositoryOptions & { paginated: true; listOptions?: Partial<Resources_PaginationRequest> }\n ): Promise<Resources_PaginatedResult<ConditionalReturnType<T, TMainSchema>>>;\n public async listForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<any> {\n const declaredListOperation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.LIST && op.isOperationDefault === true\n );\n const operation = declaredListOperation ?? ({\n operationIdentifier: CoreResourceOperation.LIST,\n variantType: ResourceOperationVariantType.REPOSITORY_ONLY,\n isOperationDefault: true,\n } as unknown as ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>);\n\n return this._doList(operation as any, executionContext, ids_or_filter, options);\n }\n\n /**\n * System-level membership projection for scope-required reference search.\n *\n * Reads THIS (junction) resource's `targetFkField` values for rows matching\n * `{ [scopeFkField]: scopeId }`. It deliberately BYPASSES operation authorization and\n * contextual filtering — it resolves the in-scope id set for a caller the authorization\n * layer has ALREADY admitted for that scope, so it is a membership projection rather\n * than a user-facing read. The retention hide is still applied, because a retained row\n * must not reappear through a projection either.\n *\n * Rows are read whole and reassembled through `transformPersistenceRow` rather than\n * selecting the single column: a junction FK is not guaranteed to be a planned column —\n * unplanned fields live inside a jsonb root — and only the planner knows how to put a\n * row back together. Junctions are narrow, so reading the row is the cheap, correct\n * option; hand-rolling a jsonb path here would be a second place for that mapping to\n * drift from the planner.\n */\n public async findScopeRelatedTargetIds(\n scopeFkField: string,\n scopeId: string,\n targetFkField: string,\n ): Promise<string[]> {\n const db = await this.getDbOrTrx();\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const baseFilter: Record<string, unknown> = { [scopeFkField]: scopeId };\n const filter = isRetentionGovernedResource(this.resourceConfiguration)\n ? withRetentionHideApplied(baseFilter)\n : baseFilter;\n\n const where = this.buildWhere(filter as ResourceFilter);\n\n /**\n * PROJECT the single column when it is planned, and only fall back to reading whole rows\n * when it is not.\n *\n * The Mongo sibling projects (`{ [targetFkField]: 1, _id: 0 }`), and a junction can hold a\n * large number of rows, so selecting every column would be a real resource regression\n * against the adapter this one is meant to reach parity with. The fallback exists because\n * an UNPLANNED field lives inside a jsonb root, where only the planner knows how to\n * reassemble it — correctness first, but not at the cost of every planned case.\n */\n const targetIsPlannedColumn = this.plannedFieldNames.has(targetFkField);\n const rows = await this.filterService\n .applyWhere(\n targetIsPlannedColumn\n ? db.selectFrom(this.tableName).select(targetFkField)\n : db.selectFrom(this.tableName).selectAll(),\n where,\n )\n .execute();\n\n const ids = new Set<string>();\n for (const row of rows) {\n const value = targetIsPlannedColumn\n ? (row as Record<string, unknown>)[targetFkField]\n : this.transformPersistenceRow<Record<string, unknown>>(row, inheritanceDef)?.[targetFkField];\n if (value === undefined || value === null) {\n continue;\n }\n const id = String(value);\n if (id.length > 0) {\n ids.add(id);\n }\n }\n return [...ids];\n }\n\n /**\n * Aggregate a numeric field across rows matching the filter (feature-limit enforcement).\n *\n * Contextual filtering IS applied — this reads user data and the result gates a quota,\n * so a cross-tenant sum would be both a disclosure and a wrong limit.\n *\n * REFUSES an unplanned field rather than aggregating it. An unplanned field lives inside\n * a jsonb root, where SQL would need an explicit numeric cast that could silently yield\n * NULL (→ 0) for a value that is present but not a number. Returning 0 from a quota\n * check reads as \"nothing consumed\" and would OPEN the limit, so a loud configuration\n * error is the only safe answer. The MongoDB sibling has no equivalent restriction\n * because a document store needs no column plan.\n */\n public async aggregateField(\n executionContext: ExecutionContext<any>,\n filter: ResourceFilter,\n field: string,\n operation: string,\n ): Promise<number> {\n if (!this.plannedFieldNames.has(field)) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message:\n 'aggregateField requires a planned SQL column on PostgreSQL-backed resources; '\n + 'aggregating a jsonb-stored field could silently yield 0 and open the limit it guards.',\n resourceType: this.resourceConfiguration.resourceIdentifier,\n field,\n operation,\n },\n });\n }\n\n const contextualFilter = this.buildContextualFilter(\n executionContext,\n filter ?? {},\n CoreResourceOperation.READ,\n );\n const where = this.buildWhere(contextualFilter);\n const db = await this.getDbOrTrx();\n\n // COALESCE mirrors the Mongo sibling's `$ifNull`: absent rows and NULL values both\n // contribute 0 rather than collapsing the whole aggregate to NULL.\n const aggregate = ((): any => {\n switch (operation) {\n case 'AVG':\n return sql<number>`coalesce(avg(${sql.ref(field)}), 0)`;\n case 'MAX':\n return sql<number>`coalesce(max(${sql.ref(field)}), 0)`;\n case 'SUM':\n default:\n return sql<number>`coalesce(sum(${sql.ref(field)}), 0)`;\n }\n })();\n\n const row = await this.filterService\n .applyWhere(db.selectFrom(this.tableName), where)\n .select(aggregate.as('result'))\n .executeTakeFirst();\n\n return Number(row?.result ?? 0);\n }\n\n /** Scope-required reference search — the RESOLVING half. See the shared authority. */\n private async applyJunctionScopeFilter(\n executionContext: ExecutionContext<any>,\n filter: ResourceFilter,\n ): Promise<ResourceFilter> {\n return applyJunctionScopeFilter({\n filter: filter as Record<string, any>,\n relationshipContexts: executionContext.relationshipContexts as any,\n targetResourceType: this.resourceConfiguration.resourceIdentifier as ResourceType,\n manyToManyScopeJunctions: this.resourceRegistry.getResourcesRegistry().manyToManyScopeJunctions as any,\n getJunctionRepository: (junctionResourceType) =>\n this.repositoriesRegistry.getRepository(junctionResourceType) as any,\n }) as Promise<ResourceFilter>;\n }\n\n private async getDbOrTrx(options?: RepositoryOptions): Promise<any> {\n const tx = this.getTransaction(options);\n if (tx) {\n return tx.nativeSession as any;\n }\n return await this.dbService.getDb();\n }\n\n // ===========================================================================\n // Helpers\n // ===========================================================================\n\n private normalizeIdsOrFilter(ids_or_filter?: IdsOrFilterType): ResourceFilter {\n if (!ids_or_filter) return {};\n if (Array.isArray(ids_or_filter)) return { _id: { $in: ids_or_filter } } as any;\n if (typeof ids_or_filter === 'object' && ids_or_filter !== null && 'ids' in (ids_or_filter as any)) {\n const ids = (ids_or_filter as any).ids;\n const filter = (ids_or_filter as any).filter;\n const base = Array.isArray(ids) ? { _id: { $in: ids } } : {};\n return filter ? ({ $and: [base, filter] } as any) : (base as any);\n }\n return ids_or_filter as any;\n }\n\n /**\n * Validate an ID using ResourceIdBackendService if available.\n * For PostgreSQL, IDs should be valid UUIDs.\n *\n * @param id - The ID to validate\n * @param executionContext - Execution context for error handling\n * @throws Error if ID is invalid\n */\n private validateId(id: string, executionContext: ExecutionContext<any>): void {\n if (this.resourceIdService) {\n const resourceType = String(this.resourceConfiguration.resourceIdentifier);\n if (!this.resourceIdService.validateForResource(id, resourceType)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { resourceType, id }, // diagnostic (log-only)\n });\n }\n }\n }\n\n private buildBaseFilterFromIdOrFilter(\n id_or_filter: IdOrFilterType,\n executionContext: ExecutionContext<any>\n ): { baseFilter: ResourceFilter } {\n let baseFilter: ResourceFilter = {};\n if (!id_or_filter) return { baseFilter };\n\n if (typeof id_or_filter === 'string') {\n this.validateId(id_or_filter, executionContext);\n baseFilter = { _id: id_or_filter } as any;\n } else if (typeof id_or_filter === 'object' && !Array.isArray(id_or_filter)) {\n if ('id' in (id_or_filter as any)) {\n const id = (id_or_filter as any).id;\n if (typeof id === 'string') this.validateId(id, executionContext);\n baseFilter = { _id: id } as any;\n const extra = (id_or_filter as any).filter;\n if (extra && Object.keys(extra).length > 0) {\n baseFilter = { $and: [baseFilter, extra] } as any;\n }\n } else if ('id_or_ids' in (id_or_filter as any)) {\n const ids = (id_or_filter as any).id_or_ids;\n if (typeof ids === 'string') {\n this.validateId(ids, executionContext);\n baseFilter = { _id: ids } as any;\n } else if (Array.isArray(ids)) {\n ids.forEach((id: string) => this.validateId(id, executionContext));\n baseFilter = { _id: { $in: ids } } as any;\n }\n const extra = (id_or_filter as any).filter;\n if (extra && Object.keys(extra).length > 0) {\n baseFilter = { $and: [baseFilter, extra] } as any;\n }\n } else {\n baseFilter = id_or_filter as any;\n }\n } else {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n });\n }\n\n return { baseFilter };\n }\n\n private buildContextualFilter(\n executionContext: ExecutionContext<any>,\n baseFilter: ResourceFilter,\n /**\n * The core operation THIS repository call is executing — NOT `executionContext.operation`. The\n * retention authority classifies it to decide whether a see-through EC may suppress the hide\n * (read-family only); see `assignRetentionHideForOperation`.\n */\n executedCoreOperation: CoreResourceOperation,\n options?: RepositoryOptions\n ): ResourceFilter {\n // Translate the date-range filter vocabulary (`{ startDate?, endDate? }`) into `{ $gte?, $lte? }`\n // BEFORE `buildWhereExpression` compiles it — its comparison compiler already handles `$gte`/`$lte`,\n // whereas a raw `{startDate,endDate}` would be treated as a nested-path equality and never filter.\n // Same shared helper the Mongo adapter's `buildContextualFilter` calls (single source of truth).\n const contextualFilter: ResourceFilter = normalizeDateRangeFilters({ ...(baseFilter || {}) }) as any;\n\n // ── M5a: retention hide predicate (privacy boundary) — Postgres sibling of the Mongo chokepoint.\n // Both adapters call the SAME retention authority, which is the whole point: the two used to carry\n // hand-written copies of the predicate and silently disagreed about NULL markers (gate G-PG-NULL)\n // until the PostgreSQL compilers were taught to emit `IS DISTINCT FROM` for `ne`. The authority's\n // emitter documents that operator choice as load-bearing, so the parity cannot be re-lost here.\n //\n // Placement is identical to the Mongo sibling and equally deliberate: BEFORE the\n // `excludeContextualFilter` (SCOPE-bypass) early-return, and writing at the TOP LEVEL so an\n // injected `retentionStatus: RETAINED` is neutralised rather than honoured.\n assignRetentionHideForOperation(\n contextualFilter,\n this.resourceConfiguration,\n executionContext,\n executedCoreOperation,\n );\n\n if (options?.excludeContextualFilter === true) {\n return contextualFilter;\n }\n\n const blacklistedFields = new Set<string>();\n blacklistedFields.add(this.resourceConfiguration.resourceFieldIdentifier);\n if (Array.isArray(options?.excludeContextualFilter)) {\n options.excludeContextualFilter.forEach((f) => blacklistedFields.add(f));\n }\n\n // D1 CLOSED — scope-required reference search, the SKIP half. Its resolving half runs in\n // `_doSearch`/`_doCount` below; the two travel together by construction (shared module), which\n // is what makes adding the skip safe now and would have made it a tenancy leak before.\n const junctionScopedFieldIdentifiers = collectJunctionScopedFieldIdentifiers({\n relationshipContexts: executionContext.relationshipContexts,\n allResourceFieldIdentifiers: this.resourceRegistry?.getResourcesRegistry()?.allResourceFieldIdentifiers,\n });\n\n const contextResourceIds = executionContext.getContextResourceIds();\n contextResourceIds.forEach((resourceId, fieldIdentifier) => {\n if (blacklistedFields.has(fieldIdentifier)) return;\n // Resolved THROUGH the junction, not a column here — skipping avoids the fail-closed\n // \"missing from schema\" check that previously refused these routes outright.\n if (junctionScopedFieldIdentifiers.has(fieldIdentifier)) return;\n\n // Adapter parity with the Mongo repository: a resource's PRIMARY-SCOPE FK is not always\n // modeled in its Zod main schema (a schema shared across scopes cannot author one — see the\n // ORGANIZATION_FEATURES / ScopeFeatures case documented on the Mongo path), yet it IS a real\n // persisted column contributed by the relationship. Filtering it must not fail closed, or an\n // org-scoped request cannot delete a tenant at all.\n //\n // PostgreSQL can be stricter than Mongo here, and should be: the column must actually be\n // PLANNED, otherwise the filter would be a SQL error rather than a no-op. `plannedFieldNames`\n // is the persisted-column truth this adapter already trusts for the org-scoping block below.\n const primaryScopeFieldIdentifier = this.resourceConfiguration.resourcePrimaryScope\n ? PRIMARY_SCOPE_TO_FIELD_IDENTIFIER[this.resourceConfiguration.resourcePrimaryScope]\n : undefined;\n if (\n fieldIdentifier === primaryScopeFieldIdentifier\n && this.plannedFieldNames.has(fieldIdentifier)\n && this.resourceOperationHelper.findNestedFieldPathsFromZodSchema(\n this.resourceConfiguration.mainSchema,\n fieldIdentifier,\n ).length === 0\n ) {\n // AUTHORITATIVE — see the Mongo sibling and `applyAuthoritativeContextFilterValue`. Both\n // adapters route through the one authority precisely because a predicate added to one of\n // them has historically been a bypass on the other.\n this.resourceOperationHelper.applyAuthoritativeContextFilterValue(\n contextualFilter, fieldIdentifier, resourceId,\n { fieldIdentifier, resourceIdentifier: String(this.resourceConfiguration.resourceIdentifier) },\n );\n return;\n }\n\n const allMatchingPaths = this.resourceOperationHelper.findRequiredNestedFieldPathsFromZodSchema(\n this.resourceConfiguration.mainSchema,\n fieldIdentifier,\n executionContext,\n {\n reason: 'context_filter',\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n message: `Execution context field '${fieldIdentifier}' is missing from schema for resource '${this.resourceConfiguration.resourceIdentifier}' during contextual filtering`,\n }\n );\n /*\n * THE SCOPE FIELD FILTERS AT THE TOP LEVEL ONLY — the third site of the same invariant fixed\n * on 2026-09-01 (the initiator-organization confinement, the Mongo context block, and this\n * twin), and the one that was actually RUNNING when the defect was measured: this adapter\n * served `wildoApplicationActorTasks`, whose schema nests\n * `errorStates.errorItems.initiatorIds.organizationId` (a recorded error's initiator — data,\n * not tenancy), and the unrestricted sweep put that dotted path into the filter, which this\n * adapter's compiler refused as an invalid column reference — a 400 on every LIST. Read the\n * Mongo sibling's block comment for the full account, including why Mongo's failure mode for\n * the same sweep is WORSE (silent row-hiding rather than a crash). The write path had already\n * learned this lesson (`enrichDataWithContextFields`: \"Deep matches inside embedded payloads\n * are never the scope column\").\n */\n const isScopeField = fieldIdentifier === primaryScopeFieldIdentifier;\n const matchingPaths = isScopeField\n ? allMatchingPaths.filter((fullPath) => fullPath === fieldIdentifier)\n : allMatchingPaths;\n if (isScopeField && matchingPaths.length === 0 && allMatchingPaths.length > 0) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n reason: 'scope_field_modeled_only_nested',\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n fieldIdentifier,\n nestedPaths: allMatchingPaths,\n message: `Scope field '${fieldIdentifier}' appears only NESTED in the schema for resource `\n + `'${this.resourceConfiguration.resourceIdentifier}'. A scoped resource carries its scope FK as a `\n + 'top-level column (the write path injects it there); a nested occurrence of the name is data. '\n + 'Refusing rather than widening the query beyond its tenant.',\n },\n });\n }\n matchingPaths.forEach((fullPath) => {\n /**\n * D2 — resolve a SURROGATE primary key to the queryable column.\n *\n * A surrogate PK (FILES `fileId`) exists in the Zod schema but is persisted as `_id`,\n * so filtering on the authored name targets a column that does not exist. The\n * resolver is shared, adapter-neutral, and the Mongo sibling has always called it;\n * this adapter simply did not, which is the whole of divergence D2.\n *\n * The old behaviour was loud rather than silent (a SQL error on the unknown column),\n * so this fixes a broken path rather than closing a leak — but a surrogate-PK-keyed\n * context filter could not work on PostgreSQL at all until now.\n */\n const filterPath = this.resourceOperationHelper.resolveQueryableFilterPath(\n this.resourceConfiguration.mainSchema,\n fullPath,\n );\n this.resourceOperationHelper.applyAuthoritativeContextFilterValue(\n contextualFilter, filterPath, resourceId,\n { fieldIdentifier, resourceIdentifier: String(this.resourceConfiguration.resourceIdentifier) },\n );\n });\n });\n\n // D3 — initiator-organization confinement, now CROSSING-AWARE and shared with Mongo.\n // This adapter applied it and Mongo did not; worse, it did not know about declared\n // cross-tenant doors, so an operation authorization had admitted was silently re-confined\n // to the operator's own tenant. `plannedFieldNames` stays the persistence predicate here:\n // this adapter knows which columns exist, and filtering on an unplanned one is a SQL error.\n assignInitiatorOrganizationConfinementToFilter({\n filter: contextualFilter,\n executionContext,\n blacklistedFields,\n mainSchema: this.resourceConfiguration.mainSchema,\n schemaPaths: this.resourceOperationHelper,\n isFieldPersisted: (fieldName) => this.plannedFieldNames.has(fieldName),\n });\n\n // Defense-in-depth: enforce userId = null for ANONYMOUS scope on isAnonymizable resources.\n //\n // Adapter-neutral twin of the Mongo arm — read the note there for why this presence-blind\n // equality is sound. On SQL a column always exists, so \"absent\" and NULL are the same state\n // by construction and this predicate cannot be split the way MongoDB's can; the guarantee it\n // relies on is the same one, namely that `isAnonymizable` forces `userId` to accept null.\n if (executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable) {\n const userPaths = this.resourceOperationHelper.findNestedFieldPathsFromZodSchema(\n this.resourceConfiguration.mainSchema, 'userId'\n );\n userPaths.forEach(fullPath => {\n this.resourceOperationHelper.setNestedValue(contextualFilter, fullPath, null);\n });\n }\n\n this.applyFKRelationshipFilters(executionContext, contextualFilter, blacklistedFields);\n\n // ── WS-C: organization-unit narrowing — PostgreSQL sibling of the Mongo chokepoint.\n // Both adapters call the SAME enforcement authority, and that is the whole point: a narrowing\n // rule present on one adapter and absent on the other is not a gap, it is an authorization bypass\n // on the adapter that lacks it — the shape that produced gate G-PG-NULL for the retention hide.\n // The emitted `$in` predicate (including the empty-array deny-all) is compiled portably here; see\n // the authority's emitter documentation before changing the operator.\n // Placement is identical to the Mongo sibling and equally deliberate: AFTER the\n // `excludeContextualFilter` scope-bypass return, LAST, and writing at the TOP LEVEL.\n assignOrganizationUnitNarrowingToFilter(\n contextualFilter,\n this.resourceConfiguration.resourceIdentifier,\n this.resourceRegistry?.getResourcesRegistry()?.organizationUnitNarrowing,\n executionContext,\n );\n\n // ── Scope-ROOT collection confinement — MongoDB sibling of the same authority ─────────────────\n // See the Mongo call site for the full reasoning. The `$in` (including the empty-array deny-all)\n // compiles portably here; this adapter's compiler emits `FALSE` for an empty `IN`, which is why\n // the authority can ship ONE emitter for the confined and the fail-closed case.\n assignScopeRootCollectionConfinementToFilter({\n filter: contextualFilter,\n executionContext,\n resourceConfiguration: this.resourceConfiguration,\n executedCoreOperation: executedCoreOperation,\n });\n\n return contextualFilter;\n }\n\n /**\n * Refuse a write whose unit-field value falls outside the caller's unit grant (WS-C) — PostgreSQL\n * sibling of the Mongo guard, sharing the same authority for the same anti-divergence reason.\n *\n * assurance-control: WILDO.ACCESS.SCOPE_CONFINEMENT — least-privilege confinement on the WRITE side.\n */\n /**\n * TENANT COHERENCE on the narrowing dimension — the PostgreSQL twin.\n *\n * Symmetric with the MongoDB adapter by obligation, not by taste: this rule's own module header\n * records that a narrowing rule present on one adapter and absent on the other \"is not a cosmetic\n * gap — it is an authorization bypass on one adapter\". The shared half (which value to check) lives\n * in `resolveSuppliedOrganizationUnitIdForTenantCheck`; only the scoped read differs, and it does not\n * differ much because `readForInternalScan` is a shared repository contract.\n *\n * See the MongoDB adapter's copy for WHY an `UNRESTRICTED` caller needs this at all: the grant check\n * returns before examining the value, so an organization-wide admin could otherwise name another\n * tenant's unit and orphan the row against a grant nobody in its tenant can hold.\n */\n private async assertOrganizationUnitBelongsToCallerTenant(\n payload: unknown,\n executedCoreOperation: CoreResourceOperation,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n const suppliedUnitId = resolveSuppliedOrganizationUnitIdForTenantCheck(\n payload as Record<string, unknown> | null | undefined,\n this.resourceConfiguration.resourceIdentifier,\n this.resourceRegistry?.getResourcesRegistry()?.organizationUnitNarrowing,\n );\n if (!suppliedUnitId) return;\n if (isOrganizationUnitNarrowingExemptExecution(executionContext.executionType)) return;\n\n const unitRepository = this.repositoriesRegistry?.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n if (!unitRepository) return;\n\n // `excludeContextualFilter: true` + an EXPLICIT tenant comparison, rather than letting the\n // contextual filter do it. Borrowing the caller's execution context for a read of a DIFFERENT\n // resource is the documented way to produce a 500: that context carries THIS resource's field\n // identifier, and `buildContextualFilter` fails closed on `organizationUnits` with\n // \"Execution context field 'teamGoalId' is missing from schema\" (reason `context_filter`).\n // Observed exactly that before this line existed.\n //\n // Nothing is weakened by the bypass — the scope question is simply asked here instead, against the\n // tenant the ROW is being written into (falling back to the caller's own), which is the same\n // comparison `authorizeOrganizations` makes for a fetched row. The retention hide is unaffected:\n // it is applied BEFORE that early-return by design.\n const unit = await unitRepository.readForInternalScan(\n executionContext as never,\n { _id: suppliedUnitId },\n { excludeContextualFilter: true },\n );\n\n const writeTenantId = String(\n (payload as Record<string, unknown> | null | undefined)?.organizationId\n ?? executionContext.initiatorIds?.organizationId\n ?? '',\n );\n const unitTenantId = String((unit as { organizationId?: unknown } | null)?.organizationId ?? '');\n\n // Three ways to reach the refusal below, and the third is a DECISION rather than an oversight:\n // 1. no such unit anywhere — `unit` is null\n // 2. the unit belongs to another tenant — the ids differ\n // 3. the write's tenant is undeterminable — `writeTenantId` is empty\n //\n // (3) fails CLOSED deliberately. A unit-narrowed resource is organization-scoped by construction\n // (a unit belongs to an organization), so a write that carries no tenant on the payload and whose\n // principal has none either cannot have its unit reference verified at all — and this module's\n // governing rule is that an inability to verify must never read as permission. Exempt execution\n // types were already returned above, so this does not catch batches, cascades or webhooks.\n //\n // Do not \"simplify\" the emptiness test away: it looks like a defensive string check and is\n // actually the third branch.\n if (unit && writeTenantId && unitTenantId === writeTenantId) return;\n\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.AUTHORIZATIONS_ACCESS_DENIED,\n context: {\n reason: OrganizationUnitNarrowingWriteViolationReason.UNIT_OUTSIDE_TENANT,\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n executedCoreOperation,\n attemptedOrganizationUnitId: suppliedUnitId,\n },\n });\n }\n\n /**\n * Deps bundle for the ADAPTER-NEUTRAL write-integrity authority\n * (`resource-write-integrity.backend.ts`), on both CREATE and UPDATE. Identical shape to the MongoDB\n * repository's — the whole point of the shared authority is that FK-existence-in-scope,\n * scope-via-junction-membership, and top-level-mainSchema-check enforcement cannot diverge between the\n * two persistence adapters.\n */\n private get writeIntegrityDeps(): ResourceWriteIntegrityDeps {\n return {\n resourceConfiguration: this.resourceConfiguration,\n resourceRegistry: this.resourceRegistry,\n repositoriesRegistry: this.repositoriesRegistry,\n errorBuilder: this.errorBuilder,\n };\n }\n\n private async assertOrganizationUnitWriteWithinGrant(\n payload: unknown,\n executedCoreOperation: CoreResourceOperation,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n await this.assertOrganizationUnitBelongsToCallerTenant(payload, executedCoreOperation, executionContext);\n\n const violation = resolveOrganizationUnitNarrowingWriteViolation(\n payload as Record<string, unknown> | null | undefined,\n executedCoreOperation,\n this.resourceConfiguration.resourceIdentifier,\n this.resourceRegistry?.getResourcesRegistry()?.organizationUnitNarrowing,\n executionContext,\n );\n if (!violation) return;\n\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.AUTHORIZATIONS_ACCESS_DENIED,\n context: {\n // diagnostic (log-only)\n reason: violation.reason,\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n executedCoreOperation,\n unitFieldName: violation.unitFieldName,\n grantedOrganizationUnitIds: violation.grantedOrganizationUnitIds,\n attemptedOrganizationUnitId: violation.attemptedOrganizationUnitId,\n },\n });\n }\n\n private applyFKRelationshipFilters(\n executionContext: ExecutionContext<any>,\n filter: ResourceFilter,\n blacklistedFields: Set<string>\n ): void {\n assignRelationshipForeignKeyFiltersToFilter({\n filter,\n executionContext,\n blacklistedFields,\n resourceIdentifier: String(this.resourceConfiguration.resourceIdentifier),\n mainSchema: this.resourceConfiguration.mainSchema,\n schemaPaths: this.resourceOperationHelper,\n });\n }\n\n /**\n * Resolve the single row a filter-shaped write targets.\n *\n * `executedCoreOperation` is the WRITE the caller is about to perform (UPDATE / DELETE), not READ:\n * this lookup is the first half of that mutation, so it applies the same retention hide the mutation\n * itself will. Defense-in-depth rather than a standalone hole — `_doUpdate` / `_doDelete` re-run\n * `buildContextualFilter` on the resolved `{ _id }`, so a retained row would fail to match there\n * anyway — but classifying a write's own id-resolution step as a READ is exactly the ambiguity that\n * produced the guard's original defect, and it would become a live hole the moment a caller used the\n * resolved id without re-filtering.\n */\n private async resolveSingleId(\n executionContext: ExecutionContext<any>,\n baseFilter: ResourceFilter,\n executedCoreOperation: CoreResourceOperation,\n options?: RepositoryOptions\n ): Promise<string | null> {\n if (baseFilter && typeof baseFilter === 'object' && !Array.isArray(baseFilter) && '_id' in baseFilter) {\n const idVal = (baseFilter as any)._id;\n if (typeof idVal === 'string') return idVal;\n if (idVal && typeof idVal === 'object' && Array.isArray((idVal as any).$in) && (idVal as any).$in.length > 0) {\n return (idVal as any).$in[0];\n }\n }\n\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter, executedCoreOperation, options);\n const where = this.buildWhere(contextualFilter);\n const db = await this.getDbOrTrx(options);\n\n let qb: any = this.filterService.applyWhere(db.selectFrom(this.tableName).select(['_id' as any]), where);\n if (this.plannedFieldNames.has('createdAt')) {\n qb = qb.orderBy('createdAt', 'desc');\n }\n const row = await qb.executeTakeFirst();\n return row?._id ?? null;\n }\n\n private findSearchOperationConfiguration():\n | ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>\n | null {\n const searchOperations = Array.from(this.operationsMap.values()).filter(\n operation => operation.operationIdentifier === CoreResourceOperation.SEARCH\n );\n const defaultSearchOperations = searchOperations.filter(\n operation => operation.isOperationDefault === true\n );\n if (defaultSearchOperations.length > 1) {\n this.logDebug('Ambiguous default SEARCH operation configurations', {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n candidateVariants: defaultSearchOperations.map((operation) => ({\n variantType: operation.variantType,\n variantKey: operation.variantKey,\n })),\n });\n return null;\n }\n return defaultSearchOperations[0] ?? searchOperations[0] ?? null;\n }\n\n private constructSearchQuery(\n searchQuery: string,\n searchConfig: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n fieldsOverride?: string[]\n ): ResourceFilter {\n if (!searchQuery?.trim()) return {};\n\n const op = searchConfig as unknown as { searchableFields?: Array<string | object> };\n const rawSearchableFields = Array.isArray(op.searchableFields) ? op.searchableFields : [];\n // Relational `searchableFields` descriptors (objects) are resolved only by the\n // Mongo adapter today, which folds related matches into an `$in` (see\n // repository-resource.backend.service.ts `findSearchMatchTargetIds`). The\n // PostgreSQL adapter supports own-column search only, so keep the string\n // entries and skip descriptors: a relational entry degrades to own-field\n // search rather than corrupting the query. Parity tracked in\n // `.claude/plans/generic-relational-search.md` (D4).\n const allowed = rawSearchableFields.filter((f): f is string => typeof f === 'string');\n if (allowed.length !== rawSearchableFields.length) {\n this.logger.warn(`Relational searchableFields descriptors are not yet supported on the PostgreSQL adapter for resource '${String(this.resourceConfiguration.resourceIdentifier)}'; applying own-column search only.`);\n }\n const fields = Array.isArray(fieldsOverride) && fieldsOverride.length > 0\n ? fieldsOverride.filter((f) => allowed.includes(f))\n : allowed;\n const orClauses = fields.map((f) => ({ [f]: { $contains: searchQuery, $options: 'i' } } as any));\n return orClauses.length > 0 ? ({ $or: orClauses } as any) : {};\n }\n\n private sanitizeRequestFilter(\n filter: ResourceFilter,\n searchConfig: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>\n ): ResourceFilter {\n if (!filter || typeof filter !== 'object') return {};\n const { filterFields } = searchConfig as unknown as { filterFields?: Record<string, unknown> };\n if (!filterFields || Object.keys(filterFields).length === 0) return filter;\n const allowedKeys = Object.keys(filterFields);\n const allowField = (field: string): boolean =>\n allowedKeys.includes(field) || allowedKeys.some((a) => field.startsWith(`${a}.`));\n\n const sanitizeObject = (obj: any): any => {\n if (!obj || typeof obj !== 'object') return obj;\n const out: any = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key === '$and' || key === '$or') {\n if (Array.isArray(value)) {\n const arr = value.map((v) => sanitizeObject(v)).filter((v) => v && Object.keys(v).length > 0);\n if (arr.length > 0) out[key] = arr;\n }\n continue;\n }\n if (key === '$not') {\n const inner = sanitizeObject(value as any);\n if (inner && Object.keys(inner).length > 0) out[key] = inner;\n continue;\n }\n if (allowField(key)) out[key] = value;\n }\n return out;\n };\n\n return sanitizeObject(filter);\n }\n\n private constructValidatedSortOptions(\n requestedSort: Record<string, 1 | -1> | undefined,\n searchConfig: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>\n ): Array<{ field: string; direction: 'asc' | 'desc' }> {\n const op = searchConfig as unknown as { sortFields?: readonly string[] };\n const sortFields = Array.isArray(op.sortFields)\n ? (op.sortFields as string[])\n : [];\n const validated: Array<{ field: string; direction: 'asc' | 'desc' }> = [];\n\n if (sortFields.length === 0) {\n // ADAPTER PARITY with the Mongo twin (`RepositoryResourceBackendService`).\n // When the operation declares no `sortFields` whitelist there is nothing to\n // validate against, and Mongo returns the caller's `sort` VERBATIM. Returning\n // `[]` here — the prior behavior — silently DISCARDED the caller's sort and\n // let the call site's `createdAt DESC` fallback take over instead (or, on a\n // resource with no `createdAt` column, no ORDER BY at all).\n //\n // That divergence is a correctness bug, not a cosmetic one, for any internal\n // forward-paging scan. Those page with `createdAt > mark` ASC and advance the\n // mark to the LAST row of each page. Served DESC, that \"last row\" is the\n // OLDEST row of the NEWEST page — so the mark leaps forward over every event\n // in between (permanently skipped, never re-read because the next filter is\n // strictly greater) while the following page re-reads rows already seen.\n // `immudb-audit-reconcile` is exactly this shape and would have silently lost\n // audit records on a PostgreSQL-backed `AUDIT_LOGS`.\n //\n // Unlike Mongo's schemaless passthrough, PostgreSQL must name a REAL column:\n // an unknown identifier is both a SQL error and an injection surface. So when\n // the operation supplies no whitelist we fall back to the resource's planned\n // columns as the whitelist rather than dropping the sort — honoring the\n // caller's intent while staying fail-closed on unknown identifiers.\n if (!requestedSort) {\n return validated;\n }\n Object.entries(requestedSort).forEach(([field, dir]) => {\n if (this.plannedFieldNames.has(field) && (dir === 1 || dir === -1)) {\n validated.push({ field, direction: dir === 1 ? 'asc' : 'desc' });\n }\n });\n return validated;\n }\n if (!requestedSort) {\n const first = sortFields[0];\n return first ? [{ field: first, direction: 'desc' }] : validated;\n }\n\n Object.entries(requestedSort).forEach(([field, dir]) => {\n if (sortFields.includes(field) && (dir === 1 || dir === -1)) {\n validated.push({ field, direction: dir === 1 ? 'asc' : 'desc' });\n }\n });\n\n return validated;\n }\n\n private addUserTrackingAndTimestamps(\n enrichedData: any,\n executionContext: ExecutionContext<any>,\n operation: CoreResourceOperation\n ): any {\n const out = { ...(enrichedData || {}) };\n const userId = (executionContext as any)?.initiatorIds?.userId;\n const now = new Date();\n\n if (operation === CoreResourceOperation.CREATE) {\n if (this.plannedFieldNames.has('createdAt') && !out.createdAt) out.createdAt = now;\n if (this.plannedFieldNames.has('updatedAt') && !out.updatedAt) out.updatedAt = now;\n if (userId && this.plannedFieldNames.has('createdByUserId') && !out.createdByUserId) out.createdByUserId = userId;\n }\n\n if (operation === CoreResourceOperation.UPDATE) {\n if (this.plannedFieldNames.has('updatedAt')) out.updatedAt = now;\n if (userId && this.plannedFieldNames.has('updatedByUserId') && !out.updatedByUserId) out.updatedByUserId = userId;\n if (userId && this.plannedFieldNames.has('lastUpdatedByUserId') && !out.lastUpdatedByUserId) out.lastUpdatedByUserId = userId;\n }\n\n return out;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"postgresql-resource-repository.backend.service.js","sourceRoot":"","sources":["../../../../../../src/base-classes/services/repositories/postgresql-resource-repository.backend.service.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,qBAAqB,EACrB,gBAAgB,EAChB,2BAA2B,EAC3B,SAAS,EAET,kBAAkB,EAClB,iCAAiC,EACjC,uBAAuB,EACvB,4BAA4B,EAC5B,kCAAkC,EAGlC,8BAA8B,GAC/B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,8CAA8C,EAAE,MAAM,uFAAuF,CAAC;AACvJ,OAAO,EAAE,4CAA4C,EAAE,MAAM,sFAAsF,CAAC;AACpJ,OAAO,EAAE,+BAA+B,EAAE,MAAM,wEAAwE,CAAC;AACzH,OAAO,EACL,wBAAwB,EACxB,qCAAqC,GACtC,MAAM,8EAA8E,CAAC;AACtF,OAAO,EAAE,2CAA2C,EAAE,MAAM,oFAAoF,CAAC;AACjJ,OAAO,EAAE,0BAA0B,EAAE,0BAA0B,EAAE,sBAAsB,EAAmC,MAAM,wFAAwF,CAAC;AACzN,OAAO,EACL,uCAAuC,EACvC,0CAA0C,EAC1C,6CAA6C,EAC7C,8CAA8C,EAC9C,+CAA+C,GAChD,MAAM,4FAA4F,CAAC;AACpG,OAAO,EAAE,mBAAmB,EAAE,MAAM,8EAA8E,CAAC;AACnH,OAAO,EAAE,sCAAsC,EAAE,MAAM,oGAAoG,CAAC;AAC5J,OAAO,EACL,sBAAsB,EACtB,yBAAyB,GAC1B,MAAM,2EAA2E,CAAC;AACnF,OAAO,EACL,gC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C,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS;gBAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC;YACnF,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS;gBAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC;YACnF,IAAI,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe;gBAAE,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;QACpH,CAAC;QAED,IAAI,SAAS,KAAK,qBAAqB,CAAC,MAAM,EAAE,CAAC;YAC/C,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,WAAW,CAAC;gBAAE,GAAG,CAAC,SAAS,GAAG,GAAG,CAAC;YACjE,IAAI,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,eAAe;gBAAE,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC;YAClH,IAAI,MAAM,IAAI,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,qBAAqB,CAAC,IAAI,CAAC,GAAG,CAAC,mBAAmB;gBAAE,GAAG,CAAC,mBAAmB,GAAG,MAAM,CAAC;QAChI,CAAC;QAED,OAAO,GAAG,CAAC;IACb,CAAC;CACF","sourcesContent":["import type {\n ResourceConfiguration,\n ResourceConfiguration_Operation,\n ResourceConfiguration_OperationRepositoryPath,\n ResourceType,\n SearchableRelationDescriptor,\n} from '@wildo-ai/saas-models';\nimport {\n CoreResourceOperation,\n CoreResourceType,\n ErrorCustomMessageReference,\n ErrorType,\n type WildoError_Backend,\n PersistenceAdapter,\n PRIMARY_SCOPE_TO_FIELD_IDENTIFIER,\n ResourceOperationsUtils,\n ResourceOperationVariantType,\n ResourcesConfig_OperationPathUtils,\n Resources_PaginationRequest,\n Resources_PaginatedResult,\n isSearchableRelationDescriptor,\n} from '@wildo-ai/saas-models';\nimport { assignInitiatorOrganizationConfinementToFilter } from '~wildo-backend-lib/security/authorizations/initiator-organization-confinement.backend';\nimport { assignScopeRootCollectionConfinementToFilter } from '~wildo-backend-lib/security/authorizations/scope-root-collection-confinement.backend';\nimport { assignRetentionHideForOperation } from '~wildo-backend-lib/compliance/privacy/retention-hide-predicate.backend';\nimport {\n applyJunctionScopeFilter,\n collectJunctionScopedFieldIdentifiers,\n} from '~wildo-backend-lib/security/authorizations/junction-scope-resolution.backend';\nimport { assignRelationshipForeignKeyFiltersToFilter } from '~wildo-backend-lib/security/authorizations/relationship-foreign-key-filter.backend';\nimport { assertCreateWriteIntegrity, assertUpdateWriteIntegrity, referenceConstraintsOf, type ResourceWriteIntegrityDeps } from '~wildo-backend-lib/base-classes/services/repositories/resource-write-integrity.backend';\nimport {\n assignOrganizationUnitNarrowingToFilter,\n isOrganizationUnitNarrowingExemptExecution,\n OrganizationUnitNarrowingWriteViolationReason,\n resolveOrganizationUnitNarrowingWriteViolation,\n resolveSuppliedOrganizationUnitIdForTenantCheck,\n} from '~wildo-backend-lib/security/authorizations/organization-unit-narrowing-enforcement.backend';\nimport { describeCaughtError } from '~wildo-backend-lib/errors/utils/error-log-level-classification.backend.utils';\nimport { resolveDeclaredUniqueConflictReference } from '~wildo-backend-lib/base-classes/services/repositories/unique-constraint-conflict-reference.backend';\nimport {\n buildBusinessKeyFilter,\n BUSINESS_KEY_ERROR_PREFIX,\n} from '~wildo-backend-lib/data-seeding/models/business-key-resolver.shared.utils';\nimport {\n DATA_SEED_ROW_METADATA_FIELD_KEY,\n type DataSeedRowMetadata,\n} from '~wildo-backend-lib/data-seeding/models/data-seed-row-metadata.shared.schemas';\nimport type { ResourceFilter } from '~wildo-backend-lib/databases/models/filter.backend.schemas';\nimport { normalizeDateRangeFilters } from '~wildo-backend-lib/databases/models/filter.backend.schemas';\nimport type { TransactionContext } from '~wildo-backend-lib/databases/models/transaction.shared.schemas';\nimport type { EnumLikeType } from '@wildo-ai/zod-decorators';\nimport { z } from 'zod';\nimport { getZodObjectShape } from '@wildo-ai/zod-decorators';\n\nimport type { LoggerService } from '~wildo-backend-lib/monitoring/logger/services/logger.service';\nimport type { ErrorBuilderBackendService } from '~wildo-backend-lib/errors/services/error-builder.backend.service';\nimport type { ResourcesRegistryBackendService } from '~wildo-backend-lib/resources/services/resources-registry.backend.service';\nimport type { ResourceOperationHelperBackendService } from '~wildo-backend-lib/base-classes/services/resource-operations-helper.backend.service';\nimport type {\n IdOrFilterType,\n IdOrIdsOrFilterType,\n IdsOrFilterType,\n RepositoryOptions,\n} from '~wildo-backend-lib/base-classes/models/repositories.backend.schemas';\nimport type { SqlWhereExpression } from '~wildo-backend-lib/databases/models/sql.backend.schemas';\nimport type { PostgreSQLDatabaseBackendService } from '~wildo-backend-lib/databases/services/postgresql-database.backend.service';\nimport { PostgreSQLFilterBackendService } from '~wildo-backend-lib/databases/services/postgresql-filter.backend.service';\nimport { ZodToSqlHybridSchemaPlannerBackendService } from '~wildo-backend-lib/databases/services/zod-to-sql-hybrid-schema.planner';\nimport type { ResourceIdBackendService } from '~wildo-backend-lib/resources/services/resource-id.backend.service';\nimport { sql } from 'kysely';\nimport type { ExecutionContext } from '~wildo-backend-lib/runtime/models/execution-context.backend.schemas';\nimport { normalizeRepositoryVersionMetadata } from '~wildo-backend-lib/base-classes/services/repositories/repository-version-metadata.backend.utils';\n\n// Forward declaration to avoid circular dependency (matches Mongo repository style)\ntype RepositoriesRegistryHandlerBackendService = any;\n\n/**\n * PostgreSQL Repository Skeleton (Hybrid JSONB + Kysely)\n *\n * NOTE:\n * - This is a scaffolding class to be completed in the next steps.\n * - It mirrors `RepositoryResourceBackendService` construction (per resourceType),\n * but targets PostgreSQL via Kysely.\n * - Migrations/DDL are owned by apps-manager.\n */\nimport type { BackendResourceRepository } from './repositories-registry-handler.backend.service';\nimport { isEngineReservedFieldName } from './field-clearing-partition.backend';\nimport type {\n ConditionalArrayReturnType,\n ConditionalNullableReturnType,\n ConditionalReturnType,\n MainSchemaArrayType,\n MainSchemaType,\n PartialMainSchemaType,\n} from '~wildo-backend-lib/base-classes/utils/backend-type-utils';\nimport {\n buildRetentionVisibleRowsSqlPredicate,\n isRetentionGovernedResource,\n withRetentionHideApplied,\n} from '~wildo-backend-lib/compliance/privacy/retention-hide-predicate.backend';\nimport {\n quotePostgresColumnOf,\n quotePostgresIdentifier,\n} from '~wildo-backend-lib/databases/utils/postgresql-identifier.backend.utils';\nimport {\n guardedMutationHasWork,\n RepositoryArrayAdditionPlacement,\n type RepositoryArrayAddition,\n type RepositoryGuardedMutation,\n} from './repository-guarded-mutation.backend.types';\n\n/**\n * The empty jsonb container a mutation falls back to when the column (or an ancestor inside it) is\n * absent. Two of them because the fallback carries a TYPE: coalescing an array path to `'{}'` would\n * make the very next `||` concatenate onto an object and fail the statement.\n */\nconst OBJECT_JSONB_LITERAL = sql`'{}'::jsonb`;\nconst ARRAY_JSONB_LITERAL = sql`'[]'::jsonb`;\n\n/**\n * A stable, order-insensitive key for a SET of column names.\n *\n * ONE function because the two sides of the comparison — the plan's declared composite constraints\n * and a caller's `ON CONFLICT` target — must key identically, and the first version of this did not:\n * one side joined on a separator, the other on a space, so the lookup could never hit and every\n * multi-column upsert was refused with a message claiming a constraint was missing when it was\n * present. That is the same \"one fact expressed twice\" shape the retention authority exists to stop,\n * so it gets the same treatment rather than a matching pair of `.join()` calls.\n *\n * `JSON.stringify` over the sorted names, deliberately: it cannot be confused by an identifier that\n * itself contains the separator (a quoted PostgreSQL identifier may legally contain a space or a\n * comma), and unlike a control-character separator it survives every tool that touches this file.\n */\nfunction uniqueColumnSetKey(columns: readonly string[]): string {\n return JSON.stringify([...columns].sort());\n}\n\n\n/**\n * The id of a deleted row, from whatever `_doDelete` answered.\n *\n * ONE function because there are TWO doors into the same delete — the typed `delete()` wrapper and\n * the `doOperation` dispatch — and for as long as only one of them unwrapped, the shape a caller got\n * depended on which door it came through. That is the adapter/door-conditional guarantee this file\n * has now been bitten by twice; keeping the unwrap in a single place is what stops a third.\n *\n * `_id` first, `id` second: PostgreSQL tables carry the framework's `_id`, and the `id` fallback is\n * kept for a row shape that predates it. `''` for \"nothing matched\" is the contract both adapters\n * already answer, and it is what lets the service distinguish a no-op delete from a successful one.\n */\nexport function extractDeletedRowId(deletedRow: unknown): string {\n if (!deletedRow || typeof deletedRow !== 'object') return '';\n const row = deletedRow as { _id?: unknown; id?: unknown };\n const identity = row._id ?? row.id;\n return typeof identity === 'string' && identity.length > 0 ? identity : '';\n}\n\nexport class PostgreSQLResourceRepositoryBackendService<\n TCustomOperationEnum extends EnumLikeType | undefined = undefined,\n TCoreOperationEnum extends Partial<CoreResourceOperation> | undefined = undefined,\n TMainSchema extends z.ZodTypeAny = z.ZodTypeAny\n> implements BackendResourceRepository<TCustomOperationEnum, TCoreOperationEnum, TMainSchema> {\n private readonly resourceConfiguration: ResourceConfiguration<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>;\n private readonly filterService: PostgreSQLFilterBackendService;\n private readonly jsonbRoots: Set<string>;\n private readonly tableName: string;\n private readonly operationsMap: Map<string, ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>>;\n private readonly plannedFieldNames: Set<string>;\n /**\n * Planned columns carrying a UNIQUE constraint — the only legal `ON CONFLICT` targets.\n *\n * A singleton ledger's scope FK is unique because its relationship is 1:1, which the planner\n * records. Reading it here is what lets `upsertByFilter` verify that the caller's filter names a\n * real constraint rather than emitting SQL PostgreSQL will reject at runtime.\n */\n private readonly uniqueFieldNames: Set<string>;\n /** Sorted column-set keys of the plan's COMPOSITE unique constraints — see the constructor. */\n private readonly uniqueConstraintKeys: Set<string>;\n /** Whether the plan scopes this table's unique indexes to non-retained rows. */\n private readonly retentionScopedUniqueIndexes: boolean;\n /**\n * The AUTHORED name of a surrogate primary key, or `null`.\n *\n * A resource may declare its own primary key (FILES declares `fileId`) which the framework\n * persists as `_id`. MongoDB reconciles the two with a virtual projection registered by the\n * zod→mongoose convertor; this adapter has no virtuals, so the translation is explicit and\n * lives at the two chokepoints every statement already passes through.\n */\n private readonly surrogatePrimaryKeyFieldName: string | null;\n\n protected logDebug: (message: string, context?: Record<string, unknown>) => void;\n\n constructor(\n resourceType: ResourceType,\n private readonly dbService: PostgreSQLDatabaseBackendService,\n private readonly logger: LoggerService,\n private readonly errorBuilder: ErrorBuilderBackendService,\n private readonly resourceRegistry: ResourcesRegistryBackendService,\n private readonly resourceOperationHelper: ResourceOperationHelperBackendService,\n private readonly repositoriesRegistry: RepositoriesRegistryHandlerBackendService,\n private readonly sqlPlanner: ZodToSqlHybridSchemaPlannerBackendService,\n private readonly resourceIdService?: ResourceIdBackendService\n ) {\n this.resourceConfiguration = this.resourceRegistry.getResourceConfiguration(resourceType);\n this.logDebug = this.logger.debugByType(`PostgreSQLRepositoryResource_${resourceType}`);\n this.logger.setDebugTypeLogging(`PostgreSQLRepositoryResource_${resourceType}`, false);\n\n // Configure JSONB roots for dot-notation support:\n // - always include variantConfig for hybrid inheritance\n // - include any object/array fields planned as JSONB\n const planned = this.sqlPlanner.planSqlHybridTable(\n this.resourceConfiguration as any,\n this.resourceConfiguration.mainSchema as any\n );\n this.jsonbRoots = new Set<string>(\n planned.fields.filter((f) => f.storage === 'jsonb').map((f) => f.name)\n );\n this.jsonbRoots.add('variantConfig');\n this.plannedFieldNames = new Set<string>(planned.fields.map((f) => f.name));\n this.uniqueFieldNames = new Set<string>(\n planned.fields.filter((f) => f.isUnique || f.isPrimaryKey).map((f) => f.name),\n );\n /**\n * Composite unique constraints, as SORTED column-set keys.\n *\n * `ON CONFLICT (a, b)` needs a unique index on that exact SET — two individually-unique columns\n * do not make one — so a multi-column conflict target is validated against these rather than\n * against `uniqueFieldNames`.\n */\n this.uniqueConstraintKeys = new Set<string>(\n (planned.uniqueConstraints ?? []).map((constraint) => uniqueColumnSetKey(constraint.fields)),\n );\n /**\n * Whether every unique index on this table is scoped to non-retained rows.\n *\n * Taken from the PLAN because that is what `postgresql-schema-ddl` keys the index predicate off,\n * so a statement inferring a partial index and the index itself are one decision. It also stays\n * correct for a shared table: a `USER_SELF*` repository issues against its twin's table, planned\n * from the twin's configuration.\n */\n this.retentionScopedUniqueIndexes = planned.uniquenessExcludesErasureRetainedRows === true;\n\n this.filterService = new PostgreSQLFilterBackendService(this.logger, this.errorBuilder);\n this.filterService.setJsonbFields(this.jsonbRoots);\n\n // Alias-aware: a `USER_SELF*` resource is a different DOOR onto its non-SELF counterpart's rows,\n // so it must issue its statements against the SHARED table (the Mongo model builder resolves the\n // same way). Deriving from `resourceIdentifier` alone pointed the self door at a disjoint table.\n this.tableName = PostgreSQLFilterBackendService.resolveTableNameForResource(String(this.resourceConfiguration.resourceIdentifier));\n\n /**\n * Read from the PLAN, not re-derived and not asked of the operation helper.\n *\n * The planner has already made this determination — it is what makes it emit the column as\n * `_id` — so taking the answer from `planned` keeps one authority. Asking the helper here\n * instead added a CONSTRUCTOR-time dependency, and a constructor-time dependency has a blast\n * radius nothing local reveals: every fixture that stubs the helper stopped being able to build\n * a PostgreSQL repository AT ALL, in suites with no connection to surrogate keys. Fifty-two of\n * them, found only by the full suite.\n */\n this.surrogatePrimaryKeyFieldName = planned.surrogatePrimaryKeyFieldName ?? null;\n\n this.operationsMap = new Map();\n this.initializeOperationsMap();\n\n this.logDebug('PostgreSQL repository skeleton created', {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n tableName: this.tableName,\n jsonbRoots: Array.from(this.jsonbRoots),\n });\n }\n\n /**\n * Extract native SQL transaction client from RepositoryOptions (if any).\n * Includes a runtime safety check similar to Mongo repository.\n */\n protected getTransaction(options?: RepositoryOptions): TransactionContext | undefined {\n if (!options?.transaction) return undefined;\n if (options.transaction.databaseType !== PersistenceAdapter.POSTGRESQL) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n context: {\n // diagnostic (log-only): wrong persistence adapter wired for this resource (framework config bug).\n expectedDatabaseType: PersistenceAdapter.POSTGRESQL,\n receivedDatabaseType: options.transaction.databaseType,\n },\n });\n }\n return options.transaction;\n }\n\n /**\n * Canonical persistence-to-domain transform for every PostgreSQL row.\n *\n * `_version_db_doc` is an adapter-internal storage name. Mongo already maps\n * it to the public repository metadata field `_version`; PostgreSQL must\n * expose the exact same contract or consumers (optimistic locking, token\n * authorization fencing, mutation state) become adapter-dependent.\n *\n * Keep this normalization after the hybrid SQL transform so inheritance and\n * JSONB reconstruction still see the physical row shape. Return a fresh\n * object to avoid mutating Kysely/planner-owned values.\n */\n private transformPersistenceRow<T>(\n row: unknown,\n inheritanceDefinition: unknown,\n ): T {\n const transformed = this.sqlPlanner.transformFromSqlRead(\n row as any,\n inheritanceDefinition as any,\n this.declaredBaseFieldNames(),\n ) as unknown;\n return normalizeRepositoryVersionMetadata(\n this.projectSurrogatePrimaryKey(this.omitUnsetColumns(transformed)),\n ) as T;\n }\n\n /**\n * Present an UNSET column the way MongoDB presents an unset field: ABSENT.\n *\n * ## Why this is a translation, not a convenience\n *\n * SQL has no \"absent\" — a row has every column, and a value that was never written is NULL. On\n * MongoDB the same row simply has no such key. So the identical logical state arrives at the DTO\n * as `null` on one adapter and `undefined` on the other, and Zod treats those as different: a\n * `z.enum([...]).optional()` accepts absent and REJECTS null.\n *\n * That is not a corner case. It fires for EVERY optional field that is not explicitly `.nullish()`,\n * on every read, so a service-tier operation against PostgreSQL failed with\n * `service_resource_transformation_failed` naming the resource and nothing else. It was invisible\n * until one lane ran on both adapters — no PostgreSQL lane had ever gone through the service tier,\n * and the repository-tier lanes read rows with raw SQL, which never meets the DTO.\n *\n * ## Why dropping is the FAITHFUL choice, including for `.nullish()` fields\n *\n * This repository already decided the same thing for the write side: a `clear` compiles to\n * `SET col = NULL` precisely because \"a SQL column cannot be removed from a row at all, so absent\n * and NULL are the same state on this adapter by construction\". Reading it back as absent is that\n * decision applied consistently. A `.nullish()` field parses either way, so nothing that could\n * legitimately distinguish them loses information — and on MongoDB `$unset` collapses the same\n * pair anyway.\n *\n * `_id` and the surrogate key are left alone: they are never legitimately absent, and dropping one\n * would turn a corrupt row into a silently id-less object rather than a loud failure.\n */\n private omitUnsetColumns(row: unknown): unknown {\n if (!row || typeof row !== 'object' || Array.isArray(row)) return row;\n const record = row as Record<string, unknown>;\n const isDroppable = (field: string, value: unknown): boolean =>\n value === null && field !== '_id' && field !== this.surrogatePrimaryKeyFieldName;\n\n // Return the SAME OBJECT when nothing is dropped. Not an optimisation: callers (and one existing\n // pin) rely on the read path handing back the row it was given, and allocating a copy on every\n // read would change that contract for the majority of rows that have no unset column at all.\n if (!Object.entries(record).some(([field, value]) => isDroppable(field, value))) return row;\n\n const projected: Record<string, unknown> = {};\n for (const [field, value] of Object.entries(record)) {\n if (isDroppable(field, value)) continue;\n projected[field] = value;\n }\n return projected;\n }\n\n /**\n * Surface a SURROGATE primary key on a row read back from SQL.\n *\n * The physical column is `_id`; the authored name (`fileId`) is what every caller, DTO and\n * schema refers to. MongoDB supplies it as a virtual, so a caller reading a FILES row gets both\n * — and code written against that contract (`createdFile.fileId`) simply returned `undefined`\n * here, silently, with no error anywhere. `_id` is KEPT alongside it, matching the Mongo shape\n * rather than choosing between the two.\n *\n * This is the READ half of one invariant. Its WRITE half is {@link foldSurrogatePrimaryKey}; the\n * FILTER half is `resolveQueryableFilterPath` (divergence D2); the MIGRATION half is the SQL\n * planner emitting the column as `_id`. All four are the same rule, and the first three were\n * each found only after the one before it was fixed.\n */\n private projectSurrogatePrimaryKey(row: unknown): unknown {\n if (!this.surrogatePrimaryKeyFieldName || !row || typeof row !== 'object') return row;\n const record = row as Record<string, unknown>;\n if (record._id === undefined || record[this.surrogatePrimaryKeyFieldName] !== undefined) return row;\n return { ...record, [this.surrogatePrimaryKeyFieldName]: record._id };\n }\n\n /**\n * Fold an authored SURROGATE primary key back onto the physical `_id` column before writing.\n *\n * Without this a payload carrying `fileId` targets a column that does not exist, which SQL\n * reports as an unknown-column error rather than anything naming the surrogate. The WRITE half\n * of the invariant documented on {@link projectSurrogatePrimaryKey}.\n */\n /**\n * THE write chokepoint: fold the surrogate primary key, then apply the SQL write transform.\n *\n * Every statement that writes app-layer data goes through here, because applying the fold at\n * each call site is the shape that keeps failing. A review of the first attempt found it applied\n * at ONE of NINE sites (`_doCreate`), leaving bulk create, both upsert branches, seed metadata,\n * both update paths and the two guarded primitives untranslated — an authored `fileId` in any of\n * those payloads targets a column that does not exist.\n *\n * See `.claude/rules/invariant-call-site-enumeration.md`: the answer it prescribes is to make the\n * invariant unbypassable rather than to apply it N times.\n *\n * **The fold itself is DEFENSIVE and currently unpinned** — stated because a mutation that kills\n * nothing is not evidence. Neutering it here reddens no test: the CREATE/UPDATE DTOs strip a\n * primary key from authored payloads (correctly — the surrogate is a virtual on MongoDB too), so\n * no operation-lifecycle caller can carry one. It remains because the INTERNAL primitives bypass\n * that validation — `updateSeedMetadata`, the `businessKeyShape` merged into an upsert insert, and\n * the caller-built `setFields` of both guarded writes — and there a stray surrogate would target a\n * column that does not exist. Pinning it needs a caller that legitimately writes one; none exists\n * today.\n */\n private toSqlWriteRow<T extends Record<string, any>>(data: T, inheritanceDefinition: unknown): unknown {\n return this.serializeJsonbColumns(\n this.sqlPlanner.transformForSqlWrite(\n this.foldSurrogatePrimaryKey(data),\n inheritanceDefinition as any,\n this.declaredBaseFieldNames(),\n ),\n );\n }\n\n /**\n * Render every JSONB-backed column's value as JSON TEXT, so PostgreSQL parses it as `jsonb`.\n *\n * ## Why this is required rather than defensive\n *\n * `pg` decides a parameter's wire form from the JAVASCRIPT value, knowing nothing about the target\n * column. Its `prepareValue` (`pg/lib/utils.js`) makes three different decisions for values this\n * repository routinely writes into one `jsonb` column:\n *\n * | app-layer value | what `pg` sends | result in a `jsonb` column |\n * |---|---|---|\n * | plain object | `JSON.stringify(val)` | parses — **by accident**, not by design |\n * | `['APP_USER']` | `{\"APP_USER\"}` — a POSTGRES ARRAY literal | `22P02 invalid input syntax for type json` |\n * | `[]` | `{}` | parses, as an **OBJECT** — silently persists `{}` where `[]` was written |\n * | `Date` | `2026-08-19 07:37:46+00` | `22P02` |\n *\n * So the previous behaviour was not \"arrays are broken\": it was that objects happened to work, empty\n * arrays SILENTLY CHANGED TYPE, and non-empty arrays failed loudly. Which of the three a field got\n * depended on its runtime value, not on anything declared.\n *\n * Measured on 2026-08-19: `wildo local dev` could not initialize an application on PostgreSQL because\n * the platform user's `appRoles` — declared `z.array(AppRolesSchema)` in `users.shared.schemas.ts`\n * and correctly planned `storage: 'jsonb'` — reached `INSERT` as `{\"APP_USER\"}`. The declaration, the\n * planner and the DDL were all right; nothing turned the value into JSON.\n *\n * ## Why the PLAN is the authority, and not `Array.isArray`\n *\n * Membership is decided by {@link jsonbRoots} — the planner's `storage === 'jsonb'` classification —\n * because that is the same fact the DDL renders the column from. Sniffing the JS type instead would\n * ask a different question than the one the column was created from, and would get both edges wrong:\n * a `z.unknown()` field (planned `json`) holding the string `'hello'` must persist as the jsonb\n * string `\"hello\"`, and a value that merely LOOKS like an array must not be re-typed by a heuristic.\n *\n * ## Two deliberate exclusions\n *\n * `null`/`undefined` are left alone, so a null lands as SQL `NULL` rather than as the jsonb scalar\n * `'null'`. The distinction is observable — `IS NULL` matches the first and not the second — and SQL\n * `NULL` is what MongoDB's absent/null field means, so this is adapter parity, not convenience.\n *\n * A Kysely expression is skipped. `plainSets` cannot contain one today (every SQL expression is\n * routed through `columnAssignments`, which builds its own `::jsonb` cast), so this branch is\n * DEFENSIVE and unpinned — stated plainly because a guard no test can kill is not evidence. It earns\n * its place because the failure mode is silent rather than loud: `JSON.stringify` of a `RawBuilder`\n * yields a plausible-looking object literal that would be persisted instead of executed, and the\n * caller-built rows reaching `insertRawDocument` / `updateSeedMetadata` are outside DTO validation.\n *\n * Applied HERE because {@link toSqlWriteRow} is the single write chokepoint all twelve statements in\n * this class pass through — see `.claude/rules/invariant-call-site-enumeration.md`, whose prescribed\n * answer is to make the invariant unbypassable rather than to apply it at N sites.\n */\n private serializeJsonbColumns<T>(row: T): T {\n if (!row || typeof row !== 'object') return row;\n\n const source = row as Record<string, unknown>;\n let output: Record<string, unknown> | undefined;\n\n for (const column of this.jsonbRoots) {\n if (!(column in source)) continue;\n const value = source[column];\n if (value === null || value === undefined) continue;\n if (\n typeof value === 'object'\n && typeof (value as { toOperationNode?: unknown }).toOperationNode === 'function'\n ) continue;\n\n // Copy lazily: a row with no jsonb column — the common case — is returned untouched.\n output ??= { ...source };\n output[column] = JSON.stringify(value);\n }\n\n return (output ?? source) as T;\n }\n\n /**\n * The resource's DECLARED base fields, for the hybrid variant split.\n *\n * The planner otherwise INFERS the base as the intersection of the variant schemas, which is wrong\n * for a family with exactly one extending variant — the intersection is then that variant's own key\n * set, so nothing is treated as variant-specific and `variantConfig` is neither filled on write nor\n * hoisted on read. Measured on `CONSUMABLE_TOKENS`, whose `BOUNDED_REUSE` is the only extending\n * variant: `maxUses` round-tripped as ABSENT, and the token consumed on its first use instead of\n * its third. See `getBaseFieldNames`.\n *\n * `mainSchema` is the base for a family-backed resource (the factory takes `mainSchema` alongside\n * `inheritenceSchemaDefinition`). Anything that is not a plain object — a union-shaped main schema,\n * say — yields an empty set, which leaves the planner on its previous inference rather than\n * asserting a base it cannot read.\n */\n private declaredBaseFieldNames(): ReadonlySet<string> | undefined {\n const mainSchema = (this.resourceConfiguration as { mainSchema?: unknown })?.mainSchema;\n if (!(mainSchema instanceof z.ZodObject)) return undefined;\n return new Set(Object.keys(getZodObjectShape(mainSchema)));\n }\n\n /**\n * Mint the row identity when the payload does not carry one — the INSERT-only half.\n *\n * MongoDB needs no equivalent because mongoose mints `_id` in the driver on every insert.\n * PostgreSQL has no such hook, so an INSERT omitting `_id` is answered with\n * `null value in column \"_id\" … violates not-null constraint`.\n *\n * Identity is minted through `ResourceIdBackendService`, NOT delegated to a column default: the\n * format is a per-resource framework decision (ObjectId or UUID) that the same service already\n * enforces on read, and pushing it into DDL would split one rule across the migration and the\n * engine, where the two can disagree silently.\n */\n private withGeneratedRowIdentity<T extends Record<string, any>>(data: T): T {\n if (!this.resourceIdService || (data._id !== undefined && data._id !== null)) return data;\n return {\n ...data,\n _id: this.resourceIdService.generateForResource(String(this.resourceConfiguration.resourceIdentifier)),\n };\n }\n\n private foldSurrogatePrimaryKey<T extends Record<string, any>>(data: T): T {\n if (!this.surrogatePrimaryKeyFieldName) return data;\n const authored = data[this.surrogatePrimaryKeyFieldName];\n if (authored === undefined) return data;\n const { [this.surrogatePrimaryKeyFieldName]: _folded, ...rest } = data;\n return { ...rest, ...(data._id === undefined ? { _id: authored } : {}) } as T;\n }\n\n /**\n * Build a SQL where expression from a Mongo-style filter.\n */\n protected buildWhere(filter: ResourceFilter | null | undefined): SqlWhereExpression | null {\n return this.filterService.buildWhereExpression(filter);\n }\n\n // ===========================================================================\n // Operation routing (align with Mongo repository surface)\n // ===========================================================================\n\n public async doByPath<T = any, U = any>(\n operationRepositoryPath: ResourceConfiguration_OperationRepositoryPath,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter?: IdOrIdsOrFilterType,\n data?: U,\n options?: RepositoryOptions\n ): Promise<T> {\n const key = ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKey(operationRepositoryPath);\n return this.doByKey<T, U>(key, executionContext, id_or_ids_or_filter, data, options);\n }\n\n public async doByKey<T = any, U = any>(\n operationRepositoryPathKey: string,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter?: IdOrIdsOrFilterType,\n data?: U,\n options?: RepositoryOptions\n ): Promise<T> {\n ResourcesConfig_OperationPathUtils.validateOperationRepositoryPathKey(operationRepositoryPathKey);\n\n const operation = this.operationsMap.get(operationRepositoryPathKey);\n if (!operation) {\n // CONFIGURATION, not NOT_FOUND — the same structural fault as the Mongo arm, fixed with it\n // rather than after it. Both persistence adapters carry this lookup, which is the shape\n // `invariant-call-site-enumeration.md` records for a port: a fix applied to one side leaves\n // the other answering the old way.\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey },\n });\n }\n\n return (await this.doOperation(operation, executionContext, id_or_ids_or_filter, data, options)) as T;\n }\n\n public async doByExecutionContext<T = any>(\n executionContext: ExecutionContext<ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>>,\n data?: any,\n options?: RepositoryOptions\n ): Promise<T> {\n const operation = executionContext.operation;\n const id_or_ids_or_filter = this.resourceOperationHelper.extractIdsFromExecutionContext(\n executionContext,\n this.resourceConfiguration.resourceFieldIdentifier\n );\n return (await this.doOperation(operation, executionContext, id_or_ids_or_filter as any, data, options)) as T;\n }\n\n private async doOperation(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter?: IdOrIdsOrFilterType,\n data?: any,\n options?: RepositoryOptions\n ): Promise<any> {\n const operationRepositoryPathKey = ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKeyFromOperation(operation);\n\n if (operation.resourceIdentifier !== this.resourceConfiguration.resourceIdentifier) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, resourceIdentifier: this.resourceConfiguration.resourceIdentifier },\n });\n }\n\n const opIdentifier = ResourceOperationsUtils.getCoreResourceOperationFromOperation(operation);\n if (!opIdentifier) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey },\n });\n }\n\n switch (opIdentifier) {\n case CoreResourceOperation.CREATE:\n return this._doCreate(operation, executionContext, data, options);\n case CoreResourceOperation.CREATE_MANY:\n return this._doCreateMany(operation, executionContext, data, options);\n case CoreResourceOperation.READ:\n if (Array.isArray(id_or_ids_or_filter)) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, id_or_ids_or_filter },\n });\n }\n return this._doRead(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.UPDATE:\n if (Array.isArray(id_or_ids_or_filter)) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, id_or_ids_or_filter },\n });\n }\n return this._doUpdate(operation, executionContext, id_or_ids_or_filter as any, data, options);\n case CoreResourceOperation.UPDATE_MANY:\n return this._doUpdateMany(operation, executionContext, id_or_ids_or_filter as IdsOrFilterType, data, options);\n case CoreResourceOperation.DELETE:\n if (Array.isArray(id_or_ids_or_filter)) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationRepositoryPathKey, id_or_ids_or_filter },\n });\n }\n /*\n * UNWRAPPED, exactly as the `delete()` wrapper does.\n *\n * `_doDelete` uses `.returningAll()` and answers the whole deleted ROW, while the DELETE\n * contract — `Promise<string>` on both adapters — is the id. `delete()` unwrapped it and this\n * dispatch did not, so which shape a caller got depended on WHICH DOOR it came through. The\n * service layer comes through here, so every single DELETE on a PostgreSQL-backed resource\n * returned a row; `composeDefaultOperationResponse` then built `{ id: <row> }`, the DELETE DTO\n * refused it, and the request answered 500 AFTER the row was already gone.\n *\n * MongoDB's `_doDelete` returns the id directly, so its dispatch was correct and this was\n * adapter-conditional — the failure shape this file's own `_doDelete` comment calls \"worse than\n * no guarantee\". Both doors now go through one function so they cannot drift apart again.\n */\n return extractDeletedRowId(\n await this._doDelete(operation, executionContext, id_or_ids_or_filter as any, options),\n );\n case CoreResourceOperation.DELETE_MANY:\n return this._doDeleteMany(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.LIST:\n return this._doList(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.COUNT:\n return this._doCount(operation, executionContext, id_or_ids_or_filter as any, options);\n case CoreResourceOperation.SEARCH:\n return this._doSearch(operation, executionContext, data?.query || '', {}, options as any);\n default:\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { resourceIdentifier: this.resourceConfiguration.resourceIdentifier, opIdentifier },\n });\n }\n }\n\n /**\n * Build the repository dispatch map.\n *\n * **A key collision here is NORMAL and is not reported as an anomaly.** The REPOSITORY path key is\n * deliberately coarser than the operation path key: it is\n * `resource | operation | operationRef | isBulk`, while the full operation key is\n * `resource | operation | variantType | (isDefault|variantKey) | isBulk`. Dropping the variant is\n * the point — several API-level variants (an admin read, a self read, an organization-scoped read)\n * describe ONE repository behaviour, so they are meant to converge on one entry.\n *\n * This used to `logger.warn` on every collision. The MongoDB base class\n * (`repository-resource.backend.service.ts`) performs the IDENTICAL last-wins `set()` with the\n * same key function and says nothing, so the warning was never reporting an adapter difference —\n * only a logging one. It became visible the moment a platform first ran on PostgreSQL and emitted\n * **16,665 WARN lines in a single boot**, which buried the three-line `REQUIRED_ADAPTER_MISMATCH`\n * that was the actual failure. A diagnostic that hides the defect it sits next to is worse than no\n * diagnostic.\n *\n * Demoted rather than deleted: the collapse is still worth being able to SEE when chasing a\n * dispatch problem, and `logDebug` is where the base class puts the same information.\n */\n private initializeOperationsMap(): void {\n const ops = this.resourceConfiguration.operations || [];\n for (const operation of ops) {\n const key = ResourcesConfig_OperationPathUtils.createOperationRepositoryPathKeyFromOperation(operation);\n if (this.operationsMap.has(key)) {\n this.logDebug(`Repository operation key '${key}' for resource '${String(this.resourceConfiguration.resourceIdentifier)}' is served by more than one operation variant. Last operation wins (by design — the repository key drops variant).`);\n }\n this.operationsMap.set(key, operation);\n }\n }\n\n // The method surface should mirror the Mongo repository public API so the\n // service layer can remain database-agnostic.\n //\n // Implementation will:\n // - Use this.dbService.getDb() to get a Kysely instance\n // - Apply SqlWhereExpression compilation to Kysely query builder\n // - Apply hybrid transforms via sqlPlanner.transformForSqlWrite/transformFromSqlRead\n // - Respect RepositoryOptions.transaction (nativeSession contains transaction client)\n\n // NOTE: These signatures are intentionally aligned with the resource-system expectations\n // but kept minimal for initial PostgreSQL adapter bring-up.\n\n public async create<T = undefined>(\n executionContext: ExecutionContext<any>,\n data: MainSchemaType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.CREATE && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.CREATE },\n });\n }\n return this._doCreate(operation as any, executionContext, data, options);\n }\n\n public async createMany<T = undefined>(\n executionContext: ExecutionContext<any>,\n data: MainSchemaArrayType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.CREATE_MANY && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.CREATE_MANY },\n });\n }\n // The private `_do*` layer is untyped against the schema; the cast is the ONE\n // place that adaptation happens, so the public surface can stay schema-derived.\n return this._doCreateMany(operation as any, executionContext, data, options) as Promise<\n ConditionalArrayReturnType<T, TMainSchema>\n >;\n }\n\n public async read<T = undefined>(\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n options?: RepositoryOptions\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.READ && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.READ },\n });\n }\n return this._doRead(operation as any, executionContext, id_or_filter, options);\n }\n\n /**\n * Adapter-parity counterpart of Mongo `readForInternalScan`. Framework\n * maintenance/reconciliation callers use one canonical persisted-truth read\n * contract regardless of the selected resource adapter.\n */\n public async readForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n options?: RepositoryOptions,\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const syntheticReadOperation = {\n operationIdentifier: CoreResourceOperation.READ,\n variantType: ResourceOperationVariantType.REPOSITORY_ONLY,\n isOperationDefault: true,\n } as unknown as ResourceConfiguration_Operation<\n TCustomOperationEnum,\n TCoreOperationEnum,\n TMainSchema\n >;\n return this._doRead(\n syntheticReadOperation,\n executionContext,\n id_or_filter,\n options,\n );\n }\n\n public async update<T = undefined>(\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n data: PartialMainSchemaType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.UPDATE && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.UPDATE },\n });\n }\n return this._doUpdate(operation as any, executionContext, id_or_filter, data, options);\n }\n\n public async updateMany<T = undefined>(\n executionContext: ExecutionContext<any>,\n data: PartialMainSchemaType<TMainSchema>,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.UPDATE_MANY && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.UPDATE_MANY },\n });\n }\n return this._doUpdateMany(operation as any, executionContext, undefined, data, options) as Promise<\n ConditionalArrayReturnType<T, TMainSchema>\n >;\n }\n\n public async delete(\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter: IdOrIdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<string> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.DELETE && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.DELETE },\n });\n }\n const deleted = await this._doDelete(operation as any, executionContext, id_or_ids_or_filter, options);\n return extractDeletedRowId(deleted);\n }\n\n public async deleteMany(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<string[]> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.DELETE_MANY && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.DELETE_MANY },\n });\n }\n return this._doDeleteMany(operation as any, executionContext, ids_or_filter, options);\n }\n\n public async list<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>>;\n public async list<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options: RepositoryOptions & { paginated: true; listOptions?: Partial<Resources_PaginationRequest> }\n ): Promise<Resources_PaginatedResult<ConditionalReturnType<T, TMainSchema>>>;\n public async list<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions & { listOptions?: Partial<Resources_PaginationRequest>; paginated?: boolean }\n ): Promise<any[] | Resources_PaginatedResult<any>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.LIST && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.LIST },\n });\n }\n return this._doList(operation as any, executionContext, ids_or_filter, options);\n }\n\n public async search<T = any>(\n executionContext: ExecutionContext<any>,\n searchQuery: string,\n filter: any = {},\n searchOptions: any = {},\n options?: RepositoryOptions\n ): Promise<Resources_PaginatedResult<T>> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.SEARCH && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.SEARCH },\n });\n }\n return this._doSearch(operation as any, executionContext, searchQuery, filter, { ...options, searchOptions } as any);\n }\n\n public async count(\n executionContext: ExecutionContext<any>,\n filter: any = {},\n options?: RepositoryOptions\n ): Promise<{ count: number }> {\n const operation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.COUNT && op.isOperationDefault === true\n );\n if (!operation) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.COUNT },\n });\n }\n return this._doCount(operation as any, executionContext, filter, options);\n }\n\n public supportsOperation(operationIdentifier: string): boolean {\n return this.resourceConfiguration.operations.some(\n (op) => op.operationIdentifier === operationIdentifier && op.isOperationDefault === true\n );\n }\n\n // ===========================================================================\n // Business-Key Helpers (data-seeding) — mirror Mongo repository surface\n // ===========================================================================\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.findByBusinessKey`.\n * Same contract: derive a flat filter from the schema's declared business\n * key, layer in the contextual filter, run a single SELECT.\n *\n * Returns `null` when no row matches.\n */\n public async findByBusinessKey<T = undefined>(\n executionContext: ExecutionContext<any>,\n businessKeyShape: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<ConditionalNullableReturnType<T, TMainSchema>> {\n const baseFilter = this._tryBuildBusinessKeyFilter(executionContext, businessKeyShape);\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter as any, CoreResourceOperation.READ, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const row = await qb.executeTakeFirst();\n if (!row) return null as ConditionalNullableReturnType<T, TMainSchema>;\n return this.transformPersistenceRow<ConditionalNullableReturnType<T, TMainSchema>>(row, inheritanceDef);\n }\n\n /**\n * ADAPTER-NEUTRAL atomic counter primitive (PostgreSQL arm) — see the MongoDB arm on\n * `RepositoryResourceBackendService.atomicIncrementField` for the contract. A shorthand over\n * {@link atomicGuardedMutation}, which is where the arithmetic and the missing-is-zero parity live.\n */\n public async atomicIncrementField<T = any>(\n filter: Record<string, unknown>,\n field: string,\n delta: number,\n setFields?: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n // `delta === 0` omits the increment, degrading the call to a GUARDED SET — the counter-reset\n // case (e.g. rolling a budget period), where the field must be overwritten rather than added to.\n // Mirrors the MongoDB arm, where the same omission also avoids an `$inc`/`$set` path conflict.\n return this.atomicGuardedMutation<T>(\n filter,\n { ...(delta === 0 ? {} : { increment: { [field]: delta } }), set: setFields },\n options,\n );\n }\n\n /**\n * SINGLE-ROW SEMANTICS + a REAL compare-and-set, matching the MongoDB arm's `findOneAndUpdate`.\n *\n * Shared by every adapter-neutral guarded-write primitive on this repository\n * ({@link atomicIncrementField}, {@link atomicConditionalSet}). The reasoning below is the\n * hard part of each of them, and it is the LAST thing that should exist in two copies — a\n * second primitive that re-derived it and got the recheck subtly wrong would look correct and\n * lose concurrent updates in exactly the case the guard exists for.\n *\n * Two predicates are applied, and BOTH are load-bearing:\n *\n * 1. `_id = (SELECT _id … LIMIT 1)` bounds the statement to at most ONE row. A bare\n * `UPDATE … WHERE <filter>` would touch EVERY match, so a filter that turned out to be\n * non-unique would apply the same write repeatedly and diverge from Mongo.\n * 2. The caller's ORIGINAL filter is ALSO applied to the UPDATE itself. This is the part that\n * makes it a compare-and-set. The sub-select is UNCORRELATED, so PostgreSQL evaluates it\n * once as a cached InitPlan; under READ COMMITTED the row-lock recheck (EvalPlanQual)\n * re-evaluates only the UPDATE's own predicate against the newly-committed row version. If\n * that predicate were `_id = <cached constant>` alone it would be trivially true, and a\n * concurrent writer that had just changed a guard column (e.g. rolled `periodKey`, or moved\n * a file out of `PENDING`) would be silently overwritten — the exact lost-update the guard\n * exists to prevent. Re-asserting the filter columns means the recheck fails and this\n * returns null, so the caller takes its fallback path exactly as it does on MongoDB.\n *\n * retention-gate: N/A — takes an ALREADY-COMPILED `where` rather than building one. Its only\n * caller is `atomicGuardedMutation`, whose filter the registry handler has already passed through\n * `applyRetentionHideToRawFilter`; re-applying the hide here would need the raw filter this method\n * deliberately no longer has.\n */\n private async executeGuardedSingleRowUpdate<T = any>(\n db: any,\n where: any,\n updates: Record<string, unknown>,\n inheritanceDef: unknown,\n ): Promise<T | null> {\n const targetIdSubquery = this.filterService\n .applyWhere(db.selectFrom(this.tableName).select('_id' as any), where)\n .limit(1);\n\n const updated = await this.filterService\n .applyWhere(\n db.updateTable(this.tableName).set(updates as any).where('_id' as any, '=', targetIdSubquery as any),\n where,\n )\n .returningAll()\n .executeTakeFirst();\n\n if (!updated) return null;\n return this.transformPersistenceRow<T>(updated, inheritanceDef);\n }\n\n /**\n * ADAPTER-NEUTRAL guarded set-and-clear (PostgreSQL arm) — see the MongoDB arm on\n * `RepositoryResourceBackendService.atomicConditionalSet` for the contract.\n *\n * `clearFields` compiles to `SET col = NULL`, which is the faithful counterpart of MongoDB's\n * `$unset` here rather than an approximation of it: the PostgreSQL filter service already\n * translates `{ $exists: false }` to `IS NULL` (and `{ $exists: true }` to `IS NOT NULL`), so a\n * cleared field is observationally identical through the one predicate that asks about\n * presence. A SQL column cannot be removed from a row at all, so \"absent\" and \"NULL\" are the\n * same state on this adapter by construction.\n */\n public async atomicConditionalSet<T = any>(\n filter: Record<string, unknown>,\n setFields: Record<string, unknown> | undefined,\n clearFields: readonly string[] | undefined,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n return this.atomicGuardedMutation<T>(filter, { set: setFields, clear: clearFields }, options);\n }\n\n /**\n * ADAPTER-NEUTRAL guarded mutation (PostgreSQL arm) — the ONE compiler both primitives above are\n * shorthands over. See `RepositoryGuardedMutation` for the vocabulary and the reasoning.\n *\n * ## The part that is genuinely PostgreSQL work: dotted paths\n *\n * MongoDB reads `engagement.activeDates` natively. Here the root is a `jsonb` COLUMN and the rest\n * is a path inside it, so every mutation on the same root must fold into ONE expression —\n * `SET col = …, col = …` is not \"last one wins\", it is a SQL error (\"multiple assignments to same\n * column\"). The accumulator below is that fold, and it is why this is one compiler rather than a\n * per-operator helper each caller composes.\n *\n * Two behaviours were MEASURED against PostgreSQL 16 rather than assumed, because both diverge\n * from the obvious reading of the documentation:\n *\n * - **`jsonb_set` cannot create intermediate levels**, `create_missing` notwithstanding:\n * `jsonb_set('{}', '{a,b}', '5', true)` returns `{}` UNCHANGED, where MongoDB's `$set` would\n * have created `{a:{b:5}}`. A silent no-op is the worst possible divergence for a counter, so\n * {@link buildJsonbPathAssignment} materialises every missing ancestor first.\n * - **A path through a MISSING array index is a no-op** (`jsonb_set('[{…}]', '{1,exitedAt}', …)`\n * leaves the array untouched) rather than an error or an append. That matches what the\n * lifecycle evaluator's `stageHistory.1` guard already requires, and is recorded here so the\n * next reader does not have to rediscover it.\n */\n /**\n * INSERT one already-built document, below the operation tier.\n *\n * The PostgreSQL arm of the MongoDB base class's `insertRawDocument`. The document is passed\n * through `toSqlWriteRow` — the same projection every other write here uses — because a caller on\n * this tier hands over a DOMAIN document, and the column mapping (JSONB packing, the framework\n * columns) is this adapter's business, not the caller's.\n *\n * Unique violations are translated to the CONFLICT contract, exactly as `_doCreate` does: a caller\n * that inserts a row carrying a declared unique key must receive the same conflict on either\n * adapter, or the classification is adapter-dependent again.\n *\n * retention-gate: N/A — INSERTs a brand-new row, so there is no existing row for a hide to\n * protect.\n */\n public async insertRawDocument<T = any>(document: Record<string, unknown>, options?: RepositoryOptions): Promise<T> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toWrite = this.toSqlWriteRow(document, inheritanceDef);\n\n let inserted: any;\n try {\n inserted = await db\n .insertInto(this.tableName)\n .values(toWrite as any)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error);\n }\n\n return this.transformPersistenceRow<T>(inserted, inheritanceDef);\n }\n\n /**\n * READ many rows matching an already-built filter, below the operation tier.\n *\n * The multi-row counterpart of `readUnscopedByKey`, and the PostgreSQL arm of the base class's\n * `findManyByRawFilter`.\n *\n * An EMPTY filter selects the whole table, deliberately — the same reasoning as `countByRawFilter`:\n * a read has no side effect, so the fail-closed rule that guards an unfiltered UPDATE would only\n * refuse a legitimate question here.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller on this tier.\n */\n public async findManyByRawFilter<T = any>(filter: Record<string, unknown>, options?: RepositoryOptions): Promise<T[]> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const where = this.buildWhere(filter as any);\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const rows = await qb.execute();\n return (rows ?? []).map((row: any) => this.transformPersistenceRow<T>(row, inheritanceDef));\n }\n\n /**\n * Count rows matching an ALREADY-BUILT filter, with no operation and no authorization.\n *\n * The PostgreSQL arm of the MongoDB base class's `countByRawFilter`. Before this existed, the\n * handler's infrastructure count reached `(repository as any).mongooseModel` and threw here, so\n * field-uniqueness validation was broken for every PostgreSQL-backed resource.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller\n * (`countDocumentsForInfrastructure`), matching the MongoDB arm. Applying it again here would put\n * the predicate in two places.\n *\n * An EMPTY filter counts the whole table, deliberately: unlike a guarded UPDATE — where an absent\n * predicate is a fail-closed error because it would rewrite every row — an unfiltered COUNT is a\n * legitimate question with no side effect.\n */\n public async countByRawFilter(filter: Record<string, unknown>, options?: RepositoryOptions): Promise<number> {\n const db = await this.getDbOrTrx(options);\n const where = this.buildWhere(filter as any);\n const qb = this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where,\n );\n const row = await qb.executeTakeFirst();\n // `count(*)` returns bigint, which the driver surfaces as a string — coerce so callers get the\n // number the signature promises rather than a string that compares wrong.\n return Number((row as { count?: unknown } | undefined)?.count ?? 0);\n }\n\n /**\n * @see BackendResourceRepository.readUnscopedByKey — the contract carries the reasoning.\n *\n * The mirror of the MongoDB arm: the caller's filter is the whole confinement (no\n * `buildContextualFilter`), and the retention hide is applied once at the registry dispatch point.\n *\n * `transformPersistenceRow` is NOT optional here even though nothing is projected away: it is what\n * re-hydrates `variantConfig` into top-level variant fields and presents unset columns as ABSENT\n * rather than NULL. A raw row would hand the caller `maxUses: undefined` on a BOUNDED_REUSE token\n * and `revokedAt: null` where MongoDB has no key — the NULL-vs-ABSENT divergence that broke every\n * service-tier read on this adapter once already.\n *\n * retention-gate: N/A — applied at `RepositoriesRegistryHandlerBackendService.readUnscopedByKey`.\n */\n public async readUnscopedByKey<T = any>(\n filter: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const where = this.buildWhere(filter as never);\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const row = await qb.executeTakeFirst();\n\n if (!row) return null;\n return this.transformPersistenceRow<T>(row, inheritanceDef);\n }\n\n /**\n * Compile a guarded mutation into column assignments, shared by the SINGLE-row and MULTI-row\n * writes.\n *\n * Split out so the two cannot drift. The descriptor's rationale is that \"each adapter now has a\n * single place where guarded-write semantics are decided, rather than three places that must\n * agree\" — two inline copies of this compilation (JSONB path assignment, planned-column gating,\n * the `updatedAt` parity rule) would have reinstated exactly what it set out to remove.\n *\n * Returns `null` when the descriptor asks for no expressible change, which BOTH callers translate\n * into their own no-op (`null` / `0`).\n */\n private async prepareGuardedUpdate(\n filter: Record<string, unknown>,\n mutation: RepositoryGuardedMutation,\n options?: RepositoryOptions,\n ): Promise<{ db: any; where: any; updates: Record<string, unknown>; inheritanceDef: any } | null> {\n const where = this.buildWhere(filter as any);\n // FAIL-CLOSED on an unfiltered update. `applyWhere` returns the builder UNCHANGED for a null\n // where-expression, and `buildWhere` yields null for an empty/unusable filter — so without this\n // guard an empty filter would silently become `UPDATE <table> SET …` across the WHOLE TABLE.\n // MongoDB's `findOneAndUpdate` would have touched at most one row, so this is precisely the kind\n // of adapter divergence a \"neutral\" primitive must not hide.\n if (!where) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.tableName,\n reason: 'atomicGuardedMutation requires a non-empty filter — refusing an unfiltered UPDATE',\n },\n });\n }\n\n // NO-OP PARITY with the MongoDB arm: an empty descriptor issues no write and returns null,\n // rather than emitting an `UPDATE … SET \"updatedAt\" = …` that would touch a row (and bump its\n // timestamp) on one adapter only.\n if (!guardedMutationHasWork(mutation)) return null;\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n /**\n * Column → the expression that column will be assigned.\n *\n * Reading through {@link currentColumnExpression} rather than from `sql.ref` directly is what\n * makes several mutations on one jsonb root COMPOSE: the second one wraps the first one's\n * expression instead of replacing it.\n */\n const columnAssignments = new Map<string, unknown>();\n\n const plainSets: Record<string, unknown> = {};\n for (const [path, value] of Object.entries(mutation.set ?? {})) {\n const segments = path.split('.');\n if (segments.length === 1) {\n plainSets[path] = value;\n continue;\n }\n const [root, ...rest] = segments;\n this.assertJsonbPathRoot(root, path, 'set');\n columnAssignments.set(root, this.buildJsonbPathAssignment(\n this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL),\n rest,\n sql`${sql.val(JSON.stringify(value ?? null))}::jsonb`,\n ));\n }\n\n for (const [path, delta] of Object.entries(mutation.increment ?? {})) {\n const segments = path.split('.');\n if (segments.length === 1) {\n // `COALESCE(col, 0)` is parity, not defensiveness: MongoDB's `$inc` treats a missing field\n // as 0 and sets it to `delta`, whereas SQL `NULL + delta` is NULL — without it a first\n // increment on a nullable column would silently blank the counter instead of starting it.\n columnAssignments.set(path, sql`COALESCE(${sql.ref(path)}, 0) + ${delta}`);\n continue;\n }\n const [root, ...rest] = segments;\n this.assertJsonbPathRoot(root, path, 'increment');\n const rootExpression = this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL);\n const pathLiteral = sql`${sql.val(rest)}::text[]`;\n columnAssignments.set(root, this.buildJsonbPathAssignment(\n rootExpression,\n rest,\n // Same missing-is-zero parity as the column case above, expressed through the jsonb path.\n sql`to_jsonb(COALESCE((${rootExpression} #>> ${pathLiteral})::numeric, 0) + ${delta})`,\n ));\n }\n\n for (const addition of mutation.arrayAdditions ?? []) {\n if (addition.values.length === 0) continue;\n const segments = addition.path.split('.');\n const [root, ...rest] = segments;\n this.assertJsonbPathRoot(root, addition.path, 'array addition');\n\n if (rest.length === 0) {\n // The array IS the column, so it coalesces to an empty ARRAY rather than an empty object.\n columnAssignments.set(root, this.buildJsonbArrayAddition(\n this.currentColumnExpression(columnAssignments, root, ARRAY_JSONB_LITERAL),\n addition,\n ));\n continue;\n }\n\n const rootExpression = this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL);\n const pathLiteral = sql`${sql.val(rest)}::text[]`;\n columnAssignments.set(root, this.buildJsonbPathAssignment(\n rootExpression,\n rest,\n this.buildJsonbArrayAddition(sql`COALESCE(${rootExpression} #> ${pathLiteral}, ${ARRAY_JSONB_LITERAL})`, addition),\n ));\n }\n\n for (const path of mutation.clear ?? []) {\n const segments = path.split('.');\n if (segments.length === 1) {\n /**\n * A clear targeting a field with NO PLANNED COLUMN is dropped rather than emitted.\n *\n * On MongoDB `$unset` of an absent path is a silent no-op; here it would be\n * `column \"x\" does not exist` and would fail the whole statement. Dropping keeps the\n * primitive's promise — the field ends up absent either way — instead of turning a\n * harmless no-op into an adapter-specific hard failure.\n */\n if (this.plannedFieldNames.has(path)) columnAssignments.set(path, null);\n continue;\n }\n const [root, ...rest] = segments;\n // Dropped for the same reason as the column case: `$unset` inside a document MongoDB does not\n // have is a no-op there, and must not become a hard failure here.\n if (!this.jsonbRoots.has(root)) continue;\n // `#-` removes the key outright, which is `$unset`'s meaning; assigning JSON null would leave\n // the key PRESENT and make `{ $exists: false }` disagree across adapters.\n columnAssignments.set(root, sql`${this.currentColumnExpression(columnAssignments, root, OBJECT_JSONB_LITERAL)} #- ${sql`${sql.val(rest)}::text[]`}`);\n }\n\n // Route the plain-column sets through the same write transform every other update path uses\n // (variant sweep / inheritance handling); path expressions are already SQL and bypass it.\n const transformedPlainSets = Object.keys(plainSets).length > 0\n ? this.toSqlWriteRow(plainSets, inheritanceDef) as Record<string, unknown>\n : {};\n\n // Every part was dropped as unplanned (see the clear rules above), so this would emit an empty\n // statement. Same NO-OP PARITY reasoning as the descriptor check at the top.\n if (columnAssignments.size === 0 && Object.keys(transformedPlainSets).length === 0) return null;\n\n const updates: Record<string, unknown> = {\n // Parity with the MongoDB arm, where mongoose's `timestamps` bumps `updatedAt` on every\n // write. PostgreSQL has no such hook, so without this a mutated row would keep a stale\n // `updatedAt` on one adapter and a fresh one on the other.\n //\n // GATED on the planned columns, and that gate is load-bearing rather than defensive. Mongoose\n // applies `timestamps` GLOBALLY (`SCHEMA_DEFAULT_OPTIONS`), but the SQL planner emits a column\n // only when the resource's Zod schema declares the field. So on any resource that omits\n // `updatedAt`, an unconditional write here succeeds on MongoDB and hard-fails on PostgreSQL\n // with `column \"updatedAt\" does not exist` — an adapter divergence in the exact primitive that\n // exists to be adapter-neutral. The lifecycle / progression states are precisely that case:\n // neither declares `updatedAt`. Mirrors the gating every other write path here already uses.\n ...(this.plannedFieldNames.has('updatedAt') ? { updatedAt: new Date() } : {}),\n ...transformedPlainSets,\n ...Object.fromEntries(columnAssignments),\n };\n\n return { db, where, updates, inheritanceDef };\n }\n\n /**\n * The single-row guarded write — set, clear, increment and array-add on the ONE matching row.\n *\n * retention-gate: N/A — the hide is applied ONCE at the registry dispatch point\n * (`RepositoriesRegistryHandlerBackendService.atomicGuardedMutation` passes the caller's filter\n * through `applyRetentionHideToRawFilter`), which is the only route services take.\n */\n public async atomicGuardedMutation<T = any>(\n filter: Record<string, unknown>,\n mutation: RepositoryGuardedMutation,\n options?: RepositoryOptions,\n ): Promise<T | null> {\n const prepared = await this.prepareGuardedUpdate(filter, mutation, options);\n if (!prepared) return null;\n return this.executeGuardedSingleRowUpdate<T>(prepared.db, prepared.where, prepared.updates, prepared.inheritanceDef);\n }\n\n /**\n * The MULTI-row guarded write: one mutation applied to EVERY matching row, returning how many\n * rows changed.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller\n * (`bulkUpdateForInfrastructure`), matching the single-row path above.\n *\n * The COUNT is the contract, not a convenience: its billing caller reports usage to a provider and\n * then marks those records reported, so a PARTIAL update is a duplicate-charge condition — the\n * unmarked records are selected again by the next sweep. `numUpdatedRows` is what makes that\n * detectable.\n */\n public async updateManyByRawFilter(\n filter: Record<string, unknown>,\n mutation: RepositoryGuardedMutation,\n options?: RepositoryOptions,\n ): Promise<number> {\n const prepared = await this.prepareGuardedUpdate(filter, mutation, options);\n if (!prepared) return 0;\n\n const result = await this.filterService\n .applyWhere(prepared.db.updateTable(this.tableName).set(prepared.updates as any), prepared.where)\n .executeTakeFirst();\n // Kysely reports affected rows as a bigint; coerce so callers compare a number, not a string.\n return Number((result as { numUpdatedRows?: unknown } | undefined)?.numUpdatedRows ?? 0);\n }\n\n /**\n * The MULTI-row DELETE below the operation tier: destroy every row matching an already-built\n * filter, returning how many went.\n *\n * retention-gate: N/A — the hide is applied ONCE by the caller\n * (`deleteManyForInfrastructure`), matching every sibling on this tier.\n *\n * rag-removal-gate: N/A — a raw repository door, bounded by the hourly RAG reconciliation sweep's\n * orphan reconciliation, exactly as `_doDelete` / `_doDeleteMany` are.\n *\n * **The empty-filter refusal is contract, not local defensiveness** — see the same guard in\n * `prepareGuardedUpdate`, and the reason it is stricter here than in `countByRawFilter` /\n * `findManyByRawFilter`: `applyWhere` returns the builder UNCHANGED for a null where-expression\n * and `buildWhere` yields null for an empty or unusable filter, so without this a caller whose\n * predicate came out empty would emit `DELETE FROM <table>` and get a cheerful count back. A read\n * can legitimately ask a whole-table question; a delete cannot.\n */\n public async deleteManyByRawFilter(\n filter: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<number> {\n const where = this.buildWhere(filter as any);\n if (!where) {\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.tableName,\n reason: 'deleteManyByRawFilter requires a non-empty filter — refusing an unfiltered DELETE',\n },\n });\n }\n\n const db = await this.getDbOrTrx(options);\n const result = await this.filterService\n .applyWhere(db.deleteFrom(this.tableName), where)\n .executeTakeFirst();\n // Kysely reports affected rows as a bigint; coerce so callers compare a number, not a string.\n return Number((result as { numDeletedRows?: unknown } | undefined)?.numDeletedRows ?? 0);\n }\n\n /**\n * The expression a column currently carries in this statement, or its base value when nothing has\n * touched it yet.\n *\n * `COALESCE` at the base is what lets a mutation land on a row whose jsonb column is NULL — the\n * state a freshly-created row is in for any field the schema defaults lazily.\n */\n private currentColumnExpression(assignments: Map<string, unknown>, column: string, emptyLiteral: any): any {\n return assignments.get(column) ?? sql`COALESCE(${sql.ref(column)}, ${emptyLiteral})`;\n }\n\n /**\n * Refuse a dotted path whose ROOT is not a jsonb column.\n *\n * Deliberately loud where an unplanned CLEAR is silently dropped: dropping a clear still leaves\n * the field absent, which is what the caller asked for, whereas dropping a set or an increment\n * loses the write and reports success. A path into a scalar column has no meaning at all.\n */\n private assertJsonbPathRoot(root: string, path: string, operation: string): void {\n if (this.jsonbRoots.has(root)) return;\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.tableName,\n reason: `Guarded mutation ${operation} targets \"${path}\", whose root column \"${root}\" is not jsonb-backed`,\n },\n });\n }\n\n /**\n * `jsonb_set` at `segments`, having first MATERIALISED every missing ancestor.\n *\n * The ancestor walk exists because `jsonb_set(target, path, value, true)` creates only the LAST\n * path element: with `{a}` absent, setting `{a,b}` returns the document unchanged (measured — see\n * the class-level note). MongoDB creates the whole chain, so without this an increment on a\n * lazily-defaulted nested counter would report success and write nothing.\n *\n * Each ancestor step repeats the accumulated expression once, so the SQL grows with path DEPTH,\n * not with the number of mutations. Real paths here are one or two levels\n * (`engagement.activeDates`, `stageHistory.1.exitedAt`).\n */\n private buildJsonbPathAssignment(baseExpression: any, segments: string[], valueExpression: any): any {\n let expression = baseExpression;\n for (let depth = 1; depth < segments.length; depth += 1) {\n const ancestorLiteral = sql`${sql.val(segments.slice(0, depth))}::text[]`;\n expression = sql`jsonb_set(${expression}, ${ancestorLiteral}, COALESCE(${expression} #> ${ancestorLiteral}, ${OBJECT_JSONB_LITERAL}), true)`;\n }\n return sql`jsonb_set(${expression}, ${sql`${sql.val(segments)}::text[]`}, ${valueExpression}, true)`;\n }\n\n /**\n * One array addition applied to `arrayExpression`, which must already evaluate to a jsonb ARRAY.\n *\n * `distinctOnly` folds ONE `CASE` per value rather than concatenating and de-duplicating\n * afterwards, because `@>` asks exactly the question `$addToSet` asks — \"is this value already in\n * the array?\" — and a de-duplicating rewrite would also drop pre-existing duplicates the caller\n * never asked to touch.\n *\n * `maxLength` uses `jsonb_path_query_array`, whose LAX mode (the default) tolerates a range wider\n * than the array instead of erroring — measured, since an out-of-range subscript is exactly the\n * case a short history hits on every early write.\n */\n private buildJsonbArrayAddition(arrayExpression: any, addition: RepositoryArrayAddition): any {\n let expression = arrayExpression;\n\n if (addition.distinctOnly) {\n // TAIL-only, and never capped: the registry's expressibility rule refuses the other\n // combinations for every adapter, because MongoDB's `$addToSet` cannot express them.\n for (const value of addition.values) {\n const valueLiteral = sql`${sql.val(JSON.stringify(value ?? null))}::jsonb`;\n expression = sql`CASE WHEN ${expression} @> ${valueLiteral} THEN ${expression} ELSE ${expression} || jsonb_build_array(${valueLiteral}) END`;\n }\n return expression;\n }\n\n const valuesLiteral = sql`${sql.val(JSON.stringify([...addition.values]))}::jsonb`;\n expression = addition.placement === RepositoryArrayAdditionPlacement.HEAD\n ? sql`${valuesLiteral} || ${expression}`\n : sql`${expression} || ${valuesLiteral}`;\n\n if (addition.maxLength === undefined) return expression;\n\n // Keep the elements nearest the addition's own end, which is what MongoDB's `$slice` sign means.\n return addition.placement === RepositoryArrayAdditionPlacement.HEAD\n ? sql`jsonb_path_query_array(${expression}, ${sql.lit(`$[0 to ${addition.maxLength - 1}]`)})`\n : sql`jsonb_path_query_array(${expression}, ${sql.lit(`$[last-${addition.maxLength - 1} to last]`)})`;\n }\n\n /**\n * PG counterpart of `findManyByBusinessKeys`. Compiles to a single SELECT\n * with an OR-of-AND-of-equalities composed via Mongo-shape filter\n * (`{ $or: [ {fieldA, fieldB}, ... ] }`) so the existing PG filter service\n * can translate it without special-casing.\n *\n * Empty input returns `[]` immediately (no DB call).\n */\n public async findManyByBusinessKeys<T = undefined>(\n executionContext: ExecutionContext<any>,\n businessKeyShapes: Array<Record<string, unknown>>,\n options?: RepositoryOptions,\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>> {\n if (businessKeyShapes.length === 0) return [] as ConditionalArrayReturnType<T, TMainSchema>;\n\n const orBranches = businessKeyShapes.map((shape) =>\n this._tryBuildBusinessKeyFilter(executionContext, shape),\n );\n const baseFilter: any = orBranches.length === 1\n ? orBranches[0]\n : { $or: orBranches };\n\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter, CoreResourceOperation.READ, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const rows = await qb.execute();\n return (rows ?? []).map((row: any) =>\n this.transformPersistenceRow<T>(row, inheritanceDef),\n );\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.upsertByBusinessKey`.\n *\n * Spec refs: data-seeding-as-first-class-feature plan §3.7 (atomic\n * upsert + ledger), §5 (Phase 2 repository contract), and decision\n * P2-B (PostgreSQL sibling parity). See\n * `business-key-resolver.shared.utils.ts` for the business-key\n * resolution contract this method consumes.\n *\n * Implemented as a two-phase transactional read-then-insert/update\n * because:\n * - Postgres `ON CONFLICT (...)` requires a known unique constraint on\n * exactly the business-key columns; we cannot guarantee that exists in\n * a generic way at this layer (apps-manager owns DDL). Phase 4+ may\n * harden this once seeds drive their own indexes.\n * - The Mongo path uses a single `findOneAndUpdate({upsert:true})` which\n * is atomic at the document level; the PG fallback wraps the read +\n * write in a transaction (or piggy-backs on the caller's transaction)\n * to retain the same effective semantics.\n *\n * **Race window (R-6):** when the caller does NOT pass a transaction in\n * `options.transaction`, the SELECT and the subsequent INSERT/UPDATE run\n * on independent connections. Two concurrent dispatcher passes for the\n * same business key can therefore both observe `existing === null` and\n * race to INSERT. The first write wins; the second surfaces as a\n * unique-constraint violation **iff** the table actually carries a\n * unique index on the business-key columns. Without that index the\n * race produces duplicate rows (same business key, different `_id`).\n * The data-seeding dispatcher always wraps a seed pass in a transaction\n * (`DataSeedDispatcherBackendService.runAdditiveSeed`), so this race is\n * mitigated for seeds; for ad-hoc callers, prefer passing a transaction\n * or guaranteeing a unique constraint on the business-key columns.\n *\n * **Optimistic-locking parity (R-10):** the Mongo path bumps\n * `_version_db_doc` via `$inc` on every upsert so subsequent\n * `_doUpdate(ifMatchVersion: …)` calls keep working. PG must mirror\n * this behavior so seed-managed rows also expose a monotonically\n * increasing `_version_db_doc`. We initialize the column to `1` on\n * INSERT and `coalesce(_version_db_doc, 0) + 1` on UPDATE — the\n * `coalesce` is defensive in case the row pre-existed without the\n * column being populated. The full PG `ifMatchVersion`-aware\n * `_doUpdate` integration is a separate concern tracked outside the\n * Phase 2 seed scope (the column being kept in sync is the\n * prerequisite for it to land later without a data-migration).\n *\n * Always returns a non-null `row`; `inserted` flips on the create branch.\n */\n public async upsertByBusinessKey<T = undefined>(\n executionContext: ExecutionContext<any>,\n businessKeyShape: Record<string, unknown>,\n payload: Record<string, unknown>,\n seedMetadata: DataSeedRowMetadata,\n options?: RepositoryOptions,\n ): Promise<{ inserted: boolean; row: ConditionalReturnType<T, TMainSchema> }> {\n const baseFilter = this._tryBuildBusinessKeyFilter(executionContext, businessKeyShape);\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter as any, CoreResourceOperation.UPDATE, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Read first inside the same client (or transaction if the caller passed one).\n const existing = await this.filterService\n .applyWhere(db.selectFrom(this.tableName).selectAll(), where)\n .executeTakeFirst();\n\n // WS-C: this upsert can INSERT, so it is governed by the row-creating rule. In practice seeding\n // runs under an internal system context, which narrowing exempts — the guard is here so that\n // coverage of the write surface is a PROPERTY of the chokepoint set rather than a consequence of\n // who happens to call it today.\n await this.assertOrganizationUnitWriteWithinGrant(payload, CoreResourceOperation.CREATE, executionContext);\n\n // Engine-reserved metadata is stripped from the CALLER's payload before anything else — the\n // 7th site of an invariant the six sibling write paths already apply by hand (`_doCreate`,\n // `_doCreateMany`, `_doUpdate`, `_doUpdateMany`, and both `upsertByFilter` branches each\n // `delete ..._version`). This one was missed, and it is the ONLY write path data-seeding uses.\n //\n // It matters because a seed UPGRADE's payload is a READ PROJECTION: the managed-field overlay\n // is the persisted row with managed paths replaced, and `transformPersistenceRow` publishes\n // `_version_db_doc` as the public read-only `_version`. Writing that back names a column this\n // table does not have — `column \"_version\" of relation \"...\" does not exist` — so every\n // PostgreSQL seed upgrade failed. Applied via the named rule rather than a seventh hand-list so\n // a future engine-owned key is covered without another enumeration.\n const callerAuthoredPayload: Record<string, unknown> = {};\n for (const key of Object.keys(payload as Record<string, unknown>)) {\n if (isEngineReservedFieldName(key)) continue;\n callerAuthoredPayload[key] = (payload as Record<string, unknown>)[key];\n }\n const writePayload: Record<string, unknown> = {\n ...callerAuthoredPayload,\n [DATA_SEED_ROW_METADATA_FIELD_KEY]: seedMetadata,\n };\n const trackedPayload = this.addUserTrackingAndTimestamps(\n writePayload,\n executionContext,\n existing ? CoreResourceOperation.UPDATE : CoreResourceOperation.CREATE,\n );\n\n if (existing) {\n // Defensive: never let the caller's payload overwrite the version\n // column directly (the Mongo path strips `_version_db_doc` from\n // `$set` for the same reason — see repository-resource.backend.service.ts).\n delete (trackedPayload as Record<string, unknown>)._version_db_doc;\n const previousVersion = typeof (existing as any)._version_db_doc === 'number'\n ? (existing as any)._version_db_doc\n : 0;\n const nextVersion = previousVersion + 1;\n const toWrite = this.toSqlWriteRow(\n { ...trackedPayload, _version_db_doc: nextVersion },\n inheritanceDef,\n );\n // Unique-violation → CONFLICT, mirroring the Mongo arm. WRITE only; the pre-read above is\n // deliberately left unwrapped so a failed lookup is never reported as a duplicate.\n let updated: any;\n try {\n updated = await this.filterService\n .applyWhere(db.updateTable(this.tableName).set(toWrite as any), where)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n const row = this.transformPersistenceRow<ConditionalReturnType<T, TMainSchema>>(updated, inheritanceDef);\n return { inserted: false, row };\n }\n\n // Defensive: stamp the business-key columns onto the row in case the\n // caller's payload omitted them (parity with Mongo $setOnInsert), and\n // initialize `_version_db_doc` to 1 so subsequent updates can $inc it\n // monotonically — same convention as Mongo (versionKey: _version_db_doc).\n delete (trackedPayload as Record<string, unknown>)._version_db_doc;\n const insertRow = { ...businessKeyShape, ...trackedPayload, _version_db_doc: 1 };\n // This branch is the upsert's INSERT — governed by the same create-time rules as `_doCreate`\n // (same adapter-neutral authority). Exempt seed contexts return immediately; a future non-exempt\n // upsert-create inherits FK-existence + top-level-check enforcement for free.\n await assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n insertRow,\n CoreResourceOperation.CREATE,\n seedMetadata.seedKey,\n executionContext,\n options,\n );\n const toInsert = this.toSqlWriteRow(this.withGeneratedRowIdentity(insertRow), inheritanceDef);\n let inserted: any;\n try {\n inserted = await db\n .insertInto(this.tableName)\n .values(toInsert as any)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n // The upsert lost the insert race, or a DIFFERENT unique constraint was violated — the caller\n // branches on CONFLICT either way, so it must not receive a raw driver error.\n throw this.handlePostgresError(error, executionContext);\n }\n const row = this.transformPersistenceRow<ConditionalReturnType<T, TMainSchema>>(inserted, inheritanceDef);\n return { inserted: true, row };\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.upsertByFilter` — a race-free singleton\n * upsert, expressed as `INSERT … ON CONFLICT (<filter columns>) DO UPDATE`.\n *\n * **Why this could not be written before.** It used to throw, citing \"relationship FK DDL and\n * ON CONFLICT support\", and that was accurate: a scope-feature ledger declares NO scope FK in its\n * schema — the column is relationship-injected — so the SQL planner never planned it, and without\n * the column and its unique constraint there is no conflict target. The planner now plans injected\n * FKs and marks a 1:1 relationship's FK unique, which is exactly the constraint this needs.\n *\n * **Atomicity comes from the constraint, not from a read.** A read-then-insert would reintroduce\n * the duplicate-singleton race this API exists to prevent: two callers both see no row, both\n * insert, and the ledger ends up with two. `ON CONFLICT` makes the database arbitrate.\n *\n * Semantics mirrored from the MongoDB arm rather than approximated:\n * - only EXPLICITLY authored keys are updated. Zod CREATE validation materializes defaults that\n * are right for a new row and wrong on the update branch — Mongo keeps them insert-only via\n * `$setOnInsert` + `setDefaultsOnInsert`, and here they simply never enter the `DO UPDATE` set.\n * - the filter's own columns are never in the update set: they identify the row.\n * - `_version_db_doc` increments on the update branch and starts at 1 on insert, matching `$inc`.\n * - the return distinguishes insert from update, via `xmax = 0` — PostgreSQL's standard signal for\n * \"this row was inserted by THIS statement\" rather than updated by it.\n */\n public async upsertByFilter<T = undefined>(\n executionContext: ExecutionContext<any>,\n filterShape: Record<string, unknown>,\n payload: Record<string, unknown>,\n options?: RepositoryOptions,\n ): Promise<{ inserted: boolean; row: ConditionalReturnType<T, TMainSchema> }> {\n const isConcreteSingletonFilterValue = (value: unknown): boolean => {\n if (value === undefined || value === null) return false;\n if (typeof value === 'string') return value.length > 0;\n if (typeof value === 'number') return Number.isFinite(value);\n if (typeof value === 'boolean') return true;\n if (value instanceof Date) return !Number.isNaN(value.getTime());\n return false;\n };\n const filterKeys = Object.keys(filterShape);\n const invalidFilterEntries = Object.entries(filterShape)\n .filter(([, value]) => !isConcreteSingletonFilterValue(value));\n if (filterKeys.length === 0 || invalidFilterEntries.length > 0) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.SERVICE_RESOURCE_VALIDATION_FAILED,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message: 'upsertByFilter requires a non-empty filter with concrete singleton key values.',\n invalidFilterFields: invalidFilterEntries.map(([key]) => key),\n },\n });\n }\n\n /**\n * FAIL CLOSED when the filter does not name a real UNIQUE constraint.\n *\n * `ON CONFLICT` needs a target the database can arbitrate on. Emitting it against unconstrained\n * columns is not a weaker guarantee — PostgreSQL rejects the statement outright, and doing it\n * silently would turn a missing migration into a runtime error at the worst moment. Refusing\n * here names the actual cause instead.\n *\n * **Single vs multi-column are different questions.** One column needs its OWN unique index;\n * `ON CONFLICT (a, b)` needs a unique index on the exact SET `{a, b}` — two individually-unique\n * columns do not make one, and checking them one at a time would pass and then hand PostgreSQL a\n * statement it rejects, which is precisely the late runtime error this guard exists to pre-empt.\n */\n if (filterKeys.length === 1) {\n const [onlyFilterKey] = filterKeys as [string];\n if (!this.uniqueFieldNames.has(onlyFilterKey)) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message: 'upsertByFilter requires every filter column to carry a UNIQUE constraint to serve as an ON CONFLICT target.',\n unconstrainedFilterFields: [onlyFilterKey],\n },\n });\n }\n } else if (!this.uniqueConstraintKeys.has(uniqueColumnSetKey(filterKeys))) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message:\n 'upsertByFilter requires a COMPOSITE unique constraint covering exactly the filter columns to serve as an '\n + 'ON CONFLICT target. Individually-unique columns do not compose into one.',\n unconstrainedFilterFields: filterKeys,\n },\n });\n }\n\n /**\n * FAIL CLOSED on the SCOPE half of this method's divergence from the MongoDB arm.\n *\n * The Mongo twin runs its filter through `buildContextualFilter(… UPDATE …)`, so it gets tenant\n * confinement on the update branch. This arm builds its statement directly and cannot: an\n * `ON CONFLICT` target must name a UNIQUE constraint, and a scope predicate is not part of one,\n * so the arbitration happens on the business key ALONE. A caller that expected scope confinement\n * would therefore update another tenant's row here and be confined on MongoDB — the exact\n * silent, one-adapter divergence this method already produced once for retention.\n *\n * Rather than leave that as a documented residual, the method refuses any caller that has NOT\n * explicitly waived contextual filtering. Every caller today passes `excludeContextualFilter: true`\n * (the feature-admin sync, billing, the milestone evaluator, and the platform apps-manager singleton\n * materializers — each keyed on its scope FK), so this costs nothing now and converts a future\n * silent leak into a loud refusal naming the cause.\n *\n * An ARRAY value is refused too: it asks for PARTIAL scope filtering, which is exactly the thing\n * that cannot be expressed here. RETENTION is unaffected — it is applied unconditionally below,\n * because a retained row must stay immutable no matter what the caller waived.\n */\n if (options?.excludeContextualFilter !== true) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message:\n 'upsertByFilter on PostgreSQL cannot apply contextual (scope) filtering — ON CONFLICT arbitrates on the '\n + 'unique key alone — so it requires `excludeContextualFilter: true` from the caller. Use a filter that '\n + 'already names the scope, or perform a scoped read-then-write instead. Retention hiding is always applied '\n + 'and is not affected by this flag.',\n excludeContextualFilter: options?.excludeContextualFilter ?? null,\n },\n });\n }\n\n const cleaned = this.resourceOperationHelper.cleanInputData(payload, CoreResourceOperation.CREATE);\n const validated = this.repositoriesRegistry.validateRequestData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n CoreResourceOperation.CREATE,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.CREATE,\n options,\n );\n\n // An upsert can INSERT, so it is governed by the row-CREATING rule: the filter constrains which\n // row is matched, never the unit a newly inserted row would land in.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.CREATE, executionContext);\n\n // Create-time write integrity for the INSERT branch — the adapter-neutral twin of the Mongo\n // `upsertByFilter` call, and the same rule `upsertByBusinessKey` applies. Without it this insert\n // path silently skipped FK-existence / scope-membership / top-level checks. Exempt callers (the\n // internal singleton materializers) return immediately; no `operation` → relationship baseline.\n await assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n { ...enriched, ...filterShape },\n CoreResourceOperation.CREATE,\n CoreResourceOperation.CREATE,\n executionContext,\n options,\n );\n\n if (executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable) {\n enriched.userId = null;\n }\n\n const withLiterals = this.resourceOperationHelper.injectNonDiscriminatorLiteralValues(\n enriched,\n this.resourceConfiguration.mainSchema,\n );\n\n // Only what the CALLER authored may be updated; everything else is insert-only, exactly as the\n // MongoDB arm splits `$set` from `$setOnInsert`.\n const explicitKeys = new Set(Object.keys(payload));\n const updateFields = this.addUserTrackingAndTimestamps(\n Object.fromEntries(\n Object.entries(withLiterals).filter(([key]) => explicitKeys.has(key) && !(key in filterShape)),\n ),\n executionContext,\n CoreResourceOperation.UPDATE,\n );\n delete (updateFields as Record<string, unknown>)._version;\n delete (updateFields as Record<string, unknown>)._version_db_doc;\n\n const insertFields = this.addUserTrackingAndTimestamps(\n { ...withLiterals, ...filterShape },\n executionContext,\n CoreResourceOperation.CREATE,\n );\n delete (insertFields as Record<string, unknown>)._version;\n (insertFields as Record<string, unknown>)._version_db_doc = 1;\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toInsert = this.toSqlWriteRow(\n this.withGeneratedRowIdentity(insertFields as Record<string, any>),\n inheritanceDef,\n ) as Record<string, unknown>;\n const toUpdate = this.toSqlWriteRow(updateFields as Record<string, any>, inheritanceDef) as Record<string, unknown>;\n\n /**\n * The conflict target must mirror the index PREDICATE, not merely its columns.\n *\n * On a retention-governed resource every unique index this framework emits is PARTIAL — the\n * planner sets `uniquenessExcludesErasureRetainedRows` and `postgresql-schema-ddl` renders\n * `… where \"retentionStatus\" is distinct from 'retained'` — because a full-table index would\n * abort the SECOND erasure of a subject (the mask writes ONE shared value to every retained row).\n * PostgreSQL will not infer a partial index from a bare `on conflict (cols)`; it answers\n * \"there is no unique or exclusion constraint matching the ON CONFLICT specification\". So the\n * predicate has to be repeated here, and it is taken from the retention authority — the same\n * emitter the DDL renderer uses — rather than re-typed, so the statement and the index it must\n * match can never disagree.\n *\n * **Repeating it is also what closes the retention hole, and those are one fact rather than two\n * fixes.** With the arbiter index scoped to VISIBLE rows, a RETAINED row holding the caller's\n * business key simply does not conflict: the insert proceeds and a new live row is created —\n * exactly what the MongoDB arm does once its own partial index excludes the retained row. Without\n * this, `do update … returning *` would REWRITE that retained row and hand it back to the caller,\n * breaking both halves of the \"hidden and immutable\" contract, on one adapter only. This method\n * was the last write path on either adapter that did not reach the hide (found 2026-08-09).\n */\n /**\n * Read from the PLAN, not re-derived from the config.\n *\n * `uniquenessExcludesErasureRetainedRows` is the exact flag the DDL renderer keys the index\n * predicate off, so reading it here makes the statement and the index provably ONE decision\n * rather than two that agree today. It also covers the shared-table alias case that a config\n * lookup would get wrong: `resolveTableNameForResource` points a `USER_SELF*` repository at its\n * twin's table, whose index was planned from the TWIN's configuration.\n */\n const retentionScopedUniqueness = this.retentionScopedUniqueIndexes;\n /**\n * The SAME predicate rendered against two different column SCOPES — which is precisely the seam\n * the authority's `quoteIdentifier` callback exists for, so the predicate itself is still spelled\n * in exactly one place.\n *\n * - The **index-inference** predicate must be UNQUALIFIED, because it has to match the index's own\n * predicate expression as `postgresql-schema-ddl` renders it.\n * - The **update-condition** predicate must be TABLE-QUALIFIED. Inside `do update`, both the target\n * row and `excluded` are in scope, so a bare `\"retentionStatus\"` is ambiguous and PostgreSQL\n * rejects the statement with `42702` (found by the integration pin, not by review). Qualifying\n * with the table names the EXISTING row, which is the one that must not be retained.\n *\n * A fresh node per use — a Kysely fragment is consumed by the builder it is handed to.\n */\n const indexInferencePredicate = () => sql<boolean>`${sql.raw(buildRetentionVisibleRowsSqlPredicate(quotePostgresIdentifier))}`;\n const existingRowIsVisible = () => sql<boolean>`${sql.raw(buildRetentionVisibleRowsSqlPredicate(\n (identifier) => quotePostgresColumnOf(this.tableName, identifier),\n ))}`;\n\n // Unique-violation → CONFLICT, mirroring the Mongo arm. `ON CONFLICT` arbitrates the TARGET\n // index only; a violation of a DIFFERENT unique constraint still surfaces here and must not\n // reach the caller as a raw driver error.\n let upserted: any;\n try {\n upserted = await db\n .insertInto(this.tableName)\n .values(toInsert as any)\n .onConflict((oc: any) => {\n // `where` BEFORE `doUpdateSet` is the index-inference predicate (which index to arbitrate on);\n // `where` AFTER it is the update condition (which conflicting rows may be written).\n const target = retentionScopedUniqueness ? oc.columns(filterKeys as any).where(indexInferencePredicate()) : oc.columns(filterKeys as any);\n const updated = target.doUpdateSet({\n ...toUpdate,\n // Mirrors `$inc: { _version_db_doc: 1 }`. `EXCLUDED` is NOT usable here — it holds the value\n // this statement PROPOSED (always 1), not the row's current one, so it would reset the\n // version on every update instead of advancing it.\n _version_db_doc: sql`coalesce(${sql.ref(this.tableName)}.\"_version_db_doc\", 0) + 1`,\n });\n // Defence in depth: unreachable while the arbiter index is correctly partial, but it makes a\n // table whose index was hand-provisioned WITHOUT the predicate fail CLOSED (nothing updated,\n // nothing returned — see the guard below) instead of silently mutating a retained row.\n return retentionScopedUniqueness ? updated.where(existingRowIsVisible()) : updated;\n })\n // `xmax = 0` is PostgreSQL's standard discriminator for a row this statement INSERTED versus\n // one it updated: an inserted tuple has no updating transaction stamped on it.\n .returningAll()\n .returning(sql<boolean>`(xmax = 0)`.as('__wildo_inserted'))\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n\n /**\n * `do update … where <false>` updates nothing and returns nothing. Every other path here yields a\n * row, so an empty result means the update branch was refused — on a retention-governed resource\n * that means the conflicting row is RETAINED and the table's unique index is NOT retention-scoped.\n * Fail loudly naming that, rather than returning an undefined row a caller would dereference.\n */\n if (!upserted) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n message:\n 'upsertByFilter matched a row it is not allowed to write. On a retention-governed resource this means the '\n + 'conflicting row is impersonalized-and-retained while the table\\'s unique index still covers retained rows — '\n + 'provision it with the retention-scoped predicate the schema plan declares.',\n filterFields: filterKeys,\n retentionScopedUniqueness,\n },\n });\n }\n\n const inserted = Boolean(upserted?.__wildo_inserted);\n if (upserted) delete upserted.__wildo_inserted;\n return {\n inserted,\n row: this.transformPersistenceRow<ConditionalReturnType<T, TMainSchema>>(upserted, inheritanceDef),\n };\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService.updateSeedMetadata`.\n *\n * Privileged write path for the `__seed` row-metadata ledger ONLY.\n * See the interface JSDoc on `BackendResourceRepository.updateSeedMetadata`\n * (in `repositories-registry-handler.backend.service.ts`) for the full\n * rationale (R3-1, Phase-4 deep-review hotfix). Short version: the\n * standard `update(...)` path runs the patch through `validateRequestData`\n * which `.strip()`s `__seed` because no app resource declares that\n * system-managed field on its UPDATE DTO. This method bypasses the\n * DTO and writes directly via Kysely.\n *\n * Optimistic-locking parity (mirrors `upsertByBusinessKey`'s R-10\n * convention): `_version_db_doc` is bumped via\n * `coalesce(_version_db_doc, 0) + 1` so subsequent updates can keep\n * relying on the same monotonic counter.\n *\n * Defensive scoping: applies `buildContextualFilter` even though the\n * dispatcher always uses an internal super-admin context that\n * bypasses scope filters — same R3-1 review note as the Mongo sibling.\n *\n * @throws WildoError_Backend(NOT_FOUND) when the `_id` doesn't match.\n */\n // rag-ingestion-gate: N/A — writes only the engine-reserved `__seed` ledger (plan §3.c M5), so no\n // `.ragSource()` corpus text ever passes through this door; any drift class it could theoretically\n // join is bounded by the hourly RAG reconciliation sweep's contentHash comparison.\n public async updateSeedMetadata(\n executionContext: ExecutionContext<any>,\n id: string,\n seedMetadata: DataSeedRowMetadata,\n options?: RepositoryOptions,\n ): Promise<void> {\n const baseFilter = { _id: id };\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter as any, CoreResourceOperation.UPDATE, options);\n const where = this.buildWhere(contextualFilter);\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Read existing for `_version_db_doc` baseline (parity with\n // `upsertByBusinessKey`'s \"+1\" convention).\n const existing = await this.filterService\n .applyWhere(db.selectFrom(this.tableName).selectAll(), where)\n .executeTakeFirst();\n if (!existing) {\n throw this.errorBuilder.buildError(\n ErrorType.NOT_FOUND,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_SEED_METADATA_NOT_FOUND,\n context: {\n // diagnostic (log-only)\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n id,\n },\n },\n );\n }\n\n const previousVersion = typeof (existing as any)._version_db_doc === 'number'\n ? (existing as any)._version_db_doc\n : 0;\n const nextVersion = previousVersion + 1;\n\n // User-tracking only (no body fields).\n const trackedPayload: Record<string, unknown> = this.addUserTrackingAndTimestamps(\n {} as Record<string, unknown>,\n executionContext,\n CoreResourceOperation.UPDATE,\n );\n\n const writeRow: Record<string, unknown> = {\n ...trackedPayload,\n [DATA_SEED_ROW_METADATA_FIELD_KEY]: seedMetadata,\n _version_db_doc: nextVersion,\n };\n const toWrite = this.toSqlWriteRow(writeRow, inheritanceDef);\n try {\n await this.filterService\n .applyWhere(db.updateTable(this.tableName).set(toWrite as any), where)\n .execute();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n }\n\n /**\n * PG counterpart of `RepositoryResourceBackendService._tryBuildBusinessKeyFilter`.\n *\n * Bridges every `BUSINESS_KEY_ERROR_PREFIX`-tagged failure (no business\n * key declared, shape missing/extra fields, undefined values) to an\n * `INTERNAL` repository error — these are all programmer mistakes since\n * the dispatcher constructs the shape from the seed's own declaration,\n * never from user input. See `business-key-resolver.shared.utils.ts`\n * and audit finding R-3 for the full rationale.\n */\n private _tryBuildBusinessKeyFilter(\n executionContext: ExecutionContext<any>,\n businessKeyShape: Record<string, unknown>,\n ): Record<string, unknown> {\n try {\n return buildBusinessKeyFilter(this.resourceConfiguration.mainSchema, businessKeyShape);\n } catch (error) {\n const message = describeCaughtError(error);\n const isTagged = message.startsWith(BUSINESS_KEY_ERROR_PREFIX);\n throw this.errorBuilder.buildError(\n ErrorType.INTERNAL,\n executionContext,\n {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: {\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n message: isTagged ? message : `[business-key:untagged] ${message}`,\n },\n },\n );\n }\n }\n\n /**\n * Every column covered by the UNIQUE constraint a PostgreSQL duplicate-key error violated.\n *\n * The MongoDB arm answers this from the driver's structured `keyPattern`. PostgreSQL's equivalent\n * is `detail`, which the server formats as `Key (col_a, col_b)=(v1, v2) already exists.` — a\n * server-supplied answer, not a reconstruction, which is what keeps this comparable to the Mongo\n * side rather than a second implementation of index naming.\n *\n * **Deliberately NOT derived from `error.constraint`.** Mapping a constraint NAME back to columns\n * would mean re-deriving the schema convertor's naming rule (scope prefixes, `compoundWith`, key\n * order) in a second place free to drift from the first — exactly what\n * `resolveDeclaredUniqueConflictReference` refuses to do, and for the same reason.\n *\n * FAIL-SAFE, never fail-guessing: anything unparseable yields `[]`, so the caller keeps the\n * generic conflict code. A wrong-but-specific error code is worse than a correct generic one,\n * because an integrator branching on it takes the wrong recovery path.\n */\n private extractViolatedUniqueColumns(error: unknown): string[] {\n const detail = (error as { detail?: unknown } | null)?.detail;\n if (typeof detail !== 'string') return [];\n // `Key (a, b)=(1, 2) already exists.` — only the key list is read; the VALUES are deliberately\n // not parsed here (they can contain commas and parentheses of their own).\n const keyMatch = /^Key \\(([^)]*)\\)=/.exec(detail);\n if (!keyMatch?.[1]) return [];\n return keyMatch[1]\n .split(',')\n .map((column) => column.trim().replace(/^\"|\"$/g, ''))\n .filter((column) => column.length > 0);\n }\n\n /**\n * Translate a PostgreSQL driver error into the engine's conflict contract.\n *\n * **The MIRROR of `handleMongoDBError`, and until now it did not exist.** The declared-conflict\n * resolver's own docstring states that resolution by field names is \"adapter-neutral — a SQL\n * adapter reporting a violated constraint's columns resolves through the same path\". That was\n * ASPIRATIONAL: the extraction existed only on the MongoDB base class, so on a PostgreSQL-backed\n * resource every unique violation escaped as a raw driver error. A resource that had carefully\n * declared `.isUnique({ conflictMessageReference })` got the generic code — or no conflict\n * classification at all — for every write.\n *\n * Found while porting consumable tokens (plan item A-2): `createToken` turns a duplicate\n * `activeGenerationKey` into a CONFLICT the caller branches on, and MongoDB's `code: 11000` /\n * `keyPattern` have no PostgreSQL counterpart. But the gap is engine-wide, not token-specific —\n * every resource on this adapter was affected.\n *\n * `23505` is `unique_violation`. Anything else is returned untouched: a connection reset must not\n * be reported to a caller as \"that value is taken\".\n */\n private handlePostgresError(error: unknown, executionContext?: ExecutionContext<any>): Error | WildoError_Backend {\n const code = (error as { code?: unknown } | null)?.code;\n if (code !== '23505') {\n return error instanceof Error ? error : new Error(describeCaughtError(error));\n }\n\n const violatedFieldNames = this.extractViolatedUniqueColumns(error);\n const declaredConflictReference = resolveDeclaredUniqueConflictReference(\n this.resourceConfiguration.mainSchema as any,\n violatedFieldNames,\n );\n\n return this.errorBuilder.buildError(ErrorType.CONFLICT, executionContext, {\n customMessageReference: declaredConflictReference ?? ErrorCustomMessageReference.UNIQUE_CONSTRAINT_VIOLATION,\n context: {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n // Named as on the Mongo arm so a consumer reading either adapter's conflict sees one shape.\n fieldName: violatedFieldNames[0] ?? 'unknown',\n violatedFields: violatedFieldNames,\n originalError: (error as { message?: unknown } | null)?.message ?? describeCaughtError(error),\n },\n });\n }\n\n // ===========================================================================\n // Core private ops (initial subset)\n // ===========================================================================\n\n /**\n * retention-gate: N/A — INSERTs a brand-new row, so there is no existing row for a hide to protect.\n * A retained row is reached only through a filter, and this statement carries none.\n */\n private async _doCreate(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n data: any,\n options?: RepositoryOptions\n ): Promise<any> {\n const cleaned = this.resourceOperationHelper.cleanInputData(data, CoreResourceOperation.CREATE);\n const validated = this.repositoriesRegistry.validateRequestData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n CoreResourceOperation.CREATE,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.CREATE,\n options\n );\n\n // WS-C: no filter can constrain a create, so the unit the row lands in is checked here.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.CREATE, executionContext);\n\n if (executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable) {\n enriched.userId = null;\n }\n\n const withLiterals = this.resourceOperationHelper.injectNonDiscriminatorLiteralValues(\n enriched,\n this.resourceConfiguration.mainSchema\n );\n\n const withTracking = this.addUserTrackingAndTimestamps(withLiterals, executionContext, CoreResourceOperation.CREATE);\n // The repository version is framework-owned. Seed it explicitly so all\n // PostgreSQL deployments expose a durable version even when table DDL\n // predates a database-level default.\n delete withTracking._version;\n delete withTracking._version_db_doc;\n withTracking._version_db_doc = 1;\n\n // Create-time write integrity (SAME adapter-neutral authority as the MongoDB repository): FK\n // existence-in-scope + top-level mainSchema checks against the fully-enriched row, before the id is\n // folded to its physical column. A create has no filter/pre-image, so this is the only place a\n // dangling or cross-tenant FK is caught on a PostgreSQL-backed resource.\n await assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n withTracking,\n CoreResourceOperation.CREATE,\n operation.operationIdentifier,\n executionContext,\n options,\n referenceConstraintsOf(operation),\n );\n\n const withPhysicalId = this.withGeneratedRowIdentity(this.foldSurrogatePrimaryKey(withTracking));\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toWrite = this.toSqlWriteRow(withPhysicalId, inheritanceDef);\n\n // Unique violations are translated to the engine's CONFLICT contract here, mirroring the Mongo\n // arm's `handleMongoDBError`. Only the WRITE is wrapped: a read failing must not be reported as\n // a duplicate.\n let inserted: any;\n try {\n inserted = await db\n .insertInto(this.tableName)\n .values(toWrite as any)\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n\n if (!inserted) return null;\n return this.transformPersistenceRow(inserted, inheritanceDef);\n }\n\n /** retention-gate: N/A — bulk INSERT of brand-new rows; see `_doCreate`. */\n private async _doCreateMany(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n data: any,\n options?: RepositoryOptions\n ): Promise<any[]> {\n const dataArray = Array.isArray(data) ? data : [];\n const cleanedArray = this.resourceOperationHelper.cleanInputDataArray(dataArray, CoreResourceOperation.CREATE_MANY);\n const isBulkOperation = 'isBulkOperation' in operation && operation.isBulkOperation === true;\n const validatedArray = cleanedArray.map((item) =>\n this.repositoriesRegistry.validateRepositoryWriteData(\n item,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n String(operation.operationIdentifier),\n isBulkOperation,\n options,\n )\n ) as any[];\n\n const isAnonymousCreate = executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable;\n // `async` + `Promise.all`, mirroring the MongoDB adapter: the per-row narrowing guard now performs\n // a scoped tenant read. Kept PER ROW — a bulk create must not let one out-of-tenant row ride in.\n const enrichedArray = await Promise.all((Array.isArray(validatedArray) ? validatedArray : []).map(async (item) => {\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n item,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.CREATE_MANY,\n options\n );\n // WS-C: checked PER ROW — a bulk create must not let one out-of-grant row ride in on a batch.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.CREATE_MANY, executionContext);\n if (isAnonymousCreate) { enriched.userId = null; }\n return enriched;\n }));\n\n const withLiteralsArray = enrichedArray.map((item) =>\n this.resourceOperationHelper.injectNonDiscriminatorLiteralValues(item, this.resourceConfiguration.mainSchema)\n );\n\n const withTrackingArray = withLiteralsArray.map((item) => {\n const tracked = this.addUserTrackingAndTimestamps(\n item,\n executionContext,\n CoreResourceOperation.CREATE,\n );\n delete tracked._version;\n delete tracked._version_db_doc;\n tracked._version_db_doc = 1;\n return tracked;\n });\n\n // Create-time write integrity PER ROW (same authority as MongoDB) — one dangling/cross-tenant FK or\n // invalid cross-field row must not ride in on a batch.\n await Promise.all(withTrackingArray.map((row) => assertCreateWriteIntegrity(\n this.writeIntegrityDeps,\n row,\n CoreResourceOperation.CREATE_MANY,\n operation.operationIdentifier,\n executionContext,\n options,\n referenceConstraintsOf(operation),\n )));\n\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const toWriteArray = withTrackingArray.map((item) => this.toSqlWriteRow(this.withGeneratedRowIdentity(item), inheritanceDef));\n\n if (toWriteArray.length === 0) return [];\n\n const insertedRows = await db.insertInto(this.tableName).values(toWriteArray as any).returningAll().execute();\n return insertedRows.map((row: any) =>\n this.transformPersistenceRow(row, inheritanceDef),\n );\n }\n\n private async _doRead(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n options?: RepositoryOptions\n ): Promise<any> {\n // Align with Mongo behavior: READ requires an id or filter.\n if (!id_or_filter) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { operationIdentifier: CoreResourceOperation.READ }, // diagnostic (log-only)\n });\n }\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const { baseFilter } = this.buildBaseFilterFromIdOrFilter(id_or_filter, executionContext);\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter, CoreResourceOperation.READ, options);\n const where = this.buildWhere(contextualFilter);\n\n const qb = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n const row = await qb.executeTakeFirst();\n\n if (!row) return null;\n return this.transformPersistenceRow(row, inheritanceDef);\n }\n\n private async _doUpdate(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_filter: IdOrFilterType,\n data: any,\n options?: RepositoryOptions\n ): Promise<any> {\n const { baseFilter } = this.buildBaseFilterFromIdOrFilter(id_or_filter, executionContext);\n const id = await this.resolveSingleId(executionContext, baseFilter, CoreResourceOperation.UPDATE, options);\n if (!id) return null;\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const cleaned = this.resourceOperationHelper.cleanInputData(data, CoreResourceOperation.UPDATE);\n const isBulkOperation = 'isBulkOperation' in operation && operation.isBulkOperation === true;\n const validated = this.repositoriesRegistry.validateRepositoryWriteData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n String(operation.operationIdentifier),\n isBulkOperation,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.UPDATE,\n options\n );\n\n // WS-C: the contextual filter already confines WHICH row is updated; this confines the unit the\n // update may move it TO. An update that does not touch the unit field is unaffected.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.UPDATE, executionContext);\n\n // Referential + scope-via-junction integrity for any FK this update REASSIGNS (adapter-neutral twin\n // of the Mongo `_doUpdate` check — one authority, both adapters). Absent FKs skipped; exempt at entry.\n await assertUpdateWriteIntegrity(this.writeIntegrityDeps, enriched, CoreResourceOperation.UPDATE, executionContext, options, referenceConstraintsOf(operation));\n\n const withTracking = this.addUserTrackingAndTimestamps(enriched, executionContext, CoreResourceOperation.UPDATE);\n delete withTracking._version;\n delete withTracking._version_db_doc;\n // FIELD-CLEARING CONTRACT — deliberately no adapter work here, stated so its absence reads as a\n // decision rather than as the Mongo arm's twin having been forgotten (these repositories share\n // no base class, so a rule applied in one is invisible from the other).\n //\n // A `null` in this payload means \"this field has no value\". The Mongo arm MUST translate that\n // into `$unset`, because storing a literal null in a field declared `.optional()` produces a row\n // its own read projection then rejects. Here the same null compiles to `SET \"col\" = NULL`, and\n // `omitUnsetColumns` on the read path already turns a NULL column back into an ABSENT key — so\n // for a CLEARED field the observable round trip is identical with no partition, for exactly the\n // reason `atomicConditionalSet`'s `clearFields` needs none on this adapter either.\n //\n // SCOPE, corrected after an independent review flagged the earlier wording as over-broad: that\n // equivalence holds for the CLEARING half of the contract, not for all of it. A field authored\n // `.nullish()` keeps a readable stored `null` on MongoDB and is flattened to an absent key here,\n // because `omitUnsetColumns` drops every null column by design. That divergence pre-dates this\n // contract; what is new is that the contract now says so out loud instead of implying parity.\n // See the table on `partitionNullClearedFields`.\n const toWrite = this.toSqlWriteRow(\n withTracking,\n inheritanceDef,\n ) as Record<string, unknown>;\n // One atomic SQL UPDATE changes the business fields and advances the\n // authorization/optimistic-locking version. A read-then-set increment would\n // lose updates under concurrency.\n toWrite._version_db_doc =\n sql<number>`coalesce(\"_version_db_doc\", 0) + 1`;\n\n // ── The UPDATE re-asserts the CALLER'S predicates, not just the resolved id ────────────────\n //\n // This WHERE used to be built from `{ _id: id }` alone, which silently discarded every\n // predicate the caller supplied beyond identity — so a COMPARE-AND-SWAP such as\n // `update({ taskId, status: { $in: [...] } }, { status: FAILED })` degraded on PostgreSQL into\n // exactly the check-then-act it exists to eliminate: the predicate was evaluated in the SELECT\n // that resolved the id (`resolveSingleId`), then dropped from the statement that writes. Any\n // concurrent writer landing in that gap wins silently.\n //\n // Two consequences made this worth fixing at the root rather than papering over per caller:\n //\n // 1. **MongoDB does NOT behave this way** — it passes the whole filter to `findOneAndUpdate`,\n // so the same code was atomic on one adapter and racy on the other, while the contracts\n // built on top claimed the guarantee unconditionally. An adapter-conditional guarantee is\n // worse than no guarantee, because callers cannot see which one they have.\n // 2. `resolveSingleId` returns EARLY when `_id` is a plain string, without querying at all —\n // so for a `{ _id, status }` filter the extra predicates were dropped from BOTH statements\n // and the swap never happened anywhere. Carrying the base filter here closes that too.\n //\n // Re-asserting is safe: the same filter already compiled through `buildWhere` for the SELECT,\n // and SQL evaluates a WHERE against the PRE-update row, so filtering on a column this statement\n // is also writing is exactly the compare-and-swap semantics intended.\n const baseFilterCarriesPredicates = !!baseFilter\n && typeof baseFilter === 'object'\n && !Array.isArray(baseFilter)\n && Object.keys(baseFilter).length > 0;\n const updateSubject = baseFilterCarriesPredicates\n ? ({ $and: [baseFilter, { _id: id }] } as any)\n : ({ _id: id } as any);\n\n const contextualFilter = this.buildContextualFilter(executionContext, updateSubject, CoreResourceOperation.UPDATE, options);\n if (options?.ifMatchVersion !== undefined) {\n contextualFilter._version_db_doc = options.ifMatchVersion;\n }\n const scopedWhere = this.buildWhere(contextualFilter);\n\n // Same translation as `_doCreate`: an UPDATE can violate a unique constraint too (moving a row\n // onto a value another row already holds), and the Mongo arm wraps its update for that reason.\n let updated: any;\n try {\n updated = await db\n .updateTable(this.tableName)\n .set(toWrite as any)\n .$call((qb: any) => this.filterService.applyWhere(qb, scopedWhere))\n .returningAll()\n .executeTakeFirst();\n } catch (error) {\n throw this.handlePostgresError(error, executionContext);\n }\n\n if (!updated) return null;\n return this.transformPersistenceRow(updated, inheritanceDef);\n }\n\n private async _doDelete(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n id_or_ids_or_filter: IdOrIdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<any> {\n const { baseFilter } = this.buildBaseFilterFromIdOrFilter(id_or_ids_or_filter as any, executionContext);\n const id = await this.resolveSingleId(executionContext, baseFilter, CoreResourceOperation.DELETE, options);\n if (!id) return null;\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Same carry as `_doUpdate` (review finding F5-7). The DELETE's WHERE was built from\n // `{ _id: id }` alone, so a caller's guard predicate survived only in the SELECT that resolved\n // the id — and on the `resolveSingleId` short-circuit (a plain-string `_id`) it was dropped from\n // BOTH statements. MongoDB's `_doDelete` passes the whole filter, so the guarantee was\n // adapter-conditional, which the update fix called \"worse than no guarantee\". Tenancy is\n // re-applied either way, so this was never a scope bypass — but a guarded single delete\n // (`delete({ _id, status: 'draft' })`) silently ignored its guard, and the same file taught two\n // different answers for two verbs.\n const baseFilterCarriesPredicates = !!baseFilter\n && typeof baseFilter === 'object'\n && !Array.isArray(baseFilter)\n && Object.keys(baseFilter).length > 0;\n const deleteSubject = baseFilterCarriesPredicates\n ? ({ $and: [baseFilter, { _id: id }] } as any)\n : ({ _id: id } as any);\n\n const contextualFilter = this.buildContextualFilter(executionContext, deleteSubject, CoreResourceOperation.DELETE, options);\n const scopedWhere = this.buildWhere(contextualFilter);\n\n const deleted = await db\n .deleteFrom(this.tableName)\n .$call((qb: any) => this.filterService.applyWhere(qb, scopedWhere))\n .returningAll()\n .executeTakeFirst();\n\n if (!deleted) return null;\n return this.transformPersistenceRow(deleted, inheritanceDef);\n }\n\n private async _doDeleteMany(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<string[]> {\n const db = await this.getDbOrTrx(options);\n\n const filter = this.normalizeIdsOrFilter(ids_or_filter);\n const contextualFilter = this.buildContextualFilter(executionContext, filter, CoreResourceOperation.DELETE_MANY, options);\n const where = this.buildWhere(contextualFilter);\n\n // Return deleted ids (best-effort; depends on table having _id)\n const deletedRows = await db\n .deleteFrom(this.tableName)\n .$call((qb: any) => this.filterService.applyWhere(qb, where))\n .returning(['_id' as any])\n .execute();\n\n return (deletedRows || [])\n .map((r: any) => r?._id)\n .filter((v: any) => typeof v === 'string' && v.length > 0);\n }\n\n private async _doUpdateMany(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType | undefined,\n data: any,\n options?: RepositoryOptions\n ): Promise<any[]> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const cleaned = this.resourceOperationHelper.cleanInputData(data, CoreResourceOperation.UPDATE_MANY);\n const isBulkOperation = 'isBulkOperation' in operation && operation.isBulkOperation === true;\n const validated = this.repositoriesRegistry.validateRepositoryWriteData(\n cleaned,\n this.resourceConfiguration.resourceIdentifier as ResourceType,\n String(operation.operationIdentifier),\n isBulkOperation,\n options,\n );\n const enriched = this.resourceOperationHelper.enrichDataWithContext(\n validated,\n executionContext,\n this.resourceConfiguration.mainSchema,\n this.resourceConfiguration.resourceFieldIdentifier,\n this.resourceConfiguration,\n CoreResourceOperation.UPDATE_MANY,\n options\n );\n\n // WS-C: one patch applied to many rows — an out-of-grant unit value here would move EVERY matched\n // row out of the caller's grant at once, so the same value check applies.\n await this.assertOrganizationUnitWriteWithinGrant(enriched, CoreResourceOperation.UPDATE_MANY, executionContext);\n\n // Referential + scope-via-junction integrity for any FK this bulk patch REASSIGNS (adapter-neutral\n // twin of the Mongo `_doUpdateMany` check). Absent FKs skipped; exempt executions exempt at entry.\n await assertUpdateWriteIntegrity(this.writeIntegrityDeps, enriched, CoreResourceOperation.UPDATE_MANY, executionContext, options, referenceConstraintsOf(operation));\n\n const withTracking = this.addUserTrackingAndTimestamps(enriched, executionContext, CoreResourceOperation.UPDATE);\n delete withTracking._version;\n delete withTracking._version_db_doc;\n // Field-clearing contract: a `null` here compiles to `SET \"col\" = NULL` and reads back as an\n // ABSENT key — no partition needed on this adapter. See the full reasoning in `_doUpdate`.\n const toWrite = this.toSqlWriteRow(\n withTracking,\n inheritanceDef,\n ) as Record<string, unknown>;\n toWrite._version_db_doc =\n sql<number>`coalesce(\"_version_db_doc\", 0) + 1`;\n\n const filter = this.normalizeIdsOrFilter(ids_or_filter);\n const contextualFilter = this.buildContextualFilter(executionContext, filter, CoreResourceOperation.UPDATE_MANY, options);\n const where = this.buildWhere(contextualFilter);\n\n const updatedRows = await db\n .updateTable(this.tableName)\n .set(toWrite as any)\n .$call((qb: any) => this.filterService.applyWhere(qb, where))\n .returningAll()\n .execute();\n\n return (updatedRows || []).map((row: any) =>\n this.transformPersistenceRow(row, inheritanceDef),\n );\n }\n\n private async _doList(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n ids_or_filter?: IdsOrFilterType,\n options?: RepositoryOptions & { listOptions?: { page?: number; limit?: number; sort?: Record<string, 1 | -1> }; paginated?: boolean }\n ): Promise<any[] | Resources_PaginatedResult<any>> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const filter = this.normalizeIdsOrFilter(ids_or_filter);\n const contextualFilter = this.buildContextualFilter(executionContext, filter, CoreResourceOperation.LIST, options);\n const where = this.buildWhere(contextualFilter);\n\n const paginated = (options as any)?.paginated ?? false;\n const listOptions = (options as any)?.listOptions;\n const hasPagination = paginated || listOptions?.page !== undefined || listOptions?.limit !== undefined;\n\n let page = 1;\n let limit = 0;\n let offset = 0;\n let total = 0;\n let totalPages = 1;\n\n if (paginated || hasPagination) {\n const countRow = await this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where\n ).executeTakeFirst();\n\n const countVal = (countRow as any)?.count;\n total = typeof countVal === 'number' ? countVal : typeof countVal === 'string' ? Number(countVal) : 0;\n page = Math.max(1, listOptions?.page || 1);\n // Mongo sibling of the same rule. This adapter already defaulted to 20 (so it never produced\n // the whole-collection page the Mongo `_doList` did), but it capped at a hard-coded 100 while\n // ignoring the operation's declared `maxPaginatedResultPerPageLimit` — so an operation\n // declaring 50 could still be asked for 100, and one declaring 200 was silently held to 100.\n // Both adapters now read the same declared ceiling, defaulting to the 100 that was already\n // hard-coded on BOTH sides of this line — see the Mongo sibling for why the default is 100\n // rather than SEARCH's 50.\n const maxLimit = (operation as { maxPaginatedResultPerPageLimit?: number }).maxPaginatedResultPerPageLimit || 100;\n //\n // ## What the pagination guarantee IS, and what it is not — decided 2026-09-08 (#471)\n //\n // This clamp bounds what an HTTP CALLER can request, and nothing else. With `paginated ===\n // false` and no `listOptions` this block is skipped entirely and every row is returned — the\n // internal-call contract, identical to the Mongo adapter's, where the same reasoning is\n // written out at length.\n //\n // The residual risk is named rather than assumed away: an internal enumeration over a very\n // large tenant can exhaust memory. Completeness is what sweeps, cascades and subject exports\n // rely on, so the unbounded shape stays; an internal caller that does not need completeness\n // pages explicitly by passing `listOptions`.\n limit = Math.min(maxLimit, Math.max(1, listOptions?.limit || 20));\n offset = (page - 1) * limit;\n totalPages = limit > 0 ? Math.max(1, Math.ceil(total / limit)) : 1;\n }\n\n // Sort mirrors SEARCH (and the mongo adapter): validate the caller-supplied\n // multi-sort against the operation's `sortFields` in priority order, then\n // fall back to createdAt-desc when nothing is requested/configured so an\n // absent `sort` preserves the prior newest-first default.\n const listSortOptions = this.constructValidatedSortOptions(listOptions?.sort, operation);\n let qb: any = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n if (listSortOptions.length > 0) {\n listSortOptions.forEach((s) => {\n qb = qb.orderBy(s.field, s.direction);\n });\n } else if (this.plannedFieldNames.has('createdAt')) {\n qb = qb.orderBy('createdAt', 'desc');\n }\n if (hasPagination) {\n qb = qb.limit(limit).offset(offset);\n }\n\n const rows = await qb.execute();\n const dataRows = rows.map((row: any) =>\n this.transformPersistenceRow(row, inheritanceDef),\n );\n\n if (paginated) {\n return {\n data: dataRows,\n pagination: { page, limit: limit || dataRows.length, total: total || dataRows.length, totalPages },\n };\n }\n\n return dataRows;\n }\n\n private async _doSearch<T = any>(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n searchQuery: string,\n filter: any = {},\n options?: RepositoryOptions & { searchOptions?: { fieldsToSearch?: string[]; page?: number; limit?: number; sort?: any } }\n ): Promise<Resources_PaginatedResult<T>> {\n const db = await this.getDbOrTrx(options);\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n // Search metadata must come from the same routed operation that controls\n // response shaping. Falling back to a default SEARCH is only for direct\n // helper paths that did not carry the full operation object.\n const searchConfig = ResourceOperationsUtils.getCoreResourceOperationFromOperation(operation) === CoreResourceOperation.SEARCH\n ? operation\n : this.findSearchOperationConfiguration();\n if (!searchConfig) {\n throw this.errorBuilder.buildError(ErrorType.NOT_FOUND, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_SEARCH_NOT_CONFIGURED,\n });\n }\n\n const op = searchConfig as unknown as {\n isSearchable?: boolean;\n maxPaginatedResultPerPageLimit?: number;\n };\n\n if (!op.isSearchable) {\n throw this.errorBuilder.buildError(ErrorType.BUSINESS_RULE, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_SEARCH_NOT_ENABLED,\n });\n }\n\n const trimmed = String(searchQuery || '').trim();\n const baseFilter = this.sanitizeRequestFilter(filter, searchConfig);\n\n const page = Math.max(1, options?.searchOptions?.page || 1);\n const maxLimit = op.maxPaginatedResultPerPageLimit || 50;\n const limit = Math.min(maxLimit, Math.max(1, options?.searchOptions?.limit || 20));\n const offset = (page - 1) * limit;\n\n const searchFilter = trimmed\n ? await this.constructSearchQuery(trimmed, searchConfig, options?.searchOptions?.fieldsToSearch)\n : {};\n const combinedFilter = trimmed ? ({ $and: [baseFilter, searchFilter] } as any) : baseFilter;\n let contextualFilter = this.buildContextualFilter(executionContext, combinedFilter, CoreResourceOperation.SEARCH, options);\n contextualFilter = await this.applyJunctionScopeFilter(executionContext, contextualFilter);\n const where = this.buildWhere(contextualFilter);\n\n const sortOptions = this.constructValidatedSortOptions(options?.searchOptions?.sort, searchConfig);\n\n let qb: any = this.filterService.applyWhere(db.selectFrom(this.tableName).selectAll(), where);\n if (sortOptions.length > 0) {\n sortOptions.forEach((s) => {\n qb = qb.orderBy(s.field, s.direction);\n });\n } else if (this.plannedFieldNames.has('createdAt')) {\n qb = qb.orderBy('createdAt', 'desc');\n }\n\n qb = qb.limit(limit).offset(offset);\n\n const countRow = await this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where\n ).executeTakeFirst();\n\n const countVal = (countRow as any)?.count;\n const total = typeof countVal === 'number' ? countVal : typeof countVal === 'string' ? Number(countVal) : 0;\n\n const rows = await qb.execute();\n const data = rows.map((row: any) =>\n this.transformPersistenceRow<T>(row, inheritanceDef),\n );\n\n return {\n data,\n pagination: { page, limit, total, totalPages: Math.ceil(total / limit) },\n };\n }\n\n private async _doCount(\n operation: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n executionContext: ExecutionContext<any>,\n filter: any = {},\n options?: RepositoryOptions\n ): Promise<{ count: number }> {\n const db = await this.getDbOrTrx(options);\n let contextualFilter = this.buildContextualFilter(executionContext, filter as any, CoreResourceOperation.COUNT, options);\n contextualFilter = await this.applyJunctionScopeFilter(executionContext, contextualFilter);\n const where = this.buildWhere(contextualFilter);\n\n const qb = this.filterService.applyWhere(\n db.selectFrom(this.tableName).select(sql<number>`count(*)`.as('count')),\n where\n );\n\n const row = await qb.executeTakeFirst();\n const countVal = (row as any)?.count;\n if (typeof countVal === 'number') return { count: countVal };\n if (typeof countVal === 'string') return { count: Number(countVal) };\n return { count: 0 };\n }\n\n // ===========================================================================\n // DB client resolution\n // ===========================================================================\n\n /**\n * Framework-internal LIST that does NOT require a declared LIST operation.\n *\n * PostgreSQL sibling of the MongoDB method, and the reason it cannot simply call\n * `list()`: that method throws when the resource declares no default LIST, which is\n * exactly the case this exists to serve (data-seed scans by `__seed.seedKey`, and the\n * controller's context-addressed-singleton authorization resolving a singleton id by\n * parent FK). A resource with no user-facing LIST surface must still be listable by\n * framework machinery.\n *\n * The synthetic operation is REPOSITORY_ONLY so it can never be mistaken for an\n * API-facing surface. Contextual filtering still applies — `_doList` builds it — so\n * this bypasses the OPERATION requirement, never the tenant boundary.\n */\n public async listForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<ConditionalArrayReturnType<T, TMainSchema>>;\n public async listForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options: RepositoryOptions & { paginated: true; listOptions?: Partial<Resources_PaginationRequest> }\n ): Promise<Resources_PaginatedResult<ConditionalReturnType<T, TMainSchema>>>;\n public async listForInternalScan<T = undefined>(\n executionContext: ExecutionContext<any>,\n ids_or_filter: IdsOrFilterType,\n options?: RepositoryOptions\n ): Promise<any> {\n const declaredListOperation = this.resourceConfiguration.operations.find(\n (op) => op.operationIdentifier === CoreResourceOperation.LIST && op.isOperationDefault === true\n );\n const operation = declaredListOperation ?? ({\n operationIdentifier: CoreResourceOperation.LIST,\n variantType: ResourceOperationVariantType.REPOSITORY_ONLY,\n isOperationDefault: true,\n } as unknown as ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>);\n\n return this._doList(operation as any, executionContext, ids_or_filter, options);\n }\n\n /**\n * System-level membership projection for scope-required reference search.\n *\n * Reads THIS (junction) resource's `targetFkField` values for rows matching\n * `{ [scopeFkField]: scopeId }`. It deliberately BYPASSES operation authorization and\n * contextual filtering — it resolves the in-scope id set for a caller the authorization\n * layer has ALREADY admitted for that scope, so it is a membership projection rather\n * than a user-facing read. The retention hide is still applied, because a retained row\n * must not reappear through a projection either.\n *\n * Rows are read whole and reassembled through `transformPersistenceRow` rather than\n * selecting the single column: a junction FK is not guaranteed to be a planned column —\n * unplanned fields live inside a jsonb root — and only the planner knows how to put a\n * row back together. Junctions are narrow, so reading the row is the cheap, correct\n * option; hand-rolling a jsonb path here would be a second place for that mapping to\n * drift from the planner.\n */\n public async findScopeRelatedTargetIds(\n scopeFkField: string,\n scopeId: string,\n targetFkField: string,\n ): Promise<string[]> {\n const db = await this.getDbOrTrx();\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n\n const baseFilter: Record<string, unknown> = { [scopeFkField]: scopeId };\n const filter = isRetentionGovernedResource(this.resourceConfiguration)\n ? withRetentionHideApplied(baseFilter)\n : baseFilter;\n\n const where = this.buildWhere(filter as ResourceFilter);\n\n /**\n * PROJECT the single column when it is planned, and only fall back to reading whole rows\n * when it is not.\n *\n * The Mongo sibling projects (`{ [targetFkField]: 1, _id: 0 }`), and a junction can hold a\n * large number of rows, so selecting every column would be a real resource regression\n * against the adapter this one is meant to reach parity with. The fallback exists because\n * an UNPLANNED field lives inside a jsonb root, where only the planner knows how to\n * reassemble it — correctness first, but not at the cost of every planned case.\n */\n const targetIsPlannedColumn = this.plannedFieldNames.has(targetFkField);\n const rows = await this.filterService\n .applyWhere(\n targetIsPlannedColumn\n ? db.selectFrom(this.tableName).select(targetFkField)\n : db.selectFrom(this.tableName).selectAll(),\n where,\n )\n .execute();\n\n const ids = new Set<string>();\n for (const row of rows) {\n const value = targetIsPlannedColumn\n ? (row as Record<string, unknown>)[targetFkField]\n : this.transformPersistenceRow<Record<string, unknown>>(row, inheritanceDef)?.[targetFkField];\n if (value === undefined || value === null) {\n continue;\n }\n const id = String(value);\n if (id.length > 0) {\n ids.add(id);\n }\n }\n return [...ids];\n }\n\n /**\n * Run THIS resource's own searchable surface against `searchQuery` and project the join values —\n * the PostgreSQL half of relational search (#470).\n *\n * Exact contract parity with the Mongo sibling in `repository-resource.backend.service.ts`, and\n * the shape is worth stating because it explains why this reached parity at all: **the relational\n * search is not a JOIN.** Mongo does not `$lookup`; it runs a secondary query on the RELATED\n * repository, collects join values, and folds them into one `{ localField: { $in } }` branch. That\n * decomposition is adapter-agnostic — which is why the PostgreSQL arm needed this projection and a\n * fold, not a query planner.\n *\n * Raw, lean, SYSTEM read by design, mirroring the Mongo sibling: no operation auth and no\n * contextual filter. Tenant safety is unaffected because the CALLER's query stays scoped — this\n * only ever narrows an already-scoped set by contributing ids to an OR branch.\n *\n * The retention hide IS applied: a retained row must not contribute a search match, exactly as the\n * Mongo sibling AND-s `withRawRetentionHide` over its match filter.\n */\n public async findSearchMatchTargetIds(\n searchQuery: string,\n joinField: string,\n options?: { fields?: string[] },\n ): Promise<string[]> {\n if (!searchQuery?.trim()) return [];\n\n /*\n * Bound the candidate set so a broad term cannot build an unbounded `IN (…)`. The same cap and\n * the same reasoning as the Mongo sibling — tenant safety is unaffected, this caps the fold size\n * only — and it must STAY the same number, or the two adapters return different result sets for\n * the same declaration, which is the drift this whole issue exists to remove.\n */\n const MATCH_ID_CAP = 1000;\n\n const searchConfig = this.findSearchOperationConfiguration();\n const op = searchConfig as unknown as { searchableFields?: Array<string | object> } | null;\n\n // Default to this resource's OWN string searchable fields — \"use the juncted element's search\" —\n // unless the caller pins a subset. Descriptors are skipped here on purpose: a relational\n // descriptor on the RELATED resource would recurse, and the Mongo sibling does not do it either.\n const ownStringFields = (op?.searchableFields ?? []).filter((field): field is string => typeof field === 'string');\n const fields = options?.fields && options.fields.length > 0 ? options.fields : ownStringFields;\n if (fields.length === 0) {\n this.logDebug('findSearchMatchTargetIds: no searchable fields resolved for relational match', {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n });\n return [];\n }\n\n const matchConditions = fields.map((field) => ({ [field]: { $contains: searchQuery, $options: 'i' } }));\n const matchFilter: Record<string, unknown> = matchConditions.length > 1\n ? { $or: matchConditions }\n : (matchConditions[0] ?? {});\n const filter = isRetentionGovernedResource(this.resourceConfiguration)\n ? withRetentionHideApplied(matchFilter)\n : matchFilter;\n\n const db = await this.getDbOrTrx();\n const inheritanceDef = (this.resourceConfiguration as any)?.inheritenceSchemaDefinition;\n const where = this.buildWhere(filter as ResourceFilter);\n\n // Project the single column when it is planned; fall back to whole rows only when it is not,\n // because an unplanned field lives inside a jsonb root that only the planner can reassemble.\n // Identical reasoning to `findScopeRelatedTargetIds` above.\n const joinIsPlannedColumn = this.plannedFieldNames.has(joinField);\n const rows = await this.filterService\n .applyWhere(\n joinIsPlannedColumn\n ? db.selectFrom(this.tableName).select(joinField)\n : db.selectFrom(this.tableName).selectAll(),\n where,\n )\n .limit(MATCH_ID_CAP + 1)\n .execute();\n\n if (rows.length > MATCH_ID_CAP) {\n this.logDebug('findSearchMatchTargetIds: related match set truncated to cap', {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n cap: MATCH_ID_CAP,\n });\n }\n\n const ids = new Set<string>();\n for (const row of rows.slice(0, MATCH_ID_CAP)) {\n const value = joinIsPlannedColumn\n ? (row as Record<string, unknown>)[joinField]\n : this.transformPersistenceRow<Record<string, unknown>>(row, inheritanceDef)?.[joinField];\n if (value === undefined || value === null) continue;\n const id = String(value);\n if (id.length > 0) ids.add(id);\n }\n return [...ids];\n }\n\n /**\n * Aggregate a numeric field across rows matching the filter (feature-limit enforcement).\n *\n * Contextual filtering IS applied — this reads user data and the result gates a quota,\n * so a cross-tenant sum would be both a disclosure and a wrong limit.\n *\n * REFUSES an unplanned field rather than aggregating it. An unplanned field lives inside\n * a jsonb root, where SQL would need an explicit numeric cast that could silently yield\n * NULL (→ 0) for a value that is present but not a number. Returning 0 from a quota\n * check reads as \"nothing consumed\" and would OPEN the limit, so a loud configuration\n * error is the only safe answer. The MongoDB sibling has no equivalent restriction\n * because a document store needs no column plan.\n */\n public async aggregateField(\n executionContext: ExecutionContext<any>,\n filter: ResourceFilter,\n field: string,\n operation: string,\n ): Promise<number> {\n if (!this.plannedFieldNames.has(field)) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n message:\n 'aggregateField requires a planned SQL column on PostgreSQL-backed resources; '\n + 'aggregating a jsonb-stored field could silently yield 0 and open the limit it guards.',\n resourceType: this.resourceConfiguration.resourceIdentifier,\n field,\n operation,\n },\n });\n }\n\n const contextualFilter = this.buildContextualFilter(\n executionContext,\n filter ?? {},\n CoreResourceOperation.READ,\n );\n const where = this.buildWhere(contextualFilter);\n const db = await this.getDbOrTrx();\n\n // COALESCE mirrors the Mongo sibling's `$ifNull`: absent rows and NULL values both\n // contribute 0 rather than collapsing the whole aggregate to NULL.\n const aggregate = ((): any => {\n switch (operation) {\n case 'AVG':\n return sql<number>`coalesce(avg(${sql.ref(field)}), 0)`;\n case 'MAX':\n return sql<number>`coalesce(max(${sql.ref(field)}), 0)`;\n case 'SUM':\n default:\n return sql<number>`coalesce(sum(${sql.ref(field)}), 0)`;\n }\n })();\n\n const row = await this.filterService\n .applyWhere(db.selectFrom(this.tableName), where)\n .select(aggregate.as('result'))\n .executeTakeFirst();\n\n return Number(row?.result ?? 0);\n }\n\n /** Scope-required reference search — the RESOLVING half. See the shared authority. */\n private async applyJunctionScopeFilter(\n executionContext: ExecutionContext<any>,\n filter: ResourceFilter,\n ): Promise<ResourceFilter> {\n return applyJunctionScopeFilter({\n filter: filter as Record<string, any>,\n relationshipContexts: executionContext.relationshipContexts as any,\n targetResourceType: this.resourceConfiguration.resourceIdentifier as ResourceType,\n manyToManyScopeJunctions: this.resourceRegistry.getResourcesRegistry().manyToManyScopeJunctions as any,\n getJunctionRepository: (junctionResourceType) =>\n this.repositoriesRegistry.getRepository(junctionResourceType) as any,\n }) as Promise<ResourceFilter>;\n }\n\n private async getDbOrTrx(options?: RepositoryOptions): Promise<any> {\n const tx = this.getTransaction(options);\n if (tx) {\n return tx.nativeSession as any;\n }\n return await this.dbService.getDb();\n }\n\n // ===========================================================================\n // Helpers\n // ===========================================================================\n\n private normalizeIdsOrFilter(ids_or_filter?: IdsOrFilterType): ResourceFilter {\n if (!ids_or_filter) return {};\n if (Array.isArray(ids_or_filter)) return { _id: { $in: ids_or_filter } } as any;\n if (typeof ids_or_filter === 'object' && ids_or_filter !== null && 'ids' in (ids_or_filter as any)) {\n const ids = (ids_or_filter as any).ids;\n const filter = (ids_or_filter as any).filter;\n const base = Array.isArray(ids) ? { _id: { $in: ids } } : {};\n return filter ? ({ $and: [base, filter] } as any) : (base as any);\n }\n return ids_or_filter as any;\n }\n\n /**\n * Validate an ID using ResourceIdBackendService if available.\n * For PostgreSQL, IDs should be valid UUIDs.\n *\n * @param id - The ID to validate\n * @param executionContext - Execution context for error handling\n * @throws Error if ID is invalid\n */\n private validateId(id: string, executionContext: ExecutionContext<any>): void {\n if (this.resourceIdService) {\n const resourceType = String(this.resourceConfiguration.resourceIdentifier);\n if (!this.resourceIdService.validateForResource(id, resourceType)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n context: { resourceType, id }, // diagnostic (log-only)\n });\n }\n }\n }\n\n private buildBaseFilterFromIdOrFilter(\n id_or_filter: IdOrFilterType,\n executionContext: ExecutionContext<any>\n ): { baseFilter: ResourceFilter } {\n let baseFilter: ResourceFilter = {};\n if (!id_or_filter) return { baseFilter };\n\n if (typeof id_or_filter === 'string') {\n this.validateId(id_or_filter, executionContext);\n baseFilter = { _id: id_or_filter } as any;\n } else if (typeof id_or_filter === 'object' && !Array.isArray(id_or_filter)) {\n if ('id' in (id_or_filter as any)) {\n const id = (id_or_filter as any).id;\n if (typeof id === 'string') this.validateId(id, executionContext);\n baseFilter = { _id: id } as any;\n const extra = (id_or_filter as any).filter;\n if (extra && Object.keys(extra).length > 0) {\n baseFilter = { $and: [baseFilter, extra] } as any;\n }\n } else if ('id_or_ids' in (id_or_filter as any)) {\n const ids = (id_or_filter as any).id_or_ids;\n if (typeof ids === 'string') {\n this.validateId(ids, executionContext);\n baseFilter = { _id: ids } as any;\n } else if (Array.isArray(ids)) {\n ids.forEach((id: string) => this.validateId(id, executionContext));\n baseFilter = { _id: { $in: ids } } as any;\n }\n const extra = (id_or_filter as any).filter;\n if (extra && Object.keys(extra).length > 0) {\n baseFilter = { $and: [baseFilter, extra] } as any;\n }\n } else {\n baseFilter = id_or_filter as any;\n }\n } else {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.REPOSITORY_RESOURCE_OPERATION_FAILED,\n });\n }\n\n return { baseFilter };\n }\n\n private buildContextualFilter(\n executionContext: ExecutionContext<any>,\n baseFilter: ResourceFilter,\n /**\n * The core operation THIS repository call is executing — NOT `executionContext.operation`. The\n * retention authority classifies it to decide whether a see-through EC may suppress the hide\n * (read-family only); see `assignRetentionHideForOperation`.\n */\n executedCoreOperation: CoreResourceOperation,\n options?: RepositoryOptions\n ): ResourceFilter {\n // Translate the date-range filter vocabulary (`{ startDate?, endDate? }`) into `{ $gte?, $lte? }`\n // BEFORE `buildWhereExpression` compiles it — its comparison compiler already handles `$gte`/`$lte`,\n // whereas a raw `{startDate,endDate}` would be treated as a nested-path equality and never filter.\n // Same shared helper the Mongo adapter's `buildContextualFilter` calls (single source of truth).\n const contextualFilter: ResourceFilter = normalizeDateRangeFilters({ ...(baseFilter || {}) }) as any;\n\n // ── M5a: retention hide predicate (privacy boundary) — Postgres sibling of the Mongo chokepoint.\n // Both adapters call the SAME retention authority, which is the whole point: the two used to carry\n // hand-written copies of the predicate and silently disagreed about NULL markers (gate G-PG-NULL)\n // until the PostgreSQL compilers were taught to emit `IS DISTINCT FROM` for `ne`. The authority's\n // emitter documents that operator choice as load-bearing, so the parity cannot be re-lost here.\n //\n // Placement is identical to the Mongo sibling and equally deliberate: BEFORE the\n // `excludeContextualFilter` (SCOPE-bypass) early-return, and writing at the TOP LEVEL so an\n // injected `retentionStatus: RETAINED` is neutralised rather than honoured.\n assignRetentionHideForOperation(\n contextualFilter,\n this.resourceConfiguration,\n executionContext,\n executedCoreOperation,\n );\n\n if (options?.excludeContextualFilter === true) {\n return contextualFilter;\n }\n\n const blacklistedFields = new Set<string>();\n blacklistedFields.add(this.resourceConfiguration.resourceFieldIdentifier);\n if (Array.isArray(options?.excludeContextualFilter)) {\n options.excludeContextualFilter.forEach((f) => blacklistedFields.add(f));\n }\n\n // D1 CLOSED — scope-required reference search, the SKIP half. Its resolving half runs in\n // `_doSearch`/`_doCount` below; the two travel together by construction (shared module), which\n // is what makes adding the skip safe now and would have made it a tenancy leak before.\n const junctionScopedFieldIdentifiers = collectJunctionScopedFieldIdentifiers({\n relationshipContexts: executionContext.relationshipContexts,\n allResourceFieldIdentifiers: this.resourceRegistry?.getResourcesRegistry()?.allResourceFieldIdentifiers,\n });\n\n const contextResourceIds = executionContext.getContextResourceIds();\n contextResourceIds.forEach((resourceId, fieldIdentifier) => {\n if (blacklistedFields.has(fieldIdentifier)) return;\n // Resolved THROUGH the junction, not a column here — skipping avoids the fail-closed\n // \"missing from schema\" check that previously refused these routes outright.\n if (junctionScopedFieldIdentifiers.has(fieldIdentifier)) return;\n\n // Adapter parity with the Mongo repository: a resource's PRIMARY-SCOPE FK is not always\n // modeled in its Zod main schema (a schema shared across scopes cannot author one — see the\n // ORGANIZATION_FEATURES / ScopeFeatures case documented on the Mongo path), yet it IS a real\n // persisted column contributed by the relationship. Filtering it must not fail closed, or an\n // org-scoped request cannot delete a tenant at all.\n //\n // PostgreSQL can be stricter than Mongo here, and should be: the column must actually be\n // PLANNED, otherwise the filter would be a SQL error rather than a no-op. `plannedFieldNames`\n // is the persisted-column truth this adapter already trusts for the org-scoping block below.\n const primaryScopeFieldIdentifier = this.resourceConfiguration.resourcePrimaryScope\n ? PRIMARY_SCOPE_TO_FIELD_IDENTIFIER[this.resourceConfiguration.resourcePrimaryScope]\n : undefined;\n if (\n fieldIdentifier === primaryScopeFieldIdentifier\n && this.plannedFieldNames.has(fieldIdentifier)\n && this.resourceOperationHelper.findNestedFieldPathsFromZodSchema(\n this.resourceConfiguration.mainSchema,\n fieldIdentifier,\n ).length === 0\n ) {\n // AUTHORITATIVE — see the Mongo sibling and `applyAuthoritativeContextFilterValue`. Both\n // adapters route through the one authority precisely because a predicate added to one of\n // them has historically been a bypass on the other.\n this.resourceOperationHelper.applyAuthoritativeContextFilterValue(\n contextualFilter, fieldIdentifier, resourceId,\n { fieldIdentifier, resourceIdentifier: String(this.resourceConfiguration.resourceIdentifier) },\n );\n return;\n }\n\n const allMatchingPaths = this.resourceOperationHelper.findRequiredNestedFieldPathsFromZodSchema(\n this.resourceConfiguration.mainSchema,\n fieldIdentifier,\n executionContext,\n {\n reason: 'context_filter',\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n message: `Execution context field '${fieldIdentifier}' is missing from schema for resource '${this.resourceConfiguration.resourceIdentifier}' during contextual filtering`,\n }\n );\n /*\n * THE SCOPE FIELD FILTERS AT THE TOP LEVEL ONLY — the third site of the same invariant fixed\n * on 2026-09-01 (the initiator-organization confinement, the Mongo context block, and this\n * twin), and the one that was actually RUNNING when the defect was measured: this adapter\n * served `wildoApplicationActorTasks`, whose schema nests\n * `errorStates.errorItems.initiatorIds.organizationId` (a recorded error's initiator — data,\n * not tenancy), and the unrestricted sweep put that dotted path into the filter, which this\n * adapter's compiler refused as an invalid column reference — a 400 on every LIST. Read the\n * Mongo sibling's block comment for the full account, including why Mongo's failure mode for\n * the same sweep is WORSE (silent row-hiding rather than a crash). The write path had already\n * learned this lesson (`enrichDataWithContextFields`: \"Deep matches inside embedded payloads\n * are never the scope column\").\n */\n const isScopeField = fieldIdentifier === primaryScopeFieldIdentifier;\n const matchingPaths = isScopeField\n ? allMatchingPaths.filter((fullPath) => fullPath === fieldIdentifier)\n : allMatchingPaths;\n if (isScopeField && matchingPaths.length === 0 && allMatchingPaths.length > 0) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.CONFIGURATION,\n context: {\n reason: 'scope_field_modeled_only_nested',\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n fieldIdentifier,\n nestedPaths: allMatchingPaths,\n message: `Scope field '${fieldIdentifier}' appears only NESTED in the schema for resource `\n + `'${this.resourceConfiguration.resourceIdentifier}'. A scoped resource carries its scope FK as a `\n + 'top-level column (the write path injects it there); a nested occurrence of the name is data. '\n + 'Refusing rather than widening the query beyond its tenant.',\n },\n });\n }\n matchingPaths.forEach((fullPath) => {\n /**\n * D2 — resolve a SURROGATE primary key to the queryable column.\n *\n * A surrogate PK (FILES `fileId`) exists in the Zod schema but is persisted as `_id`,\n * so filtering on the authored name targets a column that does not exist. The\n * resolver is shared, adapter-neutral, and the Mongo sibling has always called it;\n * this adapter simply did not, which is the whole of divergence D2.\n *\n * The old behaviour was loud rather than silent (a SQL error on the unknown column),\n * so this fixes a broken path rather than closing a leak — but a surrogate-PK-keyed\n * context filter could not work on PostgreSQL at all until now.\n */\n const filterPath = this.resourceOperationHelper.resolveQueryableFilterPath(\n this.resourceConfiguration.mainSchema,\n fullPath,\n );\n this.resourceOperationHelper.applyAuthoritativeContextFilterValue(\n contextualFilter, filterPath, resourceId,\n { fieldIdentifier, resourceIdentifier: String(this.resourceConfiguration.resourceIdentifier) },\n );\n });\n });\n\n // D3 — initiator-organization confinement, now CROSSING-AWARE and shared with Mongo.\n // This adapter applied it and Mongo did not; worse, it did not know about declared\n // cross-tenant doors, so an operation authorization had admitted was silently re-confined\n // to the operator's own tenant. `plannedFieldNames` stays the persistence predicate here:\n // this adapter knows which columns exist, and filtering on an unplanned one is a SQL error.\n assignInitiatorOrganizationConfinementToFilter({\n filter: contextualFilter,\n executionContext,\n blacklistedFields,\n mainSchema: this.resourceConfiguration.mainSchema,\n schemaPaths: this.resourceOperationHelper,\n isFieldPersisted: (fieldName) => this.plannedFieldNames.has(fieldName),\n });\n\n // Defense-in-depth: enforce userId = null for ANONYMOUS scope on isAnonymizable resources.\n //\n // Adapter-neutral twin of the Mongo arm — read the note there for why this presence-blind\n // equality is sound. On SQL a column always exists, so \"absent\" and NULL are the same state\n // by construction and this predicate cannot be split the way MongoDB's can; the guarantee it\n // relies on is the same one, namely that `isAnonymizable` forces `userId` to accept null.\n if (executionContext.isAnonymousExecution() && this.resourceConfiguration.isAnonymizable) {\n const userPaths = this.resourceOperationHelper.findNestedFieldPathsFromZodSchema(\n this.resourceConfiguration.mainSchema, 'userId'\n );\n userPaths.forEach(fullPath => {\n this.resourceOperationHelper.setNestedValue(contextualFilter, fullPath, null);\n });\n }\n\n this.applyFKRelationshipFilters(executionContext, contextualFilter, blacklistedFields);\n\n // ── WS-C: organization-unit narrowing — PostgreSQL sibling of the Mongo chokepoint.\n // Both adapters call the SAME enforcement authority, and that is the whole point: a narrowing\n // rule present on one adapter and absent on the other is not a gap, it is an authorization bypass\n // on the adapter that lacks it — the shape that produced gate G-PG-NULL for the retention hide.\n // The emitted `$in` predicate (including the empty-array deny-all) is compiled portably here; see\n // the authority's emitter documentation before changing the operator.\n // Placement is identical to the Mongo sibling and equally deliberate: AFTER the\n // `excludeContextualFilter` scope-bypass return, LAST, and writing at the TOP LEVEL.\n assignOrganizationUnitNarrowingToFilter(\n contextualFilter,\n this.resourceConfiguration.resourceIdentifier,\n this.resourceRegistry?.getResourcesRegistry()?.organizationUnitNarrowing,\n executionContext,\n );\n\n // ── Scope-ROOT collection confinement — MongoDB sibling of the same authority ─────────────────\n // See the Mongo call site for the full reasoning. The `$in` (including the empty-array deny-all)\n // compiles portably here; this adapter's compiler emits `FALSE` for an empty `IN`, which is why\n // the authority can ship ONE emitter for the confined and the fail-closed case.\n assignScopeRootCollectionConfinementToFilter({\n filter: contextualFilter,\n executionContext,\n resourceConfiguration: this.resourceConfiguration,\n executedCoreOperation: executedCoreOperation,\n });\n\n return contextualFilter;\n }\n\n /**\n * Refuse a write whose unit-field value falls outside the caller's unit grant (WS-C) — PostgreSQL\n * sibling of the Mongo guard, sharing the same authority for the same anti-divergence reason.\n *\n * assurance-control: WILDO.ACCESS.SCOPE_CONFINEMENT — least-privilege confinement on the WRITE side.\n */\n /**\n * TENANT COHERENCE on the narrowing dimension — the PostgreSQL twin.\n *\n * Symmetric with the MongoDB adapter by obligation, not by taste: this rule's own module header\n * records that a narrowing rule present on one adapter and absent on the other \"is not a cosmetic\n * gap — it is an authorization bypass on one adapter\". The shared half (which value to check) lives\n * in `resolveSuppliedOrganizationUnitIdForTenantCheck`; only the scoped read differs, and it does not\n * differ much because `readForInternalScan` is a shared repository contract.\n *\n * See the MongoDB adapter's copy for WHY an `UNRESTRICTED` caller needs this at all: the grant check\n * returns before examining the value, so an organization-wide admin could otherwise name another\n * tenant's unit and orphan the row against a grant nobody in its tenant can hold.\n */\n private async assertOrganizationUnitBelongsToCallerTenant(\n payload: unknown,\n executedCoreOperation: CoreResourceOperation,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n const suppliedUnitId = resolveSuppliedOrganizationUnitIdForTenantCheck(\n payload as Record<string, unknown> | null | undefined,\n this.resourceConfiguration.resourceIdentifier,\n this.resourceRegistry?.getResourcesRegistry()?.organizationUnitNarrowing,\n );\n if (!suppliedUnitId) return;\n if (isOrganizationUnitNarrowingExemptExecution(executionContext.executionType)) return;\n\n const unitRepository = this.repositoriesRegistry?.getRepository(CoreResourceType.ORGANIZATION_UNITS);\n if (!unitRepository) return;\n\n // `excludeContextualFilter: true` + an EXPLICIT tenant comparison, rather than letting the\n // contextual filter do it. Borrowing the caller's execution context for a read of a DIFFERENT\n // resource is the documented way to produce a 500: that context carries THIS resource's field\n // identifier, and `buildContextualFilter` fails closed on `organizationUnits` with\n // \"Execution context field 'teamGoalId' is missing from schema\" (reason `context_filter`).\n // Observed exactly that before this line existed.\n //\n // Nothing is weakened by the bypass — the scope question is simply asked here instead, against the\n // tenant the ROW is being written into (falling back to the caller's own), which is the same\n // comparison `authorizeOrganizations` makes for a fetched row. The retention hide is unaffected:\n // it is applied BEFORE that early-return by design.\n const unit = await unitRepository.readForInternalScan(\n executionContext as never,\n { _id: suppliedUnitId },\n { excludeContextualFilter: true },\n );\n\n const writeTenantId = String(\n (payload as Record<string, unknown> | null | undefined)?.organizationId\n ?? executionContext.initiatorIds?.organizationId\n ?? '',\n );\n const unitTenantId = String((unit as { organizationId?: unknown } | null)?.organizationId ?? '');\n\n // Three ways to reach the refusal below, and the third is a DECISION rather than an oversight:\n // 1. no such unit anywhere — `unit` is null\n // 2. the unit belongs to another tenant — the ids differ\n // 3. the write's tenant is undeterminable — `writeTenantId` is empty\n //\n // (3) fails CLOSED deliberately. A unit-narrowed resource is organization-scoped by construction\n // (a unit belongs to an organization), so a write that carries no tenant on the payload and whose\n // principal has none either cannot have its unit reference verified at all — and this module's\n // governing rule is that an inability to verify must never read as permission. Exempt execution\n // types were already returned above, so this does not catch batches, cascades or webhooks.\n //\n // Do not \"simplify\" the emptiness test away: it looks like a defensive string check and is\n // actually the third branch.\n if (unit && writeTenantId && unitTenantId === writeTenantId) return;\n\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.AUTHORIZATIONS_ACCESS_DENIED,\n context: {\n reason: OrganizationUnitNarrowingWriteViolationReason.UNIT_OUTSIDE_TENANT,\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n executedCoreOperation,\n attemptedOrganizationUnitId: suppliedUnitId,\n },\n });\n }\n\n /**\n * Deps bundle for the ADAPTER-NEUTRAL write-integrity authority\n * (`resource-write-integrity.backend.ts`), on both CREATE and UPDATE. Identical shape to the MongoDB\n * repository's — the whole point of the shared authority is that FK-existence-in-scope,\n * scope-via-junction-membership, and top-level-mainSchema-check enforcement cannot diverge between the\n * two persistence adapters.\n */\n private get writeIntegrityDeps(): ResourceWriteIntegrityDeps {\n return {\n resourceConfiguration: this.resourceConfiguration,\n resourceRegistry: this.resourceRegistry,\n repositoriesRegistry: this.repositoriesRegistry,\n errorBuilder: this.errorBuilder,\n };\n }\n\n private async assertOrganizationUnitWriteWithinGrant(\n payload: unknown,\n executedCoreOperation: CoreResourceOperation,\n executionContext: ExecutionContext<any>,\n ): Promise<void> {\n await this.assertOrganizationUnitBelongsToCallerTenant(payload, executedCoreOperation, executionContext);\n\n const violation = resolveOrganizationUnitNarrowingWriteViolation(\n payload as Record<string, unknown> | null | undefined,\n executedCoreOperation,\n this.resourceConfiguration.resourceIdentifier,\n this.resourceRegistry?.getResourcesRegistry()?.organizationUnitNarrowing,\n executionContext,\n );\n if (!violation) return;\n\n throw this.errorBuilder.buildError(ErrorType.AUTHORIZATION, executionContext, {\n customMessageReference: ErrorCustomMessageReference.AUTHORIZATIONS_ACCESS_DENIED,\n context: {\n // diagnostic (log-only)\n reason: violation.reason,\n resourceIdentifier: this.resourceConfiguration.resourceIdentifier,\n executedCoreOperation,\n unitFieldName: violation.unitFieldName,\n grantedOrganizationUnitIds: violation.grantedOrganizationUnitIds,\n attemptedOrganizationUnitId: violation.attemptedOrganizationUnitId,\n },\n });\n }\n\n private applyFKRelationshipFilters(\n executionContext: ExecutionContext<any>,\n filter: ResourceFilter,\n blacklistedFields: Set<string>\n ): void {\n assignRelationshipForeignKeyFiltersToFilter({\n filter,\n executionContext,\n blacklistedFields,\n resourceIdentifier: String(this.resourceConfiguration.resourceIdentifier),\n mainSchema: this.resourceConfiguration.mainSchema,\n schemaPaths: this.resourceOperationHelper,\n });\n }\n\n /**\n * Resolve the single row a filter-shaped write targets.\n *\n * `executedCoreOperation` is the WRITE the caller is about to perform (UPDATE / DELETE), not READ:\n * this lookup is the first half of that mutation, so it applies the same retention hide the mutation\n * itself will. Defense-in-depth rather than a standalone hole — `_doUpdate` / `_doDelete` re-run\n * `buildContextualFilter` on the resolved `{ _id }`, so a retained row would fail to match there\n * anyway — but classifying a write's own id-resolution step as a READ is exactly the ambiguity that\n * produced the guard's original defect, and it would become a live hole the moment a caller used the\n * resolved id without re-filtering.\n */\n private async resolveSingleId(\n executionContext: ExecutionContext<any>,\n baseFilter: ResourceFilter,\n executedCoreOperation: CoreResourceOperation,\n options?: RepositoryOptions\n ): Promise<string | null> {\n if (baseFilter && typeof baseFilter === 'object' && !Array.isArray(baseFilter) && '_id' in baseFilter) {\n const idVal = (baseFilter as any)._id;\n if (typeof idVal === 'string') return idVal;\n if (idVal && typeof idVal === 'object' && Array.isArray((idVal as any).$in) && (idVal as any).$in.length > 0) {\n return (idVal as any).$in[0];\n }\n }\n\n const contextualFilter = this.buildContextualFilter(executionContext, baseFilter, executedCoreOperation, options);\n const where = this.buildWhere(contextualFilter);\n const db = await this.getDbOrTrx(options);\n\n let qb: any = this.filterService.applyWhere(db.selectFrom(this.tableName).select(['_id' as any]), where);\n if (this.plannedFieldNames.has('createdAt')) {\n qb = qb.orderBy('createdAt', 'desc');\n }\n const row = await qb.executeTakeFirst();\n return row?._id ?? null;\n }\n\n private findSearchOperationConfiguration():\n | ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>\n | null {\n const searchOperations = Array.from(this.operationsMap.values()).filter(\n operation => operation.operationIdentifier === CoreResourceOperation.SEARCH\n );\n const defaultSearchOperations = searchOperations.filter(\n operation => operation.isOperationDefault === true\n );\n if (defaultSearchOperations.length > 1) {\n this.logDebug('Ambiguous default SEARCH operation configurations', {\n resourceType: this.resourceConfiguration.resourceIdentifier,\n candidateVariants: defaultSearchOperations.map((operation) => ({\n variantType: operation.variantType,\n variantKey: operation.variantKey,\n })),\n });\n return null;\n }\n return defaultSearchOperations[0] ?? searchOperations[0] ?? null;\n }\n\n /**\n * Build the SEARCH filter, own-column conditions AND relational descriptors (#470).\n *\n * ## Parity with Mongo, and why it was reachable\n *\n * A relational `searchableFields` descriptor used to be FILTERED OUT here with a `logger.warn`, so\n * an author on this adapter learned their declared search surface did not work only from a warning\n * in a running process — if they read the log at all.\n *\n * Reaching parity turned out not to need query planning, because the Mongo adapter does not join:\n * it runs a secondary query on the RELATED repository, collects join values, and folds them into\n * one `{ localField: { $in: ids } }` branch. That decomposition is adapter-agnostic, and `$in` is\n * already this dialect's own operator — so the arm below is the SAME algorithm, resolved through\n * the same repository method, and not a second implementation of the semantics.\n *\n * Async because a relational branch resolves its ids through the related repository, exactly as\n * the Mongo sibling is.\n */\n private async constructSearchQuery(\n searchQuery: string,\n searchConfig: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>,\n fieldsOverride?: string[]\n ): Promise<ResourceFilter> {\n if (!searchQuery?.trim()) return {};\n\n const op = searchConfig as unknown as { searchableFields?: Array<string | object> };\n const rawSearchableFields = Array.isArray(op.searchableFields) ? op.searchableFields : [];\n\n // Own-column entries → `$contains` conditions, as before.\n const ownFields = rawSearchableFields.filter((f): f is string => typeof f === 'string');\n const fields = Array.isArray(fieldsOverride) && fieldsOverride.length > 0\n ? fieldsOverride.filter((f) => ownFields.includes(f))\n : ownFields;\n const searchConditions: Array<Record<string, unknown>> = fields.map((f) => ({ [f]: { $contains: searchQuery, $options: 'i' } }));\n\n /*\n * Relational entries → a secondary match on the related resource, folded into an `$in` branch on\n * this table's join field. Resolved in declared order, matching Mongo.\n *\n * A `fieldsOverride` (the caller's `fieldsToSearch`) deliberately does NOT suppress relational\n * branches: the override names OWN fields to narrow to, and it cannot express a relational\n * descriptor, so treating it as a filter over descriptors would silently drop them for any caller\n * that pinned a field subset.\n */\n for (const descriptor of rawSearchableFields.filter(isSearchableRelationDescriptor)) {\n const relationCondition = await this.buildRelationalSearchCondition(searchQuery, descriptor);\n if (relationCondition) searchConditions.push(relationCondition);\n }\n\n if (searchConditions.length === 0) {\n /*\n * Two different situations converge here and they must NOT get the same answer.\n *\n * If `searchableFields` was non-empty — relational-only, and every related match resolved to\n * zero ids — matching everything would return the whole collection for a query that found\n * nothing, so match NOTHING. Mongo returns `{ _id: { $in: [] } }` for exactly this, and the\n * same filter is the right one here.\n *\n * If it was empty, there is no declared search surface at all, and returning `{}` preserves\n * this adapter's existing behaviour rather than newly refusing every such search.\n */\n return rawSearchableFields.length > 0 ? ({ _id: { $in: [] } } as ResourceFilter) : {};\n }\n\n return (searchConditions.length > 1 ? { $or: searchConditions } : searchConditions[0]) as ResourceFilter;\n }\n\n /**\n * Resolve one relational descriptor into a `{ [localField]: { $in: ids } }` branch by running the\n * related resource's own searchable surface (see `findSearchMatchTargetIds`).\n *\n * Returns `null` — contributing no branch — when the related repository cannot be resolved or the\n * match set is empty. That is the correct fail-safe for a MATCH branch, and the reasoning is the\n * Mongo sibling's verbatim: it only ever ADDS results within the caller's already scoped and\n * filtered set, so omitting it can never widen visibility — it merely under-matches.\n */\n private async buildRelationalSearchCondition(\n searchQuery: string,\n descriptor: SearchableRelationDescriptor,\n ): Promise<Record<string, unknown> | null> {\n const relatedRepository = this.repositoriesRegistry.getRepository(descriptor.relatedResource);\n if (!relatedRepository || typeof relatedRepository.findSearchMatchTargetIds !== 'function') {\n this.logDebug('Relational search branch skipped: related repository unavailable', {\n relatedResource: descriptor.relatedResource,\n localField: descriptor.localField,\n });\n return null;\n }\n\n const joinField = descriptor.relatedJoinField ?? '_id';\n const ids: string[] = await relatedRepository.findSearchMatchTargetIds(searchQuery, joinField, { fields: descriptor.fields });\n if (ids.length === 0) return null;\n\n return { [descriptor.localField]: { $in: ids } };\n }\n\n private sanitizeRequestFilter(\n filter: ResourceFilter,\n searchConfig: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>\n ): ResourceFilter {\n if (!filter || typeof filter !== 'object') return {};\n const { filterFields } = searchConfig as unknown as { filterFields?: Record<string, unknown> };\n if (!filterFields || Object.keys(filterFields).length === 0) return filter;\n const allowedKeys = Object.keys(filterFields);\n const allowField = (field: string): boolean =>\n allowedKeys.includes(field) || allowedKeys.some((a) => field.startsWith(`${a}.`));\n\n const sanitizeObject = (obj: any): any => {\n if (!obj || typeof obj !== 'object') return obj;\n const out: any = {};\n for (const [key, value] of Object.entries(obj)) {\n if (key === '$and' || key === '$or') {\n if (Array.isArray(value)) {\n const arr = value.map((v) => sanitizeObject(v)).filter((v) => v && Object.keys(v).length > 0);\n if (arr.length > 0) out[key] = arr;\n }\n continue;\n }\n if (key === '$not') {\n const inner = sanitizeObject(value as any);\n if (inner && Object.keys(inner).length > 0) out[key] = inner;\n continue;\n }\n if (allowField(key)) out[key] = value;\n }\n return out;\n };\n\n return sanitizeObject(filter);\n }\n\n private constructValidatedSortOptions(\n requestedSort: Record<string, 1 | -1> | undefined,\n searchConfig: ResourceConfiguration_Operation<TCustomOperationEnum, TCoreOperationEnum, TMainSchema>\n ): Array<{ field: string; direction: 'asc' | 'desc' }> {\n const op = searchConfig as unknown as { sortFields?: readonly string[] };\n const sortFields = Array.isArray(op.sortFields)\n ? (op.sortFields as string[])\n : [];\n const validated: Array<{ field: string; direction: 'asc' | 'desc' }> = [];\n\n if (sortFields.length === 0) {\n // ADAPTER PARITY with the Mongo twin (`RepositoryResourceBackendService`).\n // When the operation declares no `sortFields` whitelist there is nothing to\n // validate against, and Mongo returns the caller's `sort` VERBATIM. Returning\n // `[]` here — the prior behavior — silently DISCARDED the caller's sort and\n // let the call site's `createdAt DESC` fallback take over instead (or, on a\n // resource with no `createdAt` column, no ORDER BY at all).\n //\n // That divergence is a correctness bug, not a cosmetic one, for any internal\n // forward-paging scan. Those page with `createdAt > mark` ASC and advance the\n // mark to the LAST row of each page. Served DESC, that \"last row\" is the\n // OLDEST row of the NEWEST page — so the mark leaps forward over every event\n // in between (permanently skipped, never re-read because the next filter is\n // strictly greater) while the following page re-reads rows already seen.\n // `immudb-audit-reconcile` is exactly this shape and would have silently lost\n // audit records on a PostgreSQL-backed `AUDIT_LOGS`.\n //\n // Unlike Mongo's schemaless passthrough, PostgreSQL must name a REAL column:\n // an unknown identifier is both a SQL error and an injection surface. So when\n // the operation supplies no whitelist we fall back to the resource's planned\n // columns as the whitelist rather than dropping the sort — honoring the\n // caller's intent while staying fail-closed on unknown identifiers.\n if (!requestedSort) {\n return validated;\n }\n Object.entries(requestedSort).forEach(([field, dir]) => {\n if (this.plannedFieldNames.has(field) && (dir === 1 || dir === -1)) {\n validated.push({ field, direction: dir === 1 ? 'asc' : 'desc' });\n }\n });\n return validated;\n }\n if (!requestedSort) {\n const first = sortFields[0];\n return first ? [{ field: first, direction: 'desc' }] : validated;\n }\n\n Object.entries(requestedSort).forEach(([field, dir]) => {\n if (sortFields.includes(field) && (dir === 1 || dir === -1)) {\n validated.push({ field, direction: dir === 1 ? 'asc' : 'desc' });\n }\n });\n\n return validated;\n }\n\n private addUserTrackingAndTimestamps(\n enrichedData: any,\n executionContext: ExecutionContext<any>,\n operation: CoreResourceOperation\n ): any {\n const out = { ...(enrichedData || {}) };\n const userId = (executionContext as any)?.initiatorIds?.userId;\n const now = new Date();\n\n if (operation === CoreResourceOperation.CREATE) {\n if (this.plannedFieldNames.has('createdAt') && !out.createdAt) out.createdAt = now;\n if (this.plannedFieldNames.has('updatedAt') && !out.updatedAt) out.updatedAt = now;\n if (userId && this.plannedFieldNames.has('createdByUserId') && !out.createdByUserId) out.createdByUserId = userId;\n }\n\n if (operation === CoreResourceOperation.UPDATE) {\n if (this.plannedFieldNames.has('updatedAt')) out.updatedAt = now;\n if (userId && this.plannedFieldNames.has('updatedByUserId') && !out.updatedByUserId) out.updatedByUserId = userId;\n if (userId && this.plannedFieldNames.has('lastUpdatedByUserId') && !out.lastUpdatedByUserId) out.lastUpdatedByUserId = userId;\n }\n\n return out;\n }\n}\n"]}
|