@antelopejs/dms-saas 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +190 -0
- package/README.md +658 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +20 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/oauth-entry.d.ts +5 -0
- package/dist/auth/oauth-entry.js +10 -0
- package/dist/auth/oauth-entry.js.map +1 -0
- package/dist/auth/plan-permissions-resolver.d.ts +1 -0
- package/dist/auth/plan-permissions-resolver.js +44 -0
- package/dist/auth/plan-permissions-resolver.js.map +1 -0
- package/dist/auth/subscription-access-gate.d.ts +8 -0
- package/dist/auth/subscription-access-gate.js +38 -0
- package/dist/auth/subscription-access-gate.js.map +1 -0
- package/dist/automation/index.d.ts +44 -0
- package/dist/automation/index.js +209 -0
- package/dist/automation/index.js.map +1 -0
- package/dist/billing-state/index.d.ts +5 -0
- package/dist/billing-state/index.js +58 -0
- package/dist/billing-state/index.js.map +1 -0
- package/dist/billing-state/recovery.d.ts +22 -0
- package/dist/billing-state/recovery.js +81 -0
- package/dist/billing-state/recovery.js.map +1 -0
- package/dist/config/dev-mode.d.ts +3 -0
- package/dist/config/dev-mode.js +27 -0
- package/dist/config/dev-mode.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +19 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/runtime.d.ts +6 -0
- package/dist/config/runtime.js +54 -0
- package/dist/config/runtime.js.map +1 -0
- package/dist/crons/auto-suspend-past-due.d.ts +2 -0
- package/dist/crons/auto-suspend-past-due.js +43 -0
- package/dist/crons/auto-suspend-past-due.js.map +1 -0
- package/dist/crons/cleanup-stripe-webhook-events.d.ts +2 -0
- package/dist/crons/cleanup-stripe-webhook-events.js +27 -0
- package/dist/crons/cleanup-stripe-webhook-events.js.map +1 -0
- package/dist/crons/expire-free-workspaces.d.ts +2 -0
- package/dist/crons/expire-free-workspaces.js +36 -0
- package/dist/crons/expire-free-workspaces.js.map +1 -0
- package/dist/crons/hard-delete-cancelled.d.ts +2 -0
- package/dist/crons/hard-delete-cancelled.js +55 -0
- package/dist/crons/hard-delete-cancelled.js.map +1 -0
- package/dist/crons/index.d.ts +8 -0
- package/dist/crons/index.js +25 -0
- package/dist/crons/index.js.map +1 -0
- package/dist/crons/notify-free-workspaces-ending-soon.d.ts +2 -0
- package/dist/crons/notify-free-workspaces-ending-soon.js +69 -0
- package/dist/crons/notify-free-workspaces-ending-soon.js.map +1 -0
- package/dist/crons/recompute-billing-state.d.ts +2 -0
- package/dist/crons/recompute-billing-state.js +19 -0
- package/dist/crons/recompute-billing-state.js.map +1 -0
- package/dist/crons/recompute-segments.d.ts +2 -0
- package/dist/crons/recompute-segments.js +19 -0
- package/dist/crons/recompute-segments.js.map +1 -0
- package/dist/crons/reconcile-workspace-lifecycle.d.ts +2 -0
- package/dist/crons/reconcile-workspace-lifecycle.js +19 -0
- package/dist/crons/reconcile-workspace-lifecycle.js.map +1 -0
- package/dist/crons/register.d.ts +2 -0
- package/dist/crons/register.js +24 -0
- package/dist/crons/register.js.map +1 -0
- package/dist/crons/subscription-notifications.d.ts +2 -0
- package/dist/crons/subscription-notifications.js +55 -0
- package/dist/crons/subscription-notifications.js.map +1 -0
- package/dist/data-api/index.d.ts +2 -0
- package/dist/data-api/index.js +19 -0
- package/dist/data-api/index.js.map +1 -0
- package/dist/data-api/platformOwner/admin-user-invoices.d.ts +27 -0
- package/dist/data-api/platformOwner/admin-user-invoices.js +158 -0
- package/dist/data-api/platformOwner/admin-user-invoices.js.map +1 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.d.ts +22 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.js +97 -0
- package/dist/data-api/platformOwner/admin-user-workspaces.js.map +1 -0
- package/dist/data-api/platformOwner/credit-notes.d.ts +24 -0
- package/dist/data-api/platformOwner/credit-notes.js +133 -0
- package/dist/data-api/platformOwner/credit-notes.js.map +1 -0
- package/dist/data-api/platformOwner/features.d.ts +30 -0
- package/dist/data-api/platformOwner/features.js +141 -0
- package/dist/data-api/platformOwner/features.js.map +1 -0
- package/dist/data-api/platformOwner/hidden-filter.d.ts +1 -0
- package/dist/data-api/platformOwner/hidden-filter.js +18 -0
- package/dist/data-api/platformOwner/hidden-filter.js.map +1 -0
- package/dist/data-api/platformOwner/index.d.ts +12 -0
- package/dist/data-api/platformOwner/index.js +29 -0
- package/dist/data-api/platformOwner/index.js.map +1 -0
- package/dist/data-api/platformOwner/invoice-options.d.ts +7 -0
- package/dist/data-api/platformOwner/invoice-options.js +14 -0
- package/dist/data-api/platformOwner/invoice-options.js.map +1 -0
- package/dist/data-api/platformOwner/invoices.d.ts +26 -0
- package/dist/data-api/platformOwner/invoices.js +147 -0
- package/dist/data-api/platformOwner/invoices.js.map +1 -0
- package/dist/data-api/platformOwner/members.d.ts +24 -0
- package/dist/data-api/platformOwner/members.js +125 -0
- package/dist/data-api/platformOwner/members.js.map +1 -0
- package/dist/data-api/platformOwner/plan-migrations.d.ts +24 -0
- package/dist/data-api/platformOwner/plan-migrations.js +138 -0
- package/dist/data-api/platformOwner/plan-migrations.js.map +1 -0
- package/dist/data-api/platformOwner/plans.d.ts +30 -0
- package/dist/data-api/platformOwner/plans.js +228 -0
- package/dist/data-api/platformOwner/plans.js.map +1 -0
- package/dist/data-api/platformOwner/segments.d.ts +29 -0
- package/dist/data-api/platformOwner/segments.js +223 -0
- package/dist/data-api/platformOwner/segments.js.map +1 -0
- package/dist/data-api/platformOwner/support.d.ts +58 -0
- package/dist/data-api/platformOwner/support.js +111 -0
- package/dist/data-api/platformOwner/support.js.map +1 -0
- package/dist/data-api/platformOwner/users.d.ts +22 -0
- package/dist/data-api/platformOwner/users.js +128 -0
- package/dist/data-api/platformOwner/users.js.map +1 -0
- package/dist/data-api/platformOwner/workspaces.d.ts +22 -0
- package/dist/data-api/platformOwner/workspaces.js +153 -0
- package/dist/data-api/platformOwner/workspaces.js.map +1 -0
- package/dist/data-api/support-fields.d.ts +49 -0
- package/dist/data-api/support-fields.js +166 -0
- package/dist/data-api/support-fields.js.map +1 -0
- package/dist/data-api/support-routes.d.ts +10 -0
- package/dist/data-api/support-routes.js +71 -0
- package/dist/data-api/support-routes.js.map +1 -0
- package/dist/data-api/tenant/index.d.ts +2 -0
- package/dist/data-api/tenant/index.js +19 -0
- package/dist/data-api/tenant/index.js.map +1 -0
- package/dist/data-api/tenant/support.d.ts +39 -0
- package/dist/data-api/tenant/support.js +53 -0
- package/dist/data-api/tenant/support.js.map +1 -0
- package/dist/data-api/tenant/tenant-invoices.d.ts +37 -0
- package/dist/data-api/tenant/tenant-invoices.js +242 -0
- package/dist/data-api/tenant/tenant-invoices.js.map +1 -0
- package/dist/db/index.d.ts +1 -0
- package/dist/db/index.js +18 -0
- package/dist/db/index.js.map +1 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +20 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/register.d.ts +1 -0
- package/dist/hooks/register.js +57 -0
- package/dist/hooks/register.js.map +1 -0
- package/dist/hooks/tenant-export.d.ts +2 -0
- package/dist/hooks/tenant-export.js +64 -0
- package/dist/hooks/tenant-export.js.map +1 -0
- package/dist/hooks/tenant-provisioning.d.ts +3 -0
- package/dist/hooks/tenant-provisioning.js +12 -0
- package/dist/hooks/tenant-provisioning.js.map +1 -0
- package/dist/implementations/dms-saas/billing.d.ts +2 -0
- package/dist/implementations/dms-saas/billing.js +49 -0
- package/dist/implementations/dms-saas/billing.js.map +1 -0
- package/dist/implementations/dms-saas/invoice-line-items.d.ts +11 -0
- package/dist/implementations/dms-saas/invoice-line-items.js +24 -0
- package/dist/implementations/dms-saas/invoice-line-items.js.map +1 -0
- package/dist/implementations/dms-saas/pages.d.ts +3 -0
- package/dist/implementations/dms-saas/pages.js +12 -0
- package/dist/implementations/dms-saas/pages.js.map +1 -0
- package/dist/implementations/dms-saas/workspace-lifecycle.d.ts +2 -0
- package/dist/implementations/dms-saas/workspace-lifecycle.js +23 -0
- package/dist/implementations/dms-saas/workspace-lifecycle.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +107 -0
- package/dist/index.js.map +1 -0
- package/dist/invoice-line-items/billing-window.d.ts +3 -0
- package/dist/invoice-line-items/billing-window.js +19 -0
- package/dist/invoice-line-items/billing-window.js.map +1 -0
- package/dist/invoice-line-items/index.d.ts +1 -0
- package/dist/invoice-line-items/index.js +18 -0
- package/dist/invoice-line-items/index.js.map +1 -0
- package/dist/invoice-line-items/injection.d.ts +2 -0
- package/dist/invoice-line-items/injection.js +171 -0
- package/dist/invoice-line-items/injection.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.js +19 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/notifications/recipients.d.ts +14 -0
- package/dist/notifications/recipients.js +87 -0
- package/dist/notifications/recipients.js.map +1 -0
- package/dist/notifications/subjects.d.ts +21 -0
- package/dist/notifications/subjects.js +121 -0
- package/dist/notifications/subjects.js.map +1 -0
- package/dist/operator-actions/commands.d.ts +41 -0
- package/dist/operator-actions/commands.js +233 -0
- package/dist/operator-actions/commands.js.map +1 -0
- package/dist/operator-actions/db/index.d.ts +4 -0
- package/dist/operator-actions/db/index.js +21 -0
- package/dist/operator-actions/db/index.js.map +1 -0
- package/dist/operator-actions/db/lifecycle-delivery.model.d.ts +29 -0
- package/dist/operator-actions/db/lifecycle-delivery.model.js +85 -0
- package/dist/operator-actions/db/lifecycle-delivery.model.js.map +1 -0
- package/dist/operator-actions/db/lifecycle-delivery.table.d.ts +26 -0
- package/dist/operator-actions/db/lifecycle-delivery.table.js +107 -0
- package/dist/operator-actions/db/lifecycle-delivery.table.js.map +1 -0
- package/dist/operator-actions/db/operator-action.model.d.ts +33 -0
- package/dist/operator-actions/db/operator-action.model.js +63 -0
- package/dist/operator-actions/db/operator-action.model.js.map +1 -0
- package/dist/operator-actions/db/operator-action.table.d.ts +21 -0
- package/dist/operator-actions/db/operator-action.table.js +95 -0
- package/dist/operator-actions/db/operator-action.table.js.map +1 -0
- package/dist/operator-actions/index.d.ts +3 -0
- package/dist/operator-actions/index.js +20 -0
- package/dist/operator-actions/index.js.map +1 -0
- package/dist/operator-actions/journal.d.ts +22 -0
- package/dist/operator-actions/journal.js +183 -0
- package/dist/operator-actions/journal.js.map +1 -0
- package/dist/operator-actions/lifecycle-consumers.d.ts +12 -0
- package/dist/operator-actions/lifecycle-consumers.js +28 -0
- package/dist/operator-actions/lifecycle-consumers.js.map +1 -0
- package/dist/operator-actions/lifecycle-outbox.d.ts +19 -0
- package/dist/operator-actions/lifecycle-outbox.js +229 -0
- package/dist/operator-actions/lifecycle-outbox.js.map +1 -0
- package/dist/operator-actions/types.d.ts +11 -0
- package/dist/operator-actions/types.js +3 -0
- package/dist/operator-actions/types.js.map +1 -0
- package/dist/pages/definitions.d.ts +1 -0
- package/dist/pages/definitions.js +18 -0
- package/dist/pages/definitions.js.map +1 -0
- package/dist/pages/index.d.ts +4 -0
- package/dist/pages/index.js +21 -0
- package/dist/pages/index.js.map +1 -0
- package/dist/pages/module.d.ts +5 -0
- package/dist/pages/module.js +15 -0
- package/dist/pages/module.js.map +1 -0
- package/dist/pages/platform/categories.d.ts +6 -0
- package/dist/pages/platform/categories.js +48 -0
- package/dist/pages/platform/categories.js.map +1 -0
- package/dist/pages/platform/credit-notes.d.ts +9 -0
- package/dist/pages/platform/credit-notes.js +40 -0
- package/dist/pages/platform/credit-notes.js.map +1 -0
- package/dist/pages/platform/dashboard.d.ts +10 -0
- package/dist/pages/platform/dashboard.js +95 -0
- package/dist/pages/platform/dashboard.js.map +1 -0
- package/dist/pages/platform/features.d.ts +9 -0
- package/dist/pages/platform/features.js +42 -0
- package/dist/pages/platform/features.js.map +1 -0
- package/dist/pages/platform/index.d.ts +15 -0
- package/dist/pages/platform/index.js +32 -0
- package/dist/pages/platform/index.js.map +1 -0
- package/dist/pages/platform/invoices.d.ts +9 -0
- package/dist/pages/platform/invoices.js +63 -0
- package/dist/pages/platform/invoices.js.map +1 -0
- package/dist/pages/platform/plans/edit.d.ts +17 -0
- package/dist/pages/platform/plans/edit.js +213 -0
- package/dist/pages/platform/plans/edit.js.map +1 -0
- package/dist/pages/platform/plans/index.d.ts +9 -0
- package/dist/pages/platform/plans/index.js +99 -0
- package/dist/pages/platform/plans/index.js.map +1 -0
- package/dist/pages/platform/plans/migrations.d.ts +9 -0
- package/dist/pages/platform/plans/migrations.js +38 -0
- package/dist/pages/platform/plans/migrations.js.map +1 -0
- package/dist/pages/platform/segments/index.d.ts +9 -0
- package/dist/pages/platform/segments/index.js +59 -0
- package/dist/pages/platform/segments/index.js.map +1 -0
- package/dist/pages/platform/settings.d.ts +9 -0
- package/dist/pages/platform/settings.js +147 -0
- package/dist/pages/platform/settings.js.map +1 -0
- package/dist/pages/platform/support.d.ts +9 -0
- package/dist/pages/platform/support.js +29 -0
- package/dist/pages/platform/support.js.map +1 -0
- package/dist/pages/platform/users/detail.d.ts +9 -0
- package/dist/pages/platform/users/detail.js +78 -0
- package/dist/pages/platform/users/detail.js.map +1 -0
- package/dist/pages/platform/users/index.d.ts +9 -0
- package/dist/pages/platform/users/index.js +77 -0
- package/dist/pages/platform/users/index.js.map +1 -0
- package/dist/pages/platform/workspaces/detail.d.ts +9 -0
- package/dist/pages/platform/workspaces/detail.js +120 -0
- package/dist/pages/platform/workspaces/detail.js.map +1 -0
- package/dist/pages/platform/workspaces/index.d.ts +35 -0
- package/dist/pages/platform/workspaces/index.js +300 -0
- package/dist/pages/platform/workspaces/index.js.map +1 -0
- package/dist/pages/public/auth/index.d.ts +1 -0
- package/dist/pages/public/auth/index.js +18 -0
- package/dist/pages/public/auth/index.js.map +1 -0
- package/dist/pages/public/auth/no-workspace.d.ts +9 -0
- package/dist/pages/public/auth/no-workspace.js +26 -0
- package/dist/pages/public/auth/no-workspace.js.map +1 -0
- package/dist/pages/public/index.d.ts +3 -0
- package/dist/pages/public/index.js +20 -0
- package/dist/pages/public/index.js.map +1 -0
- package/dist/pages/public/legal/index.d.ts +3 -0
- package/dist/pages/public/legal/index.js +20 -0
- package/dist/pages/public/legal/index.js.map +1 -0
- package/dist/pages/public/legal/privacy-policy.d.ts +9 -0
- package/dist/pages/public/legal/privacy-policy.js +29 -0
- package/dist/pages/public/legal/privacy-policy.js.map +1 -0
- package/dist/pages/public/legal/terms-and-conditions.d.ts +9 -0
- package/dist/pages/public/legal/terms-and-conditions.js +29 -0
- package/dist/pages/public/legal/terms-and-conditions.js.map +1 -0
- package/dist/pages/public/legal/terms-of-use.d.ts +9 -0
- package/dist/pages/public/legal/terms-of-use.js +29 -0
- package/dist/pages/public/legal/terms-of-use.js.map +1 -0
- package/dist/pages/public/register.d.ts +9 -0
- package/dist/pages/public/register.js +29 -0
- package/dist/pages/public/register.js.map +1 -0
- package/dist/pages/public/screens.d.ts +3 -0
- package/dist/pages/public/screens.js +50 -0
- package/dist/pages/public/screens.js.map +1 -0
- package/dist/pages/tenant/billing.d.ts +15 -0
- package/dist/pages/tenant/billing.js +87 -0
- package/dist/pages/tenant/billing.js.map +1 -0
- package/dist/pages/tenant/data-export.d.ts +10 -0
- package/dist/pages/tenant/data-export.js +32 -0
- package/dist/pages/tenant/data-export.js.map +1 -0
- package/dist/pages/tenant/general.d.ts +10 -0
- package/dist/pages/tenant/general.js +33 -0
- package/dist/pages/tenant/general.js.map +1 -0
- package/dist/pages/tenant/index.d.ts +6 -0
- package/dist/pages/tenant/index.js +23 -0
- package/dist/pages/tenant/index.js.map +1 -0
- package/dist/pages/tenant/members-seat-quota.d.ts +3 -0
- package/dist/pages/tenant/members-seat-quota.js +25 -0
- package/dist/pages/tenant/members-seat-quota.js.map +1 -0
- package/dist/pages/tenant/support.d.ts +9 -0
- package/dist/pages/tenant/support.js +27 -0
- package/dist/pages/tenant/support.js.map +1 -0
- package/dist/pages/tenant/workspace-suspended.d.ts +9 -0
- package/dist/pages/tenant/workspace-suspended.js +26 -0
- package/dist/pages/tenant/workspace-suspended.js.map +1 -0
- package/dist/plan-changes/deferred.d.ts +18 -0
- package/dist/plan-changes/deferred.js +225 -0
- package/dist/plan-changes/deferred.js.map +1 -0
- package/dist/plan-changes/index.d.ts +1 -0
- package/dist/plan-changes/index.js +18 -0
- package/dist/plan-changes/index.js.map +1 -0
- package/dist/plans/index.d.ts +4 -0
- package/dist/plans/index.js +21 -0
- package/dist/plans/index.js.map +1 -0
- package/dist/plans/seat-capacity.d.ts +9 -0
- package/dist/plans/seat-capacity.js +38 -0
- package/dist/plans/seat-capacity.js.map +1 -0
- package/dist/plans/seat-hooks.d.ts +1 -0
- package/dist/plans/seat-hooks.js +80 -0
- package/dist/plans/seat-hooks.js.map +1 -0
- package/dist/plans/seat-sync.d.ts +10 -0
- package/dist/plans/seat-sync.js +23 -0
- package/dist/plans/seat-sync.js.map +1 -0
- package/dist/routes/index.d.ts +3 -0
- package/dist/routes/index.js +20 -0
- package/dist/routes/index.js.map +1 -0
- package/dist/routes/platformOwner/billing-settings.d.ts +20 -0
- package/dist/routes/platformOwner/billing-settings.js +98 -0
- package/dist/routes/platformOwner/billing-settings.js.map +1 -0
- package/dist/routes/platformOwner/credit-notes-issue.d.ts +16 -0
- package/dist/routes/platformOwner/credit-notes-issue.js +56 -0
- package/dist/routes/platformOwner/credit-notes-issue.js.map +1 -0
- package/dist/routes/platformOwner/dashboard.d.ts +62 -0
- package/dist/routes/platformOwner/dashboard.js +310 -0
- package/dist/routes/platformOwner/dashboard.js.map +1 -0
- package/dist/routes/platformOwner/index.d.ts +12 -0
- package/dist/routes/platformOwner/index.js +29 -0
- package/dist/routes/platformOwner/index.js.map +1 -0
- package/dist/routes/platformOwner/plan-deletion.d.ts +30 -0
- package/dist/routes/platformOwner/plan-deletion.js +156 -0
- package/dist/routes/platformOwner/plan-deletion.js.map +1 -0
- package/dist/routes/platformOwner/plans.d.ts +99 -0
- package/dist/routes/platformOwner/plans.js +376 -0
- package/dist/routes/platformOwner/plans.js.map +1 -0
- package/dist/routes/platformOwner/platform-notes.d.ts +36 -0
- package/dist/routes/platformOwner/platform-notes.js +149 -0
- package/dist/routes/platformOwner/platform-notes.js.map +1 -0
- package/dist/routes/platformOwner/platform-owners.d.ts +12 -0
- package/dist/routes/platformOwner/platform-owners.js +77 -0
- package/dist/routes/platformOwner/platform-owners.js.map +1 -0
- package/dist/routes/platformOwner/segments.d.ts +24 -0
- package/dist/routes/platformOwner/segments.js +174 -0
- package/dist/routes/platformOwner/segments.js.map +1 -0
- package/dist/routes/platformOwner/support.d.ts +21 -0
- package/dist/routes/platformOwner/support.js +180 -0
- package/dist/routes/platformOwner/support.js.map +1 -0
- package/dist/routes/platformOwner/users-detail.d.ts +26 -0
- package/dist/routes/platformOwner/users-detail.js +82 -0
- package/dist/routes/platformOwner/users-detail.js.map +1 -0
- package/dist/routes/platformOwner/workspace-operator-actions.d.ts +34 -0
- package/dist/routes/platformOwner/workspace-operator-actions.js +183 -0
- package/dist/routes/platformOwner/workspace-operator-actions.js.map +1 -0
- package/dist/routes/platformOwner/workspaces-admin.d.ts +27 -0
- package/dist/routes/platformOwner/workspaces-admin.js +140 -0
- package/dist/routes/platformOwner/workspaces-admin.js.map +1 -0
- package/dist/routes/public/index.d.ts +3 -0
- package/dist/routes/public/index.js +20 -0
- package/dist/routes/public/index.js.map +1 -0
- package/dist/routes/public/legal-documents.d.ts +15 -0
- package/dist/routes/public/legal-documents.js +72 -0
- package/dist/routes/public/legal-documents.js.map +1 -0
- package/dist/routes/public/register.d.ts +48 -0
- package/dist/routes/public/register.js +193 -0
- package/dist/routes/public/register.js.map +1 -0
- package/dist/routes/public/webhooks/index.d.ts +1 -0
- package/dist/routes/public/webhooks/index.js +18 -0
- package/dist/routes/public/webhooks/index.js.map +1 -0
- package/dist/routes/public/webhooks/stripe.d.ts +7 -0
- package/dist/routes/public/webhooks/stripe.js +41 -0
- package/dist/routes/public/webhooks/stripe.js.map +1 -0
- package/dist/routes/tenant/billing-portal.d.ts +31 -0
- package/dist/routes/tenant/billing-portal.js +117 -0
- package/dist/routes/tenant/billing-portal.js.map +1 -0
- package/dist/routes/tenant/billing-self-refund.d.ts +18 -0
- package/dist/routes/tenant/billing-self-refund.js +199 -0
- package/dist/routes/tenant/billing-self-refund.js.map +1 -0
- package/dist/routes/tenant/data-export.d.ts +16 -0
- package/dist/routes/tenant/data-export.js +102 -0
- package/dist/routes/tenant/data-export.js.map +1 -0
- package/dist/routes/tenant/index.d.ts +9 -0
- package/dist/routes/tenant/index.js +26 -0
- package/dist/routes/tenant/index.js.map +1 -0
- package/dist/routes/tenant/support.d.ts +27 -0
- package/dist/routes/tenant/support.js +185 -0
- package/dist/routes/tenant/support.js.map +1 -0
- package/dist/routes/tenant/tenant-billing.d.ts +26 -0
- package/dist/routes/tenant/tenant-billing.js +148 -0
- package/dist/routes/tenant/tenant-billing.js.map +1 -0
- package/dist/routes/tenant/tenant-plan-ops.d.ts +57 -0
- package/dist/routes/tenant/tenant-plan-ops.js +244 -0
- package/dist/routes/tenant/tenant-plan-ops.js.map +1 -0
- package/dist/routes/tenant/tenant-plan.d.ts +19 -0
- package/dist/routes/tenant/tenant-plan.js +172 -0
- package/dist/routes/tenant/tenant-plan.js.map +1 -0
- package/dist/routes/tenant/tenant-seats.d.ts +17 -0
- package/dist/routes/tenant/tenant-seats.js +58 -0
- package/dist/routes/tenant/tenant-seats.js.map +1 -0
- package/dist/routes/tenant/workspaces.d.ts +78 -0
- package/dist/routes/tenant/workspaces.js +301 -0
- package/dist/routes/tenant/workspaces.js.map +1 -0
- package/dist/stripe/client.d.ts +6 -0
- package/dist/stripe/client.js +44 -0
- package/dist/stripe/client.js.map +1 -0
- package/dist/stripe/customer-balance.d.ts +12 -0
- package/dist/stripe/customer-balance.js +16 -0
- package/dist/stripe/customer-balance.js.map +1 -0
- package/dist/stripe/customer-billing.d.ts +33 -0
- package/dist/stripe/customer-billing.js +140 -0
- package/dist/stripe/customer-billing.js.map +1 -0
- package/dist/stripe/index.d.ts +11 -0
- package/dist/stripe/index.js +28 -0
- package/dist/stripe/index.js.map +1 -0
- package/dist/stripe/plan-schedule.d.ts +9 -0
- package/dist/stripe/plan-schedule.js +83 -0
- package/dist/stripe/plan-schedule.js.map +1 -0
- package/dist/stripe/proration.d.ts +2 -0
- package/dist/stripe/proration.js +19 -0
- package/dist/stripe/proration.js.map +1 -0
- package/dist/stripe/sync-plan.d.ts +2 -0
- package/dist/stripe/sync-plan.js +66 -0
- package/dist/stripe/sync-plan.js.map +1 -0
- package/dist/stripe/webhook-checkout.d.ts +3 -0
- package/dist/stripe/webhook-checkout.js +157 -0
- package/dist/stripe/webhook-checkout.js.map +1 -0
- package/dist/stripe/webhook-credit-notes.d.ts +3 -0
- package/dist/stripe/webhook-credit-notes.js +192 -0
- package/dist/stripe/webhook-credit-notes.js.map +1 -0
- package/dist/stripe/webhook-dispatch.d.ts +2 -0
- package/dist/stripe/webhook-dispatch.js +45 -0
- package/dist/stripe/webhook-dispatch.js.map +1 -0
- package/dist/stripe/webhook-handlers.d.ts +11 -0
- package/dist/stripe/webhook-handlers.js +318 -0
- package/dist/stripe/webhook-handlers.js.map +1 -0
- package/dist/stripe/webhook-shared.d.ts +28 -0
- package/dist/stripe/webhook-shared.js +126 -0
- package/dist/stripe/webhook-shared.js.map +1 -0
- package/dist/stripe/workspace-checkout.d.ts +29 -0
- package/dist/stripe/workspace-checkout.js +106 -0
- package/dist/stripe/workspace-checkout.js.map +1 -0
- package/dist/support/admissions.d.ts +36 -0
- package/dist/support/admissions.js +136 -0
- package/dist/support/admissions.js.map +1 -0
- package/dist/support/attachments.d.ts +12 -0
- package/dist/support/attachments.js +56 -0
- package/dist/support/attachments.js.map +1 -0
- package/dist/support/config.d.ts +19 -0
- package/dist/support/config.js +75 -0
- package/dist/support/config.js.map +1 -0
- package/dist/support/index.d.ts +6 -0
- package/dist/support/index.js +23 -0
- package/dist/support/index.js.map +1 -0
- package/dist/support/operations.d.ts +51 -0
- package/dist/support/operations.js +109 -0
- package/dist/support/operations.js.map +1 -0
- package/dist/support/plans.d.ts +6 -0
- package/dist/support/plans.js +130 -0
- package/dist/support/plans.js.map +1 -0
- package/dist/support/publications.d.ts +8 -0
- package/dist/support/publications.js +106 -0
- package/dist/support/publications.js.map +1 -0
- package/dist/support/recovery.d.ts +7 -0
- package/dist/support/recovery.js +43 -0
- package/dist/support/recovery.js.map +1 -0
- package/dist/support/service.d.ts +51 -0
- package/dist/support/service.js +143 -0
- package/dist/support/service.js.map +1 -0
- package/dist/support/transitions.d.ts +4 -0
- package/dist/support/transitions.js +29 -0
- package/dist/support/transitions.js.map +1 -0
- package/dist/support/uploads.d.ts +39 -0
- package/dist/support/uploads.js +115 -0
- package/dist/support/uploads.js.map +1 -0
- package/dist/support/validation.d.ts +15 -0
- package/dist/support/validation.js +54 -0
- package/dist/support/validation.js.map +1 -0
- package/dist/types/config.d.ts +16 -0
- package/dist/types/config.js +3 -0
- package/dist/types/config.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +18 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/billing-document-type.d.ts +3 -0
- package/dist/utils/billing-document-type.js +18 -0
- package/dist/utils/billing-document-type.js.map +1 -0
- package/dist/utils/billing-period-type.d.ts +3 -0
- package/dist/utils/billing-period-type.js +18 -0
- package/dist/utils/billing-period-type.js.map +1 -0
- package/dist/utils/email-hash.d.ts +1 -0
- package/dist/utils/email-hash.js +8 -0
- package/dist/utils/email-hash.js.map +1 -0
- package/dist/utils/export-dataset-stream.d.ts +19 -0
- package/dist/utils/export-dataset-stream.js +40 -0
- package/dist/utils/export-dataset-stream.js.map +1 -0
- package/dist/utils/index.d.ts +15 -0
- package/dist/utils/index.js +32 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/invoice-lines-type.d.ts +27 -0
- package/dist/utils/invoice-lines-type.js +34 -0
- package/dist/utils/invoice-lines-type.js.map +1 -0
- package/dist/utils/money-cents-type.d.ts +3 -0
- package/dist/utils/money-cents-type.js +18 -0
- package/dist/utils/money-cents-type.js.map +1 -0
- package/dist/utils/pagination.d.ts +22 -0
- package/dist/utils/pagination.js +35 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/parse-future-date.d.ts +1 -0
- package/dist/utils/parse-future-date.js +15 -0
- package/dist/utils/parse-future-date.js.map +1 -0
- package/dist/utils/row-instance.d.ts +1 -0
- package/dist/utils/row-instance.js +8 -0
- package/dist/utils/row-instance.js.map +1 -0
- package/dist/utils/segment-conditions-type.d.ts +33 -0
- package/dist/utils/segment-conditions-type.js +86 -0
- package/dist/utils/segment-conditions-type.js.map +1 -0
- package/dist/utils/segment-evaluator.d.ts +3 -0
- package/dist/utils/segment-evaluator.js +117 -0
- package/dist/utils/segment-evaluator.js.map +1 -0
- package/dist/utils/segment-fields.d.ts +19 -0
- package/dist/utils/segment-fields.js +212 -0
- package/dist/utils/segment-fields.js.map +1 -0
- package/dist/utils/segment-matching.d.ts +56 -0
- package/dist/utils/segment-matching.js +200 -0
- package/dist/utils/segment-matching.js.map +1 -0
- package/dist/utils/segment-name-cache.d.ts +2 -0
- package/dist/utils/segment-name-cache.js +22 -0
- package/dist/utils/segment-name-cache.js.map +1 -0
- package/dist/utils/time.d.ts +3 -0
- package/dist/utils/time.js +10 -0
- package/dist/utils/time.js.map +1 -0
- package/dist/workers/index.d.ts +1 -0
- package/dist/workers/index.js +18 -0
- package/dist/workers/index.js.map +1 -0
- package/dist/workers/plan-migration.d.ts +4 -0
- package/dist/workers/plan-migration.js +206 -0
- package/dist/workers/plan-migration.js.map +1 -0
- package/dist/workspaces/billing-profile.d.ts +3 -0
- package/dist/workspaces/billing-profile.js +55 -0
- package/dist/workspaces/billing-profile.js.map +1 -0
- package/dist/workspaces/complimentary.d.ts +7 -0
- package/dist/workspaces/complimentary.js +47 -0
- package/dist/workspaces/complimentary.js.map +1 -0
- package/dist/workspaces/db/card-capacity.model.d.ts +30 -0
- package/dist/workspaces/db/card-capacity.model.js +98 -0
- package/dist/workspaces/db/card-capacity.model.js.map +1 -0
- package/dist/workspaces/db/card-capacity.table.d.ts +11 -0
- package/dist/workspaces/db/card-capacity.table.js +34 -0
- package/dist/workspaces/db/card-capacity.table.js.map +1 -0
- package/dist/workspaces/db/provisioning-attempt.model.d.ts +24 -0
- package/dist/workspaces/db/provisioning-attempt.model.js +33 -0
- package/dist/workspaces/db/provisioning-attempt.model.js.map +1 -0
- package/dist/workspaces/db/provisioning-attempt.table.d.ts +18 -0
- package/dist/workspaces/db/provisioning-attempt.table.js +77 -0
- package/dist/workspaces/db/provisioning-attempt.table.js.map +1 -0
- package/dist/workspaces/db/trial-identity.model.d.ts +25 -0
- package/dist/workspaces/db/trial-identity.model.js +62 -0
- package/dist/workspaces/db/trial-identity.model.js.map +1 -0
- package/dist/workspaces/db/trial-identity.table.d.ts +7 -0
- package/dist/workspaces/db/trial-identity.table.js +34 -0
- package/dist/workspaces/db/trial-identity.table.js.map +1 -0
- package/dist/workspaces/deletion.d.ts +8 -0
- package/dist/workspaces/deletion.js +75 -0
- package/dist/workspaces/deletion.js.map +1 -0
- package/dist/workspaces/free-workspace-guard.d.ts +11 -0
- package/dist/workspaces/free-workspace-guard.js +96 -0
- package/dist/workspaces/free-workspace-guard.js.map +1 -0
- package/dist/workspaces/index.d.ts +6 -0
- package/dist/workspaces/index.js +23 -0
- package/dist/workspaces/index.js.map +1 -0
- package/dist/workspaces/provisioning-rollback.d.ts +2 -0
- package/dist/workspaces/provisioning-rollback.js +78 -0
- package/dist/workspaces/provisioning-rollback.js.map +1 -0
- package/dist/workspaces/provisioning-state.d.ts +6 -0
- package/dist/workspaces/provisioning-state.js +91 -0
- package/dist/workspaces/provisioning-state.js.map +1 -0
- package/dist/workspaces/provisioning.d.ts +49 -0
- package/dist/workspaces/provisioning.js +263 -0
- package/dist/workspaces/provisioning.js.map +1 -0
- package/dist/workspaces/registration-extras.d.ts +1 -0
- package/dist/workspaces/registration-extras.js +50 -0
- package/dist/workspaces/registration-extras.js.map +1 -0
- package/dist/workspaces/suspension.d.ts +13 -0
- package/dist/workspaces/suspension.js +124 -0
- package/dist/workspaces/suspension.js.map +1 -0
- package/frontend-vue/.editorconfig +12 -0
- package/frontend-vue/.prettierrc +11 -0
- package/frontend-vue/app/build/.gitkeep +0 -0
- package/frontend-vue/app/components/CardGrid.vue +77 -0
- package/frontend-vue/app/components/CustomerPortalButton.vue +45 -0
- package/frontend-vue/app/components/DataExport.vue +300 -0
- package/frontend-vue/app/components/DeletePlanModal.vue +223 -0
- package/frontend-vue/app/components/FreeAccessBanner.vue +70 -0
- package/frontend-vue/app/components/InvoiceLines.vue +57 -0
- package/frontend-vue/app/components/IssueCreditNoteModal.vue +128 -0
- package/frontend-vue/app/components/LegalLayout.vue +63 -0
- package/frontend-vue/app/components/LoadFailure.vue +25 -0
- package/frontend-vue/app/components/PastDueAlert.vue +96 -0
- package/frontend-vue/app/components/PaymentMethodCard.vue +86 -0
- package/frontend-vue/app/components/PlanCard.vue +294 -0
- package/frontend-vue/app/components/PlanCardPublic.vue +59 -0
- package/frontend-vue/app/components/PlanCardsDisplay.vue +127 -0
- package/frontend-vue/app/components/PlanComparisonModal.vue +213 -0
- package/frontend-vue/app/components/PlanInheritancePicker.vue +329 -0
- package/frontend-vue/app/components/PlatformNotes.vue +281 -0
- package/frontend-vue/app/components/PlatformSupport.vue +461 -0
- package/frontend-vue/app/components/RecentActivity.vue +72 -0
- package/frontend-vue/app/components/RefundButton.vue +126 -0
- package/frontend-vue/app/components/Register.vue +174 -0
- package/frontend-vue/app/components/RegistrationClosed.vue +15 -0
- package/frontend-vue/app/components/SeatQuotaBanner.vue +78 -0
- package/frontend-vue/app/components/SegmentConditionsBuilder.vue +176 -0
- package/frontend-vue/app/components/SegmentConditionsGroup.vue +494 -0
- package/frontend-vue/app/components/SupportAttachmentUpload.vue +140 -0
- package/frontend-vue/app/components/SupportThreadHistory.vue +139 -0
- package/frontend-vue/app/components/TenantBillingForm.vue +208 -0
- package/frontend-vue/app/components/TenantPlanCard.vue +223 -0
- package/frontend-vue/app/components/TenantSupport.vue +415 -0
- package/frontend-vue/app/components/UserSummaryCard.vue +166 -0
- package/frontend-vue/app/components/WorkspaceBillingInfo.vue +68 -0
- package/frontend-vue/app/components/WorkspaceCompAccessButton.vue +198 -0
- package/frontend-vue/app/components/WorkspaceCreateModal.vue +256 -0
- package/frontend-vue/app/components/WorkspaceDangerZone.vue +146 -0
- package/frontend-vue/app/components/WorkspaceDetailHeader.vue +24 -0
- package/frontend-vue/app/components/WorkspaceIdentity.vue +99 -0
- package/frontend-vue/app/components/WorkspaceJoinButton.vue +50 -0
- package/frontend-vue/app/components/WorkspaceOperatorActions.vue +340 -0
- package/frontend-vue/app/components/WorkspaceSummaryCard.vue +161 -0
- package/frontend-vue/app/components/WorkspaceSuspendButton.vue +167 -0
- package/frontend-vue/app/components/WorkspaceSuspended.vue +164 -0
- package/frontend-vue/app/components/WorkspaceSwitcherWidget.vue +247 -0
- package/frontend-vue/app/composables/useApiErrorMessage.ts +35 -0
- package/frontend-vue/app/composables/useBillingCountries.ts +54 -0
- package/frontend-vue/app/composables/useBillingDocumentType.ts +7 -0
- package/frontend-vue/app/composables/useBillingStatus.ts +39 -0
- package/frontend-vue/app/composables/useCurrentWorkspace.ts +43 -0
- package/frontend-vue/app/composables/useDetailRefresh.ts +17 -0
- package/frontend-vue/app/composables/useExportHistory.ts +143 -0
- package/frontend-vue/app/composables/useInvoiceLines.ts +22 -0
- package/frontend-vue/app/composables/useMoneyFormat.ts +49 -0
- package/frontend-vue/app/composables/useMyWorkspaces.ts +47 -0
- package/frontend-vue/app/composables/usePlanFeatureFormat.ts +60 -0
- package/frontend-vue/app/composables/usePlanIntervalLabel.ts +30 -0
- package/frontend-vue/app/composables/useSaasRegistration.ts +522 -0
- package/frontend-vue/app/composables/useSeatQuota.ts +18 -0
- package/frontend-vue/app/composables/useSharedRequest.ts +54 -0
- package/frontend-vue/app/composables/useStripePaymentElement.ts +74 -0
- package/frontend-vue/app/composables/useSubscriptionAccess.ts +12 -0
- package/frontend-vue/app/composables/useSupportRequest.ts +74 -0
- package/frontend-vue/app/composables/useTenantPlan.ts +95 -0
- package/frontend-vue/app/composables/useTenantSwitch.ts +22 -0
- package/frontend-vue/app/composables/useWorkspaceAccessCache.ts +25 -0
- package/frontend-vue/app/custom-pages/auth/no-workspace.vue +495 -0
- package/frontend-vue/app/middleware/workspace-suspended.global.ts +56 -0
- package/frontend-vue/app/plugins/auth-links.ts +24 -0
- package/frontend-vue/app/plugins/billing-data-types.ts +62 -0
- package/frontend-vue/app/plugins/footer-links.ts +36 -0
- package/frontend-vue/app/plugins/plan-cards-display.client.ts +16 -0
- package/frontend-vue/app/plugins/segment-conditions-data-type.client.ts +122 -0
- package/frontend-vue/app/plugins/sidebar-widgets.ts +13 -0
- package/frontend-vue/app/types/support.ts +123 -0
- package/frontend-vue/dms.frontend.ts +68 -0
- package/frontend-vue/eslint.config.mjs +13 -0
- package/frontend-vue/i18n/locales/saas-en-GB.json +1285 -0
- package/frontend-vue/i18n/locales/saas-fr-FR.json +1285 -0
- package/frontend-vue/package.json +27 -0
- package/frontend-vue/pnpm-lock.yaml +4948 -0
- package/frontend-vue/pnpm-workspace.yaml +2 -0
- package/frontend-vue/server/routes/auth/finalize-workspace.post.ts +61 -0
- package/package.json +91 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complimentary.js","sourceRoot":"","sources":["../../src/workspaces/complimentary.ts"],"names":[],"mappings":";;;AAKA,8DAQC;AAGD,kFAWC;AAED,4CAIC;AAGD,sDAQC;AAGD,8CAoBC;AAlED,oEAAqF;AACrF,kEAAqF;AAA5E,sHAAA,2BAA2B,OAAA;AAGpC,SAAgB,yBAAyB,CACvC,YAAmD,EACnD,GAAG,GAAG,IAAI,IAAI,EAAE;IAEhB,OAAO,CACL,IAAA,qCAA2B,EAAC,YAAY,CAAC;QACzC,CAAC,CAAC,YAAY,EAAE,SAAS,IAAI,YAAY,CAAC,SAAS,GAAG,GAAG,CAAC,CAC3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+1,30 @@
|
|
|
1
|
+
import { CardCapacity } from "./card-capacity.table";
|
|
2
|
+
type ReadFreeWorkspaceIds = () => Promise<string[]>;
|
|
3
|
+
export declare function cardCapacityId(fingerprint: string): string;
|
|
4
|
+
declare const CardCapacityModel_base: {
|
|
5
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
6
|
+
readonly table: import("@antelopejs/interface-database").Table<CardCapacity>;
|
|
7
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
8
|
+
get(id: string): PromiseLike<CardCapacity | undefined>;
|
|
9
|
+
getBy(index: keyof CardCapacity, ...keys: any[]): PromiseLike<CardCapacity[]>;
|
|
10
|
+
getAll(): PromiseLike<CardCapacity[]>;
|
|
11
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<CardCapacity> | import("@antelopejs/interface-database-decorators").DeepPartial<CardCapacity>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
12
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<CardCapacity>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<CardCapacity>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
14
|
+
delete(id: string): Promise<number>;
|
|
15
|
+
};
|
|
16
|
+
readonly schemaName: string;
|
|
17
|
+
fromPlainData(obj: any): CardCapacity;
|
|
18
|
+
fromDatabase(obj: any): CardCapacity | undefined;
|
|
19
|
+
toDatabase(obj: any): Record<string, any>;
|
|
20
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
21
|
+
};
|
|
22
|
+
export declare class CardCapacityModel extends CardCapacityModel_base {
|
|
23
|
+
private getOrCreate;
|
|
24
|
+
private replaceAllocations;
|
|
25
|
+
reserve(id: string, tenantId: string, limit: number, readLiveIds: ReadFreeWorkspaceIds): Promise<boolean>;
|
|
26
|
+
confirm(id: string, tenantId: string): Promise<void>;
|
|
27
|
+
releaseCancelled(id: string, tenantId: string): Promise<void>;
|
|
28
|
+
private changeAllocation;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CardCapacityModel = void 0;
|
|
4
|
+
exports.cardCapacityId = cardCapacityId;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
7
|
+
const card_capacity_table_1 = require("./card-capacity.table");
|
|
8
|
+
const MAX_ADMISSION_ATTEMPTS = 16;
|
|
9
|
+
function cardCapacityId(fingerprint) {
|
|
10
|
+
return (0, node_crypto_1.createHash)("sha256").update(fingerprint).digest("hex");
|
|
11
|
+
}
|
|
12
|
+
function currentAllocations(capacity, liveIds) {
|
|
13
|
+
const live = new Set(liveIds);
|
|
14
|
+
const allocations = capacity.allocations.filter((allocation) => allocation.state !== "confirmed" || live.has(allocation.tenantId));
|
|
15
|
+
const known = new Set(allocations.map((allocation) => allocation.tenantId));
|
|
16
|
+
return [
|
|
17
|
+
...allocations,
|
|
18
|
+
...liveIds
|
|
19
|
+
.filter((tenantId) => !known.has(tenantId))
|
|
20
|
+
.map((tenantId) => ({
|
|
21
|
+
tenantId,
|
|
22
|
+
state: "confirmed",
|
|
23
|
+
})),
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
class CardCapacityModel extends (0, interface_database_decorators_1.BasicDataModel)(card_capacity_table_1.CardCapacity, card_capacity_table_1.cardCapacitiesTableName) {
|
|
27
|
+
async getOrCreate(id) {
|
|
28
|
+
const existing = await this.get(id);
|
|
29
|
+
if (existing)
|
|
30
|
+
return existing;
|
|
31
|
+
try {
|
|
32
|
+
await this.insert({ _id: id, revision: (0, node_crypto_1.randomUUID)(), allocations: [] });
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const concurrent = await this.get(id);
|
|
36
|
+
if (concurrent)
|
|
37
|
+
return concurrent;
|
|
38
|
+
throw error;
|
|
39
|
+
}
|
|
40
|
+
const created = await this.get(id);
|
|
41
|
+
if (!created)
|
|
42
|
+
throw new Error("Card capacity was not persisted");
|
|
43
|
+
return created;
|
|
44
|
+
}
|
|
45
|
+
replaceAllocations(current, allocations) {
|
|
46
|
+
return this.table
|
|
47
|
+
.atomicMutation(current._id, {
|
|
48
|
+
type: "update",
|
|
49
|
+
revisionField: "revision",
|
|
50
|
+
expectedRevision: current.revision,
|
|
51
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
52
|
+
patch: { allocations },
|
|
53
|
+
})
|
|
54
|
+
.run();
|
|
55
|
+
}
|
|
56
|
+
async reserve(id, tenantId, limit, readLiveIds) {
|
|
57
|
+
for (let attempt = 0; attempt < MAX_ADMISSION_ATTEMPTS; attempt++) {
|
|
58
|
+
const current = await this.getOrCreate(id);
|
|
59
|
+
if (current.allocations.some((allocation) => allocation.tenantId === tenantId))
|
|
60
|
+
return true;
|
|
61
|
+
const allocations = currentAllocations(current, await readLiveIds());
|
|
62
|
+
if (allocations.length >= limit)
|
|
63
|
+
return false;
|
|
64
|
+
allocations.push({ tenantId, state: "reserved" });
|
|
65
|
+
const outcome = await this.replaceAllocations(current, allocations);
|
|
66
|
+
if (outcome === "applied")
|
|
67
|
+
return true;
|
|
68
|
+
if (outcome === "unknown")
|
|
69
|
+
throw new Error("Card capacity admission requires reconciliation");
|
|
70
|
+
}
|
|
71
|
+
throw new Error("Card capacity changed during admission; retry the request");
|
|
72
|
+
}
|
|
73
|
+
async confirm(id, tenantId) {
|
|
74
|
+
await this.changeAllocation(id, tenantId, "confirmed");
|
|
75
|
+
}
|
|
76
|
+
async releaseCancelled(id, tenantId) {
|
|
77
|
+
await this.changeAllocation(id, tenantId, undefined);
|
|
78
|
+
}
|
|
79
|
+
async changeAllocation(id, tenantId, state) {
|
|
80
|
+
for (let attempt = 0; attempt < MAX_ADMISSION_ATTEMPTS; attempt++) {
|
|
81
|
+
const current = await this.get(id);
|
|
82
|
+
if (!current ||
|
|
83
|
+
!current.allocations.some((allocation) => allocation.tenantId === tenantId))
|
|
84
|
+
return;
|
|
85
|
+
const allocations = current.allocations.filter((allocation) => allocation.tenantId !== tenantId);
|
|
86
|
+
if (state)
|
|
87
|
+
allocations.push({ tenantId, state });
|
|
88
|
+
const outcome = await this.replaceAllocations(current, allocations);
|
|
89
|
+
if (outcome === "applied")
|
|
90
|
+
return;
|
|
91
|
+
if (outcome === "unknown")
|
|
92
|
+
throw new Error("Card capacity outcome requires reconciliation");
|
|
93
|
+
}
|
|
94
|
+
throw new Error("Card capacity changed during reconciliation");
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
exports.CardCapacityModel = CardCapacityModel;
|
|
98
|
+
//# sourceMappingURL=card-capacity.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-capacity.model.js","sourceRoot":"","sources":["../../../src/workspaces/db/card-capacity.model.ts"],"names":[],"mappings":";;;AAaA,wCAEC;AAfD,6CAAqD;AAErD,6FAA2E;AAC3E,+DAI+B;AAE/B,MAAM,sBAAsB,GAAG,EAAE,CAAC;AAIlC,SAAgB,cAAc,CAAC,WAAmB;IAChD,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAChE,CAAC;AAED,SAAS,kBAAkB,CACzB,QAAsB,EACtB,OAAiB;IAEjB,MAAM,IAAI,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,WAAW,GAAG,QAAQ,CAAC,WAAW,CAAC,MAAM,CAC7C,CAAC,UAAU,EAAE,EAAE,CACb,UAAU,CAAC,KAAK,KAAK,WAAW,IAAI,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
|
1
|
+
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
export interface CardCapacityAllocation {
|
|
3
|
+
tenantId: string;
|
|
4
|
+
state: "reserved" | "confirmed" | "reconciliation_required";
|
|
5
|
+
}
|
|
6
|
+
export declare const cardCapacitiesTableName = "saas_card_capacities";
|
|
7
|
+
export declare class CardCapacity extends Table {
|
|
8
|
+
_id: string;
|
|
9
|
+
revision: string;
|
|
10
|
+
allocations: CardCapacityAllocation[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.CardCapacity = exports.cardCapacitiesTableName = void 0;
|
|
13
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
|
+
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
|
+
exports.cardCapacitiesTableName = "saas_card_capacities";
|
|
16
|
+
let CardCapacity = class CardCapacity extends interface_database_decorators_1.Table {
|
|
17
|
+
};
|
|
18
|
+
exports.CardCapacity = CardCapacity;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], CardCapacity.prototype, "_id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], CardCapacity.prototype, "revision", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, interface_database_decorators_1.Field)("any"),
|
|
29
|
+
__metadata("design:type", Array)
|
|
30
|
+
], CardCapacity.prototype, "allocations", void 0);
|
|
31
|
+
exports.CardCapacity = CardCapacity = __decorate([
|
|
32
|
+
(0, interface_database_decorators_1.RegisterTable)(exports.cardCapacitiesTableName, constants_1.CORE_SCHEMA_NAME)
|
|
33
|
+
], CardCapacity);
|
|
34
|
+
//# sourceMappingURL=card-capacity.table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-capacity.table.js","sourceRoot":"","sources":["../../../src/workspaces/db/card-capacity.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAImD;AACnD,mEAAuE;AAQ1D,QAAA,uBAAuB,GAAG,sBAAsB,CAAC;AAIvD,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,qCAAK;CAStC,CAAA;AATY,oCAAY;AAEf;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;yCACI;AAGZ;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;8CACS;AAGjB;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;iDACiC;uBARnC,YAAY;IADxB,IAAA,6CAAa,EAAC,+BAAuB,EAAE,4BAAgB,CAAC;GAC5C,YAAY,CASxB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ProvisioningAttempt } from "./provisioning-attempt.table";
|
|
2
|
+
declare const ProvisioningAttemptModel_base: {
|
|
3
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
4
|
+
readonly table: import("@antelopejs/interface-database").Table<ProvisioningAttempt>;
|
|
5
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
6
|
+
get(id: string): PromiseLike<ProvisioningAttempt | undefined>;
|
|
7
|
+
getBy(index: keyof ProvisioningAttempt, ...keys: any[]): PromiseLike<ProvisioningAttempt[]>;
|
|
8
|
+
getAll(): PromiseLike<ProvisioningAttempt[]>;
|
|
9
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<ProvisioningAttempt> | import("@antelopejs/interface-database-decorators").DeepPartial<ProvisioningAttempt>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
10
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<ProvisioningAttempt>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
11
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<ProvisioningAttempt>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
+
delete(id: string): Promise<number>;
|
|
13
|
+
};
|
|
14
|
+
readonly schemaName: string;
|
|
15
|
+
fromPlainData(obj: any): ProvisioningAttempt;
|
|
16
|
+
fromDatabase(obj: any): ProvisioningAttempt | undefined;
|
|
17
|
+
toDatabase(obj: any): Record<string, any>;
|
|
18
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
19
|
+
};
|
|
20
|
+
export declare class ProvisioningAttemptModel extends ProvisioningAttemptModel_base {
|
|
21
|
+
advance(current: ProvisioningAttempt, patch: Partial<ProvisioningAttempt>): Promise<void>;
|
|
22
|
+
findUnresolved(): Promise<ProvisioningAttempt[]>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProvisioningAttemptModel = void 0;
|
|
4
|
+
const node_crypto_1 = require("node:crypto");
|
|
5
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
6
|
+
const provisioning_attempt_table_1 = require("./provisioning-attempt.table");
|
|
7
|
+
const UNRESOLVED_PAGE_SIZE = 100;
|
|
8
|
+
class ProvisioningAttemptModel extends (0, interface_database_decorators_1.BasicDataModel)(provisioning_attempt_table_1.ProvisioningAttempt, provisioning_attempt_table_1.provisioningAttemptsTableName) {
|
|
9
|
+
async advance(current, patch) {
|
|
10
|
+
const outcome = await this.table
|
|
11
|
+
.atomicMutation(current._id, {
|
|
12
|
+
type: "update",
|
|
13
|
+
revisionField: "revision",
|
|
14
|
+
expectedRevision: current.revision,
|
|
15
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
16
|
+
patch: { ...patch, updatedAt: new Date() },
|
|
17
|
+
})
|
|
18
|
+
.run();
|
|
19
|
+
if (outcome !== "applied")
|
|
20
|
+
throw new Error(`Provisioning outcome ${outcome}; reconciliation required`);
|
|
21
|
+
}
|
|
22
|
+
async findUnresolved() {
|
|
23
|
+
const rows = await this.table
|
|
24
|
+
.getAll(["preparing", "awaiting_payment", "reconciliation_required"], "state")
|
|
25
|
+
.slice(0, UNRESOLVED_PAGE_SIZE)
|
|
26
|
+
.run();
|
|
27
|
+
return rows
|
|
28
|
+
.map((row) => ProvisioningAttemptModel.fromDatabase(row))
|
|
29
|
+
.filter((row) => !!row);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.ProvisioningAttemptModel = ProvisioningAttemptModel;
|
|
33
|
+
//# sourceMappingURL=provisioning-attempt.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provisioning-attempt.model.js","sourceRoot":"","sources":["../../../src/workspaces/db/provisioning-attempt.model.ts"],"names":[],"mappings":";;;AAAA,6CAAyC;AACzC,6FAA2E;AAC3E,6EAGsC;AAEtC,MAAM,oBAAoB,GAAG,GAAG,CAAC;AAGjC,MAAa,wBAAyB,SAAQ,IAAA,8CAAc,EAC1D,gDAAmB,EACnB,0DAA6B,CAC9B;IAEC,KAAK,CAAC,OAAO,CACX,OAA4B,EAC5B,KAAmC;QAEnC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK;aAC7B,cAAc,CAAC,OAAO,CAAC,GAAG,EAAE;YAC3B,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,UAAU;YACzB,gBAAgB,EAAE,OAAO,CAAC,QAAQ;YAClC,YAAY,EAAE,IAAA,wBAAU,GAAE;YAC1B,KAAK,EAAE,EAAE,GAAG,KAAK,EAAE,SAAS,EAAE,IAAI,IAAI,EAAE,EAAE;SAC3C,CAAC;aACD,GAAG,EAAE,CAAC;QACT,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CACb,wBAAwB,OAAO,2BAA2B,CAC3D,CAAC;IACN,CAAC;IAGD,KAAK,CAAC,cAAc;QAClB,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,KAAK;aAC1B,MAAM,CACL,CAAC,WAAW,EAAE,kBAAkB,EAAE,yBAAyB,CAAC,EAC5D,OAAO,CACR;aACA,KAAK,CAAC,CAAC,EAAE,oBAAoB,CAAC;aAC9B,GAAG,EAAE,CAAC;QACT,OAAO,IAAI;aACR,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,wBAAwB,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;aACxD,MAAM,CAAC,CAAC,GAAG,EAA8B,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IACxD,CAAC;CACF;AArCD,4DAqCC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
export type ProvisioningAttemptState = "preparing" | "awaiting_payment" | "committed" | "cancelled" | "reconciliation_required";
|
|
3
|
+
export declare const provisioningAttemptsTableName = "saas_provisioning_attempts";
|
|
4
|
+
export declare class ProvisioningAttempt extends Table {
|
|
5
|
+
_id: string;
|
|
6
|
+
revision: string;
|
|
7
|
+
capacityId: string | null;
|
|
8
|
+
planId: string;
|
|
9
|
+
userId: string;
|
|
10
|
+
state: ProvisioningAttemptState;
|
|
11
|
+
stripeCustomerId: string | null;
|
|
12
|
+
stripeSubscriptionId: string | null;
|
|
13
|
+
trialConsumptionId: string | null;
|
|
14
|
+
trialIdentityIds: string[];
|
|
15
|
+
lastError: string | null;
|
|
16
|
+
createdAt: Date;
|
|
17
|
+
updatedAt: Date;
|
|
18
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.ProvisioningAttempt = exports.provisioningAttemptsTableName = void 0;
|
|
13
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
|
+
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
|
+
exports.provisioningAttemptsTableName = "saas_provisioning_attempts";
|
|
16
|
+
let ProvisioningAttempt = class ProvisioningAttempt extends interface_database_decorators_1.Table {
|
|
17
|
+
};
|
|
18
|
+
exports.ProvisioningAttempt = ProvisioningAttempt;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], ProvisioningAttempt.prototype, "_id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], ProvisioningAttempt.prototype, "revision", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], ProvisioningAttempt.prototype, "capacityId", void 0);
|
|
31
|
+
__decorate([
|
|
32
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
33
|
+
__metadata("design:type", String)
|
|
34
|
+
], ProvisioningAttempt.prototype, "planId", void 0);
|
|
35
|
+
__decorate([
|
|
36
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
37
|
+
__metadata("design:type", String)
|
|
38
|
+
], ProvisioningAttempt.prototype, "userId", void 0);
|
|
39
|
+
__decorate([
|
|
40
|
+
(0, interface_database_decorators_1.Index)(),
|
|
41
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
42
|
+
__metadata("design:type", String)
|
|
43
|
+
], ProvisioningAttempt.prototype, "state", void 0);
|
|
44
|
+
__decorate([
|
|
45
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
46
|
+
__metadata("design:type", Object)
|
|
47
|
+
], ProvisioningAttempt.prototype, "stripeCustomerId", void 0);
|
|
48
|
+
__decorate([
|
|
49
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
50
|
+
__metadata("design:type", Object)
|
|
51
|
+
], ProvisioningAttempt.prototype, "stripeSubscriptionId", void 0);
|
|
52
|
+
__decorate([
|
|
53
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
54
|
+
__metadata("design:type", Object)
|
|
55
|
+
], ProvisioningAttempt.prototype, "trialConsumptionId", void 0);
|
|
56
|
+
__decorate([
|
|
57
|
+
(0, interface_database_decorators_1.Field)("any"),
|
|
58
|
+
__metadata("design:type", Array)
|
|
59
|
+
], ProvisioningAttempt.prototype, "trialIdentityIds", void 0);
|
|
60
|
+
__decorate([
|
|
61
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
62
|
+
__metadata("design:type", Object)
|
|
63
|
+
], ProvisioningAttempt.prototype, "lastError", void 0);
|
|
64
|
+
__decorate([
|
|
65
|
+
(0, interface_database_decorators_1.CreationTime)(),
|
|
66
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
67
|
+
__metadata("design:type", Date)
|
|
68
|
+
], ProvisioningAttempt.prototype, "createdAt", void 0);
|
|
69
|
+
__decorate([
|
|
70
|
+
(0, interface_database_decorators_1.UpdateTime)(),
|
|
71
|
+
(0, interface_database_decorators_1.Field)("date"),
|
|
72
|
+
__metadata("design:type", Date)
|
|
73
|
+
], ProvisioningAttempt.prototype, "updatedAt", void 0);
|
|
74
|
+
exports.ProvisioningAttempt = ProvisioningAttempt = __decorate([
|
|
75
|
+
(0, interface_database_decorators_1.RegisterTable)(exports.provisioningAttemptsTableName, constants_1.CORE_SCHEMA_NAME)
|
|
76
|
+
], ProvisioningAttempt);
|
|
77
|
+
//# sourceMappingURL=provisioning-attempt.table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provisioning-attempt.table.js","sourceRoot":"","sources":["../../../src/workspaces/db/provisioning-attempt.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAOmD;AACnD,mEAAuE;AAQ1D,QAAA,6BAA6B,GAAG,4BAA4B,CAAC;AAInE,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,qCAAK;CA0C7C,CAAA;AA1CY,kDAAmB;AAEtB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;gDACI;AAGZ;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;qDACS;AAGjB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;uDACkB;AAG1B;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;mDACO;AAGf;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;mDACO;AAIf;IAFP,IAAA,qCAAK,GAAE;IACP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;kDACwB;AAGhC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;6DACwB;AAGhC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;iEAC4B;AAGpC;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;+DAC0B;AAGlC;IADP,IAAA,qCAAK,EAAC,KAAK,CAAC;;6DACsB;AAG3B;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;sDACiB;AAIzB;IAFP,IAAA,4CAAY,GAAE;IACd,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;sDAAC;AAIhB;IAFP,IAAA,0CAAU,GAAE;IACZ,IAAA,qCAAK,EAAC,MAAM,CAAC;8BACK,IAAI;sDAAC;8BAzCb,mBAAmB;IAD/B,IAAA,6CAAa,EAAC,qCAA6B,EAAE,4BAAgB,CAAC;GAClD,mBAAmB,CA0C/B"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { TrialIdentity } from "./trial-identity.table";
|
|
2
|
+
export declare function trialIdentityId(kind: "email" | "card", identity: string): string;
|
|
3
|
+
declare const TrialIdentityModel_base: {
|
|
4
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
5
|
+
readonly table: import("@antelopejs/interface-database").Table<TrialIdentity>;
|
|
6
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
7
|
+
get(id: string): PromiseLike<TrialIdentity | undefined>;
|
|
8
|
+
getBy(index: keyof TrialIdentity, ...keys: any[]): PromiseLike<TrialIdentity[]>;
|
|
9
|
+
getAll(): PromiseLike<TrialIdentity[]>;
|
|
10
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<TrialIdentity> | import("@antelopejs/interface-database-decorators").DeepPartial<TrialIdentity>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
11
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<TrialIdentity>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
12
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<TrialIdentity>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
13
|
+
delete(id: string): Promise<number>;
|
|
14
|
+
};
|
|
15
|
+
readonly schemaName: string;
|
|
16
|
+
fromPlainData(obj: any): TrialIdentity;
|
|
17
|
+
fromDatabase(obj: any): TrialIdentity | undefined;
|
|
18
|
+
toDatabase(obj: any): Record<string, any>;
|
|
19
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
20
|
+
};
|
|
21
|
+
export declare class TrialIdentityModel extends TrialIdentityModel_base {
|
|
22
|
+
reserve(id: string, tenantId: string): Promise<boolean>;
|
|
23
|
+
releaseUnused(id: string, tenantId: string): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TrialIdentityModel = void 0;
|
|
4
|
+
exports.trialIdentityId = trialIdentityId;
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
7
|
+
const trial_identity_table_1 = require("./trial-identity.table");
|
|
8
|
+
function trialIdentityId(kind, identity) {
|
|
9
|
+
return (0, node_crypto_1.createHash)("sha256").update(`${kind}:${identity}`).digest("hex");
|
|
10
|
+
}
|
|
11
|
+
class TrialIdentityModel extends (0, interface_database_decorators_1.BasicDataModel)(trial_identity_table_1.TrialIdentity, trial_identity_table_1.trialIdentitiesTableName) {
|
|
12
|
+
async reserve(id, tenantId) {
|
|
13
|
+
let current = await this.get(id);
|
|
14
|
+
if (!current) {
|
|
15
|
+
try {
|
|
16
|
+
await this.insert({ _id: id, revision: (0, node_crypto_1.randomUUID)(), tenantId });
|
|
17
|
+
}
|
|
18
|
+
catch (error) {
|
|
19
|
+
current = await this.get(id);
|
|
20
|
+
if (!current)
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
current ??= await this.get(id);
|
|
24
|
+
}
|
|
25
|
+
if (!current)
|
|
26
|
+
throw new Error("Trial reservation is missing");
|
|
27
|
+
if (current.tenantId === tenantId)
|
|
28
|
+
return true;
|
|
29
|
+
if (current.tenantId !== null)
|
|
30
|
+
return false;
|
|
31
|
+
const outcome = await this.table
|
|
32
|
+
.atomicMutation(id, {
|
|
33
|
+
type: "update",
|
|
34
|
+
revisionField: "revision",
|
|
35
|
+
expectedRevision: current.revision,
|
|
36
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
37
|
+
patch: { tenantId },
|
|
38
|
+
})
|
|
39
|
+
.run();
|
|
40
|
+
if (outcome === "unknown")
|
|
41
|
+
throw new Error("Trial reservation outcome requires reconciliation");
|
|
42
|
+
return outcome === "applied";
|
|
43
|
+
}
|
|
44
|
+
async releaseUnused(id, tenantId) {
|
|
45
|
+
const current = await this.get(id);
|
|
46
|
+
if (!current || current.tenantId !== tenantId)
|
|
47
|
+
return;
|
|
48
|
+
const outcome = await this.table
|
|
49
|
+
.atomicMutation(id, {
|
|
50
|
+
type: "update",
|
|
51
|
+
revisionField: "revision",
|
|
52
|
+
expectedRevision: current.revision,
|
|
53
|
+
nextRevision: (0, node_crypto_1.randomUUID)(),
|
|
54
|
+
patch: { tenantId: null },
|
|
55
|
+
})
|
|
56
|
+
.run();
|
|
57
|
+
if (outcome !== "applied")
|
|
58
|
+
throw new Error(`Trial release ${outcome}; reconciliation required`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
exports.TrialIdentityModel = TrialIdentityModel;
|
|
62
|
+
//# sourceMappingURL=trial-identity.model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trial-identity.model.js","sourceRoot":"","sources":["../../../src/workspaces/db/trial-identity.model.ts"],"names":[],"mappings":";;;AAQA,0CAKC;AAbD,6CAAqD;AACrD,6FAA2E;AAC3E,iEAGgC;AAGhC,SAAgB,eAAe,CAC7B,IAAsB,EACtB,QAAgB;IAEhB,OAAO,IAAA,wBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,GAAG,IAAI,IAAI,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC1E,CAAC;AAGD,MAAa,kBAAmB,SAAQ,IAAA,8CAAc,EACpD,oCAAa,EACb,+CAAwB,CACzB;IAEC,KAAK,CAAC,OAAO,CAAC,EAAU,EAAE,QAAgB;QACxC,IAAI,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,IAAI,CAAC;gBACH,MAAM,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,IAAA,wBAAU,GAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;YACnE,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;gBAC7B,IAAI,CAAC,OAAO;oBAAE,MAAM,KAAK,CAAC;YAC5B,CAAC;YACD,OAAO,KAAK,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC;QACD,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAC9D,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC/C,IAAI,OAAO,CAAC,QAAQ,KAAK,IAAI;YAAE,OAAO,KAAK,CAAC;QAC5C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK;aAC7B,cAAc,CAAC,EAAE,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,UAAU;YACzB,gBAAgB,EAAE,OAAO,CAAC,QAAQ;YAClC,YAAY,EAAE,IAAA,wBAAU,GAAE;YAC1B,KAAK,EAAE,EAAE,QAAQ,EAAE;SACpB,CAAC;aACD,GAAG,EAAE,CAAC;QACT,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CAAC,mDAAmD,CAAC,CAAC;QACvE,OAAO,OAAO,KAAK,SAAS,CAAC;IAC/B,CAAC;IAGD,KAAK,CAAC,aAAa,CAAC,EAAU,EAAE,QAAgB;QAC9C,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;QACnC,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ;YAAE,OAAO;QACtD,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,KAAK;aAC7B,cAAc,CAAC,EAAE,EAAE;YAClB,IAAI,EAAE,QAAQ;YACd,aAAa,EAAE,UAAU;YACzB,gBAAgB,EAAE,OAAO,CAAC,QAAQ;YAClC,YAAY,EAAE,IAAA,wBAAU,GAAE;YAC1B,KAAK,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;SAC1B,CAAC;aACD,GAAG,EAAE,CAAC;QACT,IAAI,OAAO,KAAK,SAAS;YACvB,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,2BAA2B,CAAC,CAAC;IACzE,CAAC;CACF;AAjDD,gDAiDC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.TrialIdentity = exports.trialIdentitiesTableName = void 0;
|
|
13
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
14
|
+
const constants_1 = require("@antelopejs/interface-dms/constants");
|
|
15
|
+
exports.trialIdentitiesTableName = "saas_trial_identities";
|
|
16
|
+
let TrialIdentity = class TrialIdentity extends interface_database_decorators_1.Table {
|
|
17
|
+
};
|
|
18
|
+
exports.TrialIdentity = TrialIdentity;
|
|
19
|
+
__decorate([
|
|
20
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
21
|
+
__metadata("design:type", String)
|
|
22
|
+
], TrialIdentity.prototype, "_id", void 0);
|
|
23
|
+
__decorate([
|
|
24
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
25
|
+
__metadata("design:type", String)
|
|
26
|
+
], TrialIdentity.prototype, "revision", void 0);
|
|
27
|
+
__decorate([
|
|
28
|
+
(0, interface_database_decorators_1.Field)("string"),
|
|
29
|
+
__metadata("design:type", Object)
|
|
30
|
+
], TrialIdentity.prototype, "tenantId", void 0);
|
|
31
|
+
exports.TrialIdentity = TrialIdentity = __decorate([
|
|
32
|
+
(0, interface_database_decorators_1.RegisterTable)(exports.trialIdentitiesTableName, constants_1.CORE_SCHEMA_NAME)
|
|
33
|
+
], TrialIdentity);
|
|
34
|
+
//# sourceMappingURL=trial-identity.table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"trial-identity.table.js","sourceRoot":"","sources":["../../../src/workspaces/db/trial-identity.table.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,6FAImD;AACnD,mEAAuE;AAE1D,QAAA,wBAAwB,GAAG,uBAAuB,CAAC;AAIzD,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,qCAAK;CASvC,CAAA;AATY,sCAAa;AAEhB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;0CACI;AAGZ;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;+CACS;AAGjB;IADP,IAAA,qCAAK,EAAC,QAAQ,CAAC;;+CACgB;wBARrB,aAAa;IADzB,IAAA,6CAAa,EAAC,gCAAwB,EAAE,4BAAgB,CAAC;GAC7C,aAAa,CASzB"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { TenantSubscription, TenantSubscriptionStatus } from "../db";
|
|
2
|
+
export interface WorkspaceDeletionResult {
|
|
3
|
+
status: TenantSubscriptionStatus;
|
|
4
|
+
retentionDays: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function getWorkspaceDeletionOperationId(tenantId: string, subscription: Pick<TenantSubscription, "_id" | "deletionStartedAt">): string;
|
|
7
|
+
export declare function resolveDataRetentionDays(): Promise<number>;
|
|
8
|
+
export declare function requestWorkspaceDeletion(tenantId: string): Promise<WorkspaceDeletionResult>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWorkspaceDeletionOperationId = getWorkspaceDeletionOperationId;
|
|
4
|
+
exports.resolveDataRetentionDays = resolveDataRetentionDays;
|
|
5
|
+
exports.requestWorkspaceDeletion = requestWorkspaceDeletion;
|
|
6
|
+
const node_crypto_1 = require("node:crypto");
|
|
7
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
8
|
+
const logging_1 = require("@antelopejs/interface-core/logging");
|
|
9
|
+
const interface_database_decorators_1 = require("@antelopejs/interface-database-decorators");
|
|
10
|
+
const billing_state_1 = require("../billing-state");
|
|
11
|
+
const db_1 = require("../db");
|
|
12
|
+
const notifications_1 = require("../notifications");
|
|
13
|
+
const stripe_1 = require("../stripe");
|
|
14
|
+
const HTTP_NOT_FOUND = 404;
|
|
15
|
+
const HTTP_CONFLICT = 409;
|
|
16
|
+
const CANCELLED_STATUS = "cancelled";
|
|
17
|
+
const NOTIF_ICON = "i-ph-trash";
|
|
18
|
+
const NOTIF_TITLE = "$saas.notifications.payload.workspace_deletion_requested.title";
|
|
19
|
+
const NOTIF_DESC = "$saas.notifications.payload.workspace_deletion_requested.description";
|
|
20
|
+
function getWorkspaceDeletionOperationId(tenantId, subscription) {
|
|
21
|
+
if (!subscription.deletionStartedAt)
|
|
22
|
+
throw new Error("Subscription deletion has not been admitted");
|
|
23
|
+
return JSON.stringify([
|
|
24
|
+
"retention-delete",
|
|
25
|
+
tenantId,
|
|
26
|
+
subscription._id,
|
|
27
|
+
subscription.deletionStartedAt.toISOString(),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
async function resolveDataRetentionDays() {
|
|
31
|
+
const settings = await (0, interface_database_decorators_1.GetModel)(db_1.BillingSettingsModel).get(db_1.BILLING_SETTINGS_SINGLETON_ID);
|
|
32
|
+
return (settings?.dataRetentionDaysAfterCancellation ?? db_1.DEFAULT_DATA_RETENTION_DAYS);
|
|
33
|
+
}
|
|
34
|
+
async function requestWorkspaceDeletion(tenantId) {
|
|
35
|
+
const subscriptionModel = (0, interface_database_decorators_1.GetModel)(db_1.TenantSubscriptionModel, tenantId);
|
|
36
|
+
const subscription = await subscriptionModel.findOne();
|
|
37
|
+
(0, interface_api_util_1.assert)(subscription, HTTP_NOT_FOUND, "saas.errors.workspace.no_active_subscription");
|
|
38
|
+
(0, interface_api_util_1.assert)(subscription.status !== CANCELLED_STATUS, HTTP_CONFLICT, "saas.errors.workspace.is_cancelled");
|
|
39
|
+
const operationId = (0, node_crypto_1.randomUUID)();
|
|
40
|
+
await subscriptionModel.beginTransition(subscription, {
|
|
41
|
+
operationId,
|
|
42
|
+
kind: "cancel",
|
|
43
|
+
targetPlanId: null,
|
|
44
|
+
requestedAt: new Date(),
|
|
45
|
+
});
|
|
46
|
+
if (subscription.stripeSubscriptionId) {
|
|
47
|
+
await (0, stripe_1.getStripeClient)().subscriptions.cancel(subscription.stripeSubscriptionId, { idempotencyKey: `workspace-delete:${operationId}` });
|
|
48
|
+
}
|
|
49
|
+
await subscriptionModel.completeTransition(subscription._id, operationId, {
|
|
50
|
+
status: CANCELLED_STATUS,
|
|
51
|
+
updatedAt: new Date(),
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
status: CANCELLED_STATUS,
|
|
55
|
+
retentionDays: await runAfterCancellation(tenantId),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function runAfterCancellation(tenantId) {
|
|
59
|
+
await bestEffort(tenantId, "recompute billing state", () => (0, billing_state_1.recomputeTenantBillingState)(tenantId));
|
|
60
|
+
await bestEffort(tenantId, "notify owners", () => (0, notifications_1.notifyTenantOwners)(tenantId, notifications_1.subscriptionCancelledSubject, {
|
|
61
|
+
icon: NOTIF_ICON,
|
|
62
|
+
title: NOTIF_TITLE,
|
|
63
|
+
description: NOTIF_DESC,
|
|
64
|
+
}));
|
|
65
|
+
return resolveDataRetentionDays().catch(() => db_1.DEFAULT_DATA_RETENTION_DAYS);
|
|
66
|
+
}
|
|
67
|
+
async function bestEffort(tenantId, step, work) {
|
|
68
|
+
try {
|
|
69
|
+
await work();
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
logging_1.Logging.Error(`[dms-saas:workspace-deletion] ${step} failed for tenant ${tenantId}`, error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
//# sourceMappingURL=deletion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,UAAU,CACvB,QAAgB,EAChB,IAAY,EACZ,IAA4B;IAE5B,IAAI,CAAC;QACH,MAAM,IAAI,EAAE,CAAC;IACf,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,iBAAO,CAAC,KAAK,CACX,iCAAiC,IAAI,sBAAsB,QAAQ,EAAE,EACrE,KAAK,CACN,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Plan } from "../db";
|
|
2
|
+
export interface FreePlanAvailability {
|
|
3
|
+
isAvailable: boolean;
|
|
4
|
+
blockingWorkspaceName: string | null;
|
|
5
|
+
}
|
|
6
|
+
export declare function isFreePlan(plan: Plan): boolean;
|
|
7
|
+
export declare function resolveMaxFreeWorkspacesPerCard(): Promise<number>;
|
|
8
|
+
export declare function findFreeWorkspaceIdsBackedByCard(cardFingerprint: string): Promise<string[]>;
|
|
9
|
+
export declare function assertFreePlanAllowedForCard(plan: Plan, cardFingerprint: string | null): Promise<void>;
|
|
10
|
+
export declare function resolveFreePlanAvailability(freeWorkspaceNamesPerCard: string[][], limit: number): FreePlanAvailability;
|
|
11
|
+
export declare function resolveFreePlanAvailabilityForUser(userId: string): Promise<FreePlanAvailability>;
|