@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,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSupportPlan = createSupportPlan;
|
|
4
|
+
exports.replySupportPlan = replySupportPlan;
|
|
5
|
+
exports.updateSupportPlan = updateSupportPlan;
|
|
6
|
+
const transitions_1 = require("./transitions");
|
|
7
|
+
function ticketEvents(ticket, next, actorId, actorName) {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
type: "status_changed",
|
|
11
|
+
previousValue: ticket.status,
|
|
12
|
+
newValue: next.status,
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
type: "assignment_changed",
|
|
16
|
+
previousValue: ticket.assignedTo,
|
|
17
|
+
newValue: next.assignedTo,
|
|
18
|
+
},
|
|
19
|
+
]
|
|
20
|
+
.filter((change) => change.previousValue !== change.newValue)
|
|
21
|
+
.map((change) => ({
|
|
22
|
+
...change,
|
|
23
|
+
_id: `${next.mutationId}:${change.type}`,
|
|
24
|
+
ticketId: ticket._id,
|
|
25
|
+
actorId,
|
|
26
|
+
actorName,
|
|
27
|
+
createdAt: next.updatedAt,
|
|
28
|
+
}));
|
|
29
|
+
}
|
|
30
|
+
function nextTicket(ticket, operationId, update) {
|
|
31
|
+
return {
|
|
32
|
+
_id: ticket._id,
|
|
33
|
+
subject: ticket.subject,
|
|
34
|
+
category: ticket.category,
|
|
35
|
+
priority: ticket.priority,
|
|
36
|
+
createdBy: ticket.createdBy,
|
|
37
|
+
createdAt: ticket.createdAt,
|
|
38
|
+
status: update.status,
|
|
39
|
+
assignedTo: update.assignedTo,
|
|
40
|
+
lastMessageAt: update.lastMessageAt ?? ticket.lastMessageAt,
|
|
41
|
+
updatedAt: update.updatedAt,
|
|
42
|
+
revision: ticket.revision + 1,
|
|
43
|
+
mutationId: operationId,
|
|
44
|
+
publicationId: operationId,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function createSupportPlan(options, id) {
|
|
48
|
+
const now = new Date();
|
|
49
|
+
const ticket = {
|
|
50
|
+
_id: id,
|
|
51
|
+
subject: options.input.subject,
|
|
52
|
+
category: options.input.category,
|
|
53
|
+
priority: options.input.priority,
|
|
54
|
+
status: "open",
|
|
55
|
+
assignedTo: null,
|
|
56
|
+
createdBy: options.authorId,
|
|
57
|
+
createdAt: now,
|
|
58
|
+
updatedAt: now,
|
|
59
|
+
lastMessageAt: now,
|
|
60
|
+
revision: 0,
|
|
61
|
+
mutationId: id,
|
|
62
|
+
publicationId: id,
|
|
63
|
+
};
|
|
64
|
+
const message = {
|
|
65
|
+
_id: `${id}:message`,
|
|
66
|
+
ticketId: id,
|
|
67
|
+
authorId: options.authorId,
|
|
68
|
+
authorType: "tenant",
|
|
69
|
+
body: options.input.body,
|
|
70
|
+
attachments: [],
|
|
71
|
+
createdAt: now,
|
|
72
|
+
};
|
|
73
|
+
return {
|
|
74
|
+
expectedMutationId: null,
|
|
75
|
+
ticket,
|
|
76
|
+
message,
|
|
77
|
+
events: [],
|
|
78
|
+
stagedKeys: options.input.attachments,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
function replySupportPlan(options, ticket, id) {
|
|
82
|
+
const now = new Date();
|
|
83
|
+
const status = options.authorType === "tenant"
|
|
84
|
+
? (0, transitions_1.statusAfterTenantMessage)(ticket.status)
|
|
85
|
+
: (0, transitions_1.statusAfterPlatformReply)(ticket.status);
|
|
86
|
+
const next = nextTicket(ticket, id, {
|
|
87
|
+
status,
|
|
88
|
+
assignedTo: ticket.assignedTo,
|
|
89
|
+
updatedAt: now,
|
|
90
|
+
lastMessageAt: now,
|
|
91
|
+
});
|
|
92
|
+
const message = {
|
|
93
|
+
_id: `${id}:message`,
|
|
94
|
+
ticketId: ticket._id,
|
|
95
|
+
authorId: options.authorId,
|
|
96
|
+
authorType: options.authorType,
|
|
97
|
+
body: options.input.body,
|
|
98
|
+
attachments: [],
|
|
99
|
+
createdAt: now,
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
expectedMutationId: ticket.mutationId,
|
|
103
|
+
ticket: next,
|
|
104
|
+
message,
|
|
105
|
+
events: ticketEvents(ticket, next, options.authorId, options.authorName || options.authorId),
|
|
106
|
+
stagedKeys: options.input.attachments,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
function updateSupportPlan(options, ticket, id) {
|
|
110
|
+
const status = options.input.status ?? ticket.status;
|
|
111
|
+
(0, transitions_1.assertSupportStatusTransition)(ticket.status, status);
|
|
112
|
+
const assignedTo = options.input.assignedTo === undefined
|
|
113
|
+
? ticket.assignedTo
|
|
114
|
+
: options.input.assignedTo;
|
|
115
|
+
const next = nextTicket(ticket, id, {
|
|
116
|
+
status,
|
|
117
|
+
assignedTo,
|
|
118
|
+
updatedAt: new Date(),
|
|
119
|
+
});
|
|
120
|
+
const events = ticketEvents(ticket, next, options.actorId, options.actorName);
|
|
121
|
+
return {
|
|
122
|
+
expectedMutationId: ticket.mutationId,
|
|
123
|
+
unchanged: events.length === 0,
|
|
124
|
+
ticket: events.length ? next : ticket,
|
|
125
|
+
message: null,
|
|
126
|
+
events,
|
|
127
|
+
stagedKeys: [],
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
//# sourceMappingURL=plans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../../src/support/plans.ts"],"names":[],"mappings":";;AAkEA,8CAoCC;AAGD,4CAqCC;AAGD,8CAyBC;AAlKD,+CAIuB;AAEvB,SAAS,YAAY,CACnB,MAAqB,EACrB,IAAmB,EACnB,OAAe,EACf,SAAiB;IAEjB,OAAO;QACL;YACE,IAAI,EAAE,gBAAyB;YAC/B,aAAa,EAAE,MAAM,CAAC,MAAM;YAC5B,QAAQ,EAAE,IAAI,CAAC,MAAM;SACtB;QACD;YACE,IAAI,EAAE,oBAA6B;YACnC,aAAa,EAAE,MAAM,CAAC,UAAU;YAChC,QAAQ,EAAE,IAAI,CAAC,UAAU;SAC1B;KACF;SACE,MAAM,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,aAAa,KAAK,MAAM,CAAC,QAAQ,CAAC;SAC5D,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAChB,GAAG,MAAM;QACT,GAAG,EAAE,GAAG,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,EAAE;QACxC,QAAQ,EAAE,MAAM,CAAC,GAAG;QACpB,OAAO;QACP,SAAS;QACT,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,UAAU,CACjB,MAAqB,EACrB,WAAmB,EACnB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OAAO,CAAC,KAAK,CAAC,WAAW;KACtC,CAAC;AACJ,CAAC;AAGD,SAAgB,iBAAiB,CAC/B,OAAmC,EACnC,MAAqB,EACrB,EAAU;IAEV,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC;IACrD,IAAA,2CAA6B,EAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrD,MAAM,UAAU,GACd,OAAO,CAAC,KAAK,CAAC,UAAU,KAAK,SAAS;QACpC,CAAC,CAAC,MAAM,CAAC,UAAU;QACnB,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC;IAC/B,MAAM,IAAI,GAAG,UAAU,CAAC,MAAM,EAAE,EAAE,EAAE;QAClC,MAAM;QACN,UAAU;QACV,SAAS,EAAE,IAAI,IAAI,EAAE;KACtB,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC;IAC9E,OAAO;QACL,kBAAkB,EAAE,MAAM,CAAC,UAAU;QACrC,SAAS,EAAE,MAAM,CAAC,MAAM,KAAK,CAAC;QAC9B,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM;QACrC,OAAO,EAAE,IAAI;QACb,MAAM;QACN,UAAU,EAAE,EAAE;KACf,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type SupportTicket, type SupportTicketModel } from "../db";
|
|
2
|
+
import { type SupportOperation } from "./operations";
|
|
3
|
+
import type { SupportModels } from "./service";
|
|
4
|
+
export declare function reconcileSupportTicket(tickets: SupportTicketModel, ticketId: string): Promise<SupportTicket>;
|
|
5
|
+
export declare function reconcileSupportPublication(models: SupportModels, ticket: SupportTicket): Promise<void>;
|
|
6
|
+
export declare function readSupportTicket(models: SupportModels, ticketId: string): Promise<SupportTicket>;
|
|
7
|
+
export declare function publishSupportOperation(models: SupportModels, operation: SupportOperation): Promise<SupportOperation>;
|
|
8
|
+
export declare function committedSupportPublication(operation: SupportOperation): import("./operations").SupportPublication;
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reconcileSupportTicket = reconcileSupportTicket;
|
|
4
|
+
exports.reconcileSupportPublication = reconcileSupportPublication;
|
|
5
|
+
exports.readSupportTicket = readSupportTicket;
|
|
6
|
+
exports.publishSupportOperation = publishSupportOperation;
|
|
7
|
+
exports.committedSupportPublication = committedSupportPublication;
|
|
8
|
+
const node_util_1 = require("node:util");
|
|
9
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
10
|
+
const db_1 = require("../db");
|
|
11
|
+
const operations_1 = require("./operations");
|
|
12
|
+
const HTTP_NOT_FOUND = 404;
|
|
13
|
+
const HTTP_CONFLICT = 409;
|
|
14
|
+
const HTTP_UNAVAILABLE = 503;
|
|
15
|
+
const MAX_PUBLICATIONS_PER_READ = 8;
|
|
16
|
+
async function reconcileSupportTicket(tickets, ticketId) {
|
|
17
|
+
const ticket = await tickets.get(ticketId);
|
|
18
|
+
(0, interface_api_util_1.assert)(ticket, HTTP_NOT_FOUND, "saas.errors.support.ticket_not_found");
|
|
19
|
+
if (!ticket.publicationId)
|
|
20
|
+
return ticket;
|
|
21
|
+
return readSupportTicket({
|
|
22
|
+
tickets,
|
|
23
|
+
messages: new db_1.SupportMessageModel(tickets.database),
|
|
24
|
+
events: new db_1.SupportTicketEventModel(tickets.database),
|
|
25
|
+
}, ticketId);
|
|
26
|
+
}
|
|
27
|
+
async function insertProjection(model, row) {
|
|
28
|
+
try {
|
|
29
|
+
await model.insert([row]);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
}
|
|
33
|
+
const stored = await model.get(row._id);
|
|
34
|
+
(0, interface_api_util_1.assert)(stored &&
|
|
35
|
+
Object.entries(row).every(([key, value]) => (0, node_util_1.isDeepStrictEqual)(stored[key], value)), HTTP_UNAVAILABLE, "saas.errors.support.projection_pending");
|
|
36
|
+
}
|
|
37
|
+
async function reconcileSupportPublication(models, ticket) {
|
|
38
|
+
if (!ticket.publicationId)
|
|
39
|
+
return;
|
|
40
|
+
const operations = new operations_1.SupportOperationModel(models.tickets.database);
|
|
41
|
+
const operation = await operations.get(ticket.publicationId);
|
|
42
|
+
(0, interface_api_util_1.assert)(operation && operation.status !== "rejected", HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
43
|
+
const publication = (0, operations_1.supportPublication)(operation);
|
|
44
|
+
(0, interface_api_util_1.assert)(publication.ticket._id === ticket._id, HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
45
|
+
if (publication.message)
|
|
46
|
+
await insertProjection(models.messages, publication.message);
|
|
47
|
+
for (const event of publication.events)
|
|
48
|
+
await insertProjection(models.events, event);
|
|
49
|
+
await operations.finish(operation, "committed");
|
|
50
|
+
await models.tickets.settlePublication(ticket._id, operation._id);
|
|
51
|
+
}
|
|
52
|
+
async function readSupportTicket(models, ticketId) {
|
|
53
|
+
for (let attempt = 0; attempt < MAX_PUBLICATIONS_PER_READ; attempt += 1) {
|
|
54
|
+
const ticket = await models.tickets.get(ticketId);
|
|
55
|
+
(0, interface_api_util_1.assert)(ticket, HTTP_NOT_FOUND, "saas.errors.support.ticket_not_found");
|
|
56
|
+
if (!ticket.publicationId)
|
|
57
|
+
return ticket;
|
|
58
|
+
await reconcileSupportPublication(models, ticket);
|
|
59
|
+
}
|
|
60
|
+
throw new Error("Support publication did not settle within the read budget");
|
|
61
|
+
}
|
|
62
|
+
async function publishTicket(models, operation) {
|
|
63
|
+
const publication = (0, operations_1.supportPublication)(operation);
|
|
64
|
+
if (publication.expectedMutationId !== null) {
|
|
65
|
+
await models.tickets.publish(publication.ticket, publication.expectedMutationId);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
try {
|
|
69
|
+
await models.tickets.insert([publication.ticket]);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
async function publishSupportOperation(models, operation) {
|
|
75
|
+
const operations = new operations_1.SupportOperationModel(models.tickets.database);
|
|
76
|
+
const current = await operations.get(operation._id);
|
|
77
|
+
(0, interface_api_util_1.assert)(current, HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
78
|
+
if (current.status !== "ready")
|
|
79
|
+
return current;
|
|
80
|
+
operation = current;
|
|
81
|
+
if ((0, operations_1.supportPublication)(operation).unchanged) {
|
|
82
|
+
return operations.finish(operation, "committed");
|
|
83
|
+
}
|
|
84
|
+
await publishTicket(models, operation);
|
|
85
|
+
const publication = (0, operations_1.supportPublication)(operation);
|
|
86
|
+
const ticket = await models.tickets.get(publication.ticket._id);
|
|
87
|
+
if (ticket?.publicationId === operation._id) {
|
|
88
|
+
await reconcileSupportPublication(models, ticket);
|
|
89
|
+
}
|
|
90
|
+
const stored = await operations.get(operation._id);
|
|
91
|
+
(0, interface_api_util_1.assert)(stored, HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
92
|
+
if (stored.status !== "ready")
|
|
93
|
+
return stored;
|
|
94
|
+
if (ticket &&
|
|
95
|
+
ticket.mutationId !== publication.expectedMutationId &&
|
|
96
|
+
ticket.mutationId !== operation._id) {
|
|
97
|
+
return operations.finish(stored, "rejected");
|
|
98
|
+
}
|
|
99
|
+
(0, interface_api_util_1.assert)(false, HTTP_UNAVAILABLE, "saas.errors.support.operation_unknown");
|
|
100
|
+
}
|
|
101
|
+
function committedSupportPublication(operation) {
|
|
102
|
+
(0, interface_api_util_1.assert)(operation.status !== "rejected", operation.failure?.status ?? HTTP_CONFLICT, operation.failure?.code ?? "saas.errors.support.tenant_busy");
|
|
103
|
+
(0, interface_api_util_1.assert)(operation.status === "committed", HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
104
|
+
return (0, operations_1.supportPublication)(operation);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=publications.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publications.js","sourceRoot":"","sources":["../../src/support/publications.ts"],"names":[],"mappings":";;AAqBA,wDAeC;AAgCD,kEAwBC;AAGD,8CAWC;AAsBD,0DA6BC;AAGD,kEAYC;AA5KD,yCAA8C;AAC9C,uEAAwD;AACxD,8BAKe;AACf,6CAIsB;AAGtB,MAAM,cAAc,GAAG,GAAG,CAAC;AAC3B,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,yBAAyB,GAAG,CAAC,CAAC;AAG7B,KAAK,UAAU,sBAAsB,CAC1C,OAA2B,EAC3B,QAAgB;IAEhB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAC3C,IAAA,2BAAM,EAAC,MAAM,EAAE,cAAc,EAAE,sCAAsC,CAAC,CAAC;IACvE,IAAI,CAAC,MAAM,CAAC,aAAa;QAAE,OAAO,MAAM,CAAC;IACzC,OAAO,iBAAiB,CACtB;QACE,OAAO;QACP,QAAQ,EAAE,IAAI,wBAAmB,CAAC,OAAO,CAAC,QAAQ,CAAC;QACnD,MAAM,EAAE,IAAI,4BAAuB,CAAC,OAAO,CAAC,QAAQ,CAAC;KACtD,EACD,QAAQ,CACT,CAAC;AACJ,CAAC;AAWD,KAAK,UAAU,gBAAgB,CAC7B,KAAyB,EACzB,GAAM;IAEN,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;IAET,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACxC,IAAA,2BAAM,EAC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,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,aAAa,EAC1C,SAAS,CAAC,OAAO,EAAE,IAAI,IAAI,iCAAiC,CAC7D,CAAC;IACF,IAAA,2BAAM,EACJ,SAAS,CAAC,MAAM,KAAK,WAAW,EAChC,gBAAgB,EAChB,uCAAuC,CACxC,CAAC;IACF,OAAO,IAAA,+BAAkB,EAAC,SAAS,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type SupportModels } from "./service";
|
|
2
|
+
export interface SupportRecoveryPage {
|
|
3
|
+
nextCursor: string | null;
|
|
4
|
+
processed: string[];
|
|
5
|
+
pending: string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function recoverSupportOperations(tenantId: string, models: SupportModels, after?: string): Promise<SupportRecoveryPage>;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.recoverSupportOperations = recoverSupportOperations;
|
|
4
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
5
|
+
const operations_1 = require("./operations");
|
|
6
|
+
const publications_1 = require("./publications");
|
|
7
|
+
const service_1 = require("./service");
|
|
8
|
+
const RECOVERY_PAGE_SIZE = 20;
|
|
9
|
+
const HTTP_BAD_REQUEST = 400;
|
|
10
|
+
const HTTP_UNAVAILABLE = 503;
|
|
11
|
+
const RECEIPT_ID = /^[a-f0-9]{64}$/;
|
|
12
|
+
async function recoverOperation(tenantId, models, operation) {
|
|
13
|
+
const result = await (0, service_1.resumeSupportOperation)(tenantId, models, operation);
|
|
14
|
+
(0, interface_api_util_1.assert)(result.status === "committed" || result.status === "rejected", HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
15
|
+
const ticket = await models.tickets.get((0, operations_1.supportPublication)(operation).ticket._id);
|
|
16
|
+
if (ticket?.publicationId === operation._id)
|
|
17
|
+
await (0, publications_1.reconcileSupportPublication)(models, ticket);
|
|
18
|
+
}
|
|
19
|
+
async function recoverSupportOperations(tenantId, models, after = "") {
|
|
20
|
+
(0, interface_api_util_1.assert)(after === "" || RECEIPT_ID.test(after), HTTP_BAD_REQUEST, "saas.errors.support.invalid_cursor");
|
|
21
|
+
const operations = new operations_1.SupportOperationModel(models.tickets.database);
|
|
22
|
+
const rows = await operations.table
|
|
23
|
+
.filter((row) => row.key("_id").gt(after))
|
|
24
|
+
.orderBy("_id", "asc")
|
|
25
|
+
.slice(0, RECOVERY_PAGE_SIZE)
|
|
26
|
+
.run();
|
|
27
|
+
const page = {
|
|
28
|
+
nextCursor: rows.length === RECOVERY_PAGE_SIZE ? rows.at(-1)._id : null,
|
|
29
|
+
processed: [],
|
|
30
|
+
pending: [],
|
|
31
|
+
};
|
|
32
|
+
for (const row of rows) {
|
|
33
|
+
try {
|
|
34
|
+
await recoverOperation(tenantId, models, row);
|
|
35
|
+
page.processed.push(row._id);
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
page.pending.push(row._id);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return page;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=recovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"recovery.js","sourceRoot":"","sources":["../../src/support/recovery.ts"],"names":[],"mappings":";;AAuCA,4DA8BC;AArED,uEAAwD;AACxD,6CAIsB;AACtB,iDAA6D;AAC7D,uCAAuE;AAEvE,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,UAAU,GAAG,gBAAgB,CAAC;AAQpC,KAAK,UAAU,gBAAgB,CAC7B,QAAgB,EAChB,MAAqB,EACrB,SAA2B;IAE3B,MAAM,MAAM,GAAG,MAAM,IAAA,gCAAsB,EAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,CAAC,CAA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,EAAE,CAAC;QACvB,IAAI,CAAC;YACH,MAAM,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;YAC9C,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,CAAC;QAAC,MAAM,CAAC;YACP,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { Tenant } from "@antelopejs/interface-dms/db";
|
|
2
|
+
import type { SupportMessage, SupportMessageAuthorType, SupportMessageModel, SupportTicket, SupportTicketEventModel, SupportTicketModel, SupportTicketStatus } from "../db";
|
|
3
|
+
import { type SupportOperation } from "./operations";
|
|
4
|
+
import { type SupportMessageInput, type SupportTicketInput } from "./validation";
|
|
5
|
+
export interface SupportModels {
|
|
6
|
+
tickets: SupportTicketModel;
|
|
7
|
+
messages: SupportMessageModel;
|
|
8
|
+
events: SupportTicketEventModel;
|
|
9
|
+
}
|
|
10
|
+
export interface CreateSupportTicketOptions {
|
|
11
|
+
tenant: Tenant;
|
|
12
|
+
authorId: string;
|
|
13
|
+
requestId: string;
|
|
14
|
+
input: SupportTicketInput;
|
|
15
|
+
models: SupportModels;
|
|
16
|
+
validateNewRequest?: () => Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export interface AddSupportMessageOptions {
|
|
19
|
+
tenantId: string;
|
|
20
|
+
ticketId: string;
|
|
21
|
+
authorId: string;
|
|
22
|
+
authorName?: string;
|
|
23
|
+
authorType: SupportMessageAuthorType;
|
|
24
|
+
requestId: string;
|
|
25
|
+
input: SupportMessageInput;
|
|
26
|
+
models: SupportModels;
|
|
27
|
+
}
|
|
28
|
+
export interface SupportTicketUpdate {
|
|
29
|
+
status: SupportTicketStatus;
|
|
30
|
+
assignedTo: string | null;
|
|
31
|
+
updatedAt: Date;
|
|
32
|
+
lastMessageAt?: Date;
|
|
33
|
+
}
|
|
34
|
+
export interface SupportTicketPatch {
|
|
35
|
+
status?: SupportTicketStatus;
|
|
36
|
+
assignedTo?: string | null;
|
|
37
|
+
}
|
|
38
|
+
export interface UpdateSupportTicketOptions {
|
|
39
|
+
tenantId: string;
|
|
40
|
+
ticketId: string;
|
|
41
|
+
requestId: string;
|
|
42
|
+
input: SupportTicketPatch;
|
|
43
|
+
actorId: string;
|
|
44
|
+
actorName: string;
|
|
45
|
+
models: SupportModels;
|
|
46
|
+
validateNewRequest?: () => Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
export declare function resumeSupportOperation(tenantId: string, models: SupportModels, operation: SupportOperation): Promise<SupportOperation>;
|
|
49
|
+
export declare function createSupportTicket(options: CreateSupportTicketOptions): Promise<SupportTicket>;
|
|
50
|
+
export declare function addSupportMessage(options: AddSupportMessageOptions): Promise<SupportMessage>;
|
|
51
|
+
export declare function updateSupportTicket(options: UpdateSupportTicketOptions): Promise<SupportTicket>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.resumeSupportOperation = resumeSupportOperation;
|
|
4
|
+
exports.createSupportTicket = createSupportTicket;
|
|
5
|
+
exports.addSupportMessage = addSupportMessage;
|
|
6
|
+
exports.updateSupportTicket = updateSupportTicket;
|
|
7
|
+
const interface_api_1 = require("@antelopejs/interface-api");
|
|
8
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
9
|
+
const interface_file_storage_1 = require("@antelopejs/interface-file-storage");
|
|
10
|
+
const admissions_1 = require("./admissions");
|
|
11
|
+
const operations_1 = require("./operations");
|
|
12
|
+
const plans_1 = require("./plans");
|
|
13
|
+
const publications_1 = require("./publications");
|
|
14
|
+
const validation_1 = require("./validation");
|
|
15
|
+
const HTTP_CONFLICT = 409;
|
|
16
|
+
const HTTP_BAD_REQUEST = 400;
|
|
17
|
+
const HTTP_UNAVAILABLE = 503;
|
|
18
|
+
async function prepareOperation(request) {
|
|
19
|
+
(0, validation_1.assertSupportRequestId)(request.requestId);
|
|
20
|
+
const id = (0, operations_1.supportOperationId)(request.tenantId, request.actorId, request.requestId);
|
|
21
|
+
const fingerprint = (0, operations_1.supportRequestFingerprint)([request.kind, request.intent]);
|
|
22
|
+
const operations = new operations_1.SupportOperationModel(request.models.tickets.database);
|
|
23
|
+
const existing = await operations.get(id);
|
|
24
|
+
if (existing) {
|
|
25
|
+
(0, interface_api_util_1.assert)(existing.fingerprint === fingerprint, HTTP_CONFLICT, "saas.errors.support.request_reused");
|
|
26
|
+
return existing;
|
|
27
|
+
}
|
|
28
|
+
const publication = await request.plan(id);
|
|
29
|
+
if (publication.message)
|
|
30
|
+
publication.message.attachments =
|
|
31
|
+
publication.stagedKeys.map(interface_file_storage_1.stripStagingPrefix);
|
|
32
|
+
return operations.prepare({
|
|
33
|
+
_id: id,
|
|
34
|
+
revision: `${id}:prepared`,
|
|
35
|
+
status: "prepared",
|
|
36
|
+
kind: request.kind,
|
|
37
|
+
fingerprint,
|
|
38
|
+
payload: JSON.stringify(publication),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function isTerminalPreparationError(error) {
|
|
42
|
+
if (error instanceof interface_api_1.HTTPResult)
|
|
43
|
+
return (error.getStatus() === HTTP_BAD_REQUEST ||
|
|
44
|
+
error.getStatus() === HTTP_CONFLICT);
|
|
45
|
+
return (error instanceof interface_file_storage_1.FileNotFoundError || error instanceof interface_file_storage_1.FileConflictError);
|
|
46
|
+
}
|
|
47
|
+
async function recoverPreparationFailure(operations, operation, error) {
|
|
48
|
+
if (isTerminalPreparationError(error)) {
|
|
49
|
+
const failure = error instanceof interface_api_1.HTTPResult && typeof error.getBody() === "string"
|
|
50
|
+
? { status: error.getStatus(), code: String(error.getBody()) }
|
|
51
|
+
: {
|
|
52
|
+
status: HTTP_CONFLICT,
|
|
53
|
+
code: "saas.errors.support.invalid_attachments",
|
|
54
|
+
};
|
|
55
|
+
await operations
|
|
56
|
+
.finish(operation, "rejected", failure)
|
|
57
|
+
.catch(() => undefined);
|
|
58
|
+
}
|
|
59
|
+
const current = await operations.get(operation._id);
|
|
60
|
+
if (current?.status === "rejected")
|
|
61
|
+
await (0, admissions_1.cancelSupportAttachments)(current);
|
|
62
|
+
if (!current || current.status === "prepared")
|
|
63
|
+
throw error;
|
|
64
|
+
return current;
|
|
65
|
+
}
|
|
66
|
+
async function readyOperation(tenantId, models, operation) {
|
|
67
|
+
const operations = new operations_1.SupportOperationModel(models.tickets.database);
|
|
68
|
+
if (operation.status !== "prepared")
|
|
69
|
+
return operation;
|
|
70
|
+
try {
|
|
71
|
+
await (0, admissions_1.prepareSupportAttachments)(operations, operation, tenantId);
|
|
72
|
+
await operations.finish(operation, "ready");
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
return recoverPreparationFailure(operations, operation, error);
|
|
76
|
+
}
|
|
77
|
+
const current = await operations.get(operation._id);
|
|
78
|
+
(0, interface_api_util_1.assert)(current, HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
79
|
+
return current;
|
|
80
|
+
}
|
|
81
|
+
async function runSupportOperation(request) {
|
|
82
|
+
const prepared = await prepareOperation(request);
|
|
83
|
+
const result = await resumeSupportOperation(request.tenantId, request.models, prepared);
|
|
84
|
+
return (0, publications_1.committedSupportPublication)(result);
|
|
85
|
+
}
|
|
86
|
+
async function resumeSupportOperation(tenantId, models, operation) {
|
|
87
|
+
const ready = await readyOperation(tenantId, models, operation);
|
|
88
|
+
const result = await (0, publications_1.publishSupportOperation)(models, ready);
|
|
89
|
+
if (result.status === "rejected")
|
|
90
|
+
await (0, admissions_1.cancelSupportAttachments)(result);
|
|
91
|
+
return result;
|
|
92
|
+
}
|
|
93
|
+
function ticketResult(publication) {
|
|
94
|
+
if (publication.unchanged)
|
|
95
|
+
return publication.ticket;
|
|
96
|
+
publication.ticket.publicationId = null;
|
|
97
|
+
publication.ticket.mutationId = `${publication.ticket.mutationId}:settled`;
|
|
98
|
+
return publication.ticket;
|
|
99
|
+
}
|
|
100
|
+
async function createSupportTicket(options) {
|
|
101
|
+
const publication = await runSupportOperation({
|
|
102
|
+
tenantId: options.tenant._id,
|
|
103
|
+
actorId: options.authorId,
|
|
104
|
+
requestId: options.requestId,
|
|
105
|
+
kind: "create",
|
|
106
|
+
intent: options.input,
|
|
107
|
+
models: options.models,
|
|
108
|
+
plan: async (id) => {
|
|
109
|
+
await options.validateNewRequest?.();
|
|
110
|
+
return (0, plans_1.createSupportPlan)(options, id);
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
return ticketResult(publication);
|
|
114
|
+
}
|
|
115
|
+
async function addSupportMessage(options) {
|
|
116
|
+
const publication = await runSupportOperation({
|
|
117
|
+
tenantId: options.tenantId,
|
|
118
|
+
actorId: options.authorId,
|
|
119
|
+
requestId: options.requestId,
|
|
120
|
+
kind: "reply",
|
|
121
|
+
intent: [options.ticketId, options.authorType, options.input],
|
|
122
|
+
models: options.models,
|
|
123
|
+
plan: async (id) => (0, plans_1.replySupportPlan)(options, await (0, publications_1.readSupportTicket)(options.models, options.ticketId), id),
|
|
124
|
+
});
|
|
125
|
+
(0, interface_api_util_1.assert)(publication.message, HTTP_UNAVAILABLE, "saas.errors.support.operation_pending");
|
|
126
|
+
return publication.message;
|
|
127
|
+
}
|
|
128
|
+
async function updateSupportTicket(options) {
|
|
129
|
+
const publication = await runSupportOperation({
|
|
130
|
+
tenantId: options.tenantId,
|
|
131
|
+
actorId: options.actorId,
|
|
132
|
+
requestId: options.requestId,
|
|
133
|
+
kind: "update",
|
|
134
|
+
intent: [options.ticketId, options.input],
|
|
135
|
+
models: options.models,
|
|
136
|
+
plan: async (id) => {
|
|
137
|
+
await options.validateNewRequest?.();
|
|
138
|
+
return (0, plans_1.updateSupportPlan)(options, await (0, publications_1.readSupportTicket)(options.models, options.ticketId), id);
|
|
139
|
+
},
|
|
140
|
+
});
|
|
141
|
+
return ticketResult(publication);
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/support/service.ts"],"names":[],"mappings":";;AA+MA,wDASC;AAUD,kDAgBC;AAGD,8CAuBC;AAGD,kDAoBC;AAnSD,6DAAuD;AACvD,uEAAwD;AACxD,+EAI4C;AAW5C,6CAGsB;AACtB,6CAOsB;AACtB,mCAIiB;AACjB,iDAIwB;AACxB,6CAIsB;AAEtB,MAAM,aAAa,GAAG,GAAG,CAAC;AAC1B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,gBAAgB,GAAG,GAAG,CAAC;AA6D7B,KAAK,UAAU,gBAAgB,CAC7B,OAAyB;IAEzB,IAAA,mCAAsB,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAC1C,MAAM,EAAE,GAAG,IAAA,+BAAkB,EAC3B,OAAO,CAAC,QAAQ,EAChB,OAAO,CAAC,OAAO,EACf,OAAO,CAAC,SAAS,CAClB,CAAC;IACF,MAAM,WAAW,GAAG,IAAA,sCAAyB,EAAC,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9E,MAAM,UAAU,GAAG,IAAI,kCAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC9E,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1C,IAAI,QAAQ,EAAE,CAAC;QACb,IAAA,2BAAM,EACJ,QAAQ,CAAC,WAAW,KAAK,WAAW,EACpC,aAAa,EACb,oCAAoC,CACrC,CAAC;QACF,OAAO,QAAQ,CAAC;IAClB,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,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;KACF,CAAC,CAAC;IACH,OAAO,YAAY,CAAC,WAAW,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { SupportTicketStatus } from "../db";
|
|
2
|
+
export declare function assertSupportStatusTransition(current: SupportTicketStatus, next: SupportTicketStatus): void;
|
|
3
|
+
export declare function statusAfterTenantMessage(current: SupportTicketStatus): SupportTicketStatus;
|
|
4
|
+
export declare function statusAfterPlatformReply(current: SupportTicketStatus): SupportTicketStatus;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.assertSupportStatusTransition = assertSupportStatusTransition;
|
|
4
|
+
exports.statusAfterTenantMessage = statusAfterTenantMessage;
|
|
5
|
+
exports.statusAfterPlatformReply = statusAfterPlatformReply;
|
|
6
|
+
const interface_api_util_1 = require("@antelopejs/interface-api-util");
|
|
7
|
+
const HTTP_BAD_REQUEST = 400;
|
|
8
|
+
const STATUS_TRANSITIONS = {
|
|
9
|
+
open: ["in_progress", "resolved", "closed"],
|
|
10
|
+
in_progress: ["waiting_customer", "resolved", "closed"],
|
|
11
|
+
waiting_customer: ["in_progress", "resolved", "closed"],
|
|
12
|
+
resolved: ["open", "closed"],
|
|
13
|
+
closed: ["open"],
|
|
14
|
+
};
|
|
15
|
+
function assertSupportStatusTransition(current, next) {
|
|
16
|
+
if (current === next)
|
|
17
|
+
return;
|
|
18
|
+
(0, interface_api_util_1.assert)(STATUS_TRANSITIONS[current].includes(next), HTTP_BAD_REQUEST, "saas.errors.support.invalid_status_transition");
|
|
19
|
+
}
|
|
20
|
+
function statusAfterTenantMessage(current) {
|
|
21
|
+
if (current === "waiting_customer")
|
|
22
|
+
return "in_progress";
|
|
23
|
+
return current === "resolved" || current === "closed" ? "open" : current;
|
|
24
|
+
}
|
|
25
|
+
function statusAfterPlatformReply(current) {
|
|
26
|
+
(0, interface_api_util_1.assert)(current !== "closed", HTTP_BAD_REQUEST, "saas.errors.support.closed_ticket_reply");
|
|
27
|
+
return "waiting_customer";
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=transitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transitions.js","sourceRoot":"","sources":["../../src/support/transitions.ts"],"names":[],"mappings":";;AAaA,sEAUC;AAED,4DAKC;AAED,4DASC;AAzCD,uEAAwD;AAGxD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAE7B,MAAM,kBAAkB,GAAuD;IAC7E,IAAI,EAAE,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC;IAC3C,WAAW,EAAE,CAAC,kBAAkB,EAAE,UAAU,EAAE,QAAQ,CAAC;IACvD,gBAAgB,EAAE,CAAC,aAAa,EAAE,UAAU,EAAE,QAAQ,CAAC;IACvD,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,CAAC;IAC5B,MAAM,EAAE,CAAC,MAAM,CAAC;CACjB,CAAC;AAEF,SAAgB,6BAA6B,CAC3C,OAA4B,EAC5B,IAAyB;IAEzB,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO;IAC7B,IAAA,2BAAM,EACJ,kBAAkB,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC1C,gBAAgB,EAChB,+CAA+C,CAChD,CAAC;AACJ,CAAC;AAED,SAAgB,wBAAwB,CACtC,OAA4B;IAE5B,IAAI,OAAO,KAAK,kBAAkB;QAAE,OAAO,aAAa,CAAC;IACzD,OAAO,OAAO,KAAK,UAAU,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC;AAC3E,CAAC;AAED,SAAgB,wBAAwB,CACtC,OAA4B;IAE5B,IAAA,2BAAM,EACJ,OAAO,KAAK,QAAQ,EACpB,gBAAgB,EAChB,yCAAyC,CAC1C,CAAC;IACF,OAAO,kBAAkB,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Table } from "@antelopejs/interface-database-decorators";
|
|
2
|
+
import { type PresignedUploadResponse } from "@antelopejs/interface-file-storage";
|
|
3
|
+
export interface SupportUploadInput {
|
|
4
|
+
filename: string;
|
|
5
|
+
size: number;
|
|
6
|
+
mimetype: string;
|
|
7
|
+
}
|
|
8
|
+
export declare class SupportUpload extends Table {
|
|
9
|
+
_id: string;
|
|
10
|
+
stagedKey: string;
|
|
11
|
+
storage: string;
|
|
12
|
+
tenantId: string;
|
|
13
|
+
}
|
|
14
|
+
declare const SupportUploadModel_base: {
|
|
15
|
+
new (database: import("@antelopejs/interface-database").SchemaInstance<any>): {
|
|
16
|
+
readonly table: import("@antelopejs/interface-database").Table<SupportUpload>;
|
|
17
|
+
readonly database: import("@antelopejs/interface-database").SchemaInstance<any>;
|
|
18
|
+
get(id: string): PromiseLike<SupportUpload | undefined>;
|
|
19
|
+
getBy(index: keyof SupportUpload, ...keys: any[]): PromiseLike<SupportUpload[]>;
|
|
20
|
+
getAll(): PromiseLike<SupportUpload[]>;
|
|
21
|
+
insert(obj: import("@antelopejs/interface-database-decorators").DeepPartial<SupportUpload> | import("@antelopejs/interface-database-decorators").DeepPartial<SupportUpload>[], options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<string[]>;
|
|
22
|
+
update(id: string, obj: import("@antelopejs/interface-database-decorators").DeepPartial<SupportUpload>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
23
|
+
update(obj: import("@antelopejs/interface-database-decorators").DeepPartial<SupportUpload>, options?: import("@antelopejs/interface-database-decorators").ValidateOptions): Promise<number>;
|
|
24
|
+
delete(id: string): Promise<number>;
|
|
25
|
+
};
|
|
26
|
+
readonly schemaName: string;
|
|
27
|
+
fromPlainData(obj: any): SupportUpload;
|
|
28
|
+
fromDatabase(obj: any): SupportUpload | undefined;
|
|
29
|
+
toDatabase(obj: any): Record<string, any>;
|
|
30
|
+
validate(obj: unknown, options?: import("@antelopejs/interface-database-decorators").ValidateInputOptions): import("@antelopejs/interface-database-decorators").ValidationResult;
|
|
31
|
+
};
|
|
32
|
+
export declare class SupportUploadModel extends SupportUploadModel_base {
|
|
33
|
+
record(candidate: SupportUpload): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
export declare function supportUploadId(storage: string, stagedKey: string): string;
|
|
36
|
+
export declare function parseSupportUpload(body: unknown): SupportUploadInput;
|
|
37
|
+
export declare function createSupportUpload(tenantId: string, input: SupportUploadInput): Promise<PresignedUploadResponse>;
|
|
38
|
+
export declare function getSupportUpload(tenantId: string, stagedKey: string): Promise<SupportUpload>;
|
|
39
|
+
export {};
|