@wildo-ai/saas-specifications 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_core/brand/brand-asset.schemas.d.ts +4 -6
- package/dist/esm/_core/brand/brand-asset.schemas.d.ts.map +1 -1
- package/dist/esm/_core/brand/brand-asset.schemas.js +4 -12
- package/dist/esm/_core/brand/brand-asset.schemas.js.map +1 -1
- package/dist/esm/_core/brand/brand-generation.schemas.d.ts +5 -3
- package/dist/esm/_core/brand/brand-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/brand/brand-generation.schemas.js +5 -2
- package/dist/esm/_core/brand/brand-generation.schemas.js.map +1 -1
- package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts +10 -3
- package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts.map +1 -1
- package/dist/esm/_core/brand/brand-snapshot.schemas.js +10 -2
- package/dist/esm/_core/brand/brand-snapshot.schemas.js.map +1 -1
- 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-task-graph-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js +15 -5
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts +40 -3
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js +85 -6
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js.map +1 -1
- 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-lite-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js +10 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts +15 -0
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js.map +1 -1
- 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 +178 -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 +115 -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/expert-personas/expert-persona-charter.schemas.d.ts +6 -7
- package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.d.ts.map +1 -1
- package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js +6 -13
- package/dist/esm/_core/expert-personas/expert-persona-charter.schemas.js.map +1 -1
- package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts +0 -11
- package/dist/esm/_core/expert-personas/expert-persona-validation.d.ts.map +1 -1
- package/dist/esm/_core/expert-personas/expert-persona-validation.js +0 -19
- package/dist/esm/_core/expert-personas/expert-persona-validation.js.map +1 -1
- package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts +1 -2
- package/dist/esm/_core/expert-personas/expert-role-template.schemas.d.ts.map +1 -1
- package/dist/esm/_core/expert-personas/expert-role-template.schemas.js +1 -2
- package/dist/esm/_core/expert-personas/expert-role-template.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/feature-drafts/feature-specification-drafts-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js +17 -4
- package/dist/esm/_core/feature-drafts/feature-specification-drafts-generation.schemas.js.map +1 -1
- 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 +3 -0
- package/dist/esm/_core/index.d.ts.map +1 -1
- package/dist/esm/_core/index.js +3 -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-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/market/market-snapshot-generation.schemas.js +5 -40
- package/dist/esm/_core/market/market-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/market/market-snapshot-validation.d.ts +15 -0
- package/dist/esm/_core/market/market-snapshot-validation.d.ts.map +1 -1
- package/dist/esm/_core/market/market-snapshot-validation.js.map +1 -1
- 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-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js +11 -5
- package/dist/esm/_core/placement-plan/placement-plan-generation.schemas.js.map +1 -1
- package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts +66 -9
- package/dist/esm/_core/placement-plan/placement-plan-validation.d.ts.map +1 -1
- package/dist/esm/_core/placement-plan/placement-plan-validation.js +62 -20
- package/dist/esm/_core/placement-plan/placement-plan-validation.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/placement-plan/placement-plan.schemas.d.ts +4 -1
- package/dist/esm/_core/placement-plan/placement-plan.schemas.d.ts.map +1 -1
- package/dist/esm/_core/placement-plan/placement-plan.schemas.js +4 -1
- package/dist/esm/_core/placement-plan/placement-plan.schemas.js.map +1 -1
- package/dist/esm/_core/provider-specification.schemas.d.ts +82 -0
- package/dist/esm/_core/provider-specification.schemas.d.ts.map +1 -0
- package/dist/esm/_core/provider-specification.schemas.js +144 -0
- package/dist/esm/_core/provider-specification.schemas.js.map +1 -0
- package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js +13 -8
- package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts +15 -0
- package/dist/esm/_core/requirements/requirements-snapshot-validation.d.ts.map +1 -1
- package/dist/esm/_core/requirements/requirements-snapshot-validation.js.map +1 -1
- 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-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js +7 -2
- package/dist/esm/_core/roadmap/roadmap-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts +15 -0
- package/dist/esm/_core/roadmap/roadmap-snapshot-validation.d.ts.map +1 -1
- package/dist/esm/_core/roadmap/roadmap-snapshot-validation.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/utils/family-ref-stamping.d.ts +64 -0
- package/dist/esm/_core/utils/family-ref-stamping.d.ts.map +1 -0
- package/dist/esm/_core/utils/family-ref-stamping.js +73 -0
- package/dist/esm/_core/utils/family-ref-stamping.js.map +1 -0
- package/dist/esm/_core/vision/vision-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js +23 -9
- package/dist/esm/_core/vision/vision-snapshot-generation.schemas.js.map +1 -1
- 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-coding-tasks.application-creation.schemas.d.ts +0 -4
- package/dist/esm/application-creation/application-coding-tasks.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.d.ts +193 -38
- 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 +157 -57
- package/dist/esm/application-creation/application-document-fact-specification.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.d.ts +3 -3
- package/dist/esm/application-creation/application-document-release-policy-specification.application-creation.schemas.js +3 -3
- package/dist/esm/application-creation/application-document-release-policy-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/journey.application-creation.schemas.d.ts +18 -6
- package/dist/esm/application-creation/journey.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/journey.application-creation.schemas.js +18 -6
- package/dist/esm/application-creation/journey.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +101 -85
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js +171 -86
- 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/application-document-publication.schemas.d.ts +20 -6
- package/dist/esm/assurance/application-document-publication.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/application-document-publication.schemas.js +26 -10
- package/dist/esm/assurance/application-document-publication.schemas.js.map +1 -1
- package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts +999 -2
- package/dist/esm/assurance/assurance-authority-basis.definitions.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-authority-basis.definitions.js +2127 -61
- package/dist/esm/assurance/assurance-authority-basis.definitions.js.map +1 -1
- package/dist/esm/assurance/assurance-authority-basis.schemas.d.ts +26 -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-evidence-requirement-bodies.definitions.d.ts +36 -0
- package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts.map +1 -0
- package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js +859 -0
- package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js.map +1 -0
- 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-foundation.schemas.d.ts +43 -0
- package/dist/esm/assurance/assurance-foundation.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-foundation.schemas.js +56 -0
- package/dist/esm/assurance/assurance-foundation.schemas.js.map +1 -1
- package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts +78 -1
- package/dist/esm/assurance/assurance-objective-catalog.definitions.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-objective-catalog.definitions.js +562 -5
- package/dist/esm/assurance/assurance-objective-catalog.definitions.js.map +1 -1
- package/dist/esm/assurance/assurance-program-generation.schemas.d.ts +148 -0
- package/dist/esm/assurance/assurance-program-generation.schemas.d.ts.map +1 -0
- package/dist/esm/assurance/assurance-program-generation.schemas.js +385 -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 +474 -14
- package/dist/esm/assurance/assurance-program.schemas.d.ts.map +1 -1
- package/dist/esm/assurance/assurance-program.schemas.js +319 -8
- 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/assurance-verification-requirement-bodies.definitions.d.ts +35 -0
- package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.d.ts.map +1 -0
- package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js +999 -0
- package/dist/esm/assurance/assurance-verification-requirement-bodies.definitions.js.map +1 -0
- 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 +26 -8
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/engine/_bootstrap.js +3 -1
- package/dist/esm/engine/_bootstrap.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 +15 -1
- 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 +4 -2
- 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 +2 -0
- 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 +17 -3
- 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 +12 -10
- 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 +4 -2
- 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 +3 -1
- 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 +15 -1
- 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 +2 -0
- 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 +17 -3
- package/dist/esm/engine/auth/resources/organization-oauth-clients.resource.specification.js.map +1 -1
- package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts +32 -0
- package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.d.ts.map +1 -0
- package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js +308 -0
- package/dist/esm/engine/auth/resources/organization-provider-credentials.resource.specification.js.map +1 -0
- 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 +6 -4
- 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 +4 -2
- 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 +8 -6
- 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 +11 -9
- 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 +8 -6
- 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 +9 -25
- 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 +106 -10
- 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 +0 -6
- 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/auth/resources/user-provider-credentials.resource.specification.d.ts +32 -0
- package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.d.ts.map +1 -0
- package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js +297 -0
- package/dist/esm/engine/auth/resources/user-provider-credentials.resource.specification.js.map +1 -0
- 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 +6 -3
- 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 +4 -2
- 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 +5 -3
- 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 +10 -8
- 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 +10 -8
- 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 +16 -12
- 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 +10 -8
- 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 +8 -3
- 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 +13 -9
- 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 +30 -11
- 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 +10 -8
- package/dist/esm/engine/compliance/resources/audit-logs.resource.specification.js.map +1 -1
- package/dist/esm/engine/engine-resource-specifications.registry.d.ts +2 -2
- package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
- package/dist/esm/engine/engine-resource-specifications.registry.js +11 -2
- package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
- package/dist/esm/engine/engine-resource-sub-domain.d.ts +83 -0
- package/dist/esm/engine/engine-resource-sub-domain.d.ts.map +1 -0
- package/dist/esm/engine/engine-resource-sub-domain.js +153 -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 +44 -1
- package/dist/esm/engine/errors/error-messages.specification.js.map +1 -1
- package/dist/esm/engine/features/audit-logs.feature.specification.js +4 -4
- package/dist/esm/engine/features/audit-logs.feature.specification.js.map +1 -1
- package/dist/esm/engine/features/core-limits.feature.specifications.js +7 -7
- package/dist/esm/engine/features/core-limits.feature.specifications.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 +5 -3
- 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 +5 -3
- 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 +5 -3
- 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 +12 -10
- 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 +22 -10
- 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 +6 -4
- 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 +4 -2
- 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/app-layout-connected-accounts-settings.frontend-component.specification.d.ts +5 -0
- package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts.map +1 -0
- package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js +81 -0
- package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js.map +1 -0
- package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts +4 -0
- package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.d.ts.map +1 -0
- package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js +22 -0
- package/dist/esm/engine/frontend-components/app/public-layout-file-upload-grant.frontend-component.specification.js.map +1 -0
- 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/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts +0 -4
- package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.d.ts.map +0 -1
- package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js +0 -21
- package/dist/esm/engine/frontend-components/billing/billing-plan-change-preview.frontend-component.specification.js.map +0 -1
- package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts +0 -4
- package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.d.ts.map +0 -1
- package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js +0 -21
- package/dist/esm/engine/frontend-components/billing/billing-promotion-code-input.frontend-component.specification.js.map +0 -1
- package/dist/esm/engine/frontend-components/index.d.ts +0 -2
- package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
- package/dist/esm/engine/frontend-components/index.js +4 -6
- package/dist/esm/engine/frontend-components/index.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 +15 -12
- 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 +12 -9
- 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 +9 -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 +9 -6
- package/dist/esm/engine/guidance/resources/progression-state.resource.specification.js.map +1 -1
- package/dist/esm/engine/index.d.ts +2 -0
- package/dist/esm/engine/index.d.ts.map +1 -1
- package/dist/esm/engine/index.js +2 -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 +19 -17
- 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 +9 -7
- 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 +10 -8
- 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 +7 -2
- 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 +12 -5
- 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 +22 -15
- 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 +14 -10
- 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 +31 -6
- 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 +11 -9
- 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 +5 -3
- 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 +6 -4
- 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 +4 -2
- 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 +3 -1
- 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 +9 -7
- package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
- package/dist/esm/engine/providers/_engine-provider-shared.d.ts +9 -0
- package/dist/esm/engine/providers/_engine-provider-shared.d.ts.map +1 -0
- package/dist/esm/engine/providers/_engine-provider-shared.js +19 -0
- package/dist/esm/engine/providers/_engine-provider-shared.js.map +1 -0
- package/dist/esm/engine/providers/anthropic.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/anthropic.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/anthropic.provider.specification.js +33 -0
- package/dist/esm/engine/providers/anthropic.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/apple.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/apple.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/apple.provider.specification.js +35 -0
- package/dist/esm/engine/providers/apple.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/email-preview.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/email-preview.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/email-preview.provider.specification.js +31 -0
- package/dist/esm/engine/providers/email-preview.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/github.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/github.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/github.provider.specification.js +30 -0
- package/dist/esm/engine/providers/github.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/google.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/google.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/google.provider.specification.js +34 -0
- package/dist/esm/engine/providers/google.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/grok.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/grok.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/grok.provider.specification.js +30 -0
- package/dist/esm/engine/providers/grok.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/index.d.ts +23 -0
- package/dist/esm/engine/providers/index.d.ts.map +1 -0
- package/dist/esm/engine/providers/index.js +37 -0
- package/dist/esm/engine/providers/index.js.map +1 -0
- package/dist/esm/engine/providers/microsoft.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/microsoft.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/microsoft.provider.specification.js +30 -0
- package/dist/esm/engine/providers/microsoft.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/mistral.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/mistral.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/mistral.provider.specification.js +33 -0
- package/dist/esm/engine/providers/mistral.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/openai.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/openai.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/openai.provider.specification.js +43 -0
- package/dist/esm/engine/providers/openai.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/opencode.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/opencode.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/opencode.provider.specification.js +50 -0
- package/dist/esm/engine/providers/opencode.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/perplexity.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/perplexity.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/perplexity.provider.specification.js +30 -0
- package/dist/esm/engine/providers/perplexity.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/resend.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/resend.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/resend.provider.specification.js +33 -0
- package/dist/esm/engine/providers/resend.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/stripe.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/stripe.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/stripe.provider.specification.js +35 -0
- package/dist/esm/engine/providers/stripe.provider.specification.js.map +1 -0
- package/dist/esm/engine/providers/twilio.provider.specification.d.ts +7 -0
- package/dist/esm/engine/providers/twilio.provider.specification.d.ts.map +1 -0
- package/dist/esm/engine/providers/twilio.provider.specification.js +33 -0
- package/dist/esm/engine/providers/twilio.provider.specification.js.map +1 -0
- 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 +9 -7
- 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 +11 -9
- 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 +4 -2
- 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 +10 -8
- 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 +5 -5
- 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 +6 -4
- 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 +4 -2
- 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 +5 -5
- 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 +15 -11
- 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 +3 -1
- 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 +11 -9
- 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 +95 -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 +451 -25
- package/dist/esm/technical-documentation/engine-documentation-specification-catalog.companion.js.map +1 -1
- package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts +37 -1
- package/dist/esm/technical-documentation/technical-documentation-units.schemas.d.ts.map +1 -1
- package/dist/esm/technical-documentation/technical-documentation-units.schemas.js +37 -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":"billing-accounts.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/billing-accounts.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,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,oBAAoB,EACpB,mCAAmC,GACpC,MAAM,uBAAuB,CAAC;AAC/B,OAA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AAO,8CAA8C,CACnD,mCAAmC,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC,EAC9G,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,+GAA+G,EAAE;QACnI,MAAM,EAAE;YACN,OAAO,EAAE,6OAA6O;YACtP,cAAc,EAAE,2OAA2O;SAC5P;QACD,KAAK,EAAE;YACL,CAAC,yBAAyB,CAAC,aAAa,CAAC,EAAE,EAAE,OAAO,EAAE,8EAA8E,EAAE,SAAS,EAAE,0EAA0E,EAAE;YAC7N,CAAC,yBAAyB,CAAC,WAAW,CAAC,EAAE,EAAE,OAAO,EAAE,yHAAyH,EAAE,SAAS,EAAE,iDAAiD,EAAE;YAC7O,CAAC,yBAAyB,CAAC,SAAS,CAAC,EAAE,EAAE,OAAO,EAAE,2EAA2E,EAAE,SAAS,EAAE,4DAA4D,EAAE;SACzM;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,gDAAgD,GAAG,wCAAwC,CACtG,gBAAgB,CAAC,6BAA6B,EAC9C,+BAA+B,CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,wCAAwC,CAC9F,gBAAgB,CAAC,qBAAqB,EACtC,uBAAuB,CACxB,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 BillingAccount_Operations,\n BillingAccountBaseSchema,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n billingAccountsPolymorphicFactories,\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 BillingAccountResourceType = CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS | CoreResourceType.USER_BILLING_ACCOUNTS;\ntype BillingAccountResourceTypeMember = 'ORGANIZATION_BILLING_ACCOUNTS' | 'USER_BILLING_ACCOUNTS';\n\nconst billingAccountResourcePrimaryScopeByResourceType: Record<BillingAccountResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_BILLING_ACCOUNTS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingAccountsPolymorphicFactories)[CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingAccountBaseSchema;\ntype BillAcctFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveBillingAccountUI(\n source: Partial<Record<string, unknown>>,\n resourceType: BillingAccountResourceType,\n sourceName: string,\n): BillAcctFrontend {\n const uiBehavior = source[resourceType] as BillAcctFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildBillingAccountBase(\n resourceType: BillingAccountResourceType,\n resourceTypeMemberName: BillingAccountResourceTypeMember,\n) {\n const exampleScope = createBillingApiReferenceScopeExample(\n billingAccountResourcePrimaryScopeByResourceType[resourceType],\n );\n const billingAccountExample = {\n _id: exampleScope.billingAccountId,\n isActive: true,\n metadata: { costCentre: 'customer-success' },\n createdAt: '2026-06-01T09:00:00.000Z',\n updatedAt: '2026-06-18T14:30:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const billingAccountSummaryExample = {\n _id: billingAccountExample._id,\n isActive: billingAccountExample.isActive,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingAccountsPolymorphicFactories[resourceType],\n BillingAccountBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n `Billing account for ${exampleScope.scopeLabel === 'organization' ? 'an organization' : 'a user'}: exposes activation state and safe metadata, and provides the entry point for checkout, the billing portal, and aggregated billing state.`,\n businessRole: 'Anchor row for subscriptions, invoices, credit pools, and self-serve `OPEN_CHECKOUT` / `OPEN_PORTAL` flows in user/org billing settings.',\n lifecycleRole:\n 'Created automatically the first time billing state is requested, then synchronized from billing-provider events. An inactive account remains readable for billing history but cannot start a new checkout or portal session. There is no client-facing create operation.',\n audience: LabelAudience.ADMIN,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'BillingAccountBaseSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingAccountsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: {\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n memberName: resourceTypeMemberName,\n },\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: 'BillingAccount_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: ['Two variants under `BILLING_SCOPE_VARIANTS` — org primary catalog scope is `ORGANIZATIONS`; user row is `USER_SELF`.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Document id in Mongo for this billing account row.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n isActive: schemaShape.isActive.booleanSpec({ meaning: 'Whether the account should participate in new purchases and portal sessions.', importance: FieldSemanticImportance.PRIMARY }),\n providerRef: schemaShape.providerRef.stringSpec({ meaning: 'Which billing adapter integration backs this account (e.g. stripe) — backend-only in typical responses.', whyItMatters: 'Drives which SDK and webhook namespace hydrate the row.' }),\n providerCustomerId: schemaShape.providerCustomerId.stringSpec({ meaning: 'Provider-side customer id; master link for subscription and invoice fetch.', whyItMatters: 'Without it the row cannot call provider APIs for portal or state.', importance: FieldSemanticImportance.PRIMARY }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Key/value tags mirrored to the provider for analytics or tax hints — not the full address book.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the row was first created.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last backend sync with provider or local patch.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Load the account row and derived UI flags for settings surfaces.',\n outcome: 'Owner sees the account id, activation state, and non-sensitive metadata needed for support correlation. Provider customer identifiers remain backend-only.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The billing account was found and its public id, activation state, and metadata are returned. Backend-only provider identifiers are omitted.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n examples: [{\n title: `Inspect an active ${exampleScope.scopeLabel} billing account`,\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the billing account with available relationship context',\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact billing-account summary',\n response: billingAccountSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'List billing account rows in org or user scope (often singleton).',\n outcome: 'Picker or table for rare multi-account orgs in admin.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty, often singleton) page of billing accounts for the scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse billing accounts for the current scope',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse billing accounts with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact billing-account summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'System-context bootstrap when a scope first needs a billing account: auto-created in-process by the billing service (INTERNAL_CALL, no HTTP surface) through the `systemAccessPolicy.create` opt-in, which injects the scope FK via the execution context map.',\n outcome: 'New row for the scope after provider customer linkage in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A billing account was provisioned for the scope (with its provider customer linked) and is returned with its server-assigned id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The account payload fails schema validation (e.g. missing `providerRef`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to provision a billing account in this scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A billing account already links this scope to the provider customer (the scope→customer link is unique).', errorCode: 'BILLING_ACCOUNT_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Provision a Stripe-backed billing account for a scope',\n request: {\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n metadata: { tier: 'pro' },\n },\n response: {\n _id: 'billacct_01HX2…',\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Metadata or activation toggles; heavy provider writes often go through webhooks or custom ops instead.',\n outcome: 'Patched `metadata` or `isActive` per DTO in factory config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The account’s `metadata` / `isActive` fields were patched and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to mutate this billing account.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [Op.DELETE]: {\n purpose: 'Dangerous off-boarding: in-process hard removal of the account row (INTERNAL_CALL, no HTTP surface). The product off-boarding path is the soft retire (`isActive: false`), not this.',\n outcome: 'Row removed — but only once the account has no retained financial children left. The dependents check is enforced by the engine before the delete, not left to the caller.',\n responseStatuses: [\n { code: HttpResponseStatusCode.NO_CONTENT_204, meaning: 'The billing account had no retained financial children and was removed; no body is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the elevated entitlement required for billing-account off-boarding.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id (or it was already removed).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account still has retained financial children — subscriptions, invoice refs, usage records, or credit pools — that reference it. Those rows survive scope and account deletion by design (billing-retention decision), and this account holds the only local `providerCustomerId` that maps them back to the provider customer, so the delete fails closed. The blocking families are named in the error context.', errorCode: 'BILLING_ACCOUNT_HAS_DEPENDENTS' },\n ],\n idempotent: true,\n },\n [BillingAccount_Operations.OPEN_CHECKOUT]: {\n operationId: BillingAccount_Operations.OPEN_CHECKOUT,\n purpose: 'Start a hosted checkout session (product+price) for the connected customer.',\n outcome: 'Redirect URL or client secret to complete purchase in the provider UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider checkout session was created; the redirect URL / client secret to complete the purchase is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The requested product/price is missing or malformed in the checkout request.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A caller-supplied `metadata` key uses the framework-reserved `wildo_` namespace, or `quantity` is not an integer within the supported bound. Reserved keys are refused rather than dropped: that namespace carries the values the completion webhook reads back to decide which account is credited and by how much.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not `productKey`’s product. The provider is billed the PRICE while the purchase is recorded against the PRODUCT, so an unmatched pair would deliver one product’s goods at another’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open checkout for it.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id, or the referenced price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account is inactive or has no linked provider customer, so a checkout session cannot be opened.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open checkout for the Pro plan',\n request: {\n productKey: 'pro_plan',\n priceId: 'price_pro_monthly',\n successUrl: 'https://app.example.test/settings/billing?checkout=success',\n cancelUrl: 'https://app.example.test/settings/billing?checkout=cancelled',\n quantity: 25,\n promotionCode: 'WELCOME20',\n metadata: { campaign: 'customer-expansion' },\n },\n response: {\n url: 'https://billing.example.test/checkout/cs_01HX2EXAMPLE',\n sessionId: 'cs_01HX2EXAMPLE',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.OPEN_PORTAL]: {\n operationId: BillingAccount_Operations.OPEN_PORTAL,\n purpose: 'Open the provider customer portal (payment methods, cancel at period end) with a return URL.',\n outcome: 'Session URL for self-serve management.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider customer-portal session was created; its session URL is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open its portal.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account has no linked provider customer, so a portal session cannot be opened.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open the hosted billing portal',\n request: { returnUrl: 'https://app.example.test/settings/billing' },\n response: { url: 'https://billing.example.test/portal/bps_01HX2EXAMPLE' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.GET_STATE]: {\n operationId: BillingAccount_Operations.GET_STATE,\n purpose: 'Collection-scoped aggregate read of account + subscriptions + catalog slices for billing home widgets. The billing service auto-creates the scope’s account when none exists.',\n outcome: 'Convenience bundle for a single call instead of N reads in the client; the absence of an existing account is a bootstrap condition, not a 404.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The denormalized billing snapshot (account + subscriptions + catalog slices) is returned in one bundle.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The authenticated request context does not contain the scope identifier required to resolve billing state.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The requested scope does not match the caller’s authenticated scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Billing is not enabled for this scope type.', errorCode: 'BILLING_SCOPE_NOT_ENABLED' },\n ],\n idempotent: true,\n examples: [{\n title: 'Load the billing home state before a subscription exists',\n response: {\n billingAccount: {\n _id: billingAccountExample._id,\n isActive: true,\n createdAt: billingAccountExample.createdAt,\n updatedAt: billingAccountExample.updatedAt,\n },\n subscription: null,\n products: [],\n prices: [],\n invoices: [],\n usage: { byProduct: {} },\n creditPools: {},\n activePromotions: [],\n scopeType: exampleScope.scopeType,\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Contact, tax, and payment instruments live in the provider — do not expect them duplicated on this document.',\n 'Checkout-session metadata is split by trust: keys prefixed `wildo_` are framework-authoritative (they are what the signed completion webhook reads back to credit an account), and caller-supplied keys in that namespace are refused at the request DTO. A provider signature proves the provider sent the echoed metadata, never that the framework wrote it, so the completion handler re-derives the billing account from the provider CUSTOMER and only cross-checks the echoed value.',\n 'Polymorphic scope FKs (`organizationId` / `userId`) are injected on concrete variant schemas, not on `BillingAccountBaseSchema` itself.',\n 'The account outlives its scope: deleting the owning org or user does NOT cascade to this row, and its financial children (subscriptions, invoice refs, usage records, credit pools) are retained too. Consequently a hard DELETE is refused with 409 while any of those children remain — this row carries the only local `providerCustomerId`, so removing it would leave the retained financial records unreconcilable against the provider.',\n ],\n }),\n { resourcePrimaryScope: billingAccountResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildBillingAccountResourceSpecification(\n resourceType: BillingAccountResourceType,\n memberName: BillingAccountResourceTypeMember,\n) {\n const base = buildBillingAccountBase(resourceType, memberName);\n const main = resolveBillingAccountUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveBillingAccountUI(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 the Mongo id string as a compact label when the row is the anchor for self-serve and admin lists.' },\n layout: {\n purpose: 'Inline summary template (no named `layout.refs.sections` in billing presets) shows `isActive` and `_id`; `variantOverrides` wire subscription/invoice/usage/credit child tabs in org vs user parent views at different `orderIndex` values.',\n displayPurpose: 'Not a public directory — org-owner/org-admin or user self-serve billing surfaces; LIST/READ are org-owner/org-admin-gated API operations, while writes (auto-create + webhook sync) stay internal service-pipeline ops, not HTTP-exposed.',\n },\n views: {\n [BillingAccount_Operations.OPEN_CHECKOUT]: { purpose: 'Custom flow entry that behaves like a purchase wizard linked to the account.', whenToUse: '“Upgrade” or “Buy credits” in product UI when checkout is the next step.' },\n [BillingAccount_Operations.OPEN_PORTAL]: { purpose: 'Custom flow entry for hosted portal; non-addressable `views` entry in merged presets (still documented as surfaced op).', whenToUse: '“Manage payment method / invoices” in settings.' },\n [BillingAccount_Operations.GET_STATE]: { purpose: 'Aggregate “billing snapshot” for dashboards; not a CRUD read replacement.', whenToUse: 'Billing home that needs a denormalized bundle in one call.' },\n },\n }),\n );\n}\n\nexport const organizationBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS,\n 'ORGANIZATION_BILLING_ACCOUNTS',\n);\n\nexport const userBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.USER_BILLING_ACCOUNTS,\n 'USER_BILLING_ACCOUNTS',\n);\n"]}
|
|
1
|
+
{"version":3,"file":"billing-accounts.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/billing-accounts.resource.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gD,GAAG,wCAAwC,CACtG,gBAAgB,CAAC,6BAA6B,EAC9C,+BAA+B,CAChC,CAAC;AAEF,MAAM,CAAC,MAAM,wCAAwC,GAAG,wCAAwC,CAC9F,gBAAgB,CAAC,qBAAqB,EACtC,uBAAuB,CACxB,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 BillingAccount_Operations,\n BillingAccountBaseSchema,\n CoreResourceOperation as Op,\n CoreResourceType,\n ResourcePrimaryScope,\n billingAccountsPolymorphicFactories,\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 BillingAccountResourceType = CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS | CoreResourceType.USER_BILLING_ACCOUNTS;\ntype BillingAccountResourceTypeMember = 'ORGANIZATION_BILLING_ACCOUNTS' | 'USER_BILLING_ACCOUNTS';\n\nconst billingAccountResourcePrimaryScopeByResourceType: Record<BillingAccountResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_BILLING_ACCOUNTS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof billingAccountsPolymorphicFactories)[CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof BillingAccountBaseSchema;\ntype BillAcctFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolveBillingAccountUI(\n source: Partial<Record<string, unknown>>,\n resourceType: BillingAccountResourceType,\n sourceName: string,\n): BillAcctFrontend {\n const uiBehavior = source[resourceType] as BillAcctFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildBillingAccountBase(\n resourceType: BillingAccountResourceType,\n resourceTypeMemberName: BillingAccountResourceTypeMember,\n) {\n const exampleScope = createBillingApiReferenceScopeExample(\n billingAccountResourcePrimaryScopeByResourceType[resourceType],\n );\n const billingAccountExample = {\n _id: exampleScope.billingAccountId,\n isActive: true,\n metadata: { costCentre: 'customer-success' },\n createdAt: '2026-06-01T09:00:00.000Z',\n updatedAt: '2026-06-18T14:30:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const billingAccountSummaryExample = {\n _id: billingAccountExample._id,\n isActive: billingAccountExample.isActive,\n };\n\n return resourceSpecification<Custom, Core, Main>(\n billingAccountsPolymorphicFactories[resourceType],\n BillingAccountBaseSchema,\n ({ schemaShape }) => ({\n purpose:\n `Billing account for ${exampleScope.scopeLabel === 'organization' ? 'an organization' : 'a user'}: exposes activation state and safe metadata, and provides the entry point for checkout, the billing portal, and aggregated billing state.`,\n businessRole: 'Anchor row for subscriptions, invoices, credit pools, and self-serve `OPEN_CHECKOUT` / `OPEN_PORTAL` flows in user/org billing settings.',\n lifecycleRole:\n 'Created automatically the first time billing state is requested, then synchronized from billing-provider events. An inactive account remains readable for billing history but cannot start a new checkout or portal session. There is no client-facing create operation.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'BillingAccountBaseSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'billingAccountsPolymorphicFactories', symbolKind: CodeSymbolKind.FACTORY },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: {\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceType', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n memberName: resourceTypeMemberName,\n },\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: 'BillingAccount_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: ['Two variants under `BILLING_SCOPE_VARIANTS` — org primary catalog scope is `ORGANIZATIONS`; user row is `USER_SELF`.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Document id in Mongo for this billing account record.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n isActive: schemaShape.isActive.booleanSpec({ meaning: 'Whether the account should participate in new purchases and portal sessions.', importance: FieldSemanticImportance.PRIMARY }),\n providerRef: schemaShape.providerRef.stringSpec({ meaning: 'Which billing adapter integration backs this account (e.g. stripe) — backend-only in typical responses.', whyItMatters: 'Drives which SDK and webhook namespace hydrate the row.' }),\n providerCustomerId: schemaShape.providerCustomerId.stringSpec({ meaning: 'Provider-side customer id; master link for subscription and invoice fetch.', whyItMatters: 'Without it the row cannot call provider APIs for portal or state.', importance: FieldSemanticImportance.PRIMARY }),\n metadata: schemaShape.metadata.objectSpec({ meaning: 'Key/value tags mirrored to the provider for analytics or tax hints — not the full address book.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the record was first created.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last backend sync with provider or local patch.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Load the account row and derived UI flags for settings surfaces.',\n outcome: 'Owner sees the account id, activation state, and non-sensitive metadata needed for support correlation. Provider customer identifiers remain backend-only.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The billing account was found and its public id, activation state, and metadata are returned. Backend-only provider identifiers are omitted.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n examples: [{\n title: `Inspect an active ${exampleScope.scopeLabel} billing account`,\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect the billing account with available relationship context',\n response: billingAccountExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact billing-account summary',\n response: billingAccountSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'List billing account rows in org or user scope (often singleton).',\n outcome: 'Picker or table for rare multi-account orgs in admin.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty, often singleton) page of billing accounts for the scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse billing accounts for the current scope',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse billing accounts with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact billing-account summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([billingAccountSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.CREATE]: {\n purpose: 'System-context bootstrap when a scope first needs a billing account: auto-created in-process by the billing service (INTERNAL_CALL, no HTTP surface) through the `systemAccessPolicy.create` opt-in, which injects the scope FK via the execution context map.',\n outcome: 'New row for the scope after provider customer linkage in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A billing account was provisioned for the scope (with its provider customer linked) and is returned with its server-assigned id.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The account payload fails schema validation (e.g. missing `providerRef`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to provision a billing account in this scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A billing account already links this scope to the provider customer (the scope→customer link is unique).', errorCode: 'BILLING_ACCOUNT_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Provision a Stripe-backed billing account for a scope',\n request: {\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n metadata: { tier: 'pro' },\n },\n response: {\n _id: 'billacct_01HX2…',\n providerRef: 'stripe',\n providerCustomerId: 'cus_01HX2…',\n isActive: true,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Metadata or activation toggles; heavy provider writes often go through webhooks or custom ops instead.',\n outcome: 'Patched `metadata` or `isActive` per DTO in factory config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The account’s `metadata` / `isActive` fields were patched and the updated record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to mutate this billing account.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [Op.DELETE]: {\n purpose: 'Dangerous off-boarding: in-process hard removal of the account row (INTERNAL_CALL, no HTTP surface). The product off-boarding path is the soft retire (`isActive: false`), not this.',\n outcome: 'Row removed — but only once the account has no retained financial children left. The dependents check is enforced by the engine before the delete, not left to the caller.',\n responseStatuses: [\n { code: HttpResponseStatusCode.NO_CONTENT_204, meaning: 'The billing account had no retained financial children and was removed; no body is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the elevated entitlement required for billing-account off-boarding.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id (or it was already removed).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account still has retained financial children — subscriptions, invoice refs, usage records, or credit pools — that reference it. Those rows survive scope and account deletion by design (billing-retention decision), and this account holds the only local `providerCustomerId` that maps them back to the provider customer, so the delete fails closed. The blocking families are named in the error context.', errorCode: 'BILLING_ACCOUNT_HAS_DEPENDENTS' },\n ],\n idempotent: true,\n },\n [BillingAccount_Operations.OPEN_CHECKOUT]: {\n operationId: BillingAccount_Operations.OPEN_CHECKOUT,\n purpose: 'Start a hosted checkout session (product+price) for the connected customer.',\n outcome: 'Redirect URL or client secret to complete purchase in the provider UI.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider checkout session was created; the redirect URL / client secret to complete the purchase is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The requested product/price is missing or malformed in the checkout request.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A caller-supplied `metadata` key uses the framework-reserved `wildo_` namespace, or `quantity` is not an integer within the supported bound. Reserved keys are refused rather than dropped: that namespace carries the values the completion webhook reads back to decide which account is credited and by how much.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: '`priceId` names a price whose `productId` is not `productKey`’s product. The provider is billed the PRICE while the purchase is recorded against the PRODUCT, so an unmatched pair would deliver one product’s goods at another’s price.', errorCode: 'BILLING_PRICE_PRODUCT_MISMATCH' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open checkout for it.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id, or the referenced price is not in the catalog.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account is inactive or has no linked provider customer, so a checkout session cannot be opened.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: '`productKey` (or the price named by `priceId`) has been RETIRED — the product left the code catalogue and the catalogue sync soft-retired it. It still exists, and existing subscribers keep it, but it may no longer be bought: its entitlements are frozen at whatever the last sync wrote and nobody maintains them.', errorCode: 'BILLING_PRODUCT_RETIRED' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open checkout for the Pro plan',\n request: {\n productKey: 'pro_plan',\n priceId: 'price_pro_monthly',\n successUrl: 'https://app.example.test/settings/billing?checkout=success',\n cancelUrl: 'https://app.example.test/settings/billing?checkout=cancelled',\n quantity: 25,\n promotionCode: 'WELCOME20',\n metadata: { campaign: 'customer-expansion' },\n },\n response: {\n url: 'https://billing.example.test/checkout/cs_01HX2EXAMPLE',\n sessionId: 'cs_01HX2EXAMPLE',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.OPEN_PORTAL]: {\n operationId: BillingAccount_Operations.OPEN_PORTAL,\n purpose: 'Open the provider customer portal (payment methods, cancel at period end) with a return URL.',\n outcome: 'Session URL for self-serve management.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A provider customer-portal session was created; its session URL is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller does not own this billing account and may not open its portal.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No billing account exists for the supplied id in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The account has no linked provider customer, so a portal session cannot be opened.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Open the hosted billing portal',\n request: { returnUrl: 'https://app.example.test/settings/billing' },\n response: { url: 'https://billing.example.test/portal/bps_01HX2EXAMPLE' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [BillingAccount_Operations.GET_STATE]: {\n operationId: BillingAccount_Operations.GET_STATE,\n purpose: 'Collection-scoped aggregate read of account + subscriptions + catalog slices for billing home widgets. The billing service auto-creates the scope’s account when none exists.',\n outcome: 'Convenience bundle for a single call instead of N reads in the client; the absence of an existing account is a bootstrap condition, not a 404.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The denormalized billing snapshot (account + subscriptions + catalog slices) is returned in one bundle.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The authenticated request context does not contain the scope identifier required to resolve billing state.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The requested scope does not match the caller’s authenticated scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Billing is not enabled for this scope type.', errorCode: 'BILLING_SCOPE_NOT_ENABLED' },\n ],\n idempotent: true,\n examples: [{\n title: 'Load the billing home state before a subscription exists',\n response: {\n billingAccount: {\n _id: billingAccountExample._id,\n isActive: true,\n createdAt: billingAccountExample.createdAt,\n updatedAt: billingAccountExample.updatedAt,\n },\n subscription: null,\n products: [],\n prices: [],\n invoices: [],\n usage: { byProduct: {} },\n creditPools: {},\n activePromotions: [],\n scopeType: exampleScope.scopeType,\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'Contact, tax, and payment instruments live in the provider — do not expect them duplicated on this document.',\n 'Checkout-session metadata is split by trust: keys prefixed `wildo_` are framework-authoritative (they are what the signed completion webhook reads back to credit an account), and caller-supplied keys in that namespace are refused at the request DTO. A provider signature proves the provider sent the echoed metadata, never that the framework wrote it, so the completion handler re-derives the billing account from the provider CUSTOMER and only cross-checks the echoed value.',\n 'Polymorphic scope FKs (`organizationId` / `userId`) are injected on concrete variant schemas, not on `BillingAccountBaseSchema` itself.',\n 'The account outlives its scope: deleting the owning org or user does NOT cascade to this row, and its financial children (subscriptions, invoice refs, usage records, credit pools) are retained too. Consequently a hard DELETE is refused with 409 while any of those children remain — this row carries the only local `providerCustomerId`, so removing it would leave the retained financial records unreconcilable against the provider.',\n ],\n }),\n { resourcePrimaryScope: billingAccountResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildBillingAccountResourceSpecification(\n resourceType: BillingAccountResourceType,\n memberName: BillingAccountResourceTypeMember,\n) {\n const base = buildBillingAccountBase(resourceType, memberName);\n const main = resolveBillingAccountUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveBillingAccountUI(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 the Mongo id string as a compact label when the row is the anchor for self-serve and admin lists.' },\n layout: {\n purpose: 'Inline summary template (no named `layout.refs.sections` in billing presets) shows `isActive` and `_id`; `variantOverrides` wire subscription/invoice/usage/credit child tabs in org vs user parent views at different `orderIndex` values.',\n displayPurpose: 'Not a public directory — org-owner/org-admin or user self-serve billing surfaces; LIST/READ are org-owner/org-admin-gated API operations, while writes (auto-create + webhook sync) stay internal service-pipeline ops, not HTTP-exposed.',\n },\n views: {\n [BillingAccount_Operations.OPEN_CHECKOUT]: { purpose: 'Custom flow entry that behaves like a purchase wizard linked to the account.', whenToUse: '“Upgrade” or “Buy credits” in product UI when checkout is the next step.' },\n [BillingAccount_Operations.OPEN_PORTAL]: { purpose: 'Custom flow entry for hosted portal; non-addressable `views` entry in merged presets (still documented as surfaced op).', whenToUse: '“Manage payment method / invoices” in settings.' },\n [BillingAccount_Operations.GET_STATE]: { purpose: 'Aggregate “billing snapshot” for dashboards; not a CRUD read replacement.', whenToUse: 'Billing home that needs a denormalized bundle in one call.' },\n },\n }),\n );\n}\n\nexport const organizationBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.ORGANIZATION_BILLING_ACCOUNTS,\n 'ORGANIZATION_BILLING_ACCOUNTS',\n);\n\nexport const userBillingAccountsResourceSpecification = buildBillingAccountResourceSpecification(\n CoreResourceType.USER_BILLING_ACCOUNTS,\n 'USER_BILLING_ACCOUNTS',\n);\n"]}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { CoreResourceOperation as Op, CreditPool_Operations } from '@wildo-ai/saas-models';
|
|
2
|
-
export declare const organizationCreditPoolsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof CreditPool_Operations, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
2
|
+
export declare const organizationCreditPoolsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof CreditPool_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("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
|
poolKey: 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").ZodString>>>>;
|
|
6
|
-
available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
7
|
-
totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
8
|
-
totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
6
|
+
available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>>;
|
|
7
|
+
totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>>;
|
|
8
|
+
totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>>;
|
|
9
9
|
createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
10
10
|
updatedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
11
11
|
}, import("zod/v4/core").$strip>>;
|
|
12
|
-
export declare const userCreditPoolsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof CreditPool_Operations, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
12
|
+
export declare const userCreditPoolsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<typeof CreditPool_Operations, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST, import("zod").ZodObject<{
|
|
13
13
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>;
|
|
14
14
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>>;
|
|
15
15
|
poolKey: 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").ZodString>>>>;
|
|
16
|
-
available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
17
|
-
totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
18
|
-
totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("
|
|
16
|
+
available: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>>;
|
|
17
|
+
totalPurchased: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>>;
|
|
18
|
+
totalConsumed: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodNumber>>>;
|
|
19
19
|
createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
20
20
|
updatedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
21
21
|
}, import("zod/v4/core").$strip>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit-pools.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/credit-pools.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAE3B,qBAAqB,EAItB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"credit-pools.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/credit-pools.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAE3B,qBAAqB,EAItB,MAAM,uBAAuB,CAAC;AA8L/B,eAAO,MAAM,4CAA4C;;;;;;;;;iCAGxD,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;iCAA+E,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { LabelAudience } from '@wildo-ai/presets-components-models';
|
|
|
3
3
|
import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';
|
|
4
4
|
import { CoreResourceOperation as Op, CoreResourceType, CreditPool_Operations, ResourcePrimaryScope, CreditPoolSchema, creditPoolsPolymorphicFactories, } 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 poolResourcePrimaryScopeByResourceType = {
|
|
7
8
|
[CoreResourceType.ORGANIZATION_CREDIT_POOLS]: ResourcePrimaryScope.ORGANIZATIONS,
|
|
8
9
|
[CoreResourceType.USER_CREDIT_POOLS]: ResourcePrimaryScope.USER_SELF,
|
|
@@ -20,6 +21,7 @@ function buildCreditPoolBase(resourceType, memberName) {
|
|
|
20
21
|
businessRole: 'Holds the spendable balance used by feature gates. BOTH balance mutations are system-only (INTERNAL_CALL, no client route): `CONSUME` decrements as a metered capability is used, `TOP_UP` increments after a purchase webhook. Neither is client-initiated.',
|
|
21
22
|
lifecycleRole: 'Row created on first need; monotonic counters updated by service layer — not a general ledger in Wildo.',
|
|
22
23
|
audience: LabelAudience.ADMIN,
|
|
24
|
+
subDomain: EngineResourceSubDomain.BILLING,
|
|
23
25
|
codeHandling: {
|
|
24
26
|
mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'CreditPoolSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },
|
|
25
27
|
resourceFactoryCollectionEntry: {
|
|
@@ -45,7 +47,7 @@ function buildCreditPoolBase(resourceType, memberName) {
|
|
|
45
47
|
available: schemaShape.available.numberSpec({ meaning: 'Spendable credits right now — blocks usage when zero under policy.', importance: FieldSemanticImportance.PRIMARY }),
|
|
46
48
|
totalPurchased: schemaShape.totalPurchased.numberSpec({ meaning: 'Cumulative top-ups for transparency and support.' }),
|
|
47
49
|
totalConsumed: schemaShape.totalConsumed.numberSpec({ meaning: 'Cumulative `CONSUME` deductions for lifetime reporting.' }),
|
|
48
|
-
createdAt: schemaShape.createdAt.dateSpec({ meaning: 'First pool
|
|
50
|
+
createdAt: schemaShape.createdAt.dateSpec({ meaning: 'First pool record creation.', temporalRole: 'creation' }),
|
|
49
51
|
updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last balance change.', temporalRole: 'modified' }),
|
|
50
52
|
},
|
|
51
53
|
operations: {
|
|
@@ -105,7 +107,7 @@ function buildCreditPoolBase(resourceType, memberName) {
|
|
|
105
107
|
purpose: 'System-level adjustments when not using custom ops; prefer `TOP_UP` / `CONSUME` in services.',
|
|
106
108
|
outcome: 'Patched non-editable fields per factory rules in edge cases.',
|
|
107
109
|
responseStatuses: [
|
|
108
|
-
{ code: HttpResponseStatusCode.OK_200, meaning: 'The pool
|
|
110
|
+
{ code: HttpResponseStatusCode.OK_200, meaning: 'The pool record was patched and the updated balances are returned.' },
|
|
109
111
|
],
|
|
110
112
|
errorScenarios: [
|
|
111
113
|
{ code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credit-pools.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/credit-pools.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,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,+BAA+B,GAChC,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,sBAAsB,EACtB,mCAAmC,EACnC,6BAA6B,EAC7B,qBAAqB,EACrB,8CAA8C,GAC/C,MAAM,6BAA6B,CAAC;AAKrC,MAAM,sCAAsC,GAAmD;IAC7F,CAAC,gBAAgB,CAAC,yBAAyB,C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iBAClM;gBACD,UAAU,EAAE,KAAK;aAClB;SACF;QACD,mBAAmB,EAAE,CAAC,wGAAwG,CAAC;KAChI,CAAC,EACF,EAAE,oBAAoB,EAAE,sCAAsC,CAAC,YAAY,CAAC,EAAE,CAC/E,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,YAA8B,EAAE,UAAkC;IAC7F,MAAM,IAAI,GAAG,mBAAmB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,aAAa,CAAC,kBAAsD,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC;IACvH,MAAM,KAAK,GAAG,aAAa,CAAC,mBAAuD,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC;IAC1H,OAAO,8CAA8C,CACnD,mCAAmC,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC,EAC9G,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,wEAAwE,EAAE;QAC5F,MAAM,EAAE;YACN,OAAO,EAAE,0KAA0K;YACnL,cAAc,EAAE,qHAAqH;SACtI;QACD,KAAK,EAAE;YACL,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,6KAA6K,EAAE,SAAS,EAAE,kIAAkI,EAAE;SAC1W;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,4CAA4C,GAAG,mBAAmB,CAC7E,gBAAgB,CAAC,yBAAyB,EAC1C,2BAA2B,CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,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 CoreResourceOperation as Op,\n CoreResourceType,\n CreditPool_Operations,\n ResourcePrimaryScope,\n CreditPoolSchema,\n creditPoolsPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport {\n HttpResponseStatusCode,\n mergeResourceFrontendConfigurations,\n resourceFrontendConfiguration,\n resourceSpecification,\n resourceSpecificationFromFrontendConfiguration,\n} from '~wildo-specifications/_core';\n\ntype PoolResourceType = CoreResourceType.ORGANIZATION_CREDIT_POOLS | CoreResourceType.USER_CREDIT_POOLS;\ntype PoolResourceTypeMember = 'ORGANIZATION_CREDIT_POOLS' | 'USER_CREDIT_POOLS';\n\nconst poolResourcePrimaryScopeByResourceType: Record<PoolResourceType, ResourcePrimaryScope> = {\n [CoreResourceType.ORGANIZATION_CREDIT_POOLS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_CREDIT_POOLS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof creditPoolsPolymorphicFactories)[CoreResourceType.ORGANIZATION_CREDIT_POOLS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof CreditPoolSchema;\ntype PoolFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolvePoolUI(source: Partial<Record<string, unknown>>, resourceType: PoolResourceType, sourceName: string): PoolFrontend {\n const uiBehavior = source[resourceType] as PoolFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildCreditPoolBase(resourceType: PoolResourceType, memberName: PoolResourceTypeMember) {\n return resourceSpecification<Custom, Core, Main>(\n creditPoolsPolymorphicFactories[resourceType],\n CreditPoolSchema,\n ({ schemaShape }) => ({\n purpose: 'Per–billing-account, per–`poolKey` credit balance (available / purchased / consumed) for CREDIT_PACK products.',\n businessRole: 'Holds the spendable balance used by feature gates. BOTH balance mutations are system-only (INTERNAL_CALL, no client route): `CONSUME` decrements as a metered capability is used, `TOP_UP` increments after a purchase webhook. Neither is client-initiated.',\n lifecycleRole: 'Row created on first need; monotonic counters updated by service layer — not a general ledger in Wildo.',\n audience: LabelAudience.ADMIN,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'CreditPoolSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'creditPoolsPolymorphicFactories', 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: 'CreditPool_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: ['Both `CONSUME` and `TOP_UP` are INTERNAL_CALL (system-only): `CONSUME` is invoked by service code metering a paid capability; `TOP_UP` is applied by the purchase webhook. The frontend registry strips both — the client credit-purchase action is OPEN_CHECKOUT on the billing account, never a direct balance write. The billing presets still list `TOP_UP` in `views` as `notAddressable`; that entry is retained for structural parity but is inert at runtime.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Credit pool document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Parent billing account polymorphic FK.', importance: FieldSemanticImportance.PRIMARY }),\n poolKey: schemaShape.poolKey.stringSpec({ meaning: 'Logical pool identifier matching catalog `creditPoolKey` (e.g. ai_tokens).', importance: FieldSemanticImportance.PRIMARY }),\n available: schemaShape.available.numberSpec({ meaning: 'Spendable credits right now — blocks usage when zero under policy.', importance: FieldSemanticImportance.PRIMARY }),\n totalPurchased: schemaShape.totalPurchased.numberSpec({ meaning: 'Cumulative top-ups for transparency and support.' }),\n totalConsumed: schemaShape.totalConsumed.numberSpec({ meaning: 'Cumulative `CONSUME` deductions for lifetime reporting.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'First pool row creation.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last balance change.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Read current balances for in-app credit meters and admin inspection.',\n outcome: 'Available, purchased, and consumed numbers.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The credit pool was found and its available / purchased / consumed counters are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [Op.LIST]: {\n purpose: 'Enumerate pools for a scope when multiple `poolKey` values exist under one account.',\n outcome: 'Table of pools for finance review.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of credit pools for the billing account / scope.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Bootstrap a pool on first credit-backed purchase for that key.',\n outcome: 'Initial available/totals in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A new credit pool was created for the `(billingAccountId, poolKey)` pair and is returned with its initial balances.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The pool payload fails schema validation (e.g. missing `poolKey` or `billingAccountId`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to provision credit pools in this scope.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'The referenced parent `billingAccountId` does not exist in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A pool already exists for this `(billingAccountId, poolKey)` pair — the pair is unique in Mongo.', errorCode: 'CREDIT_POOL_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Bootstrap an ai_tokens pool for a billing account',\n request: {\n billingAccountId: 'billacct_01HX2…',\n poolKey: 'ai_tokens',\n available: 0,\n },\n response: {\n _id: 'creditpool_01HX2…',\n billingAccountId: 'billacct_01HX2…',\n poolKey: 'ai_tokens',\n available: 0,\n totalPurchased: 0,\n totalConsumed: 0,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'System-level adjustments when not using custom ops; prefer `TOP_UP` / `CONSUME` in services.',\n outcome: 'Patched non-editable fields per factory rules in edge cases.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The pool row was patched and the updated balances are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to directly adjust credit pool balances (balance moves should use TOP_UP / CONSUME).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [CreditPool_Operations.CONSUME]: {\n operationId: CreditPool_Operations.CONSUME,\n purpose: 'Decrement `available` by a positive credit amount as a metered capability is used. **System-only (INTERNAL_CALL, no HTTP route)** — invoked by service code that meters a paid feature, not by a client; a client never spends credits directly.',\n outcome: 'Balance reduced by the service-supplied amount, or an error if credits are insufficient.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The credit amount was deducted and the new `available` / `totalConsumed` balances are returned to the internal caller.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The requested amount is missing, zero, or negative.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The pool has insufficient `available` credits to satisfy the requested deduction.', errorCode: 'INSUFFICIENT_CREDITS' },\n ],\n idempotent: false,\n },\n [CreditPool_Operations.TOP_UP]: {\n operationId: CreditPool_Operations.TOP_UP,\n purpose: 'Add credits after a verified CREDIT_PACK purchase. **System-only (INTERNAL_CALL, no HTTP route)** — invoked by the billing webhook router with a server-computed `credits` amount derived from the paid quantity; it is not client-reachable. The client \"buy credits\" action is OPEN_CHECKOUT on the billing account, which starts payment; this op applies the grant only once payment is confirmed. Gating credit grants to the payment webhook (never a tenant-owner route) prevents self-granting paid credits.',\n outcome: 'Increments available and totalPurchased when applied by the webhook.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The webhook-computed credit amount was added and the new `available` / `totalPurchased` balances are returned to the internal caller.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The computed amount is missing, zero, or negative.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id (the webhook auto-creates the pool before top-up, so this indicates an internal inconsistency).' },\n ],\n idempotent: false,\n },\n },\n businessConstraints: ['`poolKey` + `billingAccountId` is unique in Mongo — do not create duplicate keys for the same account.'],\n }),\n { resourcePrimaryScope: poolResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildCreditPoolSpec(resourceType: PoolResourceType, memberName: PoolResourceTypeMember) {\n const base = buildCreditPoolBase(resourceType, memberName);\n const main = resolvePoolUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolvePoolUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset `getFrontendResourceLabel` returns `poolKey` for the row title.' },\n layout: {\n purpose: 'Inline summary template (no `refs.sections`) stacks pool name, available/totals, and `billingAccountId` — `TOP_UP` is the only custom op listed in merged admin `views`.',\n displayPurpose: 'Self-serve and org-admin credit balance; `CONSUME` is for automated service calls, not a primary nav op in presets.',\n },\n views: {\n [CreditPool_Operations.TOP_UP]: { purpose: 'System-only grant op (INTERNAL_CALL); listed for structural parity with the admin preset but not client-invocable — the frontend registry strips it. Kept `notAddressable`.', whenToUse: 'Never client-wired. The credit-purchase UX is OPEN_CHECKOUT on the billing account; the grant is applied by the payment webhook.' },\n },\n }),\n );\n}\n\nexport const organizationCreditPoolsResourceSpecification = buildCreditPoolSpec(\n CoreResourceType.ORGANIZATION_CREDIT_POOLS,\n 'ORGANIZATION_CREDIT_POOLS',\n);\n\nexport const userCreditPoolsResourceSpecification = buildCreditPoolSpec(CoreResourceType.USER_CREDIT_POOLS, 'USER_CREDIT_POOLS');\n"]}
|
|
1
|
+
{"version":3,"file":"credit-pools.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/credit-pools.resource.specification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AACvF,OAAO,EAAE,aA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Ac,EAAE,qHAAqH;SACtI;QACD,KAAK,EAAE;YACL,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE,EAAE,OAAO,EAAE,6KAA6K,EAAE,SAAS,EAAE,kIAAkI,EAAE;SAC1W;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,4CAA4C,GAAG,mBAAmB,CAC7E,gBAAgB,CAAC,yBAAyB,EAC1C,2BAA2B,CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,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 CoreResourceOperation as Op,\n CoreResourceType,\n CreditPool_Operations,\n ResourcePrimaryScope,\n CreditPoolSchema,\n creditPoolsPolymorphicFactories,\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 PoolResourceType = CoreResourceType.ORGANIZATION_CREDIT_POOLS | CoreResourceType.USER_CREDIT_POOLS;\ntype PoolResourceTypeMember = 'ORGANIZATION_CREDIT_POOLS' | 'USER_CREDIT_POOLS';\n\nconst poolResourcePrimaryScopeByResourceType: Record<PoolResourceType, ResourcePrimaryScope> = {\n [CoreResourceType.ORGANIZATION_CREDIT_POOLS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_CREDIT_POOLS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof creditPoolsPolymorphicFactories)[CoreResourceType.ORGANIZATION_CREDIT_POOLS]>;\ntype Custom = NonNullable<Cfg['customOperation']>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof CreditPoolSchema;\ntype PoolFrontend = ResourceUIBehaviorConfig<Custom, Core, Main>;\n\nfunction resolvePoolUI(source: Partial<Record<string, unknown>>, resourceType: PoolResourceType, sourceName: string): PoolFrontend {\n const uiBehavior = source[resourceType] as PoolFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildCreditPoolBase(resourceType: PoolResourceType, memberName: PoolResourceTypeMember) {\n return resourceSpecification<Custom, Core, Main>(\n creditPoolsPolymorphicFactories[resourceType],\n CreditPoolSchema,\n ({ schemaShape }) => ({\n purpose: 'Per–billing-account, per–`poolKey` credit balance (available / purchased / consumed) for CREDIT_PACK products.',\n businessRole: 'Holds the spendable balance used by feature gates. BOTH balance mutations are system-only (INTERNAL_CALL, no client route): `CONSUME` decrements as a metered capability is used, `TOP_UP` increments after a purchase webhook. Neither is client-initiated.',\n lifecycleRole: 'Row created on first need; monotonic counters updated by service layer — not a general ledger in Wildo.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'CreditPoolSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'creditPoolsPolymorphicFactories', 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: 'CreditPool_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: ['Both `CONSUME` and `TOP_UP` are INTERNAL_CALL (system-only): `CONSUME` is invoked by service code metering a paid capability; `TOP_UP` is applied by the purchase webhook. The frontend registry strips both — the client credit-purchase action is OPEN_CHECKOUT on the billing account, never a direct balance write. The billing presets still list `TOP_UP` in `views` as `notAddressable`; that entry is retained for structural parity but is inert at runtime.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Credit pool document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Parent billing account polymorphic FK.', importance: FieldSemanticImportance.PRIMARY }),\n poolKey: schemaShape.poolKey.stringSpec({ meaning: 'Logical pool identifier matching catalog `creditPoolKey` (e.g. ai_tokens).', importance: FieldSemanticImportance.PRIMARY }),\n available: schemaShape.available.numberSpec({ meaning: 'Spendable credits right now — blocks usage when zero under policy.', importance: FieldSemanticImportance.PRIMARY }),\n totalPurchased: schemaShape.totalPurchased.numberSpec({ meaning: 'Cumulative top-ups for transparency and support.' }),\n totalConsumed: schemaShape.totalConsumed.numberSpec({ meaning: 'Cumulative `CONSUME` deductions for lifetime reporting.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'First pool record creation.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last balance change.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Read current balances for in-app credit meters and admin inspection.',\n outcome: 'Available, purchased, and consumed numbers.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The credit pool was found and its available / purchased / consumed counters are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [Op.LIST]: {\n purpose: 'Enumerate pools for a scope when multiple `poolKey` values exist under one account.',\n outcome: 'Table of pools for finance review.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of credit pools for the billing account / scope.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Bootstrap a pool on first credit-backed purchase for that key.',\n outcome: 'Initial available/totals in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A new credit pool was created for the `(billingAccountId, poolKey)` pair and is returned with its initial balances.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The pool payload fails schema validation (e.g. missing `poolKey` or `billingAccountId`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to provision credit pools in this scope.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'The referenced parent `billingAccountId` does not exist in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A pool already exists for this `(billingAccountId, poolKey)` pair — the pair is unique in Mongo.', errorCode: 'CREDIT_POOL_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Bootstrap an ai_tokens pool for a billing account',\n request: {\n billingAccountId: 'billacct_01HX2…',\n poolKey: 'ai_tokens',\n available: 0,\n },\n response: {\n _id: 'creditpool_01HX2…',\n billingAccountId: 'billacct_01HX2…',\n poolKey: 'ai_tokens',\n available: 0,\n totalPurchased: 0,\n totalConsumed: 0,\n },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'System-level adjustments when not using custom ops; prefer `TOP_UP` / `CONSUME` in services.',\n outcome: 'Patched non-editable fields per factory rules in edge cases.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The pool record was patched and the updated balances are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The edited fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the entitlement to directly adjust credit pool balances (balance moves should use TOP_UP / CONSUME).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n [CreditPool_Operations.CONSUME]: {\n operationId: CreditPool_Operations.CONSUME,\n purpose: 'Decrement `available` by a positive credit amount as a metered capability is used. **System-only (INTERNAL_CALL, no HTTP route)** — invoked by service code that meters a paid feature, not by a client; a client never spends credits directly.',\n outcome: 'Balance reduced by the service-supplied amount, or an error if credits are insufficient.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The credit amount was deducted and the new `available` / `totalConsumed` balances are returned to the internal caller.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The requested amount is missing, zero, or negative.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The pool has insufficient `available` credits to satisfy the requested deduction.', errorCode: 'INSUFFICIENT_CREDITS' },\n ],\n idempotent: false,\n },\n [CreditPool_Operations.TOP_UP]: {\n operationId: CreditPool_Operations.TOP_UP,\n purpose: 'Add credits after a verified CREDIT_PACK purchase. **System-only (INTERNAL_CALL, no HTTP route)** — invoked by the billing webhook router with a server-computed `credits` amount derived from the paid quantity; it is not client-reachable. The client \"buy credits\" action is OPEN_CHECKOUT on the billing account, which starts payment; this op applies the grant only once payment is confirmed. Gating credit grants to the payment webhook (never a tenant-owner route) prevents self-granting paid credits.',\n outcome: 'Increments available and totalPurchased when applied by the webhook.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The webhook-computed credit amount was added and the new `available` / `totalPurchased` balances are returned to the internal caller.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The computed amount is missing, zero, or negative.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No credit pool exists for the supplied id (the webhook auto-creates the pool before top-up, so this indicates an internal inconsistency).' },\n ],\n idempotent: false,\n },\n },\n businessConstraints: ['`poolKey` + `billingAccountId` is unique in Mongo — do not create duplicate keys for the same account.'],\n }),\n { resourcePrimaryScope: poolResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildCreditPoolSpec(resourceType: PoolResourceType, memberName: PoolResourceTypeMember) {\n const base = buildCreditPoolBase(resourceType, memberName);\n const main = resolvePoolUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolvePoolUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset `getFrontendResourceLabel` returns `poolKey` for the row title.' },\n layout: {\n purpose: 'Inline summary template (no `refs.sections`) stacks pool name, available/totals, and `billingAccountId` — `TOP_UP` is the only custom op listed in merged admin `views`.',\n displayPurpose: 'Self-serve and org-admin credit balance; `CONSUME` is for automated service calls, not a primary nav op in presets.',\n },\n views: {\n [CreditPool_Operations.TOP_UP]: { purpose: 'System-only grant op (INTERNAL_CALL); listed for structural parity with the admin preset but not client-invocable — the frontend registry strips it. Kept `notAddressable`.', whenToUse: 'Never client-wired. The credit-purchase UX is OPEN_CHECKOUT on the billing account; the grant is applied by the payment webhook.' },\n },\n }),\n );\n}\n\nexport const organizationCreditPoolsResourceSpecification = buildCreditPoolSpec(\n CoreResourceType.ORGANIZATION_CREDIT_POOLS,\n 'ORGANIZATION_CREDIT_POOLS',\n);\n\nexport const userCreditPoolsResourceSpecification = buildCreditPoolSpec(CoreResourceType.USER_CREDIT_POOLS, 'USER_CREDIT_POOLS');\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CoreResourceOperation as Op, InvoiceStatus } from '@wildo-ai/saas-models';
|
|
2
|
-
export declare const organizationInvoiceRefsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST | Op.SEARCH, import("zod").ZodObject<{
|
|
2
|
+
export declare const organizationInvoiceRefsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST | Op.SEARCH, 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("zod").ZodString>>;
|
|
5
5
|
status: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodEnum<typeof InvoiceStatus>>>>;
|
|
@@ -10,7 +10,7 @@ export declare const organizationInvoiceRefsResourceSpecification: import("../..
|
|
|
10
10
|
createdAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
11
11
|
updatedAt: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodDefault<import("zod").ZodDate>>>;
|
|
12
12
|
}, import("zod/v4/core").$strip>>;
|
|
13
|
-
export declare const userInvoiceRefsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.CREATE | Op.LIST | Op.SEARCH, import("zod").ZodObject<{
|
|
13
|
+
export declare const userInvoiceRefsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.UPDATE_MANY | Op.CREATE | Op.LIST | Op.SEARCH, import("zod").ZodObject<{
|
|
14
14
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
15
15
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodString>>;
|
|
16
16
|
status: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("zod").ZodEnum<typeof InvoiceStatus>>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoice-refs.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/invoice-refs.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAE3B,aAAa,EAId,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"invoice-refs.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/invoice-refs.resource.specification.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAE3B,aAAa,EAId,MAAM,uBAAuB,CAAC;AAoP/B,eAAO,MAAM,4CAA4C;;;;;;;;;;iCAGxD,CAAC;AAEF,eAAO,MAAM,oCAAoC;;;;;;;;;;iCAA+E,CAAC"}
|
|
@@ -4,6 +4,7 @@ import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@w
|
|
|
4
4
|
import { CoreResourceOperation as Op, CoreResourceType, InvoiceStatus, ResourcePrimaryScope, InvoiceRefSchema, invoiceRefsPolymorphicFactories, } 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 invResourcePrimaryScopeByResourceType = {
|
|
8
9
|
[CoreResourceType.ORGANIZATION_INVOICE_REFS]: ResourcePrimaryScope.ORGANIZATIONS,
|
|
9
10
|
[CoreResourceType.USER_INVOICE_REFS]: ResourcePrimaryScope.USER_SELF,
|
|
@@ -37,6 +38,7 @@ function buildInvoiceRefBase(resourceType, memberName) {
|
|
|
37
38
|
businessRole: 'Lets billing surfaces show recent invoice state and money totals while invoice documents remain available through the protected billing portal.',
|
|
38
39
|
lifecycleRole: 'Created and updated from billing-provider events. The public API exposes invoice summaries as read-only records; it does not provide create, update, or delete operations.',
|
|
39
40
|
audience: LabelAudience.ADMIN,
|
|
41
|
+
subDomain: EngineResourceSubDomain.BILLING,
|
|
40
42
|
codeHandling: {
|
|
41
43
|
mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'InvoiceRefSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },
|
|
42
44
|
resourceFactoryCollectionEntry: {
|
|
@@ -69,8 +71,8 @@ function buildInvoiceRefBase(resourceType, memberName) {
|
|
|
69
71
|
total: schemaShape.total.objectSpec({ meaning: 'Money object (amount + currency) for invoice total display.' }),
|
|
70
72
|
hostedInvoiceUrl: schemaShape.hostedInvoiceUrl.stringSpec({ meaning: 'Provider-hosted invoice page. BACKEND-ONLY — never returned to a client: it is an unauthenticated capability link to a tax invoice, which legally carries the customer name and billing address. Clients reach invoice documents through the billing account\'s open_portal operation instead.' }),
|
|
71
73
|
invoicePdfUrl: schemaShape.invoicePdfUrl.stringSpec({ meaning: 'Provider-hosted invoice PDF. BACKEND-ONLY for the same reason as hostedInvoiceUrl.' }),
|
|
72
|
-
providerInvoiceId: schemaShape.providerInvoiceId.stringSpec({ meaning: 'Opaque provider id — backend-only. Also the upsert key the billing webhook uses to find an existing invoice
|
|
73
|
-
createdAt: schemaShape.createdAt.dateSpec({ meaning: '
|
|
74
|
+
providerInvoiceId: schemaShape.providerInvoiceId.stringSpec({ meaning: 'Opaque provider id — backend-only. Also the upsert key the billing webhook uses to find an existing invoice record.' }),
|
|
75
|
+
createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Record creation time.', temporalRole: 'creation' }),
|
|
74
76
|
updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last sync time.', temporalRole: 'modified' }),
|
|
75
77
|
},
|
|
76
78
|
operations: {
|
|
@@ -181,7 +183,7 @@ function buildInvoiceRefBase(resourceType, memberName) {
|
|
|
181
183
|
purpose: 'Sync status/total/url fields when webhooks arrive.',
|
|
182
184
|
outcome: 'Patched provider-mirrored fields.',
|
|
183
185
|
responseStatuses: [
|
|
184
|
-
{ code: HttpResponseStatusCode.OK_200, meaning: 'The invoice ref’s provider-mirrored fields (status, total, urls) were synced and the updated
|
|
186
|
+
{ code: HttpResponseStatusCode.OK_200, meaning: 'The invoice ref’s provider-mirrored fields (status, total, urls) were synced and the updated record is returned.' },
|
|
185
187
|
],
|
|
186
188
|
errorScenarios: [
|
|
187
189
|
{ code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoice-refs.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/invoice-refs.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,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,+BAA+B,GAChC,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,yBAAyB,CAAC,EAAE,oBAAoB,CAAC,aAAa;IAChF,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,oBAAoB,CAAC,SAAS;CACrE,CAAC;AAOF,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,U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mB,CAAC,YAA6B,EAAE,UAAiC;IAC3F,MAAM,IAAI,GAAG,mBAAmB,CAAC,YAAY,EAAE,UAAU,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,YAAY,CAAC,kBAAsD,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC;IACtH,MAAM,KAAK,GAAG,YAAY,CAAC,mBAAuD,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC;IACzH,OAAO,8CAA8C,CACnD,mCAAmC,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC,EAC9G,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,6DAA6D,EAAE;QACjF,KAAK,EAAE;YACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,+FAA+F,EAAE,SAAS,EAAE,8CAA8C,EAAE;YAClL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,8DAA8D,EAAE,SAAS,EAAE,4CAA4C,EAAE;SAChJ;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,4CAA4C,GAAG,mBAAmB,CAC7E,gBAAgB,CAAC,yBAAyB,EAC1C,2BAA2B,CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,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 CoreResourceOperation as Op,\n CoreResourceType,\n InvoiceStatus,\n ResourcePrimaryScope,\n InvoiceRefSchema,\n invoiceRefsPolymorphicFactories,\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 InvResourceType = CoreResourceType.ORGANIZATION_INVOICE_REFS | CoreResourceType.USER_INVOICE_REFS;\ntype InvResourceTypeMember = 'ORGANIZATION_INVOICE_REFS' | 'USER_INVOICE_REFS';\n\nconst invResourcePrimaryScopeByResourceType: Record<InvResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_INVOICE_REFS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_INVOICE_REFS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof invoiceRefsPolymorphicFactories)[CoreResourceType.ORGANIZATION_INVOICE_REFS]>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof InvoiceRefSchema;\ntype InvFrontend = ResourceUIBehaviorConfig<undefined, Core, Main>;\n\nfunction resolveInvUI(source: Partial<Record<string, unknown>>, resourceType: InvResourceType, sourceName: string): InvFrontend {\n const uiBehavior = source[resourceType] as InvFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildInvoiceRefBase(resourceType: InvResourceType, memberName: InvResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n invResourcePrimaryScopeByResourceType[resourceType],\n );\n const invoiceTotalExample = { amount: 4900, currency: 'USD', decimals: 2 };\n const invoiceRefExample = {\n _id: 'invoice_ref_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n status: InvoiceStatus.PAID,\n total: invoiceTotalExample,\n createdAt: '2026-06-02T08:00:00.000Z',\n updatedAt: '2026-06-02T08:05:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const invoiceRefSummaryExample = {\n _id: invoiceRefExample._id,\n status: invoiceRefExample.status,\n total: invoiceRefExample.total,\n };\n\n return resourceSpecification<undefined, Core, Main>(\n invoiceRefsPolymorphicFactories[resourceType],\n InvoiceRefSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Invoice summary for a billing account: exposes lifecycle status, money total, and timestamps without leaking provider identifiers or provider-hosted document locations.',\n businessRole: 'Lets billing surfaces show recent invoice state and money totals while invoice documents remain available through the protected billing portal.',\n lifecycleRole: 'Created and updated from billing-provider events. The public API exposes invoice summaries as read-only records; it does not provide create, update, or delete operations.',\n audience: LabelAudience.ADMIN,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'InvoiceRefSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'invoiceRefsPolymorphicFactories', 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: { coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM } },\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: ['Payment-failed and invoice-ready emails may reference these rows — verify `userNotifications[]` on operations in the factory before claiming fan-outs.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Invoice ref document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic parent billing account FK.', importance: FieldSemanticImportance.PRIMARY }),\n status: schemaShape.status.enumSpec({\n meaning: 'Provider invoice payment state for past-due surfacing.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'InvoiceStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [InvoiceStatus.DRAFT]: { meaning: 'Not finalized for collection.' },\n [InvoiceStatus.OPEN]: { meaning: 'Awaiting payment.' },\n [InvoiceStatus.PAID]: { meaning: 'Settled successfully.' },\n [InvoiceStatus.VOID]: { meaning: 'Voided at provider.' },\n [InvoiceStatus.UNCOLLECTIBLE]: { meaning: 'Written off or uncollectible per provider.' },\n },\n }),\n total: schemaShape.total.objectSpec({ meaning: 'Money object (amount + currency) for invoice total display.' }),\n hostedInvoiceUrl: schemaShape.hostedInvoiceUrl.stringSpec({ meaning: 'Provider-hosted invoice page. BACKEND-ONLY — never returned to a client: it is an unauthenticated capability link to a tax invoice, which legally carries the customer name and billing address. Clients reach invoice documents through the billing account\\'s open_portal operation instead.' }),\n invoicePdfUrl: schemaShape.invoicePdfUrl.stringSpec({ meaning: 'Provider-hosted invoice PDF. BACKEND-ONLY for the same reason as hostedInvoiceUrl.' }),\n providerInvoiceId: schemaShape.providerInvoiceId.stringSpec({ meaning: 'Opaque provider id — backend-only. Also the upsert key the billing webhook uses to find an existing invoice row.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Row creation time.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last sync time.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Open one invoice ref for detail panes.',\n outcome: 'Status and total for support and user self-serve. The invoice DOCUMENT is not linked from here — clients open it through the billing account\\'s open_portal operation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The invoice ref was found and its status and total are returned. The provider-hosted URLs are backend-only and deliberately absent from the response.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No invoice ref exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect a paid invoice header',\n response: invoiceRefExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect an invoice header with available relationship context',\n response: invoiceRefExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact invoice summary',\n response: invoiceRefSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'History table under a billing account.',\n outcome: 'Chronological refs for org or user scope.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of invoice refs for the billing account / scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse recent invoice headers',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([invoiceRefExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse invoice headers with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([invoiceRefExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact invoice summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([invoiceRefSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.SEARCH]: {\n purpose: 'Repository search (status and similar) for admin tooling.',\n outcome: 'Filtered page of invoice refs when search is enabled in factory.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of invoice refs matching the status/repository search query.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the admin entitlement required to run repository-level invoice searches.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Backfill or webhook ingestion path when the service inserts a new ref document.',\n outcome: 'New row keyed to provider invoice id in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'An invoice ref mirror was inserted (internal/repository path) and is returned keyed to its provider invoice id. Not a client-facing create — invoice refs are system-written from provider webhooks or backfills.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The ingested payload fails schema validation (e.g. missing `billingAccountId` or `providerInvoiceId`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the internal/webhook/repository path permitted to insert invoice mirrors.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'The referenced parent `billingAccountId` does not exist in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'An invoice ref already mirrors this `providerInvoiceId` (idempotent webhook re-delivery target).', errorCode: 'INVOICE_REF_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Internal ingestion of a provider invoice mirror',\n request: {\n ...exampleScope.billingAccountIdentity,\n providerInvoiceId: 'in_01HX2EXAMPLE',\n status: InvoiceStatus.OPEN,\n total: invoiceTotalExample,\n hostedInvoiceUrl: 'https://billing.example.test/invoices/in_01HX2EXAMPLE',\n },\n response: { ...invoiceRefExample, status: InvoiceStatus.OPEN },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Sync status/total/url fields when webhooks arrive.',\n outcome: 'Patched provider-mirrored fields.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The invoice ref’s provider-mirrored fields (status, total, urls) were synced and the updated row is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the internal/webhook path permitted to sync invoice mirrors.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No invoice ref exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n },\n businessConstraints: ['Line-item detail lives at the provider — this row is intentionally shallow.'],\n }),\n { resourcePrimaryScope: invResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildInvoiceRefSpec(resourceType: InvResourceType, memberName: InvResourceTypeMember) {\n const base = buildInvoiceRefBase(resourceType, memberName);\n const main = resolveInvUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveInvUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset builds `Invoice ${status}` as a readable list label.' },\n views: {\n [Op.LIST]: { purpose: 'List op present in merged preset `views` as non-addressable — document for overlay alignment.', whenToUse: 'Account invoice history surfaces when wired.' },\n [Op.READ]: { purpose: 'Read op present in merged preset `views` as non-addressable.', whenToUse: 'Invoice detail drawer from list selection.' },\n },\n }),\n );\n}\n\nexport const organizationInvoiceRefsResourceSpecification = buildInvoiceRefSpec(\n CoreResourceType.ORGANIZATION_INVOICE_REFS,\n 'ORGANIZATION_INVOICE_REFS',\n);\n\nexport const userInvoiceRefsResourceSpecification = buildInvoiceRefSpec(CoreResourceType.USER_INVOICE_REFS, 'USER_INVOICE_REFS');\n"]}
|
|
1
|
+
{"version":3,"file":"invoice-refs.resource.specification.js","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/invoice-refs.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,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,aAAa,EACb,oBAAoB,EACpB,gBAAgB,EAChB,+BAA+B,GAChC,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;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAK3E,MAAM,qCAAqC,GAA6D;IACtG,CAAC,gBAAgB,CAAC,yBAAyB,CAAC,EAAE,oBAAoB,CAAC,aAAa;IAChF,CAAC,gBAAgB,CAAC,iBAAiB,CAAC,EAAE,oBAAoB,CAAC,SAAS;CACrE,CAAC;AAOF,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,mBAAmB,CAAC,YAA6B,EAAE,UAAiC;IAC3F,MAAM,YAAY,GAAG,qCAAqC,CACxD,qCAAqC,CAAC,YAAY,CAAC,CACpD,CAAC;IACF,MAAM,mB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AAG,YAAY,CAAC,kBAAsD,EAAE,YAAY,EAAE,oBAAoB,CAAC,CAAC;IACtH,MAAM,KAAK,GAAG,YAAY,CAAC,mBAAuD,EAAE,YAAY,EAAE,qBAAqB,CAAC,CAAC;IACzH,OAAO,8CAA8C,CACnD,mCAAmC,CAAC,6BAA6B,CAAC,IAAI,CAAC,EAAE,6BAA6B,CAAC,KAAK,CAAC,CAAC,EAC9G,IAAI,EACJ,GAAG,EAAE,CAAC,CAAC;QACL,KAAK,EAAE,EAAE,OAAO,EAAE,6DAA6D,EAAE;QACjF,KAAK,EAAE;YACL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,+FAA+F,EAAE,SAAS,EAAE,8CAA8C,EAAE;YAClL,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,EAAE,8DAA8D,EAAE,SAAS,EAAE,4CAA4C,EAAE;SAChJ;KACF,CAAC,CACH,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,4CAA4C,GAAG,mBAAmB,CAC7E,gBAAgB,CAAC,yBAAyB,EAC1C,2BAA2B,CAC5B,CAAC;AAEF,MAAM,CAAC,MAAM,oCAAoC,GAAG,mBAAmB,CAAC,gBAAgB,CAAC,iBAAiB,EAAE,mBAAmB,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 CoreResourceOperation as Op,\n CoreResourceType,\n InvoiceStatus,\n ResourcePrimaryScope,\n InvoiceRefSchema,\n invoiceRefsPolymorphicFactories,\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 InvResourceType = CoreResourceType.ORGANIZATION_INVOICE_REFS | CoreResourceType.USER_INVOICE_REFS;\ntype InvResourceTypeMember = 'ORGANIZATION_INVOICE_REFS' | 'USER_INVOICE_REFS';\n\nconst invResourcePrimaryScopeByResourceType: Record<InvResourceType, BillingApiReferenceExampleScope> = {\n [CoreResourceType.ORGANIZATION_INVOICE_REFS]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.USER_INVOICE_REFS]: ResourcePrimaryScope.USER_SELF,\n};\n\ntype Cfg = ReturnType<(typeof invoiceRefsPolymorphicFactories)[CoreResourceType.ORGANIZATION_INVOICE_REFS]>;\ntype Core = Cfg['coreOperations'][number];\ntype Main = typeof InvoiceRefSchema;\ntype InvFrontend = ResourceUIBehaviorConfig<undefined, Core, Main>;\n\nfunction resolveInvUI(source: Partial<Record<string, unknown>>, resourceType: InvResourceType, sourceName: string): InvFrontend {\n const uiBehavior = source[resourceType] as InvFrontend | undefined;\n if (!uiBehavior) {\n throw new Error(`Missing \"${resourceType}\" UI behavior in ${sourceName}.`);\n }\n return uiBehavior;\n}\n\nfunction buildInvoiceRefBase(resourceType: InvResourceType, memberName: InvResourceTypeMember) {\n const exampleScope = createBillingApiReferenceScopeExample(\n invResourcePrimaryScopeByResourceType[resourceType],\n );\n const invoiceTotalExample = { amount: 4900, currency: 'USD', decimals: 2 };\n const invoiceRefExample = {\n _id: 'invoice_ref_01HX2EXAMPLE',\n ...exampleScope.billingAccountIdentity,\n status: InvoiceStatus.PAID,\n total: invoiceTotalExample,\n createdAt: '2026-06-02T08:00:00.000Z',\n updatedAt: '2026-06-02T08:05:00.000Z',\n ...exampleScope.scopeIdentity,\n };\n const invoiceRefSummaryExample = {\n _id: invoiceRefExample._id,\n status: invoiceRefExample.status,\n total: invoiceRefExample.total,\n };\n\n return resourceSpecification<undefined, Core, Main>(\n invoiceRefsPolymorphicFactories[resourceType],\n InvoiceRefSchema,\n ({ schemaShape }) => ({\n purpose:\n 'Invoice summary for a billing account: exposes lifecycle status, money total, and timestamps without leaking provider identifiers or provider-hosted document locations.',\n businessRole: 'Lets billing surfaces show recent invoice state and money totals while invoice documents remain available through the protected billing portal.',\n lifecycleRole: 'Created and updated from billing-provider events. The public API exposes invoice summaries as read-only records; it does not provide create, update, or delete operations.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.BILLING,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'InvoiceRefSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactoryCollectionEntry: {\n collectionSymbol: { packageName: '@wildo-ai/saas-models', exportName: 'invoiceRefsPolymorphicFactories', 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: { coreEnum: { packageName: '@wildo-ai/saas-models', exportName: 'CoreResourceOperation', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM } },\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: ['Payment-failed and invoice-ready emails may reference these rows — verify `userNotifications[]` on operations in the factory before claiming fan-outs.'],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Invoice ref document id.', importance: FieldSemanticImportance.PRIMARY, semanticRole: 'identifier' }),\n billingAccountId: schemaShape.billingAccountId.stringSpec({ meaning: 'Polymorphic parent billing account FK.', importance: FieldSemanticImportance.PRIMARY }),\n status: schemaShape.status.enumSpec({\n meaning: 'Provider invoice payment state for past-due surfacing.',\n enumDeclaration: { packageName: '@wildo-ai/saas-models', exportName: 'InvoiceStatus', symbolKind: CodeSymbolKind.ENUM, declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM },\n values: {\n [InvoiceStatus.DRAFT]: { meaning: 'Not finalized for collection.' },\n [InvoiceStatus.OPEN]: { meaning: 'Awaiting payment.' },\n [InvoiceStatus.PAID]: { meaning: 'Settled successfully.' },\n [InvoiceStatus.VOID]: { meaning: 'Voided at provider.' },\n [InvoiceStatus.UNCOLLECTIBLE]: { meaning: 'Written off or uncollectible per provider.' },\n },\n }),\n total: schemaShape.total.objectSpec({ meaning: 'Money object (amount + currency) for invoice total display.' }),\n hostedInvoiceUrl: schemaShape.hostedInvoiceUrl.stringSpec({ meaning: 'Provider-hosted invoice page. BACKEND-ONLY — never returned to a client: it is an unauthenticated capability link to a tax invoice, which legally carries the customer name and billing address. Clients reach invoice documents through the billing account\\'s open_portal operation instead.' }),\n invoicePdfUrl: schemaShape.invoicePdfUrl.stringSpec({ meaning: 'Provider-hosted invoice PDF. BACKEND-ONLY for the same reason as hostedInvoiceUrl.' }),\n providerInvoiceId: schemaShape.providerInvoiceId.stringSpec({ meaning: 'Opaque provider id — backend-only. Also the upsert key the billing webhook uses to find an existing invoice record.' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'Record creation time.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'Last sync time.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Open one invoice ref for detail panes.',\n outcome: 'Status and total for support and user self-serve. The invoice DOCUMENT is not linked from here — clients open it through the billing account\\'s open_portal operation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The invoice ref was found and its status and total are returned. The provider-hosted URLs are backend-only and deliberately absent from the response.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No invoice ref exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect a paid invoice header',\n response: invoiceRefExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Inspect an invoice header with available relationship context',\n response: invoiceRefExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Inspect the compact invoice summary',\n response: invoiceRefSummaryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.LIST]: {\n purpose: 'History table under a billing account.',\n outcome: 'Chronological refs for org or user scope.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of invoice refs for the billing account / scope.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse recent invoice headers',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([invoiceRefExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: {\n examples: [{\n title: 'Browse invoice headers with relationship context',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([invoiceRefExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n summary: {\n examples: [{\n title: 'Browse compact invoice summaries',\n request: BILLING_API_REFERENCE_PAGE_REQUEST,\n response: billingApiReferencePage([invoiceRefSummaryExample]),\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n },\n [Op.SEARCH]: {\n purpose: 'Repository search (status and similar) for admin tooling.',\n outcome: 'Filtered page of invoice refs when search is enabled in factory.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of invoice refs matching the status/repository search query.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the admin entitlement required to run repository-level invoice searches.' },\n ],\n idempotent: true,\n },\n [Op.CREATE]: {\n purpose: 'Backfill or webhook ingestion path when the service inserts a new ref document.',\n outcome: 'New row keyed to provider invoice id in implementation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'An invoice ref mirror was inserted (internal/repository path) and is returned keyed to its provider invoice id. Not a client-facing create — invoice refs are system-written from provider webhooks or backfills.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The ingested payload fails schema validation (e.g. missing `billingAccountId` or `providerInvoiceId`).', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the internal/webhook/repository path permitted to insert invoice mirrors.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'The referenced parent `billingAccountId` does not exist in the caller’s scope.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'An invoice ref already mirrors this `providerInvoiceId` (idempotent webhook re-delivery target).', errorCode: 'INVOICE_REF_EXISTS' },\n ],\n idempotent: false,\n examples: [\n {\n title: 'Internal ingestion of a provider invoice mirror',\n request: {\n ...exampleScope.billingAccountIdentity,\n providerInvoiceId: 'in_01HX2EXAMPLE',\n status: InvoiceStatus.OPEN,\n total: invoiceTotalExample,\n hostedInvoiceUrl: 'https://billing.example.test/invoices/in_01HX2EXAMPLE',\n },\n response: { ...invoiceRefExample, status: InvoiceStatus.OPEN },\n forStatus: HttpResponseStatusCode.CREATED_201,\n },\n ],\n },\n [Op.UPDATE]: {\n purpose: 'Sync status/total/url fields when webhooks arrive.',\n outcome: 'Patched provider-mirrored fields.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The invoice ref’s provider-mirrored fields (status, total, urls) were synced and the updated record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The synced fields fail schema validation.', errorCode: 'VALIDATION_FAILED' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not the internal/webhook path permitted to sync invoice mirrors.' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No invoice ref exists for the supplied id in the caller’s scope.' },\n ],\n idempotent: true,\n },\n },\n businessConstraints: ['Line-item detail lives at the provider — this row is intentionally shallow.'],\n }),\n { resourcePrimaryScope: invResourcePrimaryScopeByResourceType[resourceType] },\n );\n}\n\nfunction buildInvoiceRefSpec(resourceType: InvResourceType, memberName: InvResourceTypeMember) {\n const base = buildInvoiceRefBase(resourceType, memberName);\n const main = resolveInvUI(billingMainPresets as Partial<Record<string, unknown>>, resourceType, 'billingMainPresets');\n const admin = resolveInvUI(billingAdminPresets as Partial<Record<string, unknown>>, resourceType, 'billingAdminPresets');\n return resourceSpecificationFromFrontendConfiguration(\n mergeResourceFrontendConfigurations(resourceFrontendConfiguration(main), resourceFrontendConfiguration(admin)),\n base,\n () => ({\n label: { purpose: 'Preset builds `Invoice ${status}` as a readable list label.' },\n views: {\n [Op.LIST]: { purpose: 'List op present in merged preset `views` as non-addressable — document for overlay alignment.', whenToUse: 'Account invoice history surfaces when wired.' },\n [Op.READ]: { purpose: 'Read op present in merged preset `views` as non-addressable.', whenToUse: 'Invoice detail drawer from list selection.' },\n },\n }),\n );\n}\n\nexport const organizationInvoiceRefsResourceSpecification = buildInvoiceRefSpec(\n CoreResourceType.ORGANIZATION_INVOICE_REFS,\n 'ORGANIZATION_INVOICE_REFS',\n);\n\nexport const userInvoiceRefsResourceSpecification = buildInvoiceRefSpec(CoreResourceType.USER_INVOICE_REFS, 'USER_INVOICE_REFS');\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prices.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/prices.resource.specification.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAC3B,eAAe,EAEf,YAAY,EAEZ,cAAc,EACd,oBAAoB,EAErB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"prices.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/billing/resources/prices.resource.specification.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,qBAAqB,IAAI,EAAE,EAC3B,eAAe,EAEf,YAAY,EAEZ,cAAc,EACd,oBAAoB,EAErB,MAAM,uBAAuB,CAAC;AA8K/B,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;iCAoBvC,CAAC"}
|