@wildo-ai/saas-backend-lib 1.1.0 → 1.1.2
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/base-classes/services/controllers/controller-resource.backend.service.d.ts +14 -3
- 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 +115 -22
- package/dist/esm/base-classes/services/controllers/controller-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts +3 -1
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js +8 -3
- package/dist/esm/base-classes/services/controllers/controllers-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts +11 -0
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js +11 -2
- package/dist/esm/base-classes/services/repositories/field-clearing-partition.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/http-api-resource-repository.backend.service.d.ts +1 -0
- 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 +6 -1
- 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/odata-query-compiler.backend.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js +16 -0
- package/dist/esm/base-classes/services/repositories/http-api/odata-query-compiler.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.d.ts +20 -6
- 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 +88 -32
- package/dist/esm/base-classes/services/repositories/infrastructure-tier-contract.backend.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts +3 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js +32 -7
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-repository.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts +8 -5
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.d.ts.map +1 -1
- package/dist/esm/base-classes/services/repositories/introspection/introspection-resource-source.backend.port.js.map +1 -1
- package/dist/esm/base-classes/services/repositories/postgresql-resource-repository.backend.service.d.ts +31 -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 +127 -5
- 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 +71 -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 +62 -2
- 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 +21 -0
- 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 +126 -4
- package/dist/esm/base-classes/services/repositories/repository-resource.backend.service.js.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts +3 -26
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.d.ts.map +1 -1
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js +3 -68
- package/dist/esm/base-classes/services/services/resource-operation-implementation-coverage.backend.utils.js.map +1 -1
- 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 +4 -2
- package/dist/esm/base-classes/services/services/services-registry-handler.backend.service.js.map +1 -1
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js +6 -6
- package/dist/esm/billing/services/custom-impl/billing-account.mutations.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/audit-event-dispatcher.backend.service.d.ts +38 -0
- 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 +40 -0
- 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 +20 -0
- 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 +28 -0
- package/dist/esm/compliance/audit-trails/services/audit-logs.backend.service.js.map +1 -1
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts +12 -0
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js +118 -0
- package/dist/esm/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js.map +1 -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 +8 -5
- package/dist/esm/compliance/audit-trails/services/siem-webhook-delivery.backend.service.js.map +1 -1
- 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 +14 -0
- package/dist/esm/compliance/audit-trails/services/utils/ocsf-activity-mapping.backend.utils.js.map +1 -1
- package/dist/esm/config/custom/application-config-controller.backend.service.d.ts.map +1 -1
- package/dist/esm/config/custom/application-config-controller.backend.service.js +7 -1
- package/dist/esm/config/custom/application-config-controller.backend.service.js.map +1 -1
- package/dist/esm/config/models/app-config.backend.schemas.d.ts +4 -0
- package/dist/esm/config/models/app-config.backend.schemas.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts +10 -1
- package/dist/esm/config/services/app-configuration.backend.utils.d.ts.map +1 -1
- package/dist/esm/config/services/app-configuration.backend.utils.js +13 -2
- package/dist/esm/config/services/app-configuration.backend.utils.js.map +1 -1
- package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.d.ts +2 -2
- package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js +2 -2
- package/dist/esm/data-seeding/services/shared/data-seed-scope-iteration.shared.utils.js.map +1 -1
- package/dist/esm/databases/models/filter.backend.schemas.js +2 -2
- package/dist/esm/databases/models/filter.backend.schemas.js.map +1 -1
- package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.d.ts.map +1 -1
- package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js +20 -1
- package/dist/esm/databases/services/aggregation/aggregation-authorization.backend.service.js.map +1 -1
- package/dist/esm/databases/services/redis.service.d.ts +27 -0
- package/dist/esm/databases/services/redis.service.d.ts.map +1 -1
- package/dist/esm/databases/services/redis.service.js +29 -0
- package/dist/esm/databases/services/redis.service.js.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/errors/services/error-handler.backend.service.js +5 -0
- package/dist/esm/errors/services/error-handler.backend.service.js.map +1 -1
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts +41 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.d.ts.map +1 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js +40 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.contracts.js.map +1 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts +64 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.d.ts.map +1 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js +193 -0
- package/dist/esm/external-data/controllers/external-data-admin.backend.controller.js.map +1 -0
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.d.ts +13 -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 +8 -2
- package/dist/esm/external-data/external-data-pipeline-run.backend.service.js.map +1 -1
- package/dist/esm/external-data/external-data-transform.backend.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-transform.backend.js +7 -1
- package/dist/esm/external-data/external-data-transform.backend.js.map +1 -1
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts +2 -0
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.d.ts.map +1 -1
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js +13 -0
- package/dist/esm/external-data/models/external-data-pipeline-state.backend.schemas.js.map +1 -1
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.d.ts +14 -0
- 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 +6 -0
- package/dist/esm/external-providers/services/external-providers-registry.backend.service.js.map +1 -1
- package/dist/esm/files/controllers/file.controller.d.ts +24 -1
- package/dist/esm/files/controllers/file.controller.d.ts.map +1 -1
- package/dist/esm/files/controllers/file.controller.js +66 -2
- package/dist/esm/files/controllers/file.controller.js.map +1 -1
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts +17 -0
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.d.ts.map +1 -0
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js +1 -0
- package/dist/esm/files/handlers/file-upload-route-locals.backend.types.js.map +1 -0
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.d.ts +5 -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 +42 -3
- package/dist/esm/files/handlers/resource-file-upload-handler.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-operation-handler.backend.service.d.ts +18 -0
- package/dist/esm/files/services/file-operation-handler.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/file-operation-handler.backend.service.js +36 -28
- package/dist/esm/files/services/file-operation-handler.backend.service.js.map +1 -1
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts +163 -0
- package/dist/esm/files/services/file-upload-grant.backend.service.d.ts.map +1 -0
- package/dist/esm/files/services/file-upload-grant.backend.service.js +442 -0
- package/dist/esm/files/services/file-upload-grant.backend.service.js.map +1 -0
- package/dist/esm/files/services/files.backend.service.d.ts +19 -0
- package/dist/esm/files/services/files.backend.service.d.ts.map +1 -1
- package/dist/esm/files/services/files.backend.service.js +78 -15
- package/dist/esm/files/services/files.backend.service.js.map +1 -1
- package/dist/esm/files/utils/file-uploader.utils.d.ts.map +1 -1
- package/dist/esm/files/utils/file-uploader.utils.js +12 -0
- package/dist/esm/files/utils/file-uploader.utils.js.map +1 -1
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js +5 -5
- package/dist/esm/flows-actors/a2a/services/a2a-task-cancellation.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts +79 -0
- package/dist/esm/flows-actors/services/agents.backend.service.d.ts.map +1 -1
- package/dist/esm/flows-actors/services/agents.backend.service.js +319 -42
- package/dist/esm/flows-actors/services/agents.backend.service.js.map +1 -1
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.d.ts +151 -41
- 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 +300 -139
- package/dist/esm/flows-actors/utils/acp-session-runner.backend.utils.js.map +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -1
- 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 +4 -0
- package/dist/esm/inject/models/container.js.map +1 -1
- package/dist/esm/inject/models/service-types.d.ts +3 -0
- package/dist/esm/inject/models/service-types.d.ts.map +1 -1
- package/dist/esm/inject/models/service-types.js +2 -0
- 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 +12 -4
- package/dist/esm/mcp/controllers/mcp.controller.js.map +1 -1
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts +34 -0
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.d.ts.map +1 -1
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.js +42 -0
- package/dist/esm/mcp/models/mcp-tool.backend.schemas.js.map +1 -1
- package/dist/esm/mcp/services/mcp-server.backend.service.d.ts +29 -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 +131 -3
- 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 +64 -2
- 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 +130 -6
- package/dist/esm/mcp/services/mcp-tool-adapter.backend.service.js.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts +9 -0
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.d.ts.map +1 -1
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js +11 -36
- package/dist/esm/notifications/services/notifications-dispatcher.backend.service.js.map +1 -1
- 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 +9 -7
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.backend.service.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts +5 -5
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.d.ts.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js +14 -13
- package/dist/esm/notifications/webhooks/outbound/batches/m2m-webhook-delivery.batch.utils.js.map +1 -1
- package/dist/esm/notifications/webhooks/outbound/m2m-webhook-signed-request.backend.utils.d.ts +2 -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 +2 -2
- 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 +9 -7
- package/dist/esm/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service.js.map +1 -1
- package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.d.ts.map +1 -1
- package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js +4 -1
- package/dist/esm/organizations/services/organization-unit-custom-implementation.backend.service.js.map +1 -1
- package/dist/esm/requests/service/websocket.service.d.ts.map +1 -1
- package/dist/esm/requests/service/websocket.service.js +56 -7
- 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 +2 -0
- package/dist/esm/resources/models/custom-service-implementations.backend.definition.js.map +1 -1
- package/dist/esm/resources/services/resource-id.backend.service.js +3 -3
- package/dist/esm/resources/services/resource-id.backend.service.js.map +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.js +1 -1
- package/dist/esm/resources/services/resources-registry.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/execution-context-creator.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/execution-context-creator.backend.service.js +13 -7
- package/dist/esm/runtime/services/execution-context-creator.backend.service.js.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.d.ts +28 -0
- package/dist/esm/runtime/services/start-application.backend.service.d.ts.map +1 -1
- package/dist/esm/runtime/services/start-application.backend.service.js +82 -0
- package/dist/esm/runtime/services/start-application.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts +3 -23
- package/dist/esm/security/authentications/models/jwt.backend.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/models/jwt.backend.schemas.js +20 -45
- package/dist/esm/security/authentications/models/jwt.backend.schemas.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-method-management.backend.service.d.ts +9 -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 +9 -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-mfa.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js +5 -3
- package/dist/esm/security/authentications/services/auth-methods/auth-mfa.backend.service.js.map +1 -1
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.d.ts +25 -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 +55 -4
- package/dist/esm/security/authentications/services/auth-token-issuer.backend.service.js.map +1 -1
- package/dist/esm/security/authorizations/initiator-organization-confinement.backend.d.ts.map +1 -1
- package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js +24 -1
- package/dist/esm/security/authorizations/initiator-organization-confinement.backend.js.map +1 -1
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts +117 -0
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.d.ts.map +1 -0
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js +104 -0
- package/dist/esm/security/authorizations/privileged-access-review.backend.utils.js.map +1 -0
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts +101 -6
- package/dist/esm/security/authorizations/services/authorizations.backend.service.d.ts.map +1 -1
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js +210 -30
- package/dist/esm/security/authorizations/services/authorizations.backend.service.js.map +1 -1
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts +18 -1
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js +110 -74
- package/dist/esm/security/consumable-tokens/batches/consumable-tokens-cleanup.batch.backend.service.js.map +1 -1
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts +22 -0
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.d.ts.map +1 -0
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js +22 -0
- package/dist/esm/security/consumable-tokens/consumable-token-models.exports.js.map +1 -0
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts +17 -3
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js +12 -0
- package/dist/esm/security/consumable-tokens/models/consumable-tokens.backend.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.d.ts +20 -0
- 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 +58 -5
- package/dist/esm/security/consumable-tokens/services/consumable-token.backend.service.js.map +1 -1
- package/dist/esm/security/jwt/services/jwt.backend.service.d.ts.map +1 -1
- package/dist/esm/security/jwt/services/jwt.backend.service.js +1 -18
- package/dist/esm/security/jwt/services/jwt.backend.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +15 -9
- package/dist/esm/.builder.pid +0 -9
package/dist/esm/resources/models/custom-service-implementations.backend.definition.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-service-implementations.backend.definition.d.ts","sourceRoot":"","sources":["../../../../../src/resources/models/custom-service-implementations.backend.definition.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0CAA0C,EAAE,MAAM,4GAA4G,CAAC;
|
|
1
|
+
{"version":3,"file":"custom-service-implementations.backend.definition.d.ts","sourceRoot":"","sources":["../../../../../src/resources/models/custom-service-implementations.backend.definition.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,0CAA0C,EAAE,MAAM,4GAA4G,CAAC;AA0DxK,eAAO,MAAM,2CAA2C,EAAG,0CAA0C,EAuGpG,CAAA"}
|
|
@@ -19,6 +19,7 @@ import { createUserSuperAdminFloorFactories } from '../../users/services/user-su
|
|
|
19
19
|
import { createApiKeyCreateFactories, createApiKeyRotateFactories, createApiKeyRegenerateFactories, createApiKeyExtendExpiryFactories, createApiKeyUsageStatsFactories, createApiKeyDeactivateFactories, createApiKeyReactivateFactories, } from '../../security/api-keys/api-keys.custom-impl.backend.service.js';
|
|
20
20
|
import { createOAuthClientCreateFactories, createOAuthClientRotateFactories, createOAuthClientRegenerateFactories, } from '../../security/oauth-clients/oauth-clients.custom-impl.backend.service.js';
|
|
21
21
|
import { createScopeFeaturesCacheInvalidationFactories } from '../../features/services/scope-features-cache-invalidation.custom-impl.backend.service.js';
|
|
22
|
+
import { createSiemExportConfigCacheInvalidationFactories } from '../../compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service.js';
|
|
22
23
|
import { createOrganizationFeaturesAdminWritePathFactories } from '../../features/services/organization-features-admin-write-path.custom-impl.backend.service.js';
|
|
23
24
|
import { createApplicationFeaturesAdminWritePathFactories } from '../../features/services/application-features-admin-write-path.custom-impl.backend.service.js';
|
|
24
25
|
import { createWebhookConfigReadPublicKeyFactories } from '../../notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service.js';
|
|
@@ -114,6 +115,7 @@ export const CoreBackend_ServiceImplementationsFactories = [
|
|
|
114
115
|
...createOrganizationFeaturesAdminWritePathFactories(),
|
|
115
116
|
...createApplicationFeaturesAdminWritePathFactories(),
|
|
116
117
|
...createScopeFeaturesCacheInvalidationFactories(),
|
|
118
|
+
...createSiemExportConfigCacheInvalidationFactories(),
|
|
117
119
|
...createAuditLogsExportFactories(),
|
|
118
120
|
// Webhook (M2M outbound) domain — the public-key READ postfix existed but was
|
|
119
121
|
// never registered (the `applicationPublicKeyPem` field silently never
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"custom-service-implementations.backend.definition.js","sourceRoot":"","sources":["../../../../../src/resources/models/custom-service-implementations.backend.definition.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAC3H,OAAO,EAAE,4BAA4B,EAAE,MAAM,wFAAwF,CAAC;AACtI,OAAO,EAAE,8BAA8B,EAAE,MAAM,+EAA+E,CAAC;AAC/H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D,4EAA4E;IAC5E,8EAA8E;IAC9E,GAAG,mCAAmC,EAAE;IACxC,iGAAiG;IACjG,iGAAiG;IACjG,iGAAiG;IACjG,mFAAmF;IACnF,GAAG,mCAAmC,EAAE;IACxC,GAAG,kCAAkC,EAAE;IACvC,0FAA0F;IAC1F,4FAA4F;IAC5F,4FAA4F;IAC5F,8FAA8F;IAC9F,uDAAuD;IACvD,GAAG,qCAAqC,EAAE;IAC1C,iGAAiG;IACjG,gGAAgG;IAChG,kGAAkG;IAClG,wBAAwB;IACxB,GAAG,gCAAgC,EAAE;IACrC,6FAA6F;IAC7F,mGAAmG;IACnG,mGAAmG;IACnG,iFAAiF;IACjF,GAAG,kCAAkC,EAAE;IACvC,GAAG,2BAA2B,EAAE;IAChC,GAAG,2BAA2B,EAAE;IAChC,GAAG,+BAA+B,EAAE;IACpC,GAAG,iCAAiC,EAAE;IACtC,GAAG,+BAA+B,EAAE;IACpC,GAAG,+BAA+B,EAAE;IACpC,GAAG,+BAA+B,EAAE;IACpC,uFAAuF;IACvF,GAAG,gCAAgC,EAAE;IACrC,GAAG,gCAAgC,EAAE;IACrC,GAAG,oCAAoC,EAAE;IACzC,GAAG,iDAAiD,EAAE;IACtD,GAAG,gDAAgD,EAAE;IACrD,GAAG,6CAA6C,EAAE;IAClD,GAAG,8BAA8B,EAAE;IACnC,8EAA8E;IAC9E,uEAAuE;IACvE,wEAAwE;IACxE,GAAG,yCAAyC,EAAE;IAC9C,GAAG,yCAAyC,EAAE;IAC9C,GAAG,4CAA4C,EAAE;IACjD,qFAAqF;IACrF,yFAAyF;IACzF,0FAA0F;IAC1F,oBAAoB;IACpB,GAAG,wCAAwC,EAAE;CAC9C,CAAA","sourcesContent":["import { z } from 'zod';\nimport type { ResourceConfiguration_Operation } from '@wildo-ai/saas-models';\nimport type { ResourceOperationCustomImplementationBase } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service';\nimport { ResourceCustomServiceImplementationFactory } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport { userSelfCustomImplementations } from '~wildo-backend-lib/users/services/user-self-custom-implementations.backend';\nimport { billingCustomImplementations } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-implementations.backend';\nimport { lifecycleCustomImplementations } from '~wildo-backend-lib/guidance/services/lifecycle-custom-implementations.backend';\nimport { scopedStateReadCustomImplementations } from '~wildo-backend-lib/guidance/services/scoped-state-read-custom-implementations.backend';\nimport { authCustomImplementations } from '~wildo-backend-lib/security/authentications/services/custom-impls/auth-custom-implementations.backend';\nimport { createAuditLogsExportFactories } from '~wildo-backend-lib/compliance/audit-trails/audit-logs.custom-impl.backend.service';\nimport { createOrganizationCreateFactories, createOrganizationLifecycleFactories } from '~wildo-backend-lib/organizations/services/organization-custom-implementation.backend.service';\nimport { createOrganizationDeletionAuditFactories } from '~wildo-backend-lib/organizations/services/organization-deletion-audit.custom-impl.backend.service';\nimport { createEngineResourceStatusTransitionFactories } from '~wildo-backend-lib/base-classes/services/services/resource-status-transition.definitions.backend';\nimport { createOrganizationMemberCreateFactories } from '~wildo-backend-lib/organizations/services/organization-member-custom-implementation.backend.service';\nimport { createPlatformAccessGrantFactories } from '~wildo-backend-lib/security/authorizations/platform-access-grant-custom-implementation.backend.service';\nimport {\n createOrganizationUnitCreatePathFactories,\n createOrganizationUnitDeleteDependentsGuardFactories,\n createOrganizationUnitMoveFactories,\n createOrganizationUnitStatusTransitionFactories,\n createOrganizationUnitUpdateFactories,\n} from '~wildo-backend-lib/organizations/services/organization-unit-custom-implementation.backend.service';\nimport {\n createOrganizationUnitMemberCreateFactories,\n createOrganizationUnitMemberDeleteFactories,\n createOrganizationUnitMemberUpdateFactories,\n} from '~wildo-backend-lib/organizations/services/organization-unit-member-custom-implementation.backend.service';\nimport { createInboundContactCreateFactories } from '~wildo-backend-lib/users/services/inbound-contact-custom-implementation.backend.service';\nimport {\n createUserCoreRoleCeilingFactories,\n createUserRoleSetOperationFactories,\n} from '~wildo-backend-lib/users/services/user-role-administration.custom-impl.backend.service';\nimport { createUserForcePasswordResetFactories } from '~wildo-backend-lib/users/services/user-force-password-reset.custom-impl.backend.service';\nimport { createUserDeletionAuditFactories } from '~wildo-backend-lib/users/services/user-deletion-audit.custom-impl.backend.service';\nimport { createUserSuperAdminFloorFactories } from '~wildo-backend-lib/users/services/user-super-admin-floor.custom-impl.backend.service';\nimport {\n createApiKeyCreateFactories,\n createApiKeyRotateFactories,\n createApiKeyRegenerateFactories,\n createApiKeyExtendExpiryFactories,\n createApiKeyUsageStatsFactories,\n createApiKeyDeactivateFactories,\n createApiKeyReactivateFactories,\n} from '~wildo-backend-lib/security/api-keys/api-keys.custom-impl.backend.service';\nimport {\n createOAuthClientCreateFactories,\n createOAuthClientRotateFactories,\n createOAuthClientRegenerateFactories,\n} from '~wildo-backend-lib/security/oauth-clients/oauth-clients.custom-impl.backend.service';\nimport { createScopeFeaturesCacheInvalidationFactories } from '~wildo-backend-lib/features/services/scope-features-cache-invalidation.custom-impl.backend.service';\nimport { createOrganizationFeaturesAdminWritePathFactories } from '~wildo-backend-lib/features/services/organization-features-admin-write-path.custom-impl.backend.service';\nimport { createApplicationFeaturesAdminWritePathFactories } from '~wildo-backend-lib/features/services/application-features-admin-write-path.custom-impl.backend.service';\nimport { createWebhookConfigReadPublicKeyFactories } from '~wildo-backend-lib/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service';\nimport {\n createM2MWebhookDeliveryLogRetryFactories,\n createM2MWebhookDeliveryLogPurgeOldFactories,\n} from '~wildo-backend-lib/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service';\nimport { createWebhookConfigTestEndpointFactories } from '~wildo-backend-lib/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service';\n\n\nexport const CoreBackend_ServiceImplementationsFactories : ResourceCustomServiceImplementationFactory[] = [\n ...userSelfCustomImplementations,\n ...billingCustomImplementations,\n ...scopedStateReadCustomImplementations,\n ...lifecycleCustomImplementations,\n ...authCustomImplementations,\n ...createOrganizationCreateFactories(),\n // Tenant lifecycle transitions (WS-A): `request_deletion` on both declared variants + `restore`.\n // These own `Organization.status`, which generic UPDATE may not write.\n ...createOrganizationLifecycleFactories(),\n // ORGANIZATIONS DELETE — emits ORGANIZATION_DELETED. The event type, its typed event-data schema\n // and its SIEM classification all existed from the start but NOTHING produced them, so destroying\n // a whole tenant left no evidence at all (the exact sibling of the USER_DELETED gap below).\n // Registered on BOTH declared doors — the org-admin default AND the super-admin `admin` variant —\n // because custom impls resolve by an exact operation-path key; one registration would have left\n // the privileged cross-tenant route unaudited. Post-commit by construction; reads the pre-deletion\n // snapshot because `name` / `slug` are unrecoverable once the row is gone.\n ...createOrganizationDeletionAuditFactories(),\n ...createOrganizationMemberCreateFactories(),\n // PLATFORM_ACCESS_GRANTS — the four lifecycle transitions. Every field that carries the\n // time-bound/justified/tenant-scoped guarantee (`operatorUserId`, `status`, `expiresAt`,\n // `approvedByUserId`) is server-authored here; the resource exposes no generic CREATE/UPDATE door,\n // so these prefixes are the only way a grant can come into existence or change state.\n ...createPlatformAccessGrantFactories(),\n // ORGANIZATION_UNITS DELETE prefix — refuses to strand a subtree behind a deleted interior\n // node (the unit tree self-edge declares no delete cascade).\n ...createOrganizationUnitDeleteDependentsGuardFactories(),\n // ORGANIZATION_UNITS tree mechanics. CREATE materializes the hierarchy `path` on the inserting\n // write (it was previously never written by anything); MOVE re-parents and re-homes the whole\n // subtree; ARCHIVE/RESTORE own the node-only status transitions. Before these, all three custom\n // operations were declared with no implementation and succeeded while changing nothing.\n ...createOrganizationUnitCreatePathFactories(),\n ...createOrganizationUnitUpdateFactories(),\n ...createOrganizationUnitMoveFactories(),\n ...createOrganizationUnitStatusTransitionFactories(),\n // ORGANIZATION_UNIT_MEMBERS — a unit assignment is a role grant (its `role` is read into\n // `initiatorRoles` as a unit-narrowed entry), so both write paths carry the role-ceiling gate\n // explicitly (custom impls resolve by exact operation path; neither inherits the other's gate).\n // CREATE additionally proves the target unit is in the caller's tenant. All three paths emit the\n // matching audit event: grant and re-grade via ORGANIZATION_UNIT_MEMBER_ROLE_CHANGED, revocation\n // via ORGANIZATION_UNIT_MEMBER_REMOVED — without the last one an authorization-filtered trail\n // would show unit privileges granted and never removed. DELETE must capture the revoked role in\n // its PREFIX: a delete postfix cannot read the deleted document.\n ...createOrganizationUnitMemberCreateFactories(),\n ...createOrganizationUnitMemberUpdateFactories(),\n ...createOrganizationUnitMemberDeleteFactories(),\n // Account/entity lifecycle transitions (SUSPEND / REACTIVATE / DEACTIVATE_ACCOUNT …). One shared\n // implementation across resources, declared as data — see\n // `resource-status-transition.definitions.backend.ts` for the state machine and for why\n // `organizations | activate|suspend` are not in the list yet.\n ...createEngineResourceStatusTransitionFactories(),\n // INBOUND_CONTACTS CREATE prefix — stamps the backend-only `emailUserMatch`\n // triage signal (does the lead email match an existing active/inactive user).\n ...createInboundContactCreateFactories(),\n // USERS application-role administration. `assign_roles` / `revoke_roles` translate their `roles`\n // request contract into set algebra over the persisted `appRoles` (they previously named a field\n // that is not a schema path and wrote nothing); CREATE/UPDATE carry the role-ceiling gate on the\n // same field, which nothing measured before. All four emit USER_APP_ROLES_CHANGED.\n ...createUserRoleSetOperationFactories(),\n ...createUserCoreRoleCeilingFactories(),\n // USERS force_password_reset — mints a single-use reset token for the TARGET, mails it to\n // them, evicts their live sessions, and records the acting administrator plus their reason.\n // Previously declared UPDATE-like with no handler, so it answered 200 while minting nothing\n // and the declared `{ resetToken, resetUrl }` response could never be produced (that handback\n // is now gone — it was an account-takeover primitive).\n ...createUserForcePasswordResetFactories(),\n // USERS DELETE — emits USER_DELETED. The event type and its SIEM classification existed from the\n // start but NOTHING produced them, so identity destruction left no evidence at all. Post-commit\n // by construction; reads the pre-deletion snapshot because `email` / `appRoles` are unrecoverable\n // once the row is gone.\n ...createUserDeletionAuditFactories(),\n // USERS DELETE — the last-super-administrator floor. Registered at priority 50 so it refuses\n // BEFORE the deletion-audit registration above (default 100) prepares anything: destroying the row\n // that holds the last application authority is the same unrecoverable lockout as revoking the role\n // off it, which the role-administration registrations refuse on their own paths.\n ...createUserSuperAdminFloorFactories(),\n ...createApiKeyCreateFactories(),\n ...createApiKeyRotateFactories(),\n ...createApiKeyRegenerateFactories(),\n ...createApiKeyExtendExpiryFactories(),\n ...createApiKeyUsageStatsFactories(),\n ...createApiKeyDeactivateFactories(),\n ...createApiKeyReactivateFactories(),\n // OAuth Clients (registered client-credentials front — mirrors API Keys mint pipeline)\n ...createOAuthClientCreateFactories(),\n ...createOAuthClientRotateFactories(),\n ...createOAuthClientRegenerateFactories(),\n ...createOrganizationFeaturesAdminWritePathFactories(),\n ...createApplicationFeaturesAdminWritePathFactories(),\n ...createScopeFeaturesCacheInvalidationFactories(),\n ...createAuditLogsExportFactories(),\n // Webhook (M2M outbound) domain — the public-key READ postfix existed but was\n // never registered (the `applicationPublicKeyPem` field silently never\n // surfaced); registered here together with the RETRY / PURGE_OLD impls.\n ...createWebhookConfigReadPublicKeyFactories(),\n ...createM2MWebhookDeliveryLogRetryFactories(),\n ...createM2MWebhookDeliveryLogPurgeOldFactories(),\n // TEST_ENDPOINT — fires one signed synthetic delivery through the SAME transport the\n // delivery worker uses and returns the diagnostic. Previously declared READ-like with no\n // handler, so the core read answered 200 with the config row and an unreachable URL still\n // reported success.\n ...createWebhookConfigTestEndpointFactories(),\n]\n"]}
|
|
1
|
+
{"version":3,"file":"custom-service-implementations.backend.definition.js","sourceRoot":"","sources":["../../../../../src/resources/models/custom-service-implementations.backend.definition.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,6BAA6B,EAAE,MAAM,4EAA4E,CAAC;AAC3H,OAAO,EAAE,4BAA4B,EAAE,MAAM,wFAAwF,CAAC;AACtI,OAAO,EAAE,8BAA8B,EAAE,MAAM,+EAA+E,CAAC;AAC/H,OAAO,EAAE,oCAAoC,EAAE,MAAM,uFAAuF,CAAC;AAC7I,OAAO,EAAE,yBAAyB,EAAE,MAAM,uGA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,mCAAmC,EAAE;IACxC,iGAAiG;IACjG,iGAAiG;IACjG,iGAAiG;IACjG,mFAAmF;IACnF,GAAG,mCAAmC,EAAE;IACxC,GAAG,kCAAkC,EAAE;IACvC,0FAA0F;IAC1F,4FAA4F;IAC5F,4FAA4F;IAC5F,8FAA8F;IAC9F,uDAAuD;IACvD,GAAG,qCAAqC,EAAE;IAC1C,iGAAiG;IACjG,gGAAgG;IAChG,kGAAkG;IAClG,wBAAwB;IACxB,GAAG,gCAAgC,EAAE;IACrC,6FAA6F;IAC7F,mGAAmG;IACnG,mGAAmG;IACnG,iFAAiF;IACjF,GAAG,kCAAkC,EAAE;IACvC,GAAG,2BAA2B,EAAE;IAChC,GAAG,2BAA2B,EAAE;IAChC,GAAG,+BAA+B,EAAE;IACpC,GAAG,iCAAiC,EAAE;IACtC,GAAG,+BAA+B,EAAE;IACpC,GAAG,+BAA+B,EAAE;IACpC,GAAG,+BAA+B,EAAE;IACpC,uFAAuF;IACvF,GAAG,gCAAgC,EAAE;IACrC,GAAG,gCAAgC,EAAE;IACrC,GAAG,oCAAoC,EAAE;IACzC,GAAG,iDAAiD,EAAE;IACtD,GAAG,gDAAgD,EAAE;IACrD,GAAG,6CAA6C,EAAE;IAClD,GAAG,gDAAgD,EAAE;IACrD,GAAG,8BAA8B,EAAE;IACnC,8EAA8E;IAC9E,uEAAuE;IACvE,wEAAwE;IACxE,GAAG,yCAAyC,EAAE;IAC9C,GAAG,yCAAyC,EAAE;IAC9C,GAAG,4CAA4C,EAAE;IACjD,qFAAqF;IACrF,yFAAyF;IACzF,0FAA0F;IAC1F,oBAAoB;IACpB,GAAG,wCAAwC,EAAE;CAC9C,CAAA","sourcesContent":["import { z } from 'zod';\nimport type { ResourceConfiguration_Operation } from '@wildo-ai/saas-models';\nimport type { ResourceOperationCustomImplementationBase } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation-base.backend.service';\nimport { ResourceCustomServiceImplementationFactory } from '~wildo-backend-lib/base-classes/services/services/resource-operation-custom-implementation.factory.backend';\nimport { userSelfCustomImplementations } from '~wildo-backend-lib/users/services/user-self-custom-implementations.backend';\nimport { billingCustomImplementations } from '~wildo-backend-lib/billing/services/custom-impl/billing-custom-implementations.backend';\nimport { lifecycleCustomImplementations } from '~wildo-backend-lib/guidance/services/lifecycle-custom-implementations.backend';\nimport { scopedStateReadCustomImplementations } from '~wildo-backend-lib/guidance/services/scoped-state-read-custom-implementations.backend';\nimport { authCustomImplementations } from '~wildo-backend-lib/security/authentications/services/custom-impls/auth-custom-implementations.backend';\nimport { createAuditLogsExportFactories } from '~wildo-backend-lib/compliance/audit-trails/audit-logs.custom-impl.backend.service';\nimport { createOrganizationCreateFactories, createOrganizationLifecycleFactories } from '~wildo-backend-lib/organizations/services/organization-custom-implementation.backend.service';\nimport { createOrganizationDeletionAuditFactories } from '~wildo-backend-lib/organizations/services/organization-deletion-audit.custom-impl.backend.service';\nimport { createEngineResourceStatusTransitionFactories } from '~wildo-backend-lib/base-classes/services/services/resource-status-transition.definitions.backend';\nimport { createOrganizationMemberCreateFactories } from '~wildo-backend-lib/organizations/services/organization-member-custom-implementation.backend.service';\nimport { createPlatformAccessGrantFactories } from '~wildo-backend-lib/security/authorizations/platform-access-grant-custom-implementation.backend.service';\nimport {\n createOrganizationUnitCreatePathFactories,\n createOrganizationUnitDeleteDependentsGuardFactories,\n createOrganizationUnitMoveFactories,\n createOrganizationUnitStatusTransitionFactories,\n createOrganizationUnitUpdateFactories,\n} from '~wildo-backend-lib/organizations/services/organization-unit-custom-implementation.backend.service';\nimport {\n createOrganizationUnitMemberCreateFactories,\n createOrganizationUnitMemberDeleteFactories,\n createOrganizationUnitMemberUpdateFactories,\n} from '~wildo-backend-lib/organizations/services/organization-unit-member-custom-implementation.backend.service';\nimport { createInboundContactCreateFactories } from '~wildo-backend-lib/users/services/inbound-contact-custom-implementation.backend.service';\nimport {\n createUserCoreRoleCeilingFactories,\n createUserRoleSetOperationFactories,\n} from '~wildo-backend-lib/users/services/user-role-administration.custom-impl.backend.service';\nimport { createUserForcePasswordResetFactories } from '~wildo-backend-lib/users/services/user-force-password-reset.custom-impl.backend.service';\nimport { createUserDeletionAuditFactories } from '~wildo-backend-lib/users/services/user-deletion-audit.custom-impl.backend.service';\nimport { createUserSuperAdminFloorFactories } from '~wildo-backend-lib/users/services/user-super-admin-floor.custom-impl.backend.service';\nimport {\n createApiKeyCreateFactories,\n createApiKeyRotateFactories,\n createApiKeyRegenerateFactories,\n createApiKeyExtendExpiryFactories,\n createApiKeyUsageStatsFactories,\n createApiKeyDeactivateFactories,\n createApiKeyReactivateFactories,\n} from '~wildo-backend-lib/security/api-keys/api-keys.custom-impl.backend.service';\nimport {\n createOAuthClientCreateFactories,\n createOAuthClientRotateFactories,\n createOAuthClientRegenerateFactories,\n} from '~wildo-backend-lib/security/oauth-clients/oauth-clients.custom-impl.backend.service';\nimport { createScopeFeaturesCacheInvalidationFactories } from '~wildo-backend-lib/features/services/scope-features-cache-invalidation.custom-impl.backend.service';\nimport { createSiemExportConfigCacheInvalidationFactories } from '~wildo-backend-lib/compliance/audit-trails/services/siem-export-config-cache-invalidation.custom-impl.backend.service';\nimport { createOrganizationFeaturesAdminWritePathFactories } from '~wildo-backend-lib/features/services/organization-features-admin-write-path.custom-impl.backend.service';\nimport { createApplicationFeaturesAdminWritePathFactories } from '~wildo-backend-lib/features/services/application-features-admin-write-path.custom-impl.backend.service';\nimport { createWebhookConfigReadPublicKeyFactories } from '~wildo-backend-lib/notifications/webhooks/outbound/services/webhook-config-public-key.custom-impl.backend.service';\nimport {\n createM2MWebhookDeliveryLogRetryFactories,\n createM2MWebhookDeliveryLogPurgeOldFactories,\n} from '~wildo-backend-lib/notifications/webhooks/outbound/services/m2m-webhook-delivery-log.custom-impl.backend.service';\nimport { createWebhookConfigTestEndpointFactories } from '~wildo-backend-lib/notifications/webhooks/outbound/services/webhook-config-test-endpoint.custom-impl.backend.service';\n\n\nexport const CoreBackend_ServiceImplementationsFactories : ResourceCustomServiceImplementationFactory[] = [\n ...userSelfCustomImplementations,\n ...billingCustomImplementations,\n ...scopedStateReadCustomImplementations,\n ...lifecycleCustomImplementations,\n ...authCustomImplementations,\n ...createOrganizationCreateFactories(),\n // Tenant lifecycle transitions (WS-A): `request_deletion` on both declared variants + `restore`.\n // These own `Organization.status`, which generic UPDATE may not write.\n ...createOrganizationLifecycleFactories(),\n // ORGANIZATIONS DELETE — emits ORGANIZATION_DELETED. The event type, its typed event-data schema\n // and its SIEM classification all existed from the start but NOTHING produced them, so destroying\n // a whole tenant left no evidence at all (the exact sibling of the USER_DELETED gap below).\n // Registered on BOTH declared doors — the org-admin default AND the super-admin `admin` variant —\n // because custom impls resolve by an exact operation-path key; one registration would have left\n // the privileged cross-tenant route unaudited. Post-commit by construction; reads the pre-deletion\n // snapshot because `name` / `slug` are unrecoverable once the row is gone.\n ...createOrganizationDeletionAuditFactories(),\n ...createOrganizationMemberCreateFactories(),\n // PLATFORM_ACCESS_GRANTS — the four lifecycle transitions. Every field that carries the\n // time-bound/justified/tenant-scoped guarantee (`operatorUserId`, `status`, `expiresAt`,\n // `approvedByUserId`) is server-authored here; the resource exposes no generic CREATE/UPDATE door,\n // so these prefixes are the only way a grant can come into existence or change state.\n ...createPlatformAccessGrantFactories(),\n // ORGANIZATION_UNITS DELETE prefix — refuses to strand a subtree behind a deleted interior\n // node (the unit tree self-edge declares no delete cascade).\n ...createOrganizationUnitDeleteDependentsGuardFactories(),\n // ORGANIZATION_UNITS tree mechanics. CREATE materializes the hierarchy `path` on the inserting\n // write (it was previously never written by anything); MOVE re-parents and re-homes the whole\n // subtree; ARCHIVE/RESTORE own the node-only status transitions. Before these, all three custom\n // operations were declared with no implementation and succeeded while changing nothing.\n ...createOrganizationUnitCreatePathFactories(),\n ...createOrganizationUnitUpdateFactories(),\n ...createOrganizationUnitMoveFactories(),\n ...createOrganizationUnitStatusTransitionFactories(),\n // ORGANIZATION_UNIT_MEMBERS — a unit assignment is a role grant (its `role` is read into\n // `initiatorRoles` as a unit-narrowed entry), so both write paths carry the role-ceiling gate\n // explicitly (custom impls resolve by exact operation path; neither inherits the other's gate).\n // CREATE additionally proves the target unit is in the caller's tenant. All three paths emit the\n // matching audit event: grant and re-grade via ORGANIZATION_UNIT_MEMBER_ROLE_CHANGED, revocation\n // via ORGANIZATION_UNIT_MEMBER_REMOVED — without the last one an authorization-filtered trail\n // would show unit privileges granted and never removed. DELETE must capture the revoked role in\n // its PREFIX: a delete postfix cannot read the deleted document.\n ...createOrganizationUnitMemberCreateFactories(),\n ...createOrganizationUnitMemberUpdateFactories(),\n ...createOrganizationUnitMemberDeleteFactories(),\n // Account/entity lifecycle transitions (SUSPEND / REACTIVATE / DEACTIVATE_ACCOUNT …). One shared\n // implementation across resources, declared as data — see\n // `resource-status-transition.definitions.backend.ts` for the state machine and for why\n // `organizations | activate|suspend` are not in the list yet.\n ...createEngineResourceStatusTransitionFactories(),\n // INBOUND_CONTACTS CREATE prefix — stamps the backend-only `emailUserMatch`\n // triage signal (does the lead email match an existing active/inactive user).\n ...createInboundContactCreateFactories(),\n // USERS application-role administration. `assign_roles` / `revoke_roles` translate their `roles`\n // request contract into set algebra over the persisted `appRoles` (they previously named a field\n // that is not a schema path and wrote nothing); CREATE/UPDATE carry the role-ceiling gate on the\n // same field, which nothing measured before. All four emit USER_APP_ROLES_CHANGED.\n ...createUserRoleSetOperationFactories(),\n ...createUserCoreRoleCeilingFactories(),\n // USERS force_password_reset — mints a single-use reset token for the TARGET, mails it to\n // them, evicts their live sessions, and records the acting administrator plus their reason.\n // Previously declared UPDATE-like with no handler, so it answered 200 while minting nothing\n // and the declared `{ resetToken, resetUrl }` response could never be produced (that handback\n // is now gone — it was an account-takeover primitive).\n ...createUserForcePasswordResetFactories(),\n // USERS DELETE — emits USER_DELETED. The event type and its SIEM classification existed from the\n // start but NOTHING produced them, so identity destruction left no evidence at all. Post-commit\n // by construction; reads the pre-deletion snapshot because `email` / `appRoles` are unrecoverable\n // once the row is gone.\n ...createUserDeletionAuditFactories(),\n // USERS DELETE — the last-super-administrator floor. Registered at priority 50 so it refuses\n // BEFORE the deletion-audit registration above (default 100) prepares anything: destroying the row\n // that holds the last application authority is the same unrecoverable lockout as revoking the role\n // off it, which the role-administration registrations refuse on their own paths.\n ...createUserSuperAdminFloorFactories(),\n ...createApiKeyCreateFactories(),\n ...createApiKeyRotateFactories(),\n ...createApiKeyRegenerateFactories(),\n ...createApiKeyExtendExpiryFactories(),\n ...createApiKeyUsageStatsFactories(),\n ...createApiKeyDeactivateFactories(),\n ...createApiKeyReactivateFactories(),\n // OAuth Clients (registered client-credentials front — mirrors API Keys mint pipeline)\n ...createOAuthClientCreateFactories(),\n ...createOAuthClientRotateFactories(),\n ...createOAuthClientRegenerateFactories(),\n ...createOrganizationFeaturesAdminWritePathFactories(),\n ...createApplicationFeaturesAdminWritePathFactories(),\n ...createScopeFeaturesCacheInvalidationFactories(),\n ...createSiemExportConfigCacheInvalidationFactories(),\n ...createAuditLogsExportFactories(),\n // Webhook (M2M outbound) domain — the public-key READ postfix existed but was\n // never registered (the `applicationPublicKeyPem` field silently never\n // surfaced); registered here together with the RETRY / PURGE_OLD impls.\n ...createWebhookConfigReadPublicKeyFactories(),\n ...createM2MWebhookDeliveryLogRetryFactories(),\n ...createM2MWebhookDeliveryLogPurgeOldFactories(),\n // TEST_ENDPOINT — fires one signed synthetic delivery through the SAME transport the\n // delivery worker uses and returns the diagnostic. Previously declared READ-like with no\n // handler, so the core read answered 200 with the config row and an unreachable URL still\n // reported success.\n ...createWebhookConfigTestEndpointFactories(),\n]\n"]}
|
|
@@ -103,9 +103,9 @@ let ResourceIdBackendService = class ResourceIdBackendService {
|
|
|
103
103
|
*
|
|
104
104
|
* Without this arm such a resource can be LISTed and never READ: the declared platform format
|
|
105
105
|
* admits only an ObjectId or a UUID, and a projection cannot produce either without inventing
|
|
106
|
-
* an identity it does not have. Measured before the arm existed
|
|
107
|
-
*
|
|
108
|
-
*
|
|
106
|
+
* an identity it does not have. Measured before the arm existed, on the workbench's module
|
|
107
|
+
* projection (a resource since superseded by `workbench-domain-resources`): the LIST answered 200
|
|
108
|
+
* with 8 rows while the addressed READ of the row keyed `engine` answered 400 `invalid_format`.
|
|
109
109
|
*/
|
|
110
110
|
if (adapter === PersistenceAdapter.INTROSPECTION) {
|
|
111
111
|
return ResourceIdFormat.INTROSPECTION_SYNTHESIZED;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-id.backend.service.js","sourceRoot":"","sources":["../../../../../src/resources/services/resource-id.backend.service.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;;;;;;;;;;;;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,MAAM,CAAC;AACpC,OAAO,EAEL,gBAAgB,EAChB,qBAAqB,EACrB,kBAAkB,EAGlB,SAAS,EACT,2BAA2B,EAC3B,mBAAmB,GACpB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,kBAAkB,EAAE,MAAM,gDAAgD,CAAC;AACpF,OAAO,EAAE,gCAAgC,EAAE,MAAM,+EAA+E,CAAC;AAKjI;;;;;;;;;;;;;;;GAeG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAGhB;IAEA;IAGA;IAPnB,YAEmB,gBAAyC,EAEzC,YAAwC,EAGxC,gBAAkD;QALlD,qBAAgB,GAAhB,gBAAgB,CAAyB;QAEzC,iBAAY,GAAZ,YAAY,CAA4B;QAGxC,qBAAgB,GAAhB,gBAAgB,CAAkC;IAClE,CAAC;IAEJ,+EAA+E;IAC/E,mBAAmB;IACnB,+EAA+E;IAE/E;;OAEG;IACH,gBAAgB;QACd,OAAO,IAAI,CAAC,2BAA2B,EAAE,CAAC;IAC5C,CAAC;IAED;;;;OAIG;IACH,oBAAoB,CAA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AAiC;oBACzC,kBAAkB,EAAE,OAAO;iBAC5B;aACF,CAAC,CAAC;QACL,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;;OAMG;IACK,2BAA2B;QACjC,IAAI,CAAC;YACH,OAAQ,IAAI,CAAC,gBAAgB,CAAC,MAAc,EAAE,QAAQ,EAAE,gBAAgB;mBACnE,gBAAgB,CAAC,SAAS,CAAC;QAClC,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,gBAAgB,CAAC,SAAS,CAAC;QACpC,CAAC;IACH,CAAC;CAEF,CAAA;AAlWY,wBAAwB;IADpC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,QAAQ,EAAE,CAAA;;GAPF,wBAAwB,CAkWpC","sourcesContent":["/**\n * ResourceId Backend Service\n *\n * Backend-specific service for ID generation, validation, and formatting.\n * Works with both MongoDB ObjectId and PostgreSQL UUID formats.\n *\n * @see DATABASE_AGNOSTIC_REPOSITORY_ANALYSIS.md Section 28.4\n */\n\nimport { injectable, inject, optional } from 'inversify';\nimport { Types } from 'mongoose';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n ResourceId,\n ResourceIdFormat,\n Resources_SharedUtils,\n PersistenceAdapter,\n PersistenceAdapterType,\n DEFAULT_PERSISTENCE_ADAPTER,\n ErrorType,\n ErrorCustomMessageReference,\n isWildoBackendError,\n} from '@wildo-ai/saas-models';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { resolveDefaultPersistenceAdapter } from '~wildo-backend-lib/databases/models/resolve-persistence-adapter.backend.utils';\nimport type { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.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';\n\n/**\n * Backend service for database-agnostic resource ID operations.\n *\n * Provides:\n * - ID generation (ObjectId or UUID based on configuration)\n * - Format detection and validation\n * - Query formatting (converts string IDs to native database types)\n *\n * @example\n * // Generate ID for a resource\n * const id = resourceIdService.generateForResource('TODOS');\n *\n * // Format ID for database query\n * const queryId = resourceIdService.formatForQuery(id, ResourceIdFormat.OBJECT_ID);\n * // Returns Types.ObjectId for MongoDB queries\n */\n@injectable()\nexport class ResourceIdBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n @optional()\n private readonly resourceRegistry?: ResourcesRegistryBackendService,\n ) {}\n\n // ============================================================================\n // Format Detection\n // ============================================================================\n\n /**\n * Get the default ID format based on app configuration\n */\n getDefaultFormat(): ResourceIdFormat {\n return this.getDeclaredResourceIdFormat();\n }\n\n /**\n * Get the ID format for a specific resource type\n * @param resourceType - The resource type identifier\n * @returns The ID format to use for this resource\n */\n getFormatForResource(_resourceType: string): ResourceIdFormat {\n /**\n * The DECLARED application format, not a function of where this resource is stored.\n *\n * This used to be `adapterToFormat(getAdapterForResource(resourceType))`, which made identity\n * format a side effect of storage. Two things followed, and both are border effects rather\n * than theory:\n *\n * - moving ONE resource to another adapter changed the shape of every id it minted from then\n * on, so a single application accumulated both formats with nothing recording why;\n * - every id minted BEFORE the move then failed `validateForResource`, because that check\n * compared a stored, historical value against the currently-configured format. An adapter\n * change is not supposed to invalidate existing data.\n *\n * The resource type is retained in the signature: per-resource identity formats are a plausible\n * future authoring surface, and the callers should not have to change if it arrives. It is\n * deliberately ignored today for PLATFORM-backed resources — one application, one identity\n * format.\n *\n * The ONE exception is `HTTP_API` (ETL Step 3, paper A gate G2): a synthesized id IS a\n * function of where the rows live — it encodes the remote entity's key components and is\n * never minted here — so an HTTP_API-backed resource resolves to\n * `HTTP_API_SYNTHESIZED`. The historical objection to adapter-derived formats (an adapter\n * change retroactively invalidating minted ids) does not arise: an HTTP_API resource has no\n * minted history, and its charset admission is a superset of both platform formats.\n */\n const adapter = this.getAdapterForResource(_resourceType);\n if (adapter === PersistenceAdapter.HTTP_API) {\n return ResourceIdFormat.HTTP_API_SYNTHESIZED;\n }\n /*\n * INTROSPECTION is the same exception for the same reason, and needs it MORE.\n *\n * An introspected row is derived from the application's own structure per request and stored\n * nowhere, so its id is whatever the projection already calls it — `engine`, or a composed\n * structural key. Nothing mints it, so there is no minted history for an adapter change to\n * invalidate, which is the objection that kept format decoupled from storage everywhere else.\n *\n * Without this arm such a resource can be LISTed and never READ: the declared platform format\n * admits only an ObjectId or a UUID, and a projection cannot produce either without inventing\n * an identity it does not have. Measured before the arm existed — `GET\n * /workbench-application-modules` answered 200 with 8 rows while\n * `/workbench-application-modules/engine` answered 400 `invalid_format`.\n */\n if (adapter === PersistenceAdapter.INTROSPECTION) {\n return ResourceIdFormat.INTROSPECTION_SYNTHESIZED;\n }\n return this.getDeclaredResourceIdFormat();\n }\n\n /**\n * Get the persistence adapter for a resource\n * @param resourceType - The resource type identifier\n * @returns The persistence adapter ('mongodb' or 'postgresql')\n */\n getAdapterForResource(resourceType: string): PersistenceAdapterType {\n if (this.resourceRegistry) {\n try {\n const resourceConfiguration = this.resourceRegistry.tryGetResourceConfiguration(resourceType as any);\n if (resourceConfiguration) {\n return this.assertSupportedAdapter(\n resourceConfiguration.persistenceAdapter ?? this.getDefaultAdapter(),\n );\n }\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { resourceType, message: `Cannot resolve persistence adapter for unregistered resource '${resourceType}'` },\n });\n } catch (error) {\n if (\n isWildoBackendError(error)\n && error.customMessageReference\n === ErrorCustomMessageReference.RESOURCES_REGISTRY_INITIALIZATION_FAILED\n ) {\n return this.getDefaultAdapter();\n }\n throw error;\n }\n }\n\n return this.getDefaultAdapter();\n }\n\n /**\n * Detect the format of an existing ID\n * @param id - The resource ID to analyze\n * @returns The detected format, or null if invalid\n */\n detectFormat(id: ResourceId): ResourceIdFormat | null {\n return Resources_SharedUtils.detectIdFormat(id);\n }\n\n // ============================================================================\n // ID Generation\n // ============================================================================\n\n /**\n * Generate a new resource ID in the specified format\n * @param format - The format to generate (defaults to config default)\n * @returns A new resource ID string\n */\n generate(format?: ResourceIdFormat): ResourceId {\n const targetFormat = format ?? this.getDefaultFormat();\n\n switch (targetFormat) {\n case ResourceIdFormat.OBJECT_ID:\n return new Types.ObjectId().toHexString();\n case ResourceIdFormat.UUID:\n return uuidv4();\n case ResourceIdFormat.HTTP_API_SYNTHESIZED:\n // Synthesized ids are DERIVED from remote key components by the codec authority\n // (`synthesizeHttpApiResourceId`), never minted — minting one here would fabricate an id\n // addressing no remote row.\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: {\n reason: 'http_api_ids_are_synthesized_never_minted',\n targetFormat,\n },\n });\n default:\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { targetFormat }, // diagnostic (log-only)\n });\n }\n }\n\n /**\n * Generate a new resource ID for a specific resource type\n * Uses the configured format for that resource\n * @param resourceType - The resource type identifier\n * @returns A new resource ID string\n */\n generateForResource(resourceType: string): ResourceId {\n const format = this.getFormatForResource(resourceType);\n return this.generate(format);\n }\n\n // ============================================================================\n // Query Formatting\n // ============================================================================\n\n /**\n * Format an ID for use in database queries.\n *\n * - For MongoDB: Returns `Types.ObjectId` instance\n * - For PostgreSQL: Returns the string as-is (UUID)\n *\n * @param id - The resource ID string\n * @param format - The expected format (auto-detected if not provided)\n * @returns The formatted ID for database queries\n */\n formatForQuery(id: ResourceId, format?: ResourceIdFormat): unknown {\n const targetFormat = format ?? this.detectFormat(id);\n\n if (!targetFormat) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id }, // diagnostic (log-only)\n });\n }\n\n switch (targetFormat) {\n case ResourceIdFormat.OBJECT_ID:\n if (!Resources_SharedUtils.isObjectId(id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id, expectedFormat: 'ObjectId' },\n });\n }\n return new Types.ObjectId(id);\n case ResourceIdFormat.UUID:\n if (!Resources_SharedUtils.isUUID(id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id, expectedFormat: 'UUID' },\n });\n }\n return id; // PostgreSQL uses UUID as string\n case ResourceIdFormat.HTTP_API_SYNTHESIZED:\n // Charset-checked passthrough (paper A gate G2): the synthesized id is an opaque string\n // wherever a platform store holds it (e.g. a String FK column referencing an HTTP_API\n // parent). Decode/canonicality live in the codec authority, not here.\n if (!Resources_SharedUtils.isHttpApiSynthesizedId(id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id, expectedFormat: 'HTTP_API_SYNTHESIZED (charset law)' },\n });\n }\n return id;\n default:\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { targetFormat }, // diagnostic (log-only)\n });\n }\n }\n\n /**\n * Format an ID for a specific resource type's database queries\n * @param id - The resource ID string\n * @param resourceType - The resource type identifier\n * @returns The formatted ID for database queries\n */\n formatForResourceQuery(id: ResourceId, resourceType: string): unknown {\n const format = this.getFormatForResource(resourceType);\n return this.formatForQuery(id, format);\n }\n\n // ============================================================================\n // Validation\n // ============================================================================\n\n /**\n * Validate an ID value\n * @param id - The value to validate\n * @param expectedFormat - Optional expected format for strict validation\n * @returns true if valid\n */\n validate(id: unknown, expectedFormat?: ResourceIdFormat): boolean {\n if (typeof id !== 'string') {\n return false;\n }\n\n if (expectedFormat) {\n switch (expectedFormat) {\n case ResourceIdFormat.OBJECT_ID:\n return Resources_SharedUtils.isObjectId(id);\n case ResourceIdFormat.UUID:\n return Resources_SharedUtils.isUUID(id);\n case ResourceIdFormat.HTTP_API_SYNTHESIZED:\n return Resources_SharedUtils.isHttpApiSynthesizedId(id);\n default:\n return false;\n }\n }\n\n return Resources_SharedUtils.isValidResourceId(id);\n }\n\n /**\n * Validate an ID for a specific resource type\n * @param id - The value to validate\n * @param resourceType - The resource type identifier\n * @returns true if valid for the resource's configured format\n */\n validateForResource(id: unknown, _resourceType: string): boolean {\n /**\n * Tolerates ANY well-formed resource id, deliberately — policy governs MINTING, not history.\n *\n * A stored identifier's format is a fact about when it was created, not a statement about\n * current configuration. Rejecting a perfectly well-formed ObjectId because the application now\n * mints UUIDs (or the reverse) would make an id-format change — or, before this was decoupled,\n * an ADAPTER change — retroactively invalidate every existing row, URL and external reference.\n *\n * This is the same split as the continuity rule's \"reads tolerate, acceptance refuses\":\n * {@link generateForResource} applies the declared policy to new identifiers; this check only\n * asks whether the value can be an identifier at all.\n *\n * For an `HTTP_API`-backed resource the admissible shape WIDENS to the synthesized-id charset\n * law (a strict superset of both platform formats — ObjectId hex and UUID both match it), and\n * ONLY there: the widening is keyed on the resource's resolved format, never folded into the\n * shared static validator (paper A: no silent loosening for platform rows).\n */\n const format = this.getFormatForResource(_resourceType);\n if (format === ResourceIdFormat.HTTP_API_SYNTHESIZED) {\n return typeof id === 'string' && Resources_SharedUtils.isHttpApiSynthesizedId(id);\n }\n if (format === ResourceIdFormat.INTROSPECTION_SYNTHESIZED) {\n return typeof id === 'string' && Resources_SharedUtils.isIntrospectionSynthesizedId(id);\n }\n return this.validate(id);\n }\n\n // ============================================================================\n // Private Helpers\n // ============================================================================\n\n /**\n * The default persistence adapter, through the ONE derivation seam (review R2): this resolver\n * feeds the unit-of-work's transaction routing, and reading hydrated config directly here left\n * it blind to the platform-mode construction-time override — the third of three resolvers that\n * had to agree and only agreed by accident. See `resolveDefaultPersistenceAdapter`'s JSDoc.\n */\n private getDefaultAdapter(): PersistenceAdapterType {\n return resolveDefaultPersistenceAdapter(this.appConfigService);\n }\n\n /**\n * Refuse an adapter this build does not implement.\n *\n * This fail-closed used to live in `adapterToFormat`, whose removal would otherwise have deleted\n * it: an unrecognised `persistenceAdapter` (a typo, or a value from a newer build) silently\n * became MongoDB's id format. Format no longer derives from the adapter, so the guard moves to\n * where adapters are actually resolved and keeps protecting every consumer of this method — the\n * persistence unit of work included.\n */\n private assertSupportedAdapter(adapter: PersistenceAdapterType): PersistenceAdapterType {\n if (!Object.values(PersistenceAdapter).includes(adapter as PersistenceAdapter)) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: {\n reason: 'unsupported_persistence_adapter',\n persistenceAdapter: adapter,\n },\n });\n }\n return adapter;\n }\n\n /**\n * The application's declared identity format.\n *\n * Falls back to `OBJECT_ID` when configuration is unavailable (the service is constructed before\n * config load in some bootstrap paths) — the same value every existing application already mints,\n * so an unreadable config cannot silently change identity shape.\n */\n private getDeclaredResourceIdFormat(): ResourceIdFormat {\n try {\n return (this.appConfigService.config as any)?.database?.resourceIdFormat\n ?? ResourceIdFormat.OBJECT_ID;\n } catch {\n return ResourceIdFormat.OBJECT_ID;\n }\n }\n\n}\n"]}
|
|
1
|
+
{"version":3,"file":"resource-id.backend.service.js","sourceRoot":"","sources":["../../../../../src/resources/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;QACpC,CAAC;IACH,CAAC;CAEF,CAAA;AAlWY,wBAAwB;IADpC,UAAU,EAAE;IAGR,WAAA,MAAM,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,CAAA;IAE3C,WAAA,MAAM,CAAC,kBAAkB,CAAC,mBAAmB,CAAC,CAAA;IAE9C,WAAA,MAAM,CAAC,kBAAkB,CAAC,uBAAuB,CAAC,CAAA;IAClD,WAAA,QAAQ,EAAE,CAAA;;GAPF,wBAAwB,CAkWpC","sourcesContent":["/**\n * ResourceId Backend Service\n *\n * Backend-specific service for ID generation, validation, and formatting.\n * Works with both MongoDB ObjectId and PostgreSQL UUID formats.\n *\n * @see DATABASE_AGNOSTIC_REPOSITORY_ANALYSIS.md Section 28.4\n */\n\nimport { injectable, inject, optional } from 'inversify';\nimport { Types } from 'mongoose';\nimport { v4 as uuidv4 } from 'uuid';\nimport {\n ResourceId,\n ResourceIdFormat,\n Resources_SharedUtils,\n PersistenceAdapter,\n PersistenceAdapterType,\n DEFAULT_PERSISTENCE_ADAPTER,\n ErrorType,\n ErrorCustomMessageReference,\n isWildoBackendError,\n} from '@wildo-ai/saas-models';\nimport { SAAS_SERVICE_TYPES } from '~wildo-backend-lib/inject/models/service-types';\nimport { resolveDefaultPersistenceAdapter } from '~wildo-backend-lib/databases/models/resolve-persistence-adapter.backend.utils';\nimport type { AppConfigurationService } from '~wildo-backend-lib/config/services/app-configuration.backend.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';\n\n/**\n * Backend service for database-agnostic resource ID operations.\n *\n * Provides:\n * - ID generation (ObjectId or UUID based on configuration)\n * - Format detection and validation\n * - Query formatting (converts string IDs to native database types)\n *\n * @example\n * // Generate ID for a resource\n * const id = resourceIdService.generateForResource('TODOS');\n *\n * // Format ID for database query\n * const queryId = resourceIdService.formatForQuery(id, ResourceIdFormat.OBJECT_ID);\n * // Returns Types.ObjectId for MongoDB queries\n */\n@injectable()\nexport class ResourceIdBackendService {\n constructor(\n @inject(SAAS_SERVICE_TYPES.AppConfigService)\n private readonly appConfigService: AppConfigurationService,\n @inject(SAAS_SERVICE_TYPES.ErrorBuilderService)\n private readonly errorBuilder: ErrorBuilderBackendService,\n @inject(SAAS_SERVICE_TYPES.ResourceRegistryService)\n @optional()\n private readonly resourceRegistry?: ResourcesRegistryBackendService,\n ) {}\n\n // ============================================================================\n // Format Detection\n // ============================================================================\n\n /**\n * Get the default ID format based on app configuration\n */\n getDefaultFormat(): ResourceIdFormat {\n return this.getDeclaredResourceIdFormat();\n }\n\n /**\n * Get the ID format for a specific resource type\n * @param resourceType - The resource type identifier\n * @returns The ID format to use for this resource\n */\n getFormatForResource(_resourceType: string): ResourceIdFormat {\n /**\n * The DECLARED application format, not a function of where this resource is stored.\n *\n * This used to be `adapterToFormat(getAdapterForResource(resourceType))`, which made identity\n * format a side effect of storage. Two things followed, and both are border effects rather\n * than theory:\n *\n * - moving ONE resource to another adapter changed the shape of every id it minted from then\n * on, so a single application accumulated both formats with nothing recording why;\n * - every id minted BEFORE the move then failed `validateForResource`, because that check\n * compared a stored, historical value against the currently-configured format. An adapter\n * change is not supposed to invalidate existing data.\n *\n * The resource type is retained in the signature: per-resource identity formats are a plausible\n * future authoring surface, and the callers should not have to change if it arrives. It is\n * deliberately ignored today for PLATFORM-backed resources — one application, one identity\n * format.\n *\n * The ONE exception is `HTTP_API` (ETL Step 3, paper A gate G2): a synthesized id IS a\n * function of where the rows live — it encodes the remote entity's key components and is\n * never minted here — so an HTTP_API-backed resource resolves to\n * `HTTP_API_SYNTHESIZED`. The historical objection to adapter-derived formats (an adapter\n * change retroactively invalidating minted ids) does not arise: an HTTP_API resource has no\n * minted history, and its charset admission is a superset of both platform formats.\n */\n const adapter = this.getAdapterForResource(_resourceType);\n if (adapter === PersistenceAdapter.HTTP_API) {\n return ResourceIdFormat.HTTP_API_SYNTHESIZED;\n }\n /*\n * INTROSPECTION is the same exception for the same reason, and needs it MORE.\n *\n * An introspected row is derived from the application's own structure per request and stored\n * nowhere, so its id is whatever the projection already calls it — `engine`, or a composed\n * structural key. Nothing mints it, so there is no minted history for an adapter change to\n * invalidate, which is the objection that kept format decoupled from storage everywhere else.\n *\n * Without this arm such a resource can be LISTed and never READ: the declared platform format\n * admits only an ObjectId or a UUID, and a projection cannot produce either without inventing\n * an identity it does not have. Measured before the arm existed, on the workbench's module\n * projection (a resource since superseded by `workbench-domain-resources`): the LIST answered 200\n * with 8 rows while the addressed READ of the row keyed `engine` answered 400 `invalid_format`.\n */\n if (adapter === PersistenceAdapter.INTROSPECTION) {\n return ResourceIdFormat.INTROSPECTION_SYNTHESIZED;\n }\n return this.getDeclaredResourceIdFormat();\n }\n\n /**\n * Get the persistence adapter for a resource\n * @param resourceType - The resource type identifier\n * @returns The persistence adapter ('mongodb' or 'postgresql')\n */\n getAdapterForResource(resourceType: string): PersistenceAdapterType {\n if (this.resourceRegistry) {\n try {\n const resourceConfiguration = this.resourceRegistry.tryGetResourceConfiguration(resourceType as any);\n if (resourceConfiguration) {\n return this.assertSupportedAdapter(\n resourceConfiguration.persistenceAdapter ?? this.getDefaultAdapter(),\n );\n }\n throw this.errorBuilder.buildError(ErrorType.INTERNAL, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { resourceType, message: `Cannot resolve persistence adapter for unregistered resource '${resourceType}'` },\n });\n } catch (error) {\n if (\n isWildoBackendError(error)\n && error.customMessageReference\n === ErrorCustomMessageReference.RESOURCES_REGISTRY_INITIALIZATION_FAILED\n ) {\n return this.getDefaultAdapter();\n }\n throw error;\n }\n }\n\n return this.getDefaultAdapter();\n }\n\n /**\n * Detect the format of an existing ID\n * @param id - The resource ID to analyze\n * @returns The detected format, or null if invalid\n */\n detectFormat(id: ResourceId): ResourceIdFormat | null {\n return Resources_SharedUtils.detectIdFormat(id);\n }\n\n // ============================================================================\n // ID Generation\n // ============================================================================\n\n /**\n * Generate a new resource ID in the specified format\n * @param format - The format to generate (defaults to config default)\n * @returns A new resource ID string\n */\n generate(format?: ResourceIdFormat): ResourceId {\n const targetFormat = format ?? this.getDefaultFormat();\n\n switch (targetFormat) {\n case ResourceIdFormat.OBJECT_ID:\n return new Types.ObjectId().toHexString();\n case ResourceIdFormat.UUID:\n return uuidv4();\n case ResourceIdFormat.HTTP_API_SYNTHESIZED:\n // Synthesized ids are DERIVED from remote key components by the codec authority\n // (`synthesizeHttpApiResourceId`), never minted — minting one here would fabricate an id\n // addressing no remote row.\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: {\n reason: 'http_api_ids_are_synthesized_never_minted',\n targetFormat,\n },\n });\n default:\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { targetFormat }, // diagnostic (log-only)\n });\n }\n }\n\n /**\n * Generate a new resource ID for a specific resource type\n * Uses the configured format for that resource\n * @param resourceType - The resource type identifier\n * @returns A new resource ID string\n */\n generateForResource(resourceType: string): ResourceId {\n const format = this.getFormatForResource(resourceType);\n return this.generate(format);\n }\n\n // ============================================================================\n // Query Formatting\n // ============================================================================\n\n /**\n * Format an ID for use in database queries.\n *\n * - For MongoDB: Returns `Types.ObjectId` instance\n * - For PostgreSQL: Returns the string as-is (UUID)\n *\n * @param id - The resource ID string\n * @param format - The expected format (auto-detected if not provided)\n * @returns The formatted ID for database queries\n */\n formatForQuery(id: ResourceId, format?: ResourceIdFormat): unknown {\n const targetFormat = format ?? this.detectFormat(id);\n\n if (!targetFormat) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id }, // diagnostic (log-only)\n });\n }\n\n switch (targetFormat) {\n case ResourceIdFormat.OBJECT_ID:\n if (!Resources_SharedUtils.isObjectId(id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id, expectedFormat: 'ObjectId' },\n });\n }\n return new Types.ObjectId(id);\n case ResourceIdFormat.UUID:\n if (!Resources_SharedUtils.isUUID(id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id, expectedFormat: 'UUID' },\n });\n }\n return id; // PostgreSQL uses UUID as string\n case ResourceIdFormat.HTTP_API_SYNTHESIZED:\n // Charset-checked passthrough (paper A gate G2): the synthesized id is an opaque string\n // wherever a platform store holds it (e.g. a String FK column referencing an HTTP_API\n // parent). Decode/canonicality live in the codec authority, not here.\n if (!Resources_SharedUtils.isHttpApiSynthesizedId(id)) {\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { id, expectedFormat: 'HTTP_API_SYNTHESIZED (charset law)' },\n });\n }\n return id;\n default:\n throw this.errorBuilder.buildError(ErrorType.VALIDATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: { targetFormat }, // diagnostic (log-only)\n });\n }\n }\n\n /**\n * Format an ID for a specific resource type's database queries\n * @param id - The resource ID string\n * @param resourceType - The resource type identifier\n * @returns The formatted ID for database queries\n */\n formatForResourceQuery(id: ResourceId, resourceType: string): unknown {\n const format = this.getFormatForResource(resourceType);\n return this.formatForQuery(id, format);\n }\n\n // ============================================================================\n // Validation\n // ============================================================================\n\n /**\n * Validate an ID value\n * @param id - The value to validate\n * @param expectedFormat - Optional expected format for strict validation\n * @returns true if valid\n */\n validate(id: unknown, expectedFormat?: ResourceIdFormat): boolean {\n if (typeof id !== 'string') {\n return false;\n }\n\n if (expectedFormat) {\n switch (expectedFormat) {\n case ResourceIdFormat.OBJECT_ID:\n return Resources_SharedUtils.isObjectId(id);\n case ResourceIdFormat.UUID:\n return Resources_SharedUtils.isUUID(id);\n case ResourceIdFormat.HTTP_API_SYNTHESIZED:\n return Resources_SharedUtils.isHttpApiSynthesizedId(id);\n default:\n return false;\n }\n }\n\n return Resources_SharedUtils.isValidResourceId(id);\n }\n\n /**\n * Validate an ID for a specific resource type\n * @param id - The value to validate\n * @param resourceType - The resource type identifier\n * @returns true if valid for the resource's configured format\n */\n validateForResource(id: unknown, _resourceType: string): boolean {\n /**\n * Tolerates ANY well-formed resource id, deliberately — policy governs MINTING, not history.\n *\n * A stored identifier's format is a fact about when it was created, not a statement about\n * current configuration. Rejecting a perfectly well-formed ObjectId because the application now\n * mints UUIDs (or the reverse) would make an id-format change — or, before this was decoupled,\n * an ADAPTER change — retroactively invalidate every existing row, URL and external reference.\n *\n * This is the same split as the continuity rule's \"reads tolerate, acceptance refuses\":\n * {@link generateForResource} applies the declared policy to new identifiers; this check only\n * asks whether the value can be an identifier at all.\n *\n * For an `HTTP_API`-backed resource the admissible shape WIDENS to the synthesized-id charset\n * law (a strict superset of both platform formats — ObjectId hex and UUID both match it), and\n * ONLY there: the widening is keyed on the resource's resolved format, never folded into the\n * shared static validator (paper A: no silent loosening for platform rows).\n */\n const format = this.getFormatForResource(_resourceType);\n if (format === ResourceIdFormat.HTTP_API_SYNTHESIZED) {\n return typeof id === 'string' && Resources_SharedUtils.isHttpApiSynthesizedId(id);\n }\n if (format === ResourceIdFormat.INTROSPECTION_SYNTHESIZED) {\n return typeof id === 'string' && Resources_SharedUtils.isIntrospectionSynthesizedId(id);\n }\n return this.validate(id);\n }\n\n // ============================================================================\n // Private Helpers\n // ============================================================================\n\n /**\n * The default persistence adapter, through the ONE derivation seam (review R2): this resolver\n * feeds the unit-of-work's transaction routing, and reading hydrated config directly here left\n * it blind to the platform-mode construction-time override — the third of three resolvers that\n * had to agree and only agreed by accident. See `resolveDefaultPersistenceAdapter`'s JSDoc.\n */\n private getDefaultAdapter(): PersistenceAdapterType {\n return resolveDefaultPersistenceAdapter(this.appConfigService);\n }\n\n /**\n * Refuse an adapter this build does not implement.\n *\n * This fail-closed used to live in `adapterToFormat`, whose removal would otherwise have deleted\n * it: an unrecognised `persistenceAdapter` (a typo, or a value from a newer build) silently\n * became MongoDB's id format. Format no longer derives from the adapter, so the guard moves to\n * where adapters are actually resolved and keeps protecting every consumer of this method — the\n * persistence unit of work included.\n */\n private assertSupportedAdapter(adapter: PersistenceAdapterType): PersistenceAdapterType {\n if (!Object.values(PersistenceAdapter).includes(adapter as PersistenceAdapter)) {\n throw this.errorBuilder.buildError(ErrorType.CONFIGURATION, undefined, {\n customMessageReference: ErrorCustomMessageReference.RESOURCE_ID_VALIDATION_FAILED,\n context: {\n reason: 'unsupported_persistence_adapter',\n persistenceAdapter: adapter,\n },\n });\n }\n return adapter;\n }\n\n /**\n * The application's declared identity format.\n *\n * Falls back to `OBJECT_ID` when configuration is unavailable (the service is constructed before\n * config load in some bootstrap paths) — the same value every existing application already mints,\n * so an unreadable config cannot silently change identity shape.\n */\n private getDeclaredResourceIdFormat(): ResourceIdFormat {\n try {\n return (this.appConfigService.config as any)?.database?.resourceIdFormat\n ?? ResourceIdFormat.OBJECT_ID;\n } catch {\n return ResourceIdFormat.OBJECT_ID;\n }\n }\n\n}\n"]}
|
|
@@ -1362,7 +1362,7 @@ let ResourcesRegistryBackendService = class ResourcesRegistryBackendService {
|
|
|
1362
1362
|
*/
|
|
1363
1363
|
const tenancy = config.introspectionBinding?.tenancy;
|
|
1364
1364
|
if (tenancy === IntrospectionTenancyStance.SCOPE_FILTER_PUSHDOWN) {
|
|
1365
|
-
errors.push(`Resource '${resourceType}' declares introspection tenancy 'scope-filter-pushdown', which is not implemented: no introspection behavior accepts a scope argument, so the engine has nothing to push down and the rows would be served unscoped. Declare 'application-structure' if the rows carry no tenant dimension, or do not back this resource with introspection.`);
|
|
1365
|
+
errors.push(`Resource '${resourceType}' declares introspection tenancy 'scope-filter-pushdown', which is not implemented: no introspection behavior accepts a scope argument, so the engine has nothing to push down and the rows would be served unscoped. Declare 'application-structure' (source-derived rows) or 'application-runtime' (companion runtime projections) if the rows carry no tenant dimension, or do not back this resource with introspection.`);
|
|
1366
1366
|
}
|
|
1367
1367
|
if (config.retentionPolicy) {
|
|
1368
1368
|
errors.push(`Resource '${resourceType}' is INTROSPECTION-backed and declares 'retentionPolicy' — nothing is stored, so there is nothing to retain or purge; remove the policy.`);
|