@wildo-ai/saas-specifications 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assurance/external-framework-mapping.json +980 -0
- package/dist/esm/_core/brand/brand.family-aspects.d.ts +3 -0
- package/dist/esm/_core/brand/brand.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand.family-aspects.js +51 -0
- package/dist/esm/_core/brand/brand.family-aspects.js.map +1 -0
- package/dist/esm/_core/build-plan/build-plan.family-aspects.d.ts +3 -0
- package/dist/esm/_core/build-plan/build-plan.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/build-plan/build-plan.family-aspects.js +28 -0
- package/dist/esm/_core/build-plan/build-plan.family-aspects.js.map +1 -0
- package/dist/esm/_core/business-model-lite/business-model.family-aspects.d.ts +3 -0
- package/dist/esm/_core/business-model-lite/business-model.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/business-model-lite/business-model.family-aspects.js +21 -0
- package/dist/esm/_core/business-model-lite/business-model.family-aspects.js.map +1 -0
- package/dist/esm/_core/chart-view-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/chart-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/chart-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/compliance-document-candidate-generation.schemas.d.ts +85 -0
- package/dist/esm/_core/compliance-documents/compliance-document-candidate-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/compliance-documents/compliance-document-candidate-generation.schemas.js +41 -0
- package/dist/esm/_core/compliance-documents/compliance-document-candidate-generation.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts +168 -2
- package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.d.ts.map +1 -1
- package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js +98 -9
- package/dist/esm/_core/compliance-documents/compliance-document-candidate.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/compliance-documents.family-aspects.d.ts +12 -0
- package/dist/esm/_core/compliance-documents/compliance-documents.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/compliance-documents/compliance-documents.family-aspects.js +47 -0
- package/dist/esm/_core/compliance-documents/compliance-documents.family-aspects.js.map +1 -0
- package/dist/esm/_core/compliance-documents/document-fact-specification-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/compliance-documents/document-fact-specification-generation.schemas.js +8 -3
- package/dist/esm/_core/compliance-documents/document-fact-specification-generation.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/processor-register.family-aspects.d.ts +21 -0
- package/dist/esm/_core/compliance-documents/processor-register.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/compliance-documents/processor-register.family-aspects.js +40 -0
- package/dist/esm/_core/compliance-documents/processor-register.family-aspects.js.map +1 -0
- package/dist/esm/_core/composite-view-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/composite-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/composite-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan.family-aspects.d.ts +3 -0
- package/dist/esm/_core/domain-plan/domain-plan.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/domain-plan/domain-plan.family-aspects.js +32 -0
- package/dist/esm/_core/domain-plan/domain-plan.family-aspects.js.map +1 -0
- package/dist/esm/_core/execution-view-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/execution-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/execution-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/family-aspects.registry.d.ts +18 -0
- package/dist/esm/_core/family-aspects.registry.d.ts.map +1 -0
- package/dist/esm/_core/family-aspects.registry.js +60 -0
- package/dist/esm/_core/family-aspects.registry.js.map +1 -0
- package/dist/esm/_core/family-aspects.schemas.d.ts +122 -0
- package/dist/esm/_core/family-aspects.schemas.d.ts.map +1 -0
- package/dist/esm/_core/family-aspects.schemas.js +15 -0
- package/dist/esm/_core/family-aspects.schemas.js.map +1 -0
- package/dist/esm/_core/feature-drafts/capability-map-output-set-generation.schemas.d.ts +11 -11
- package/dist/esm/_core/feature-drafts/feature-drafts.family-aspects.d.ts +3 -0
- package/dist/esm/_core/feature-drafts/feature-drafts.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/feature-drafts/feature-drafts.family-aspects.js +25 -0
- package/dist/esm/_core/feature-drafts/feature-drafts.family-aspects.js.map +1 -0
- package/dist/esm/_core/flows-actors-view-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/flows-actors-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/flows-actors-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/frontend-component-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/frontend-component-specification.schemas.js +19 -1
- package/dist/esm/_core/frontend-component-specification.schemas.js.map +1 -1
- package/dist/esm/_core/full-custom-view-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/full-custom-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/full-custom-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/guidance-flow-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/guidance-flow-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/guidance-flow-specification.schemas.js +14 -0
- package/dist/esm/_core/guidance-flow-specification.schemas.js.map +1 -1
- package/dist/esm/_core/index.d.ts +2 -0
- package/dist/esm/_core/index.d.ts.map +1 -1
- package/dist/esm/_core/index.js +2 -0
- package/dist/esm/_core/index.js.map +1 -1
- package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts +22 -22
- package/dist/esm/_core/market/market.family-aspects.d.ts +9 -0
- package/dist/esm/_core/market/market.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/market/market.family-aspects.js +227 -0
- package/dist/esm/_core/market/market.family-aspects.js.map +1 -0
- package/dist/esm/_core/onboarding-view-specification.schemas.d.ts +11 -0
- package/dist/esm/_core/onboarding-view-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/onboarding-view-specification.schemas.js +14 -0
- package/dist/esm/_core/onboarding-view-specification.schemas.js.map +1 -1
- package/dist/esm/_core/placement-plan/placement-plan.family-aspects.d.ts +3 -0
- package/dist/esm/_core/placement-plan/placement-plan.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/placement-plan/placement-plan.family-aspects.js +31 -0
- package/dist/esm/_core/placement-plan/placement-plan.family-aspects.js.map +1 -0
- package/dist/esm/_core/requirements/requirements.family-aspects.d.ts +9 -0
- package/dist/esm/_core/requirements/requirements.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/requirements/requirements.family-aspects.js +40 -0
- package/dist/esm/_core/requirements/requirements.family-aspects.js.map +1 -0
- package/dist/esm/_core/resource-specification.schemas.d.ts +22 -0
- package/dist/esm/_core/resource-specification.schemas.d.ts.map +1 -1
- package/dist/esm/_core/resource-specification.schemas.js.map +1 -1
- package/dist/esm/_core/roadmap/roadmap.family-aspects.d.ts +3 -0
- package/dist/esm/_core/roadmap/roadmap.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/roadmap/roadmap.family-aspects.js +26 -0
- package/dist/esm/_core/roadmap/roadmap.family-aspects.js.map +1 -0
- package/dist/esm/_core/vision/vision.family-aspects.d.ts +11 -0
- package/dist/esm/_core/vision/vision.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/vision/vision.family-aspects.js +63 -0
- package/dist/esm/_core/vision/vision.family-aspects.js.map +1 -0
- package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts +188 -33
- package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js +158 -57
- package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.d.ts +38 -4
- package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js +37 -3
- package/dist/esm/application-creation/application-specification-family-identity.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/document-facts.family-aspects.d.ts +12 -0
- package/dist/esm/application-creation/document-facts.family-aspects.d.ts.map +1 -0
- package/dist/esm/application-creation/document-facts.family-aspects.js +37 -0
- package/dist/esm/application-creation/document-facts.family-aspects.js.map +1 -0
- package/dist/esm/application-creation/document-release-policy.family-aspects.d.ts +3 -0
- package/dist/esm/application-creation/document-release-policy.family-aspects.d.ts.map +1 -0
- package/dist/esm/application-creation/document-release-policy.family-aspects.js +23 -0
- package/dist/esm/application-creation/document-release-policy.family-aspects.js.map +1 -0
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +93 -62
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js +114 -59
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.d.ts +2 -0
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.js +2 -0
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation.exports.d.ts +11 -0
- package/dist/esm/application-creation.exports.d.ts.map +1 -1
- package/dist/esm/application-creation.exports.js +11 -0
- package/dist/esm/application-creation.exports.js.map +1 -1
- package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts +976 -2
- package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-authority-basis.definitions.js +2026 -61
- package/dist/esm/assurance/assurance-authority-basis.definitions.js.map +1 -1
- package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts +1 -0
- package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-document-system.definitions.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-document-system.definitions.js +18 -3
- package/dist/esm/assurance/assurance-document-system.definitions.js.map +1 -1
- package/dist/esm/assurance/assurance-document-system.schemas.d.ts +32 -2
- package/dist/esm/assurance/assurance-document-system.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-document-system.schemas.js +32 -2
- package/dist/esm/assurance/assurance-document-system.schemas.js.map +1 -1
- package/dist/esm/assurance/assurance-external-framework-mapping.d.ts +90 -0
- package/dist/esm/assurance/assurance-external-framework-mapping.d.ts.map +1 -0
- package/dist/esm/assurance/assurance-external-framework-mapping.js +134 -0
- package/dist/esm/assurance/assurance-external-framework-mapping.js.map +1 -0
- package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts +71 -1
- package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-objective-catalog.definitions.js +545 -5
- package/dist/esm/assurance/assurance-objective-catalog.definitions.js.map +1 -1
- package/dist/esm/assurance/assurance-program-generation.schemas.d.ts +141 -0
- package/dist/esm/assurance/assurance-program-generation.schemas.d.ts.map +1 -0
- package/dist/esm/assurance/assurance-program-generation.schemas.js +377 -0
- package/dist/esm/assurance/assurance-program-generation.schemas.js.map +1 -0
- package/dist/esm/assurance/assurance-program.family-aspects.d.ts +13 -0
- package/dist/esm/assurance/assurance-program.family-aspects.d.ts.map +1 -0
- package/dist/esm/assurance/assurance-program.family-aspects.js +16 -0
- package/dist/esm/assurance/assurance-program.family-aspects.js.map +1 -0
- package/dist/esm/assurance/assurance-program.schemas.d.ts +30 -6
- package/dist/esm/assurance/assurance-program.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-program.schemas.js +29 -6
- package/dist/esm/assurance/assurance-program.schemas.js.map +1 -1
- package/dist/esm/assurance/assurance-source-registry.definitions.d.ts +1 -0
- package/dist/esm/assurance/assurance-source-registry.definitions.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-source-registry.definitions.js +12 -0
- package/dist/esm/assurance/assurance-source-registry.definitions.js.map +1 -1
- package/dist/esm/assurance/assurance-sources.schemas.d.ts +76 -0
- package/dist/esm/assurance/assurance-sources.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-sources.schemas.js +59 -0
- package/dist/esm/assurance/assurance-sources.schemas.js.map +1 -1
- package/dist/esm/assurance/document-publication.family-aspects.d.ts +29 -0
- package/dist/esm/assurance/document-publication.family-aspects.d.ts.map +1 -0
- package/dist/esm/assurance/document-publication.family-aspects.js +48 -0
- package/dist/esm/assurance/document-publication.family-aspects.js.map +1 -0
- package/dist/esm/assurance.exports.d.ts +2 -0
- package/dist/esm/assurance.exports.d.ts.map +1 -1
- package/dist/esm/assurance.exports.js +2 -0
- package/dist/esm/assurance.exports.js.map +1 -1
- package/dist/esm/companion-exports.d.ts +19 -2
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js +2 -0
- package/dist/esm/engine/applications/resources/application-api-keys.resource.specification.js.map +1 -1
- package/dist/esm/engine/applications/resources/application-metadata.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js +3 -1
- package/dist/esm/engine/applications/resources/application-metadata.resource.specification.js.map +1 -1
- package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js +3 -1
- package/dist/esm/engine/applications/resources/application-oauth-clients.resource.specification.js.map +1 -1
- package/dist/esm/engine/applications/resources/application-versions.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/applications/resources/application-versions.resource.specification.js +3 -1
- package/dist/esm/engine/applications/resources/application-versions.resource.specification.js.map +1 -1
- package/dist/esm/engine/applications/resources/applications.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/applications/resources/applications.resource.specification.js +3 -1
- package/dist/esm/engine/applications/resources/applications.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.d.ts +36 -0
- package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.d.ts.map +1 -0
- package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js +193 -0
- package/dist/esm/engine/auth/resources/consumable-tokens.resource.specification.js.map +1 -0
- package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.d.ts +1 -1
- package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/oauth-consent-grants.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/organization-api-keys.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js +3 -1
- package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.d.ts +1 -1
- package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/platform-access-grants.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/scim-provisioning-config.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/scim-tokens.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/siem-delivery-dlq.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js +6 -4
- package/dist/esm/engine/auth/resources/siem-export-config.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/sso-config.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/sso-config.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/sso-config.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/sso-connections.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/auth/resources/sso-connections.resource.specification.js +2 -0
- package/dist/esm/engine/auth/resources/sso-connections.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.d.ts +2 -2
- package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js +2 -0
- package/dist/esm/engine/billing/resources/billing-accounts.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/credit-pools.resource.specification.d.ts +8 -8
- package/dist/esm/engine/billing/resources/credit-pools.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js +2 -0
- package/dist/esm/engine/billing/resources/credit-pools.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.d.ts +2 -2
- package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js +2 -0
- package/dist/esm/engine/billing/resources/invoice-refs.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/prices.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/prices.resource.specification.js +3 -1
- package/dist/esm/engine/billing/resources/prices.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/products.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/products.resource.specification.js +3 -1
- package/dist/esm/engine/billing/resources/products.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/promotions.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/promotions.resource.specification.js +2 -0
- package/dist/esm/engine/billing/resources/promotions.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/referrals.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/referrals.resource.specification.js +3 -1
- package/dist/esm/engine/billing/resources/referrals.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/subscriptions.resource.specification.d.ts +6 -6
- package/dist/esm/engine/billing/resources/subscriptions.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js +2 -0
- package/dist/esm/engine/billing/resources/subscriptions.resource.specification.js.map +1 -1
- package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts +6 -6
- package/dist/esm/engine/billing/resources/usage-records.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/billing/resources/usage-records.resource.specification.js +2 -0
- package/dist/esm/engine/billing/resources/usage-records.resource.specification.js.map +1 -1
- package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js +2 -0
- package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js.map +1 -1
- package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
- package/dist/esm/engine/engine-resource-specifications.registry.js +5 -0
- package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
- package/dist/esm/engine/engine-resource-sub-domain.d.ts +63 -0
- package/dist/esm/engine/engine-resource-sub-domain.d.ts.map +1 -0
- package/dist/esm/engine/engine-resource-sub-domain.js +87 -0
- package/dist/esm/engine/engine-resource-sub-domain.js.map +1 -0
- package/dist/esm/engine/errors/error-messages.specification.d.ts.map +1 -1
- package/dist/esm/engine/errors/error-messages.specification.js +30 -1
- package/dist/esm/engine/errors/error-messages.specification.js.map +1 -1
- package/dist/esm/engine/features/resources/application-features.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/features/resources/application-features.resource.specification.js +2 -0
- package/dist/esm/engine/features/resources/application-features.resource.specification.js.map +1 -1
- package/dist/esm/engine/features/resources/organization-features.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/features/resources/organization-features.resource.specification.js +2 -0
- package/dist/esm/engine/features/resources/organization-features.resource.specification.js.map +1 -1
- package/dist/esm/engine/features/resources/user-features.resource.specification.d.ts +1 -1
- package/dist/esm/engine/features/resources/user-features.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/features/resources/user-features.resource.specification.js +2 -0
- package/dist/esm/engine/features/resources/user-features.resource.specification.js.map +1 -1
- package/dist/esm/engine/files/resources/files.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/files/resources/files.resource.specification.js +2 -0
- package/dist/esm/engine/files/resources/files.resource.specification.js.map +1 -1
- package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.d.ts +3 -3
- package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js +12 -0
- package/dist/esm/engine/flows-actors/resources/a2a-push-delivery-log.resource.specification.js.map +1 -1
- package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.d.ts +3 -3
- package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js +2 -0
- package/dist/esm/engine/flows-actors/resources/a2a-token-budget-state.resource.specification.js.map +1 -1
- package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.d.ts +3 -3
- package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js +2 -0
- package/dist/esm/engine/flows-actors/resources/flow-actor-executions.resource.specification.js.map +1 -1
- package/dist/esm/engine/flows-actors/resources/flow-actor-tasks.resource.specification.d.ts +3 -3
- package/dist/esm/engine/flows-actors/resources/flow-actor-tasks.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/flows-actors/resources/flow-actor-tasks.resource.specification.js +3 -1
- package/dist/esm/engine/flows-actors/resources/flow-actor-tasks.resource.specification.js.map +1 -1
- package/dist/esm/engine/frontend-components/app/public-layout-main-container.frontend-component.specification.d.ts.map +1 -1
- package/dist/esm/engine/frontend-components/app/public-layout-main-container.frontend-component.specification.js +8 -3
- package/dist/esm/engine/frontend-components/app/public-layout-main-container.frontend-component.specification.js.map +1 -1
- package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.d.ts +1 -1
- package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js +3 -0
- package/dist/esm/engine/guidance/resources/guidance-state.resource.specification.js.map +1 -1
- package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.d.ts +1 -1
- package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js +3 -0
- package/dist/esm/engine/guidance/resources/lifecycle-state.resource.specification.js.map +1 -1
- package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts +1 -1
- package/dist/esm/engine/guidance/resources/progression-state.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js +3 -0
- package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js.map +1 -1
- package/dist/esm/engine/index.d.ts +1 -0
- package/dist/esm/engine/index.d.ts.map +1 -1
- package/dist/esm/engine/index.js +1 -0
- package/dist/esm/engine/index.js.map +1 -1
- package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js +2 -0
- package/dist/esm/engine/infrastructure/resources/data-seed-runs.resource.specification.js.map +1 -1
- package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js +2 -0
- package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js.map +1 -1
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js +2 -0
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.js.map +1 -1
- package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js +2 -0
- package/dist/esm/engine/infrastructure/resources/job-payload-storage.resource.specification.js.map +1 -1
- package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js +2 -0
- package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js.map +1 -1
- package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.d.ts +1 -1
- package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js +3 -0
- package/dist/esm/engine/notifications/resources/notification-badges.resource.specification.js.map +1 -1
- package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js +2 -0
- package/dist/esm/engine/notifications/resources/webhook-config.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts +1 -1
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organization-notifications.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organization-preferences.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organization-profiles.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organization-unit-members.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-units.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organization-units.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organization-units.resource.specification.js.map +1 -1
- package/dist/esm/engine/organizations/resources/organizations.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/organizations/resources/organizations.resource.specification.js +2 -0
- package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/anonymous-users.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/anonymous-users.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-credentials.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/user-credentials.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-credentials.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/user-credentials.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-identity-links.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/user-identity-links.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/user-identity-links.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-preferences.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/user-preferences.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-profiles.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/user-profiles.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-profiles.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/user-profiles.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.d.ts +1 -1
- package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/user-self-profiles.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/user-self.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/user-self.resource.specification.js +3 -1
- package/dist/esm/engine/users/resources/user-self.resource.specification.js.map +1 -1
- package/dist/esm/engine/users/resources/users.resource.specification.d.ts.map +1 -1
- package/dist/esm/engine/users/resources/users.resource.specification.js +2 -0
- package/dist/esm/engine/users/resources/users.resource.specification.js.map +1 -1
- package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.d.ts +5 -0
- package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.d.ts.map +1 -1
- package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js +385 -9
- package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js.map +1 -1
- package/dist/esm/technical-documentation/technical-documentation-units.schemas.js +1 -1
- package/dist/esm/technical-documentation/technical-documentation-units.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +8 -8
- package/dist/esm/.builder.pid +0 -9
- package/dist/esm/_core/business-coverage/coverage-findings-validation.d.ts +0 -0
- package/dist/esm/_core/business-coverage/coverage-findings-validation.d.ts.map +0 -0
- package/dist/esm/_core/business-coverage/coverage-findings-validation.js.map +0 -0
- package/dist/esm/_core/business-coverage/coverage-findings.schemas.d.ts +0 -0
- package/dist/esm/_core/business-coverage/coverage-findings.schemas.d.ts.map +0 -0
- package/dist/esm/_core/business-coverage/coverage-findings.schemas.js.map +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"promotions.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/promotions.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,IAAI,qBAAqB,EAC1D,gCAAgC,IAAI,oBAAoB,GACzD,MAAM,8BAA8B,CAAC;AACtC,OAA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AE,2DAA2D,EAAE,SAAS,EAAE,qCAAqC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,6EAA6E,EAAE,EAAE,EAAE;YAC7S,QAAQ,EAAE,EAAE,OAAO,EAAE,8EAA8E,EAAE,SAAS,EAAE,kCAAkC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,iGAAiG,EAAE,EAAE,EAAE;SACxU;KACF;IACD,KAAK,EAAE;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,qEAAqE,EAAE,SAAS,EAAE,qDAAqD,EAAE;QAC/J,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,+DAA+D,EAAE,SAAS,EAAE,kCAAkC,EAAE;QACtI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,oHAAoH,EAAE,SAAS,EAAE,oCAAoC,EAAE;QAChN,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,qGAAqG,EAAE,SAAS,EAAE,gDAAgD,EAAE;KACnN;CACF,CAAC,CACH,CAAC","sourcesContent":["import {\n promotionsAdminResourceUIBehavior as promotionsAdminSource,\n promotionsMainResourceUIBehavior as promotionsMainSource,\n} from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n DiscountType,\n PromotionType,\n PromotionDuration,\n PromotionSchema,\n Promotion_Operations,\n ResourcePrimaryScope,\n promotionsResourceConfiguration_InitializationFactory as promotionsFactory,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\n\ntype Cfg = ReturnType<typeof promotionsFactory>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = Cfg['mainSchema'];\nconst promotionsMainUI = promotionsMainSource as ResourceUIBehaviorConfig<Custom, Core, Main>;\nconst promotionsAdminUI = promotionsAdminSource as ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nconst promotionsBase = resourceSpecification<Custom, Core, Main>(\n promotionsFactory,\n PromotionSchema,\n ({ schemaShape }) => ({\n purpose: 'Promotional instrument (coupon, promotion code, referral program, deal) with discount mechanics, validity window, and redemption counters — synced to the provider where applicable.',\n businessRole: 'Feeds checkout `promotionCode` validation and subscription discount objects; distinct from `REFERRALS` relationship rows.',\n lifecycleRole: 'Authored by operators; `APPLY` validates at purchase; `DEACTIVATE` ends new redemptions while historical subs may retain benefits per policy.',\n audience: LabelAudience.ADMIN,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'PromotionSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'promotionsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName: 'PROMOTIONS' },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'Promotion_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSources: [\n { packageName: '@wildo-ai/presets-components', exportName: 'promotionsMainResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n { packageName: '@wildo-ai/presets-components', exportName: 'promotionsAdminResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Promotion document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n name: schemaShape.name.stringSpec({ meaning: 'Human label in admin and support tools.', importance: FieldSemanticImportance.PRIMARY }),\n description: schemaShape.description.stringSpec({ meaning: 'Longer explanation of the offer and legal/restriction copy when needed.' }),\n type: schemaShape.type.enumSpec({\n meaning: 'Kind of promotion surface in catalog and checkout.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'PromotionType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [PromotionType.COUPON]: { meaning: 'Checkout coupon code style.' },\n [PromotionType.PROMOTION_CODE]: { meaning: 'Provider-style promotion code.' },\n [PromotionType.REFERRAL]: { meaning: 'Referral-driven automatic benefit (cross-link to referral program when present).' },\n [PromotionType.DEAL]: { meaning: 'Negotiated or campaign deal object with custom rules.' },\n },\n }),\n code: schemaShape.code.stringSpec({ meaning: 'The string customers or APIs pass at checkout when applicable.' }),\n discountType: schemaShape.discountType.enumSpec({\n meaning: 'Whether the benefit is percentage, fixed money, or free trial extension per schema rules.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'DiscountType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [DiscountType.PERCENTAGE]: { meaning: 'Percent off list or subtotal.' },\n [DiscountType.FIXED_AMOUNT]: { meaning: 'Flat money off (currency in provider sync).' },\n },\n }),\n discountPercentage: schemaShape.discountPercentage.numberSpec({ meaning: 'Percent off when `discountType` is percentage.' }),\n discountFixedAmount: schemaShape.discountFixedAmount.numberSpec({ meaning: 'Money off when `discountType` is fixed amount in provider currency.' }),\n duration: schemaShape.duration.enumSpec({\n meaning: 'How long the discount applies to a subscription once redeemed.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'PromotionDuration', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [PromotionDuration.ONCE]: { meaning: 'First invoice only.' },\n [PromotionDuration.REPEATING]: { meaning: 'Repeats for N months when `durationInMonths` is set.' },\n [PromotionDuration.FOREVER]: { meaning: 'Applies for the life of the subscription while active.' },\n },\n }),\n durationInMonths: schemaShape.durationInMonths.numberSpec({ meaning: 'Repeat window for `REPEATING` duration mode.' }),\n applicableProducts: schemaShape.applicableProducts.arraySpec({ meaning: 'Product keys this promo can apply to — empty may mean all catalog per policy.', elementMeaning: 'One product `key` string.' }),\n maxRedemptions: schemaShape.maxRedemptions.numberSpec({ meaning: 'Cap on redemptions across all customers; null may mean unlimited per implementation.' }),\n timesRedeemed: schemaShape.timesRedeemed.numberSpec({ meaning: 'Counter mirrored for admin read of campaign health.' }),\n validFrom: schemaShape.validFrom.dateSpec({ meaning: 'Earliest datetime the code is valid.', temporalRole: 'scheduled' }),\n validUntil: schemaShape.validUntil.dateSpec({ meaning: 'Hard stop for new redemptions.', temporalRole: 'deadline' }),\n isActive: schemaShape.isActive.booleanSpec({ meaning: 'Soft switch to stop new uses without deleting the row.' }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Extra campaign tags for analytics — not user PII.' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one promotion’s terms and counters in admin.',\n outcome: 'Full discount and validity block for editing support.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The promotion was found and its full discount mechanics + validity block + redemption counters are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to read the admin-managed promotion catalog.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion exists for the supplied id in the application scope.' },\n ],\n idempotent: true,\n },\n [Op.LIST]: {\n purpose: 'Browse campaigns in admin (merged admin adds non-addressable LIST view).',\n outcome: 'Paginated promotions in application scope.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of promotion rows in the application scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to browse the promotion catalog.' },\n ],\n idempotent: true,\n },\n [Op.SEARCH]: {\n purpose: 'Search by `name` / `code` per factory search config.',\n outcome: 'Filtered list for operators.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of promotions matching the `name` / `code` query (case-insensitive, max 50 per page).' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to search the promotion catalog.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Author a new promotion row for an upcoming campaign.',\n outcome: 'New id and code when unique constraints pass.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A promotion row was created and is returned with its server-assigned id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The discount mechanics are inconsistent (e.g. percentage value with `discountType` fixed, or `REPEATING` duration without `durationInMonths`) or the payload otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to author promotions.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A promotion with the same `code` already exists (codes are the customer-facing checkout key and must be unique).' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Create a percentage coupon',\n request: {\n name: 'Summer launch 20%',\n type: PromotionType.COUPON,\n code: 'SUMMER20',\n discountType: DiscountType.PERCENTAGE,\n discountPercentage: 20,\n duration: PromotionDuration.ONCE,\n maxRedemptions: 500,\n },\n response: {\n _id: 'promo_01HX2…',\n name: 'Summer launch 20%',\n code: 'SUMMER20',\n discountType: DiscountType.PERCENTAGE,\n discountPercentage: 20,\n isActive: true,\n timesRedeemed: 0,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Adjust limits, validity, or active bit before or during a campaign.',\n outcome: 'Patched row with provider sync where required.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The promotion’s limits / validity window / active bit were patched and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited discount or duration fields are inconsistent, or the patch otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to edit promotions.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion exists for the supplied id in the application scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A `code` change collides with another promotion’s existing code.' },\n ],\n idempotent: true,\n },\n [Promotion_Operations.APPLY]: {\n operationId: Promotion_Operations.APPLY,\n purpose: 'Validate and apply a promotion at checkout or plan change when a user supplies a code.',\n outcome: 'Discount object or error for the checkout session — main preset surfaces this in `views` as non-addressable.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The supplied `code` was valid and applicable; the resolved discount object is returned and the redemption counter is advanced.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `code` is missing/empty or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is neither an org owner nor an org member, so cannot apply promotions in this scope.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion matches the supplied `code`.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The matched promotion is inactive, outside its `validFrom`/`validUntil` window, exhausted (`maxRedemptions` reached), or not applicable to the targeted products.' },\n ],\n // Each successful APPLY records a redemption and advances `timesRedeemed`, so\n // re-issuing the same request is NOT side-effect-free — it consumes another\n // redemption (and may then trip the exhaustion 409 above).\n idempotent: false,\n rateLimitNote: 'Code-application is abuse-sensitive (coupon brute-forcing) — the platform may throttle repeated APPLY attempts per caller/account.',\n },\n [Promotion_Operations.DEACTIVATE]: {\n operationId: Promotion_Operations.DEACTIVATE,\n purpose: 'Disable new redemptions while preserving history for audits.',\n outcome: 'Sets `isActive` false in implementation; still listed in merged `views` for action wiring.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The promotion’s `isActive` flag is now false; the campaign accepts no new redemptions while history is preserved.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to deactivate a promotion.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion exists for the supplied id in the application scope.' },\n ],\n // Convergent state-set: deactivating drives `isActive` to a fixed value, so\n // repeating the request lands the campaign in the same disabled state.\n idempotent: true,\n },\n },\n businessConstraints: [\n 'Provider is the settlement system of record — Wildo rows follow provider capabilities for multi-currency and duration semantics.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.APPLICATION },\n);\n\nexport const promotionsResourceSpecification = resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(promotionsMainUI), resourceFrontendConfiguration(promotionsAdminUI)),\n promotionsBase,\n () => ({\n label: { purpose: 'Preset `getFrontendResourceLabel` uses the promotion `name` for list rows.' },\n layout: {\n purpose: 'Section refs `overview`, `discount`, `duration`, `applicability`, `validity` in billing presets — form and display walk the same order.',\n displayPurpose: 'Main bundle exposes `APPLY` and `DEACTIVATE` custom views; merged admin adds LIST+READ for catalog browse (non-addressable).',\n sections: {\n overview: { purpose: 'Name, description, type, and public `code`.', whenToUse: 'Campaign identification in admin.', textSlots: { title: { purpose: 'Promotion title block.' }, description: { purpose: 'Type drives which provider API is used when syncing.' } } },\n discount: { purpose: 'Percent vs fixed amount semantics with the two discount fields.', whenToUse: 'Setting the commercial terms of the deal.', textSlots: { title: { purpose: 'Discount block.' }, description: { purpose: 'Only one of percentage/fixed is meaningful per `discountType` — UI enforces in product.' } } },\n duration: { purpose: '`duration` + `durationInMonths` for repeating windows.', whenToUse: 'When promos apply across multiple renewal cycles.', textSlots: { title: { purpose: 'Duration block.' }, description: { purpose: '“Forever” maps to provider “forever coupon” semantics where available.' } } },\n applicability: { purpose: 'Which products can consume the promo and redemption caps.', whenToUse: 'Limiting an offer to specific SKUs.', textSlots: { title: { purpose: 'Applicability block.' }, description: { purpose: '`maxRedemptions` is global — not per-user unless extended in policy layers.' } } },\n validity: { purpose: '`validFrom`, `validUntil`, `isActive`, and `metadata` for ops and analytics.', whenToUse: 'Sunsetting and seasonal windows.', textSlots: { title: { purpose: 'Validity block.' }, description: { purpose: 'Past `validUntil` should reject `APPLY` at API even if `isActive` is true until a job flips it.' } } },\n },\n },\n views: {\n [Op.LIST]: { purpose: 'Merged admin LIST (non-addressable) for operator catalog alignment.', whenToUse: 'Super-admin promotion management when routes exist.' },\n [Op.READ]: { purpose: 'Merged admin READ (non-addressable) for drill-down alignment.', whenToUse: 'Inspect one campaign when wired.' },\n [Promotion_Operations.APPLY]: { purpose: 'Apply path for checkout integration; non-addressable in merged `views` array but op is present for action buttons.', whenToUse: 'User enters code in purchase flow.' },\n [Promotion_Operations.DEACTIVATE]: { purpose: 'Deactivate path for admin shutoff; present in both main and merged `views` maps as non-addressable.', whenToUse: 'End a campaign early without deleting history.' },\n },\n }),\n);\n"]}
|
|
1
|
+
{"version":3,"file":"promotions.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/promotions.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAA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AAE,mDAAmD,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,wEAAwE,EAAE,EAAE,EAAE;YACzS,aAAa,EAAE,EAAE,OAAO,EAAE,2DAA2D,EAAE,SAAS,EAAE,qCAAqC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,sBAAsB,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,6EAA6E,EAAE,EAAE,EAAE;YAC7S,QAAQ,EAAE,EAAE,OAAO,EAAE,8EAA8E,EAAE,SAAS,EAAE,kCAAkC,EAAE,SAAS,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,WAAW,EAAE,EAAE,OAAO,EAAE,iGAAiG,EAAE,EAAE,EAAE;SACxU;KACF;IACD,KAAK,EAAE;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,qEAAqE,EAAE,SAAS,EAAE,qDAAqD,EAAE;QAC/J,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,+DAA+D,EAAE,SAAS,EAAE,kCAAkC,EAAE;QACtI,CAAC,oBAAoB,CAAC,KAAK,CAAC,EAAE,EAAE,OAAO,EAAE,oHAAoH,EAAE,SAAS,EAAE,oCAAoC,EAAE;QAChN,CAAC,oBAAoB,CAAC,UAAU,CAAC,EAAE,EAAE,OAAO,EAAE,qGAAqG,EAAE,SAAS,EAAE,gDAAgD,EAAE;KACnN;CACF,CAAC,CACH,CAAC","sourcesContent":["import {\n promotionsAdminResourceUIBehavior as promotionsAdminSource,\n promotionsMainResourceUIBehavior as promotionsMainSource,\n} from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n DiscountType,\n PromotionType,\n PromotionDuration,\n PromotionSchema,\n Promotion_Operations,\n ResourcePrimaryScope,\n promotionsResourceConfiguration_InitializationFactory as promotionsFactory,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype Cfg = ReturnType<typeof promotionsFactory>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = Cfg['mainSchema'];\nconst promotionsMainUI = promotionsMainSource as ResourceUIBehaviorConfig<Custom, Core, Main>;\nconst promotionsAdminUI = promotionsAdminSource as ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nconst promotionsBase = resourceSpecification<Custom, Core, Main>(\n promotionsFactory,\n PromotionSchema,\n ({ schemaShape }) => ({\n purpose: 'Promotional instrument (coupon, promotion code, referral program, deal) with discount mechanics, validity window, and redemption counters — synced to the provider where applicable.',\n businessRole: 'Feeds checkout `promotionCode` validation and subscription discount objects; distinct from `REFERRALS` relationship rows.',\n lifecycleRole: 'Authored by operators; `APPLY` validates at purchase; `DEACTIVATE` ends new redemptions while historical subs may retain benefits per policy.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'PromotionSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'promotionsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName: 'PROMOTIONS' },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'Promotion_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSources: [\n { packageName: '@wildo-ai/presets-components', exportName: 'promotionsMainResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n { packageName: '@wildo-ai/presets-components', exportName: 'promotionsAdminResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Promotion document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n name: schemaShape.name.stringSpec({ meaning: 'Human label in admin and support tools.', importance: FieldSemanticImportance.PRIMARY }),\n description: schemaShape.description.stringSpec({ meaning: 'Longer explanation of the offer and legal/restriction copy when needed.' }),\n type: schemaShape.type.enumSpec({\n meaning: 'Kind of promotion surface in catalog and checkout.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'PromotionType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [PromotionType.COUPON]: { meaning: 'Checkout coupon code style.' },\n [PromotionType.PROMOTION_CODE]: { meaning: 'Provider-style promotion code.' },\n [PromotionType.REFERRAL]: { meaning: 'Referral-driven automatic benefit (cross-link to referral program when present).' },\n [PromotionType.DEAL]: { meaning: 'Negotiated or campaign deal object with custom rules.' },\n },\n }),\n code: schemaShape.code.stringSpec({ meaning: 'The string customers or APIs pass at checkout when applicable.' }),\n discountType: schemaShape.discountType.enumSpec({\n meaning: 'Whether the benefit is percentage, fixed money, or free trial extension per schema rules.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'DiscountType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [DiscountType.PERCENTAGE]: { meaning: 'Percent off list or subtotal.' },\n [DiscountType.FIXED_AMOUNT]: { meaning: 'Flat money off (currency in provider sync).' },\n },\n }),\n discountPercentage: schemaShape.discountPercentage.numberSpec({ meaning: 'Percent off when `discountType` is percentage.' }),\n discountFixedAmount: schemaShape.discountFixedAmount.numberSpec({ meaning: 'Money off when `discountType` is fixed amount in provider currency.' }),\n duration: schemaShape.duration.enumSpec({\n meaning: 'How long the discount applies to a subscription once redeemed.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'PromotionDuration', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [PromotionDuration.ONCE]: { meaning: 'First invoice only.' },\n [PromotionDuration.REPEATING]: { meaning: 'Repeats for N months when `durationInMonths` is set.' },\n [PromotionDuration.FOREVER]: { meaning: 'Applies for the life of the subscription while active.' },\n },\n }),\n durationInMonths: schemaShape.durationInMonths.numberSpec({ meaning: 'Repeat window for `REPEATING` duration mode.' }),\n applicableProducts: schemaShape.applicableProducts.arraySpec({ meaning: 'Product keys this promo can apply to — empty may mean all catalog per policy.', elementMeaning: 'One product `key` string.' }),\n maxRedemptions: schemaShape.maxRedemptions.numberSpec({ meaning: 'Cap on redemptions across all customers; null may mean unlimited per implementation.' }),\n timesRedeemed: schemaShape.timesRedeemed.numberSpec({ meaning: 'Counter mirrored for admin read of campaign health.' }),\n validFrom: schemaShape.validFrom.dateSpec({ meaning: 'Earliest datetime the code is valid.', temporalRole: 'scheduled' }),\n validUntil: schemaShape.validUntil.dateSpec({ meaning: 'Hard stop for new redemptions.', temporalRole: 'deadline' }),\n isActive: schemaShape.isActive.booleanSpec({ meaning: 'Soft switch to stop new uses without deleting the row.' }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Extra campaign tags for analytics — not user PII.' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one promotion’s terms and counters in admin.',\n outcome: 'Full discount and validity block for editing support.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The promotion was found and its full discount mechanics + validity block + redemption counters are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to read the admin-managed promotion catalog.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion exists for the supplied id in the application scope.' },\n ],\n idempotent: true,\n },\n [Op.LIST]: {\n purpose: 'Browse campaigns in admin (merged admin adds non-addressable LIST view).',\n outcome: 'Paginated promotions in application scope.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of promotion rows in the application scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to browse the promotion catalog.' },\n ],\n idempotent: true,\n },\n [Op.SEARCH]: {\n purpose: 'Search by `name` / `code` per factory search config.',\n outcome: 'Filtered list for operators.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of promotions matching the `name` / `code` query (case-insensitive, max 50 per page).' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to search the promotion catalog.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Author a new promotion row for an upcoming campaign.',\n outcome: 'New id and code when unique constraints pass.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A promotion row was created and is returned with its server-assigned id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The discount mechanics are inconsistent (e.g. percentage value with `discountType` fixed, or `REPEATING` duration without `durationInMonths`) or the payload otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to author promotions.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A promotion with the same `code` already exists (codes are the customer-facing checkout key and must be unique).' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Create a percentage coupon',\n request: {\n name: 'Summer launch 20%',\n type: PromotionType.COUPON,\n code: 'SUMMER20',\n discountType: DiscountType.PERCENTAGE,\n discountPercentage: 20,\n duration: PromotionDuration.ONCE,\n maxRedemptions: 500,\n },\n response: {\n _id: 'promo_01HX2…',\n name: 'Summer launch 20%',\n code: 'SUMMER20',\n discountType: DiscountType.PERCENTAGE,\n discountPercentage: 20,\n isActive: true,\n timesRedeemed: 0,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Adjust limits, validity, or active bit before or during a campaign.',\n outcome: 'Patched row with provider sync where required.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The promotion’s limits / validity window / active bit were patched and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited discount or duration fields are inconsistent, or the patch otherwise fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to edit promotions.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion exists for the supplied id in the application scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A `code` change collides with another promotion’s existing code.' },\n ],\n idempotent: true,\n },\n [Promotion_Operations.APPLY]: {\n operationId: Promotion_Operations.APPLY,\n purpose: 'Validate and apply a promotion at checkout or plan change when a user supplies a code.',\n outcome: 'Discount object or error for the checkout session — main preset surfaces this in `views` as non-addressable.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The supplied `code` was valid and applicable; the resolved discount object is returned and the redemption counter is advanced.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `code` is missing/empty or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is neither an org owner nor an org member, so cannot apply promotions in this scope.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion matches the supplied `code`.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The matched promotion is inactive, outside its `validFrom`/`validUntil` window, exhausted (`maxRedemptions` reached), or not applicable to the targeted products.' },\n ],\n // Each successful APPLY records a redemption and advances `timesRedeemed`, so\n // re-issuing the same request is NOT side-effect-free — it consumes another\n // redemption (and may then trip the exhaustion 409 above).\n idempotent: false,\n rateLimitNote: 'Code-application is abuse-sensitive (coupon brute-forcing) — the platform may throttle repeated APPLY attempts per caller/account.',\n },\n [Promotion_Operations.DEACTIVATE]: {\n operationId: Promotion_Operations.DEACTIVATE,\n purpose: 'Disable new redemptions while preserving history for audits.',\n outcome: 'Sets `isActive` false in implementation; still listed in merged `views` for action wiring.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The promotion’s `isActive` flag is now false; the campaign accepts no new redemptions while history is preserved.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to deactivate a promotion.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No promotion exists for the supplied id in the application scope.' },\n ],\n // Convergent state-set: deactivating drives `isActive` to a fixed value, so\n // repeating the request lands the campaign in the same disabled state.\n idempotent: true,\n },\n },\n businessConstraints: [\n 'Provider is the settlement system of record — Wildo rows follow provider capabilities for multi-currency and duration semantics.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.APPLICATION },\n);\n\nexport const promotionsResourceSpecification = resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(promotionsMainUI), resourceFrontendConfiguration(promotionsAdminUI)),\n promotionsBase,\n () => ({\n label: { purpose: 'Preset `getFrontendResourceLabel` uses the promotion `name` for list rows.' },\n layout: {\n purpose: 'Section refs `overview`, `discount`, `duration`, `applicability`, `validity` in billing presets — form and display walk the same order.',\n displayPurpose: 'Main bundle exposes `APPLY` and `DEACTIVATE` custom views; merged admin adds LIST+READ for catalog browse (non-addressable).',\n sections: {\n overview: { purpose: 'Name, description, type, and public `code`.', whenToUse: 'Campaign identification in admin.', textSlots: { title: { purpose: 'Promotion title block.' }, description: { purpose: 'Type drives which provider API is used when syncing.' } } },\n discount: { purpose: 'Percent vs fixed amount semantics with the two discount fields.', whenToUse: 'Setting the commercial terms of the deal.', textSlots: { title: { purpose: 'Discount block.' }, description: { purpose: 'Only one of percentage/fixed is meaningful per `discountType` — UI enforces in product.' } } },\n duration: { purpose: '`duration` + `durationInMonths` for repeating windows.', whenToUse: 'When promos apply across multiple renewal cycles.', textSlots: { title: { purpose: 'Duration block.' }, description: { purpose: '“Forever” maps to provider “forever coupon” semantics where available.' } } },\n applicability: { purpose: 'Which products can consume the promo and redemption caps.', whenToUse: 'Limiting an offer to specific SKUs.', textSlots: { title: { purpose: 'Applicability block.' }, description: { purpose: '`maxRedemptions` is global — not per-user unless extended in policy layers.' } } },\n validity: { purpose: '`validFrom`, `validUntil`, `isActive`, and `metadata` for ops and analytics.', whenToUse: 'Sunsetting and seasonal windows.', textSlots: { title: { purpose: 'Validity block.' }, description: { purpose: 'Past `validUntil` should reject `APPLY` at API even if `isActive` is true until a job flips it.' } } },\n },\n },\n views: {\n [Op.LIST]: { purpose: 'Merged admin LIST (non-addressable) for operator catalog alignment.', whenToUse: 'Super-admin promotion management when routes exist.' },\n [Op.READ]: { purpose: 'Merged admin READ (non-addressable) for drill-down alignment.', whenToUse: 'Inspect one campaign when wired.' },\n [Promotion_Operations.APPLY]: { purpose: 'Apply path for checkout integration; non-addressable in merged `views` array but op is present for action buttons.', whenToUse: 'User enters code in purchase flow.' },\n [Promotion_Operations.DEACTIVATE]: { purpose: 'Deactivate path for admin shutoff; present in both main and merged `views` maps as non-addressable.', whenToUse: 'End a campaign early without deleting history.' },\n },\n }),\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referrals.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/referrals.resource.specification.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,IAAI,EAAE,EAE3B,cAAc,EAGf,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"referrals.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/referrals.resource.specification.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,gBAAgB,EAChB,qBAAqB,IAAI,EAAE,EAE3B,cAAc,EAGf,MAAM,uBAAuB,CAAC;AA0J/B,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAc1C,CAAC"}
|
|
@@ -3,13 +3,15 @@ import { LabelAudience } from '@wildo-ai/presets-components-models';
|
|
|
3
3
|
import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';
|
|
4
4
|
import { BillingScopeType, CoreResourceOperation as Op, ReferralSchema, ReferralStatus, ResourcePrimaryScope, referralsResourceConfiguration_InitializationFactory as referralsFactory, } from '@wildo-ai/saas-models';
|
|
5
5
|
import { HttpResponseStatusCode, mergeResourceFrontendConfigurations, resourceFrontendConfiguration, resourceSpecification, resourceSpecificationFromFrontendConfiguration, } from '../../../_core/index.js';
|
|
6
|
+
import { EngineResourceSubDomain } from '../../engine-resource-sub-domain.js';
|
|
6
7
|
const referralsMainUI = referralsMainSource;
|
|
7
8
|
const referralsAdminUI = referralsAdminSource;
|
|
8
9
|
const referralsBase = resourceSpecification(referralsFactory, ReferralSchema, ({ schemaShape }) => ({
|
|
9
|
-
purpose: '
|
|
10
|
+
purpose: 'A referral between two billing accounts: the code that was shared, whether it converted, and the rewards each side earned. Promotions define the offer; a referral records one use of it.',
|
|
10
11
|
businessRole: 'Tracks who referred whom across org vs user billing scopes and whether rewards were applied once the referred party converts.',
|
|
11
12
|
lifecycleRole: 'Created when a code is issued; `referredBillingAccountId` fills in on signup; status moves to CONVERTED on first subscription per product rules; rewards are idempotent via `*RewardApplied` flags.',
|
|
12
13
|
audience: LabelAudience.ADMIN,
|
|
14
|
+
subDomain: EngineResourceSubDomain.BILLING,
|
|
13
15
|
codeHandling: {
|
|
14
16
|
mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'ReferralSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },
|
|
15
17
|
resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'referralsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"referrals.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/referrals.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,IAAI,oBAAoB,EACxD,+BAA+B,IAAI,mBAAmB,GACvD,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,gBAAgB,EAChB,qBAAqB,IAAI,EAAE,EAC3B,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,oDAAoD,IAAI,gBAAgB,GACzE,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AAKrC,MAAM,eAAe,GAAG,mBAAsE,CAAC;AAC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E,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,wHAAwH,EAAE;aAC3K;YACD,cAAc,EAAE;gBACd,EAAE,IAAI,EAAE,sBAAsB,CAAC,eAAe,EAAE,IAAI,EAAE,iGAAiG,EAAE,SAAS,EAAE,mBAAmB,EAAE;gBACzL,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,+EAA+E,EAAE;gBACrI,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,uEAAuE,EAAE;gBAC7H,EAAE,IAAI,EAAE,sBAAsB,CAAC,YAAY,EAAE,IAAI,EAAE,0IAA0I,EAAE;aAChM;YACD,UAAU,EAAE,IAAI;SACjB;KACF;IACD,mBAAmB,EAAE;QACnB,0IAA0I;KAC3I;CACF,CAAC,EACF,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,8CAA8C,CAC1F,mCAAmC,CAAC,6BAA6B,CAAC,eAAe,CAAC,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAC,EACpI,aAAa,EACb,GAAG,EAAE,CAAC,CAAC;IACL,KAAK,EAAE,EAAE,OAAO,EAAE,kFAAkF,EAAE;IACpG,MAAM,EAAE;QACN,OAAO,EAAE,gIAAgI;QACzI,cAAc,EAAE,mJAAmJ;KACpK;IACH,KAAK,EAAE;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,qGAAqG,EAAE,SAAS,EAAE,qEAAqE,EAAE;QAC/M,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,2DAA2D,EAAE,SAAS,EAAE,2CAA2C,EAAE;KAC5I;CACF,CAAC,CACH,CAAC","sourcesContent":["import {\n referralsAdminResourceUIBehavior as referralsAdminSource,\n referralsMainResourceUIBehavior as referralsMainSource,\n} from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingScopeType,\n CoreResourceOperation as Op,\n ReferralSchema,\n ReferralStatus,\n ResourcePrimaryScope,\n referralsResourceConfiguration_InitializationFactory as referralsFactory,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\n\ntype Cfg = ReturnType<typeof referralsFactory>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = Cfg['mainSchema'];\nconst referralsMainUI = referralsMainSource as ResourceUIBehaviorConfig<undefined, Core, Main>;\nconst referralsAdminUI = referralsAdminSource as ResourceUIBehaviorConfig<undefined, Core, Main>;\n\nconst referralsBase = resourceSpecification<undefined, Core, Main>(\n referralsFactory,\n ReferralSchema,\n ({ schemaShape }) => ({\n purpose: 'Referral relationship between two billing accounts: code, status, reward blocks, and conversion timestamps — the program’s state row, not the marketing `PROMOTIONS` definition.',\n businessRole: 'Tracks who referred whom across org vs user billing scopes and whether rewards were applied once the referred party converts.',\n lifecycleRole: 'Created when a code is issued; `referredBillingAccountId` fills in on signup; status moves to CONVERTED on first subscription per product rules; rewards are idempotent via `*RewardApplied` flags.',\n audience: LabelAudience.ADMIN,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'ReferralSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'referralsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName: 'REFERRALS' },\n operationVocabulary: { coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM } },\n frontendConfigurationSources: [\n { packageName: '@wildo-ai/presets-components', exportName: 'referralsMainResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n { packageName: '@wildo-ai/presets-components', exportName: 'referralsAdminResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Referral document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n referralCode: schemaShape.referralCode.stringSpec({ meaning: 'Globally unique shareable code embedded in invite links.', importance: FieldSemanticImportance.PRIMARY }),\n referrerBillingAccountId: schemaShape.referrerBillingAccountId.foreignKeySpec({ meaning: 'Billing account of the party that ISSUED the referral (the referrer) and is entitled to referrer-side rewards on conversion. Per-record DISCRIMINATED polymorphic FK: resolves to a `userBillingAccounts` OR `organizationBillingAccounts` record, selected per row by `referrerScopeType`.', importance: FieldSemanticImportance.PRIMARY }),\n referrerScopeType: schemaShape.referrerScopeType.enumSpec({\n meaning: 'Discriminator that selects which billing-account branch `referrerBillingAccountId` points at (org- vs user-scoped); matched against the branch’s primary scope.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'BillingScopeType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [BillingScopeType.ORGANIZATIONS]: { meaning: 'Referrer account lives under an organization billing account resource.' },\n [BillingScopeType.USER_SELF]: { meaning: 'Referrer account is a user billing account resource.' },\n },\n }),\n referredBillingAccountId: schemaShape.referredBillingAccountId.foreignKeySpec({ meaning: 'Billing account of the party that WAS REFERRED (the referee), populated once they create a billing account through the program and entitled to referred-side credit. Per-record DISCRIMINATED polymorphic FK like `referrerBillingAccountId`, with the branch selected by `referredScopeType`.', importance: FieldSemanticImportance.PRIMARY }),\n referredScopeType: schemaShape.referredScopeType.enumSpec({\n meaning: 'Discriminator that selects which billing-account branch `referredBillingAccountId` points at, once the referred account is known.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'BillingScopeType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [BillingScopeType.ORGANIZATIONS]: { meaning: 'Referred tenant org billing account.' },\n [BillingScopeType.USER_SELF]: { meaning: 'Referred individual billing account.' },\n },\n }),\n status: schemaShape.status.enumSpec({\n meaning: 'Lifecycle of the referral row for reward eligibility.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'ReferralStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [ReferralStatus.PENDING]: { meaning: 'Code issued; no conversion yet.' },\n [ReferralStatus.ACCEPTED]: { meaning: 'Referee signed up; not yet monetized.' },\n [ReferralStatus.CONVERTED]: { meaning: 'First qualifying subscription completed — reward hooks run here.' },\n [ReferralStatus.EXPIRED]: { meaning: 'Past `expiresAt` without conversion.' },\n [ReferralStatus.CANCELLED]: { meaning: 'Programmatically voided referral.' },\n },\n }),\n referrerReward: schemaShape.referrerReward.objectSpec({ meaning: 'Serialized reward terms for the referrer when status hits CONVERTED.' }),\n referredReward: schemaShape.referredReward.objectSpec({ meaning: 'Serialized reward terms for the referred account on conversion.' }),\n referrerRewardApplied: schemaShape.referrerRewardApplied.booleanSpec({ meaning: 'Idempotency bit so payout jobs do not double-apply benefits.' }),\n referredRewardApplied: schemaShape.referredRewardApplied.booleanSpec({ meaning: 'Idempotency for the referred-side credit/discount application.' }),\n acceptedAt: schemaShape.acceptedAt.dateSpec({ meaning: 'When the referred party accepted/registered using the code.', temporalRole: 'occurred' }),\n convertedAt: schemaShape.convertedAt.dateSpec({ meaning: 'When the business defines “conversion” (often first paid subscription).', temporalRole: 'occurred' }),\n expiresAt: schemaShape.expiresAt.dateSpec({ meaning: 'When the offer window closes for this code if limited.', temporalRole: 'deadline' }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Campaign ids or UTM echo for marketing analytics.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Row creation time.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last reward or status change.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect a referral in partner or CSM UIs and support tools.',\n outcome: 'Full state + reward config snapshot.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The referral row was found and its full state + reward-config snapshot is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to read referral program rows (the operation is an internal service-pipeline op, back-office scoped, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No referral exists for the supplied id in the caller’s billing scope.' },\n ],\n idempotent: true,\n },\n [Op.LIST]: {\n purpose: 'Program dashboards over referrals for an org or app (merged admin adds LIST in `views` as non-addressable).',\n outcome: 'Paginated rows filtered by app policies.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of referral rows scoped to the caller’s billing account and filtered by app policy.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to enumerate referral program rows.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Issue a new referral when a user/org starts a share from billing settings.',\n outcome: 'New `referralCode` and reward templates from the active program config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A referral row was created with a freshly minted `referralCode` and reward templates copied from the active program config.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The referral payload (referrer account / scope) fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to issue referral rows (this is an internal service-pipeline, back-office-issued resource, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The generated `referralCode` collides with an existing code, or the referrer is attempting a self-referral that program rules forbid.' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Issue a referral for an organization referrer',\n request: {\n referrerBillingAccountId: 'billacct_org_01HX2…',\n referrerScopeType: BillingScopeType.ORGANIZATIONS,\n },\n response: {\n _id: 'referral_01HX2…',\n referralCode: 'WILDO-7Q2K9X',\n referrerBillingAccountId: 'billacct_org_01HX2…',\n referrerScopeType: BillingScopeType.ORGANIZATIONS,\n status: ReferralStatus.PENDING,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Patch status, referred ids, applied flags, and timestamps as the funnel progresses.',\n outcome: 'Updated row; reward application should be transactional in the service layer.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The referral row advanced (status / referred ids / reward-applied flags / timestamps) and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The patched fields (status transition, referred account, applied flags) fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to mutate referral program rows.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No referral exists for the supplied id in the caller’s billing scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The referee is already claimed/converted on this referral, or a `*RewardApplied` idempotency bit conflicts with a concurrent payout job.' },\n ],\n idempotent: true,\n },\n },\n businessConstraints: [\n 'Referral program definitions may live in separate config; this row is the per-relationship state machine, not the global program editor.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.ORGANIZATIONS },\n);\n\nexport const referralsResourceSpecification = resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(referralsMainUI), resourceFrontendConfiguration(referralsAdminUI)),\n referralsBase,\n () => ({\n label: { purpose: 'Preset `getFrontendResourceLabel` shows `referralCode` in lists for share/audit.' },\n layout: {\n purpose: 'Inline summary in billing presets (no `refs.sections`) shows `referralCode`, status, scope badges, key dates, and referrer id.',\n displayPurpose: 'Main bundle has no addressable `views`; merged admin adds LIST+READ (non-addressable) for back-office triage with org owner roles in the factory.',\n },\n views: {\n [Op.LIST]: { purpose: 'Merged admin includes LIST in `views` as non-addressable — document for spec/preset overlay parity.', whenToUse: 'Org referral tables when super-admin or org-admin routes are wired.' },\n [Op.READ]: { purpose: 'Merged admin includes READ in `views` as non-addressable.', whenToUse: 'Detail drawer on one referral when wired.' },\n },\n }),\n);\n"]}
|
|
1
|
+
{"version":3,"file":"referrals.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/referrals.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,IAAI,oBAAoB,EACxD,+BAA+B,IAAI,mBAAmB,GACvD,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,gBAAgB,EAChB,qBAAqB,IAAI,EAAE,EAC3B,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,oDAAoD,IAAI,gBAAgB,GACzE,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAK3E,MAAM,eAAe,GAAG,mBAAsE,CAAC;AAC/F,MAAM,gB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AE;gBAChB,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,wHAAwH,EAAE;aAC3K;YACD,cAAc,EAAE;gBACd,EAAE,IAAI,EAAE,sBAAsB,CAAC,eAAe,EAAE,IAAI,EAAE,iGAAiG,EAAE,SAAS,EAAE,mBAAmB,EAAE;gBACzL,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,+EAA+E,EAAE;gBACrI,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,uEAAuE,EAAE;gBAC7H,EAAE,IAAI,EAAE,sBAAsB,CAAC,YAAY,EAAE,IAAI,EAAE,0IAA0I,EAAE;aAChM;YACD,UAAU,EAAE,IAAI;SACjB;KACF;IACD,mBAAmB,EAAE;QACnB,0IAA0I;KAC3I;CACF,CAAC,EACF,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,8CAA8C,CAC1F,mCAAmC,CAAC,6BAA6B,CAAC,eAAe,CAAC,EAAE,6BAA6B,CAAC,gBAAgB,CAAC,CAAC,EACpI,aAAa,EACb,GAAG,EAAE,CAAC,CAAC;IACL,KAAK,EAAE,EAAE,OAAO,EAAE,kFAAkF,EAAE;IACpG,MAAM,EAAE;QACN,OAAO,EAAE,gIAAgI;QACzI,cAAc,EAAE,mJAAmJ;KACpK;IACH,KAAK,EAAE;QACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,qGAAqG,EAAE,SAAS,EAAE,qEAAqE,EAAE;QAC/M,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,2DAA2D,EAAE,SAAS,EAAE,2CAA2C,EAAE;KAC5I;CACF,CAAC,CACH,CAAC","sourcesContent":["import {\n referralsAdminResourceUIBehavior as referralsAdminSource,\n referralsMainResourceUIBehavior as referralsMainSource,\n} from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingScopeType,\n CoreResourceOperation as Op,\n ReferralSchema,\n ReferralStatus,\n ResourcePrimaryScope,\n referralsResourceConfiguration_InitializationFactory as referralsFactory,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype Cfg = ReturnType<typeof referralsFactory>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = Cfg['mainSchema'];\nconst referralsMainUI = referralsMainSource as ResourceUIBehaviorConfig<undefined, Core, Main>;\nconst referralsAdminUI = referralsAdminSource as ResourceUIBehaviorConfig<undefined, Core, Main>;\n\nconst referralsBase = resourceSpecification<undefined, Core, Main>(\n referralsFactory,\n ReferralSchema,\n ({ schemaShape }) => ({\n purpose: 'A referral between two billing accounts: the code that was shared, whether it converted, and the rewards each side earned. Promotions define the offer; a referral records one use of it.',\n businessRole: 'Tracks who referred whom across org vs user billing scopes and whether rewards were applied once the referred party converts.',\n lifecycleRole: 'Created when a code is issued; `referredBillingAccountId` fills in on signup; status moves to CONVERTED on first subscription per product rules; rewards are idempotent via `*RewardApplied` flags.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'ReferralSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'referralsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName: 'REFERRALS' },\n operationVocabulary: { coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM } },\n frontendConfigurationSources: [\n { packageName: '@wildo-ai/presets-components', exportName: 'referralsMainResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n { packageName: '@wildo-ai/presets-components', exportName: 'referralsAdminResourceUIBehavior', symbolKind: CodeSymbolKind.UI_BEHAVIOR },\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Referral document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n referralCode: schemaShape.referralCode.stringSpec({ meaning: 'Globally unique shareable code embedded in invite links.', importance: FieldSemanticImportance.PRIMARY }),\n referrerBillingAccountId: schemaShape.referrerBillingAccountId.foreignKeySpec({ meaning: 'Billing account of the party that ISSUED the referral (the referrer) and is entitled to referrer-side rewards on conversion. Per-record DISCRIMINATED polymorphic FK: resolves to a `userBillingAccounts` OR `organizationBillingAccounts` record, selected per row by `referrerScopeType`.', importance: FieldSemanticImportance.PRIMARY }),\n referrerScopeType: schemaShape.referrerScopeType.enumSpec({\n meaning: 'Discriminator that selects which billing-account branch `referrerBillingAccountId` points at (org- vs user-scoped); matched against the branch’s primary scope.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'BillingScopeType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [BillingScopeType.ORGANIZATIONS]: { meaning: 'Referrer account lives under an organization billing account resource.' },\n [BillingScopeType.USER_SELF]: { meaning: 'Referrer account is a user billing account resource.' },\n },\n }),\n referredBillingAccountId: schemaShape.referredBillingAccountId.foreignKeySpec({ meaning: 'Billing account of the party that WAS REFERRED (the referee), populated once they create a billing account through the program and entitled to referred-side credit. Per-record DISCRIMINATED polymorphic FK like `referrerBillingAccountId`, with the branch selected by `referredScopeType`.', importance: FieldSemanticImportance.PRIMARY }),\n referredScopeType: schemaShape.referredScopeType.enumSpec({\n meaning: 'Discriminator that selects which billing-account branch `referredBillingAccountId` points at, once the referred account is known.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'BillingScopeType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [BillingScopeType.ORGANIZATIONS]: { meaning: 'Referred tenant org billing account.' },\n [BillingScopeType.USER_SELF]: { meaning: 'Referred individual billing account.' },\n },\n }),\n status: schemaShape.status.enumSpec({\n meaning: 'Lifecycle of the referral row for reward eligibility.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'ReferralStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [ReferralStatus.PENDING]: { meaning: 'Code issued; no conversion yet.' },\n [ReferralStatus.ACCEPTED]: { meaning: 'Referee signed up; not yet monetized.' },\n [ReferralStatus.CONVERTED]: { meaning: 'First qualifying subscription completed — reward hooks run here.' },\n [ReferralStatus.EXPIRED]: { meaning: 'Past `expiresAt` without conversion.' },\n [ReferralStatus.CANCELLED]: { meaning: 'Programmatically voided referral.' },\n },\n }),\n referrerReward: schemaShape.referrerReward.objectSpec({ meaning: 'Serialized reward terms for the referrer when status hits CONVERTED.' }),\n referredReward: schemaShape.referredReward.objectSpec({ meaning: 'Serialized reward terms for the referred account on conversion.' }),\n referrerRewardApplied: schemaShape.referrerRewardApplied.booleanSpec({ meaning: 'Idempotency bit so payout jobs do not double-apply benefits.' }),\n referredRewardApplied: schemaShape.referredRewardApplied.booleanSpec({ meaning: 'Idempotency for the referred-side credit/discount application.' }),\n acceptedAt: schemaShape.acceptedAt.dateSpec({ meaning: 'When the referred party accepted/registered using the code.', temporalRole: 'occurred' }),\n convertedAt: schemaShape.convertedAt.dateSpec({ meaning: 'When the business defines “conversion” (often first paid subscription).', temporalRole: 'occurred' }),\n expiresAt: schemaShape.expiresAt.dateSpec({ meaning: 'When the offer window closes for this code if limited.', temporalRole: 'deadline' }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Campaign ids or UTM echo for marketing analytics.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Row creation time.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last reward or status change.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect a referral in partner or CSM UIs and support tools.',\n outcome: 'Full state + reward config snapshot.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The referral row was found and its full state + reward-config snapshot is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to read referral program rows (the operation is an internal service-pipeline op, back-office scoped, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No referral exists for the supplied id in the caller’s billing scope.' },\n ],\n idempotent: true,\n },\n [Op.LIST]: {\n purpose: 'Program dashboards over referrals for an org or app (merged admin adds LIST in `views` as non-addressable).',\n outcome: 'Paginated rows filtered by app policies.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of referral rows scoped to the caller’s billing account and filtered by app policy.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to enumerate referral program rows.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Issue a new referral when a user/org starts a share from billing settings.',\n outcome: 'New `referralCode` and reward templates from the active program config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A referral row was created with a freshly minted `referralCode` and reward templates copied from the active program config.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The referral payload (referrer account / scope) fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to issue referral rows (this is an internal service-pipeline, back-office-issued resource, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The generated `referralCode` collides with an existing code, or the referrer is attempting a self-referral that program rules forbid.' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Issue a referral for an organization referrer',\n request: {\n referrerBillingAccountId: 'billacct_org_01HX2…',\n referrerScopeType: BillingScopeType.ORGANIZATIONS,\n },\n response: {\n _id: 'referral_01HX2…',\n referralCode: 'WILDO-7Q2K9X',\n referrerBillingAccountId: 'billacct_org_01HX2…',\n referrerScopeType: BillingScopeType.ORGANIZATIONS,\n status: ReferralStatus.PENDING,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Patch status, referred ids, applied flags, and timestamps as the funnel progresses.',\n outcome: 'Updated row; reward application should be transactional in the service layer.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The referral row advanced (status / referred ids / reward-applied flags / timestamps) and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The patched fields (status transition, referred account, applied flags) fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner role required to mutate referral program rows.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No referral exists for the supplied id in the caller’s billing scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The referee is already claimed/converted on this referral, or a `*RewardApplied` idempotency bit conflicts with a concurrent payout job.' },\n ],\n idempotent: true,\n },\n },\n businessConstraints: [\n 'Referral program definitions may live in separate config; this row is the per-relationship state machine, not the global program editor.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.ORGANIZATIONS },\n);\n\nexport const referralsResourceSpecification = resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(referralsMainUI), resourceFrontendConfiguration(referralsAdminUI)),\n referralsBase,\n () => ({\n label: { purpose: 'Preset `getFrontendResourceLabel` shows `referralCode` in lists for share/audit.' },\n layout: {\n purpose: 'Inline summary in billing presets (no `refs.sections`) shows `referralCode`, status, scope badges, key dates, and referrer id.',\n displayPurpose: 'Main bundle has no addressable `views`; merged admin adds LIST+READ (non-addressable) for back-office triage with org owner roles in the factory.',\n },\n views: {\n [Op.LIST]: { purpose: 'Merged admin includes LIST in `views` as non-addressable — document for spec/preset overlay parity.', whenToUse: 'Org referral tables when super-admin or org-admin routes are wired.' },\n [Op.READ]: { purpose: 'Merged admin includes READ in `views` as non-addressable.', whenToUse: 'Detail drawer on one referral when wired.' },\n },\n }),\n);\n"]}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { BillingSubscription_Operations, CoreResourceOperation as Op, SubscriptionStatus } from '@wildo-ai/saas-models';
|
|
2
|
-
export declare const organizationSubscriptionsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof BillingSubscription_Operations, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
2
|
+
export declare const organizationSubscriptionsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof BillingSubscription_Operations, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
3
3
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
4
4
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
5
5
|
status: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodEnum<typeof SubscriptionStatus>>>>>;
|
|
6
|
-
items: import("
|
|
6
|
+
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
7
7
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>;
|
|
8
8
|
productId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
9
9
|
priceId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
10
10
|
quantity: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
11
11
|
providerSubscriptionItemId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
12
|
-
}, import("zod/v4/core").$strip
|
|
12
|
+
}, import("zod/v4/core").$strip>>;
|
|
13
13
|
currentPeriodStart: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDate>>;
|
|
14
14
|
currentPeriodEnd: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDate>>>;
|
|
15
15
|
trialStart: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodDate>>;
|
|
@@ -31,17 +31,17 @@ export declare const organizationSubscriptionsResourceSpecification: import("../
|
|
|
31
31
|
createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
32
32
|
updatedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
33
33
|
}, import("zod/v4/core").$strip>>;
|
|
34
|
-
export declare const userSubscriptionsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof BillingSubscription_Operations, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
34
|
+
export declare const userSubscriptionsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof BillingSubscription_Operations, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
35
35
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
36
36
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
37
37
|
status: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodEnum<typeof SubscriptionStatus>>>>>;
|
|
38
|
-
items: import("
|
|
38
|
+
items: import("zod").ZodArray<import("zod").ZodObject<{
|
|
39
39
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>;
|
|
40
40
|
productId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
41
41
|
priceId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
42
42
|
quantity: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>;
|
|
43
43
|
providerSubscriptionItemId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodString>>;
|
|
44
|
-
}, import("zod/v4/core").$strip
|
|
44
|
+
}, import("zod/v4/core").$strip>>;
|
|
45
45
|
currentPeriodStart: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDate>>;
|
|
46
46
|
currentPeriodEnd: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDate>>>;
|
|
47
47
|
trialStart: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodDate>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/subscriptions.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,8BAA8B,EAC9B,qBAAqB,IAAI,EAAE,EAG3B,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"subscriptions.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/subscriptions.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,8BAA8B,EAC9B,qBAAqB,IAAI,EAAE,EAG3B,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;AAoZ/B,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAG1D,CAAC;AAEF,eAAO,MAAM,sCAAsC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iCAAmF,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@w
|
|
|
4
4
|
import { BillingSubscriptionBaseSchema, BillingSubscription_Operations, CoreResourceOperation as Op, CoreResourceType, ResourcePrimaryScope, SubscriptionStatus, billingSubscriptionsPolymorphicFactories, } from '@wildo-ai/saas-models';
|
|
5
5
|
import { HttpResponseStatusCode, mergeResourceFrontendConfigurations, resourceFrontendConfiguration, resourceSpecification, resourceSpecificationFromFrontendConfiguration, } from '../../../_core/index.js';
|
|
6
6
|
import { BILLING_API_REFERENCE_PAGE_REQUEST, billingApiReferencePage, createBillingApiReferenceScopeExample, } from './billing-api-reference-examples.js';
|
|
7
|
+
import { EngineResourceSubDomain } from '../../engine-resource-sub-domain.js';
|
|
7
8
|
const subResourcePrimaryScopeByResourceType = {
|
|
8
9
|
[CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]: ResourcePrimaryScope.ORGANIZATIONS,
|
|
9
10
|
[CoreResourceType.USER_SUBSCRIPTIONS]: ResourcePrimaryScope.USER_SELF,
|
|
@@ -48,6 +49,7 @@ function buildSubscriptionBase(resourceType, memberName) {
|
|
|
48
49
|
businessRole: 'Entitlement driver for seats and renewals — the object billing emails and plan changes refer to.',
|
|
49
50
|
lifecycleRole: 'Created after a successful checkout and updated after subscription changes or billing-provider events. A cancelled subscription is retained as billing history rather than cascade-deleted with its account, and subject erasure terminates active billing.',
|
|
50
51
|
audience: LabelAudience.ADMIN,
|
|
52
|
+
subDomain: EngineResourceSubDomain.BILLING,
|
|
51
53
|
codeHandling: {
|
|
52
54
|
mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscriptionBaseSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },
|
|
53
55
|
resourceFactoryCollectionEntry: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/subscriptions.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,wCAAwC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AACrC,OAAO,EACL,kCAAkC,EAClC,uBAAuB,EACvB,qCAAqC,GAEtC,MAAM,kCAAkC,CAAC;AAK1C,MAAM,qCAAqC,GAA6D;IACtG,CAAC,gBAAgB,CAAC,0BAA0B,CAAC,EAAE,oBAAoB,CAAC,aAAa;IACjF,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,EAAE,oBAAoB,CAAC,SAAS;CACtE,CAAC;AAQF,SAAS,YAAY,CAAC,MAAwC,EAAE,YAA6B,EAAE,UAAkB;IAC/G,MAAM,UAAU,GAAG,MAAM,CAAC,YAAY,CAA4B,CAAC;IACnE,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,KAAK,CAAC,YAAY,YAAY,oBAAoB,UAAU,GAAG,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,SAAS,qBAAqB,CAAC,YAA6B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CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,8CAA8C,GAAG,qBAAqB,CACjF,gBAAgB,CAAC,0BAA0B,EAC3C,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingSubscriptionBaseSchema,\n BillingSubscription_Operations,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n SubscriptionStatus,\n billingSubscriptionsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\n\ntype SubResourceType = CoreResourceType.ORGANIZATION_SUBSCRIPTIONS | CoreResourceType.USER_SUBSCRIPTIONS;\ntype SubResourceTypeMember = 'ORGANIZATION_SUBSCRIPTIONS' | 'USER_SUBSCRIPTIONS';\n\nconst subResourcePrimaryScopeByResourceType: Record<SubResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_SUBSCRIPTIONS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingSubscriptionsPolymorphicFactories)[CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingSubscriptionBaseSchema;\ntype SubFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveSubUI(source: Partial<Record<string, unknown>>, resourceType: SubResourceType, sourceName: string): SubFrontend {\n const uiBehavior = source[resourceType] as SubFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildSubscriptionBase(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n subResourcePrimaryScopeByResourceType[resourceType],\n );\n const baseItem = {\n _id: 'subscription_item_base_01HX2EXAMPLE',\n productId: 'product_team_plan',\n priceId: 'price_team_monthly',\n quantity: 25,\n };\n const subscriptionExample = {\n _id: 'subscription_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n status: SubscriptionStatus.ACTIVE,\n items: [baseItem],\n currentPeriodStart: '2026-06-01T00:00:00.000Z',\n currentPeriodEnd: '2026-07-01T00:00:00.000Z',\n cancelAtPeriodEnd: false,\n metadata: { contract: 'annual-commitment' },\n createdAt: '2026-05-10T09:00:00.000Z',\n updatedAt: '2026-06-01T00:05:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const subscriptionSummaryExample = {\n _id: subscriptionExample._id,\n ...exampleScope.billingAccountIdentity,\n status: subscriptionExample.status,\n currentPeriodEnd: subscriptionExample.currentPeriodEnd,\n cancelAtPeriodEnd: subscriptionExample.cancelAtPeriodEnd,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingSubscriptionsPolymorphicFactories[resourceType],\n BillingSubscriptionBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Subscription for a billing account: exposes the selected plan and add-ons, lifecycle status, billing-period bounds, trial state, and cancellation state.',\n businessRole: 'Entitlement driver for seats and renewals — the object billing emails and plan changes refer to.',\n lifecycleRole:\n 'Created after a successful checkout and updated after subscription changes or billing-provider events. A cancelled subscription is retained as billing history rather than cascade-deleted with its account, and subject erasure terminates active billing.',\n audience: LabelAudience.ADMIN,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscriptionBaseSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingSubscriptionsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscription_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n notes: ['Renewal and payment-failed emails may fan out from subscription state changes — confirm `userNotifications[]` on the factory when documenting communications.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Mongo id for this subscription document.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic FK to the parent billing account (`organizationBillingAccountId` or `userBillingAccountId` on concrete schema).', importance: FieldSemanticImportance.PRIMARY }),\n status: schemaShape.status.enumSpec({\n meaning: 'Provider subscription lifecycle state mirrored for gating and UI badges.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'SubscriptionStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [SubscriptionStatus.ACTIVE]: { meaning: 'Currently billable and entitled per provider.' },\n [SubscriptionStatus.TRIALING]: { meaning: 'In trial window if applicable.' },\n [SubscriptionStatus.PAST_DUE]: { meaning: 'Payment failed; access may be degraded per product policy.' },\n [SubscriptionStatus.UNPAID]: { meaning: 'Severe payment failure state from provider semantics.' },\n [SubscriptionStatus.CANCELLED]: { meaning: 'Terminated; may still be visible for history.' },\n [SubscriptionStatus.INCOMPLETE]: { meaning: 'Checkout or first payment not completed.' },\n [SubscriptionStatus.INCOMPLETE_EXPIRED]: { meaning: 'Incomplete checkout expired at provider.' },\n [SubscriptionStatus.PAUSED]: { meaning: 'Paused per provider rules (if used).' },\n },\n }),\n items: schemaShape.items.arraySpec({\n meaning: 'Line items (product + price + quantity) that make up the commercial subscription.',\n elementMeaning: 'One `SubscriptionItemSchema` with `productId`, `priceId`, `quantity`, and optional provider item id.',\n }),\n currentPeriodStart: schemaShape.currentPeriodStart.dateSpec({ meaning: 'Start of the current invoice period.', temporalRole: 'scheduled' }),\n currentPeriodEnd: schemaShape.currentPeriodEnd.dateSpec({ meaning: 'End of the current invoice period / next renewal anchor.', importance: FieldSemanticImportance.PRIMARY }),\n trialEnd: schemaShape.trialEnd.dateSpec({ meaning: 'When trial pricing ends if trialing.', temporalRole: 'deadline' }),\n cancelAtPeriodEnd: schemaShape.cancelAtPeriodEnd.booleanSpec({ meaning: 'User/org requested cancel at end of current period.' }),\n cancellationReason: schemaShape.cancellationReason.stringSpec({ meaning: 'Free-text reason captured when cancelling, if any.' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one subscription for settings, entitlements, and support.',\n outcome: 'Current items, status, and period fields for UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription was found and its items, status, and period bounds are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read the subscription (the read path is an org-owner/org-admin-scoped API operation).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect the active team subscription',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the subscription with available relationship context',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact subscription summary',\n response: subscriptionSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'Enumerate subscriptions for a billing account or scope.',\n outcome: 'Table data for admin and self-serve subscription pickers.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of subscriptions for the billing account or scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate subscriptions in this scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse subscriptions for one billing account',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse subscriptions with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact subscription summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'Repository path when server creates a subscription document from provider sync before first API read.',\n outcome: 'New row aligned to provider id in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A subscription document was materialised from provider sync and aligned to the provider subscription id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced subscription payload fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the trusted system/webhook identity authorised to materialise subscription rows (this is an internal service-pipeline write, not a public create endpoint).' },\n ],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Internal updates from webhooks or migration; user-facing changes often use custom ops.',\n outcome: 'Patched fields per DTO rules in factory.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription fields were patched (typically reconciling provider webhook state) and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The patched fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner / system role required to reconcile subscription state (internal service-pipeline path, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n },\n [BillingSubscription_Operations.CANCEL]: {\n operationId: BillingSubscription_Operations.CANCEL,\n purpose: 'Cancel at period end or immediately per request DTO.',\n outcome: 'Provider and row updated; emails may fire per runtime config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The cancellation was accepted at the provider and mirrored locally — either `cancelAtPeriodEnd` is set or the subscription is now `CANCELLED` per the `cancelImmediately` flag.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to cancel the subscription (a CRITICAL-risk lifecycle action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The subscription is in a state the provider will not cancel (e.g. already terminated, or `INCOMPLETE_EXPIRED`).' },\n ],\n // Convergent lifecycle set: cancelling drives the subscription toward a fixed\n // cancelled / cancel-at-period-end state, so a repeat request lands the same\n // outcome (the provider treats re-cancelling an already-cancelling sub as a no-op).\n idempotent: true,\n examples: [{\n title: 'Schedule cancellation at the current period end',\n request: { cancelImmediately: false, reason: 'Consolidating tools at renewal' },\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: true,\n cancellationReason: 'Consolidating tools at renewal',\n updatedAt: '2026-06-20T15:15:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.RESUME]: {\n operationId: BillingSubscription_Operations.RESUME,\n purpose: 'Undo a pending cancel before period end when provider allows.',\n outcome: 'Status returns toward active trialing/active.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The pending cancellation was cleared at the provider; the subscription returns toward `ACTIVE` / `TRIALING`.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to resume the subscription.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'There is no pending cancellation to undo, or the current period already ended so the provider cannot resume it.' },\n ],\n // Convergent set toward the un-cancelled state: re-resuming an already-active\n // subscription is a no-op at the provider, so the operation is idempotent.\n idempotent: true,\n examples: [{\n title: 'Resume a subscription before renewal',\n request: {},\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: false,\n updatedAt: '2026-06-21T10:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.CHANGE_PLAN]: {\n operationId: BillingSubscription_Operations.CHANGE_PLAN,\n purpose: 'Swap product/price with proration rules in the billing service.',\n outcome: 'Items and period fields updated after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The plan swap (with proration) was confirmed by the provider; the subscription’s items and period fields are updated.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The target `newProductKey` / `newPriceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`newPriceId` names a price whose `productId` is not `newProductKey`’s product. The two are caller-supplied independently, and the provider is billed the PRICE while entitlements derive from the PRODUCT recorded on the item — so an unmatched pair would grant one plan’s entitlements at another plan’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to change the plan (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the target product/price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The requested price is incompatible with the current subscription, or the provider rejects the proration in the subscription’s current state.' },\n ],\n // Non-convergent: each plan swap is a distinct commercial change with its own\n // proration at the provider, so repeating the request is not side-effect-free.\n idempotent: false,\n examples: [{\n title: 'Upgrade from Team to Business',\n request: { newProductKey: 'business_plan', newPriceId: 'price_business_monthly' },\n response: {\n ...subscriptionExample,\n items: [{\n _id: 'subscription_item_business_01HX2EXAMPLE',\n productId: 'product_business_plan',\n priceId: 'price_business_monthly',\n quantity: 25,\n }],\n updatedAt: '2026-06-22T11:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.ADD_ADDON]: {\n operationId: BillingSubscription_Operations.ADD_ADDON,\n purpose: 'Attach an add-on line item to the subscription.',\n outcome: 'Items array gains a new entry after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was confirmed by the provider and appended to the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` / `priceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not the add-on product’s. Same split as CHANGE_PLAN: the provider bills the price, the item records the product, and entitlements follow the product.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to add an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the add-on product is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on is already attached, or is incompatible with the current plan per provider rules.' },\n ],\n // Non-convergent: adding an add-on is an incremental commercial change; a repeat\n // call would attempt to attach the same add-on again (and trips the 409 above).\n idempotent: false,\n examples: [{\n title: 'Add the audit-retention add-on',\n request: { addonProductKey: 'audit_retention', priceId: 'price_audit_retention_monthly' },\n response: {\n ...subscriptionExample,\n items: [\n baseItem,\n {\n _id: 'subscription_item_audit_01HX2EXAMPLE',\n productId: 'product_audit_retention',\n priceId: 'price_audit_retention_monthly',\n quantity: 1,\n },\n ],\n updatedAt: '2026-06-23T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.REMOVE_ADDON]: {\n operationId: BillingSubscription_Operations.REMOVE_ADDON,\n purpose: 'Remove an add-on line item before next period where allowed.',\n outcome: 'Items array shrinks after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was removed at the provider and dropped from the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to remove an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the named add-on is not present on the subscription.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on cannot be removed mid-cycle under the current plan/provider policy.' },\n ],\n // Non-convergent: removal is a commercial change confirmed per-call at the\n // provider; the second identical call no longer finds the add-on (404) rather\n // than being a safe no-op, so it is not modelled as idempotent.\n idempotent: false,\n examples: [{\n title: 'Remove the audit-retention add-on',\n request: { addonProductKey: 'audit_retention' },\n response: {\n ...subscriptionExample,\n items: [baseItem],\n updatedAt: '2026-06-24T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Nested `discount` blocks are provider-populated on READ; clients should not treat them as editable catalog data.',\n ],\n }),\n { resourcePrimaryScope: subResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildSubscriptionSpec(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const base = buildSubscriptionBase(resourceType, memberName);\n const main = resolveSubUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveSubUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset uses `status` string for a compact row label in subscription lists.' },\n layout: {\n purpose: 'Inline summary template in billing presets (no `refs.sections`) shows status, cancel-at-period-end, period end, trial end, and billing-account id — child resources appear in parent billing-account tabs via `variantOverrides`.',\n displayPurpose: 'Self-serve “current plan” and org admin subscription management.',\n },\n views: {\n [BillingSubscription_Operations.CANCEL]: { purpose: 'Custom op host; entries are not addressable routes in merged `billing` presets but operations exist for action buttons.', whenToUse: 'Cancel plan flow in product UI.' },\n [BillingSubscription_Operations.RESUME]: { purpose: 'Resume before period end when user changes mind.', whenToUse: 'Reverse a scheduled cancel.' },\n [BillingSubscription_Operations.CHANGE_PLAN]: { purpose: 'Plan migration host for upgrade/downgrade UX.', whenToUse: 'When catalog offers multiple prices for the same product line.' },\n [BillingSubscription_Operations.ADD_ADDON]: { purpose: 'Attach add-on SKUs to the active subscription.', whenToUse: 'When add-on products exist in the catalog.' },\n [BillingSubscription_Operations.REMOVE_ADDON]: { purpose: 'Detach an add-on line item.', whenToUse: 'When seat-based or feature add-ons can be removed mid-cycle per policy.' },\n },\n }),\n );\n}\n\nexport const organizationSubscriptionsResourceSpecification = buildSubscriptionSpec(\n CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,\n 'ORGANIZATION_SUBSCRIPTIONS',\n);\n\nexport const userSubscriptionsResourceSpecification = buildSubscriptionSpec(CoreResourceType.USER_SUBSCRIPTIONS, 'USER_SUBSCRIPTIONS');\n"]}
|
|
1
|
+
{"version":3,"file":"subscriptions.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/subscriptions.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AAEpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,6BAA6B,EAC7B,8BAA8B,EAC9B,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,wCAAwC,GACzC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,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E,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,4EAA4E,EAAE;QAChG,MAAM,EAAE;YACN,OAAO,EAAE,mOAAmO;YAC5O,cAAc,EAAE,kEAAkE;SACnF;QACD,KAAK,EAAE;YACL,CAAC,8BAA8B,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,yHAAyH,EAAE,SAAS,EAAE,iCAAiC,EAAE;YAC7N,CAAC,8BAA8B,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,kDAAkD,EAAE,SAAS,EAAE,6BAA6B,EAAE;YAClJ,CAAC,8BAA8B,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,+CAA+C,EAAE,SAAS,EAAE,gEAAgE,EAAE;YACvL,CAAC,8BAA8B,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,gDAAgD,EAAE,SAAS,EAAE,4CAA4C,EAAE;YAClK,CAAC,8BAA8B,CAAC,YAAY,CAAC,EAAE,EAAE,OAAO,EAAE,6BAA6B,EAAE,SAAS,EAAE,yEAAyE,EAAE;SAChL;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,8CAA8C,GAAG,qBAAqB,CACjF,gBAAgB,CAAC,0BAA0B,EAC3C,4BAA4B,CAC7B,CAAC;AAEF,MAAM,CAAC,MAAM,sCAAsC,GAAG,qBAAqB,CAAC,gBAAgB,CAAC,kBAAkB,EAAE,oBAAoB,CAAC,CAAC","sourcesContent":["import { billingAdminPresets, billingMainPresets } from '@wildo-ai/presets-components';\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport type { ResourceUIBehaviorConfig } from '@wildo-ai/saas-frontend-lib/companion';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n BillingSubscriptionBaseSchema,\n BillingSubscription_Operations,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n SubscriptionStatus,\n billingSubscriptionsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\nimport {\n BILLING_API_REFERENCE_PAGE_REQUEST,\n billingApiReferencePage,\n createBillingApiReferenceScopeExample,\n type BillingApiReferenceExampleScope,\n} from './billing-api-reference-examples';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype SubResourceType = CoreResourceType.ORGANIZATION_SUBSCRIPTIONS | CoreResourceType.USER_SUBSCRIPTIONS;\ntype SubResourceTypeMember = 'ORGANIZATION_SUBSCRIPTIONS' | 'USER_SUBSCRIPTIONS';\n\nconst subResourcePrimaryScopeByResourceType: Record<SubResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_SUBSCRIPTIONS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingSubscriptionsPolymorphicFactories)[CoreResourceType.ORGANIZATION_SUBSCRIPTIONS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingSubscriptionBaseSchema;\ntype SubFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveSubUI(source: Partial<Record<string, unknown>>, resourceType: SubResourceType, sourceName: string): SubFrontend {\n const uiBehavior = source[resourceType] as SubFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildSubscriptionBase(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n subResourcePrimaryScopeByResourceType[resourceType],\n );\n const baseItem = {\n _id: 'subscription_item_base_01HX2EXAMPLE',\n productId: 'product_team_plan',\n priceId: 'price_team_monthly',\n quantity: 25,\n };\n const subscriptionExample = {\n _id: 'subscription_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n status: SubscriptionStatus.ACTIVE,\n items: [baseItem],\n currentPeriodStart: '2026-06-01T00:00:00.000Z',\n currentPeriodEnd: '2026-07-01T00:00:00.000Z',\n cancelAtPeriodEnd: false,\n metadata: { contract: 'annual-commitment' },\n createdAt: '2026-05-10T09:00:00.000Z',\n updatedAt: '2026-06-01T00:05:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const subscriptionSummaryExample = {\n _id: subscriptionExample._id,\n ...exampleScope.billingAccountIdentity,\n status: subscriptionExample.status,\n currentPeriodEnd: subscriptionExample.currentPeriodEnd,\n cancelAtPeriodEnd: subscriptionExample.cancelAtPeriodEnd,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingSubscriptionsPolymorphicFactories[resourceType],\n BillingSubscriptionBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Subscription for a billing account: exposes the selected plan and add-ons, lifecycle status, billing-period bounds, trial state, and cancellation state.',\n businessRole: 'Entitlement driver for seats and renewals — the object billing emails and plan changes refer to.',\n lifecycleRole:\n 'Created after a successful checkout and updated after subscription changes or billing-provider events. A cancelled subscription is retained as billing history rather than cascade-deleted with its account, and subject erasure terminates active billing.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscriptionBaseSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingSubscriptionsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: { enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM }, memberName },\n operationVocabulary: {\n coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n customEnum: { packageName: '@wildo-ai/saas-models', exportName: 'BillingSubscription_Operations', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n },\n frontendConfigurationSourceEntries: [\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingMainPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n { collectionSymbol: { packageName: '@wildo-ai/presets-components', exportName: 'billingAdminPresets', symbolKind: CodeSymbolKind.UI_BEHAVIOR }, identifierField: 'collectionKey', identifierValue: resourceType },\n ],\n notes: ['Renewal and payment-failed emails may fan out from subscription state changes — confirm `userNotifications[]` on the factory when documenting communications.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Mongo id for this subscription document.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic FK to the parent billing account (`organizationBillingAccountId` or `userBillingAccountId` on concrete schema).', importance: FieldSemanticImportance.PRIMARY }),\n status: schemaShape.status.enumSpec({\n meaning: 'Provider subscription lifecycle state mirrored for gating and UI badges.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'SubscriptionStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [SubscriptionStatus.ACTIVE]: { meaning: 'Currently billable and entitled per provider.' },\n [SubscriptionStatus.TRIALING]: { meaning: 'In trial window if applicable.' },\n [SubscriptionStatus.PAST_DUE]: { meaning: 'Payment failed; access may be degraded per product policy.' },\n [SubscriptionStatus.UNPAID]: { meaning: 'Severe payment failure state from provider semantics.' },\n [SubscriptionStatus.CANCELLED]: { meaning: 'Terminated; may still be visible for history.' },\n [SubscriptionStatus.INCOMPLETE]: { meaning: 'Checkout or first payment not completed.' },\n [SubscriptionStatus.INCOMPLETE_EXPIRED]: { meaning: 'Incomplete checkout expired at provider.' },\n [SubscriptionStatus.PAUSED]: { meaning: 'Paused per provider rules (if used).' },\n },\n }),\n items: schemaShape.items.arraySpec({\n meaning: 'Line items (product + price + quantity) that make up the commercial subscription.',\n elementMeaning: 'One `SubscriptionItemSchema` with `productId`, `priceId`, `quantity`, and optional provider item id.',\n }),\n currentPeriodStart: schemaShape.currentPeriodStart.dateSpec({ meaning: 'Start of the current invoice period.', temporalRole: 'scheduled' }),\n currentPeriodEnd: schemaShape.currentPeriodEnd.dateSpec({ meaning: 'End of the current invoice period / next renewal anchor.', importance: FieldSemanticImportance.PRIMARY }),\n trialEnd: schemaShape.trialEnd.dateSpec({ meaning: 'When trial pricing ends if trialing.', temporalRole: 'deadline' }),\n cancelAtPeriodEnd: schemaShape.cancelAtPeriodEnd.booleanSpec({ meaning: 'User/org requested cancel at end of current period.' }),\n cancellationReason: schemaShape.cancellationReason.stringSpec({ meaning: 'Free-text reason captured when cancelling, if any.' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Inspect one subscription for settings, entitlements, and support.',\n outcome: 'Current items, status, and period fields for UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription was found and its items, status, and period bounds are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to read the subscription (the read path is an org-owner/org-admin-scoped API operation).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect the active team subscription',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the subscription with available relationship context',\n response: subscriptionExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact subscription summary',\n response: subscriptionSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'Enumerate subscriptions for a billing account or scope.',\n outcome: 'Table data for admin and self-serve subscription pickers.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of subscriptions for the billing account or scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to enumerate subscriptions in this scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse subscriptions for one billing account',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse subscriptions with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact subscription summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([subscriptionSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'Repository path when server creates a subscription document from provider sync before first API read.',\n outcome: 'New row aligned to provider id in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A subscription document was materialised from provider sync and aligned to the provider subscription id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced subscription payload fails schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the trusted system/webhook identity authorised to materialise subscription rows (this is an internal service-pipeline write, not a public create endpoint).' },\n ],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Internal updates from webhooks or migration; user-facing changes often use custom ops.',\n outcome: 'Patched fields per DTO rules in factory.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The subscription fields were patched (typically reconciling provider webhook state) and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The patched fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner / system role required to reconcile subscription state (internal service-pipeline path, not HTTP-exposed).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n ],\n idempotent: true,\n },\n [BillingSubscription_Operations.CANCEL]: {\n operationId: BillingSubscription_Operations.CANCEL,\n purpose: 'Cancel at period end or immediately per request DTO.',\n outcome: 'Provider and row updated; emails may fire per runtime config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The cancellation was accepted at the provider and mirrored locally — either `cancelAtPeriodEnd` is set or the subscription is now `CANCELLED` per the `cancelImmediately` flag.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to cancel the subscription (a CRITICAL-risk lifecycle action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The subscription is in a state the provider will not cancel (e.g. already terminated, or `INCOMPLETE_EXPIRED`).' },\n ],\n // Convergent lifecycle set: cancelling drives the subscription toward a fixed\n // cancelled / cancel-at-period-end state, so a repeat request lands the same\n // outcome (the provider treats re-cancelling an already-cancelling sub as a no-op).\n idempotent: true,\n examples: [{\n title: 'Schedule cancellation at the current period end',\n request: { cancelImmediately: false, reason: 'Consolidating tools at renewal' },\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: true,\n cancellationReason: 'Consolidating tools at renewal',\n updatedAt: '2026-06-20T15:15:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.RESUME]: {\n operationId: BillingSubscription_Operations.RESUME,\n purpose: 'Undo a pending cancel before period end when provider allows.',\n outcome: 'Status returns toward active trialing/active.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The pending cancellation was cleared at the provider; the subscription returns toward `ACTIVE` / `TRIALING`.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to resume the subscription.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id under the caller’s billing account.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'There is no pending cancellation to undo, or the current period already ended so the provider cannot resume it.' },\n ],\n // Convergent set toward the un-cancelled state: re-resuming an already-active\n // subscription is a no-op at the provider, so the operation is idempotent.\n idempotent: true,\n examples: [{\n title: 'Resume a subscription before renewal',\n request: {},\n response: {\n ...subscriptionExample,\n cancelAtPeriodEnd: false,\n updatedAt: '2026-06-21T10:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.CHANGE_PLAN]: {\n operationId: BillingSubscription_Operations.CHANGE_PLAN,\n purpose: 'Swap product/price with proration rules in the billing service.',\n outcome: 'Items and period fields updated after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The plan swap (with proration) was confirmed by the provider; the subscription’s items and period fields are updated.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The target `newProductKey` / `newPriceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`newPriceId` names a price whose `productId` is not `newProductKey`’s product. The two are caller-supplied independently, and the provider is billed the PRICE while entitlements derive from the PRODUCT recorded on the item — so an unmatched pair would grant one plan’s entitlements at another plan’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to change the plan (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the target product/price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The requested price is incompatible with the current subscription, or the provider rejects the proration in the subscription’s current state.' },\n ],\n // Non-convergent: each plan swap is a distinct commercial change with its own\n // proration at the provider, so repeating the request is not side-effect-free.\n idempotent: false,\n examples: [{\n title: 'Upgrade from Team to Business',\n request: { newProductKey: 'business_plan', newPriceId: 'price_business_monthly' },\n response: {\n ...subscriptionExample,\n items: [{\n _id: 'subscription_item_business_01HX2EXAMPLE',\n productId: 'product_business_plan',\n priceId: 'price_business_monthly',\n quantity: 25,\n }],\n updatedAt: '2026-06-22T11:00:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.ADD_ADDON]: {\n operationId: BillingSubscription_Operations.ADD_ADDON,\n purpose: 'Attach an add-on line item to the subscription.',\n outcome: 'Items array gains a new entry after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was confirmed by the provider and appended to the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` / `priceId` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not the add-on product’s. Same split as CHANGE_PLAN: the provider bills the price, the item records the product, and entitlements follow the product.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to add an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the add-on product is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on is already attached, or is incompatible with the current plan per provider rules.' },\n ],\n // Non-convergent: adding an add-on is an incremental commercial change; a repeat\n // call would attempt to attach the same add-on again (and trips the 409 above).\n idempotent: false,\n examples: [{\n title: 'Add the audit-retention add-on',\n request: { addonProductKey: 'audit_retention', priceId: 'price_audit_retention_monthly' },\n response: {\n ...subscriptionExample,\n items: [\n baseItem,\n {\n _id: 'subscription_item_audit_01HX2EXAMPLE',\n productId: 'product_audit_retention',\n priceId: 'price_audit_retention_monthly',\n quantity: 1,\n },\n ],\n updatedAt: '2026-06-23T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingSubscription_Operations.REMOVE_ADDON]: {\n operationId: BillingSubscription_Operations.REMOVE_ADDON,\n purpose: 'Remove an add-on line item before next period where allowed.',\n outcome: 'Items array shrinks after provider confirmation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The add-on line item was removed at the provider and dropped from the subscription’s items array.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `addonProductKey` is missing or fails request-DTO validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-owner/org-admin role required to remove an add-on (a HIGH-risk commercial action).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No subscription exists for the supplied id, or the named add-on is not present on the subscription.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The add-on cannot be removed mid-cycle under the current plan/provider policy.' },\n ],\n // Non-convergent: removal is a commercial change confirmed per-call at the\n // provider; the second identical call no longer finds the add-on (404) rather\n // than being a safe no-op, so it is not modelled as idempotent.\n idempotent: false,\n examples: [{\n title: 'Remove the audit-retention add-on',\n request: { addonProductKey: 'audit_retention' },\n response: {\n ...subscriptionExample,\n items: [baseItem],\n updatedAt: '2026-06-24T08:30:00.000Z',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Nested `discount` blocks are provider-populated on READ; clients should not treat them as editable catalog data.',\n ],\n }),\n { resourcePrimaryScope: subResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildSubscriptionSpec(resourceType: SubResourceType, memberName: SubResourceTypeMember) {\n const base = buildSubscriptionBase(resourceType, memberName);\n const main = resolveSubUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveSubUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset uses `status` string for a compact row label in subscription lists.' },\n layout: {\n purpose: 'Inline summary template in billing presets (no `refs.sections`) shows status, cancel-at-period-end, period end, trial end, and billing-account id — child resources appear in parent billing-account tabs via `variantOverrides`.',\n displayPurpose: 'Self-serve “current plan” and org admin subscription management.',\n },\n views: {\n [BillingSubscription_Operations.CANCEL]: { purpose: 'Custom op host; entries are not addressable routes in merged `billing` presets but operations exist for action buttons.', whenToUse: 'Cancel plan flow in product UI.' },\n [BillingSubscription_Operations.RESUME]: { purpose: 'Resume before period end when user changes mind.', whenToUse: 'Reverse a scheduled cancel.' },\n [BillingSubscription_Operations.CHANGE_PLAN]: { purpose: 'Plan migration host for upgrade/downgrade UX.', whenToUse: 'When catalog offers multiple prices for the same product line.' },\n [BillingSubscription_Operations.ADD_ADDON]: { purpose: 'Attach add-on SKUs to the active subscription.', whenToUse: 'When add-on products exist in the catalog.' },\n [BillingSubscription_Operations.REMOVE_ADDON]: { purpose: 'Detach an add-on line item.', whenToUse: 'When seat-based or feature add-ons can be removed mid-cycle per policy.' },\n },\n }),\n );\n}\n\nexport const organizationSubscriptionsResourceSpecification = buildSubscriptionSpec(\n CoreResourceType.ORGANIZATION_SUBSCRIPTIONS,\n 'ORGANIZATION_SUBSCRIPTIONS',\n);\n\nexport const userSubscriptionsResourceSpecification = buildSubscriptionSpec(CoreResourceType.USER_SUBSCRIPTIONS, 'USER_SUBSCRIPTIONS');\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { CoreResourceOperation as Op, UsageSourceType } from '@wildo-ai/saas-models';
|
|
2
|
-
export declare const organizationUsageRecordsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
2
|
+
export declare const organizationUsageRecordsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
3
3
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>;
|
|
4
4
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
5
|
-
productKey: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
6
|
-
quantity: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
5
|
+
productKey: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
6
|
+
quantity: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodNumber>;
|
|
7
7
|
timestamp: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDate>>>;
|
|
8
8
|
source: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodObject<{
|
|
9
9
|
type: import("zod").ZodEnum<typeof UsageSourceType>;
|
|
@@ -16,11 +16,11 @@ export declare const organizationUsageRecordsResourceSpecification: import("../.
|
|
|
16
16
|
metadata: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
17
17
|
createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
18
18
|
}, import("zod/v4/core").$strip>>;
|
|
19
|
-
export declare const userUsageRecordsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
19
|
+
export declare const userUsageRecordsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
20
20
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>;
|
|
21
21
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
22
|
-
productKey: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
23
|
-
quantity: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
22
|
+
productKey: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
23
|
+
quantity: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodNumber>;
|
|
24
24
|
timestamp: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDate>>>;
|
|
25
25
|
source: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodOptional<import("zod").ZodObject<{
|
|
26
26
|
type: import("zod").ZodEnum<typeof UsageSourceType>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usage-records.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/usage-records.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAI3B,eAAe,EAEhB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"usage-records.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/usage-records.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAI3B,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAiQ/B,eAAO,MAAM,6CAA6C;;;;;;;;;;;;;;;;iCAGzD,CAAC;AAEF,eAAO,MAAM,qCAAqC;;;;;;;;;;;;;;;;iCAGjD,CAAC"}
|