@wildo-ai/saas-models 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/applications/applications-context.schemas.d.ts +14 -10
- package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -1
- package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/applications/applications.shared.resources-config.schemas.js +4 -3
- package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts +0 -4
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/billing-configuration.shared.schemas.js +59 -17
- package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -1
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts +77 -21
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/billing-enums.shared.schemas.js +85 -23
- package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -1
- package/dist/esm/billing/billing-types.shared.schemas.d.ts +3 -3
- package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/price.shared.schemas.js +7 -1
- package/dist/esm/billing/price.shared.schemas.js.map +1 -1
- package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js +52 -11
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -1
- package/dist/esm/billing/product-definition.shared.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.resources-config.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/product.shared.schemas.js +7 -3
- package/dist/esm/billing/product.shared.schemas.js.map +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js +15 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/billing/usage-record.shared.schemas.d.ts +7 -3
- package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/usage-record.shared.schemas.js +22 -3
- package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.d.ts +69 -2
- package/dist/esm/companion/provider-discovery.shared.schemas.d.ts.map +1 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.js +20 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts +85 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js +157 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts +23 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js +56 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts +480 -20
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js +547 -23
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -1
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js +82 -3
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -1
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts +31 -30
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js +98 -3
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts +17 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js +27 -4
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts +82 -29
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js +95 -29
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.js +12 -5
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.js.map +1 -1
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts +21 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/analytics-value-moments.shared.schemas.js +20 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -1
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts +7 -5
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts +8 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.js +29 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -1
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts +95 -17
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/entity-identity-config.shared.schemas.js +86 -8
- package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -1
- package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts +12 -12
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts +28 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -1
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js +28 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -1
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts +45 -12
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts +103 -58
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.js +176 -15
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts +15 -3
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts.map +1 -1
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js +32 -5
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js.map +1 -1
- package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts +83 -7
- package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts +59 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js +61 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts +97 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts.map +1 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js +41 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js.map +1 -0
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts +148 -2
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js +56 -1
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts +5 -28
- package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-capability.shared.schemas.js +4 -2
- package/dist/esm/external-providers/provider-capability.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts +18 -8
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js +9 -4
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts +338 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js +332 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts +178 -9
- package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-metadata.shared.schemas.js +181 -9
- package/dist/esm/external-providers/provider-metadata.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts +7 -5
- package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-protocol.shared.schemas.js +7 -5
- package/dist/esm/external-providers/provider-protocol.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts +40 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts.map +1 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.js +80 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.js.map +1 -0
- package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -1
- package/dist/esm/features/core-feature-definitions.shared.js +7 -1
- package/dist/esm/features/core-feature-definitions.shared.js.map +1 -1
- package/dist/esm/features/feature-builders.shared.d.ts +32 -0
- package/dist/esm/features/feature-builders.shared.d.ts.map +1 -1
- package/dist/esm/features/feature-builders.shared.js +32 -0
- package/dist/esm/features/feature-builders.shared.js.map +1 -1
- package/dist/esm/files/file-upload-grant.shared.schemas.d.ts +14 -2
- package/dist/esm/files/file-upload-grant.shared.schemas.d.ts.map +1 -1
- package/dist/esm/files/file-upload-grant.shared.schemas.js +44 -5
- package/dist/esm/files/file-upload-grant.shared.schemas.js.map +1 -1
- package/dist/esm/files/files.shared.schemas.d.ts +15 -8
- package/dist/esm/files/files.shared.schemas.d.ts.map +1 -1
- package/dist/esm/files/files.shared.schemas.js +15 -8
- package/dist/esm/files/files.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/actors.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts +54 -5
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts +6 -6
- package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts +0 -3
- package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/deliberation.shared.schemas.js +0 -5
- package/dist/esm/flows-actors/deliberation.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts +14 -0
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js +40 -3
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts +19 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js +33 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts +14 -9
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js +14 -9
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts +128 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.js +142 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts +0 -3
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js +1 -4
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts +0 -16
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js +1 -17
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts +3 -3
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js +3 -3
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts +2 -8
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js +4 -15
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/guidance/guidance-state.shared.utils.d.ts.map +1 -1
- package/dist/esm/guidance/guidance-state.shared.utils.js +1 -0
- package/dist/esm/guidance/guidance-state.shared.utils.js.map +1 -1
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts +8 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts +46 -0
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -1
- package/dist/esm/guidance/progression-state.shared.schemas.js +49 -0
- package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -1
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts +320 -50
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts.map +1 -1
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js +137 -36
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js.map +1 -1
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts +11 -2
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -1
- package/dist/esm/notifications/email/email-template.shared.enums.d.ts +15 -0
- package/dist/esm/notifications/email/email-template.shared.enums.d.ts.map +1 -1
- package/dist/esm/notifications/email/email-template.shared.enums.js +15 -0
- package/dist/esm/notifications/email/email-template.shared.enums.js.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js +19 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts +30 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js +65 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js.map +1 -1
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts +6 -4
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -1
- package/dist/esm/notifications/notification-badges.core.definitions.js +6 -4
- package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -1
- package/dist/esm/notifications/notification-badges.schemas.d.ts +167 -5
- package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/notification-badges.schemas.js +191 -6
- package/dist/esm/notifications/notification-badges.schemas.js.map +1 -1
- package/dist/esm/notifications/notifications.shared.schemas.d.ts +107 -0
- package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/notifications.shared.schemas.js +149 -1
- package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.js +22 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts +26 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-preferences.shared.schemas.js +25 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts +25 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-profile.shared.schemas.js +42 -17
- package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts +3 -2
- package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts.map +1 -1
- package/dist/esm/organizations/organization-unit-narrowing.shared.js +9 -2
- package/dist/esm/organizations/organization-unit-narrowing.shared.js.map +1 -1
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js +18 -3
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/public-runtime/index.d.ts +49 -2
- package/dist/esm/public-runtime/index.d.ts.map +1 -1
- package/dist/esm/public-runtime/index.js +48 -1
- package/dist/esm/public-runtime/index.js.map +1 -1
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts +6 -5
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js +6 -5
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/queue/jobs.shared.schemas.d.ts +16 -3
- package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -1
- package/dist/esm/queue/jobs.shared.schemas.js +16 -3
- package/dist/esm/queue/jobs.shared.schemas.js.map +1 -1
- package/dist/esm/requests/manual-controllers-routes-documentation.d.ts +137 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.d.ts.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.js +1201 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.js.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts +67 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -1
- package/dist/esm/requests/manual-controllers-routes-urls.js +78 -0
- package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -1
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts +11 -1
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -1
- package/dist/esm/requests/rate-limits.shared.schemas.js +11 -1
- package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -1
- package/dist/esm/requests/websocket.shared.schemas.d.ts +27 -4
- package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -1
- package/dist/esm/requests/websocket.shared.schemas.js +35 -0
- package/dist/esm/requests/websocket.shared.schemas.js.map +1 -1
- package/dist/esm/resources/resources-config.shared.factory.d.ts +1 -0
- package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -1
- package/dist/esm/resources/resources-config.shared.factory.js +105 -20
- package/dist/esm/resources/resources-config.shared.factory.js.map +1 -1
- package/dist/esm/resources/resources-config.shared.schemas.d.ts +254 -72
- package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -1
- package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -1
- package/dist/esm/resources/resources-registry.shared.core.definitions.js +97 -5
- package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -1
- package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -1
- package/dist/esm/resources/resources-relationships.shared.factory.js +15 -0
- package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -1
- package/dist/esm/resources/resources.shared.core.definitions.d.ts +37 -0
- package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -1
- package/dist/esm/resources/resources.shared.core.definitions.js +51 -0
- package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -1
- package/dist/esm/resources/resources.shared.schemas.d.ts +11 -2
- package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -1
- package/dist/esm/resources/resources.shared.schemas.js +34 -3
- package/dist/esm/resources/resources.shared.schemas.js.map +1 -1
- package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts +51 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.js +53 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-summary.utils.d.ts +16 -2
- package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -1
- package/dist/esm/resources/utils/resources-summary.utils.js +19 -5
- package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -1
- package/dist/esm/resources/utils/shared-persistence-collection.utils.d.ts.map +1 -1
- package/dist/esm/resources/utils/shared-persistence-collection.utils.js +11 -0
- package/dist/esm/resources/utils/shared-persistence-collection.utils.js.map +1 -1
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts +25 -0
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -1
- package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js +38 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js +38 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts +4 -11
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js +0 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts +84 -5
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.schemas.js +83 -3
- package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts +1 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js +11 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -1
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts +15 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js +21 -4
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts +61 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js +208 -6
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts +37 -27
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js +134 -12
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts +0 -6
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js +17 -8
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js +27 -0
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts +52 -7
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js +45 -8
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js.map +1 -1
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js +198 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js +191 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts +250 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js +486 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js.map +1 -0
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts +4 -1
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js +29 -0
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts +4 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js +29 -0
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts +6 -0
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js +31 -0
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts +13 -0
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js +24 -3
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js.map +1 -1
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts +4 -4
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts +4 -4
- package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/users/user-self.shared.resources-config.schemas.js +33 -3
- package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts +17 -1
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/users/users.shared.resources-config.schemas.js +136 -5
- package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/users/users.shared.schemas.d.ts +43 -12
- package/dist/esm/users/users.shared.schemas.d.ts.map +1 -1
- package/dist/esm/users/users.shared.schemas.js +38 -7
- package/dist/esm/users/users.shared.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -5,14 +5,28 @@
|
|
|
5
5
|
* These supersede the legacy enums from billing.shared.schemas.ts.
|
|
6
6
|
*
|
|
7
7
|
* Enums shared with the standard billing interface (PricingModel, BillingInterval,
|
|
8
|
-
* TaxDisplayMode, SubscriptionStatus) are defined in
|
|
9
|
-
* and re-exported here for convenience.
|
|
8
|
+
* TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior) are defined in
|
|
9
|
+
* @wildo-ai/external-connectors-models and re-exported here for convenience.
|
|
10
10
|
*
|
|
11
11
|
* @see billing-and-features-system.md §6 (Billing Schemas)
|
|
12
12
|
*/
|
|
13
|
-
export { PricingModel, BillingInterval, TaxDisplayMode, SubscriptionStatus } from '@wildo-ai/external-connectors-models';
|
|
13
|
+
export { PricingModel, BillingInterval, TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior } from '@wildo-ai/external-connectors-models';
|
|
14
14
|
// ── Product & Pricing ──────────────────────────────────────────────
|
|
15
15
|
/**
|
|
16
|
+
* @wildo_source:part:start saas.models.billing.catalog-vocabularies facet:layer:shared facet:audience:app-developer
|
|
17
|
+
*
|
|
18
|
+
* The vocabularies an application types into its own product catalogue — the `ProductDefinition[]`
|
|
19
|
+
* it exports from its shared library and hands to the engine with its module declarations.
|
|
20
|
+
*
|
|
21
|
+
* Imported from `@wildo-ai/saas-models`. `PricingModel`, `BillingInterval` and `ProrationBehavior`
|
|
22
|
+
* are re-exported from the connector models, because their values ARE the provider's wire values.
|
|
23
|
+
*
|
|
24
|
+
* ⚠️ **The catalogue is ONE-WAY.** Sync pushes only rows that have no provider link yet, so a product
|
|
25
|
+
* or price edited in the provider's own dashboard is never read back, never reconciled, and never
|
|
26
|
+
* reported. Removing a product from the array does not retire it at the provider and does not
|
|
27
|
+
* deactivate the existing row — nothing detects that a previously synced key has disappeared. Treat
|
|
28
|
+
* the array as the source of truth and make every change through it.
|
|
29
|
+
*
|
|
16
30
|
* Product types available in the billing catalog.
|
|
17
31
|
*
|
|
18
32
|
* | Type | Creates subscription? | Repeatable? | Grants features? | Usage tracked? |
|
|
@@ -53,12 +67,9 @@ export var LimitGrantMode;
|
|
|
53
67
|
/**
|
|
54
68
|
* Proration behavior for plan changes (upgrade/downgrade).
|
|
55
69
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
ProrationBehavior["NONE"] = "none";
|
|
60
|
-
ProrationBehavior["ALWAYS_INVOICE"] = "always_invoice";
|
|
61
|
-
})(ProrationBehavior || (ProrationBehavior = {}));
|
|
70
|
+
// ProrationBehavior: re-exported from @wildo-ai/external-connectors-models (see top of file).
|
|
71
|
+
// Moved there 2026-09-08 (#516) because its three values ARE the provider's wire values, so the
|
|
72
|
+
// request contract has to be able to name the type — see TaxDisplayMode for the same reasoning.
|
|
62
73
|
/**
|
|
63
74
|
* Billing timing: when to apply plan changes.
|
|
64
75
|
*/
|
|
@@ -67,6 +78,7 @@ export var BillingTiming;
|
|
|
67
78
|
BillingTiming["IMMEDIATE"] = "immediate";
|
|
68
79
|
BillingTiming["AT_PERIOD_END"] = "at_period_end";
|
|
69
80
|
})(BillingTiming || (BillingTiming = {}));
|
|
81
|
+
/** @wildo_source:part:end saas.models.billing.catalog-vocabularies */
|
|
70
82
|
// BillingInterval: re-exported from @wildo-ai/external-connectors-models (see top of file)
|
|
71
83
|
// ── Metering & Usage ───────────────────────────────────────────────
|
|
72
84
|
/**
|
|
@@ -95,6 +107,53 @@ export var UsageSourceType;
|
|
|
95
107
|
UsageSourceType["RESOURCE_COUNT"] = "resource_count";
|
|
96
108
|
UsageSourceType["CUSTOM"] = "custom";
|
|
97
109
|
})(UsageSourceType || (UsageSourceType = {}));
|
|
110
|
+
/**
|
|
111
|
+
* Where one metered usage row stands with respect to the provider flush.
|
|
112
|
+
*
|
|
113
|
+
* This was a BOOLEAN (`reportedToProvider`) until 2026-09-09, and the third state is the whole
|
|
114
|
+
* reason it is an enum now (#512). A boolean can say "not yet reported" and "reported", and the
|
|
115
|
+
* flush selects on the first — so a row that can NEVER be reported has nowhere to go. It stays
|
|
116
|
+
* pending, is re-selected by every run, fails identically, and grows an error backlog that no
|
|
117
|
+
* operator action can drain, on a five-minute schedule.
|
|
118
|
+
*
|
|
119
|
+
* The three states are genuinely distinct and must not be collapsed:
|
|
120
|
+
*
|
|
121
|
+
* - {@link PENDING} — the flush will try again. Every newly recorded row starts here.
|
|
122
|
+
* - {@link REPORTED} — the provider acknowledged the quantity. `reportedAt` says when. Terminal,
|
|
123
|
+
* and money has moved: never move a row back out of this state.
|
|
124
|
+
* - {@link UNREPORTABLE} — the flush determined the row can never be reported, for a reason named
|
|
125
|
+
* in `unreportableReason`. Terminal, and NO money moved. Marking such a row `REPORTED` instead
|
|
126
|
+
* would drain the backlog just as well and would be a lie no later reader could detect, which is
|
|
127
|
+
* exactly why the state exists rather than a shortcut.
|
|
128
|
+
*/
|
|
129
|
+
export var UsageRecordFlushState;
|
|
130
|
+
(function (UsageRecordFlushState) {
|
|
131
|
+
UsageRecordFlushState["PENDING"] = "pending";
|
|
132
|
+
UsageRecordFlushState["REPORTED"] = "reported";
|
|
133
|
+
UsageRecordFlushState["UNREPORTABLE"] = "unreportable";
|
|
134
|
+
})(UsageRecordFlushState || (UsageRecordFlushState = {}));
|
|
135
|
+
/**
|
|
136
|
+
* Why a usage row was determined to be permanently unreportable.
|
|
137
|
+
*
|
|
138
|
+
* One member today, and it is a closed vocabulary rather than a free string because the operator
|
|
139
|
+
* reading a retained financial record needs to know which permanent condition applies — and because
|
|
140
|
+
* the distinction between a PERMANENT and a TRANSIENT failure is the judgement this whole state
|
|
141
|
+
* turns on. A billing account that merely has no `providerCustomerId` yet is transient: the account
|
|
142
|
+
* exists, provisioning may still complete, and such a row stays {@link UsageRecordFlushState.PENDING}.
|
|
143
|
+
* Only a condition that cannot resolve itself belongs here.
|
|
144
|
+
*/
|
|
145
|
+
export var UsageRecordUnreportableReason;
|
|
146
|
+
(function (UsageRecordUnreportableReason) {
|
|
147
|
+
/**
|
|
148
|
+
* The billing account row no longer exists.
|
|
149
|
+
*
|
|
150
|
+
* Reachable by design: usage rows are RETAINED when their subject is erased (the tax/audit
|
|
151
|
+
* obligation on `usage-record.shared.schemas.ts`), so a deleted account legitimately leaves rows
|
|
152
|
+
* behind with no provider customer to report them to. Nothing can restore the mapping, so the
|
|
153
|
+
* quantity will never be billed and saying so on the row is the only honest outcome.
|
|
154
|
+
*/
|
|
155
|
+
UsageRecordUnreportableReason["BILLING_ACCOUNT_DELETED"] = "billing_account_deleted";
|
|
156
|
+
})(UsageRecordUnreportableReason || (UsageRecordUnreportableReason = {}));
|
|
98
157
|
// ── Tax ────────────────────────────────────────────────────────────
|
|
99
158
|
// TaxDisplayMode: re-exported from @wildo-ai/external-connectors-models (see top of file)
|
|
100
159
|
/**
|
|
@@ -107,20 +166,9 @@ export var TaxCalculationMode;
|
|
|
107
166
|
})(TaxCalculationMode || (TaxCalculationMode = {}));
|
|
108
167
|
// ── Subscription & Invoice Status ──────────────────────────────────
|
|
109
168
|
// SubscriptionStatus: re-exported from @wildo-ai/external-connectors-models (see top of file)
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
* Invoices are created and managed entirely by the billing provider.
|
|
114
|
-
* We store a thin reference for status tracking and quick display.
|
|
115
|
-
*/
|
|
116
|
-
export var InvoiceStatus;
|
|
117
|
-
(function (InvoiceStatus) {
|
|
118
|
-
InvoiceStatus["DRAFT"] = "draft";
|
|
119
|
-
InvoiceStatus["OPEN"] = "open";
|
|
120
|
-
InvoiceStatus["PAID"] = "paid";
|
|
121
|
-
InvoiceStatus["VOID"] = "void";
|
|
122
|
-
InvoiceStatus["UNCOLLECTIBLE"] = "uncollectible";
|
|
123
|
-
})(InvoiceStatus || (InvoiceStatus = {}));
|
|
169
|
+
// InvoiceStatus: re-exported from @wildo-ai/external-connectors-models (see top of file).
|
|
170
|
+
// It moved there on 2026-09-09 so `StandardBilling_InvoiceData` could name it; the specifier every
|
|
171
|
+
// consumer imports is unchanged.
|
|
124
172
|
// ── Billing Scope ──────────────────────────────────────────────────
|
|
125
173
|
/**
|
|
126
174
|
* Billing-compatible scope types.
|
|
@@ -252,6 +300,20 @@ export var BillingCheckoutMetadataKey;
|
|
|
252
300
|
BillingCheckoutMetadataKey["BILLING_ACCOUNT_ID"] = "wildo_billingAccountId";
|
|
253
301
|
/** The catalog product key purchased — selects the credit pool and credits-per-unit on top-up. */
|
|
254
302
|
BillingCheckoutMetadataKey["PRODUCT_KEY"] = "wildo_productKey";
|
|
303
|
+
/**
|
|
304
|
+
* The PROMOTION row whose code the framework validated when it opened this checkout, so the
|
|
305
|
+
* redemption can be counted when the session COMPLETES (#518).
|
|
306
|
+
*
|
|
307
|
+
* Absent when the purchase used no code, which is the common case.
|
|
308
|
+
*
|
|
309
|
+
* Stamped rather than re-derived from the completed session, because the provider reports the
|
|
310
|
+
* DISCOUNT it applied and not the Wildo row that authorised it — and the row is what carries
|
|
311
|
+
* `maxRedemptions`. Like every key here it is written for the framework's own reconciliation and is
|
|
312
|
+
* never trusted as authority on its own: the redemption is counted with a compare-and-swap that
|
|
313
|
+
* refuses past the cap, so a tampered value can at worst count a redemption against a promotion
|
|
314
|
+
* that has room for one.
|
|
315
|
+
*/
|
|
316
|
+
BillingCheckoutMetadataKey["PROMOTION_ID"] = "wildo_promotionId";
|
|
255
317
|
/**
|
|
256
318
|
* The purchased quantity, as a decimal integer string (provider metadata values are strings).
|
|
257
319
|
* Strictly parsed and bounded by {@link BILLING_CHECKOUT_MAX_QUANTITY} on the way back in.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"billing-enums.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/billing-enums.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,sCAAsC,CAAC;AAEzH,sEAAsE;AAEtE;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,gEAAgE;IAChE,4BAAa,CAAA;IACb,6DAA6D;IAC7D,8BAAe,CAAA;IACf,kEAAkE;IAClE,kCAAmB,CAAA;IACnB,6EAA6E;IAC7E,oCAAqB,CAAA;IACrB,sEAAsE;IACtE,0CAA2B,CAAA;IAC3B,0EAA0E;IAC1E,4BAAa,CAAA;AACf,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,6BAAW,CAAA;AACb,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB;AAED,sEAAsE;AAEtE;;GAEG;AACH,MAAM,CAAN,IAAY,iBAIX;AAJD,WAAY,iBAAiB;IAC3B,4DAAuC,CAAA;IACvC,kCAAa,CAAA;IACb,sDAAiC,CAAA;AACnC,CAAC,EAJW,iBAAiB,KAAjB,iBAAiB,QAI5B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACvB,wCAAuB,CAAA;IACvB,gDAA+B,CAAA;AACjC,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB;AAED,2FAA2F;AAE3F,sEAAsE;AAEtE;;GAEG;AACH,MAAM,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AAA;IAChC;;;OAGG;IACH,yDAA2B,CAAA;AAC7B,CAAC,EAhBW,0BAA0B,KAA1B,0BAA0B,QAgBrC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC","sourcesContent":["/**\n * Billing Enums (Shared)\n *\n * All billing-system enums used across backend, frontend, and shared models.\n * These supersede the legacy enums from billing.shared.schemas.ts.\n *\n * Enums shared with the standard billing interface (PricingModel, BillingInterval,\n * TaxDisplayMode, SubscriptionStatus) are defined in @wildo-ai/external-connectors-models\n * and re-exported here for convenience.\n *\n * @see billing-and-features-system.md §6 (Billing Schemas)\n */\n\nexport { PricingModel, BillingInterval, TaxDisplayMode, SubscriptionStatus } from '@wildo-ai/external-connectors-models';\n\n// ── Product & Pricing ──────────────────────────────────────────────\n\n/**\n * Product types available in the billing catalog.\n *\n * | Type | Creates subscription? | Repeatable? | Grants features? | Usage tracked? |\n * |-------------|----------------------|-------------|------------------|----------------|\n * | PLAN | Yes (exclusive) | No (switch) | Yes | No |\n * | ADDON | Yes (stackable) | No (toggle) | Yes | No |\n * | METERED | Yes | No | Optional | Yes |\n * | ONE_TIME | No | No (once) | Optional | No |\n * | CREDIT_PACK | No | Yes | No (credits) | Credits-based |\n * | ITEM | No | Yes | Optional | No |\n */\nexport enum ProductType {\n /** Subscription plan, mutually exclusive per billing account */\n PLAN = 'plan',\n /** Optional subscription add-on, stackable on top of plan */\n ADDON = 'addon',\n /** Usage-based subscription (consumption reported to provider) */\n METERED = 'metered',\n /** Single purchase, once per billing account (e.g., setup fee, migration) */\n ONE_TIME = 'one_time',\n /** Buy a pack of credits/tokens (repeatable, consumable over time) */\n CREDIT_PACK = 'credit_pack',\n /** Purchasable item, repeatable (e.g., report generation, data export) */\n ITEM = 'item',\n}\n\n/**\n * Limit grant mode: how this product's limits compose with other products.\n * - SET: absolute value (replaces, used for PLAN base limits)\n * - ADD: additive (stacks on top, used for ADDON bonus limits)\n */\nexport enum LimitGrantMode {\n SET = 'set',\n ADD = 'add',\n}\n\n// ── Billing Lifecycle ──────────────────────────────────────────────\n\n/**\n * Proration behavior for plan changes (upgrade/downgrade).\n */\nexport enum ProrationBehavior {\n CREATE_PRORATIONS = 'create_prorations',\n NONE = 'none',\n ALWAYS_INVOICE = 'always_invoice',\n}\n\n/**\n * Billing timing: when to apply plan changes.\n */\nexport enum BillingTiming {\n IMMEDIATE = 'immediate',\n AT_PERIOD_END = 'at_period_end',\n}\n\n// BillingInterval: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// ── Metering & Usage ───────────────────────────────────────────────\n\n/**\n * Metering aggregation window for usage records.\n */\nexport enum MeteringAggregationWindow {\n PER_FLUSH = 'per_flush',\n PER_BILLING_PERIOD = 'per_billing_period',\n}\n\n/**\n * Usage aggregation type for metered prices.\n */\nexport enum UsageAggregationType {\n SUM = 'sum',\n MAX = 'max',\n LAST = 'last',\n}\n\n/**\n * Usage record source type.\n */\nexport enum UsageSourceType {\n OPERATION = 'operation',\n RESOURCE_COUNT = 'resource_count',\n CUSTOM = 'custom',\n}\n\n// ── Tax ────────────────────────────────────────────────────────────\n\n// TaxDisplayMode: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n/**\n * Tax calculation mode: provider-managed or disabled.\n */\nexport enum TaxCalculationMode {\n PROVIDER_MANAGED = 'provider_managed',\n DISABLED = 'disabled',\n}\n\n// ── Subscription & Invoice Status ──────────────────────────────────\n\n// SubscriptionStatus: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n/**\n * Invoice status values (maps to Stripe invoice statuses).\n *\n * Invoices are created and managed entirely by the billing provider.\n * We store a thin reference for status tracking and quick display.\n */\nexport enum InvoiceStatus {\n DRAFT = 'draft',\n OPEN = 'open',\n PAID = 'paid',\n VOID = 'void',\n UNCOLLECTIBLE = 'uncollectible',\n}\n\n// ── Billing Scope ──────────────────────────────────────────────────\n\n/**\n * Billing-compatible scope types.\n * Subset of ResourcePrimaryScope — excludes APPLICATION which has no billing variants.\n * Used by scope-agnostic billing resources (e.g., Referrals) that reference\n * billing accounts across different polymorphic collections.\n */\nexport enum BillingScopeType {\n ORGANIZATIONS = 'organizations',\n USER_SELF = 'user_self',\n}\n\n// ── Promotions & Referrals ─────────────────────────────────────────\n\n/**\n * Promotion type.\n */\nexport enum PromotionType {\n /** Direct discount */\n COUPON = 'coupon',\n /** Code-based discount */\n PROMOTION_CODE = 'promotion_code',\n /** Referral program */\n REFERRAL = 'referral',\n /** Special deal/offer */\n DEAL = 'deal',\n}\n\n/**\n * Discount type for promotions.\n */\nexport enum DiscountType {\n PERCENTAGE = 'percentage',\n FIXED_AMOUNT = 'fixed_amount',\n}\n\n/**\n * Promotion duration (how long the discount applies).\n */\nexport enum PromotionDuration {\n ONCE = 'once',\n REPEATING = 'repeating',\n FOREVER = 'forever',\n}\n\n/**\n * Referral status lifecycle.\n */\nexport enum ReferralStatus {\n PENDING = 'pending',\n ACCEPTED = 'accepted',\n CONVERTED = 'converted',\n EXPIRED = 'expired',\n CANCELLED = 'cancelled',\n}\n\n/**\n * Reward type for the referrer (person who referred).\n */\nexport enum ReferrerRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n COMMISSION = 'commission',\n}\n\n/**\n * Reward type for the referred (new customer).\n */\nexport enum ReferredRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n TRIAL_EXTENSION = 'trial_extension',\n}\n\n// ── Provider checkout metadata: the framework/caller trust boundary ─────────────\n\n/**\n * Prefix that marks a provider-metadata key as FRAMEWORK-AUTHORITATIVE.\n *\n * ## Why a reserved namespace exists at all\n *\n * A provider checkout session carries ONE flat `metadata` map, and two parties want to write into\n * it: the framework (which needs to recognise the purchase when the provider echoes the session\n * back on `checkout.session.completed`) and the application's own caller (who legitimately wants\n * to tag the purchase for their analytics or reconciliation).\n *\n * Those two writers do not have the same authority. The framework's entries decide WHICH billing\n * account is credited and HOW MUCH — the provider replays them verbatim inside a genuinely SIGNED\n * webhook, so a signature proves the provider sent them, never that the framework wrote them. The\n * caller's entries decide nothing.\n *\n * Sharing one un-partitioned namespace between those two authorities is what turned a caller-supplied\n * map into a credit-minting primitive: the producer spread caller metadata LAST, so `billingAccountId`\n * / `productKey` / `quantity` were simply overwritable, and the webhook consumer read the result back\n * as trusted framework state. Ordering alone is not the fix — swapping the spread leaves an\n * unmarked namespace in which the NEXT authoritative key is one careless line from being overridable\n * again. The prefix makes the trust boundary a property of the KEY, so it survives refactors.\n *\n * The boundary is enforced in three places, deliberately overlapping:\n * 1. the OPEN_CHECKOUT request DTO REFUSES any caller key carrying this prefix (loud, at the edge);\n * 2. the metadata builder writes the reserved entries LAST (structural, cannot be forgotten);\n * 3. the webhook consumer reads ONLY reserved keys, and re-derives the billing account from\n * provider-authoritative data rather than trusting the echoed value.\n *\n * @see BillingCheckoutMetadataKey for the reserved key vocabulary itself.\n */\nexport const BILLING_RESERVED_METADATA_KEY_PREFIX = 'wildo_';\n\n/**\n * The closed vocabulary of framework-authoritative provider-metadata keys.\n *\n * Every member MUST start with {@link BILLING_RESERVED_METADATA_KEY_PREFIX} — that is what makes the\n * DTO's caller-key refusal and the consumer's read-only-reserved rule line up. A member added\n * without the prefix would be silently overridable by a caller, which is the whole defect this\n * vocabulary exists to prevent, so a pinned test asserts the prefix across every member.\n *\n * Named rather than inlined because each member carries a different obligation on the consumer side\n * (one is cross-checked against provider truth, one selects the product, one is bounded and\n * strictly parsed) and a bare string literal has nowhere to record that.\n */\nexport enum BillingCheckoutMetadataKey {\n /**\n * The billing account the checkout was opened FOR.\n *\n * Written for traceability and cross-checking only. The webhook consumer re-derives the account\n * from the provider-authoritative customer id on the event and REFUSES the event if the echoed\n * value disagrees — it is never used as the account to credit.\n */\n BILLING_ACCOUNT_ID = 'wildo_billingAccountId',\n /** The catalog product key purchased — selects the credit pool and credits-per-unit on top-up. */\n PRODUCT_KEY = 'wildo_productKey',\n /**\n * The purchased quantity, as a decimal integer string (provider metadata values are strings).\n * Strictly parsed and bounded by {@link BILLING_CHECKOUT_MAX_QUANTITY} on the way back in.\n */\n QUANTITY = 'wildo_quantity',\n}\n\n/**\n * Upper bound on a single checkout's line-item quantity, applied on BOTH sides of the provider\n * round trip: the OPEN_CHECKOUT request DTO refuses more, and the webhook consumer refuses to\n * honour more.\n *\n * One shared constant rather than two, because a consumer bound lower than the producer bound would\n * silently refuse legitimate large purchases the framework itself allowed to be billed — the\n * failure mode where the customer is charged and the credits never arrive.\n *\n * The value is a framework policy ceiling, not a provider-derived one: it is deliberately far above\n * any plausible self-serve purchase and far below the range where an unbounded quantity becomes a\n * credit-minting primitive. An application whose catalog genuinely sells in larger units should\n * raise it here, where both sides read it, rather than at either end.\n */\nexport const BILLING_CHECKOUT_MAX_QUANTITY = 999_999;\n"]}
|
|
1
|
+
{"version":3,"file":"billing-enums.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/billing-enums.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,kBAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AAE3J,sEAAsE;AAEtE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAN,IAAY,WAaX;AAbD,WAAY,WAAW;IACrB,gEAAgE;IAChE,4BAAa,CAAA;IACb,6DAA6D;IAC7D,8BAAe,CAAA;IACf,kEAAkE;IAClE,kCAAmB,CAAA;IACnB,6EAA6E;IAC7E,oCAAqB,CAAA;IACrB,sEAAsE;IACtE,0CAA2B,CAAA;IAC3B,0EAA0E;IAC1E,4BAAa,CAAA;AACf,CAAC,EAbW,WAAW,KAAX,WAAW,QAatB;AAED;;;;GAIG;AACH,MAAM,CAAN,IAAY,cAGX;AAHD,WAAY,cAAc;IACxB,6BAAW,CAAA;IACX,6BAAW,CAAA;AACb,CAAC,EAHW,cAAc,KAAd,cAAc,QAGzB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C,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED;;GAEG;AACH,MAAM,CAAN,IAAY,kBAKX;AALD,WAAY,kBAAkB;IAC5B,uCAAiB,CAAA;IACjB,2CAAqB,CAAA;IACrB,yCAAmB,CAAA;IACnB,yDAAmC,CAAA;AACrC,CAAC,EALW,kBAAkB,KAAlB,kBAAkB,QAK7B;AAED,mFAAmF;AAEnF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,QAAQ,CAAC;AAE7D;;;;;;;;;;;GAWG;AACH,MAAM,CAAN,IAAY,0BA8BX;AA9BD,WAAY,0BAA0B;IACpC;;;;;;OAMG;IACH,2EAA6C,CAAA;IAC7C,kGAAkG;IAClG,8DAAgC,CAAA;IAChC;;;;;;;;;;;;OAYG;IACH,gEAAkC,CAAA;IAClC;;;OAGG;IACH,yDAA2B,CAAA;AAC7B,CAAC,EA9BW,0BAA0B,KAA1B,0BAA0B,QA8BrC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,6BAA6B,GAAG,OAAO,CAAC","sourcesContent":["/**\n * Billing Enums (Shared)\n *\n * All billing-system enums used across backend, frontend, and shared models.\n * These supersede the legacy enums from billing.shared.schemas.ts.\n *\n * Enums shared with the standard billing interface (PricingModel, BillingInterval,\n * TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior) are defined in\n * @wildo-ai/external-connectors-models and re-exported here for convenience.\n *\n * @see billing-and-features-system.md §6 (Billing Schemas)\n */\n\nexport { PricingModel, BillingInterval, TaxDisplayMode, SubscriptionStatus, InvoiceStatus, ProrationBehavior } from '@wildo-ai/external-connectors-models';\n\n// ── Product & Pricing ──────────────────────────────────────────────\n\n/**\n * @wildo_source:part:start saas.models.billing.catalog-vocabularies facet:layer:shared facet:audience:app-developer\n *\n * The vocabularies an application types into its own product catalogue — the `ProductDefinition[]`\n * it exports from its shared library and hands to the engine with its module declarations.\n *\n * Imported from `@wildo-ai/saas-models`. `PricingModel`, `BillingInterval` and `ProrationBehavior`\n * are re-exported from the connector models, because their values ARE the provider's wire values.\n *\n * ⚠️ **The catalogue is ONE-WAY.** Sync pushes only rows that have no provider link yet, so a product\n * or price edited in the provider's own dashboard is never read back, never reconciled, and never\n * reported. Removing a product from the array does not retire it at the provider and does not\n * deactivate the existing row — nothing detects that a previously synced key has disappeared. Treat\n * the array as the source of truth and make every change through it.\n *\n * Product types available in the billing catalog.\n *\n * | Type | Creates subscription? | Repeatable? | Grants features? | Usage tracked? |\n * |-------------|----------------------|-------------|------------------|----------------|\n * | PLAN | Yes (exclusive) | No (switch) | Yes | No |\n * | ADDON | Yes (stackable) | No (toggle) | Yes | No |\n * | METERED | Yes | No | Optional | Yes |\n * | ONE_TIME | No | No (once) | Optional | No |\n * | CREDIT_PACK | No | Yes | No (credits) | Credits-based |\n * | ITEM | No | Yes | Optional | No |\n */\nexport enum ProductType {\n /** Subscription plan, mutually exclusive per billing account */\n PLAN = 'plan',\n /** Optional subscription add-on, stackable on top of plan */\n ADDON = 'addon',\n /** Usage-based subscription (consumption reported to provider) */\n METERED = 'metered',\n /** Single purchase, once per billing account (e.g., setup fee, migration) */\n ONE_TIME = 'one_time',\n /** Buy a pack of credits/tokens (repeatable, consumable over time) */\n CREDIT_PACK = 'credit_pack',\n /** Purchasable item, repeatable (e.g., report generation, data export) */\n ITEM = 'item',\n}\n\n/**\n * Limit grant mode: how this product's limits compose with other products.\n * - SET: absolute value (replaces, used for PLAN base limits)\n * - ADD: additive (stacks on top, used for ADDON bonus limits)\n */\nexport enum LimitGrantMode {\n SET = 'set',\n ADD = 'add',\n}\n\n// ── Billing Lifecycle ──────────────────────────────────────────────\n\n/**\n * Proration behavior for plan changes (upgrade/downgrade).\n */\n// ProrationBehavior: re-exported from @wildo-ai/external-connectors-models (see top of file).\n// Moved there 2026-09-08 (#516) because its three values ARE the provider's wire values, so the\n// request contract has to be able to name the type — see TaxDisplayMode for the same reasoning.\n\n/**\n * Billing timing: when to apply plan changes.\n */\nexport enum BillingTiming {\n IMMEDIATE = 'immediate',\n AT_PERIOD_END = 'at_period_end',\n}\n/** @wildo_source:part:end saas.models.billing.catalog-vocabularies */\n\n// BillingInterval: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// ── Metering & Usage ───────────────────────────────────────────────\n\n/**\n * Metering aggregation window for usage records.\n */\nexport enum MeteringAggregationWindow {\n PER_FLUSH = 'per_flush',\n PER_BILLING_PERIOD = 'per_billing_period',\n}\n\n/**\n * Usage aggregation type for metered prices.\n */\nexport enum UsageAggregationType {\n SUM = 'sum',\n MAX = 'max',\n LAST = 'last',\n}\n\n/**\n * Usage record source type.\n */\nexport enum UsageSourceType {\n OPERATION = 'operation',\n RESOURCE_COUNT = 'resource_count',\n CUSTOM = 'custom',\n}\n\n/**\n * Where one metered usage row stands with respect to the provider flush.\n *\n * This was a BOOLEAN (`reportedToProvider`) until 2026-09-09, and the third state is the whole\n * reason it is an enum now (#512). A boolean can say \"not yet reported\" and \"reported\", and the\n * flush selects on the first — so a row that can NEVER be reported has nowhere to go. It stays\n * pending, is re-selected by every run, fails identically, and grows an error backlog that no\n * operator action can drain, on a five-minute schedule.\n *\n * The three states are genuinely distinct and must not be collapsed:\n *\n * - {@link PENDING} — the flush will try again. Every newly recorded row starts here.\n * - {@link REPORTED} — the provider acknowledged the quantity. `reportedAt` says when. Terminal,\n * and money has moved: never move a row back out of this state.\n * - {@link UNREPORTABLE} — the flush determined the row can never be reported, for a reason named\n * in `unreportableReason`. Terminal, and NO money moved. Marking such a row `REPORTED` instead\n * would drain the backlog just as well and would be a lie no later reader could detect, which is\n * exactly why the state exists rather than a shortcut.\n */\nexport enum UsageRecordFlushState {\n PENDING = 'pending',\n REPORTED = 'reported',\n UNREPORTABLE = 'unreportable',\n}\n\n/**\n * Why a usage row was determined to be permanently unreportable.\n *\n * One member today, and it is a closed vocabulary rather than a free string because the operator\n * reading a retained financial record needs to know which permanent condition applies — and because\n * the distinction between a PERMANENT and a TRANSIENT failure is the judgement this whole state\n * turns on. A billing account that merely has no `providerCustomerId` yet is transient: the account\n * exists, provisioning may still complete, and such a row stays {@link UsageRecordFlushState.PENDING}.\n * Only a condition that cannot resolve itself belongs here.\n */\nexport enum UsageRecordUnreportableReason {\n /**\n * The billing account row no longer exists.\n *\n * Reachable by design: usage rows are RETAINED when their subject is erased (the tax/audit\n * obligation on `usage-record.shared.schemas.ts`), so a deleted account legitimately leaves rows\n * behind with no provider customer to report them to. Nothing can restore the mapping, so the\n * quantity will never be billed and saying so on the row is the only honest outcome.\n */\n BILLING_ACCOUNT_DELETED = 'billing_account_deleted',\n}\n\n// ── Tax ────────────────────────────────────────────────────────────\n\n// TaxDisplayMode: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n/**\n * Tax calculation mode: provider-managed or disabled.\n */\nexport enum TaxCalculationMode {\n PROVIDER_MANAGED = 'provider_managed',\n DISABLED = 'disabled',\n}\n\n// ── Subscription & Invoice Status ──────────────────────────────────\n\n// SubscriptionStatus: re-exported from @wildo-ai/external-connectors-models (see top of file)\n\n// InvoiceStatus: re-exported from @wildo-ai/external-connectors-models (see top of file).\n// It moved there on 2026-09-09 so `StandardBilling_InvoiceData` could name it; the specifier every\n// consumer imports is unchanged.\n\n// ── Billing Scope ──────────────────────────────────────────────────\n\n/**\n * Billing-compatible scope types.\n * Subset of ResourcePrimaryScope — excludes APPLICATION which has no billing variants.\n * Used by scope-agnostic billing resources (e.g., Referrals) that reference\n * billing accounts across different polymorphic collections.\n */\nexport enum BillingScopeType {\n ORGANIZATIONS = 'organizations',\n USER_SELF = 'user_self',\n}\n\n// ── Promotions & Referrals ─────────────────────────────────────────\n\n/**\n * Promotion type.\n */\nexport enum PromotionType {\n /** Direct discount */\n COUPON = 'coupon',\n /** Code-based discount */\n PROMOTION_CODE = 'promotion_code',\n /** Referral program */\n REFERRAL = 'referral',\n /** Special deal/offer */\n DEAL = 'deal',\n}\n\n/**\n * Discount type for promotions.\n */\nexport enum DiscountType {\n PERCENTAGE = 'percentage',\n FIXED_AMOUNT = 'fixed_amount',\n}\n\n/**\n * Promotion duration (how long the discount applies).\n */\nexport enum PromotionDuration {\n ONCE = 'once',\n REPEATING = 'repeating',\n FOREVER = 'forever',\n}\n\n/**\n * Referral status lifecycle.\n */\nexport enum ReferralStatus {\n PENDING = 'pending',\n ACCEPTED = 'accepted',\n CONVERTED = 'converted',\n EXPIRED = 'expired',\n CANCELLED = 'cancelled',\n}\n\n/**\n * Reward type for the referrer (person who referred).\n */\nexport enum ReferrerRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n COMMISSION = 'commission',\n}\n\n/**\n * Reward type for the referred (new customer).\n */\nexport enum ReferredRewardType {\n CREDIT = 'credit',\n DISCOUNT = 'discount',\n FEATURE = 'feature',\n TRIAL_EXTENSION = 'trial_extension',\n}\n\n// ── Provider checkout metadata: the framework/caller trust boundary ─────────────\n\n/**\n * Prefix that marks a provider-metadata key as FRAMEWORK-AUTHORITATIVE.\n *\n * ## Why a reserved namespace exists at all\n *\n * A provider checkout session carries ONE flat `metadata` map, and two parties want to write into\n * it: the framework (which needs to recognise the purchase when the provider echoes the session\n * back on `checkout.session.completed`) and the application's own caller (who legitimately wants\n * to tag the purchase for their analytics or reconciliation).\n *\n * Those two writers do not have the same authority. The framework's entries decide WHICH billing\n * account is credited and HOW MUCH — the provider replays them verbatim inside a genuinely SIGNED\n * webhook, so a signature proves the provider sent them, never that the framework wrote them. The\n * caller's entries decide nothing.\n *\n * Sharing one un-partitioned namespace between those two authorities is what turned a caller-supplied\n * map into a credit-minting primitive: the producer spread caller metadata LAST, so `billingAccountId`\n * / `productKey` / `quantity` were simply overwritable, and the webhook consumer read the result back\n * as trusted framework state. Ordering alone is not the fix — swapping the spread leaves an\n * unmarked namespace in which the NEXT authoritative key is one careless line from being overridable\n * again. The prefix makes the trust boundary a property of the KEY, so it survives refactors.\n *\n * The boundary is enforced in three places, deliberately overlapping:\n * 1. the OPEN_CHECKOUT request DTO REFUSES any caller key carrying this prefix (loud, at the edge);\n * 2. the metadata builder writes the reserved entries LAST (structural, cannot be forgotten);\n * 3. the webhook consumer reads ONLY reserved keys, and re-derives the billing account from\n * provider-authoritative data rather than trusting the echoed value.\n *\n * @see BillingCheckoutMetadataKey for the reserved key vocabulary itself.\n */\nexport const BILLING_RESERVED_METADATA_KEY_PREFIX = 'wildo_';\n\n/**\n * The closed vocabulary of framework-authoritative provider-metadata keys.\n *\n * Every member MUST start with {@link BILLING_RESERVED_METADATA_KEY_PREFIX} — that is what makes the\n * DTO's caller-key refusal and the consumer's read-only-reserved rule line up. A member added\n * without the prefix would be silently overridable by a caller, which is the whole defect this\n * vocabulary exists to prevent, so a pinned test asserts the prefix across every member.\n *\n * Named rather than inlined because each member carries a different obligation on the consumer side\n * (one is cross-checked against provider truth, one selects the product, one is bounded and\n * strictly parsed) and a bare string literal has nowhere to record that.\n */\nexport enum BillingCheckoutMetadataKey {\n /**\n * The billing account the checkout was opened FOR.\n *\n * Written for traceability and cross-checking only. The webhook consumer re-derives the account\n * from the provider-authoritative customer id on the event and REFUSES the event if the echoed\n * value disagrees — it is never used as the account to credit.\n */\n BILLING_ACCOUNT_ID = 'wildo_billingAccountId',\n /** The catalog product key purchased — selects the credit pool and credits-per-unit on top-up. */\n PRODUCT_KEY = 'wildo_productKey',\n /**\n * The PROMOTION row whose code the framework validated when it opened this checkout, so the\n * redemption can be counted when the session COMPLETES (#518).\n *\n * Absent when the purchase used no code, which is the common case.\n *\n * Stamped rather than re-derived from the completed session, because the provider reports the\n * DISCOUNT it applied and not the Wildo row that authorised it — and the row is what carries\n * `maxRedemptions`. Like every key here it is written for the framework's own reconciliation and is\n * never trusted as authority on its own: the redemption is counted with a compare-and-swap that\n * refuses past the cap, so a tampered value can at worst count a redemption against a promotion\n * that has room for one.\n */\n PROMOTION_ID = 'wildo_promotionId',\n /**\n * The purchased quantity, as a decimal integer string (provider metadata values are strings).\n * Strictly parsed and bounded by {@link BILLING_CHECKOUT_MAX_QUANTITY} on the way back in.\n */\n QUANTITY = 'wildo_quantity',\n}\n\n/**\n * Upper bound on a single checkout's line-item quantity, applied on BOTH sides of the provider\n * round trip: the OPEN_CHECKOUT request DTO refuses more, and the webhook consumer refuses to\n * honour more.\n *\n * One shared constant rather than two, because a consumer bound lower than the producer bound would\n * silently refuse legitimate large purchases the framework itself allowed to be billed — the\n * failure mode where the customer is charged and the credits never arrive.\n *\n * The value is a framework policy ceiling, not a provider-derived one: it is deliberately far above\n * any plausible self-serve purchase and far below the range where an unbounded quantity becomes a\n * credit-minting primitive. An application whose catalog genuinely sells in larger units should\n * raise it here, where both sides read it, rather than at either end.\n */\nexport const BILLING_CHECKOUT_MAX_QUANTITY = 999_999;\n"]}
|
|
@@ -141,11 +141,11 @@ export declare const BillingStateResponseSchema: z.ZodObject<{
|
|
|
141
141
|
requirePaymentMethod: z.ZodDefault<z.ZodBoolean>;
|
|
142
142
|
}, z.core.$strip>>;
|
|
143
143
|
upgrade: z.ZodOptional<z.ZodObject<{
|
|
144
|
-
proration: z.ZodDefault<z.ZodEnum<typeof import("
|
|
144
|
+
proration: z.ZodDefault<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
145
145
|
timing: z.ZodDefault<z.ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
146
146
|
}, z.core.$strip>>;
|
|
147
147
|
downgrade: z.ZodOptional<z.ZodObject<{
|
|
148
|
-
proration: z.ZodDefault<z.ZodEnum<typeof import("
|
|
148
|
+
proration: z.ZodDefault<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
149
149
|
timing: z.ZodDefault<z.ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
150
150
|
}, z.core.$strip>>;
|
|
151
151
|
cancellation: z.ZodOptional<z.ZodObject<{
|
|
@@ -193,7 +193,7 @@ export declare const BillingStateResponseSchema: z.ZodObject<{
|
|
|
193
193
|
invoices: z.ZodArray<z.ZodObject<{
|
|
194
194
|
_id: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>;
|
|
195
195
|
billingAccountId: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodString>>;
|
|
196
|
-
status: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodEnum<typeof import("
|
|
196
|
+
status: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").InvoiceStatus>>>>;
|
|
197
197
|
total: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedMoneySchema>>;
|
|
198
198
|
hostedInvoiceUrl: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodString>>>;
|
|
199
199
|
invoicePdfUrl: import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<import("@wildo-ai/zod-decorators").DecoratedPrimitiveZodType<z.ZodOptional<z.ZodString>>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAIxD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"price.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,EACf,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;GAQG;AACH,eAAO,MAAM,eAAe;;;;iBAO1B,CAAC;AACH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAIxD,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;iBAkDtB,CAAC;AACH,MAAM,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,CAAC"}
|
|
@@ -55,7 +55,13 @@ export const PriceSchema = z.object({
|
|
|
55
55
|
usageAggregation: z.enum(UsageAggregationType).optional(),
|
|
56
56
|
/**
|
|
57
57
|
* Tax behavior for this price (maps to Stripe's price.tax_behavior).
|
|
58
|
-
*
|
|
58
|
+
*
|
|
59
|
+
* There is NO resolution chain: this value alone reaches the provider. The catalog sync passes
|
|
60
|
+
* `taxBehavior` straight through on both the price upsert and the provider price creation, so
|
|
61
|
+
* leaving it unset does not fall back to `product.taxDisplayMode` or to
|
|
62
|
+
* `BillingConfiguration.tax.defaultDisplayMode`. The provider call simply omits `tax_behavior`
|
|
63
|
+
* and the billing account's own default decides. Declare it here on every price whose tax
|
|
64
|
+
* presentation matters.
|
|
59
65
|
* - 'exclusive': amount is HT, tax added on top
|
|
60
66
|
* - 'inclusive': amount is TTC, tax embedded
|
|
61
67
|
* When absent: inherits from product, then from global config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"price.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/price.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EACL,YAAY,EACZ,eAAe,EACf,oBAAoB,EACpB,cAAc,GACf,MAAM,gCAAgC,CAAC;AAExC,sEAAsE;AAEtE;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACtC,sEAAsE;IACtE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC3B,mCAAmC;IACnC,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;IAChF,6DAA6D;IAC7D,SAAS,EAAE,OAAO,CAAC,EAAE,iBAAiB,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;CACjF,CAAC,CAAC;AAGH,sEAAsE;AAEtE,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC;IAElC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,cAAc,EAAE;IACtD,sCAAsC;IACtC,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC,WAAW,EAAE;IAEzD,iEAAiE;IACjE,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,c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Q,EAAE;IACzC,gDAAgD;IAChD,gBAAgB,EAAE,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,QAAQ,EAAE;IAEzD;;;;;;;;;;;;OAYG;IACH,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,QAAQ,EAAE;IAE9C,mEAAmE;IACnE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,aAAa,EAAE;IACtD,4EAA4E;IAC5E,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACpC,mDAAmD;IACnD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE;IAEjD,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC","sourcesContent":["/**\n * Price & Price Tier Schemas (Shared)\n *\n * Prices define how much a product costs. A product can have multiple prices\n * (e.g., monthly vs. yearly, different currencies).\n *\n * Prices are APPLICATION-scoped, linked to a Product via productId.\n * Like products, they are populated lazily from the code-defined catalog.\n *\n * @see billing-and-features-system.md §6.2 (Product & Price Catalog)\n */\n\nimport { z } from 'zod';\nimport { z_money, CurrencyAllowed } from '@wildo-ai/zod-decorators';\nimport {\n PricingModel,\n BillingInterval,\n UsageAggregationType,\n TaxDisplayMode,\n} from './billing-enums.shared.schemas';\n\n// ── Price Tier ─────────────────────────────────────────────────────\n\n/**\n * A single tier in a tiered/graduated pricing model.\n * `upTo: null` means \"infinity\" (the final open-ended tier).\n *\n * Tier amounts carry their own currency via z_money for:\n * - Self-describing data (no implicit dependency on parent Price's currency)\n * - Proper money input rendering in forms\n * - Bigint precision for all monetary values\n */\nexport const PriceTierSchema = z.object({\n /** Upper bound for this tier (null = infinity, i.e. the last tier) */\n upTo: z.number().nullable(),\n /** Per-unit price for this tier */\n unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }),\n /** Flat price added to this tier (on top of unit pricing) */\n flatPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }),\n});\nexport type PriceTier = z.infer<typeof PriceTierSchema>;\n\n// ── Price ──────────────────────────────────────────────────────────\n\nexport const PriceSchema = z.object({\n\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n /** Reference to the parent product */\n productId: z.string().min(1).isForeignKey().isDBIndexed(),\n\n /** Pricing model (flat, per_unit, tiered, graduated, package) */\n model: z.enum(PricingModel).isSummaryField().systemEnum('PricingModel'),\n /**\n * Unit price for FLAT/PER_UNIT models.\n * Uses z_money for bigint precision, self-contained currency, and proper form rendering.\n * Undefined for TIERED/GRADUATED models (use `tiers` instead).\n */\n unitPrice: z_money({ currenciesAllowed: [CurrencyAllowed.FIAT], minAmount: 0n }).isSummaryField(),\n\n /** Billing interval (undefined for one-time prices) */\n interval: z.enum(BillingInterval).optional().isSummaryField(),\n /** Interval count (e.g., 3 for quarterly = interval:'month', intervalCount:3) */\n intervalCount: z.number().min(1).default(1),\n\n /** Tiers for TIERED/GRADUATED pricing models */\n tiers: z.array(PriceTierSchema).optional(),\n /** Package size for PACKAGE pricing model (price per N units) */\n packageSize: z.number().min(1).optional(),\n /** Usage aggregation type for metered prices */\n usageAggregation: z.enum(UsageAggregationType).optional(),\n\n /**\n * Tax behavior for this price (maps to Stripe's price.tax_behavior).\n *\n * There is NO resolution chain: this value alone reaches the provider. The catalog sync passes\n * `taxBehavior` straight through on both the price upsert and the provider price creation, so\n * leaving it unset does not fall back to `product.taxDisplayMode` or to\n * `BillingConfiguration.tax.defaultDisplayMode`. The provider call simply omits `tax_behavior`\n * and the billing account's own default decides. Declare it here on every price whose tax\n * presentation matters.\n * - 'exclusive': amount is HT, tax added on top\n * - 'inclusive': amount is TTC, tax embedded\n * When absent: inherits from product, then from global config.\n */\n taxBehavior: z.enum(TaxDisplayMode).optional(),\n\n /** Provider sync (lazy: populated on first use, not at startup) */\n providerPriceId: z.string().optional().isBackendOnly(),\n /** Whether this is the default price for the product (shown first in UI) */\n isDefault: z.boolean().default(true),\n /** Whether this price is available for purchase */\n isActive: z.boolean().default(true).isDBIndexed(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type Price = z.infer<typeof PriceSchema>;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-behavior-policy.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/product-behavior-policy.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"product-behavior-policy.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/product-behavior-policy.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AAIxC;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,gBAAgB;;;iBAK3B,CAAC;AACH,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8FtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -44,7 +44,17 @@ export const ProductBehaviorPolicySchema = z.object({
|
|
|
44
44
|
trial: z.object({
|
|
45
45
|
/** Number of trial days (0 = no trial) */
|
|
46
46
|
days: z.number().min(0).default(0),
|
|
47
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Require a payment method before the trial starts. READ since 2026-09-08 (#408).
|
|
49
|
+
*
|
|
50
|
+
* It reached no provider call before that, so a trial declared as requiring a card behaved
|
|
51
|
+
* identically to one that did not — Wonder Todos' enterprise plan (`true`) and professional
|
|
52
|
+
* plan (`false`) were indistinguishable at the provider.
|
|
53
|
+
*
|
|
54
|
+
* Only meaningful WITH a trial: a product declaring it alongside `days: 0` demands nothing,
|
|
55
|
+
* because asking for a card up front on a purchase with no trial is a different decision and
|
|
56
|
+
* nobody authored it.
|
|
57
|
+
*/
|
|
48
58
|
requirePaymentMethod: z.boolean().default(false),
|
|
49
59
|
}).optional(),
|
|
50
60
|
/** Upgrade behavior (when switching TO this plan from a lower tier) */
|
|
@@ -67,22 +77,53 @@ export const ProductBehaviorPolicySchema = z.object({
|
|
|
67
77
|
defaultBehavior: z.enum(BillingTiming).default(BillingTiming.AT_PERIOD_END),
|
|
68
78
|
}).optional(),
|
|
69
79
|
/**
|
|
70
|
-
* Authored metering policy (for METERED products only)
|
|
80
|
+
* Authored metering policy (for METERED products only), READ by
|
|
81
|
+
* `UsageMeteringBackendService` since 2026-09-08 (#415).
|
|
71
82
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
76
|
-
*
|
|
83
|
+
* Every field here was declared, defaulted, documented and read by NOTHING until then: the flush
|
|
84
|
+
* merged every pending row by billing account and product whatever the product said, so
|
|
85
|
+
* `preFlushAggregation: false` was unrepresentable and `aggregationWindow`'s two members selected
|
|
86
|
+
* between behaviours that were the same behaviour. The note that stood here said exactly that and
|
|
87
|
+
* asked that the gap stay visible rather than become "a false runtime guarantee"; this replaces it
|
|
88
|
+
* because the guarantee is now real, and says which reader makes each field true.
|
|
77
89
|
*/
|
|
78
90
|
metering: z.object({
|
|
79
|
-
/**
|
|
91
|
+
/**
|
|
92
|
+
* How often to flush aggregated usage to the billing provider (minutes).
|
|
93
|
+
*
|
|
94
|
+
* Read by the engine's usage-flush batch, which picks the SHORTEST interval any metered product
|
|
95
|
+
* authors — a schedule is one thing and the products sharing it are many, so the fastest promise
|
|
96
|
+
* is the one that has to be kept. A product asking for less frequent reporting than its neighbour
|
|
97
|
+
* still gets reported at the neighbour's cadence, which costs nothing: reporting sooner than
|
|
98
|
+
* authored is never wrong, reporting later than authored is.
|
|
99
|
+
*/
|
|
80
100
|
flushIntervalMinutes: z.number().min(1).default(60),
|
|
81
|
-
/**
|
|
101
|
+
/**
|
|
102
|
+
* Whether one meter event may span a billing-period boundary.
|
|
103
|
+
*
|
|
104
|
+
* This is not a preference, it is a correctness choice about MONEY. A merged group carries ONE
|
|
105
|
+
* timestamp and the provider assigns the event to the period that timestamp falls in, so
|
|
106
|
+
* `PER_FLUSH` merging across a boundary bills the earlier period's usage into the later one.
|
|
107
|
+
* `PER_BILLING_PERIOD` splits at the boundary, derived from the subscription's own
|
|
108
|
+
* `currentPeriodStart` / `currentPeriodEnd`. Leave it `PER_FLUSH` when the product's periods do
|
|
109
|
+
* not change what it costs.
|
|
110
|
+
*/
|
|
82
111
|
aggregationWindow: z.enum(MeteringAggregationWindow).default(MeteringAggregationWindow.PER_FLUSH),
|
|
83
|
-
/**
|
|
112
|
+
/**
|
|
113
|
+
* Aggregate locally before sending (sum same-key records into one meter event).
|
|
114
|
+
*
|
|
115
|
+
* `false` sends one event per recorded row, each with its own instant. Choose it when the provider
|
|
116
|
+
* must see every event — because its aggregation is not a sum, or because the individual instants
|
|
117
|
+
* matter. Local merging destroys both irreversibly, before the provider ever sees them.
|
|
118
|
+
*/
|
|
84
119
|
preFlushAggregation: z.boolean().default(true),
|
|
85
|
-
/**
|
|
120
|
+
/**
|
|
121
|
+
* Retry policy when a provider report fails.
|
|
122
|
+
*
|
|
123
|
+
* Safe only because every meter event carries a derived idempotency identifier: a retry after a
|
|
124
|
+
* response lost in transit re-sends the same identifier and the provider discards it. Retrying
|
|
125
|
+
* without that is how a timeout becomes a double charge, which is why the two shipped together.
|
|
126
|
+
*/
|
|
86
127
|
retryPolicy: z.object({
|
|
87
128
|
maxRetries: z.number().default(3),
|
|
88
129
|
backoffMultiplier: z.number().default(2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-behavior-policy.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/product-behavior-policy.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AAExC,sEAAsE;AAEtE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,2DAA2D;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,0CAA0C;IAC1C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC;CACzD,CAAC,CAAC;AAGH,sEAAsE;AAEtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,mFAAmF;IACnF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,0CAA0C;QAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAClC
|
|
1
|
+
{"version":3,"file":"product-behavior-policy.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/product-behavior-policy.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,aAAa,EACb,yBAAyB,GAC1B,MAAM,gCAAgC,CAAC;AAExC,sEAAsE;AAEtE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,2DAA2D;IAC3D,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,0CAA0C;IAC1C,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG,CAAC;CACzD,CAAC,CAAC;AAGH,sEAAsE;AAEtE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC;IAClD,mFAAmF;IACnF,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,0CAA0C;QAC1C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;QAClC;;;;;;;;;;WAUG;QACH,oBAAoB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;KACjD,CAAC,CAAC,QAAQ,EAAE;IAEb,uEAAuE;IACvE,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC;QAChB,4EAA4E;QAC5E,SAAS,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,iBAAiB,CAAC;QACjF,oDAAoD;QACpD,M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YACjC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;SACzC,CAAC,CAAC,OAAO,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,CAAC;KACpD,CAAC,CAAC,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * Product Behavior Policy & Limit Grant Schemas (Shared)\n *\n * Declarative configuration for how the billing provider and the engine\n * should handle product lifecycle (trial, proration, cancellation, metering).\n *\n * Also defines the LimitGrant schema that controls how product limits compose.\n *\n * @see billing-and-features-system.md §6.1 (LimitGrant), §6.1 (ProductBehaviorPolicy)\n */\n\nimport { z } from 'zod';\nimport {\n LimitGrantMode,\n ProrationBehavior,\n BillingTiming,\n MeteringAggregationWindow,\n} from './billing-enums.shared.schemas';\n\n// ── Limit Grant ────────────────────────────────────────────────────\n\n/**\n * A limit grant from a product.\n *\n * - SET mode: absolute value (replaces, used for PLAN base limits).\n * Example: \"Professional plan gives you 50 projects.\"\n * - ADD mode: additive (stacks on top, used for ADDON bonus limits).\n * Example: \"+10 extra projects.\"\n *\n * Aggregation algorithm in BillingFeatureSyncBackendService:\n * 1. Start with active PLAN's SET limits (only one active plan per billing account)\n * 2. For each active ADDON with ADD mode: sum onto current limit\n * 3. For each active ADDON with SET mode: take max(current, addon value)\n * 4. FEATURES_UNLIMITED always wins in any comparison\n */\nexport const LimitGrantSchema = z.object({\n /** The limit value (count or -1 for FEATURES_UNLIMITED) */\n value: z.number(),\n /** How this grant composes with others */\n mode: z.enum(LimitGrantMode).default(LimitGrantMode.SET),\n});\nexport type LimitGrant = z.infer<typeof LimitGrantSchema>;\n\n// ── Product Behavior Policy ────────────────────────────────────────\n\n/**\n * Declarative configuration for how the billing provider and the engine\n * should handle this product's lifecycle.\n *\n * This is the \"billing policy\" layer — NOT reimplementing provider logic,\n * but CONFIGURING the parameters that get passed to the provider's API.\n */\nexport const ProductBehaviorPolicySchema = z.object({\n /** Trial configuration (overrides global BillingConfiguration.defaultTrialDays) */\n trial: z.object({\n /** Number of trial days (0 = no trial) */\n days: z.number().min(0).default(0),\n /**\n * Require a payment method before the trial starts. READ since 2026-09-08 (#408).\n *\n * It reached no provider call before that, so a trial declared as requiring a card behaved\n * identically to one that did not — Wonder Todos' enterprise plan (`true`) and professional\n * plan (`false`) were indistinguishable at the provider.\n *\n * Only meaningful WITH a trial: a product declaring it alongside `days: 0` demands nothing,\n * because asking for a card up front on a purchase with no trial is a different decision and\n * nobody authored it.\n */\n requirePaymentMethod: z.boolean().default(false),\n }).optional(),\n\n /** Upgrade behavior (when switching TO this plan from a lower tier) */\n upgrade: z.object({\n /** Proration passed to provider: create_prorations, none, always_invoice */\n proration: z.enum(ProrationBehavior).default(ProrationBehavior.CREATE_PRORATIONS),\n /** Apply immediately or at end of current period */\n timing: z.enum(BillingTiming).default(BillingTiming.IMMEDIATE),\n }).optional(),\n\n /** Downgrade behavior (when switching FROM this plan to a lower tier) */\n downgrade: z.object({\n proration: z.enum(ProrationBehavior).default(ProrationBehavior.NONE),\n timing: z.enum(BillingTiming).default(BillingTiming.AT_PERIOD_END),\n }).optional(),\n\n /** Cancellation behavior for subscriptions on this product */\n cancellation: z.object({\n /** Allow immediate cancellation (vs only at period end) */\n allowImmediate: z.boolean().default(false),\n /** Default cancellation timing when user cancels */\n defaultBehavior: z.enum(BillingTiming).default(BillingTiming.AT_PERIOD_END),\n }).optional(),\n\n /**\n * Authored metering policy (for METERED products only), READ by\n * `UsageMeteringBackendService` since 2026-09-08 (#415).\n *\n * Every field here was declared, defaulted, documented and read by NOTHING until then: the flush\n * merged every pending row by billing account and product whatever the product said, so\n * `preFlushAggregation: false` was unrepresentable and `aggregationWindow`'s two members selected\n * between behaviours that were the same behaviour. The note that stood here said exactly that and\n * asked that the gap stay visible rather than become \"a false runtime guarantee\"; this replaces it\n * because the guarantee is now real, and says which reader makes each field true.\n */\n metering: z.object({\n /**\n * How often to flush aggregated usage to the billing provider (minutes).\n *\n * Read by the engine's usage-flush batch, which picks the SHORTEST interval any metered product\n * authors — a schedule is one thing and the products sharing it are many, so the fastest promise\n * is the one that has to be kept. A product asking for less frequent reporting than its neighbour\n * still gets reported at the neighbour's cadence, which costs nothing: reporting sooner than\n * authored is never wrong, reporting later than authored is.\n */\n flushIntervalMinutes: z.number().min(1).default(60),\n /**\n * Whether one meter event may span a billing-period boundary.\n *\n * This is not a preference, it is a correctness choice about MONEY. A merged group carries ONE\n * timestamp and the provider assigns the event to the period that timestamp falls in, so\n * `PER_FLUSH` merging across a boundary bills the earlier period's usage into the later one.\n * `PER_BILLING_PERIOD` splits at the boundary, derived from the subscription's own\n * `currentPeriodStart` / `currentPeriodEnd`. Leave it `PER_FLUSH` when the product's periods do\n * not change what it costs.\n */\n aggregationWindow: z.enum(MeteringAggregationWindow).default(MeteringAggregationWindow.PER_FLUSH),\n /**\n * Aggregate locally before sending (sum same-key records into one meter event).\n *\n * `false` sends one event per recorded row, each with its own instant. Choose it when the provider\n * must see every event — because its aggregation is not a sum, or because the individual instants\n * matter. Local merging destroys both irreversibly, before the provider ever sees them.\n */\n preFlushAggregation: z.boolean().default(true),\n /**\n * Retry policy when a provider report fails.\n *\n * Safe only because every meter event carries a derived idempotency identifier: a retry after a\n * response lost in transit re-sends the same identifier and the provider discards it. Retrying\n * without that is how a timeout becomes a double charge, which is why the two shipped together.\n */\n retryPolicy: z.object({\n maxRetries: z.number().default(3),\n backoffMultiplier: z.number().default(2),\n }).default({ maxRetries: 3, backoffMultiplier: 2 }),\n }).optional(),\n});\nexport type ProductBehaviorPolicy = z.infer<typeof ProductBehaviorPolicySchema>;\n"]}
|
|
@@ -74,11 +74,11 @@ export declare const ProductDefinitionSchema: z.ZodObject<{
|
|
|
74
74
|
requirePaymentMethod: z.ZodDefault<z.ZodBoolean>;
|
|
75
75
|
}, z.core.$strip>>;
|
|
76
76
|
upgrade: z.ZodOptional<z.ZodObject<{
|
|
77
|
-
proration: z.ZodDefault<z.ZodEnum<typeof import("
|
|
77
|
+
proration: z.ZodDefault<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
78
78
|
timing: z.ZodDefault<z.ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
79
79
|
}, z.core.$strip>>;
|
|
80
80
|
downgrade: z.ZodOptional<z.ZodObject<{
|
|
81
|
-
proration: z.ZodDefault<z.ZodEnum<typeof import("
|
|
81
|
+
proration: z.ZodDefault<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
82
82
|
timing: z.ZodDefault<z.ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
83
83
|
}, z.core.$strip>>;
|
|
84
84
|
cancellation: z.ZodOptional<z.ZodObject<{
|
|
@@ -31,11 +31,11 @@ export declare const productsResourceConfiguration_InitializationFactory: (resou
|
|
|
31
31
|
requirePaymentMethod: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
32
32
|
}, import("zod/v4/core").$strip>>;
|
|
33
33
|
upgrade: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
34
|
-
proration: import("zod").ZodDefault<import("zod").ZodEnum<typeof import("
|
|
34
|
+
proration: import("zod").ZodDefault<import("zod").ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
35
35
|
timing: import("zod").ZodDefault<import("zod").ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
36
36
|
}, import("zod/v4/core").$strip>>;
|
|
37
37
|
downgrade: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
38
|
-
proration: import("zod").ZodDefault<import("zod").ZodEnum<typeof import("
|
|
38
|
+
proration: import("zod").ZodDefault<import("zod").ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
39
39
|
timing: import("zod").ZodDefault<import("zod").ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
40
40
|
}, import("zod/v4/core").$strip>>;
|
|
41
41
|
cancellation: import("zod").ZodOptional<import("zod").ZodObject<{
|
|
@@ -44,11 +44,11 @@ export declare const ProductSchema: z.ZodObject<{
|
|
|
44
44
|
requirePaymentMethod: z.ZodDefault<z.ZodBoolean>;
|
|
45
45
|
}, z.core.$strip>>;
|
|
46
46
|
upgrade: z.ZodOptional<z.ZodObject<{
|
|
47
|
-
proration: z.ZodDefault<z.ZodEnum<typeof import("
|
|
47
|
+
proration: z.ZodDefault<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
48
48
|
timing: z.ZodDefault<z.ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
49
49
|
}, z.core.$strip>>;
|
|
50
50
|
downgrade: z.ZodOptional<z.ZodObject<{
|
|
51
|
-
proration: z.ZodDefault<z.ZodEnum<typeof import("
|
|
51
|
+
proration: z.ZodDefault<z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ProrationBehavior>>;
|
|
52
52
|
timing: z.ZodDefault<z.ZodEnum<typeof import("./billing-enums.shared.schemas").BillingTiming>>;
|
|
53
53
|
}, z.core.$strip>>;
|
|
54
54
|
cancellation: z.ZodOptional<z.ZodObject<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/product.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,cAAc,EACf,MAAM,gCAAgC,CAAC;AAIxC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"product.shared.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/product.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EACL,WAAW,EACX,cAAc,EACf,MAAM,gCAAgC,CAAC;AAIxC,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA8ExB,CAAC;AACH,MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC"}
|
|
@@ -49,12 +49,16 @@ export const ProductSchema = z.object({
|
|
|
49
49
|
/** For ADDON type: required plan tiers to subscribe to this addon (empty = no restriction) */
|
|
50
50
|
requiredPlanTiers: z.array(z.string()).optional(),
|
|
51
51
|
/**
|
|
52
|
-
* Tax display
|
|
52
|
+
* Tax display intent for this product, recorded on the product row.
|
|
53
53
|
* - 'exclusive': price amounts are HT (tax added at checkout)
|
|
54
54
|
* - 'inclusive': price amounts are TTC (tax embedded)
|
|
55
|
-
* When absent: uses global default from BillingConfiguration.
|
|
56
55
|
*
|
|
57
|
-
*
|
|
56
|
+
* It is DECLARATIVE ONLY and does not reach the billing provider. The catalog sync stores it on
|
|
57
|
+
* the product and then sends each price's own `taxBehavior` unchanged, so a price that declares
|
|
58
|
+
* none is created without `tax_behavior` regardless of what this field says. To make the
|
|
59
|
+
* intention effective, set `taxBehavior` on the prices as well.
|
|
60
|
+
*
|
|
61
|
+
* Common pattern: org products exclusive, user products inclusive.
|
|
58
62
|
*/
|
|
59
63
|
taxDisplayMode: z.enum(TaxDisplayMode).optional(),
|
|
60
64
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product.shared.schemas.js","sourceRoot":"","sources":["../../../../src/billing/product.shared.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE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AC3C,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAChC,mDAAmD;IACnD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE;IACpD,qDAAqD;IACrD,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC,cAAc,EAAE;IAClE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAErD,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;IACrF,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,iBAAiB,EAAE,CAAC,iBAAiB,EAAE;CACtF,CAAC,CAAC","sourcesContent":["/**\n * Product Schema (Shared)\n *\n * Products define what you sell. They live in the DB as APPLICATION-scoped records,\n * populated lazily from the code-defined ProductDefinition catalog.\n *\n * Config-driven, lazy-populated:\n * 1. Config is the source of truth: Product definitions live in code (shared lib)\n * 2. Populate on demand: DB records created on first checkout/admin view\n * 3. Provider sync on demand: providerProductId filled when first used in provider ops\n * 4. Bulk sync available: Admin action to pre-populate all products\n * 5. Startup is lightweight: No blocking provider calls at boot\n *\n * The admin UI shows products as read-only resources (view + \"Sync to Provider\" action),\n * NOT as CRUD-editable. Changes require code deployment.\n *\n * @see billing-and-features-system.md §6.2 (Product & Price Catalog)\n */\n\nimport { z } from 'zod';\nimport { ResourcePrimaryScope } from '../resources/resources.shared.schemas';\nimport {\n ProductType,\n TaxDisplayMode,\n} from './billing-enums.shared.schemas';\nimport { LimitGrantSchema } from './product-behavior-policy.shared.schemas';\nimport { ProductBehaviorPolicySchema } from './product-behavior-policy.shared.schemas';\n\nexport const ProductSchema = z.object({\n\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n\n type: z.enum(ProductType).isDBIndexed().isSummaryField().isNotEditable().systemEnum('ProductType'),\n /** Unique product key (maps to ProductDefinition.key in code catalog) */\n key: z.string().min(1).isUnique({ scope: 'global' }).isSummaryField().isNotEditable(),\n\n /** Which scopes can subscribe to this product (code-driven, not user-editable) */\n targetScopes: z.array(z.enum(ResourcePrimaryScope)).min(1),\n\n /** Features this product grants (boolean: present = enabled) */\n grantedFeatures: z.array(z.string()).default([]).isNotEditable(),\n\n /**\n * Limits this product grants, with aggregation mode.\n * - SET: absolute value (for PLAN products: \"Professional gives you 50 projects\")\n * - ADD: additive to current limits (for ADDON products: \"+10 extra projects\")\n *\n * Aggregation algorithm in BillingFeatureSyncBackendService:\n * 1. Start with active PLAN's SET limits (only one active plan per billing account)\n * 2. For each active ADDON with ADD mode: sum onto current limit\n * 3. For each active ADDON with SET mode: take max(current, addon value)\n * 4. FEATURES_UNLIMITED always wins in any comparison\n */\n grantedLimits: z.record(z.string(), LimitGrantSchema).default({}).isNotEditable(),\n\n /** For PLAN type: mutually exclusive tier ordering (higher number = higher tier) */\n planTier: z.string().optional().isSummaryField(),\n /** For PLAN type: tier sort order (used for upgrade/downgrade direction detection) */\n planTierOrder: z.number().optional(),\n\n /** For ADDON type: required plan tiers to subscribe to this addon (empty = no restriction) */\n requiredPlanTiers: z.array(z.string()).optional(),\n\n /**\n * Tax display intent for this product, recorded on the product row.\n * - 'exclusive': price amounts are HT (tax added at checkout)\n * - 'inclusive': price amounts are TTC (tax embedded)\n *\n * It is DECLARATIVE ONLY and does not reach the billing provider. The catalog sync stores it on\n * the product and then sends each price's own `taxBehavior` unchanged, so a price that declares\n * none is created without `tax_behavior` regardless of what this field says. To make the\n * intention effective, set `taxBehavior` on the prices as well.\n *\n * Common pattern: org products exclusive, user products inclusive.\n */\n taxDisplayMode: z.enum(TaxDisplayMode).optional(),\n\n /**\n * Purchase configuration for non-subscription products (ONE_TIME, CREDIT_PACK, ITEM).\n * Ignored for subscription products (PLAN, ADDON, METERED).\n */\n purchaseConfig: z.object({\n /** Maximum quantity per purchase (for CREDIT_PACK/ITEM). undefined = no limit */\n maxQuantityPerPurchase: z.number().min(1).optional(),\n /** For CREDIT_PACK: how many credits per pack unit */\n creditsPerUnit: z.number().min(1).optional(),\n /** For CREDIT_PACK: which \"credit pool\" this feeds (e.g., 'ai_tokens', 'sms_credits') */\n creditPoolKey: z.string().optional(),\n }).optional(),\n\n /** Behavior policy: trial, proration, cancellation, metering */\n behaviorPolicy: ProductBehaviorPolicySchema.optional(),\n\n /** Provider sync (lazy: populated on first checkout or sync action, NOT at startup) */\n providerProductId: z.string().optional().isBackendOnly(),\n\n /** Display sort order in pricing tables */\n sortOrder: z.number().default(0),\n /** Whether this product is visible to end users */\n isPublic: z.boolean().default(true).isSummaryField(),\n /** Whether this product is available for purchase */\n isActive: z.boolean().default(true).isDBIndexed().isSummaryField(),\n metadata: z.record(z.string(), z.string()).optional(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\nexport type Product = z.infer<typeof ProductSchema>;\n"]}
|
|
@@ -23,7 +23,7 @@ export declare enum BillingSubscription_Operations {
|
|
|
23
23
|
}
|
|
24
24
|
/** Request DTO for CANCEL operation — shared between resource config and custom impl */
|
|
25
25
|
export declare const BillingSubscription_CancelRequestDto: z.ZodObject<{
|
|
26
|
-
cancelImmediately: z.
|
|
26
|
+
cancelImmediately: z.ZodOptional<z.ZodBoolean>;
|
|
27
27
|
reason: z.ZodOptional<z.ZodString>;
|
|
28
28
|
}, z.core.$strip>;
|
|
29
29
|
/** Request DTO for CHANGE_PLAN operation — shared between resource config and custom impl */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"subscription.shared.resources-config.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/subscription.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAoB,MAAM,gDAAgD,CAAC;AAczG,oBAAY,8BAA8B;IACxC,6DAA6D;IAC7D,MAAM,WAAW;IACjB,wDAAwD;IACxD,MAAM,WAAW;IACjB,qDAAqD;IACrD,WAAW,gBAAgB;IAC3B,+CAA+C;IAC/C,SAAS,cAAc;IACvB,oDAAoD;IACpD,YAAY,iBAAiB;CAC9B;AAID,wFAAwF;AACxF,eAAO,MAAM,oCAAoC;;;
|
|
1
|
+
{"version":3,"file":"subscription.shared.resources-config.schemas.d.ts","sourceRoot":"","sources":["../../../../src/billing/subscription.shared.resources-config.schemas.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,qBAAqB,EAAoB,MAAM,gDAAgD,CAAC;AAczG,oBAAY,8BAA8B;IACxC,6DAA6D;IAC7D,MAAM,WAAW;IACjB,wDAAwD;IACxD,MAAM,WAAW;IACjB,qDAAqD;IACrD,WAAW,gBAAgB;IAC3B,+CAA+C;IAC/C,SAAS,cAAc;IACvB,oDAAoD;IACpD,YAAY,iBAAiB;CAC9B;AAID,wFAAwF;AACxF,eAAO,MAAM,oCAAoC;;;iBAiB/C,CAAC;AAEH,6FAA6F;AAC7F,eAAO,MAAM,wCAAwC;;;iBAGnD,CAAC;AAEH,2FAA2F;AAC3F,eAAO,MAAM,sCAAsC;;;iBAGjD,CAAC;AAEH,8FAA8F;AAC9F,eAAO,MAAM,yCAAyC;;iBAEpD,CAAC;AAMH;;;;;;;;GAQG;AACH,eAAO,MAAM,wCAAwC,iRA4LpD,CAAC"}
|