@wildo-ai/saas-models 1.0.1
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/__tests__/setup.d.ts +2 -0
- package/dist/esm/__tests__/setup.d.ts.map +1 -0
- package/dist/esm/__tests__/setup.js +4 -0
- package/dist/esm/__tests__/setup.js.map +1 -0
- package/dist/esm/applications/application-metadata.shared.resources-config.schemas.d.ts +17 -0
- package/dist/esm/applications/application-metadata.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/applications/application-metadata.shared.resources-config.schemas.js +91 -0
- package/dist/esm/applications/application-metadata.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/applications/application-versions.shared.resources-config.schemas.d.ts +24 -0
- package/dist/esm/applications/application-versions.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/applications/application-versions.shared.resources-config.schemas.js +200 -0
- package/dist/esm/applications/application-versions.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/applications/applications-context.schemas.d.ts +574 -0
- package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -0
- package/dist/esm/applications/applications-context.schemas.js +14 -0
- package/dist/esm/applications/applications-context.schemas.js.map +1 -0
- package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts +24 -0
- package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/applications/applications.shared.resources-config.schemas.js +268 -0
- package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/applications/applications.shared.schemas.d.ts +45 -0
- package/dist/esm/applications/applications.shared.schemas.d.ts.map +1 -0
- package/dist/esm/applications/applications.shared.schemas.js +48 -0
- package/dist/esm/applications/applications.shared.schemas.js.map +1 -0
- package/dist/esm/billing/billing-account.shared.resources-config.schemas.d.ts +45 -0
- package/dist/esm/billing/billing-account.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/billing-account.shared.resources-config.schemas.js +160 -0
- package/dist/esm/billing/billing-account.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/billing-account.shared.schemas.d.ts +78 -0
- package/dist/esm/billing/billing-account.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/billing-account.shared.schemas.js +87 -0
- package/dist/esm/billing/billing-account.shared.schemas.js.map +1 -0
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts +43 -0
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/billing-configuration.shared.schemas.js +100 -0
- package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -0
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts +173 -0
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/billing-enums.shared.schemas.js +199 -0
- package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -0
- package/dist/esm/billing/billing-types.shared.schemas.d.ts +81 -0
- package/dist/esm/billing/billing-types.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/billing-types.shared.schemas.js +10 -0
- package/dist/esm/billing/billing-types.shared.schemas.js.map +1 -0
- package/dist/esm/billing/credit-pool.shared.resources-config.schemas.d.ts +23 -0
- package/dist/esm/billing/credit-pool.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/credit-pool.shared.resources-config.schemas.js +111 -0
- package/dist/esm/billing/credit-pool.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/credit-pool.shared.schemas.d.ts +48 -0
- package/dist/esm/billing/credit-pool.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/credit-pool.shared.schemas.js +52 -0
- package/dist/esm/billing/credit-pool.shared.schemas.js.map +1 -0
- package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.d.ts +10 -0
- package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.js +86 -0
- package/dist/esm/billing/invoice-ref.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/invoice-ref.shared.schemas.d.ts +40 -0
- package/dist/esm/billing/invoice-ref.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/invoice-ref.shared.schemas.js +43 -0
- package/dist/esm/billing/invoice-ref.shared.schemas.js.map +1 -0
- package/dist/esm/billing/price.shared.resources-config.schemas.d.ts +30 -0
- package/dist/esm/billing/price.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/price.shared.resources-config.schemas.js +58 -0
- package/dist/esm/billing/price.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/price.shared.schemas.d.ts +50 -0
- package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/price.shared.schemas.js +72 -0
- package/dist/esm/billing/price.shared.schemas.js.map +1 -0
- package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts +67 -0
- package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js +84 -0
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -0
- package/dist/esm/billing/product-definition.shared.schemas.d.ts +111 -0
- package/dist/esm/billing/product-definition.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/product-definition.shared.schemas.js +97 -0
- package/dist/esm/billing/product-definition.shared.schemas.js.map +1 -0
- package/dist/esm/billing/product.shared.resources-config.schemas.d.ts +64 -0
- package/dist/esm/billing/product.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/product.shared.resources-config.schemas.js +73 -0
- package/dist/esm/billing/product.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/product.shared.schemas.d.ts +77 -0
- package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/product.shared.schemas.js +86 -0
- package/dist/esm/billing/product.shared.schemas.js.map +1 -0
- package/dist/esm/billing/promotions.shared.resources-config.schemas.d.ts +40 -0
- package/dist/esm/billing/promotions.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/promotions.shared.resources-config.schemas.js +105 -0
- package/dist/esm/billing/promotions.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/promotions.shared.schemas.d.ts +41 -0
- package/dist/esm/billing/promotions.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/promotions.shared.schemas.js +70 -0
- package/dist/esm/billing/promotions.shared.schemas.js.map +1 -0
- package/dist/esm/billing/referral.shared.resources-config.schemas.d.ts +43 -0
- package/dist/esm/billing/referral.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/referral.shared.resources-config.schemas.js +58 -0
- package/dist/esm/billing/referral.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/referral.shared.schemas.d.ts +70 -0
- package/dist/esm/billing/referral.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/referral.shared.schemas.js +75 -0
- package/dist/esm/billing/referral.shared.schemas.js.map +1 -0
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts +53 -0
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js +182 -0
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/subscription.shared.schemas.d.ts +109 -0
- package/dist/esm/billing/subscription.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/subscription.shared.schemas.js +92 -0
- package/dist/esm/billing/subscription.shared.schemas.js.map +1 -0
- package/dist/esm/billing/usage-record.shared.resources-config.schemas.d.ts +10 -0
- package/dist/esm/billing/usage-record.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/billing/usage-record.shared.resources-config.schemas.js +68 -0
- package/dist/esm/billing/usage-record.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/billing/usage-record.shared.schemas.d.ts +52 -0
- package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -0
- package/dist/esm/billing/usage-record.shared.schemas.js +49 -0
- package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -0
- package/dist/esm/charts/aggregation-query.shared.schemas.d.ts +185 -0
- package/dist/esm/charts/aggregation-query.shared.schemas.d.ts.map +1 -0
- package/dist/esm/charts/aggregation-query.shared.schemas.js +200 -0
- package/dist/esm/charts/aggregation-query.shared.schemas.js.map +1 -0
- package/dist/esm/charts/aggregation.shared.definitions.d.ts +80 -0
- package/dist/esm/charts/aggregation.shared.definitions.d.ts.map +1 -0
- package/dist/esm/charts/aggregation.shared.definitions.js +103 -0
- package/dist/esm/charts/aggregation.shared.definitions.js.map +1 -0
- package/dist/esm/charts/chart-definition-builder.shared.d.ts +212 -0
- package/dist/esm/charts/chart-definition-builder.shared.d.ts.map +1 -0
- package/dist/esm/charts/chart-definition-builder.shared.js +434 -0
- package/dist/esm/charts/chart-definition-builder.shared.js.map +1 -0
- package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.d.ts +43 -0
- package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.js +133 -0
- package/dist/esm/compliance/audit-trails/audit-logs.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts +951 -0
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js +643 -0
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -0
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts +69 -0
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js +163 -0
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -0
- package/dist/esm/compliance/compliance-framework/compliance-frameworks.shared.schemas.d.ts +37 -0
- package/dist/esm/compliance/compliance-framework/compliance-frameworks.shared.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/compliance-framework/compliance-frameworks.shared.schemas.js +38 -0
- package/dist/esm/compliance/compliance-framework/compliance-frameworks.shared.schemas.js.map +1 -0
- package/dist/esm/compliance/privacy/data-retention.shared.schemas.d.ts +8 -0
- package/dist/esm/compliance/privacy/data-retention.shared.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/privacy/data-retention.shared.schemas.js +7 -0
- package/dist/esm/compliance/privacy/data-retention.shared.schemas.js.map +1 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts +85 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js +60 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -0
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts +15 -0
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js +16 -0
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -0
- package/dist/esm/compliance/privacy/sharing.shared.schemas.d.ts +2 -0
- package/dist/esm/compliance/privacy/sharing.shared.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/privacy/sharing.shared.schemas.js +1 -0
- package/dist/esm/compliance/privacy/sharing.shared.schemas.js.map +1 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts +166 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.js +215 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -0
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts +472 -0
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/app-configuration-shared.shared.schemas.js +219 -0
- package/dist/esm/config/app-configuration-shared.shared.schemas.js.map +1 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts +28 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.js +211 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -0
- package/dist/esm/config/configuration-validation.shared.schemas.d.ts +38 -0
- package/dist/esm/config/configuration-validation.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/configuration-validation.shared.schemas.js +48 -0
- package/dist/esm/config/configuration-validation.shared.schemas.js.map +1 -0
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts +402 -0
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/entity-identity-config.shared.schemas.js +228 -0
- package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -0
- package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts +1612 -0
- package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/frontend/chart-definition.shared.schemas.js +998 -0
- package/dist/esm/config/frontend/chart-definition.shared.schemas.js.map +1 -0
- package/dist/esm/config/frontend/navigation.shared.schemas.d.ts +684 -0
- package/dist/esm/config/frontend/navigation.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/frontend/navigation.shared.schemas.js +678 -0
- package/dist/esm/config/frontend/navigation.shared.schemas.js.map +1 -0
- package/dist/esm/config/frontend/onboarding.shared.schemas.d.ts +618 -0
- package/dist/esm/config/frontend/onboarding.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/frontend/onboarding.shared.schemas.js +391 -0
- package/dist/esm/config/frontend/onboarding.shared.schemas.js.map +1 -0
- package/dist/esm/config/postgresql.shared.schemas.d.ts +29 -0
- package/dist/esm/config/postgresql.shared.schemas.d.ts.map +1 -0
- package/dist/esm/config/postgresql.shared.schemas.js +37 -0
- package/dist/esm/config/postgresql.shared.schemas.js.map +1 -0
- package/dist/esm/crdt/crdt-merge.shared.utils.d.ts +50 -0
- package/dist/esm/crdt/crdt-merge.shared.utils.d.ts.map +1 -0
- package/dist/esm/crdt/crdt-merge.shared.utils.js +120 -0
- package/dist/esm/crdt/crdt-merge.shared.utils.js.map +1 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts +230 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js +248 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -0
- package/dist/esm/errors/errors.shared.definitions.d.ts +27 -0
- package/dist/esm/errors/errors.shared.definitions.d.ts.map +1 -0
- package/dist/esm/errors/errors.shared.definitions.js +287 -0
- package/dist/esm/errors/errors.shared.definitions.js.map +1 -0
- package/dist/esm/errors/errors.shared.schemas.d.ts +424 -0
- package/dist/esm/errors/errors.shared.schemas.d.ts.map +1 -0
- package/dist/esm/errors/errors.shared.schemas.js +375 -0
- package/dist/esm/errors/errors.shared.schemas.js.map +1 -0
- package/dist/esm/errors/errors.shared.utils.d.ts +15 -0
- package/dist/esm/errors/errors.shared.utils.d.ts.map +1 -0
- package/dist/esm/errors/errors.shared.utils.js +23 -0
- package/dist/esm/errors/errors.shared.utils.js.map +1 -0
- package/dist/esm/external-providers/external-providers.shared.schemas.d.ts +248 -0
- package/dist/esm/external-providers/external-providers.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/external-providers.shared.schemas.js +70 -0
- package/dist/esm/external-providers/external-providers.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/feature-bindings-policy.shared.schemas.d.ts +27 -0
- package/dist/esm/external-providers/feature-bindings-policy.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/feature-bindings-policy.shared.schemas.js +35 -0
- package/dist/esm/external-providers/feature-bindings-policy.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/feature-mapping.shared.schemas.d.ts +80 -0
- package/dist/esm/external-providers/feature-mapping.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/feature-mapping.shared.schemas.js +159 -0
- package/dist/esm/external-providers/feature-mapping.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/wildo-features.shared.schemas.d.ts +102 -0
- package/dist/esm/external-providers/wildo-features.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/wildo-features.shared.schemas.js +124 -0
- package/dist/esm/external-providers/wildo-features.shared.schemas.js.map +1 -0
- package/dist/esm/features/core-feature-definitions.shared.d.ts +19 -0
- package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -0
- package/dist/esm/features/core-feature-definitions.shared.js +69 -0
- package/dist/esm/features/core-feature-definitions.shared.js.map +1 -0
- package/dist/esm/features/feature-builders.shared.d.ts +90 -0
- package/dist/esm/features/feature-builders.shared.d.ts.map +1 -0
- package/dist/esm/features/feature-builders.shared.js +107 -0
- package/dist/esm/features/feature-builders.shared.js.map +1 -0
- package/dist/esm/features/feature-definition.shared.schemas.d.ts +239 -0
- package/dist/esm/features/feature-definition.shared.schemas.d.ts.map +1 -0
- package/dist/esm/features/feature-definition.shared.schemas.js +280 -0
- package/dist/esm/features/feature-definition.shared.schemas.js.map +1 -0
- package/dist/esm/features/feature-registry.shared.d.ts +117 -0
- package/dist/esm/features/feature-registry.shared.d.ts.map +1 -0
- package/dist/esm/features/feature-registry.shared.js +176 -0
- package/dist/esm/features/feature-registry.shared.js.map +1 -0
- package/dist/esm/features/feature-resolution.shared.schemas.d.ts +54 -0
- package/dist/esm/features/feature-resolution.shared.schemas.d.ts.map +1 -0
- package/dist/esm/features/feature-resolution.shared.schemas.js +7 -0
- package/dist/esm/features/feature-resolution.shared.schemas.js.map +1 -0
- package/dist/esm/features/platform-capability-definitions.shared.d.ts +50 -0
- package/dist/esm/features/platform-capability-definitions.shared.d.ts.map +1 -0
- package/dist/esm/features/platform-capability-definitions.shared.js +30 -0
- package/dist/esm/features/platform-capability-definitions.shared.js.map +1 -0
- package/dist/esm/features/scope-features.shared.schemas.d.ts +45 -0
- package/dist/esm/features/scope-features.shared.schemas.d.ts.map +1 -0
- package/dist/esm/features/scope-features.shared.schemas.js +50 -0
- package/dist/esm/features/scope-features.shared.schemas.js.map +1 -0
- package/dist/esm/features/user-features.shared.resources-config.schemas.d.ts +21 -0
- package/dist/esm/features/user-features.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/features/user-features.shared.resources-config.schemas.js +65 -0
- package/dist/esm/features/user-features.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/files/files.shared.resources-config.schemas.d.ts +69 -0
- package/dist/esm/files/files.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/files/files.shared.resources-config.schemas.js +103 -0
- package/dist/esm/files/files.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/files/files.shared.schemas.d.ts +122 -0
- package/dist/esm/files/files.shared.schemas.d.ts.map +1 -0
- package/dist/esm/files/files.shared.schemas.js +234 -0
- package/dist/esm/files/files.shared.schemas.js.map +1 -0
- package/dist/esm/files/files.shared.utils.d.ts +46 -0
- package/dist/esm/files/files.shared.utils.d.ts.map +1 -0
- package/dist/esm/files/files.shared.utils.js +74 -0
- package/dist/esm/files/files.shared.utils.js.map +1 -0
- package/dist/esm/flows-actors/actors.shared.schemas.d.ts +847 -0
- package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/actors.shared.schemas.js +71 -0
- package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/agents-context.shared.schemas.d.ts +181 -0
- package/dist/esm/flows-actors/agents-context.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/agents-context.shared.schemas.js +116 -0
- package/dist/esm/flows-actors/agents-context.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts +181 -0
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/agents.shared.schemas.js +226 -0
- package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts +229 -0
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.js +319 -0
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/apps-blueprint/artifacts.apps-blueprint.shared.schemas.d.ts +236 -0
- package/dist/esm/flows-actors/apps-blueprint/artifacts.apps-blueprint.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/apps-blueprint/artifacts.apps-blueprint.shared.schemas.js +212 -0
- package/dist/esm/flows-actors/apps-blueprint/artifacts.apps-blueprint.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts +276 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js +206 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.d.ts +243 -0
- package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.js +88 -0
- package/dist/esm/flows-actors/flows-actors.configuration.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.d.ts +61 -0
- package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.js +54 -0
- package/dist/esm/flows-actors/flows-actors.frontend.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts +122 -0
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js +76 -0
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts +224 -0
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js +76 -0
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/flows.shared.schemas.d.ts +306 -0
- package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/flows.shared.schemas.js +148 -0
- package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/prompt-ir.shared.schemas.d.ts +60 -0
- package/dist/esm/flows-actors/prompt-ir.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/prompt-ir.shared.schemas.js +95 -0
- package/dist/esm/flows-actors/prompt-ir.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/tasks.actors.shared.schemas.d.ts +700 -0
- package/dist/esm/flows-actors/tasks.actors.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/tasks.actors.shared.schemas.js +164 -0
- package/dist/esm/flows-actors/tasks.actors.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/utils/flow-actors.context-builder.apps-context.shared.utils.d.ts +2 -0
- package/dist/esm/flows-actors/utils/flow-actors.context-builder.apps-context.shared.utils.d.ts.map +1 -0
- package/dist/esm/flows-actors/utils/flow-actors.context-builder.apps-context.shared.utils.js +1 -0
- package/dist/esm/flows-actors/utils/flow-actors.context-builder.apps-context.shared.utils.js.map +1 -0
- package/dist/esm/frontend-definitions/frontend-notification-custom-message-ref.definitions.d.ts +4 -0
- package/dist/esm/frontend-definitions/frontend-notification-custom-message-ref.definitions.d.ts.map +1 -0
- package/dist/esm/frontend-definitions/frontend-notification-custom-message-ref.definitions.js +5 -0
- package/dist/esm/frontend-definitions/frontend-notification-custom-message-ref.definitions.js.map +1 -0
- package/dist/esm/guidance/guidance-flow.shared.schemas.d.ts +287 -0
- package/dist/esm/guidance/guidance-flow.shared.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/guidance-flow.shared.schemas.js +105 -0
- package/dist/esm/guidance/guidance-flow.shared.schemas.js.map +1 -0
- package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.d.ts +43 -0
- package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.js +139 -0
- package/dist/esm/guidance/guidance-state.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/guidance/guidance-state.shared.schemas.d.ts +53 -0
- package/dist/esm/guidance/guidance-state.shared.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/guidance-state.shared.schemas.js +40 -0
- package/dist/esm/guidance/guidance-state.shared.schemas.js.map +1 -0
- package/dist/esm/guidance/lifecycle-config.shared.schemas.d.ts +89 -0
- package/dist/esm/guidance/lifecycle-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/lifecycle-config.shared.schemas.js +80 -0
- package/dist/esm/guidance/lifecycle-config.shared.schemas.js.map +1 -0
- package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.d.ts +47 -0
- package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.js +135 -0
- package/dist/esm/guidance/lifecycle-state.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/guidance/lifecycle-state.shared.schemas.d.ts +110 -0
- package/dist/esm/guidance/lifecycle-state.shared.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/lifecycle-state.shared.schemas.js +184 -0
- package/dist/esm/guidance/lifecycle-state.shared.schemas.js.map +1 -0
- package/dist/esm/guidance/milestone-builders.shared.d.ts +49 -0
- package/dist/esm/guidance/milestone-builders.shared.d.ts.map +1 -0
- package/dist/esm/guidance/milestone-builders.shared.js +47 -0
- package/dist/esm/guidance/milestone-builders.shared.js.map +1 -0
- package/dist/esm/guidance/milestone-definition.shared.schemas.d.ts +106 -0
- package/dist/esm/guidance/milestone-definition.shared.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/milestone-definition.shared.schemas.js +45 -0
- package/dist/esm/guidance/milestone-definition.shared.schemas.js.map +1 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts +37 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.js +135 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts +38 -0
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -0
- package/dist/esm/guidance/progression-state.shared.schemas.js +38 -0
- package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -0
- package/dist/esm/i18n/labelling.dto.shared.schemas.d.ts +26 -0
- package/dist/esm/i18n/labelling.dto.shared.schemas.d.ts.map +1 -0
- package/dist/esm/i18n/labelling.dto.shared.schemas.js +23 -0
- package/dist/esm/i18n/labelling.dto.shared.schemas.js.map +1 -0
- package/dist/esm/index.d.ts +201 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +227 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/monitoring/monitoring.shared.schemas.d.ts +128 -0
- package/dist/esm/monitoring/monitoring.shared.schemas.d.ts.map +1 -0
- package/dist/esm/monitoring/monitoring.shared.schemas.js +112 -0
- package/dist/esm/monitoring/monitoring.shared.schemas.js.map +1 -0
- package/dist/esm/notifications/email/email-context.shared.schemas.d.ts +139 -0
- package/dist/esm/notifications/email/email-context.shared.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/email/email-context.shared.schemas.js +290 -0
- package/dist/esm/notifications/email/email-context.shared.schemas.js.map +1 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.resources-config.schemas.d.ts +39 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.resources-config.schemas.js +113 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.schemas.d.ts +63 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.schemas.js +110 -0
- package/dist/esm/notifications/email/email-header-footer-template.shared.schemas.js.map +1 -0
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts +85 -0
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.js +328 -0
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -0
- package/dist/esm/notifications/email/email-template.shared.resources-config.schemas.d.ts +62 -0
- package/dist/esm/notifications/email/email-template.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/email/email-template.shared.resources-config.schemas.js +112 -0
- package/dist/esm/notifications/email/email-template.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/notifications/email/email-template.shared.schemas.d.ts +162 -0
- package/dist/esm/notifications/email/email-template.shared.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/email/email-template.shared.schemas.js +189 -0
- package/dist/esm/notifications/email/email-template.shared.schemas.js.map +1 -0
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts +3 -0
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -0
- package/dist/esm/notifications/notification-badges.core.definitions.js +13 -0
- package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -0
- package/dist/esm/notifications/notification-badges.schemas.d.ts +75 -0
- package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/notification-badges.schemas.js +52 -0
- package/dist/esm/notifications/notification-badges.schemas.js.map +1 -0
- package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.d.ts +22 -0
- package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.js +79 -0
- package/dist/esm/notifications/notification-badges.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/notifications/notifications.shared.schemas.d.ts +583 -0
- package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -0
- package/dist/esm/notifications/notifications.shared.schemas.js +196 -0
- package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-features.shared.resources-config.schemas.d.ts +27 -0
- package/dist/esm/organizations/organization-features.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-features.shared.resources-config.schemas.js +162 -0
- package/dist/esm/organizations/organization-features.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-features.shared.schemas.d.ts +23 -0
- package/dist/esm/organizations/organization-features.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-features.shared.schemas.js +25 -0
- package/dist/esm/organizations/organization-features.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-member-invitations.shared.resources-config.schemas.d.ts +37 -0
- package/dist/esm/organizations/organization-member-invitations.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-member-invitations.shared.resources-config.schemas.js +207 -0
- package/dist/esm/organizations/organization-member-invitations.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-members.shared.resources-config.schemas.d.ts +35 -0
- package/dist/esm/organizations/organization-members.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-members.shared.resources-config.schemas.js +278 -0
- package/dist/esm/organizations/organization-members.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-members.shared.schemas.d.ts +59 -0
- package/dist/esm/organizations/organization-members.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-members.shared.schemas.js +56 -0
- package/dist/esm/organizations/organization-members.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.d.ts +29 -0
- package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.js +68 -0
- package/dist/esm/organizations/organization-notifications.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts +26 -0
- package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-notifications.shared.schemas.js +28 -0
- package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.d.ts +29 -0
- package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.js +70 -0
- package/dist/esm/organizations/organization-preferences.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts +34 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.js +30 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.d.ts +52 -0
- package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.js +97 -0
- package/dist/esm/organizations/organization-profile.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts +73 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.js +71 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-units.shared.resources-config.schemas.d.ts +30 -0
- package/dist/esm/organizations/organization-units.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-units.shared.resources-config.schemas.js +196 -0
- package/dist/esm/organizations/organization-units.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organization-units.shared.schemas.d.ts +53 -0
- package/dist/esm/organizations/organization-units.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organization-units.shared.schemas.js +58 -0
- package/dist/esm/organizations/organization-units.shared.schemas.js.map +1 -0
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts +27 -0
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js +214 -0
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/organizations/organizations.shared.schemas.d.ts +138 -0
- package/dist/esm/organizations/organizations.shared.schemas.d.ts.map +1 -0
- package/dist/esm/organizations/organizations.shared.schemas.js +58 -0
- package/dist/esm/organizations/organizations.shared.schemas.js.map +1 -0
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts +64 -0
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js +290 -0
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/queue/jobs.shared.schemas.d.ts +337 -0
- package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -0
- package/dist/esm/queue/jobs.shared.schemas.js +367 -0
- package/dist/esm/queue/jobs.shared.schemas.js.map +1 -0
- package/dist/esm/queue/jobs.shared.utils.d.ts +253 -0
- package/dist/esm/queue/jobs.shared.utils.d.ts.map +1 -0
- package/dist/esm/queue/jobs.shared.utils.js +446 -0
- package/dist/esm/queue/jobs.shared.utils.js.map +1 -0
- package/dist/esm/queue/queues.shared.schemas.d.ts +203 -0
- package/dist/esm/queue/queues.shared.schemas.d.ts.map +1 -0
- package/dist/esm/queue/queues.shared.schemas.js +300 -0
- package/dist/esm/queue/queues.shared.schemas.js.map +1 -0
- package/dist/esm/queue/queues.shared.utils.d.ts +122 -0
- package/dist/esm/queue/queues.shared.utils.d.ts.map +1 -0
- package/dist/esm/queue/queues.shared.utils.js +212 -0
- package/dist/esm/queue/queues.shared.utils.js.map +1 -0
- package/dist/esm/queue/rabbitmq-queue-args.shared.d.ts +13 -0
- package/dist/esm/queue/rabbitmq-queue-args.shared.d.ts.map +1 -0
- package/dist/esm/queue/rabbitmq-queue-args.shared.js +13 -0
- package/dist/esm/queue/rabbitmq-queue-args.shared.js.map +1 -0
- package/dist/esm/requests/header-keys.shared.d.ts +52 -0
- package/dist/esm/requests/header-keys.shared.d.ts.map +1 -0
- package/dist/esm/requests/header-keys.shared.js +67 -0
- package/dist/esm/requests/header-keys.shared.js.map +1 -0
- package/dist/esm/requests/http-requests.shared.d.ts +37 -0
- package/dist/esm/requests/http-requests.shared.d.ts.map +1 -0
- package/dist/esm/requests/http-requests.shared.js +40 -0
- package/dist/esm/requests/http-requests.shared.js.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts +80 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-urls.js +172 -0
- package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -0
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts +44 -0
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -0
- package/dist/esm/requests/rate-limits.shared.schemas.js +38 -0
- package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -0
- package/dist/esm/requests/websocket.shared.schemas.d.ts +1113 -0
- package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -0
- package/dist/esm/requests/websocket.shared.schemas.js +682 -0
- package/dist/esm/requests/websocket.shared.schemas.js.map +1 -0
- package/dist/esm/resources/child-operations.shared.schemas.d.ts +236 -0
- package/dist/esm/resources/child-operations.shared.schemas.d.ts.map +1 -0
- package/dist/esm/resources/child-operations.shared.schemas.js +280 -0
- package/dist/esm/resources/child-operations.shared.schemas.js.map +1 -0
- package/dist/esm/resources/context-policy.shared.schemas.d.ts +159 -0
- package/dist/esm/resources/context-policy.shared.schemas.d.ts.map +1 -0
- package/dist/esm/resources/context-policy.shared.schemas.js +69 -0
- package/dist/esm/resources/context-policy.shared.schemas.js.map +1 -0
- package/dist/esm/resources/relationship-display.shared.schemas.d.ts +1487 -0
- package/dist/esm/resources/relationship-display.shared.schemas.d.ts.map +1 -0
- package/dist/esm/resources/relationship-display.shared.schemas.js +383 -0
- package/dist/esm/resources/relationship-display.shared.schemas.js.map +1 -0
- package/dist/esm/resources/resources-config.shared.factory.d.ts +31 -0
- package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -0
- package/dist/esm/resources/resources-config.shared.factory.js +1536 -0
- package/dist/esm/resources/resources-config.shared.factory.js.map +1 -0
- package/dist/esm/resources/resources-config.shared.schemas.d.ts +767 -0
- package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/resources/resources-config.shared.schemas.js +127 -0
- package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -0
- package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts +6 -0
- package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -0
- package/dist/esm/resources/resources-registry.shared.core.definitions.js +691 -0
- package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -0
- package/dist/esm/resources/resources-relationships.shared.factory.d.ts +155 -0
- package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -0
- package/dist/esm/resources/resources-relationships.shared.factory.js +256 -0
- package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -0
- package/dist/esm/resources/resources-serialization.shared.schemas.d.ts +254 -0
- package/dist/esm/resources/resources-serialization.shared.schemas.d.ts.map +1 -0
- package/dist/esm/resources/resources-serialization.shared.schemas.js +53 -0
- package/dist/esm/resources/resources-serialization.shared.schemas.js.map +1 -0
- package/dist/esm/resources/resources.shared.core.definitions.d.ts +142 -0
- package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -0
- package/dist/esm/resources/resources.shared.core.definitions.js +290 -0
- package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -0
- package/dist/esm/resources/resources.shared.schemas.d.ts +1302 -0
- package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -0
- package/dist/esm/resources/resources.shared.schemas.js +717 -0
- package/dist/esm/resources/resources.shared.schemas.js.map +1 -0
- package/dist/esm/resources/resources.shared.utils.d.ts +364 -0
- package/dist/esm/resources/resources.shared.utils.d.ts.map +1 -0
- package/dist/esm/resources/resources.shared.utils.js +752 -0
- package/dist/esm/resources/resources.shared.utils.js.map +1 -0
- package/dist/esm/resources/testing/SchemaDecoratorTestUtils.d.ts +91 -0
- package/dist/esm/resources/testing/SchemaDecoratorTestUtils.d.ts.map +1 -0
- package/dist/esm/resources/testing/SchemaDecoratorTestUtils.js +325 -0
- package/dist/esm/resources/testing/SchemaDecoratorTestUtils.js.map +1 -0
- package/dist/esm/resources/utils/repository-dto-builder.utils.d.ts +79 -0
- package/dist/esm/resources/utils/repository-dto-builder.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/repository-dto-builder.utils.js +157 -0
- package/dist/esm/resources/utils/repository-dto-builder.utils.js.map +1 -0
- package/dist/esm/resources/utils/resource-operation-type-guards.utils.d.ts +47 -0
- package/dist/esm/resources/utils/resource-operation-type-guards.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resource-operation-type-guards.utils.js +46 -0
- package/dist/esm/resources/utils/resource-operation-type-guards.utils.js.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.factory.d.ts +130 -0
- package/dist/esm/resources/utils/resource-polymorphism.factory.d.ts.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.factory.js +133 -0
- package/dist/esm/resources/utils/resource-polymorphism.factory.js.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.relationships.d.ts +122 -0
- package/dist/esm/resources/utils/resource-polymorphism.relationships.d.ts.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.relationships.js +131 -0
- package/dist/esm/resources/utils/resource-polymorphism.relationships.js.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.schemas.d.ts +128 -0
- package/dist/esm/resources/utils/resource-polymorphism.schemas.d.ts.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.schemas.js +267 -0
- package/dist/esm/resources/utils/resource-polymorphism.schemas.js.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.utils.d.ts +120 -0
- package/dist/esm/resources/utils/resource-polymorphism.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resource-polymorphism.utils.js +122 -0
- package/dist/esm/resources/utils/resource-polymorphism.utils.js.map +1 -0
- package/dist/esm/resources/utils/resource-subtree.utils.d.ts +26 -0
- package/dist/esm/resources/utils/resource-subtree.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resource-subtree.utils.js +75 -0
- package/dist/esm/resources/utils/resource-subtree.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-config-context-needs.utils.d.ts +29 -0
- package/dist/esm/resources/utils/resources-config-context-needs.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-config-context-needs.utils.js +47 -0
- package/dist/esm/resources/utils/resources-config-context-needs.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-config-naming.utils.d.ts +149 -0
- package/dist/esm/resources/utils/resources-config-naming.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-config-naming.utils.js +391 -0
- package/dist/esm/resources/utils/resources-config-naming.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.d.ts +381 -0
- package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.js +2180 -0
- package/dist/esm/resources/utils/resources-config-operations.dtos-builder.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.path.utils.d.ts +65 -0
- package/dist/esm/resources/utils/resources-config-operations.path.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.path.utils.js +250 -0
- package/dist/esm/resources/utils/resources-config-operations.path.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.d.ts +258 -0
- package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.js +693 -0
- package/dist/esm/resources/utils/resources-config-operations.urls-builder.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.utils.d.ts +40 -0
- package/dist/esm/resources/utils/resources-config-operations.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-config-operations.utils.js +78 -0
- package/dist/esm/resources/utils/resources-config-operations.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-serialization.utils.d.ts +75 -0
- package/dist/esm/resources/utils/resources-serialization.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-serialization.utils.js +92 -0
- package/dist/esm/resources/utils/resources-serialization.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-summary.utils.d.ts +81 -0
- package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/resources-summary.utils.js +183 -0
- package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -0
- package/dist/esm/resources/utils/schema-family-builder.utils.d.ts +97 -0
- package/dist/esm/resources/utils/schema-family-builder.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/schema-family-builder.utils.js +202 -0
- package/dist/esm/resources/utils/schema-family-builder.utils.js.map +1 -0
- package/dist/esm/resources/utils/schema-type-inference.utils.d.ts +26 -0
- package/dist/esm/resources/utils/schema-type-inference.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/schema-type-inference.utils.js +10 -0
- package/dist/esm/resources/utils/schema-type-inference.utils.js.map +1 -0
- package/dist/esm/resources/utils/schema-type-utils.d.ts +56 -0
- package/dist/esm/resources/utils/schema-type-utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/schema-type-utils.js +81 -0
- package/dist/esm/resources/utils/schema-type-utils.js.map +1 -0
- package/dist/esm/resources/utils/schema-variant-resolver.utils.d.ts +49 -0
- package/dist/esm/resources/utils/schema-variant-resolver.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/schema-variant-resolver.utils.js +99 -0
- package/dist/esm/resources/utils/schema-variant-resolver.utils.js.map +1 -0
- package/dist/esm/runtime/companion-artifact-placement.shared.definitions.d.ts +31 -0
- package/dist/esm/runtime/companion-artifact-placement.shared.definitions.d.ts.map +1 -0
- package/dist/esm/runtime/companion-artifact-placement.shared.definitions.js +8 -0
- package/dist/esm/runtime/companion-artifact-placement.shared.definitions.js.map +1 -0
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts +43 -0
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -0
- package/dist/esm/runtime/domain-module.shared.definitions.js +77 -0
- package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -0
- package/dist/esm/runtime/execution-context.shared.schemas.d.ts +77 -0
- package/dist/esm/runtime/execution-context.shared.schemas.d.ts.map +1 -0
- package/dist/esm/runtime/execution-context.shared.schemas.js +87 -0
- package/dist/esm/runtime/execution-context.shared.schemas.js.map +1 -0
- package/dist/esm/runtime/runtime.shared.schemas.d.ts +19 -0
- package/dist/esm/runtime/runtime.shared.schemas.d.ts.map +1 -0
- package/dist/esm/runtime/runtime.shared.schemas.js +20 -0
- package/dist/esm/runtime/runtime.shared.schemas.js.map +1 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts +37 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js +235 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts +37 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js +364 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/api-keys/api-keys.shared.schemas.d.ts +113 -0
- package/dist/esm/security/api-keys/api-keys.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/api-keys/api-keys.shared.schemas.js +65 -0
- package/dist/esm/security/api-keys/api-keys.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts +623 -0
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js +421 -0
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -0
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts +140 -0
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/authentication.shared.schemas.js +195 -0
- package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/authentication.shared.utils.d.ts +67 -0
- package/dist/esm/security/authentications/authentication.shared.utils.d.ts.map +1 -0
- package/dist/esm/security/authentications/authentication.shared.utils.js +126 -0
- package/dist/esm/security/authentications/authentication.shared.utils.js.map +1 -0
- package/dist/esm/security/authentications/consumable-token.shared.schemas.d.ts +146 -0
- package/dist/esm/security/authentications/consumable-token.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/consumable-token.shared.schemas.js +59 -0
- package/dist/esm/security/authentications/consumable-token.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/password-reset.shared.dto.schemas.d.ts +39 -0
- package/dist/esm/security/authentications/password-reset.shared.dto.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/password-reset.shared.dto.schemas.js +42 -0
- package/dist/esm/security/authentications/password-reset.shared.dto.schemas.js.map +1 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.resources-config.schemas.d.ts +10 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.resources-config.schemas.js +52 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.schemas.d.ts +52 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.schemas.js +40 -0
- package/dist/esm/security/authentications/policy/auth-policy.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts +85 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js +90 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.d.ts +17 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.js +90 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts +51 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js +38 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.d.ts +25 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.js +127 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.d.ts +36 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.js +33 -0
- package/dist/esm/security/authentications/scim/scim-tokens.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.d.ts +21 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.js +123 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.d.ts +49 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.js +37 -0
- package/dist/esm/security/authentications/siem/siem-delivery-dlq.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.d.ts +17 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.js +90 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.d.ts +125 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.js +76 -0
- package/dist/esm/security/authentications/siem/siem-export-config.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts +25 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js +111 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts +160 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js +113 -0
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.d.ts +22 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.js +123 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts +274 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js +143 -0
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -0
- package/dist/esm/security/authorizations/roles.shared.defaults.d.ts +10 -0
- package/dist/esm/security/authorizations/roles.shared.defaults.d.ts.map +1 -0
- package/dist/esm/security/authorizations/roles.shared.defaults.js +76 -0
- package/dist/esm/security/authorizations/roles.shared.defaults.js.map +1 -0
- package/dist/esm/security/authorizations/roles.shared.schemas.d.ts +43 -0
- package/dist/esm/security/authorizations/roles.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/authorizations/roles.shared.schemas.js +58 -0
- package/dist/esm/security/authorizations/roles.shared.schemas.js.map +1 -0
- package/dist/esm/security/crypto-keys/crypto-keys.shared.schemas.d.ts +6 -0
- package/dist/esm/security/crypto-keys/crypto-keys.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/crypto-keys/crypto-keys.shared.schemas.js +7 -0
- package/dist/esm/security/crypto-keys/crypto-keys.shared.schemas.js.map +1 -0
- package/dist/esm/testing/resource-config-builders.d.ts +33 -0
- package/dist/esm/testing/resource-config-builders.d.ts.map +1 -0
- package/dist/esm/testing/resource-config-builders.js +240 -0
- package/dist/esm/testing/resource-config-builders.js.map +1 -0
- package/dist/esm/testing/schema-decorator-utils.d.ts +91 -0
- package/dist/esm/testing/schema-decorator-utils.d.ts.map +1 -0
- package/dist/esm/testing/schema-decorator-utils.js +325 -0
- package/dist/esm/testing/schema-decorator-utils.js.map +1 -0
- package/dist/esm/testing.d.ts +6 -0
- package/dist/esm/testing.d.ts.map +1 -0
- package/dist/esm/testing.js +6 -0
- package/dist/esm/testing.js.map +1 -0
- package/dist/esm/users/anonymous-users.shared.resources-config.schemas.d.ts +27 -0
- package/dist/esm/users/anonymous-users.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/anonymous-users.shared.resources-config.schemas.js +79 -0
- package/dist/esm/users/anonymous-users.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/anonymous-users.shared.schema.d.ts +28 -0
- package/dist/esm/users/anonymous-users.shared.schema.d.ts.map +1 -0
- package/dist/esm/users/anonymous-users.shared.schema.js +21 -0
- package/dist/esm/users/anonymous-users.shared.schema.js.map +1 -0
- package/dist/esm/users/inbound-contacts.shared.schemas.d.ts +23 -0
- package/dist/esm/users/inbound-contacts.shared.schemas.d.ts.map +1 -0
- package/dist/esm/users/inbound-contacts.shared.schemas.js +15 -0
- package/dist/esm/users/inbound-contacts.shared.schemas.js.map +1 -0
- package/dist/esm/users/user-credentials.shared.resources-config.schemas.d.ts +41 -0
- package/dist/esm/users/user-credentials.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-credentials.shared.resources-config.schemas.js +81 -0
- package/dist/esm/users/user-credentials.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/user-credentials.shared.schemas.d.ts +63 -0
- package/dist/esm/users/user-credentials.shared.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-credentials.shared.schemas.js +62 -0
- package/dist/esm/users/user-credentials.shared.schemas.js.map +1 -0
- package/dist/esm/users/user-identity-links.shared.resources-config.schemas.d.ts +29 -0
- package/dist/esm/users/user-identity-links.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-identity-links.shared.resources-config.schemas.js +82 -0
- package/dist/esm/users/user-identity-links.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/user-identity-links.shared.schemas.d.ts +37 -0
- package/dist/esm/users/user-identity-links.shared.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-identity-links.shared.schemas.js +50 -0
- package/dist/esm/users/user-identity-links.shared.schemas.js.map +1 -0
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts +70 -0
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.js +278 -0
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/user-profiles.shared.resources-config.schemas.d.ts +29 -0
- package/dist/esm/users/user-profiles.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-profiles.shared.resources-config.schemas.js +246 -0
- package/dist/esm/users/user-profiles.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts +71 -0
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.js +253 -0
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.js +195 -0
- package/dist/esm/users/user-self-profiles.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts +32 -0
- package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/user-self.shared.resources-config.schemas.js +232 -0
- package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts +34 -0
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/users/users.shared.resources-config.schemas.js +414 -0
- package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/users/users.shared.schemas.d.ts +199 -0
- package/dist/esm/users/users.shared.schemas.d.ts.map +1 -0
- package/dist/esm/users/users.shared.schemas.js +84 -0
- package/dist/esm/users/users.shared.schemas.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +199 -0
|
@@ -0,0 +1,2180 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { CoreResourceOperation } from '../resources.shared.core.definitions.js';
|
|
3
|
+
import { Resouces_BulkOperationBaseSchema, DataMode, OPERATION_VARIANT_KEY, Resouces_PaginationResponseMetadataSchema, getChildDirectionRelationships, getParentDirectionRelationships } from '../resources-config.shared.schemas.js';
|
|
4
|
+
import { ResourceRelationshipCardinality, isOneToOneCardinality, isArrayCardinality, getDefaultResponseSchemaForOperation, operationShouldHaveRequestDto, DefaultBulkDeleteResponseSchema } from '../resources.shared.schemas.js';
|
|
5
|
+
import { Resources_SharedUtils } from '../resources.shared.utils.js';
|
|
6
|
+
import { getCustomFieldMetadata, ZodDecorator, getZodType, hasZodType, isZodObject, isZodArray, isZodOptional, isZodDefault, getZodObjectShape, getZodDefSchemaProperty, getZodDefArrayProperty, getZodDefStringProperty, getZodDefProperty, isZodTypeAny, getEnumValues, isExcludedFromCreate, isExcludedFromUpdate, isVirtualField, isPrimaryKey, isBackendOnlyField, getBackendOnlyParams, isDiscriminatorField, unwrapSchema } from '@wildo-ai/zod-decorators';
|
|
7
|
+
import { ResourcesSummaryUtils } from './resources-summary.utils.js';
|
|
8
|
+
import { RepositoryDtoBuilderUtils } from './repository-dto-builder.utils.js';
|
|
9
|
+
/**
|
|
10
|
+
* Type guard to check if schema is a ZodAny
|
|
11
|
+
* In Zod v4, any schemas have type: "any"
|
|
12
|
+
*/
|
|
13
|
+
function isZodAny(schema) {
|
|
14
|
+
return hasZodType(schema, 'any');
|
|
15
|
+
}
|
|
16
|
+
export class ResourcesConfigOperationsDtosBuilderUtils {
|
|
17
|
+
/**
|
|
18
|
+
* Rebuild an object schema, optionally preserving schema-level checks.
|
|
19
|
+
*
|
|
20
|
+
* DTO derivation frequently needs to rebuild object shapes for omission,
|
|
21
|
+
* backend-only stripping, and date coercion. In Zod 4 those rebuilds would
|
|
22
|
+
* otherwise discard `.refine()` / `.superRefine()` checks. Preserve them when
|
|
23
|
+
* the field set stays semantically equivalent; skip them when fields were
|
|
24
|
+
* omitted because the original cross-field logic may no longer be valid.
|
|
25
|
+
*/
|
|
26
|
+
static rebuildObjectSchema(schema, rebuiltShape, options) {
|
|
27
|
+
let rebuiltSchema = z.object(rebuiltShape);
|
|
28
|
+
if (options?.preserveChecks === false) {
|
|
29
|
+
return rebuiltSchema;
|
|
30
|
+
}
|
|
31
|
+
const checks = getZodDefArrayProperty(schema, 'checks');
|
|
32
|
+
for (const check of checks ?? []) {
|
|
33
|
+
rebuiltSchema = rebuiltSchema.check(check);
|
|
34
|
+
}
|
|
35
|
+
return rebuiltSchema;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Omit fields from an object schema while staying compatible with Zod 4
|
|
39
|
+
* refined objects.
|
|
40
|
+
*
|
|
41
|
+
* Zod 4 throws when `.omit()` is used on object schemas that already carry
|
|
42
|
+
* schema-level checks (`.refine()` / `.superRefine()`). DTO derivation must
|
|
43
|
+
* still be able to remove transport-managed fields from those schemas, so we
|
|
44
|
+
* fall back to rebuilding the object shape and reapplying the existing checks.
|
|
45
|
+
*/
|
|
46
|
+
static omitObjectFields(schema, omitObj) {
|
|
47
|
+
if (Object.keys(omitObj).length === 0) {
|
|
48
|
+
return schema;
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
return schema.omit(omitObj);
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
if (!(error instanceof Error) || !error.message.includes('containing refinements')) {
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
const originalShape = getZodObjectShape(schema);
|
|
58
|
+
const rebuiltShape = {};
|
|
59
|
+
for (const [fieldName, fieldSchema] of Object.entries(originalShape)) {
|
|
60
|
+
if (!omitObj[fieldName]) {
|
|
61
|
+
rebuiltShape[fieldName] = fieldSchema;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return this.rebuildObjectSchema(schema, rebuiltShape, {
|
|
65
|
+
preserveChecks: false,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Rebuild all operation DTOs once the full registry is available.
|
|
71
|
+
*
|
|
72
|
+
* Resource factories only know about their own config at declaration time, so
|
|
73
|
+
* nested child DTOs cannot be fully derived there. Registry startup is the
|
|
74
|
+
* authoritative compilation boundary for operation DTOs.
|
|
75
|
+
*/
|
|
76
|
+
static rebuildResourceConfigurationsOperationDtos(resourceConfigurations) {
|
|
77
|
+
const resourceRegistry = new Map(Object.entries(resourceConfigurations));
|
|
78
|
+
for (const config of Object.values(resourceConfigurations)) {
|
|
79
|
+
config.operations = config.operations.map((operation) => this.buildAllOperationDtos(operation, config, resourceRegistry));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Build all DTO variants for an operation.
|
|
84
|
+
* This is the main entry point called by the factory.
|
|
85
|
+
*
|
|
86
|
+
* @param operation - Operation configuration
|
|
87
|
+
* @param resourceConfig - Full resource configuration (for inheritance reference)
|
|
88
|
+
* @param registry - Resource registry
|
|
89
|
+
* @returns Operation with all DTOs pre-computed and stored
|
|
90
|
+
*/
|
|
91
|
+
static buildAllOperationDtos(operation, resourceConfig, registry) {
|
|
92
|
+
// 1. Apply inheritance to mainSchema (from resourceConfig.inheritenceSchemaDefinition)
|
|
93
|
+
const inheritenceSchemaDefinition = resourceConfig.inheritenceSchemaDefinition;
|
|
94
|
+
const enhancedMainSchema = (inheritenceSchemaDefinition
|
|
95
|
+
? this.applyInheritanceToSchema(operation.mainSchema, inheritenceSchemaDefinition, new Map())
|
|
96
|
+
: operation.mainSchema);
|
|
97
|
+
// Determine the effective operation identifier for DTO building
|
|
98
|
+
const effectiveOperation = operation.resourceOperationLike || operation.operationIdentifier;
|
|
99
|
+
// IMPORTANT: Temporary DTOs from factory are built from mainSchema WITHOUT inheritance.
|
|
100
|
+
// buildEnhancedRequestDto/buildEnhancedResponseDto check for existing DTOs first and
|
|
101
|
+
// return them if meaningful (line 330, 388), which would skip inheritance application.
|
|
102
|
+
//
|
|
103
|
+
// Strategy: Store original DTOs to detect custom ones, then clear temporary DTOs to force
|
|
104
|
+
// rebuild from enhancedMainSchema (with inheritance). Custom DTOs will be preserved and
|
|
105
|
+
// only have transformations applied (date coercion), while auto-derived DTOs will be
|
|
106
|
+
// rebuilt with inheritance and transformations.
|
|
107
|
+
//
|
|
108
|
+
// Custom DTOs are detected by comparing the rebuilt DTO structure to the original.
|
|
109
|
+
// If they're significantly different, we preserve the original (it's custom).
|
|
110
|
+
// Otherwise, we use the rebuilt one (with inheritance).
|
|
111
|
+
const originalRequestDto = operation.requestDto;
|
|
112
|
+
const originalResponseDto = operation.responseDto;
|
|
113
|
+
const operationWithEnhancedSchema = {
|
|
114
|
+
...operation,
|
|
115
|
+
mainSchema: enhancedMainSchema,
|
|
116
|
+
requestDto: undefined, // Clear to force rebuild with inheritance
|
|
117
|
+
responseDto: undefined // Clear to force rebuild with inheritance
|
|
118
|
+
};
|
|
119
|
+
// 2. Build requestDto:
|
|
120
|
+
// - Rebuild from enhancedMainSchema (with inheritance applied)
|
|
121
|
+
// - If original was explicitly provided (custom), preserve it but apply transformations
|
|
122
|
+
// - Otherwise use rebuilt DTO (with inheritance)
|
|
123
|
+
// - Apply date coercion
|
|
124
|
+
// - Backend-only fields already excluded in buildEnhancedRequestDto
|
|
125
|
+
let requestDto = this.buildEnhancedRequestDto(operationWithEnhancedSchema, effectiveOperation);
|
|
126
|
+
// Check if original DTO was explicitly provided (custom DTO from variantParams.requestDto)
|
|
127
|
+
// Custom DTOs are complete schemas that should be preserved as-is, but still need
|
|
128
|
+
// transformations (date coercion). We detect custom DTOs by checking if they're
|
|
129
|
+
// significantly different from what would be auto-derived, OR if they're the same
|
|
130
|
+
// structure but the user explicitly provided them (we can't distinguish this easily,
|
|
131
|
+
// so we use a heuristic: if different, preserve; if same, use rebuilt with inheritance).
|
|
132
|
+
const rebuiltRequestInfo = this.analyzeDtoSchema(requestDto);
|
|
133
|
+
const originalRequestInfo = originalRequestDto ? this.analyzeDtoSchema(originalRequestDto) : null;
|
|
134
|
+
// If original exists and is significantly different from rebuilt, it's likely custom
|
|
135
|
+
// Preserve it but apply transformations (date coercion)
|
|
136
|
+
// Note: Custom DTOs are complete schemas that don't need inheritance - they're provided
|
|
137
|
+
// as-is by the user. However, they still need date coercion for API communication.
|
|
138
|
+
if (originalRequestDto && originalRequestInfo &&
|
|
139
|
+
originalRequestInfo !== rebuiltRequestInfo &&
|
|
140
|
+
originalRequestInfo !== '📄 {} (empty object)' &&
|
|
141
|
+
!isZodAny(originalRequestDto)) {
|
|
142
|
+
// Custom DTO: preserve structure but apply date coercion
|
|
143
|
+
requestDto = this.applyDateCoercion(originalRequestDto);
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
// Auto-derived DTO: use rebuilt (with inheritance) and apply transformations
|
|
147
|
+
requestDto = this.applyDateCoercion(requestDto);
|
|
148
|
+
}
|
|
149
|
+
// 3. Build responseDto first (repositoryDto depends on it)
|
|
150
|
+
// - Rebuild from enhancedMainSchema (with inheritance applied)
|
|
151
|
+
// - If original was custom (significantly different), preserve it but apply transformations
|
|
152
|
+
// - Otherwise use rebuilt DTO (with inheritance)
|
|
153
|
+
// - Strip backend-only fields (except isReturnedAtCreation for CREATE)
|
|
154
|
+
// - Apply date coercion
|
|
155
|
+
// - Exclude virtual fields (they're computed, not stored)
|
|
156
|
+
let responseDtoInternal = this.buildEnhancedResponseDto(operationWithEnhancedSchema, effectiveOperation);
|
|
157
|
+
let responseDto = responseDtoInternal;
|
|
158
|
+
// Check if original DTO was explicitly provided (custom DTO from customResponseDto)
|
|
159
|
+
// Custom DTOs are complete schemas that should be preserved as-is, but still need
|
|
160
|
+
// transformations (backend-only stripping, date coercion).
|
|
161
|
+
const hasExplicitCustomResponseDto = operation.hasCustomResponseDto === true;
|
|
162
|
+
const rebuiltResponseInfo = this.analyzeDtoSchema(responseDtoInternal);
|
|
163
|
+
const originalResponseInfo = originalResponseDto ? this.analyzeDtoSchema(originalResponseDto) : null;
|
|
164
|
+
// If hasCustomResponseDto flag is set, always preserve the original (skip heuristic).
|
|
165
|
+
// Otherwise, fall back to analyzeDtoSchema heuristic for backward compatibility.
|
|
166
|
+
const isCustomResponseDto = hasExplicitCustomResponseDto
|
|
167
|
+
? (originalResponseDto && !isZodAny(originalResponseDto))
|
|
168
|
+
: (originalResponseDto && originalResponseInfo &&
|
|
169
|
+
originalResponseInfo !== rebuiltResponseInfo &&
|
|
170
|
+
originalResponseInfo !== '📄 {} (empty object)' &&
|
|
171
|
+
!isZodAny(originalResponseDto));
|
|
172
|
+
if (isCustomResponseDto && originalResponseDto) {
|
|
173
|
+
// Custom DTO: preserve structure but apply transformations
|
|
174
|
+
// Still need to strip backend-only fields and apply date coercion
|
|
175
|
+
const isCreateOperation = effectiveOperation === CoreResourceOperation.CREATE ||
|
|
176
|
+
effectiveOperation === CoreResourceOperation.CREATE_MANY;
|
|
177
|
+
responseDtoInternal = this.applyDateCoercion(originalResponseDto);
|
|
178
|
+
responseDto = this.stripBackendOnlyFields(responseDtoInternal, {
|
|
179
|
+
respectIsReturnedAtCreation: isCreateOperation,
|
|
180
|
+
operationType: isCreateOperation ? CoreResourceOperation.CREATE : undefined
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
// Auto-derived DTO: use rebuilt (with inheritance) and apply transformations
|
|
185
|
+
// Strip backend-only fields (respect isReturnedAtCreation for CREATE)
|
|
186
|
+
const isCreateOperation = effectiveOperation === CoreResourceOperation.CREATE ||
|
|
187
|
+
effectiveOperation === CoreResourceOperation.CREATE_MANY;
|
|
188
|
+
responseDtoInternal = this.applyDateCoercion(responseDtoInternal);
|
|
189
|
+
responseDto = this.stripBackendOnlyFields(responseDtoInternal, {
|
|
190
|
+
respectIsReturnedAtCreation: isCreateOperation,
|
|
191
|
+
operationType: isCreateOperation ? CoreResourceOperation.CREATE : undefined
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
// Note: Virtual fields are already excluded in buildEnhancedResponseDto
|
|
195
|
+
// 4. Add nested operations DTOs if configured (child + self relationships)
|
|
196
|
+
const resourceRelationships = operation.resourceRelationships;
|
|
197
|
+
const childDirRels = resourceRelationships ? getChildDirectionRelationships(resourceRelationships) : [];
|
|
198
|
+
if (childDirRels.length > 0) {
|
|
199
|
+
// Build request DTO with nested children for create/update operations,
|
|
200
|
+
// including bulk variants. Runtime bulk orchestration is handled in the
|
|
201
|
+
// services layer by applying the same nested-processing principles per
|
|
202
|
+
// parent result.
|
|
203
|
+
if (effectiveOperation === CoreResourceOperation.CREATE || effectiveOperation === CoreResourceOperation.CREATE_MANY ||
|
|
204
|
+
effectiveOperation === CoreResourceOperation.UPDATE || effectiveOperation === CoreResourceOperation.UPDATE_MANY) {
|
|
205
|
+
requestDto = this.buildRequestDtoWithNested(effectiveOperation, requestDto, childDirRels, registry);
|
|
206
|
+
}
|
|
207
|
+
// Build response DTO with nested children (for READ)
|
|
208
|
+
if (effectiveOperation === CoreResourceOperation.READ) {
|
|
209
|
+
responseDtoInternal = this.buildResponseDtoWithNested(responseDtoInternal, childDirRels, registry);
|
|
210
|
+
responseDto = this.buildResponseDtoWithNested(responseDto, childDirRels, registry);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
// 5. Build summaryDto (WITH backend-only fields for internal processing):
|
|
214
|
+
// - Extract summary fields (isSummaryField)
|
|
215
|
+
// - If no summary fields defined, fall back to mainSchema (same as RAW)
|
|
216
|
+
// - DO NOT strip backend-only fields yet (needed for repositoryDto)
|
|
217
|
+
// - Apply date coercion (already applied in extractSummaryFields)
|
|
218
|
+
// - Handle discriminated unions
|
|
219
|
+
let summaryDtoInternal = this.extractSummaryFields(enhancedMainSchema);
|
|
220
|
+
// If no summary fields are defined, use full schema (same as RAW mode)
|
|
221
|
+
// Check if summaryDtoInternal is empty (z.object({}))
|
|
222
|
+
if (isZodObject(summaryDtoInternal)) {
|
|
223
|
+
const summaryShape = getZodObjectShape(summaryDtoInternal);
|
|
224
|
+
if (Object.keys(summaryShape).length === 0) {
|
|
225
|
+
// No summary fields defined - use full mainSchema as fallback
|
|
226
|
+
// This ensures SUMMARY mode works even without explicit isSummaryField decorators
|
|
227
|
+
summaryDtoInternal = this.excludeVirtualFieldsFromSchema(enhancedMainSchema);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
// Build stripped version for frontend (summaryDto)
|
|
231
|
+
const summaryDto = this.stripBackendOnlyFields(summaryDtoInternal);
|
|
232
|
+
// Note: Date coercion is already applied in extractSummaryFields
|
|
233
|
+
// 6. Build contextDto:
|
|
234
|
+
// - Start with responseDto
|
|
235
|
+
// - Add relationship placeholders
|
|
236
|
+
// - Date coercion already applied to responseDto
|
|
237
|
+
const contextDto = this.addRelationshipPlaceholders(responseDto, operation.resourceRelationships, registry);
|
|
238
|
+
// 7. Build internalDto base (before variant overrides):
|
|
239
|
+
// - Start with mainSchema (with inheritance)
|
|
240
|
+
// - Include backend-only fields (DO NOT strip)
|
|
241
|
+
// - Exclude virtual fields (they're computed)
|
|
242
|
+
let internalDtoProcessed = effectiveOperation === CoreResourceOperation.READ
|
|
243
|
+
? responseDtoInternal
|
|
244
|
+
: enhancedMainSchema;
|
|
245
|
+
// Exclude virtual fields from internalDto
|
|
246
|
+
if (isZodObject(internalDtoProcessed)) {
|
|
247
|
+
const shape = getZodObjectShape(internalDtoProcessed);
|
|
248
|
+
const omitObj = {};
|
|
249
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
250
|
+
if (isVirtualField(fieldSchema)) {
|
|
251
|
+
omitObj[fieldName] = true;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (Object.keys(omitObj).length > 0) {
|
|
255
|
+
internalDtoProcessed = this.omitObjectFields(internalDtoProcessed, omitObj);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
// 8. Build repositoryDto first (before variant overrides):
|
|
259
|
+
// - For default operations, derive from responseDto
|
|
260
|
+
// - Include backend-only fields (for internal processing)
|
|
261
|
+
// - Exclude virtual fields but include their dependencies
|
|
262
|
+
let repositoryDto = RepositoryDtoBuilderUtils.deriveRepositoryDto(responseDto, enhancedMainSchema);
|
|
263
|
+
// 9. For default operations (no variantKey), wrap internalDto in pagination for LIST/SEARCH:
|
|
264
|
+
const isListOrSearch = effectiveOperation === CoreResourceOperation.LIST
|
|
265
|
+
|| effectiveOperation === CoreResourceOperation.SEARCH;
|
|
266
|
+
if (!operation.variantKey && isListOrSearch) {
|
|
267
|
+
// Default LIST/SEARCH operations: wrap internalDto in pagination
|
|
268
|
+
internalDtoProcessed = z.object({
|
|
269
|
+
data: z.array(internalDtoProcessed),
|
|
270
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
// 10. Override responseDto, repositoryDto, and internalDto for variant operations:
|
|
274
|
+
// - For SUMMARY variants: use summaryDto (wrapped in pagination for LIST/SEARCH)
|
|
275
|
+
// - For CONTEXT variants: use contextDto (wrapped in pagination for LIST/SEARCH)
|
|
276
|
+
// - For custom variants with customResponseDto: use the custom schema for internalDto too
|
|
277
|
+
// - Build repositoryDto from INTERNAL versions (with backend-only fields)
|
|
278
|
+
// - Build internalDto for service-layer validation (pagination wrapper with backend-only items)
|
|
279
|
+
if (operation.variantKey) {
|
|
280
|
+
if (operation.variantKey === OPERATION_VARIANT_KEY.SUMMARY) {
|
|
281
|
+
// For SUMMARY variants, build repositoryDto from INTERNAL version (has backend-only fields)
|
|
282
|
+
repositoryDto = RepositoryDtoBuilderUtils.deriveRepositoryDto(summaryDtoInternal, enhancedMainSchema);
|
|
283
|
+
if (isListOrSearch) {
|
|
284
|
+
// Build internalDto for service-layer validation (pagination wrapper with backend-only items)
|
|
285
|
+
internalDtoProcessed = z.object({
|
|
286
|
+
data: z.array(summaryDtoInternal),
|
|
287
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
288
|
+
});
|
|
289
|
+
// Wrap summaryDto (frontend version, backend-only stripped) in pagination for responseDto
|
|
290
|
+
responseDto = z.object({
|
|
291
|
+
data: z.array(summaryDto),
|
|
292
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
// For READ operations, use summaryDto versions
|
|
297
|
+
internalDtoProcessed = summaryDtoInternal;
|
|
298
|
+
responseDto = summaryDto;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
else if (operation.variantKey === OPERATION_VARIANT_KEY.CONTEXT) {
|
|
302
|
+
// For CONTEXT variants, build from contextDto versions
|
|
303
|
+
// contextDto is built from responseDto which already has backend-only stripped, so we need internal version
|
|
304
|
+
const contextDtoInternal = this.addRelationshipPlaceholders(this.excludeVirtualFieldsFromSchema(enhancedMainSchema), operation.resourceRelationships, registry);
|
|
305
|
+
repositoryDto = RepositoryDtoBuilderUtils.deriveRepositoryDto(contextDtoInternal, enhancedMainSchema);
|
|
306
|
+
if (isListOrSearch) {
|
|
307
|
+
// Build internalDto for service-layer validation (pagination wrapper with backend-only items)
|
|
308
|
+
internalDtoProcessed = z.object({
|
|
309
|
+
data: z.array(contextDtoInternal),
|
|
310
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
311
|
+
});
|
|
312
|
+
// Wrap contextDto (frontend version, backend-only stripped) in pagination for responseDto
|
|
313
|
+
responseDto = z.object({
|
|
314
|
+
data: z.array(contextDto),
|
|
315
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
else {
|
|
319
|
+
// For READ operations, use contextDto versions
|
|
320
|
+
internalDtoProcessed = contextDtoInternal;
|
|
321
|
+
responseDto = contextDto;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
else if (originalResponseDto && !isZodAny(originalResponseDto)) {
|
|
325
|
+
// For custom variants with customResponseDto (e.g., 'context_old'):
|
|
326
|
+
// The internalDto should also use the custom schema to preserve enriched fields.
|
|
327
|
+
// This ensures that custom implementations can return additional fields that won't be stripped.
|
|
328
|
+
// Apply date coercion to the custom schema for internal processing.
|
|
329
|
+
internalDtoProcessed = this.applyDateCoercion(originalResponseDto);
|
|
330
|
+
repositoryDto = RepositoryDtoBuilderUtils.deriveRepositoryDto(originalResponseDto, enhancedMainSchema);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
// 11. Finalize internalDto with date coercion:
|
|
334
|
+
const internalDtoFinal = this.applyDateCoercion(internalDtoProcessed);
|
|
335
|
+
// 12. Return operation with all DTOs stored
|
|
336
|
+
return {
|
|
337
|
+
...operation,
|
|
338
|
+
requestDto,
|
|
339
|
+
responseDto,
|
|
340
|
+
summaryDto,
|
|
341
|
+
contextDto,
|
|
342
|
+
internalDto: internalDtoFinal,
|
|
343
|
+
repositoryDto
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Main entry point to build DTOs for all operations of a resource
|
|
348
|
+
* This replaces the minimal DTOs set during initialization with comprehensive ones
|
|
349
|
+
*
|
|
350
|
+
* INHERITANCE APPROACH:
|
|
351
|
+
* - Inheritance is applied to mainSchema (not relationship cascading)
|
|
352
|
+
* - Creates discriminated union schemas based on inheritance definitions
|
|
353
|
+
* - Inheritance logic is transferred to DTO building process
|
|
354
|
+
*
|
|
355
|
+
* NOTE: TDatabaseSchema has been removed. Backend-only fields are now marked with
|
|
356
|
+
* the `isBackendOnly` decorator on mainSchema and stripped at the service layer.
|
|
357
|
+
*
|
|
358
|
+
* IMPORTANT: Each operation represents ONE flattened variant, not multiple variants
|
|
359
|
+
*/
|
|
360
|
+
static buildOperationDtos(operations, resourceRegistry, // Full resource registry for cross-references
|
|
361
|
+
processedInheritanceSchemas = new Map() // Cache for inheritance schemas
|
|
362
|
+
) {
|
|
363
|
+
// Process each flattened operation individually
|
|
364
|
+
const enhancedOperations = operations.map((operation, index) => {
|
|
365
|
+
return this.buildOperationDto(operation, resourceRegistry, processedInheritanceSchemas);
|
|
366
|
+
});
|
|
367
|
+
return enhancedOperations;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Build DTO for a single flattened operation with enhanced inheritance handling
|
|
371
|
+
*/
|
|
372
|
+
static buildOperationDto(operation, resourceRegistry, processedInheritanceSchemas, resourceConfig) {
|
|
373
|
+
// Determine the effective operation identifier for DTO building
|
|
374
|
+
const effectiveOperation = operation.resourceOperationLike || operation.operationIdentifier;
|
|
375
|
+
// Apply inheritance to mainSchema if inheritance definition exists
|
|
376
|
+
// Use resource-level inheritance (resourceConfig.inheritenceSchemaDefinition) instead of operation-level
|
|
377
|
+
const inheritenceSchemaDefinition = resourceConfig?.inheritenceSchemaDefinition;
|
|
378
|
+
const enhancedMainSchema = this.applyInheritanceToSchema(operation.mainSchema, inheritenceSchemaDefinition, processedInheritanceSchemas);
|
|
379
|
+
// Create operation with inherited schema
|
|
380
|
+
const operationWithInheritance = {
|
|
381
|
+
...operation,
|
|
382
|
+
mainSchema: enhancedMainSchema
|
|
383
|
+
};
|
|
384
|
+
// Build enhanced request DTO based on operation type and inherited schemas
|
|
385
|
+
let enhancedRequestDto = this.buildEnhancedRequestDto(operationWithInheritance, effectiveOperation);
|
|
386
|
+
// Build enhanced response DTO based on operation type and inherited schemas
|
|
387
|
+
let enhancedResponseDto = this.buildEnhancedResponseDto(operationWithInheritance, effectiveOperation);
|
|
388
|
+
// Add nested operations DTOs if configured (child + self relationships)
|
|
389
|
+
const resourceRelationships = operationWithInheritance.resourceRelationships;
|
|
390
|
+
const childDirRels = resourceRelationships ? getChildDirectionRelationships(resourceRelationships) : [];
|
|
391
|
+
if (childDirRels.length > 0) {
|
|
392
|
+
// Build request DTO with nested children for create/update operations,
|
|
393
|
+
// including bulk variants. Runtime bulk orchestration is handled in the
|
|
394
|
+
// services layer by applying the same nested-processing principles per
|
|
395
|
+
// parent result.
|
|
396
|
+
if (effectiveOperation === CoreResourceOperation.CREATE || effectiveOperation === CoreResourceOperation.CREATE_MANY ||
|
|
397
|
+
effectiveOperation === CoreResourceOperation.UPDATE || effectiveOperation === CoreResourceOperation.UPDATE_MANY) {
|
|
398
|
+
enhancedRequestDto = this.buildRequestDtoWithNested(effectiveOperation, enhancedRequestDto, childDirRels, resourceRegistry);
|
|
399
|
+
}
|
|
400
|
+
// Build response DTO with nested children (for READ)
|
|
401
|
+
if (effectiveOperation === CoreResourceOperation.READ) {
|
|
402
|
+
enhancedResponseDto = this.buildResponseDtoWithNested(enhancedResponseDto, childDirRels, resourceRegistry);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
const result = {
|
|
406
|
+
...operationWithInheritance,
|
|
407
|
+
requestDto: enhancedRequestDto,
|
|
408
|
+
responseDto: enhancedResponseDto,
|
|
409
|
+
};
|
|
410
|
+
return result;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Build enhanced request DTO based on operation type and existing DTOs.
|
|
414
|
+
*
|
|
415
|
+
* Decorator-aware DTO building:
|
|
416
|
+
* - For CREATE operations: excludes fields with `excludeFromCreate` decorator
|
|
417
|
+
* - For UPDATE operations: excludes fields with `excludeFromUpdate` decorator
|
|
418
|
+
* - For ALL operations: excludes fields with `isVirtual` decorator (computed fields)
|
|
419
|
+
*/
|
|
420
|
+
static buildEnhancedRequestDto(operation, effectiveOperation) {
|
|
421
|
+
// Check if operation already has a meaningful requestDto (not z.any() and not empty)
|
|
422
|
+
const isZAny = operation.requestDto && isZodAny(operation.requestDto);
|
|
423
|
+
const currentRequestInfo = this.analyzeDtoSchema(operation.requestDto);
|
|
424
|
+
if (operation.requestDto && !isZAny && currentRequestInfo !== '📄 {} (empty object)') {
|
|
425
|
+
return operation.requestDto;
|
|
426
|
+
}
|
|
427
|
+
const searchQueryRequestSchema = operation.searchQueryRequestSchema;
|
|
428
|
+
if (effectiveOperation === CoreResourceOperation.SEARCH
|
|
429
|
+
&& searchQueryRequestSchema
|
|
430
|
+
&& !isZodAny(searchQueryRequestSchema)) {
|
|
431
|
+
return searchQueryRequestSchema;
|
|
432
|
+
}
|
|
433
|
+
// For operations that shouldn't have request DTOs, return empty object
|
|
434
|
+
const shouldHaveRequestDto = operationShouldHaveRequestDto(effectiveOperation);
|
|
435
|
+
if (!shouldHaveRequestDto) {
|
|
436
|
+
return z.object({});
|
|
437
|
+
}
|
|
438
|
+
// Apply bulk operation decorator if needed (only for API_CALL operations)
|
|
439
|
+
// For bulk operations, we need to wrap the underlying operation's requestDto
|
|
440
|
+
// with Resouces_BulkOperationBaseSchema
|
|
441
|
+
if ('isBulkOperation' in operation && operation.isBulkOperation) {
|
|
442
|
+
// Rebuild the underlying (non-bulk) requestDto by temporarily treating as non-bulk
|
|
443
|
+
const underlyingOperation = {
|
|
444
|
+
...operation,
|
|
445
|
+
isBulkOperation: false,
|
|
446
|
+
requestDto: undefined // Clear to force rebuild
|
|
447
|
+
};
|
|
448
|
+
const underlyingRequestDto = this.buildEnhancedRequestDto(underlyingOperation, effectiveOperation);
|
|
449
|
+
// Wrap with bulk operation base schema
|
|
450
|
+
if (underlyingRequestDto && !isZodAny(underlyingRequestDto)) {
|
|
451
|
+
const underlyingInfo = this.analyzeDtoSchema(underlyingRequestDto);
|
|
452
|
+
if (underlyingInfo !== '📄 {} (empty object)') {
|
|
453
|
+
if (effectiveOperation === CoreResourceOperation.CREATE_MANY) {
|
|
454
|
+
return z.object({
|
|
455
|
+
data: z.array(underlyingRequestDto),
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
if (isZodObject(underlyingRequestDto)) {
|
|
459
|
+
return Resouces_BulkOperationBaseSchema.extend(getZodObjectShape(underlyingRequestDto));
|
|
460
|
+
}
|
|
461
|
+
return Resouces_BulkOperationBaseSchema.and(underlyingRequestDto);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
return effectiveOperation === CoreResourceOperation.CREATE_MANY
|
|
465
|
+
? z.object({
|
|
466
|
+
data: z.array(z.object({})),
|
|
467
|
+
})
|
|
468
|
+
: Resouces_BulkOperationBaseSchema;
|
|
469
|
+
}
|
|
470
|
+
// For create operations, use decorator-aware DTO building
|
|
471
|
+
if (effectiveOperation === CoreResourceOperation.CREATE || effectiveOperation === CoreResourceOperation.CREATE_MANY) {
|
|
472
|
+
return this.createRequestDtoForCreate(operation.mainSchema);
|
|
473
|
+
}
|
|
474
|
+
// For update operations, use decorator-aware DTO building
|
|
475
|
+
if (effectiveOperation === CoreResourceOperation.UPDATE || effectiveOperation === CoreResourceOperation.UPDATE_MANY) {
|
|
476
|
+
return this.createRequestDtoForUpdate(operation.mainSchema);
|
|
477
|
+
}
|
|
478
|
+
// Default: use mainSchema as-is (but still exclude virtual fields)
|
|
479
|
+
return this.excludeVirtualFieldsFromSchema(operation.mainSchema);
|
|
480
|
+
}
|
|
481
|
+
/**
|
|
482
|
+
* Build enhanced response DTO based on operation type and mainSchema
|
|
483
|
+
*/
|
|
484
|
+
static buildEnhancedResponseDto(operation, effectiveOperation) {
|
|
485
|
+
// Check if operation already has a meaningful responseDto (not z.any() and not empty)
|
|
486
|
+
const isZAny = operation.responseDto && isZodAny(operation.responseDto);
|
|
487
|
+
const currentResponseInfo = this.analyzeDtoSchema(operation.responseDto);
|
|
488
|
+
if (operation.responseDto && !isZAny && currentResponseInfo !== '📄 {} (empty object)') {
|
|
489
|
+
return operation.responseDto;
|
|
490
|
+
}
|
|
491
|
+
// Apply bulk operation decorator for bulk operations (only for API_CALL operations)
|
|
492
|
+
if ('isBulkOperation' in operation && operation.isBulkOperation) {
|
|
493
|
+
switch (effectiveOperation) {
|
|
494
|
+
case CoreResourceOperation.DELETE:
|
|
495
|
+
case CoreResourceOperation.DELETE_MANY:
|
|
496
|
+
return DefaultBulkDeleteResponseSchema;
|
|
497
|
+
case CoreResourceOperation.UPDATE:
|
|
498
|
+
case CoreResourceOperation.UPDATE_MANY:
|
|
499
|
+
case CoreResourceOperation.CREATE:
|
|
500
|
+
case CoreResourceOperation.CREATE_MANY:
|
|
501
|
+
// Bulk create/update responses are arrays of resource items at runtime.
|
|
502
|
+
// The controller validates array responses item-by-item against responseDto,
|
|
503
|
+
// so bulk mutations must expose the per-item schema here, not a count wrapper.
|
|
504
|
+
return operation.mainSchema;
|
|
505
|
+
default:
|
|
506
|
+
return z.array(operation.mainSchema);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
// Apply pagination decorator for list/search operations
|
|
510
|
+
if (effectiveOperation === CoreResourceOperation.LIST || effectiveOperation === CoreResourceOperation.SEARCH) {
|
|
511
|
+
return this.createPaginatedResponseSchema(operation.mainSchema, 50);
|
|
512
|
+
}
|
|
513
|
+
// Apply operation-specific default patterns
|
|
514
|
+
const defaultResponse = getDefaultResponseSchemaForOperation(effectiveOperation, operation.mainSchema);
|
|
515
|
+
return defaultResponse;
|
|
516
|
+
}
|
|
517
|
+
/**
|
|
518
|
+
* Create request DTO for CREATE operations.
|
|
519
|
+
*
|
|
520
|
+
* Excludes:
|
|
521
|
+
* - Standard auto-populated fields (_id, createdAt, etc.)
|
|
522
|
+
* - Fields with `excludeFromCreate` decorator
|
|
523
|
+
* - Fields with `isVirtual` decorator (computed fields)
|
|
524
|
+
*
|
|
525
|
+
* Handles discriminated unions by applying omissions to each variant.
|
|
526
|
+
*/
|
|
527
|
+
static createRequestDtoForCreate(mainSchema) {
|
|
528
|
+
// Check if it's a discriminated union - need to handle each variant
|
|
529
|
+
const zodType = getZodType(mainSchema);
|
|
530
|
+
if (zodType === 'union') {
|
|
531
|
+
const discriminator = getZodDefStringProperty(mainSchema, 'discriminator');
|
|
532
|
+
const options = getZodDefArrayProperty(mainSchema, 'options');
|
|
533
|
+
if (discriminator && options && options.length > 0) {
|
|
534
|
+
// Apply omissions to each variant in the union
|
|
535
|
+
const modifiedOptions = options.map(option => this.applyCreateOmissionsToSchema(option));
|
|
536
|
+
// Recreate discriminated union with modified variants
|
|
537
|
+
if (modifiedOptions.length >= 2) {
|
|
538
|
+
return z.discriminatedUnion(discriminator, modifiedOptions);
|
|
539
|
+
}
|
|
540
|
+
else if (modifiedOptions.length === 1) {
|
|
541
|
+
return modifiedOptions[0];
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
// Regular object schema - apply omissions directly
|
|
546
|
+
return this.applyCreateOmissionsToSchema(mainSchema);
|
|
547
|
+
}
|
|
548
|
+
/**
|
|
549
|
+
* Check if a field is a non-discriminator literal.
|
|
550
|
+
* Non-discriminator literals are fixed values that should be auto-populated by the backend.
|
|
551
|
+
* Discriminator literals are used for variant selection and should be shown in CREATE forms.
|
|
552
|
+
*
|
|
553
|
+
* Handles wrapped types (optional, default, etc.) by unwrapping before type check.
|
|
554
|
+
*/
|
|
555
|
+
static isNonDiscriminatorLiteral(fieldSchema) {
|
|
556
|
+
// Unwrap to handle z.literal("value").optional() etc.
|
|
557
|
+
const unwrapped = unwrapSchema(fieldSchema);
|
|
558
|
+
const zodType = getZodType(unwrapped);
|
|
559
|
+
// Check if it's a literal type and NOT marked as discriminator
|
|
560
|
+
// isDiscriminatorField already handles unwrapping via getMetadataRecursive
|
|
561
|
+
return zodType === 'literal' && !isDiscriminatorField(fieldSchema);
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Apply CREATE operation omissions to a single schema (object or other).
|
|
565
|
+
*/
|
|
566
|
+
static applyCreateOmissionsToSchema(schema) {
|
|
567
|
+
if (!isZodObject(schema)) {
|
|
568
|
+
return schema;
|
|
569
|
+
}
|
|
570
|
+
// Standard auto-generated fields to omit from create request DTOs
|
|
571
|
+
// Note: _id is handled via isPrimaryKey decorator which implies excludeFromCreate
|
|
572
|
+
// Primary scope fields (organizationId, userId, etc.) are auto-populated from context
|
|
573
|
+
// W7.3a: anonymousUserId is backend-injected from EC context, never client-supplied
|
|
574
|
+
const fieldsToOmit = ['id', 'createdAt', 'updatedAt', 'createdByUserId', 'organizationId', 'userId', 'applicationId', 'anonymousUserId'];
|
|
575
|
+
try {
|
|
576
|
+
const omitObj = {};
|
|
577
|
+
const shape = getZodObjectShape(schema);
|
|
578
|
+
// Add standard fields to omit
|
|
579
|
+
fieldsToOmit.forEach(field => {
|
|
580
|
+
if (shape[field]) {
|
|
581
|
+
omitObj[field] = true;
|
|
582
|
+
}
|
|
583
|
+
});
|
|
584
|
+
// Add fields with excludeFromCreate decorator (includes isPrimaryKey which implies excludeFromCreate)
|
|
585
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
586
|
+
if (isExcludedFromCreate(fieldSchema)) {
|
|
587
|
+
omitObj[fieldName] = true;
|
|
588
|
+
}
|
|
589
|
+
// Exclude virtual fields - they are computed, not submitted
|
|
590
|
+
if (isVirtualField(fieldSchema)) {
|
|
591
|
+
omitObj[fieldName] = true;
|
|
592
|
+
}
|
|
593
|
+
// Exclude backend-only fields - they are managed internally
|
|
594
|
+
if (isBackendOnlyField(fieldSchema)) {
|
|
595
|
+
omitObj[fieldName] = true;
|
|
596
|
+
}
|
|
597
|
+
// Exclude non-discriminator literals - they are auto-populated by backend
|
|
598
|
+
// Discriminator literals are KEPT for variant selection in CREATE forms
|
|
599
|
+
if (this.isNonDiscriminatorLiteral(fieldSchema)) {
|
|
600
|
+
omitObj[fieldName] = true;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
// If we have fields to omit, create omitted schema
|
|
604
|
+
if (Object.keys(omitObj).length > 0) {
|
|
605
|
+
const omittedSchema = this.omitObjectFields(schema, omitObj);
|
|
606
|
+
return omittedSchema;
|
|
607
|
+
}
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
throw new Error(`Failed to create request DTO for CREATE: ${error instanceof Error ? error.message : String(error)}`);
|
|
611
|
+
}
|
|
612
|
+
return schema;
|
|
613
|
+
}
|
|
614
|
+
/**
|
|
615
|
+
* Create request DTO for UPDATE operations.
|
|
616
|
+
*
|
|
617
|
+
* Excludes:
|
|
618
|
+
* - Standard auto-populated fields (_id, createdAt, etc.)
|
|
619
|
+
* - Fields with `excludeFromUpdate` decorator
|
|
620
|
+
* - Fields with `isVirtual` decorator (computed fields)
|
|
621
|
+
*
|
|
622
|
+
* Handles discriminated unions by applying omissions to each variant.
|
|
623
|
+
*/
|
|
624
|
+
static createRequestDtoForUpdate(mainSchema) {
|
|
625
|
+
// Check if it's a discriminated union - need to handle each variant
|
|
626
|
+
const zodType = getZodType(mainSchema);
|
|
627
|
+
if (zodType === 'union') {
|
|
628
|
+
const discriminator = getZodDefStringProperty(mainSchema, 'discriminator');
|
|
629
|
+
const options = getZodDefArrayProperty(mainSchema, 'options');
|
|
630
|
+
if (discriminator && options && options.length > 0) {
|
|
631
|
+
// Apply omissions to each variant in the union
|
|
632
|
+
const modifiedOptions = options.map(option => this.applyUpdateOmissionsToSchema(option));
|
|
633
|
+
// Recreate discriminated union with modified variants
|
|
634
|
+
if (modifiedOptions.length >= 2) {
|
|
635
|
+
return z.discriminatedUnion(discriminator, modifiedOptions);
|
|
636
|
+
}
|
|
637
|
+
else if (modifiedOptions.length === 1) {
|
|
638
|
+
return modifiedOptions[0];
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
// Regular object schema - apply omissions directly
|
|
643
|
+
return this.applyUpdateOmissionsToSchema(mainSchema);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Check if a field is any kind of literal (discriminator or non-discriminator).
|
|
647
|
+
* All literals are excluded from UPDATE DTOs as they are immutable after creation.
|
|
648
|
+
*
|
|
649
|
+
* Handles wrapped types (optional, default, etc.) by unwrapping before type check.
|
|
650
|
+
*/
|
|
651
|
+
static isLiteralField(fieldSchema) {
|
|
652
|
+
// Unwrap to handle z.literal("value").optional() etc.
|
|
653
|
+
const unwrapped = unwrapSchema(fieldSchema);
|
|
654
|
+
return getZodType(unwrapped) === 'literal';
|
|
655
|
+
}
|
|
656
|
+
/**
|
|
657
|
+
* Apply UPDATE operation omissions to a single schema (object or other).
|
|
658
|
+
*/
|
|
659
|
+
static applyUpdateOmissionsToSchema(schema) {
|
|
660
|
+
if (!isZodObject(schema)) {
|
|
661
|
+
return schema;
|
|
662
|
+
}
|
|
663
|
+
// Standard auto-generated fields to omit from update request DTOs
|
|
664
|
+
// Note: Primary keys are passed as route params, not in request body
|
|
665
|
+
// Primary scope fields (organizationId, userId, etc.) are immutable after creation
|
|
666
|
+
// W7.3a: anonymousUserId is managed by transposition, never client-updatable
|
|
667
|
+
const fieldsToOmit = ['id', 'createdAt', 'updatedAt', 'createdByUserId', 'organizationId', 'userId', 'applicationId', 'anonymousUserId'];
|
|
668
|
+
try {
|
|
669
|
+
const omitObj = {};
|
|
670
|
+
const shape = getZodObjectShape(schema);
|
|
671
|
+
// Add standard fields to omit
|
|
672
|
+
fieldsToOmit.forEach(field => {
|
|
673
|
+
if (shape[field]) {
|
|
674
|
+
omitObj[field] = true;
|
|
675
|
+
}
|
|
676
|
+
});
|
|
677
|
+
// Add fields with excludeFromUpdate decorator or isPrimaryKey (passed as route param)
|
|
678
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
679
|
+
if (isExcludedFromUpdate(fieldSchema)) {
|
|
680
|
+
omitObj[fieldName] = true;
|
|
681
|
+
}
|
|
682
|
+
// Primary keys are passed as route params, not in request body
|
|
683
|
+
if (isPrimaryKey(fieldSchema)) {
|
|
684
|
+
omitObj[fieldName] = true;
|
|
685
|
+
}
|
|
686
|
+
// Exclude virtual fields - they are computed, not submitted
|
|
687
|
+
if (isVirtualField(fieldSchema)) {
|
|
688
|
+
omitObj[fieldName] = true;
|
|
689
|
+
}
|
|
690
|
+
// Exclude backend-only fields - they are managed internally
|
|
691
|
+
if (isBackendOnlyField(fieldSchema)) {
|
|
692
|
+
omitObj[fieldName] = true;
|
|
693
|
+
}
|
|
694
|
+
// Exclude ALL literal fields - both discriminator and non-discriminator
|
|
695
|
+
// Literals are immutable after creation (discriminators define the variant,
|
|
696
|
+
// non-discriminators are fixed values)
|
|
697
|
+
if (this.isLiteralField(fieldSchema)) {
|
|
698
|
+
omitObj[fieldName] = true;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
// If we have fields to omit, create omitted schema
|
|
702
|
+
if (Object.keys(omitObj).length > 0) {
|
|
703
|
+
const omittedSchema = this.omitObjectFields(schema, omitObj);
|
|
704
|
+
return omittedSchema;
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
catch (error) {
|
|
708
|
+
throw new Error(`Failed to create request DTO for UPDATE: ${error instanceof Error ? error.message : String(error)}`);
|
|
709
|
+
}
|
|
710
|
+
return schema;
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Exclude virtual fields from a schema.
|
|
714
|
+
* Virtual fields are computed at runtime and should not appear in request DTOs.
|
|
715
|
+
*
|
|
716
|
+
* Handles discriminated unions by applying omissions to each variant.
|
|
717
|
+
*/
|
|
718
|
+
static excludeVirtualFieldsFromSchema(mainSchema) {
|
|
719
|
+
// Check if it's a discriminated union - need to handle each variant
|
|
720
|
+
const zodType = getZodType(mainSchema);
|
|
721
|
+
if (zodType === 'union') {
|
|
722
|
+
const discriminator = getZodDefStringProperty(mainSchema, 'discriminator');
|
|
723
|
+
const options = getZodDefArrayProperty(mainSchema, 'options');
|
|
724
|
+
if (discriminator && options && options.length > 0) {
|
|
725
|
+
// Apply virtual field exclusion to each variant
|
|
726
|
+
const modifiedOptions = options.map(option => this.applyVirtualFieldExclusionToSchema(option));
|
|
727
|
+
// Recreate discriminated union with modified variants
|
|
728
|
+
if (modifiedOptions.length >= 2) {
|
|
729
|
+
return z.discriminatedUnion(discriminator, modifiedOptions);
|
|
730
|
+
}
|
|
731
|
+
else if (modifiedOptions.length === 1) {
|
|
732
|
+
return modifiedOptions[0];
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
// Regular object schema - apply exclusion directly
|
|
737
|
+
return this.applyVirtualFieldExclusionToSchema(mainSchema);
|
|
738
|
+
}
|
|
739
|
+
/**
|
|
740
|
+
* Apply virtual field exclusion to a single schema (object or other).
|
|
741
|
+
*/
|
|
742
|
+
static applyVirtualFieldExclusionToSchema(schema) {
|
|
743
|
+
if (!isZodObject(schema)) {
|
|
744
|
+
return schema;
|
|
745
|
+
}
|
|
746
|
+
try {
|
|
747
|
+
const omitObj = {};
|
|
748
|
+
const shape = getZodObjectShape(schema);
|
|
749
|
+
// Find and exclude virtual fields
|
|
750
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
751
|
+
if (isVirtualField(fieldSchema)) {
|
|
752
|
+
omitObj[fieldName] = true;
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
// If we have fields to omit, create omitted schema
|
|
756
|
+
if (Object.keys(omitObj).length > 0) {
|
|
757
|
+
const omittedSchema = this.omitObjectFields(schema, omitObj);
|
|
758
|
+
return omittedSchema;
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
catch (error) {
|
|
762
|
+
throw new Error(`Failed to exclude virtual fields from schema: ${error instanceof Error ? error.message : String(error)}`);
|
|
763
|
+
}
|
|
764
|
+
return schema;
|
|
765
|
+
}
|
|
766
|
+
// TODO: Implement cascading relationships logic in future iteration
|
|
767
|
+
/**
|
|
768
|
+
* Create paginated response schema using shared pagination metadata schema
|
|
769
|
+
*/
|
|
770
|
+
static createPaginatedResponseSchema(dataSchema, maxResultsPerPageLimit = 50) {
|
|
771
|
+
return z.object({
|
|
772
|
+
data: z.array(dataSchema).max(maxResultsPerPageLimit),
|
|
773
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Analyze a DTO schema with full recursive object display
|
|
778
|
+
* Public method to get detailed recursive schema analysis
|
|
779
|
+
*/
|
|
780
|
+
static analyzeSchemaRecursive(schema, maxDepth = 5) {
|
|
781
|
+
return this.analyzeDtoSchemaRecursive(schema, '', maxDepth);
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* Debug helper to display a single schema with full recursive analysis
|
|
785
|
+
* Useful for detailed inspection of specific DTOs
|
|
786
|
+
*/
|
|
787
|
+
static debugDisplaySingleSchema(schemaName, schema, maxDepth = 5) {
|
|
788
|
+
console.log(`\n🔍 === SCHEMA DEBUG: ${schemaName} ===`);
|
|
789
|
+
const analysis = this.analyzeDtoSchemaRecursive(schema, '', maxDepth);
|
|
790
|
+
console.log(analysis);
|
|
791
|
+
console.log(`=== END SCHEMA DEBUG ===\n`);
|
|
792
|
+
}
|
|
793
|
+
/**
|
|
794
|
+
* Convenience method to display DTOs with full recursive object details
|
|
795
|
+
* Shows complete nested structures for better understanding
|
|
796
|
+
*/
|
|
797
|
+
static debugDisplayGeneratedDtosWithFullDetails(resourceConfigurations, resourceFilter = [], maxDepth = 4) {
|
|
798
|
+
console.log(`\n🔍 === FULL RECURSIVE DTO ANALYSIS (depth: ${maxDepth}) ===\n`);
|
|
799
|
+
this.debugDisplayGeneratedDtos(resourceConfigurations, resourceFilter, true, // Always use recursive analysis
|
|
800
|
+
maxDepth);
|
|
801
|
+
}
|
|
802
|
+
/**
|
|
803
|
+
* Debug function to display DTOs for specific resources
|
|
804
|
+
* @param resourceConfigurations - All resource configurations
|
|
805
|
+
* @param resourceFilter - Array of resource types to filter (empty = show all)
|
|
806
|
+
* @param useRecursiveAnalysis - Whether to show full recursive object structures (default: true now)
|
|
807
|
+
* @param maxRecursionDepth - Maximum depth for recursive object analysis (default: 3)
|
|
808
|
+
*/
|
|
809
|
+
static debugDisplayGeneratedDtos(resourceConfigurations, resourceFilter = [], useRecursiveAnalysis = true, maxRecursionDepth = 3) {
|
|
810
|
+
console.log('\n=== 📋 GENERATED DTOS DEBUG DISPLAY ===\n');
|
|
811
|
+
const resourceTypes = Object.keys(resourceConfigurations).sort();
|
|
812
|
+
let totalOperations = 0;
|
|
813
|
+
let totalDtosProcessed = 0;
|
|
814
|
+
let filteredResourceTypes = resourceFilter.length > 0
|
|
815
|
+
? resourceTypes.filter(type => resourceFilter.includes(type))
|
|
816
|
+
: resourceTypes;
|
|
817
|
+
if (resourceFilter.length > 0) {
|
|
818
|
+
console.log(`🔍 Filtering for resources: ${resourceFilter.join(', ')}\n`);
|
|
819
|
+
}
|
|
820
|
+
if (useRecursiveAnalysis) {
|
|
821
|
+
console.log(`🔄 Using recursive object analysis (full nested structures, max depth: ${maxRecursionDepth})\n`);
|
|
822
|
+
}
|
|
823
|
+
for (const resourceType of filteredResourceTypes) {
|
|
824
|
+
const resourceConfig = resourceConfigurations[resourceType];
|
|
825
|
+
if (!resourceConfig || !resourceConfig.operations) {
|
|
826
|
+
console.log(`⚠️ Resource ${resourceType}: No operations found`);
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
const operations = resourceConfig.operations;
|
|
830
|
+
console.log(`\n📦 Resource: ${resourceType}`);
|
|
831
|
+
console.log(` Operations: ${operations.length}`);
|
|
832
|
+
// Group operations by operation identifier for cleaner display
|
|
833
|
+
const operationGroups = new Map();
|
|
834
|
+
operations.forEach((op) => {
|
|
835
|
+
const key = op.operationIdentifier;
|
|
836
|
+
if (!operationGroups.has(key)) {
|
|
837
|
+
operationGroups.set(key, []);
|
|
838
|
+
}
|
|
839
|
+
operationGroups.get(key).push(op);
|
|
840
|
+
});
|
|
841
|
+
for (const [operationIdentifier, ops] of operationGroups.entries()) {
|
|
842
|
+
console.log(`\n 🔧 Operation: ${operationIdentifier} (${ops.length} variants)`);
|
|
843
|
+
ops.forEach((operation, index) => {
|
|
844
|
+
totalOperations++;
|
|
845
|
+
const variantInfo = operation.variantType +
|
|
846
|
+
(operation.isBulkOperation ? ' [BULK]' : '') +
|
|
847
|
+
(operation.isOperationDefault ? ' [DEFAULT]' : '') +
|
|
848
|
+
(operation.variantKey ? ` [${operation.variantKey}]` : '');
|
|
849
|
+
console.log(` └─ Variant ${index + 1}: ${variantInfo}`);
|
|
850
|
+
// Display Request DTO
|
|
851
|
+
const requestDtoInfo = useRecursiveAnalysis
|
|
852
|
+
? this.analyzeDtoSchemaRecursive(operation.requestDto, '', maxRecursionDepth)
|
|
853
|
+
: this.analyzeDtoSchema(operation.requestDto);
|
|
854
|
+
console.log(` 📤 Request: ${requestDtoInfo}`);
|
|
855
|
+
totalDtosProcessed++;
|
|
856
|
+
// Display Response DTO
|
|
857
|
+
const responseDtoInfo = useRecursiveAnalysis
|
|
858
|
+
? this.analyzeDtoSchemaRecursive(operation.responseDto, '', maxRecursionDepth)
|
|
859
|
+
: this.analyzeDtoSchema(operation.responseDto);
|
|
860
|
+
console.log(` 📥 Response: ${responseDtoInfo}`);
|
|
861
|
+
totalDtosProcessed++;
|
|
862
|
+
// NOTE: Cascade mode logging removed - lifecycle operations are now on relationships
|
|
863
|
+
// See childOperations.lifecycle.onParentDelete on ResourceRelationship
|
|
864
|
+
// NOTE: inheritenceSchemaConfiguration removed - conditional relationships now use
|
|
865
|
+
// discriminator field on ResourceRelationship instead
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
}
|
|
869
|
+
console.log(`\n=== 📊 DTO DEBUG SUMMARY ===`);
|
|
870
|
+
console.log(`Resources processed: ${filteredResourceTypes.length}/${resourceTypes.length}`);
|
|
871
|
+
console.log(`Total operations: ${totalOperations}`);
|
|
872
|
+
console.log(`Total DTOs processed: ${totalDtosProcessed}`);
|
|
873
|
+
if (resourceFilter.length > 0) {
|
|
874
|
+
console.log(`Filter applied: [${resourceFilter.join(', ')}]`);
|
|
875
|
+
}
|
|
876
|
+
if (useRecursiveAnalysis) {
|
|
877
|
+
console.log(`Analysis mode: Recursive (full nested structures, depth: ${maxRecursionDepth})`);
|
|
878
|
+
}
|
|
879
|
+
console.log(`=================================\n`);
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* Get field count and names from a Zod object schema (Zod-compliant)
|
|
883
|
+
*/
|
|
884
|
+
static getZodObjectFields(schema) {
|
|
885
|
+
if (!isZodObject(schema)) {
|
|
886
|
+
return { fieldCount: 0, fieldNames: [] };
|
|
887
|
+
}
|
|
888
|
+
try {
|
|
889
|
+
// Use public .shape property (Zod v4 API)
|
|
890
|
+
const shape = getZodObjectShape(schema);
|
|
891
|
+
const fieldNames = Object.keys(shape);
|
|
892
|
+
return { fieldCount: fieldNames.length, fieldNames };
|
|
893
|
+
}
|
|
894
|
+
catch (error) {
|
|
895
|
+
return { fieldCount: 0, fieldNames: [] };
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
/**
|
|
899
|
+
* Analyze a DTO schema and return a detailed human-readable summary (Zod-compliant)
|
|
900
|
+
*/
|
|
901
|
+
static analyzeDtoSchema(schema, indent = '') {
|
|
902
|
+
if (!schema) {
|
|
903
|
+
return '❌ null/undefined';
|
|
904
|
+
}
|
|
905
|
+
// Check if it's a z.any()
|
|
906
|
+
if (isZodAny(schema)) {
|
|
907
|
+
return '⚪ z.any() [NEEDS ENHANCEMENT]';
|
|
908
|
+
}
|
|
909
|
+
// Check if it's a ZodObject - use proper field detection
|
|
910
|
+
if (isZodObject(schema)) {
|
|
911
|
+
const { fieldCount, fieldNames } = this.getZodObjectFields(schema);
|
|
912
|
+
if (fieldCount === 0) {
|
|
913
|
+
return '📄 {} (empty object)';
|
|
914
|
+
}
|
|
915
|
+
// Check if this is a decorated schema
|
|
916
|
+
let decorationInfo = '';
|
|
917
|
+
// Use the new Symbol-based metadata approach (preserves description for API docs)
|
|
918
|
+
const metadata = getCustomFieldMetadata(schema);
|
|
919
|
+
const decorations = [];
|
|
920
|
+
if (metadata[ZodDecorator.IS_DB_INDEXED])
|
|
921
|
+
decorations.push('indexed');
|
|
922
|
+
if (metadata[ZodDecorator.IS_FOREIGN_KEY])
|
|
923
|
+
decorations.push('reference');
|
|
924
|
+
if (decorations.length > 0) {
|
|
925
|
+
decorationInfo = ` [${decorations.join(', ')}]`;
|
|
926
|
+
}
|
|
927
|
+
// Return with detailed field information inline
|
|
928
|
+
let result = `📋 Object (${fieldCount} fields)${decorationInfo}`;
|
|
929
|
+
// Always show ALL field details without truncation
|
|
930
|
+
if (fieldCount > 0) {
|
|
931
|
+
try {
|
|
932
|
+
const shape = getZodObjectShape(schema);
|
|
933
|
+
result += ':\n';
|
|
934
|
+
fieldNames.forEach((fieldName, index) => {
|
|
935
|
+
const fieldSchema = shape[fieldName];
|
|
936
|
+
const fieldType = this.getFieldTypeRecursive(fieldSchema, indent + ' │ ', 3, // Max depth for nested objects
|
|
937
|
+
0, new Set());
|
|
938
|
+
const isOptional = this.isFieldOptional(fieldSchema);
|
|
939
|
+
const optionalMark = isOptional ? '?' : '';
|
|
940
|
+
result += `${indent} │ ${fieldName}${optionalMark}: ${fieldType}`;
|
|
941
|
+
if (index < fieldNames.length - 1)
|
|
942
|
+
result += '\n';
|
|
943
|
+
});
|
|
944
|
+
}
|
|
945
|
+
catch (error) {
|
|
946
|
+
result += ` (field details unavailable: ${error})`;
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
return result;
|
|
950
|
+
}
|
|
951
|
+
// Check if it's an array
|
|
952
|
+
if (isZodArray(schema)) {
|
|
953
|
+
const element = getZodDefSchemaProperty(schema, 'element');
|
|
954
|
+
if (!element)
|
|
955
|
+
return '📚 Array[unknown]';
|
|
956
|
+
const elementType = this.getFieldTypeRecursive(element, indent, 3, // Max depth for array elements
|
|
957
|
+
0, new Set());
|
|
958
|
+
return `📚 Array[${elementType}]`;
|
|
959
|
+
}
|
|
960
|
+
// Check if it's a union (regular or discriminated)
|
|
961
|
+
const zodType = getZodType(schema);
|
|
962
|
+
if (zodType === 'union') {
|
|
963
|
+
const options = getZodDefArrayProperty(schema, 'options');
|
|
964
|
+
const optionCount = options?.length || 0;
|
|
965
|
+
// In Zod v4, discriminated unions extend union and have a discriminator property
|
|
966
|
+
const discriminator = getZodDefStringProperty(schema, 'discriminator');
|
|
967
|
+
if (discriminator) {
|
|
968
|
+
return `🔀 DiscriminatedUnion (${optionCount} options, discriminator: "${discriminator}")`;
|
|
969
|
+
}
|
|
970
|
+
return `🔀 Union (${optionCount} options)`;
|
|
971
|
+
}
|
|
972
|
+
// Check if it's a merge/intersection
|
|
973
|
+
if (zodType === 'intersection') {
|
|
974
|
+
return '🔗 Merged schema';
|
|
975
|
+
}
|
|
976
|
+
// Check if it's an optional wrapper
|
|
977
|
+
if (isZodOptional(schema)) {
|
|
978
|
+
const innerType = getZodDefSchemaProperty(schema, 'innerType');
|
|
979
|
+
if (!innerType)
|
|
980
|
+
return 'unknown (optional)';
|
|
981
|
+
return this.analyzeDtoSchema(innerType, indent) + ' (optional)';
|
|
982
|
+
}
|
|
983
|
+
// Check if it's a pipe (from .transform(), .pipe(), etc.)
|
|
984
|
+
// In Zod v4, transforms create pipe types with 'in' and 'out' schemas
|
|
985
|
+
if (zodType === 'pipe') {
|
|
986
|
+
const inSchema = getZodDefSchemaProperty(schema, 'in');
|
|
987
|
+
if (!inSchema)
|
|
988
|
+
return '🔧 Pipe[unknown]';
|
|
989
|
+
return `🔧 Pipe[${this.analyzeDtoSchema(inSchema, indent)}]`;
|
|
990
|
+
}
|
|
991
|
+
// Check if it's a transform (standalone transform, no underlying schema)
|
|
992
|
+
if (zodType === 'transform') {
|
|
993
|
+
return '🔧 Transform';
|
|
994
|
+
}
|
|
995
|
+
// Check if it's a custom (from .refine(), .superRefine(), etc.)
|
|
996
|
+
// Custom types don't wrap schemas - refinements are stored as checks on the schema
|
|
997
|
+
if (zodType === 'custom') {
|
|
998
|
+
return '🔧 Custom';
|
|
999
|
+
}
|
|
1000
|
+
// Check if it's a ZodDefault (has default value)
|
|
1001
|
+
if (isZodDefault(schema)) {
|
|
1002
|
+
const innerSchema = getZodDefSchemaProperty(schema, 'innerType');
|
|
1003
|
+
if (!innerSchema)
|
|
1004
|
+
return 'unknown (with default)';
|
|
1005
|
+
return this.analyzeDtoSchema(innerSchema, indent) + ' (with default)';
|
|
1006
|
+
}
|
|
1007
|
+
// Default case
|
|
1008
|
+
return `🔍 ${zodType || 'Unknown'}`;
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Analyze a DTO schema with full recursive object display
|
|
1012
|
+
* This method shows complete nested object structures instead of just summaries
|
|
1013
|
+
*/
|
|
1014
|
+
static analyzeDtoSchemaRecursive(schema, indent = '', maxDepth = 5, currentDepth = 0, visitedSchemas = new Set()) {
|
|
1015
|
+
if (!schema) {
|
|
1016
|
+
return '❌ null/undefined';
|
|
1017
|
+
}
|
|
1018
|
+
// Prevent infinite recursion
|
|
1019
|
+
if (currentDepth >= maxDepth) {
|
|
1020
|
+
return `🔄 [Max depth ${maxDepth} reached]`;
|
|
1021
|
+
}
|
|
1022
|
+
// Prevent circular references
|
|
1023
|
+
if (visitedSchemas.has(schema)) {
|
|
1024
|
+
return '🔄 [Circular reference]';
|
|
1025
|
+
}
|
|
1026
|
+
visitedSchemas.add(schema);
|
|
1027
|
+
// Check if it's a z.any()
|
|
1028
|
+
if (isZodAny(schema)) {
|
|
1029
|
+
visitedSchemas.delete(schema);
|
|
1030
|
+
return '⚪ z.any() [NEEDS ENHANCEMENT]';
|
|
1031
|
+
}
|
|
1032
|
+
// Check if it's a ZodObject - use proper field detection with full recursion
|
|
1033
|
+
if (isZodObject(schema)) {
|
|
1034
|
+
const { fieldCount, fieldNames } = this.getZodObjectFields(schema);
|
|
1035
|
+
if (fieldCount === 0) {
|
|
1036
|
+
visitedSchemas.delete(schema);
|
|
1037
|
+
return '📄 {} (empty object)';
|
|
1038
|
+
}
|
|
1039
|
+
// Check if this is a decorated schema
|
|
1040
|
+
let decorationInfo = '';
|
|
1041
|
+
// Use the new Symbol-based metadata approach (preserves description for API docs)
|
|
1042
|
+
const metadata = getCustomFieldMetadata(schema);
|
|
1043
|
+
const decorations = [];
|
|
1044
|
+
if (metadata[ZodDecorator.IS_DB_INDEXED])
|
|
1045
|
+
decorations.push('indexed');
|
|
1046
|
+
if (metadata[ZodDecorator.IS_FOREIGN_KEY])
|
|
1047
|
+
decorations.push('reference');
|
|
1048
|
+
if (decorations.length > 0) {
|
|
1049
|
+
decorationInfo = ` [${decorations.join(', ')}]`;
|
|
1050
|
+
}
|
|
1051
|
+
// Return with detailed field information inline with full recursion
|
|
1052
|
+
let result = `📋 Object (${fieldCount} fields)${decorationInfo}`;
|
|
1053
|
+
// Always show ALL field details with recursion
|
|
1054
|
+
if (fieldCount > 0) {
|
|
1055
|
+
try {
|
|
1056
|
+
const shape = getZodObjectShape(schema);
|
|
1057
|
+
result += ':\n';
|
|
1058
|
+
fieldNames.forEach((fieldName, index) => {
|
|
1059
|
+
const fieldSchema = shape[fieldName];
|
|
1060
|
+
const fieldType = this.getFieldTypeRecursive(fieldSchema, indent + ' │ ', maxDepth, currentDepth + 1, new Set(visitedSchemas));
|
|
1061
|
+
const isOptional = this.isFieldOptional(fieldSchema);
|
|
1062
|
+
const optionalMark = isOptional ? '?' : '';
|
|
1063
|
+
result += `${indent} │ ${fieldName}${optionalMark}: ${fieldType}`;
|
|
1064
|
+
if (index < fieldNames.length - 1)
|
|
1065
|
+
result += '\n';
|
|
1066
|
+
});
|
|
1067
|
+
}
|
|
1068
|
+
catch (error) {
|
|
1069
|
+
result += ` (field details unavailable: ${error})`;
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
visitedSchemas.delete(schema);
|
|
1073
|
+
return result;
|
|
1074
|
+
}
|
|
1075
|
+
// Check if it's an array with recursive element analysis
|
|
1076
|
+
if (isZodArray(schema)) {
|
|
1077
|
+
const element = getZodDefSchemaProperty(schema, 'element');
|
|
1078
|
+
if (!element) {
|
|
1079
|
+
visitedSchemas.delete(schema);
|
|
1080
|
+
return '📚 Array[unknown]';
|
|
1081
|
+
}
|
|
1082
|
+
const elementType = this.getFieldTypeRecursive(element, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas));
|
|
1083
|
+
visitedSchemas.delete(schema);
|
|
1084
|
+
return `📚 Array[${elementType}]`;
|
|
1085
|
+
}
|
|
1086
|
+
// Check if it's a union (regular or discriminated)
|
|
1087
|
+
const zodType = getZodType(schema);
|
|
1088
|
+
if (zodType === 'union') {
|
|
1089
|
+
const options = getZodDefArrayProperty(schema, 'options');
|
|
1090
|
+
const optionCount = options?.length || 0;
|
|
1091
|
+
// In Zod v4, discriminated unions extend union and have a discriminator property
|
|
1092
|
+
const discriminator = getZodDefStringProperty(schema, 'discriminator');
|
|
1093
|
+
visitedSchemas.delete(schema);
|
|
1094
|
+
if (discriminator) {
|
|
1095
|
+
return `🔀 DiscriminatedUnion (${optionCount} options, discriminator: "${discriminator}")`;
|
|
1096
|
+
}
|
|
1097
|
+
return `🔀 Union (${optionCount} options)`;
|
|
1098
|
+
}
|
|
1099
|
+
// Check if it's a merge/intersection
|
|
1100
|
+
if (zodType === 'intersection') {
|
|
1101
|
+
visitedSchemas.delete(schema);
|
|
1102
|
+
return '🔗 Merged schema';
|
|
1103
|
+
}
|
|
1104
|
+
// Check if it's an optional wrapper
|
|
1105
|
+
if (isZodOptional(schema)) {
|
|
1106
|
+
const innerType = getZodDefSchemaProperty(schema, 'innerType');
|
|
1107
|
+
if (!innerType) {
|
|
1108
|
+
visitedSchemas.delete(schema);
|
|
1109
|
+
return 'unknown (optional)';
|
|
1110
|
+
}
|
|
1111
|
+
const result = this.analyzeDtoSchemaRecursive(innerType, indent, maxDepth, currentDepth, new Set(visitedSchemas)) + ' (optional)';
|
|
1112
|
+
visitedSchemas.delete(schema);
|
|
1113
|
+
return result;
|
|
1114
|
+
}
|
|
1115
|
+
// Check if it's a pipe (from .transform(), .pipe(), etc.)
|
|
1116
|
+
// In Zod v4, transforms create pipe types with 'in' and 'out' schemas
|
|
1117
|
+
if (zodType === 'pipe') {
|
|
1118
|
+
const inSchema = getZodDefSchemaProperty(schema, 'in');
|
|
1119
|
+
if (!inSchema) {
|
|
1120
|
+
visitedSchemas.delete(schema);
|
|
1121
|
+
return '🔧 Pipe[unknown]';
|
|
1122
|
+
}
|
|
1123
|
+
const result = `🔧 Pipe[${this.analyzeDtoSchemaRecursive(inSchema, indent, maxDepth, currentDepth, new Set(visitedSchemas))}]`;
|
|
1124
|
+
visitedSchemas.delete(schema);
|
|
1125
|
+
return result;
|
|
1126
|
+
}
|
|
1127
|
+
// Check if it's a transform (standalone transform, no underlying schema)
|
|
1128
|
+
if (zodType === 'transform') {
|
|
1129
|
+
visitedSchemas.delete(schema);
|
|
1130
|
+
return '🔧 Transform';
|
|
1131
|
+
}
|
|
1132
|
+
// Check if it's a custom (from .refine(), .superRefine(), etc.)
|
|
1133
|
+
// Custom types don't wrap schemas - refinements are stored as checks on the schema
|
|
1134
|
+
if (zodType === 'custom') {
|
|
1135
|
+
visitedSchemas.delete(schema);
|
|
1136
|
+
return '🔧 Custom';
|
|
1137
|
+
}
|
|
1138
|
+
// Check if it's a ZodDefault (has default value)
|
|
1139
|
+
if (isZodDefault(schema)) {
|
|
1140
|
+
const innerSchema = getZodDefSchemaProperty(schema, 'innerType');
|
|
1141
|
+
if (!innerSchema) {
|
|
1142
|
+
visitedSchemas.delete(schema);
|
|
1143
|
+
return 'unknown (with default)';
|
|
1144
|
+
}
|
|
1145
|
+
const result = this.analyzeDtoSchemaRecursive(innerSchema, indent, maxDepth, currentDepth, new Set(visitedSchemas)) + ' (with default)';
|
|
1146
|
+
visitedSchemas.delete(schema);
|
|
1147
|
+
return result;
|
|
1148
|
+
}
|
|
1149
|
+
// Default case
|
|
1150
|
+
visitedSchemas.delete(schema);
|
|
1151
|
+
return `🔍 ${zodType || 'Unknown'}`;
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Get detailed field type description with full recursive sub-object support
|
|
1155
|
+
*/
|
|
1156
|
+
static getFieldTypeRecursive(fieldSchema, indent = '', maxDepth = 5, currentDepth = 0, visitedSchemas = new Set()) {
|
|
1157
|
+
const zodType = getZodType(fieldSchema);
|
|
1158
|
+
if (!zodType)
|
|
1159
|
+
return 'unknown';
|
|
1160
|
+
// Prevent infinite recursion
|
|
1161
|
+
if (currentDepth >= maxDepth) {
|
|
1162
|
+
return `[Max depth ${maxDepth} reached]`;
|
|
1163
|
+
}
|
|
1164
|
+
// Prevent circular references
|
|
1165
|
+
if (visitedSchemas.has(fieldSchema)) {
|
|
1166
|
+
return '[Circular reference]';
|
|
1167
|
+
}
|
|
1168
|
+
switch (zodType) {
|
|
1169
|
+
case 'string':
|
|
1170
|
+
// Check for decorations
|
|
1171
|
+
if (fieldSchema.description) {
|
|
1172
|
+
try {
|
|
1173
|
+
const metadata = JSON.parse(fieldSchema.description);
|
|
1174
|
+
const decorations = [];
|
|
1175
|
+
if (metadata.isDBIndexed)
|
|
1176
|
+
decorations.push('indexed');
|
|
1177
|
+
if (metadata.isForeignKey)
|
|
1178
|
+
decorations.push('ref');
|
|
1179
|
+
if (decorations.length > 0) {
|
|
1180
|
+
return `string [${decorations.join(', ')}]`;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
catch { }
|
|
1184
|
+
}
|
|
1185
|
+
return 'string';
|
|
1186
|
+
case 'number':
|
|
1187
|
+
case 'int': return 'number';
|
|
1188
|
+
case 'bigint': return 'bigint';
|
|
1189
|
+
case 'boolean': return 'boolean';
|
|
1190
|
+
case 'date': return 'Date';
|
|
1191
|
+
case 'array':
|
|
1192
|
+
visitedSchemas.add(fieldSchema);
|
|
1193
|
+
const element = getZodDefSchemaProperty(fieldSchema, 'element');
|
|
1194
|
+
if (!element) {
|
|
1195
|
+
visitedSchemas.delete(fieldSchema);
|
|
1196
|
+
return 'unknown[]';
|
|
1197
|
+
}
|
|
1198
|
+
const elementType = this.getFieldTypeRecursive(element, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas));
|
|
1199
|
+
visitedSchemas.delete(fieldSchema);
|
|
1200
|
+
return `${elementType}[]`;
|
|
1201
|
+
case 'enum':
|
|
1202
|
+
// Use centralized getEnumValues function
|
|
1203
|
+
const enumValues = getEnumValues(fieldSchema);
|
|
1204
|
+
if (enumValues.length === 0)
|
|
1205
|
+
return 'enum()';
|
|
1206
|
+
return `enum(${enumValues.slice(0, 3).join('|')}${enumValues.length > 3 ? '...' : ''})`;
|
|
1207
|
+
case 'object':
|
|
1208
|
+
// Full recursive object analysis
|
|
1209
|
+
visitedSchemas.add(fieldSchema);
|
|
1210
|
+
const { fieldCount, fieldNames } = this.getZodObjectFields(fieldSchema);
|
|
1211
|
+
if (fieldCount === 0) {
|
|
1212
|
+
visitedSchemas.delete(fieldSchema);
|
|
1213
|
+
return '{}';
|
|
1214
|
+
}
|
|
1215
|
+
let result = `{\n`;
|
|
1216
|
+
try {
|
|
1217
|
+
const shape = getZodObjectShape(fieldSchema);
|
|
1218
|
+
fieldNames.forEach((fieldName, index) => {
|
|
1219
|
+
const nestedFieldSchema = shape[fieldName];
|
|
1220
|
+
const nestedFieldType = this.getFieldTypeRecursive(nestedFieldSchema, indent + ' ', maxDepth, currentDepth + 1, new Set(visitedSchemas));
|
|
1221
|
+
const isOptional = this.isFieldOptional(nestedFieldSchema);
|
|
1222
|
+
const optionalMark = isOptional ? '?' : '';
|
|
1223
|
+
result += `${indent} ${fieldName}${optionalMark}: ${nestedFieldType}`;
|
|
1224
|
+
if (index < fieldNames.length - 1)
|
|
1225
|
+
result += ',\n';
|
|
1226
|
+
});
|
|
1227
|
+
result += `\n${indent}}`;
|
|
1228
|
+
}
|
|
1229
|
+
catch (error) {
|
|
1230
|
+
result = `object(${fieldCount} fields) [error: ${error}]`;
|
|
1231
|
+
}
|
|
1232
|
+
visitedSchemas.delete(fieldSchema);
|
|
1233
|
+
return result;
|
|
1234
|
+
case 'optional':
|
|
1235
|
+
const optionalInnerType = getZodDefSchemaProperty(fieldSchema, 'innerType');
|
|
1236
|
+
if (!optionalInnerType)
|
|
1237
|
+
return 'unknown?';
|
|
1238
|
+
return this.getFieldTypeRecursive(optionalInnerType, indent, maxDepth, currentDepth, visitedSchemas) + '?';
|
|
1239
|
+
case 'nullable':
|
|
1240
|
+
const nullableInnerType = getZodDefSchemaProperty(fieldSchema, 'innerType');
|
|
1241
|
+
if (!nullableInnerType)
|
|
1242
|
+
return 'unknown | null';
|
|
1243
|
+
return this.getFieldTypeRecursive(nullableInnerType, indent, maxDepth, currentDepth, visitedSchemas) + ' | null';
|
|
1244
|
+
case 'default':
|
|
1245
|
+
const defaultValue = getZodDefProperty(fieldSchema, 'defaultValue');
|
|
1246
|
+
const defaultInnerType = getZodDefSchemaProperty(fieldSchema, 'innerType');
|
|
1247
|
+
if (!defaultInnerType)
|
|
1248
|
+
return 'unknown (with default)';
|
|
1249
|
+
const defaultValueStr = typeof defaultValue === 'function'
|
|
1250
|
+
? 'fn()'
|
|
1251
|
+
: String(defaultValue ?? 'undefined');
|
|
1252
|
+
return this.getFieldTypeRecursive(defaultInnerType, indent, maxDepth, currentDepth, visitedSchemas) + ` (default: ${defaultValueStr})`;
|
|
1253
|
+
case 'union':
|
|
1254
|
+
const unionOptions = getZodDefArrayProperty(fieldSchema, 'options');
|
|
1255
|
+
const optionCount = unionOptions?.length || 0;
|
|
1256
|
+
// Check if it's a discriminated union
|
|
1257
|
+
const unionDiscriminator = getZodDefStringProperty(fieldSchema, 'discriminator');
|
|
1258
|
+
if (unionDiscriminator) {
|
|
1259
|
+
return `discriminatedUnion(${optionCount} options, discriminator: "${unionDiscriminator}")`;
|
|
1260
|
+
}
|
|
1261
|
+
return `union(${optionCount} options)`;
|
|
1262
|
+
case 'literal':
|
|
1263
|
+
const literalValue = getZodDefProperty(fieldSchema, 'value');
|
|
1264
|
+
return `literal("${String(literalValue ?? 'unknown')}")`;
|
|
1265
|
+
case 'any':
|
|
1266
|
+
return 'any';
|
|
1267
|
+
case 'unknown':
|
|
1268
|
+
return 'unknown';
|
|
1269
|
+
case 'set':
|
|
1270
|
+
visitedSchemas.add(fieldSchema);
|
|
1271
|
+
const setElement = getZodDefSchemaProperty(fieldSchema, 'valueType');
|
|
1272
|
+
if (!setElement) {
|
|
1273
|
+
visitedSchemas.delete(fieldSchema);
|
|
1274
|
+
return 'Set<unknown>';
|
|
1275
|
+
}
|
|
1276
|
+
const setElementType = this.getFieldTypeRecursive(setElement, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas));
|
|
1277
|
+
visitedSchemas.delete(fieldSchema);
|
|
1278
|
+
return `Set<${setElementType}>`;
|
|
1279
|
+
case 'tuple':
|
|
1280
|
+
visitedSchemas.add(fieldSchema);
|
|
1281
|
+
const tupleItems = getZodDefArrayProperty(fieldSchema, 'items') ?? [];
|
|
1282
|
+
const tupleTypes = tupleItems
|
|
1283
|
+
.filter((item) => isZodTypeAny(item))
|
|
1284
|
+
.map(item => this.getFieldTypeRecursive(item, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas)));
|
|
1285
|
+
visitedSchemas.delete(fieldSchema);
|
|
1286
|
+
return `[${tupleTypes.join(', ')}]`;
|
|
1287
|
+
case 'record':
|
|
1288
|
+
visitedSchemas.add(fieldSchema);
|
|
1289
|
+
const recordValue = getZodDefSchemaProperty(fieldSchema, 'valueType');
|
|
1290
|
+
if (!recordValue) {
|
|
1291
|
+
visitedSchemas.delete(fieldSchema);
|
|
1292
|
+
return 'Record<string, unknown>';
|
|
1293
|
+
}
|
|
1294
|
+
const recordValueType = this.getFieldTypeRecursive(recordValue, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas));
|
|
1295
|
+
visitedSchemas.delete(fieldSchema);
|
|
1296
|
+
return `Record<string, ${recordValueType}>`;
|
|
1297
|
+
case 'map':
|
|
1298
|
+
visitedSchemas.add(fieldSchema);
|
|
1299
|
+
const mapKey = getZodDefSchemaProperty(fieldSchema, 'keyType');
|
|
1300
|
+
const mapValue = getZodDefSchemaProperty(fieldSchema, 'valueType');
|
|
1301
|
+
const mapKeyType = mapKey ? this.getFieldTypeRecursive(mapKey, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas)) : 'unknown';
|
|
1302
|
+
const mapValueType = mapValue ? this.getFieldTypeRecursive(mapValue, indent, maxDepth, currentDepth + 1, new Set(visitedSchemas)) : 'unknown';
|
|
1303
|
+
visitedSchemas.delete(fieldSchema);
|
|
1304
|
+
return `Map<${mapKeyType}, ${mapValueType}>`;
|
|
1305
|
+
case 'intersection':
|
|
1306
|
+
const leftSchema = getZodDefSchemaProperty(fieldSchema, 'left');
|
|
1307
|
+
const rightSchema = getZodDefSchemaProperty(fieldSchema, 'right');
|
|
1308
|
+
const leftType = leftSchema ? this.getFieldTypeRecursive(leftSchema, indent, maxDepth, currentDepth + 1, visitedSchemas) : 'unknown';
|
|
1309
|
+
const rightType = rightSchema ? this.getFieldTypeRecursive(rightSchema, indent, maxDepth, currentDepth + 1, visitedSchemas) : 'unknown';
|
|
1310
|
+
return `${leftType} & ${rightType}`;
|
|
1311
|
+
case 'lazy':
|
|
1312
|
+
return 'lazy<...>';
|
|
1313
|
+
case 'void':
|
|
1314
|
+
case 'undefined':
|
|
1315
|
+
case 'never':
|
|
1316
|
+
return zodType;
|
|
1317
|
+
case 'pipe':
|
|
1318
|
+
const pipeInSchema = getZodDefSchemaProperty(fieldSchema, 'in');
|
|
1319
|
+
if (!pipeInSchema)
|
|
1320
|
+
return 'pipe[unknown]';
|
|
1321
|
+
const pipeInnerType = this.getFieldTypeRecursive(pipeInSchema, indent, maxDepth, currentDepth, visitedSchemas);
|
|
1322
|
+
return `pipe[${pipeInnerType}]`;
|
|
1323
|
+
case 'transform':
|
|
1324
|
+
return 'transform';
|
|
1325
|
+
case 'custom':
|
|
1326
|
+
return 'custom';
|
|
1327
|
+
default:
|
|
1328
|
+
return zodType || 'unknown';
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
/**
|
|
1332
|
+
* Check if a field is optional
|
|
1333
|
+
*/
|
|
1334
|
+
static isFieldOptional(fieldSchema) {
|
|
1335
|
+
// Check if it's wrapped in ZodOptional
|
|
1336
|
+
if (isZodOptional(fieldSchema))
|
|
1337
|
+
return true;
|
|
1338
|
+
// Check if it's a ZodDefault (has default value)
|
|
1339
|
+
if (isZodDefault(fieldSchema))
|
|
1340
|
+
return true;
|
|
1341
|
+
return false;
|
|
1342
|
+
}
|
|
1343
|
+
/**
|
|
1344
|
+
* Apply inheritance to mainSchema based on inheritance definition
|
|
1345
|
+
* Creates discriminated union schemas when inheritance is defined
|
|
1346
|
+
*
|
|
1347
|
+
* NOTE: This transfers inheritance logic from relationship cascading mechanism
|
|
1348
|
+
* to schema-level processing, ensuring inheritance affects DTOs properly.
|
|
1349
|
+
*
|
|
1350
|
+
* NOTE: TDatabaseSchema has been removed. Backend-only fields are now marked with
|
|
1351
|
+
* the `isBackendOnly` decorator and stripped at the service layer.
|
|
1352
|
+
*/
|
|
1353
|
+
static applyInheritanceToSchema(mainSchema, inheritanceDefinition, processedInheritanceSchemas) {
|
|
1354
|
+
// If no inheritance definition, return original schema
|
|
1355
|
+
if (!inheritanceDefinition || !inheritanceDefinition.inheritedSchemas ||
|
|
1356
|
+
inheritanceDefinition.inheritedSchemas.length === 0) {
|
|
1357
|
+
return mainSchema;
|
|
1358
|
+
}
|
|
1359
|
+
const cacheKey = `${JSON.stringify(inheritanceDefinition)}_main`;
|
|
1360
|
+
// Check cache first
|
|
1361
|
+
if (processedInheritanceSchemas.has(cacheKey)) {
|
|
1362
|
+
return processedInheritanceSchemas.get(cacheKey);
|
|
1363
|
+
}
|
|
1364
|
+
const { discriminatorField, inheritedSchemas, withoutInheritanceDiscriminatorFieldValues } = inheritanceDefinition;
|
|
1365
|
+
// Build discriminated union options for mainSchema
|
|
1366
|
+
const mainSchemaOptions = [];
|
|
1367
|
+
// Add base schema for non-inherited values if specified
|
|
1368
|
+
if (withoutInheritanceDiscriminatorFieldValues && withoutInheritanceDiscriminatorFieldValues.length > 0) {
|
|
1369
|
+
// Create enum for base discriminator values
|
|
1370
|
+
const baseDiscriminatorEnum = z.enum(withoutInheritanceDiscriminatorFieldValues);
|
|
1371
|
+
// Extend mainSchema with discriminator field
|
|
1372
|
+
const baseMainSchema = this.extendSchemaWithDiscriminator(mainSchema, discriminatorField, baseDiscriminatorEnum);
|
|
1373
|
+
mainSchemaOptions.push(baseMainSchema);
|
|
1374
|
+
}
|
|
1375
|
+
// Process each inherited schema
|
|
1376
|
+
inheritedSchemas.forEach((inheritedItem) => {
|
|
1377
|
+
const { discriminatorFieldValue, schema: inheritedSchema } = inheritedItem;
|
|
1378
|
+
// Create literal discriminator for this variant
|
|
1379
|
+
const discriminatorLiteral = z.literal(discriminatorFieldValue);
|
|
1380
|
+
// Merge inherited schema with base schema and add discriminator
|
|
1381
|
+
const mergedMainSchema = this.mergeInheritedSchema(mainSchema, inheritedSchema, discriminatorField, discriminatorLiteral);
|
|
1382
|
+
mainSchemaOptions.push(mergedMainSchema);
|
|
1383
|
+
// Handle nested inheritance recursively
|
|
1384
|
+
if (inheritedItem.inheritenceSchemaDefinition) {
|
|
1385
|
+
const nestedMain = this.applyInheritanceToSchema(mergedMainSchema, inheritedItem.inheritenceSchemaDefinition, processedInheritanceSchemas);
|
|
1386
|
+
// Replace the simple merged schema with the nested enhanced one
|
|
1387
|
+
mainSchemaOptions[mainSchemaOptions.length - 1] = nestedMain;
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
// Create discriminated union if we have multiple options
|
|
1391
|
+
let enhancedMainSchema;
|
|
1392
|
+
if (mainSchemaOptions.length > 1) {
|
|
1393
|
+
// Check if all schemas are ZodObject types to use discriminated union
|
|
1394
|
+
const allMainAreObjects = mainSchemaOptions.every(schema => isZodObject(schema));
|
|
1395
|
+
if (allMainAreObjects) {
|
|
1396
|
+
// Use discriminated union for object schemas
|
|
1397
|
+
enhancedMainSchema = z.discriminatedUnion(discriminatorField, mainSchemaOptions);
|
|
1398
|
+
}
|
|
1399
|
+
else {
|
|
1400
|
+
// Fallback to regular union for mixed types
|
|
1401
|
+
enhancedMainSchema = z.union(mainSchemaOptions);
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
else if (mainSchemaOptions.length === 1) {
|
|
1405
|
+
enhancedMainSchema = mainSchemaOptions[0];
|
|
1406
|
+
}
|
|
1407
|
+
else {
|
|
1408
|
+
// Fallback to original schema
|
|
1409
|
+
enhancedMainSchema = mainSchema;
|
|
1410
|
+
}
|
|
1411
|
+
// Cache the result
|
|
1412
|
+
processedInheritanceSchemas.set(cacheKey, enhancedMainSchema);
|
|
1413
|
+
return enhancedMainSchema;
|
|
1414
|
+
}
|
|
1415
|
+
/**
|
|
1416
|
+
* Extend a schema with a discriminator field
|
|
1417
|
+
*/
|
|
1418
|
+
static extendSchemaWithDiscriminator(baseSchema, discriminatorField, discriminatorSchema) {
|
|
1419
|
+
// If base schema is not an object, wrap it in an object with the discriminator
|
|
1420
|
+
if (!isZodObject(baseSchema)) {
|
|
1421
|
+
return z.object({
|
|
1422
|
+
[discriminatorField]: discriminatorSchema,
|
|
1423
|
+
value: baseSchema
|
|
1424
|
+
});
|
|
1425
|
+
}
|
|
1426
|
+
// Extend existing object schema with discriminator field
|
|
1427
|
+
// Type guard already ensures it's a ZodObject
|
|
1428
|
+
return baseSchema.extend({
|
|
1429
|
+
[discriminatorField]: discriminatorSchema
|
|
1430
|
+
});
|
|
1431
|
+
}
|
|
1432
|
+
/**
|
|
1433
|
+
* Merge inherited schema with base schema and add discriminator
|
|
1434
|
+
*/
|
|
1435
|
+
static mergeInheritedSchema(baseSchema, inheritedSchema, discriminatorField, discriminatorValue) {
|
|
1436
|
+
// If both are object schemas, merge them
|
|
1437
|
+
if (isZodObject(baseSchema) && isZodObject(inheritedSchema)) {
|
|
1438
|
+
// Merge the two object schemas and add discriminator (using extend instead of merge in Zod v4)
|
|
1439
|
+
const mergedSchema = baseSchema.extend(inheritedSchema.shape);
|
|
1440
|
+
return mergedSchema.extend({
|
|
1441
|
+
[discriminatorField]: discriminatorValue
|
|
1442
|
+
});
|
|
1443
|
+
}
|
|
1444
|
+
// If only inherited schema is an object, extend it with discriminator
|
|
1445
|
+
if (isZodObject(inheritedSchema)) {
|
|
1446
|
+
// Type guard already ensures it's a ZodObject
|
|
1447
|
+
return inheritedSchema.extend({
|
|
1448
|
+
[discriminatorField]: discriminatorValue
|
|
1449
|
+
});
|
|
1450
|
+
}
|
|
1451
|
+
// Fallback: create object with discriminator and value
|
|
1452
|
+
return z.object({
|
|
1453
|
+
[discriminatorField]: discriminatorValue,
|
|
1454
|
+
value: inheritedSchema
|
|
1455
|
+
});
|
|
1456
|
+
}
|
|
1457
|
+
// =============================================================================
|
|
1458
|
+
// NESTED OPERATIONS DTO BUILDING
|
|
1459
|
+
// =============================================================================
|
|
1460
|
+
static getAllResourceFieldIdentifiers(resourceRegistry) {
|
|
1461
|
+
const allResourceFieldIdentifiers = {};
|
|
1462
|
+
for (const [resourceType, resourceConfig] of resourceRegistry.entries()) {
|
|
1463
|
+
if (typeof resourceConfig?.resourceFieldIdentifier === 'string' && resourceConfig.resourceFieldIdentifier.length > 0) {
|
|
1464
|
+
allResourceFieldIdentifiers[resourceType] = resourceConfig.resourceFieldIdentifier;
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
return allResourceFieldIdentifiers;
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Derive nested field name from the relationship identifier.
|
|
1471
|
+
*/
|
|
1472
|
+
static getNestedFieldName(rel, resourceRegistry) {
|
|
1473
|
+
return Resources_SharedUtils.resolveRelationshipObjectIdentity(rel, rel.resourceType2, rel.cardinality2, this.getAllResourceFieldIdentifiers(resourceRegistry)).objectFieldName;
|
|
1474
|
+
}
|
|
1475
|
+
static getRelationshipObjectFieldName(rel, relatedResourceType, cardinality, resourceRegistry) {
|
|
1476
|
+
return Resources_SharedUtils.resolveRelationshipObjectIdentity(rel, relatedResourceType, cardinality, this.getAllResourceFieldIdentifiers(resourceRegistry)).objectFieldName;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Get delete field name: _{nestedField}ToDelete
|
|
1480
|
+
*/
|
|
1481
|
+
static getDeleteFieldName(nestedFieldName) {
|
|
1482
|
+
return `_${nestedFieldName}ToDelete`;
|
|
1483
|
+
}
|
|
1484
|
+
/**
|
|
1485
|
+
* Build child schema for nested operations based on operation type and config.
|
|
1486
|
+
* For CREATE: uses child's CREATE request DTO
|
|
1487
|
+
* For UPDATE: uses union of CREATE (no _id) and UPDATE (with _id) DTOs
|
|
1488
|
+
*/
|
|
1489
|
+
static buildNestedChildSchema(rel, nestedConfig, operation, childMainSchema, resourceRegistry) {
|
|
1490
|
+
const childResourceType = rel.resourceType2;
|
|
1491
|
+
// Get child's operation config to find request DTOs
|
|
1492
|
+
const childConfig = resourceRegistry.get(childResourceType);
|
|
1493
|
+
if (!childConfig || !childConfig.operations) {
|
|
1494
|
+
// Fallback: use child's main schema with appropriate omissions
|
|
1495
|
+
if (operation === CoreResourceOperation.CREATE || operation === CoreResourceOperation.CREATE_MANY) {
|
|
1496
|
+
return this.createRequestDtoForCreate(childMainSchema);
|
|
1497
|
+
}
|
|
1498
|
+
else {
|
|
1499
|
+
return this.createRequestDtoForUpdate(childMainSchema);
|
|
1500
|
+
}
|
|
1501
|
+
}
|
|
1502
|
+
// Find child's CREATE operation for request DTO
|
|
1503
|
+
const childCreateOp = childConfig.operations.find((op) => op.operationIdentifier === CoreResourceOperation.CREATE ||
|
|
1504
|
+
op.resourceOperationLike === CoreResourceOperation.CREATE);
|
|
1505
|
+
const childCreateDto = childCreateOp?.requestDto || this.createRequestDtoForCreate(childMainSchema);
|
|
1506
|
+
if (operation === CoreResourceOperation.CREATE || operation === CoreResourceOperation.CREATE_MANY) {
|
|
1507
|
+
// For CREATE: use child's CREATE DTO
|
|
1508
|
+
return childCreateDto;
|
|
1509
|
+
}
|
|
1510
|
+
// For UPDATE: use union of CREATE (no _id) and UPDATE (with _id) DTOs
|
|
1511
|
+
const childUpdateOp = childConfig.operations.find((op) => op.operationIdentifier === CoreResourceOperation.UPDATE ||
|
|
1512
|
+
op.resourceOperationLike === CoreResourceOperation.UPDATE);
|
|
1513
|
+
const childUpdateDto = childUpdateOp?.requestDto || this.createRequestDtoForUpdate(childMainSchema);
|
|
1514
|
+
// Create union: items without _id are creates, items with _id are updates
|
|
1515
|
+
// In Zod 4, we use z.union for discriminated unions or z.union for simple unions
|
|
1516
|
+
if (isZodObject(childCreateDto) && isZodObject(childUpdateDto)) {
|
|
1517
|
+
// Explicitly forbid _id on the create branch so _id-bearing payloads are
|
|
1518
|
+
// routed through the update branch instead of being accepted as creates and
|
|
1519
|
+
// only failing later in downstream child UPDATE validation.
|
|
1520
|
+
const createWithoutId = childCreateDto.extend({
|
|
1521
|
+
_id: z.never().optional()
|
|
1522
|
+
});
|
|
1523
|
+
// UPDATE DTO should have _id as required
|
|
1524
|
+
const updateWithRequiredId = childUpdateDto.extend({
|
|
1525
|
+
_id: z.string()
|
|
1526
|
+
});
|
|
1527
|
+
return z.union([updateWithRequiredId, createWithoutId]);
|
|
1528
|
+
}
|
|
1529
|
+
// Fallback: use UPDATE DTO
|
|
1530
|
+
return childUpdateDto;
|
|
1531
|
+
}
|
|
1532
|
+
/**
|
|
1533
|
+
* Get child schema for a specific DataMode (for nested READ responses).
|
|
1534
|
+
* - RAW: All stored fields, no population
|
|
1535
|
+
* - SUMMARY: Summary fields only (fields with isSummaryField decorator)
|
|
1536
|
+
* - CONTEXT: Full context (all fields with contextPolicy applied)
|
|
1537
|
+
*
|
|
1538
|
+
* Note: CONTEXT mode requires service-layer processing (contextPolicy application),
|
|
1539
|
+
* so we return the full schema here. The service layer will apply contextPolicy.
|
|
1540
|
+
*/
|
|
1541
|
+
static getChildSchemaForDataMode(childMainSchema, dataMode) {
|
|
1542
|
+
switch (dataMode) {
|
|
1543
|
+
case DataMode.SUMMARY:
|
|
1544
|
+
// Use ResourcesSummaryUtils to derive summary schema (only fields with isSummaryField decorator)
|
|
1545
|
+
if (isZodObject(childMainSchema)) {
|
|
1546
|
+
return ResourcesSummaryUtils.deriveSummarySchema(childMainSchema, {
|
|
1547
|
+
includeId: true, // Always include _id in summaries
|
|
1548
|
+
includeForeignKeys: false, // Only include FKs if they have isSummaryField decorator
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
// Fallback for non-object schemas
|
|
1552
|
+
return childMainSchema;
|
|
1553
|
+
case DataMode.CONTEXT:
|
|
1554
|
+
// CONTEXT mode requires service-layer processing (contextPolicy, population, etc.)
|
|
1555
|
+
// Return full schema - service layer will apply contextPolicy
|
|
1556
|
+
return childMainSchema;
|
|
1557
|
+
case DataMode.RAW:
|
|
1558
|
+
default:
|
|
1559
|
+
// RAW mode: return full schema (all stored fields)
|
|
1560
|
+
return childMainSchema;
|
|
1561
|
+
}
|
|
1562
|
+
}
|
|
1563
|
+
/**
|
|
1564
|
+
* Extend a DTO root that may be either a plain object or a discriminated
|
|
1565
|
+
* union of objects.
|
|
1566
|
+
*
|
|
1567
|
+
* Relationship-driven nested fields must exist on every variant of a
|
|
1568
|
+
* polymorphic DTO root; otherwise the shared contract silently diverges from
|
|
1569
|
+
* the live frontend form/runtime path.
|
|
1570
|
+
*/
|
|
1571
|
+
static extendObjectLikeDto(baseDto, extensionShape) {
|
|
1572
|
+
if (Object.keys(extensionShape).length === 0) {
|
|
1573
|
+
return baseDto;
|
|
1574
|
+
}
|
|
1575
|
+
if (isZodObject(baseDto)) {
|
|
1576
|
+
return baseDto.extend(extensionShape);
|
|
1577
|
+
}
|
|
1578
|
+
const zodType = getZodType(baseDto);
|
|
1579
|
+
if (zodType === 'union') {
|
|
1580
|
+
const discriminator = getZodDefStringProperty(baseDto, 'discriminator');
|
|
1581
|
+
const unionOptions = getZodDefArrayProperty(baseDto, 'options');
|
|
1582
|
+
if (discriminator && unionOptions && unionOptions.length > 0) {
|
|
1583
|
+
const extendedOptions = unionOptions.map((option) => isZodObject(option)
|
|
1584
|
+
? option.extend(extensionShape)
|
|
1585
|
+
: option);
|
|
1586
|
+
if (extendedOptions.every((option) => isZodObject(option))) {
|
|
1587
|
+
if (extendedOptions.length >= 2) {
|
|
1588
|
+
return z.discriminatedUnion(discriminator, extendedOptions);
|
|
1589
|
+
}
|
|
1590
|
+
if (extendedOptions.length === 1) {
|
|
1591
|
+
return extendedOptions[0];
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
return baseDto;
|
|
1597
|
+
}
|
|
1598
|
+
/**
|
|
1599
|
+
* Build request DTO with nested children based on config.
|
|
1600
|
+
* Extends the base request DTO with nested child fields for CREATE/UPDATE operations.
|
|
1601
|
+
*
|
|
1602
|
+
* ## Deliberate Condition-Agnosticism
|
|
1603
|
+
*
|
|
1604
|
+
* This method iterates ALL child relationships whose compiled runtime
|
|
1605
|
+
* semantics expose a current effective nested projection,
|
|
1606
|
+
* regardless of whether they carry a `discriminator` or `condition`.
|
|
1607
|
+
* It generates DTO fields for every such relationship unconditionally.
|
|
1608
|
+
*
|
|
1609
|
+
* This is intentional: DTO generation is a STARTUP concern — it defines the shape
|
|
1610
|
+
* of all possible request/response schemas. Conditional filtering is a RUNTIME
|
|
1611
|
+
* concern handled by:
|
|
1612
|
+
* - `ServicesRegistryHandler.filterRelationshipsByParent()` — which filters
|
|
1613
|
+
* active relationships before processing nested data in CREATE/UPDATE
|
|
1614
|
+
* - `ResourceContextBackendService.fetchChildResourcesWithPolicy()` — which
|
|
1615
|
+
* filters active relationships before fetching children in context
|
|
1616
|
+
*
|
|
1617
|
+
* If the DTO builder filtered by discriminator at startup, the nested fields
|
|
1618
|
+
* would be missing from the schema entirely, and runtime data for those fields
|
|
1619
|
+
* would be silently dropped during Zod validation.
|
|
1620
|
+
*/
|
|
1621
|
+
static buildRequestDtoWithNested(operation, baseDto, childRelationships, resourceRegistry) {
|
|
1622
|
+
if (operation === CoreResourceOperation.CREATE_MANY) {
|
|
1623
|
+
const baseShape = isZodObject(baseDto) ? getZodObjectShape(baseDto) : undefined;
|
|
1624
|
+
const dataSchema = baseShape?.data;
|
|
1625
|
+
if (dataSchema instanceof z.ZodArray) {
|
|
1626
|
+
const nestedItemDto = this.buildRequestDtoWithNested(CoreResourceOperation.CREATE, dataSchema.element, childRelationships, resourceRegistry);
|
|
1627
|
+
return this.extendObjectLikeDto(baseDto, {
|
|
1628
|
+
data: z.array(nestedItemDto),
|
|
1629
|
+
});
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
const nestedFields = {};
|
|
1633
|
+
for (const rel of childRelationships) {
|
|
1634
|
+
const compiledRel = Resources_SharedUtils.ensureCompiledRelationship(rel);
|
|
1635
|
+
const nestedConfig = Resources_SharedUtils.resolveRelationshipNestedMutationConfig(compiledRel, operation);
|
|
1636
|
+
if (!nestedConfig)
|
|
1637
|
+
continue;
|
|
1638
|
+
const fieldName = this.getNestedFieldName(compiledRel, resourceRegistry);
|
|
1639
|
+
const childConfig = resourceRegistry.get(compiledRel.resourceType2);
|
|
1640
|
+
if (!childConfig)
|
|
1641
|
+
continue;
|
|
1642
|
+
const childSchema = this.buildNestedChildSchema(compiledRel, nestedConfig, operation, childConfig.mainSchema, resourceRegistry);
|
|
1643
|
+
// Add nested field (array for 1:N/N:N, object for 1:1)
|
|
1644
|
+
nestedFields[fieldName] = isArrayCardinality(compiledRel.cardinality2)
|
|
1645
|
+
? z.array(childSchema).optional()
|
|
1646
|
+
: childSchema.optional();
|
|
1647
|
+
// Add delete field if allowDelete (for UPDATE only)
|
|
1648
|
+
if (nestedConfig.allowDelete &&
|
|
1649
|
+
(operation === CoreResourceOperation.UPDATE || operation === CoreResourceOperation.UPDATE_MANY)) {
|
|
1650
|
+
nestedFields[this.getDeleteFieldName(fieldName)] = z.array(z.string()).optional();
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
return this.extendObjectLikeDto(baseDto, nestedFields);
|
|
1654
|
+
}
|
|
1655
|
+
/**
|
|
1656
|
+
* Build response DTO with nested children based on onRead config.
|
|
1657
|
+
* Extends the base response DTO with nested child fields for READ operations.
|
|
1658
|
+
*
|
|
1659
|
+
* Like `buildRequestDtoWithNested`, this is deliberately condition-agnostic —
|
|
1660
|
+
* it generates response DTO fields for ALL relationships whose compiled
|
|
1661
|
+
* runtime semantics expose an effective nested-read projection, regardless of
|
|
1662
|
+
* discriminator/condition. The fields are optional (`z.optional()`), so when
|
|
1663
|
+
* the runtime skips a conditional relationship, the field is simply absent
|
|
1664
|
+
* from the response rather than causing a schema validation error.
|
|
1665
|
+
*/
|
|
1666
|
+
static buildResponseDtoWithNested(baseDto, childRelationships, resourceRegistry) {
|
|
1667
|
+
const nestedFields = {};
|
|
1668
|
+
for (const rel of childRelationships) {
|
|
1669
|
+
const compiledRel = Resources_SharedUtils.ensureCompiledRelationship(rel);
|
|
1670
|
+
const readConfig = Resources_SharedUtils.resolveRelationshipNestedReadConfig(compiledRel);
|
|
1671
|
+
if (!readConfig)
|
|
1672
|
+
continue;
|
|
1673
|
+
const fieldName = this.getNestedFieldName(compiledRel, resourceRegistry);
|
|
1674
|
+
const childConfig = resourceRegistry.get(compiledRel.resourceType2);
|
|
1675
|
+
if (!childConfig)
|
|
1676
|
+
continue;
|
|
1677
|
+
const childSchema = this.getChildSchemaForDataMode(childConfig.mainSchema, readConfig.dataMode);
|
|
1678
|
+
// Add nested field (array for 1:N/N:N, object for 1:1)
|
|
1679
|
+
nestedFields[fieldName] = isArrayCardinality(compiledRel.cardinality2)
|
|
1680
|
+
? z.array(childSchema).optional()
|
|
1681
|
+
: childSchema.optional();
|
|
1682
|
+
}
|
|
1683
|
+
return this.extendObjectLikeDto(baseDto, nestedFields);
|
|
1684
|
+
}
|
|
1685
|
+
/**
|
|
1686
|
+
* Strip fields marked with isBackendOnly decorator from schema.
|
|
1687
|
+
*
|
|
1688
|
+
* @param schema - Schema to strip from
|
|
1689
|
+
* @param options - Options for stripping behavior
|
|
1690
|
+
* @returns New schema without backend-only fields
|
|
1691
|
+
*/
|
|
1692
|
+
static stripBackendOnlyFields(schema, options) {
|
|
1693
|
+
// Handle discriminated unions - strip from all variants
|
|
1694
|
+
const zodType = getZodType(schema);
|
|
1695
|
+
if (zodType === 'union') {
|
|
1696
|
+
const discriminator = getZodDefStringProperty(schema, 'discriminator');
|
|
1697
|
+
const unionOptions = getZodDefArrayProperty(schema, 'options');
|
|
1698
|
+
if (discriminator && unionOptions && unionOptions.length > 0) {
|
|
1699
|
+
const strippedOptions = unionOptions.map((option) => this.stripBackendOnlyFields(option, options));
|
|
1700
|
+
// Recreate discriminated union with modified variants
|
|
1701
|
+
if (strippedOptions.length >= 2) {
|
|
1702
|
+
return z.discriminatedUnion(discriminator, strippedOptions);
|
|
1703
|
+
}
|
|
1704
|
+
else if (strippedOptions.length === 1) {
|
|
1705
|
+
return strippedOptions[0];
|
|
1706
|
+
}
|
|
1707
|
+
}
|
|
1708
|
+
return schema;
|
|
1709
|
+
}
|
|
1710
|
+
// Handle arrays - strip from array element schema
|
|
1711
|
+
if (isZodArray(schema)) {
|
|
1712
|
+
// ZodArray stores element schema in _def.element (not _def.type)
|
|
1713
|
+
const elementSchema = getZodDefProperty(schema, 'element');
|
|
1714
|
+
return z.array(this.stripBackendOnlyFields(elementSchema, options));
|
|
1715
|
+
}
|
|
1716
|
+
// Handle optional/nullable/default wrappers - unwrap, strip, rewrap
|
|
1717
|
+
if (isZodOptional(schema)) {
|
|
1718
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1719
|
+
return this.stripBackendOnlyFields(innerSchema, options).optional();
|
|
1720
|
+
}
|
|
1721
|
+
if (hasZodType(schema, 'nullable')) {
|
|
1722
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1723
|
+
return this.stripBackendOnlyFields(innerSchema, options).nullable();
|
|
1724
|
+
}
|
|
1725
|
+
if (isZodDefault(schema)) {
|
|
1726
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1727
|
+
const defaultValue = getZodDefProperty(schema, 'defaultValue');
|
|
1728
|
+
return this.stripBackendOnlyFields(innerSchema, options).default(defaultValue);
|
|
1729
|
+
}
|
|
1730
|
+
// Handle objects - strip backend-only fields from shape
|
|
1731
|
+
if (isZodObject(schema)) {
|
|
1732
|
+
const shape = getZodObjectShape(schema);
|
|
1733
|
+
const omitObj = {};
|
|
1734
|
+
const rebuiltShape = {};
|
|
1735
|
+
let didRebuildNestedField = false;
|
|
1736
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
1737
|
+
if (isBackendOnlyField(fieldSchema)) {
|
|
1738
|
+
const backendOnlyParams = getBackendOnlyParams(fieldSchema);
|
|
1739
|
+
// Respect isReturnedAtCreation for CREATE operations
|
|
1740
|
+
if (options?.respectIsReturnedAtCreation &&
|
|
1741
|
+
options?.operationType === CoreResourceOperation.CREATE &&
|
|
1742
|
+
backendOnlyParams?.isReturnedAtCreation) {
|
|
1743
|
+
// Keep this field - it's returned at creation
|
|
1744
|
+
rebuiltShape[fieldName] = fieldSchema;
|
|
1745
|
+
continue;
|
|
1746
|
+
}
|
|
1747
|
+
// Strip this backend-only field
|
|
1748
|
+
omitObj[fieldName] = true;
|
|
1749
|
+
}
|
|
1750
|
+
else {
|
|
1751
|
+
// Recursively strip from nested objects/arrays
|
|
1752
|
+
const strippedFieldSchema = this.stripBackendOnlyFields(fieldSchema, options);
|
|
1753
|
+
rebuiltShape[fieldName] = strippedFieldSchema;
|
|
1754
|
+
didRebuildNestedField = didRebuildNestedField || strippedFieldSchema !== fieldSchema;
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
if (Object.keys(omitObj).length > 0 || didRebuildNestedField) {
|
|
1758
|
+
return this.rebuildObjectSchema(schema, rebuiltShape, {
|
|
1759
|
+
preserveChecks: Object.keys(omitObj).length === 0,
|
|
1760
|
+
});
|
|
1761
|
+
}
|
|
1762
|
+
return schema;
|
|
1763
|
+
}
|
|
1764
|
+
// For other schema types (primitives, etc.), return as-is
|
|
1765
|
+
return schema;
|
|
1766
|
+
}
|
|
1767
|
+
/**
|
|
1768
|
+
* Transform z.date() → z.coerce.date() recursively for API/WebSocket/Queue DTOs.
|
|
1769
|
+
*
|
|
1770
|
+
* This utility is used to create schemas suitable for parsing API responses/requests
|
|
1771
|
+
* where dates come as ISO strings and need to be coerced to Date objects.
|
|
1772
|
+
*
|
|
1773
|
+
* Use this when parsing data from:
|
|
1774
|
+
* - HTTP API responses (JSON with date strings)
|
|
1775
|
+
* - WebSocket messages
|
|
1776
|
+
* - Queue messages
|
|
1777
|
+
* - Any external data source where dates are serialized as strings
|
|
1778
|
+
*
|
|
1779
|
+
* @param schema - Schema to transform (typically a database/internal schema with z.date())
|
|
1780
|
+
* @returns New schema with coerced dates (z.coerce.date()) suitable for API parsing
|
|
1781
|
+
*
|
|
1782
|
+
* @example
|
|
1783
|
+
* ```typescript
|
|
1784
|
+
* // Database schema uses z.date()
|
|
1785
|
+
* const dbSchema = z.object({ createdAt: z.date() });
|
|
1786
|
+
*
|
|
1787
|
+
* // Create API parsing schema
|
|
1788
|
+
* const apiSchema = ResourcesConfigOperationsDtosBuilderUtils.createApiParsingSchema(dbSchema);
|
|
1789
|
+
*
|
|
1790
|
+
* // Now can parse API response with date strings
|
|
1791
|
+
* const data = apiSchema.parse({ createdAt: "2024-01-01T00:00:00Z" }); // Works!
|
|
1792
|
+
* ```
|
|
1793
|
+
*/
|
|
1794
|
+
static createApiParsingSchema(schema) {
|
|
1795
|
+
return this.applyDateCoercion(schema);
|
|
1796
|
+
}
|
|
1797
|
+
/**
|
|
1798
|
+
* Transform z.date() → z.coerce.date() recursively for API/WebSocket/Queue DTOs.
|
|
1799
|
+
*
|
|
1800
|
+
* @param schema - Schema to transform
|
|
1801
|
+
* @returns New schema with coerced dates
|
|
1802
|
+
*/
|
|
1803
|
+
static applyDateCoercion(schema) {
|
|
1804
|
+
// Handle discriminated unions - transform dates in all variants
|
|
1805
|
+
const zodType = getZodType(schema);
|
|
1806
|
+
if (zodType === 'union') {
|
|
1807
|
+
const discriminator = getZodDefStringProperty(schema, 'discriminator');
|
|
1808
|
+
const unionOptions = getZodDefArrayProperty(schema, 'options');
|
|
1809
|
+
if (discriminator && unionOptions && unionOptions.length > 0) {
|
|
1810
|
+
const transformedOptions = unionOptions.map((option) => this.applyDateCoercion(option));
|
|
1811
|
+
if (transformedOptions.length >= 2) {
|
|
1812
|
+
return z.discriminatedUnion(discriminator, transformedOptions);
|
|
1813
|
+
}
|
|
1814
|
+
else if (transformedOptions.length === 1) {
|
|
1815
|
+
return transformedOptions[0];
|
|
1816
|
+
}
|
|
1817
|
+
}
|
|
1818
|
+
return schema;
|
|
1819
|
+
}
|
|
1820
|
+
// Handle arrays - transform dates in array element schema
|
|
1821
|
+
if (isZodArray(schema)) {
|
|
1822
|
+
// ZodArray stores element schema in _def.element (not _def.type)
|
|
1823
|
+
const elementSchema = getZodDefProperty(schema, 'element');
|
|
1824
|
+
return z.array(this.applyDateCoercion(elementSchema));
|
|
1825
|
+
}
|
|
1826
|
+
// Handle optional/nullable/default wrappers - unwrap, transform, rewrap
|
|
1827
|
+
if (isZodOptional(schema)) {
|
|
1828
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1829
|
+
return this.applyDateCoercion(innerSchema).optional();
|
|
1830
|
+
}
|
|
1831
|
+
if (hasZodType(schema, 'nullable')) {
|
|
1832
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1833
|
+
return this.applyDateCoercion(innerSchema).nullable();
|
|
1834
|
+
}
|
|
1835
|
+
if (isZodDefault(schema)) {
|
|
1836
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1837
|
+
const defaultValue = getZodDefProperty(schema, 'defaultValue');
|
|
1838
|
+
return this.applyDateCoercion(innerSchema).default(defaultValue);
|
|
1839
|
+
}
|
|
1840
|
+
// Handle pipe/refine - unwrap, transform, rewrap
|
|
1841
|
+
if (hasZodType(schema, 'pipe') || hasZodType(schema, 'refine')) {
|
|
1842
|
+
const innerSchema = getZodDefProperty(schema, 'schema');
|
|
1843
|
+
const transformed = this.applyDateCoercion(innerSchema);
|
|
1844
|
+
// Reapply pipe/refine - this is complex, for now just transform inner schema
|
|
1845
|
+
// Full pipe/refine preservation would require extracting all pipe steps
|
|
1846
|
+
return transformed;
|
|
1847
|
+
}
|
|
1848
|
+
// Handle date - transform to coerce.date
|
|
1849
|
+
if (hasZodType(schema, 'date')) {
|
|
1850
|
+
// Always transform to coerce.date for DTOs (API/WebSocket/Queue communication)
|
|
1851
|
+
// This allows string dates from JSON to be coerced to Date objects
|
|
1852
|
+
return z.coerce.date();
|
|
1853
|
+
}
|
|
1854
|
+
// Handle objects - transform dates in shape
|
|
1855
|
+
if (isZodObject(schema)) {
|
|
1856
|
+
const shape = getZodObjectShape(schema);
|
|
1857
|
+
const transformedShape = {};
|
|
1858
|
+
let didTransformAnyField = false;
|
|
1859
|
+
for (const [fieldName, fieldSchema] of Object.entries(shape)) {
|
|
1860
|
+
const transformedFieldSchema = this.applyDateCoercion(fieldSchema);
|
|
1861
|
+
transformedShape[fieldName] = transformedFieldSchema;
|
|
1862
|
+
didTransformAnyField = didTransformAnyField || transformedFieldSchema !== fieldSchema;
|
|
1863
|
+
}
|
|
1864
|
+
if (!didTransformAnyField) {
|
|
1865
|
+
return schema;
|
|
1866
|
+
}
|
|
1867
|
+
return this.rebuildObjectSchema(schema, transformedShape);
|
|
1868
|
+
}
|
|
1869
|
+
// For other schema types (primitives, etc.), return as-is
|
|
1870
|
+
return schema;
|
|
1871
|
+
}
|
|
1872
|
+
/**
|
|
1873
|
+
* Extract summary fields (isSummaryField decorator) from schema.
|
|
1874
|
+
* Handles discriminated unions by extracting from each variant.
|
|
1875
|
+
*
|
|
1876
|
+
* @param schema - Schema to extract from
|
|
1877
|
+
* @returns New schema with only summary fields
|
|
1878
|
+
*/
|
|
1879
|
+
static extractSummaryFields(schema) {
|
|
1880
|
+
// Handle discriminated unions - extract summary from each variant
|
|
1881
|
+
const zodType = getZodType(schema);
|
|
1882
|
+
if (zodType === 'union') {
|
|
1883
|
+
const discriminator = getZodDefStringProperty(schema, 'discriminator');
|
|
1884
|
+
const unionOptions = getZodDefArrayProperty(schema, 'options');
|
|
1885
|
+
if (discriminator && unionOptions && unionOptions.length > 0) {
|
|
1886
|
+
// Use ResourcesSummaryUtils.deriveSummarySchemaForDiscriminatedUnion if all options are objects
|
|
1887
|
+
const allAreObjects = unionOptions.every(opt => isZodObject(opt));
|
|
1888
|
+
if (allAreObjects) {
|
|
1889
|
+
try {
|
|
1890
|
+
return ResourcesSummaryUtils.deriveSummarySchemaForDiscriminatedUnion(schema, {
|
|
1891
|
+
discriminatorField: discriminator,
|
|
1892
|
+
withoutInheritanceDiscriminatorFieldValues: []
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
catch {
|
|
1896
|
+
// Fallback: extract from each variant individually (see lines below)
|
|
1897
|
+
}
|
|
1898
|
+
}
|
|
1899
|
+
// Extract summary from each variant and rebuild union
|
|
1900
|
+
const summaryOptions = unionOptions.map((option) => this.extractSummaryFields(option)).filter(opt => opt !== null && opt !== undefined);
|
|
1901
|
+
if (summaryOptions.length >= 2) {
|
|
1902
|
+
return z.discriminatedUnion(discriminator, summaryOptions);
|
|
1903
|
+
}
|
|
1904
|
+
else if (summaryOptions.length === 1) {
|
|
1905
|
+
return summaryOptions[0];
|
|
1906
|
+
}
|
|
1907
|
+
}
|
|
1908
|
+
return schema;
|
|
1909
|
+
}
|
|
1910
|
+
// Handle arrays - extract summary from array element schema
|
|
1911
|
+
if (isZodArray(schema)) {
|
|
1912
|
+
// ZodArray stores element schema in _def.element (not _def.type)
|
|
1913
|
+
const elementSchema = getZodDefProperty(schema, 'element');
|
|
1914
|
+
return z.array(this.extractSummaryFields(elementSchema));
|
|
1915
|
+
}
|
|
1916
|
+
// Handle optional/nullable/default wrappers - unwrap, extract, rewrap
|
|
1917
|
+
if (isZodOptional(schema)) {
|
|
1918
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1919
|
+
return this.extractSummaryFields(innerSchema).optional();
|
|
1920
|
+
}
|
|
1921
|
+
if (hasZodType(schema, 'nullable')) {
|
|
1922
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1923
|
+
return this.extractSummaryFields(innerSchema).nullable();
|
|
1924
|
+
}
|
|
1925
|
+
if (isZodDefault(schema)) {
|
|
1926
|
+
const innerSchema = getZodDefProperty(schema, 'innerType');
|
|
1927
|
+
const defaultValue = getZodDefProperty(schema, 'defaultValue');
|
|
1928
|
+
return this.extractSummaryFields(innerSchema).default(defaultValue);
|
|
1929
|
+
}
|
|
1930
|
+
// Handle objects - use ResourcesSummaryUtils.deriveSummarySchema
|
|
1931
|
+
if (isZodObject(schema)) {
|
|
1932
|
+
try {
|
|
1933
|
+
const summarySchema = ResourcesSummaryUtils.deriveSummarySchema(schema, {
|
|
1934
|
+
includeId: true,
|
|
1935
|
+
includeForeignKeys: false
|
|
1936
|
+
});
|
|
1937
|
+
// Apply date coercion to summary schema
|
|
1938
|
+
return this.applyDateCoercion(summarySchema);
|
|
1939
|
+
}
|
|
1940
|
+
catch (error) {
|
|
1941
|
+
throw new Error(`Failed to derive summary schema for object: ${error instanceof Error ? error.message : String(error)}`);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
// For other schema types (primitives, etc.), return as-is
|
|
1945
|
+
return schema;
|
|
1946
|
+
}
|
|
1947
|
+
/**
|
|
1948
|
+
* Add relationship placeholders to schema for context DTO.
|
|
1949
|
+
* Placeholders are optional fields: parentResourceType?: { _id: string }
|
|
1950
|
+
*
|
|
1951
|
+
* @param schema - Base schema
|
|
1952
|
+
* @param relationships - Resource relationships configuration
|
|
1953
|
+
* @param registry - Resource registry for type resolution
|
|
1954
|
+
* @returns Schema with relationship placeholders added
|
|
1955
|
+
*/
|
|
1956
|
+
static addRelationshipPlaceholders(schema, relationships, registry) {
|
|
1957
|
+
// Only add placeholders to object schemas
|
|
1958
|
+
if (!isZodObject(schema)) {
|
|
1959
|
+
return schema;
|
|
1960
|
+
}
|
|
1961
|
+
const shape = getZodObjectShape(schema);
|
|
1962
|
+
const placeholderFields = {};
|
|
1963
|
+
// Add parent relationship placeholders (includes self-refs acting as parents)
|
|
1964
|
+
const parentDirRels = getParentDirectionRelationships(relationships);
|
|
1965
|
+
for (const relationship of parentDirRels) {
|
|
1966
|
+
if (relationship.contextPolicy?.enabled === false) {
|
|
1967
|
+
continue;
|
|
1968
|
+
}
|
|
1969
|
+
const fieldName = this.getRelationshipObjectFieldName(relationship, relationship.resourceType1, ResourceRelationshipCardinality.ONE, registry);
|
|
1970
|
+
// Only add if field doesn't already exist (avoid conflicts)
|
|
1971
|
+
if (!shape[fieldName]) {
|
|
1972
|
+
// Placeholder format: parentResourceType?: { _id: string }
|
|
1973
|
+
placeholderFields[fieldName] = z.object({
|
|
1974
|
+
_id: z.string()
|
|
1975
|
+
}).optional();
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
// Add child relationship placeholders (includes self-refs acting as children)
|
|
1979
|
+
// Children with contextPolicy enabled are populated in CONTEXT mode
|
|
1980
|
+
const childDirRels = getChildDirectionRelationships(relationships);
|
|
1981
|
+
for (const relationship of childDirRels) {
|
|
1982
|
+
// Skip relationships without contextPolicy or with disabled contextPolicy
|
|
1983
|
+
if (!relationship.contextPolicy) {
|
|
1984
|
+
continue;
|
|
1985
|
+
}
|
|
1986
|
+
// Skip if contextPolicy is explicitly disabled
|
|
1987
|
+
if (relationship.contextPolicy.enabled === false) {
|
|
1988
|
+
continue;
|
|
1989
|
+
}
|
|
1990
|
+
const fieldName = this.getRelationshipObjectFieldName(relationship, relationship.resourceType2, relationship.cardinality2, registry);
|
|
1991
|
+
const isOneToOne = isOneToOneCardinality(relationship.cardinality2);
|
|
1992
|
+
// Only add if field doesn't already exist (avoid conflicts)
|
|
1993
|
+
if (!shape[fieldName]) {
|
|
1994
|
+
// Use a passthrough schema to allow any fields from the child
|
|
1995
|
+
// Zod 4 requires key and value schemas for z.record
|
|
1996
|
+
const childPlaceholder = z.record(z.string(), z.any());
|
|
1997
|
+
if (isOneToOne) {
|
|
1998
|
+
// 1:1: single object (optional)
|
|
1999
|
+
placeholderFields[fieldName] = childPlaceholder.optional();
|
|
2000
|
+
}
|
|
2001
|
+
else {
|
|
2002
|
+
// 1:many: array of objects (optional)
|
|
2003
|
+
placeholderFields[fieldName] = z.array(childPlaceholder).optional();
|
|
2004
|
+
}
|
|
2005
|
+
}
|
|
2006
|
+
}
|
|
2007
|
+
// Merge placeholders with existing schema
|
|
2008
|
+
if (Object.keys(placeholderFields).length > 0) {
|
|
2009
|
+
return schema.extend(placeholderFields);
|
|
2010
|
+
}
|
|
2011
|
+
return schema;
|
|
2012
|
+
}
|
|
2013
|
+
/**
|
|
2014
|
+
* Transform object dates from strings to Date objects (for incoming requests).
|
|
2015
|
+
* Uses DTO schema to identify which fields are dates.
|
|
2016
|
+
*
|
|
2017
|
+
* @param data - Object to transform
|
|
2018
|
+
* @param dtoSchema - DTO schema (with z.coerce.date() fields)
|
|
2019
|
+
* @returns Transformed object with Date objects
|
|
2020
|
+
*/
|
|
2021
|
+
static transformRequestDates(data, dtoSchema) {
|
|
2022
|
+
if (!data || typeof data !== 'object') {
|
|
2023
|
+
return data;
|
|
2024
|
+
}
|
|
2025
|
+
// Handle arrays
|
|
2026
|
+
if (Array.isArray(data)) {
|
|
2027
|
+
const zodType = getZodType(dtoSchema);
|
|
2028
|
+
if (zodType === 'array') {
|
|
2029
|
+
// ZodArray stores element schema in _def.element (not _def.type)
|
|
2030
|
+
const elementSchema = getZodDefProperty(dtoSchema, 'element');
|
|
2031
|
+
if (elementSchema) {
|
|
2032
|
+
return data.map(item => this.transformRequestDates(item, elementSchema));
|
|
2033
|
+
}
|
|
2034
|
+
}
|
|
2035
|
+
return data;
|
|
2036
|
+
}
|
|
2037
|
+
// Handle objects
|
|
2038
|
+
if (isZodObject(dtoSchema)) {
|
|
2039
|
+
const shape = getZodObjectShape(dtoSchema);
|
|
2040
|
+
const transformed = {};
|
|
2041
|
+
for (const [key, value] of Object.entries(data)) {
|
|
2042
|
+
const fieldSchema = shape[key];
|
|
2043
|
+
if (fieldSchema) {
|
|
2044
|
+
// Check if field is a date (coerced or regular)
|
|
2045
|
+
const zodType = getZodType(fieldSchema);
|
|
2046
|
+
if (zodType === 'date' || hasZodType(fieldSchema, 'date')) {
|
|
2047
|
+
// Transform string to Date
|
|
2048
|
+
if (typeof value === 'string') {
|
|
2049
|
+
transformed[key] = new Date(value);
|
|
2050
|
+
}
|
|
2051
|
+
else {
|
|
2052
|
+
transformed[key] = value;
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
else {
|
|
2056
|
+
// Recursively transform nested objects/arrays
|
|
2057
|
+
transformed[key] = this.transformRequestDates(value, fieldSchema);
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
else {
|
|
2061
|
+
transformed[key] = value;
|
|
2062
|
+
}
|
|
2063
|
+
}
|
|
2064
|
+
return transformed;
|
|
2065
|
+
}
|
|
2066
|
+
return data;
|
|
2067
|
+
}
|
|
2068
|
+
/**
|
|
2069
|
+
* Transform object dates from Date objects to ISO strings (for outgoing responses).
|
|
2070
|
+
* Uses DTO schema to identify which fields are dates.
|
|
2071
|
+
*
|
|
2072
|
+
* @param data - Object to transform
|
|
2073
|
+
* @param dtoSchema - DTO schema (with z.coerce.date() fields)
|
|
2074
|
+
* @returns Transformed object with ISO string dates
|
|
2075
|
+
*/
|
|
2076
|
+
static transformResponseDates(data, dtoSchema) {
|
|
2077
|
+
if (!data || typeof data !== 'object') {
|
|
2078
|
+
return data;
|
|
2079
|
+
}
|
|
2080
|
+
// Handle arrays
|
|
2081
|
+
if (Array.isArray(data)) {
|
|
2082
|
+
const zodType = getZodType(dtoSchema);
|
|
2083
|
+
if (zodType === 'array') {
|
|
2084
|
+
// ZodArray stores element schema in _def.element (not _def.type)
|
|
2085
|
+
const elementSchema = getZodDefProperty(dtoSchema, 'element');
|
|
2086
|
+
if (elementSchema) {
|
|
2087
|
+
return data.map(item => this.transformResponseDates(item, elementSchema));
|
|
2088
|
+
}
|
|
2089
|
+
}
|
|
2090
|
+
return data;
|
|
2091
|
+
}
|
|
2092
|
+
// Handle objects
|
|
2093
|
+
if (isZodObject(dtoSchema)) {
|
|
2094
|
+
const shape = getZodObjectShape(dtoSchema);
|
|
2095
|
+
const transformed = {};
|
|
2096
|
+
for (const [key, value] of Object.entries(data)) {
|
|
2097
|
+
const fieldSchema = shape[key];
|
|
2098
|
+
if (fieldSchema) {
|
|
2099
|
+
// Check if field is a date (coerced or regular)
|
|
2100
|
+
const zodType = getZodType(fieldSchema);
|
|
2101
|
+
if (zodType === 'date' || hasZodType(fieldSchema, 'date')) {
|
|
2102
|
+
// Transform Date to ISO string
|
|
2103
|
+
if (value instanceof Date) {
|
|
2104
|
+
transformed[key] = value.toISOString();
|
|
2105
|
+
}
|
|
2106
|
+
else {
|
|
2107
|
+
transformed[key] = value;
|
|
2108
|
+
}
|
|
2109
|
+
}
|
|
2110
|
+
else {
|
|
2111
|
+
// Recursively transform nested objects/arrays
|
|
2112
|
+
transformed[key] = this.transformResponseDates(value, fieldSchema);
|
|
2113
|
+
}
|
|
2114
|
+
}
|
|
2115
|
+
else {
|
|
2116
|
+
transformed[key] = value;
|
|
2117
|
+
}
|
|
2118
|
+
}
|
|
2119
|
+
return transformed;
|
|
2120
|
+
}
|
|
2121
|
+
return data;
|
|
2122
|
+
}
|
|
2123
|
+
/**
|
|
2124
|
+
* Select the appropriate response DTO based on DataMode.
|
|
2125
|
+
* Used by both backend and frontend services to ensure consistent DTO selection.
|
|
2126
|
+
*
|
|
2127
|
+
* IMPORTANT: Handles structure differences between single-item and collection operations:
|
|
2128
|
+
* - Single item (READ, CREATE, etc.): Returns item schema
|
|
2129
|
+
* - Collection (LIST, SEARCH): Returns pagination wrapper schema
|
|
2130
|
+
*
|
|
2131
|
+
* Priority:
|
|
2132
|
+
* 1. If operation has variantKey → return operation.responseDto (already variant-specific)
|
|
2133
|
+
* 2. If DataMode is SUMMARY and summaryDto exists → return summaryDto (wrapped for LIST/SEARCH)
|
|
2134
|
+
* 3. If DataMode is CONTEXT and contextDto exists → return contextDto (wrapped for LIST/SEARCH)
|
|
2135
|
+
* 4. Otherwise → return responseDto (default for RAW mode)
|
|
2136
|
+
*
|
|
2137
|
+
* @param operation - The resource operation configuration
|
|
2138
|
+
* @param dataMode - The data mode (defaults to RAW if not specified)
|
|
2139
|
+
* @returns The selected DTO schema, or null/undefined if not available
|
|
2140
|
+
*/
|
|
2141
|
+
static selectResponseDto(operation, dataMode) {
|
|
2142
|
+
if (!operation) {
|
|
2143
|
+
return null;
|
|
2144
|
+
}
|
|
2145
|
+
// For variant operations (with variantKey), responseDto is already correct
|
|
2146
|
+
// (built in buildAllOperationDtos with correct structure for LIST/SEARCH)
|
|
2147
|
+
if (operation.variantKey) {
|
|
2148
|
+
return operation.responseDto || null;
|
|
2149
|
+
}
|
|
2150
|
+
const effectiveDataMode = dataMode || DataMode.RAW;
|
|
2151
|
+
const effectiveOperation = operation.resourceOperationLike || operation.operationIdentifier;
|
|
2152
|
+
const isListOrSearch = effectiveOperation === CoreResourceOperation.LIST
|
|
2153
|
+
|| effectiveOperation === CoreResourceOperation.SEARCH;
|
|
2154
|
+
// For default operations with dataMode specified, select and wrap appropriately
|
|
2155
|
+
if (effectiveDataMode === DataMode.SUMMARY && operation.summaryDto) {
|
|
2156
|
+
return isListOrSearch
|
|
2157
|
+
? this.wrapInPaginationStructure(operation.summaryDto)
|
|
2158
|
+
: operation.summaryDto;
|
|
2159
|
+
}
|
|
2160
|
+
if (effectiveDataMode === DataMode.CONTEXT && operation.contextDto) {
|
|
2161
|
+
return isListOrSearch
|
|
2162
|
+
? this.wrapInPaginationStructure(operation.contextDto)
|
|
2163
|
+
: operation.contextDto;
|
|
2164
|
+
}
|
|
2165
|
+
// Default to responseDto for RAW mode or when specific DTOs are not available
|
|
2166
|
+
return operation.responseDto || null;
|
|
2167
|
+
}
|
|
2168
|
+
/**
|
|
2169
|
+
* Wrap item schema in pagination structure for LIST/SEARCH operations
|
|
2170
|
+
* @param itemSchema - Schema for individual items
|
|
2171
|
+
* @returns Pagination wrapper schema
|
|
2172
|
+
*/
|
|
2173
|
+
static wrapInPaginationStructure(itemSchema) {
|
|
2174
|
+
return z.object({
|
|
2175
|
+
data: z.array(itemSchema),
|
|
2176
|
+
pagination: Resouces_PaginationResponseMetadataSchema
|
|
2177
|
+
});
|
|
2178
|
+
}
|
|
2179
|
+
}
|
|
2180
|
+
//# sourceMappingURL=resources-config-operations.dtos-builder.utils.js.map
|