@kelpie/server 0.8.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/ids.d.ts +11 -0
- package/dist/lib/ids.d.ts.map +1 -1
- package/dist/lib/ids.js +11 -0
- package/dist/lib/ids.js.map +1 -1
- package/dist/modules/activities/repository.d.ts.map +1 -1
- package/dist/modules/activities/repository.js +19 -20
- package/dist/modules/activities/repository.js.map +1 -1
- package/dist/modules/activities/wording.d.ts +12 -0
- package/dist/modules/activities/wording.d.ts.map +1 -1
- package/dist/modules/activities/wording.js +16 -0
- package/dist/modules/activities/wording.js.map +1 -1
- package/dist/modules/agent-tasks/catalog.d.ts.map +1 -1
- package/dist/modules/agent-tasks/catalog.js +62 -0
- package/dist/modules/agent-tasks/catalog.js.map +1 -1
- package/dist/modules/agent-tasks/resolve.d.ts.map +1 -1
- package/dist/modules/agent-tasks/resolve.js +42 -9
- package/dist/modules/agent-tasks/resolve.js.map +1 -1
- package/dist/modules/agent-tasks/routes.d.ts +2 -0
- package/dist/modules/agent-tasks/routes.d.ts.map +1 -1
- package/dist/modules/attachedRecords.d.ts +6 -1
- package/dist/modules/attachedRecords.d.ts.map +1 -1
- package/dist/modules/attachedRecords.js +15 -1
- package/dist/modules/attachedRecords.js.map +1 -1
- package/dist/modules/companies/index.d.ts.map +1 -1
- package/dist/modules/companies/index.js +3 -1
- package/dist/modules/companies/index.js.map +1 -1
- package/dist/modules/companies/routes.d.ts +14 -0
- package/dist/modules/companies/routes.d.ts.map +1 -1
- package/dist/modules/companies/routes.js +7 -0
- package/dist/modules/companies/routes.js.map +1 -1
- package/dist/modules/companies/schema.d.ts +20 -0
- package/dist/modules/companies/schema.d.ts.map +1 -1
- package/dist/modules/companies/schema.js +6 -1
- package/dist/modules/companies/schema.js.map +1 -1
- package/dist/modules/companies/service.d.ts +5 -0
- package/dist/modules/companies/service.d.ts.map +1 -1
- package/dist/modules/companies/service.js +24 -12
- package/dist/modules/companies/service.js.map +1 -1
- package/dist/modules/consent-purposes/capabilities.d.ts +7 -0
- package/dist/modules/consent-purposes/capabilities.d.ts.map +1 -0
- package/dist/modules/consent-purposes/capabilities.js +10 -0
- package/dist/modules/consent-purposes/capabilities.js.map +1 -0
- package/dist/modules/consent-purposes/events.d.ts +38 -0
- package/dist/modules/consent-purposes/events.d.ts.map +1 -0
- package/dist/modules/consent-purposes/events.js +17 -0
- package/dist/modules/consent-purposes/events.js.map +1 -0
- package/dist/modules/consent-purposes/index.d.ts +13 -0
- package/dist/modules/consent-purposes/index.d.ts.map +1 -0
- package/dist/modules/consent-purposes/index.js +41 -0
- package/dist/modules/consent-purposes/index.js.map +1 -0
- package/dist/modules/consent-purposes/repository.d.ts +21 -0
- package/dist/modules/consent-purposes/repository.d.ts.map +1 -0
- package/dist/modules/consent-purposes/repository.js +98 -0
- package/dist/modules/consent-purposes/repository.js.map +1 -0
- package/dist/modules/consent-purposes/routes.d.ts +39 -0
- package/dist/modules/consent-purposes/routes.d.ts.map +1 -0
- package/dist/modules/consent-purposes/routes.js +79 -0
- package/dist/modules/consent-purposes/routes.js.map +1 -0
- package/dist/modules/consent-purposes/schema.d.ts +175 -0
- package/dist/modules/consent-purposes/schema.d.ts.map +1 -0
- package/dist/modules/consent-purposes/schema.js +35 -0
- package/dist/modules/consent-purposes/schema.js.map +1 -0
- package/dist/modules/consent-purposes/service.d.ts +50 -0
- package/dist/modules/consent-purposes/service.d.ts.map +1 -0
- package/dist/modules/consent-purposes/service.js +263 -0
- package/dist/modules/consent-purposes/service.js.map +1 -0
- package/dist/modules/consent-purposes/starters.d.ts +17 -0
- package/dist/modules/consent-purposes/starters.d.ts.map +1 -0
- package/dist/modules/consent-purposes/starters.js +15 -0
- package/dist/modules/consent-purposes/starters.js.map +1 -0
- package/dist/modules/consent-purposes/tools.d.ts +4 -0
- package/dist/modules/consent-purposes/tools.d.ts.map +1 -0
- package/dist/modules/consent-purposes/tools.js +29 -0
- package/dist/modules/consent-purposes/tools.js.map +1 -0
- package/dist/modules/core.d.ts.map +1 -1
- package/dist/modules/core.js +10 -0
- package/dist/modules/core.js.map +1 -1
- package/dist/modules/custom-fields/capabilities.d.ts +12 -0
- package/dist/modules/custom-fields/capabilities.d.ts.map +1 -0
- package/dist/modules/custom-fields/capabilities.js +15 -0
- package/dist/modules/custom-fields/capabilities.js.map +1 -0
- package/dist/modules/custom-fields/events.d.ts +49 -0
- package/dist/modules/custom-fields/events.d.ts.map +1 -0
- package/dist/modules/custom-fields/events.js +25 -0
- package/dist/modules/custom-fields/events.js.map +1 -0
- package/dist/modules/custom-fields/index.d.ts +19 -0
- package/dist/modules/custom-fields/index.d.ts.map +1 -0
- package/dist/modules/custom-fields/index.js +46 -0
- package/dist/modules/custom-fields/index.js.map +1 -0
- package/dist/modules/custom-fields/repository.d.ts +37 -0
- package/dist/modules/custom-fields/repository.d.ts.map +1 -0
- package/dist/modules/custom-fields/repository.js +144 -0
- package/dist/modules/custom-fields/repository.js.map +1 -0
- package/dist/modules/custom-fields/routes.d.ts +44 -0
- package/dist/modules/custom-fields/routes.d.ts.map +1 -0
- package/dist/modules/custom-fields/routes.js +103 -0
- package/dist/modules/custom-fields/routes.js.map +1 -0
- package/dist/modules/custom-fields/schema.d.ts +215 -0
- package/dist/modules/custom-fields/schema.d.ts.map +1 -0
- package/dist/modules/custom-fields/schema.js +43 -0
- package/dist/modules/custom-fields/schema.js.map +1 -0
- package/dist/modules/custom-fields/service.d.ts +57 -0
- package/dist/modules/custom-fields/service.d.ts.map +1 -0
- package/dist/modules/custom-fields/service.js +273 -0
- package/dist/modules/custom-fields/service.js.map +1 -0
- package/dist/modules/custom-fields/tools.d.ts +4 -0
- package/dist/modules/custom-fields/tools.d.ts.map +1 -0
- package/dist/modules/custom-fields/tools.js +38 -0
- package/dist/modules/custom-fields/tools.js.map +1 -0
- package/dist/modules/custom-fields/values.d.ts +49 -0
- package/dist/modules/custom-fields/values.d.ts.map +1 -0
- package/dist/modules/custom-fields/values.js +249 -0
- package/dist/modules/custom-fields/values.js.map +1 -0
- package/dist/modules/custom-fields/wire.d.ts +12 -0
- package/dist/modules/custom-fields/wire.d.ts.map +1 -0
- package/dist/modules/custom-fields/wire.js +30 -0
- package/dist/modules/custom-fields/wire.js.map +1 -0
- package/dist/modules/dashboard/repository.d.ts.map +1 -1
- package/dist/modules/dashboard/repository.js +4 -3
- package/dist/modules/dashboard/repository.js.map +1 -1
- package/dist/modules/deals/index.d.ts +2 -1
- package/dist/modules/deals/index.d.ts.map +1 -1
- package/dist/modules/deals/index.js +5 -2
- package/dist/modules/deals/index.js.map +1 -1
- package/dist/modules/deals/repository.d.ts +0 -16
- package/dist/modules/deals/repository.d.ts.map +1 -1
- package/dist/modules/deals/repository.js +6 -76
- package/dist/modules/deals/repository.js.map +1 -1
- package/dist/modules/deals/routes.d.ts +14 -0
- package/dist/modules/deals/routes.d.ts.map +1 -1
- package/dist/modules/deals/routes.js +7 -0
- package/dist/modules/deals/routes.js.map +1 -1
- package/dist/modules/deals/schema.d.ts +20 -42
- package/dist/modules/deals/schema.d.ts.map +1 -1
- package/dist/modules/deals/schema.js +6 -11
- package/dist/modules/deals/schema.js.map +1 -1
- package/dist/modules/deals/service.d.ts +13 -2
- package/dist/modules/deals/service.d.ts.map +1 -1
- package/dist/modules/deals/service.js +43 -20
- package/dist/modules/deals/service.js.map +1 -1
- package/dist/modules/decisions/repository.d.ts.map +1 -1
- package/dist/modules/decisions/repository.js +2 -0
- package/dist/modules/decisions/repository.js.map +1 -1
- package/dist/modules/decisions/routes.d.ts +1 -0
- package/dist/modules/decisions/routes.d.ts.map +1 -1
- package/dist/modules/enquiries/events.d.ts +44 -0
- package/dist/modules/enquiries/events.d.ts.map +1 -0
- package/dist/modules/enquiries/events.js +19 -0
- package/dist/modules/enquiries/events.js.map +1 -0
- package/dist/modules/enquiries/index.d.ts +13 -0
- package/dist/modules/enquiries/index.d.ts.map +1 -0
- package/dist/modules/enquiries/index.js +44 -0
- package/dist/modules/enquiries/index.js.map +1 -0
- package/dist/modules/enquiries/repository.d.ts +30 -0
- package/dist/modules/enquiries/repository.d.ts.map +1 -0
- package/dist/modules/enquiries/repository.js +94 -0
- package/dist/modules/enquiries/repository.js.map +1 -0
- package/dist/modules/enquiries/routes.d.ts +52 -0
- package/dist/modules/enquiries/routes.d.ts.map +1 -0
- package/dist/modules/enquiries/routes.js +127 -0
- package/dist/modules/enquiries/routes.js.map +1 -0
- package/dist/modules/enquiries/schema.d.ts +290 -0
- package/dist/modules/enquiries/schema.d.ts.map +1 -0
- package/dist/modules/enquiries/schema.js +52 -0
- package/dist/modules/enquiries/schema.js.map +1 -0
- package/dist/modules/enquiries/service.d.ts +85 -0
- package/dist/modules/enquiries/service.d.ts.map +1 -0
- package/dist/modules/enquiries/service.js +370 -0
- package/dist/modules/enquiries/service.js.map +1 -0
- package/dist/modules/enquiries/tools.d.ts +4 -0
- package/dist/modules/enquiries/tools.d.ts.map +1 -0
- package/dist/modules/enquiries/tools.js +50 -0
- package/dist/modules/enquiries/tools.js.map +1 -0
- package/dist/modules/eventCatalogs.d.ts +3 -0
- package/dist/modules/eventCatalogs.d.ts.map +1 -1
- package/dist/modules/eventCatalogs.js +3 -0
- package/dist/modules/eventCatalogs.js.map +1 -1
- package/dist/modules/forms/embed.d.ts +20 -6
- package/dist/modules/forms/embed.d.ts.map +1 -1
- package/dist/modules/forms/embed.js +359 -43
- package/dist/modules/forms/embed.js.map +1 -1
- package/dist/modules/forms/events.d.ts +20 -7
- package/dist/modules/forms/events.d.ts.map +1 -1
- package/dist/modules/forms/events.js +20 -2
- package/dist/modules/forms/events.js.map +1 -1
- package/dist/modules/forms/fields.d.ts +14 -1
- package/dist/modules/forms/fields.d.ts.map +1 -1
- package/dist/modules/forms/fields.js +87 -3
- package/dist/modules/forms/fields.js.map +1 -1
- package/dist/modules/forms/index.d.ts.map +1 -1
- package/dist/modules/forms/index.js +12 -1
- package/dist/modules/forms/index.js.map +1 -1
- package/dist/modules/forms/mapping.d.ts +62 -5
- package/dist/modules/forms/mapping.d.ts.map +1 -1
- package/dist/modules/forms/mapping.js +139 -5
- package/dist/modules/forms/mapping.js.map +1 -1
- package/dist/modules/forms/publicRoutes.d.ts.map +1 -1
- package/dist/modules/forms/publicRoutes.js +29 -1
- package/dist/modules/forms/publicRoutes.js.map +1 -1
- package/dist/modules/forms/repository.d.ts +31 -0
- package/dist/modules/forms/repository.d.ts.map +1 -1
- package/dist/modules/forms/repository.js +90 -1
- package/dist/modules/forms/repository.js.map +1 -1
- package/dist/modules/forms/routes.d.ts +83 -1
- package/dist/modules/forms/routes.d.ts.map +1 -1
- package/dist/modules/forms/routes.js +185 -2
- package/dist/modules/forms/routes.js.map +1 -1
- package/dist/modules/forms/schema.d.ts +672 -1
- package/dist/modules/forms/schema.d.ts.map +1 -1
- package/dist/modules/forms/schema.js +146 -3
- package/dist/modules/forms/schema.js.map +1 -1
- package/dist/modules/forms/service.d.ts +54 -1
- package/dist/modules/forms/service.d.ts.map +1 -1
- package/dist/modules/forms/service.js +338 -28
- package/dist/modules/forms/service.js.map +1 -1
- package/dist/modules/forms/submission.d.ts +15 -0
- package/dist/modules/forms/submission.d.ts.map +1 -1
- package/dist/modules/forms/submission.js +418 -40
- package/dist/modules/forms/submission.js.map +1 -1
- package/dist/modules/import-export/drafts.d.ts +10 -0
- package/dist/modules/import-export/drafts.d.ts.map +1 -1
- package/dist/modules/import-export/drafts.js +16 -2
- package/dist/modules/import-export/drafts.js.map +1 -1
- package/dist/modules/import-export/exportRows.d.ts +7 -4
- package/dist/modules/import-export/exportRows.d.ts.map +1 -1
- package/dist/modules/import-export/exportRows.js +20 -5
- package/dist/modules/import-export/exportRows.js.map +1 -1
- package/dist/modules/import-export/plan.d.ts +12 -1
- package/dist/modules/import-export/plan.d.ts.map +1 -1
- package/dist/modules/import-export/plan.js +29 -2
- package/dist/modules/import-export/plan.js.map +1 -1
- package/dist/modules/import-export/presets.d.ts.map +1 -1
- package/dist/modules/import-export/presets.js +10 -0
- package/dist/modules/import-export/presets.js.map +1 -1
- package/dist/modules/import-export/repository.d.ts +11 -1
- package/dist/modules/import-export/repository.d.ts.map +1 -1
- package/dist/modules/import-export/repository.js +42 -9
- package/dist/modules/import-export/repository.js.map +1 -1
- package/dist/modules/import-export/routes.d.ts.map +1 -1
- package/dist/modules/import-export/routes.js +4 -0
- package/dist/modules/import-export/routes.js.map +1 -1
- package/dist/modules/import-export/schema.d.ts +17 -0
- package/dist/modules/import-export/schema.d.ts.map +1 -1
- package/dist/modules/import-export/schema.js +11 -0
- package/dist/modules/import-export/schema.js.map +1 -1
- package/dist/modules/import-export/service.d.ts +6 -0
- package/dist/modules/import-export/service.d.ts.map +1 -1
- package/dist/modules/import-export/service.js +14 -2
- package/dist/modules/import-export/service.js.map +1 -1
- package/dist/modules/import-export/streams.d.ts.map +1 -1
- package/dist/modules/import-export/streams.js +3 -3
- package/dist/modules/import-export/streams.js.map +1 -1
- package/dist/modules/import-export/tools.d.ts.map +1 -1
- package/dist/modules/import-export/tools.js +8 -0
- package/dist/modules/import-export/tools.js.map +1 -1
- package/dist/modules/import-export/validation.d.ts.map +1 -1
- package/dist/modules/import-export/validation.js +22 -1
- package/dist/modules/import-export/validation.js.map +1 -1
- package/dist/modules/import-export/writes.d.ts.map +1 -1
- package/dist/modules/import-export/writes.js +37 -4
- package/dist/modules/import-export/writes.js.map +1 -1
- package/dist/modules/lists/index.d.ts +38 -0
- package/dist/modules/lists/index.d.ts.map +1 -1
- package/dist/modules/lists/index.js +27 -0
- package/dist/modules/lists/index.js.map +1 -1
- package/dist/modules/lists/repository.d.ts +26 -0
- package/dist/modules/lists/repository.d.ts.map +1 -1
- package/dist/modules/lists/repository.js +32 -0
- package/dist/modules/lists/repository.js.map +1 -1
- package/dist/modules/lists/routes.d.ts +4 -0
- package/dist/modules/lists/routes.d.ts.map +1 -1
- package/dist/modules/lists/routes.js +8 -0
- package/dist/modules/lists/routes.js.map +1 -1
- package/dist/modules/lists/schema.d.ts +17 -0
- package/dist/modules/lists/schema.d.ts.map +1 -1
- package/dist/modules/lists/schema.js +10 -0
- package/dist/modules/lists/schema.js.map +1 -1
- package/dist/modules/lists/service.d.ts +14 -2
- package/dist/modules/lists/service.d.ts.map +1 -1
- package/dist/modules/lists/service.js +55 -7
- package/dist/modules/lists/service.js.map +1 -1
- package/dist/modules/mcp/index.d.ts.map +1 -1
- package/dist/modules/mcp/index.js +5 -0
- package/dist/modules/mcp/index.js.map +1 -1
- package/dist/modules/notes/routes.d.ts +1 -0
- package/dist/modules/notes/routes.d.ts.map +1 -1
- package/dist/modules/opportunities/index.d.ts.map +1 -1
- package/dist/modules/opportunities/index.js +3 -1
- package/dist/modules/opportunities/index.js.map +1 -1
- package/dist/modules/opportunities/repository.d.ts +2 -0
- package/dist/modules/opportunities/repository.d.ts.map +1 -1
- package/dist/modules/opportunities/repository.js +4 -0
- package/dist/modules/opportunities/repository.js.map +1 -1
- package/dist/modules/opportunities/routes.d.ts +16 -0
- package/dist/modules/opportunities/routes.d.ts.map +1 -1
- package/dist/modules/opportunities/routes.js +13 -0
- package/dist/modules/opportunities/routes.js.map +1 -1
- package/dist/modules/opportunities/schema.d.ts +20 -0
- package/dist/modules/opportunities/schema.d.ts.map +1 -1
- package/dist/modules/opportunities/schema.js +6 -1
- package/dist/modules/opportunities/schema.js.map +1 -1
- package/dist/modules/opportunities/service.d.ts +20 -3
- package/dist/modules/opportunities/service.d.ts.map +1 -1
- package/dist/modules/opportunities/service.js +99 -18
- package/dist/modules/opportunities/service.js.map +1 -1
- package/dist/modules/opportunities/tools.d.ts.map +1 -1
- package/dist/modules/opportunities/tools.js +2 -0
- package/dist/modules/opportunities/tools.js.map +1 -1
- package/dist/modules/partnerships/index.d.ts.map +1 -1
- package/dist/modules/partnerships/index.js +3 -1
- package/dist/modules/partnerships/index.js.map +1 -1
- package/dist/modules/partnerships/repository.d.ts +0 -17
- package/dist/modules/partnerships/repository.d.ts.map +1 -1
- package/dist/modules/partnerships/repository.js +6 -82
- package/dist/modules/partnerships/repository.js.map +1 -1
- package/dist/modules/partnerships/routes.d.ts +14 -0
- package/dist/modules/partnerships/routes.d.ts.map +1 -1
- package/dist/modules/partnerships/routes.js +7 -0
- package/dist/modules/partnerships/routes.js.map +1 -1
- package/dist/modules/partnerships/schema.d.ts +20 -41
- package/dist/modules/partnerships/schema.d.ts.map +1 -1
- package/dist/modules/partnerships/schema.js +6 -10
- package/dist/modules/partnerships/schema.js.map +1 -1
- package/dist/modules/partnerships/service.d.ts +11 -1
- package/dist/modules/partnerships/service.d.ts.map +1 -1
- package/dist/modules/partnerships/service.js +43 -20
- package/dist/modules/partnerships/service.js.map +1 -1
- package/dist/modules/people/consentHydration.d.ts +26 -0
- package/dist/modules/people/consentHydration.d.ts.map +1 -0
- package/dist/modules/people/consentHydration.js +100 -0
- package/dist/modules/people/consentHydration.js.map +1 -0
- package/dist/modules/people/index.d.ts.map +1 -1
- package/dist/modules/people/index.js +3 -1
- package/dist/modules/people/index.js.map +1 -1
- package/dist/modules/people/personConsentWrites.d.ts +40 -0
- package/dist/modules/people/personConsentWrites.d.ts.map +1 -0
- package/dist/modules/people/personConsentWrites.js +98 -0
- package/dist/modules/people/personConsentWrites.js.map +1 -0
- package/dist/modules/people/repository.d.ts.map +1 -1
- package/dist/modules/people/repository.js +5 -1
- package/dist/modules/people/repository.js.map +1 -1
- package/dist/modules/people/routes.d.ts +57 -4
- package/dist/modules/people/routes.d.ts.map +1 -1
- package/dist/modules/people/routes.js +104 -5
- package/dist/modules/people/routes.js.map +1 -1
- package/dist/modules/people/schema.d.ts +366 -1
- package/dist/modules/people/schema.d.ts.map +1 -1
- package/dist/modules/people/schema.js +92 -2
- package/dist/modules/people/schema.js.map +1 -1
- package/dist/modules/people/service.d.ts +30 -1
- package/dist/modules/people/service.d.ts.map +1 -1
- package/dist/modules/people/service.js +115 -38
- package/dist/modules/people/service.js.map +1 -1
- package/dist/modules/people/tools.d.ts.map +1 -1
- package/dist/modules/people/tools.js +4 -1
- package/dist/modules/people/tools.js.map +1 -1
- package/dist/modules/personLinks.d.ts +79 -0
- package/dist/modules/personLinks.d.ts.map +1 -0
- package/dist/modules/personLinks.js +155 -0
- package/dist/modules/personLinks.js.map +1 -0
- package/dist/modules/pipelines/routes.d.ts +1 -0
- package/dist/modules/pipelines/routes.d.ts.map +1 -1
- package/dist/modules/plans/routes.d.ts +1 -0
- package/dist/modules/plans/routes.d.ts.map +1 -1
- package/dist/modules/raises/index.d.ts.map +1 -1
- package/dist/modules/raises/index.js +3 -1
- package/dist/modules/raises/index.js.map +1 -1
- package/dist/modules/raises/repository.d.ts +0 -17
- package/dist/modules/raises/repository.d.ts.map +1 -1
- package/dist/modules/raises/repository.js +6 -77
- package/dist/modules/raises/repository.js.map +1 -1
- package/dist/modules/raises/routes.d.ts +14 -0
- package/dist/modules/raises/routes.d.ts.map +1 -1
- package/dist/modules/raises/routes.js +7 -0
- package/dist/modules/raises/routes.js.map +1 -1
- package/dist/modules/raises/schema.d.ts +20 -41
- package/dist/modules/raises/schema.d.ts.map +1 -1
- package/dist/modules/raises/schema.js +6 -10
- package/dist/modules/raises/schema.js.map +1 -1
- package/dist/modules/raises/service.d.ts +11 -1
- package/dist/modules/raises/service.d.ts.map +1 -1
- package/dist/modules/raises/service.js +41 -18
- package/dist/modules/raises/service.js.map +1 -1
- package/dist/modules/recordTargets.d.ts.map +1 -1
- package/dist/modules/recordTargets.js +2 -0
- package/dist/modules/recordTargets.js.map +1 -1
- package/dist/modules/references.d.ts +10 -0
- package/dist/modules/references.d.ts.map +1 -1
- package/dist/modules/references.js +27 -4
- package/dist/modules/references.js.map +1 -1
- package/dist/modules/sample-data/fixture.d.ts +21 -0
- package/dist/modules/sample-data/fixture.d.ts.map +1 -1
- package/dist/modules/sample-data/fixture.js +40 -0
- package/dist/modules/sample-data/fixture.js.map +1 -1
- package/dist/modules/sample-data/index.d.ts.map +1 -1
- package/dist/modules/sample-data/index.js +1 -0
- package/dist/modules/sample-data/index.js.map +1 -1
- package/dist/modules/sample-data/routes.d.ts.map +1 -1
- package/dist/modules/sample-data/routes.js +1 -0
- package/dist/modules/sample-data/routes.js.map +1 -1
- package/dist/modules/sample-data/service.d.ts +1 -0
- package/dist/modules/sample-data/service.d.ts.map +1 -1
- package/dist/modules/sample-data/service.js +77 -8
- package/dist/modules/sample-data/service.js.map +1 -1
- package/dist/modules/search/index.d.ts +1 -1
- package/dist/modules/search/index.d.ts.map +1 -1
- package/dist/modules/search/index.js +2 -1
- package/dist/modules/search/index.js.map +1 -1
- package/dist/modules/search/repository.d.ts +1 -0
- package/dist/modules/search/repository.d.ts.map +1 -1
- package/dist/modules/search/repository.js +23 -0
- package/dist/modules/search/repository.js.map +1 -1
- package/dist/modules/search/service.d.ts +3 -3
- package/dist/modules/search/service.d.ts.map +1 -1
- package/dist/modules/search/service.js +5 -4
- package/dist/modules/search/service.js.map +1 -1
- package/dist/modules/stagedRecords.d.ts +3 -3
- package/dist/modules/stagedRecords.d.ts.map +1 -1
- package/dist/modules/stagedRecords.js +9 -0
- package/dist/modules/stagedRecords.js.map +1 -1
- package/dist/modules/webhooks/payloads.d.ts.map +1 -1
- package/dist/modules/webhooks/payloads.js +15 -2
- package/dist/modules/webhooks/payloads.js.map +1 -1
- package/dist/modules/workspace/repository.d.ts +2 -0
- package/dist/modules/workspace/repository.d.ts.map +1 -1
- package/dist/modules/workspace/repository.js +7 -0
- package/dist/modules/workspace/repository.js.map +1 -1
- package/dist/modules/workspace/service.d.ts.map +1 -1
- package/dist/modules/workspace/service.js +10 -0
- package/dist/modules/workspace/service.js.map +1 -1
- package/dist/modules/workspace/starters.d.ts.map +1 -1
- package/dist/modules/workspace/starters.js +5 -0
- package/dist/modules/workspace/starters.js.map +1 -1
- package/dist/runtime/events.d.ts +1 -1
- package/dist/runtime/events.d.ts.map +1 -1
- package/dist/runtime/events.js +1 -0
- package/dist/runtime/events.js.map +1 -1
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +3 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/testing/database.d.ts +5 -1
- package/dist/testing/database.d.ts.map +1 -1
- package/dist/testing/database.js +81 -10
- package/dist/testing/database.js.map +1 -1
- package/migrations/0024_third_king_cobra.sql +46 -0
- package/migrations/0025_worthless_chimera.sql +3 -0
- package/migrations/0026_late_aqueduct.sql +46 -0
- package/migrations/0027_brainy_silver_sable.sql +3 -0
- package/migrations/0028_freezing_scrambler.sql +19 -0
- package/migrations/0029_custom_fields.sql +26 -0
- package/migrations/0030_enquiries.sql +79 -0
- package/migrations/0031_consent.sql +45 -0
- package/migrations/0032_form_field_statement.sql +1 -0
- package/migrations/0033_form_field_consent_purpose_ids.sql +5 -0
- package/migrations/0034_drop_form_field_consent_purpose_id.sql +1 -0
- package/migrations/0035_form_field_consent_purpose_labels.sql +1 -0
- package/migrations/0036_form_field_notice_type.sql +2 -0
- package/migrations/meta/0024_snapshot.json +5516 -0
- package/migrations/meta/0025_snapshot.json +5336 -0
- package/migrations/meta/0026_snapshot.json +5710 -0
- package/migrations/meta/0027_snapshot.json +5716 -0
- package/migrations/meta/0028_snapshot.json +5740 -0
- package/migrations/meta/0029_snapshot.json +5935 -0
- package/migrations/meta/0030_snapshot.json +6245 -0
- package/migrations/meta/0031_snapshot.json +6572 -0
- package/migrations/meta/0032_snapshot.json +6578 -0
- package/migrations/meta/0033_snapshot.json +6572 -0
- package/migrations/meta/0034_snapshot.json +6566 -0
- package/migrations/meta/0035_snapshot.json +6573 -0
- package/migrations/meta/0036_snapshot.json +6573 -0
- package/migrations/meta/_journal.json +91 -0
- package/package.json +2 -2
- package/src/index.ts +6 -0
- package/src/lib/ids.ts +11 -0
- package/src/modules/activities/repository.ts +22 -23
- package/src/modules/activities/wording.ts +18 -0
- package/src/modules/agent-tasks/catalog.ts +63 -0
- package/src/modules/agent-tasks/resolve.ts +64 -24
- package/src/modules/attachedRecords.ts +29 -2
- package/src/modules/companies/index.ts +3 -1
- package/src/modules/companies/routes.ts +7 -0
- package/src/modules/companies/schema.ts +7 -1
- package/src/modules/companies/service.ts +48 -13
- package/src/modules/consent-purposes/capabilities.ts +12 -0
- package/src/modules/consent-purposes/events.ts +38 -0
- package/src/modules/consent-purposes/index.ts +48 -0
- package/src/modules/consent-purposes/repository.ts +163 -0
- package/src/modules/consent-purposes/routes.ts +122 -0
- package/src/modules/consent-purposes/schema.ts +46 -0
- package/src/modules/consent-purposes/service.ts +423 -0
- package/src/modules/consent-purposes/starters.ts +32 -0
- package/src/modules/consent-purposes/tools.ts +44 -0
- package/src/modules/core.ts +10 -0
- package/src/modules/custom-fields/capabilities.ts +17 -0
- package/src/modules/custom-fields/events.ts +51 -0
- package/src/modules/custom-fields/index.ts +61 -0
- package/src/modules/custom-fields/repository.ts +225 -0
- package/src/modules/custom-fields/routes.ts +155 -0
- package/src/modules/custom-fields/schema.ts +61 -0
- package/src/modules/custom-fields/service.ts +439 -0
- package/src/modules/custom-fields/tools.ts +53 -0
- package/src/modules/custom-fields/values.ts +352 -0
- package/src/modules/custom-fields/wire.ts +32 -0
- package/src/modules/dashboard/repository.ts +4 -3
- package/src/modules/deals/index.ts +5 -2
- package/src/modules/deals/repository.ts +6 -106
- package/src/modules/deals/routes.ts +7 -0
- package/src/modules/deals/schema.ts +7 -15
- package/src/modules/deals/service.ts +92 -23
- package/src/modules/decisions/repository.ts +2 -0
- package/src/modules/enquiries/events.ts +45 -0
- package/src/modules/enquiries/index.ts +50 -0
- package/src/modules/enquiries/repository.ts +164 -0
- package/src/modules/enquiries/routes.ts +172 -0
- package/src/modules/enquiries/schema.ts +59 -0
- package/src/modules/enquiries/service.ts +644 -0
- package/src/modules/enquiries/tools.ts +66 -0
- package/src/modules/eventCatalogs.ts +3 -0
- package/src/modules/forms/embed.ts +391 -44
- package/src/modules/forms/events.ts +30 -2
- package/src/modules/forms/fields.ts +102 -2
- package/src/modules/forms/index.ts +12 -1
- package/src/modules/forms/mapping.ts +183 -6
- package/src/modules/forms/publicRoutes.ts +43 -1
- package/src/modules/forms/repository.ts +162 -1
- package/src/modules/forms/routes.ts +212 -2
- package/src/modules/forms/schema.ts +166 -4
- package/src/modules/forms/service.ts +565 -41
- package/src/modules/forms/submission.ts +718 -44
- package/src/modules/import-export/drafts.ts +20 -1
- package/src/modules/import-export/exportRows.ts +21 -5
- package/src/modules/import-export/plan.ts +47 -2
- package/src/modules/import-export/presets.ts +10 -0
- package/src/modules/import-export/repository.ts +73 -8
- package/src/modules/import-export/routes.ts +4 -0
- package/src/modules/import-export/schema.ts +11 -0
- package/src/modules/import-export/service.ts +28 -2
- package/src/modules/import-export/streams.ts +3 -1
- package/src/modules/import-export/tools.ts +10 -0
- package/src/modules/import-export/validation.ts +28 -0
- package/src/modules/import-export/writes.ts +70 -5
- package/src/modules/lists/index.ts +71 -0
- package/src/modules/lists/repository.ts +64 -0
- package/src/modules/lists/routes.ts +8 -0
- package/src/modules/lists/schema.ts +10 -0
- package/src/modules/lists/service.ts +110 -9
- package/src/modules/mcp/index.ts +5 -0
- package/src/modules/opportunities/index.ts +3 -1
- package/src/modules/opportunities/repository.ts +11 -0
- package/src/modules/opportunities/routes.ts +13 -0
- package/src/modules/opportunities/schema.ts +7 -1
- package/src/modules/opportunities/service.ts +188 -22
- package/src/modules/opportunities/tools.ts +2 -0
- package/src/modules/partnerships/index.ts +3 -1
- package/src/modules/partnerships/repository.ts +6 -117
- package/src/modules/partnerships/routes.ts +7 -0
- package/src/modules/partnerships/schema.ts +7 -14
- package/src/modules/partnerships/service.ts +93 -22
- package/src/modules/people/consentHydration.ts +167 -0
- package/src/modules/people/index.ts +3 -1
- package/src/modules/people/personConsentWrites.ts +177 -0
- package/src/modules/people/repository.ts +5 -0
- package/src/modules/people/routes.ts +127 -18
- package/src/modules/people/schema.ts +109 -3
- package/src/modules/people/service.ts +186 -40
- package/src/modules/people/tools.ts +5 -1
- package/src/modules/personLinks.ts +278 -0
- package/src/modules/raises/index.ts +3 -1
- package/src/modules/raises/repository.ts +6 -107
- package/src/modules/raises/routes.ts +7 -0
- package/src/modules/raises/schema.ts +7 -14
- package/src/modules/raises/service.ts +91 -20
- package/src/modules/recordTargets.ts +2 -0
- package/src/modules/references.ts +43 -4
- package/src/modules/sample-data/fixture.ts +63 -0
- package/src/modules/sample-data/index.ts +1 -0
- package/src/modules/sample-data/routes.ts +1 -0
- package/src/modules/sample-data/service.ts +97 -8
- package/src/modules/search/index.ts +2 -1
- package/src/modules/search/repository.ts +33 -1
- package/src/modules/search/service.ts +7 -5
- package/src/modules/stagedRecords.ts +18 -3
- package/src/modules/webhooks/payloads.ts +20 -2
- package/src/modules/workspace/repository.ts +12 -0
- package/src/modules/workspace/service.ts +14 -0
- package/src/modules/workspace/starters.ts +5 -0
- package/src/runtime/events.ts +1 -0
- package/src/schema/index.ts +3 -0
- package/src/testing/database.ts +97 -11
|
@@ -0,0 +1,370 @@
|
|
|
1
|
+
import { changedKeys } from '../../lib/changes.js';
|
|
2
|
+
import { AppError } from '../../lib/errors.js';
|
|
3
|
+
import { readListWindow, toPage } from '../../lib/pagination.js';
|
|
4
|
+
import { describeConversion, describeCreation, describeCreationFrom, describeLink, describeStageChange, describeUnlink, describeUpdate, } from '../activities/wording.js';
|
|
5
|
+
import { toEventActor } from '../../lib/actor.js';
|
|
6
|
+
import { actorMemberId, requireWorkspaceId } from '../auth/actor.js';
|
|
7
|
+
import './events.js';
|
|
8
|
+
import '../deals/events.js';
|
|
9
|
+
import { deleteRecordsAttachedTo } from '../attachedRecords.js';
|
|
10
|
+
import * as companyRepository from '../companies/repository.js';
|
|
11
|
+
import * as dealRepository from '../deals/repository.js';
|
|
12
|
+
import * as personLinks from '../personLinks.js';
|
|
13
|
+
import * as pipelineRepository from '../pipelines/repository.js';
|
|
14
|
+
import * as repository from './repository.js';
|
|
15
|
+
import { DEFAULT_ENQUIRY_SORT, ENQUIRY_SORTS } from './repository.js';
|
|
16
|
+
/** What a changed column is called on a timeline. */
|
|
17
|
+
const ENQUIRY_FIELD_LABELS = {
|
|
18
|
+
name: 'Name',
|
|
19
|
+
source: 'Source',
|
|
20
|
+
companyId: 'Company',
|
|
21
|
+
ownerId: 'Owner',
|
|
22
|
+
summary: 'Summary',
|
|
23
|
+
tags: 'Tags',
|
|
24
|
+
};
|
|
25
|
+
function toView(record, personIds) {
|
|
26
|
+
const { workspaceId: _workspaceId, ...view } = record;
|
|
27
|
+
return { ...view, personIds };
|
|
28
|
+
}
|
|
29
|
+
function toStoredColumns(input) {
|
|
30
|
+
return {
|
|
31
|
+
...(input.name === undefined ? {} : { name: input.name }),
|
|
32
|
+
...(input.source === undefined ? {} : { source: input.source }),
|
|
33
|
+
...(input.stageId === undefined ? {} : { stageId: input.stageId }),
|
|
34
|
+
...(input.companyId === undefined ? {} : { companyId: input.companyId }),
|
|
35
|
+
...(input.ownerId === undefined ? {} : { ownerId: input.ownerId }),
|
|
36
|
+
...(input.summary === undefined ? {} : { summary: input.summary }),
|
|
37
|
+
...(input.tags === undefined ? {} : { tags: [...input.tags] }),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export function createEnquiriesService(dependencies) {
|
|
41
|
+
async function require(workspaceId, id) {
|
|
42
|
+
const enquiry = await repository.findEnquiry(dependencies.db, workspaceId, id);
|
|
43
|
+
if (enquiry === undefined) {
|
|
44
|
+
throw AppError.notFound('Enquiry not found');
|
|
45
|
+
}
|
|
46
|
+
return enquiry;
|
|
47
|
+
}
|
|
48
|
+
async function requireCompany(workspaceId, companyId) {
|
|
49
|
+
const company = await companyRepository.findCompany(dependencies.db, workspaceId, companyId);
|
|
50
|
+
if (company === undefined) {
|
|
51
|
+
throw AppError.notFound('Company not found');
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* A stage an enquiry may sit in: exists in this workspace and belongs to the
|
|
56
|
+
* enquiry pipeline. The wrong-workspace case reads as missing; the
|
|
57
|
+
* wrong-pipeline case is a request naming a real stage that can never hold an
|
|
58
|
+
* enquiry, which is a validation error rather than a missing record.
|
|
59
|
+
*/
|
|
60
|
+
async function requireEnquiryStage(workspaceId, stageId) {
|
|
61
|
+
const stage = await pipelineRepository.findStage(dependencies.db, workspaceId, stageId);
|
|
62
|
+
if (stage === undefined) {
|
|
63
|
+
throw AppError.notFound('Pipeline stage not found');
|
|
64
|
+
}
|
|
65
|
+
if (stage.kind !== 'enquiry') {
|
|
66
|
+
throw AppError.validationFailed('That stage is not part of the enquiry pipeline', [
|
|
67
|
+
{ field: 'stage_id', message: `It belongs to the ${stage.kind} pipeline` },
|
|
68
|
+
]);
|
|
69
|
+
}
|
|
70
|
+
return stage;
|
|
71
|
+
}
|
|
72
|
+
/** The default stage for a new enquiry: the first open one, or the first if none are open. */
|
|
73
|
+
async function defaultEnquiryStage(workspaceId) {
|
|
74
|
+
const rows = await pipelineRepository.listStagesOfKind(dependencies.db, workspaceId, 'enquiry');
|
|
75
|
+
const first = rows.find((row) => row.open) ?? rows[0];
|
|
76
|
+
if (first === undefined) {
|
|
77
|
+
// Unreachable through the API: workspaces seed stages and the last stage
|
|
78
|
+
// of a pipeline cannot be removed.
|
|
79
|
+
throw AppError.conflict('This workspace has no enquiry stages');
|
|
80
|
+
}
|
|
81
|
+
return first;
|
|
82
|
+
}
|
|
83
|
+
async function requireOwner(workspaceId, ownerId) {
|
|
84
|
+
if (!(await repository.memberExists(dependencies.db, workspaceId, ownerId))) {
|
|
85
|
+
throw AppError.notFound('Team member not found');
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/** @returns Each person's name, for the link activities. Any id missing here is a 404. */
|
|
89
|
+
async function requirePeople(workspaceId, personIds) {
|
|
90
|
+
const named = await personLinks.findPeopleNamed(dependencies.db, workspaceId, personIds);
|
|
91
|
+
const missing = personIds.filter((id) => !named.has(id));
|
|
92
|
+
if (missing.length > 0) {
|
|
93
|
+
throw new AppError('not_found', 'Person not found', missing.map((id) => ({ field: 'person_ids', message: `No person ${id} here` })));
|
|
94
|
+
}
|
|
95
|
+
return named;
|
|
96
|
+
}
|
|
97
|
+
async function toViews(workspaceId, records) {
|
|
98
|
+
const peopleByEnquiry = await personLinks.listPersonIdsFor(dependencies.db, workspaceId, 'enquiry', records.map((record) => record.id));
|
|
99
|
+
return records.map((record) => toView(record, peopleByEnquiry.get(record.id) ?? []));
|
|
100
|
+
}
|
|
101
|
+
return {
|
|
102
|
+
async list(actor, filters, query) {
|
|
103
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
104
|
+
const window = readListWindow(query, ENQUIRY_SORTS, DEFAULT_ENQUIRY_SORT);
|
|
105
|
+
const rows = await repository.listEnquiries(dependencies.db, workspaceId, filters, window);
|
|
106
|
+
const page = toPage(rows, window, (enquiry) => enquiry.id);
|
|
107
|
+
return { items: await toViews(workspaceId, page.items), nextCursor: page.nextCursor };
|
|
108
|
+
},
|
|
109
|
+
async get(actor, id) {
|
|
110
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
111
|
+
const enquiry = await require(workspaceId, id);
|
|
112
|
+
return toView(enquiry, await personLinks.listPersonIds(dependencies.db, workspaceId, {
|
|
113
|
+
targetType: 'enquiry',
|
|
114
|
+
targetId: id,
|
|
115
|
+
}));
|
|
116
|
+
},
|
|
117
|
+
async create(actor, input) {
|
|
118
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
119
|
+
if (input.companyId !== null) {
|
|
120
|
+
await requireCompany(workspaceId, input.companyId);
|
|
121
|
+
}
|
|
122
|
+
const stage = input.stageId === undefined
|
|
123
|
+
? await defaultEnquiryStage(workspaceId)
|
|
124
|
+
: await requireEnquiryStage(workspaceId, input.stageId);
|
|
125
|
+
const ownerId = input.ownerId === undefined ? actorMemberId(actor) : input.ownerId;
|
|
126
|
+
if (ownerId !== null) {
|
|
127
|
+
await requireOwner(workspaceId, ownerId);
|
|
128
|
+
}
|
|
129
|
+
const personIds = [...new Set(input.personIds)];
|
|
130
|
+
const named = await requirePeople(workspaceId, personIds);
|
|
131
|
+
const id = dependencies.createId('enquiry');
|
|
132
|
+
return dependencies.transaction(async ({ tx, events }) => {
|
|
133
|
+
const customFields = await dependencies.customFields.forCreate(tx, workspaceId, 'enquiry', input.customFields);
|
|
134
|
+
const created = await repository.insertEnquiry(tx, {
|
|
135
|
+
id,
|
|
136
|
+
workspaceId,
|
|
137
|
+
name: input.name,
|
|
138
|
+
source: input.source,
|
|
139
|
+
stageId: stage.id,
|
|
140
|
+
companyId: input.companyId,
|
|
141
|
+
ownerId,
|
|
142
|
+
convertedDealId: null,
|
|
143
|
+
summary: input.summary,
|
|
144
|
+
tags: [...input.tags],
|
|
145
|
+
customFields,
|
|
146
|
+
});
|
|
147
|
+
await personLinks.linkPeople(tx, dependencies.createId, workspaceId, { targetType: 'enquiry', targetId: id }, personIds);
|
|
148
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
149
|
+
targetType: 'enquiry',
|
|
150
|
+
targetId: id,
|
|
151
|
+
kind: 'created',
|
|
152
|
+
...describeCreation('Enquiry'),
|
|
153
|
+
});
|
|
154
|
+
for (const personId of personIds) {
|
|
155
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
156
|
+
targetType: 'enquiry',
|
|
157
|
+
targetId: id,
|
|
158
|
+
kind: 'linked',
|
|
159
|
+
...describeLink('person', named.get(personId) ?? personId),
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
events.emit('enquiries.enquiry.created', { type: 'enquiry', id }, {});
|
|
163
|
+
return toView(created, personIds);
|
|
164
|
+
}, { workspaceId, actor: toEventActor(actor) });
|
|
165
|
+
},
|
|
166
|
+
async update(actor, id, changes) {
|
|
167
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
168
|
+
const existing = await require(workspaceId, id);
|
|
169
|
+
if (typeof changes.companyId === 'string' && changes.companyId !== existing.companyId) {
|
|
170
|
+
await requireCompany(workspaceId, changes.companyId);
|
|
171
|
+
}
|
|
172
|
+
const stageMove = changes.stageId === undefined || changes.stageId === existing.stageId
|
|
173
|
+
? undefined
|
|
174
|
+
: {
|
|
175
|
+
from: await requireEnquiryStage(workspaceId, existing.stageId),
|
|
176
|
+
to: await requireEnquiryStage(workspaceId, changes.stageId),
|
|
177
|
+
};
|
|
178
|
+
if (typeof changes.ownerId === 'string' && changes.ownerId !== existing.ownerId) {
|
|
179
|
+
await requireOwner(workspaceId, changes.ownerId);
|
|
180
|
+
}
|
|
181
|
+
const currentPeople = await personLinks.listPersonIds(dependencies.db, workspaceId, {
|
|
182
|
+
targetType: 'enquiry',
|
|
183
|
+
targetId: id,
|
|
184
|
+
});
|
|
185
|
+
const nextPeople = changes.personIds === undefined ? undefined : [...new Set(changes.personIds)];
|
|
186
|
+
const added = nextPeople === undefined
|
|
187
|
+
? []
|
|
188
|
+
: nextPeople.filter((personId) => !currentPeople.includes(personId));
|
|
189
|
+
const removed = nextPeople === undefined
|
|
190
|
+
? []
|
|
191
|
+
: currentPeople.filter((personId) => !nextPeople.includes(personId));
|
|
192
|
+
const named = await requirePeople(workspaceId, [...added, ...removed]);
|
|
193
|
+
const columns = toStoredColumns(changes);
|
|
194
|
+
const scalarChanged = changedKeys(existing, columns);
|
|
195
|
+
const linksChanged = added.length > 0 || removed.length > 0;
|
|
196
|
+
return dependencies.transaction(async ({ tx, events }) => {
|
|
197
|
+
const cf = await dependencies.customFields.forUpdate(tx, workspaceId, 'enquiry', existing.customFields, changes.customFields);
|
|
198
|
+
const customFieldsChanged = cf !== undefined && cf.changedPaths.length > 0;
|
|
199
|
+
if (scalarChanged.length === 0 && !linksChanged && !customFieldsChanged) {
|
|
200
|
+
return toView(existing, currentPeople);
|
|
201
|
+
}
|
|
202
|
+
const updated = await repository.updateEnquiry(tx, workspaceId, id, {
|
|
203
|
+
...columns,
|
|
204
|
+
...(customFieldsChanged ? { customFields: cf.merged } : {}),
|
|
205
|
+
updatedAt: dependencies.now(),
|
|
206
|
+
});
|
|
207
|
+
if (updated === undefined) {
|
|
208
|
+
throw AppError.notFound('Enquiry not found');
|
|
209
|
+
}
|
|
210
|
+
await personLinks.linkPeople(tx, dependencies.createId, workspaceId, { targetType: 'enquiry', targetId: id }, added);
|
|
211
|
+
await personLinks.unlinkPeople(tx, workspaceId, { targetType: 'enquiry', targetId: id }, removed);
|
|
212
|
+
if (stageMove !== undefined) {
|
|
213
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
214
|
+
targetType: 'enquiry',
|
|
215
|
+
targetId: id,
|
|
216
|
+
kind: 'stage_changed',
|
|
217
|
+
...describeStageChange(stageMove.from.label, stageMove.to.label),
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
const otherChanged = scalarChanged.filter((field) => field !== 'stageId');
|
|
221
|
+
const customFieldPaths = cf?.changedPaths ?? [];
|
|
222
|
+
const activityChanged = [...otherChanged, ...customFieldPaths];
|
|
223
|
+
if (activityChanged.length > 0) {
|
|
224
|
+
const labels = { ...ENQUIRY_FIELD_LABELS, ...cf?.labels };
|
|
225
|
+
const before = { ...existing, ...cf?.flatBefore };
|
|
226
|
+
const after = { ...columns, ...cf?.flatAfter };
|
|
227
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
228
|
+
targetType: 'enquiry',
|
|
229
|
+
targetId: id,
|
|
230
|
+
kind: 'updated',
|
|
231
|
+
...describeUpdate(activityChanged, labels, before, after),
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
for (const personId of added) {
|
|
235
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
236
|
+
targetType: 'enquiry',
|
|
237
|
+
targetId: id,
|
|
238
|
+
kind: 'linked',
|
|
239
|
+
...describeLink('person', named.get(personId) ?? personId),
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
for (const personId of removed) {
|
|
243
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
244
|
+
targetType: 'enquiry',
|
|
245
|
+
targetId: id,
|
|
246
|
+
kind: 'unlinked',
|
|
247
|
+
...describeUnlink('person', named.get(personId) ?? personId),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
events.emit('enquiries.enquiry.updated', { type: 'enquiry', id }, {
|
|
251
|
+
changed: [
|
|
252
|
+
...scalarChanged,
|
|
253
|
+
...(linksChanged ? ['personIds'] : []),
|
|
254
|
+
...customFieldPaths,
|
|
255
|
+
],
|
|
256
|
+
});
|
|
257
|
+
if (stageMove !== undefined) {
|
|
258
|
+
events.emit('enquiries.enquiry.stage_changed', { type: 'enquiry', id }, { fromStageId: stageMove.from.id, toStageId: stageMove.to.id });
|
|
259
|
+
}
|
|
260
|
+
return toView(updated, nextPeople ?? currentPeople);
|
|
261
|
+
}, { workspaceId, actor: toEventActor(actor) });
|
|
262
|
+
},
|
|
263
|
+
async remove(actor, id) {
|
|
264
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
265
|
+
await dependencies.transaction(async ({ tx, events }) => {
|
|
266
|
+
await require(workspaceId, id);
|
|
267
|
+
// Notes, activities, decisions, plan items, person_links, list
|
|
268
|
+
// memberships and form_attach_targets rows are removed here in the
|
|
269
|
+
// same transaction. `form_submissions.enquiry_id` is a set-null FK, so
|
|
270
|
+
// the DB clears it on its own.
|
|
271
|
+
await deleteRecordsAttachedTo(tx, workspaceId, 'enquiry', id);
|
|
272
|
+
await repository.deleteEnquiry(tx, workspaceId, id);
|
|
273
|
+
events.emit('enquiries.enquiry.deleted', { type: 'enquiry', id }, {});
|
|
274
|
+
}, { workspaceId, actor: toEventActor(actor) });
|
|
275
|
+
},
|
|
276
|
+
async convertToDeal(actor, id) {
|
|
277
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
278
|
+
const existing = await require(workspaceId, id);
|
|
279
|
+
if (existing.convertedDealId !== null) {
|
|
280
|
+
throw new AppError('conflict', 'This enquiry has already been converted to a deal', [{ field: 'converted_deal_id', message: `Deal ${existing.convertedDealId}` }]);
|
|
281
|
+
}
|
|
282
|
+
if (existing.companyId === null) {
|
|
283
|
+
throw AppError.validationFailed('An enquiry needs a company before it can become a deal', [
|
|
284
|
+
{ field: 'company_id', message: 'Link a company to the enquiry first' },
|
|
285
|
+
]);
|
|
286
|
+
}
|
|
287
|
+
const dealStages = await pipelineRepository.listStagesOfKind(dependencies.db, workspaceId, 'deal');
|
|
288
|
+
const openDealStage = dealStages.find((row) => row.open) ?? dealStages[0];
|
|
289
|
+
if (openDealStage === undefined) {
|
|
290
|
+
// Unreachable through the API: workspaces seed stages and the last
|
|
291
|
+
// deal stage cannot be removed.
|
|
292
|
+
throw AppError.conflict('This workspace has no deal stages');
|
|
293
|
+
}
|
|
294
|
+
const enquiryStages = await pipelineRepository.listStagesOfKind(dependencies.db, workspaceId, 'enquiry');
|
|
295
|
+
// A closed enquiry stage is where a converted enquiry lands. If the
|
|
296
|
+
// workspace has deleted every closed stage we leave the enquiry where it
|
|
297
|
+
// is rather than refuse the conversion over board cosmetics.
|
|
298
|
+
const closedEnquiryStage = enquiryStages.find((row) => !row.open);
|
|
299
|
+
const personIds = await personLinks.listPersonIds(dependencies.db, workspaceId, {
|
|
300
|
+
targetType: 'enquiry',
|
|
301
|
+
targetId: id,
|
|
302
|
+
});
|
|
303
|
+
const dealId = dependencies.createId('deal');
|
|
304
|
+
const now = dependencies.now();
|
|
305
|
+
return dependencies.transaction(async ({ tx, events }) => {
|
|
306
|
+
const deal = await dealRepository.insertDeal(tx, {
|
|
307
|
+
id: dealId,
|
|
308
|
+
workspaceId,
|
|
309
|
+
name: existing.name,
|
|
310
|
+
companyId: existing.companyId,
|
|
311
|
+
stageId: openDealStage.id,
|
|
312
|
+
valueCents: null,
|
|
313
|
+
currency: null,
|
|
314
|
+
ownerId: existing.ownerId,
|
|
315
|
+
expectedClose: null,
|
|
316
|
+
competitors: [],
|
|
317
|
+
risks: '',
|
|
318
|
+
whyWin: '',
|
|
319
|
+
summary: existing.summary,
|
|
320
|
+
tags: [...existing.tags],
|
|
321
|
+
externalId: null,
|
|
322
|
+
customFields: {},
|
|
323
|
+
});
|
|
324
|
+
await personLinks.linkPeople(tx, dependencies.createId, workspaceId, { targetType: 'deal', targetId: dealId }, personIds);
|
|
325
|
+
const stageChanged = closedEnquiryStage !== undefined && closedEnquiryStage.id !== existing.stageId;
|
|
326
|
+
const currentEnquiryStage = enquiryStages.find((row) => row.id === existing.stageId);
|
|
327
|
+
const updatedEnquiry = await repository.updateEnquiry(tx, workspaceId, id, {
|
|
328
|
+
convertedDealId: dealId,
|
|
329
|
+
...(stageChanged ? { stageId: closedEnquiryStage.id } : {}),
|
|
330
|
+
updatedAt: now,
|
|
331
|
+
});
|
|
332
|
+
if (updatedEnquiry === undefined) {
|
|
333
|
+
throw AppError.notFound('Enquiry not found');
|
|
334
|
+
}
|
|
335
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
336
|
+
targetType: 'deal',
|
|
337
|
+
targetId: dealId,
|
|
338
|
+
kind: 'created',
|
|
339
|
+
...describeCreationFrom('Deal', 'Enquiry', existing.name),
|
|
340
|
+
});
|
|
341
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
342
|
+
targetType: 'enquiry',
|
|
343
|
+
targetId: id,
|
|
344
|
+
kind: 'updated',
|
|
345
|
+
...describeConversion('Deal', deal.name),
|
|
346
|
+
});
|
|
347
|
+
if (stageChanged && currentEnquiryStage !== undefined) {
|
|
348
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
349
|
+
targetType: 'enquiry',
|
|
350
|
+
targetId: id,
|
|
351
|
+
kind: 'stage_changed',
|
|
352
|
+
...describeStageChange(currentEnquiryStage.label, closedEnquiryStage.label),
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
events.emit('deals.deal.created', { type: 'deal', id: dealId }, {});
|
|
356
|
+
events.emit('enquiries.enquiry.updated', { type: 'enquiry', id }, {
|
|
357
|
+
changed: stageChanged
|
|
358
|
+
? ['convertedDealId', 'stageId']
|
|
359
|
+
: ['convertedDealId'],
|
|
360
|
+
});
|
|
361
|
+
if (stageChanged && currentEnquiryStage !== undefined) {
|
|
362
|
+
events.emit('enquiries.enquiry.stage_changed', { type: 'enquiry', id }, { fromStageId: currentEnquiryStage.id, toStageId: closedEnquiryStage.id });
|
|
363
|
+
}
|
|
364
|
+
events.emit('enquiries.enquiry.converted', { type: 'enquiry', id }, { dealId });
|
|
365
|
+
return { deal, personIds };
|
|
366
|
+
}, { workspaceId, actor: toEventActor(actor) });
|
|
367
|
+
},
|
|
368
|
+
};
|
|
369
|
+
}
|
|
370
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/modules/enquiries/service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAIhE,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,YAAY,EACZ,mBAAmB,EACnB,cAAc,EACd,cAAc,GACf,MAAM,0BAA0B,CAAA;AAEjC,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACpE,OAAO,aAAa,CAAA;AACpB,OAAO,oBAAoB,CAAA;AAC3B,OAAO,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAA;AAC/D,OAAO,KAAK,iBAAiB,MAAM,4BAA4B,CAAA;AAE/D,OAAO,KAAK,cAAc,MAAM,wBAAwB,CAAA;AAExD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAA;AAChD,OAAO,KAAK,kBAAkB,MAAM,4BAA4B,CAAA;AAEhE,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAA;AAC7C,OAAO,EAAE,oBAAoB,EAAE,aAAa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,CAAC,IAAI,CACT,iCAAiC,EACjC,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EACvB,EAAE,WAAW,EAAE,mBAAmB,CAAC,EAAE,EAAE,SAAS,EAAE,kBAAkB,CAAC,EAAE,EAAE,CAC1E,CAAA;gBACH,CAAC;gBAED,MAAM,CAAC,IAAI,CAAC,6BAA6B,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAA;gBAE/E,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAA;YAC5B,CAAC,EAAE,EAAE,WAAW,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;QACjD,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/modules/enquiries/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAW9D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAapD,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,gBAAgB,GAAG,IAAI,CAuC5F"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { idArg, idSetArg, listWindowShape, registerCrudTools, termArg, toSet, } from '../crudTools.js';
|
|
3
|
+
import { dealResponse } from '../deals/routes.js';
|
|
4
|
+
import { createBody, enquiryResponse, toCreateInput, toUpdateInput, updateBody } from './routes.js';
|
|
5
|
+
/** `enquiries_*`. Same schemas and mappers as `/v1/enquiries`. */
|
|
6
|
+
const listArgs = z.strictObject({
|
|
7
|
+
...listWindowShape,
|
|
8
|
+
q: termArg,
|
|
9
|
+
source: idSetArg.optional().describe('Sources are free text, so a match here is exact.'),
|
|
10
|
+
company_id: idSetArg.optional().describe('Only enquiries with these companies.'),
|
|
11
|
+
stage_id: idSetArg.optional().describe('Only enquiries in these pipeline stages.'),
|
|
12
|
+
person_id: idSetArg.optional().describe('Only enquiries any of these people are on.'),
|
|
13
|
+
});
|
|
14
|
+
export function registerEnquiriesTools(mcp, service) {
|
|
15
|
+
registerCrudTools(mcp, {
|
|
16
|
+
resource: 'enquiries',
|
|
17
|
+
subject: 'enquiry',
|
|
18
|
+
about: 'An inbound enquiry: a top-of-funnel request that may become a Deal once qualified. ' +
|
|
19
|
+
'Not itself a deal.',
|
|
20
|
+
service,
|
|
21
|
+
render: enquiryResponse,
|
|
22
|
+
listArgs,
|
|
23
|
+
toFilters: (args) => ({
|
|
24
|
+
term: args.q,
|
|
25
|
+
sources: toSet(args.source),
|
|
26
|
+
companyIds: toSet(args.company_id),
|
|
27
|
+
stageIds: toSet(args.stage_id),
|
|
28
|
+
personIds: toSet(args.person_id),
|
|
29
|
+
}),
|
|
30
|
+
createArgs: createBody,
|
|
31
|
+
toCreateInput,
|
|
32
|
+
updateArgs: updateBody.extend({ id: idArg }),
|
|
33
|
+
toUpdateInput,
|
|
34
|
+
});
|
|
35
|
+
mcp.tool({
|
|
36
|
+
name: 'enquiries_convert_to_deal',
|
|
37
|
+
description: 'Convert an enquiry to a Deal. Copies name, company, owner and linked ' +
|
|
38
|
+
'people to a new deal in the first open deal stage, moves the enquiry ' +
|
|
39
|
+
'to its first closed stage, and records the link on the enquiry. 409 if ' +
|
|
40
|
+
'the enquiry has already been converted; 422 if it has no company. ' +
|
|
41
|
+
'Mirrors POST /v1/enquiries/{id}/convert.',
|
|
42
|
+
inputSchema: z.strictObject({ id: idArg }),
|
|
43
|
+
invoke: async ({ id }, actor) => {
|
|
44
|
+
const { deal, personIds } = await service.convertToDeal(actor, id);
|
|
45
|
+
const { workspaceId: _workspaceId, ...dealView } = deal;
|
|
46
|
+
return dealResponse({ ...dealView, personIds });
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50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AAM,CAAC;YAC3B,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YAClC,QAAQ,EAAE,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC9B,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC;SACjC,CAAC;QACF,UAAU,EAAE,UAAU;QACtB,aAAa;QACb,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;QAC5C,aAAa;KACd,CAAC,CAAA;IAEF,GAAG,CAAC,IAAI,CAAC;QACP,IAAI,EAAE,2BAA2B;QACjC,WAAW,EACT,uEAAuE;YACvE,uEAAuE;YACvE,yEAAyE;YACzE,oEAAoE;YACpE,0CAA0C;QAC5C,WAAW,EAAE,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;QAC1C,MAAM,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE;YAC9B,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,EAAE,CAAC,CAAA;YAClE,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAA;YAEvD,OAAO,YAAY,CAAC,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAA;QACjD,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -23,7 +23,10 @@ import './companies/events.ts';
|
|
|
23
23
|
import './positions/events.ts';
|
|
24
24
|
import './notes/events.ts';
|
|
25
25
|
import './lists/events.ts';
|
|
26
|
+
import './consent-purposes/events.ts';
|
|
27
|
+
import './custom-fields/events.ts';
|
|
26
28
|
import './deals/events.ts';
|
|
29
|
+
import './enquiries/events.ts';
|
|
27
30
|
import './opportunities/events.ts';
|
|
28
31
|
import './partnerships/events.ts';
|
|
29
32
|
import './raises/events.ts';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventCatalogs.d.ts","sourceRoot":"","sources":["../../src/modules/eventCatalogs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,uBAAuB,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,2BAA2B,CAAA;AAClC,OAAO,0BAA0B,CAAA;AACjC,OAAO,oBAAoB,CAAA;AAC3B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"eventCatalogs.d.ts","sourceRoot":"","sources":["../../src/modules/eventCatalogs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,uBAAuB,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,8BAA8B,CAAA;AACrC,OAAO,2BAA2B,CAAA;AAClC,OAAO,mBAAmB,CAAA;AAC1B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,2BAA2B,CAAA;AAClC,OAAO,0BAA0B,CAAA;AACjC,OAAO,oBAAoB,CAAA;AAC3B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,2BAA2B,CAAA"}
|
|
@@ -23,7 +23,10 @@ import './companies/events.js';
|
|
|
23
23
|
import './positions/events.js';
|
|
24
24
|
import './notes/events.js';
|
|
25
25
|
import './lists/events.js';
|
|
26
|
+
import './consent-purposes/events.js';
|
|
27
|
+
import './custom-fields/events.js';
|
|
26
28
|
import './deals/events.js';
|
|
29
|
+
import './enquiries/events.js';
|
|
27
30
|
import './opportunities/events.js';
|
|
28
31
|
import './partnerships/events.js';
|
|
29
32
|
import './raises/events.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"eventCatalogs.js","sourceRoot":"","sources":["../../src/modules/eventCatalogs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,uBAAuB,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,2BAA2B,CAAA;AAClC,OAAO,0BAA0B,CAAA;AACjC,OAAO,oBAAoB,CAAA;AAC3B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,2BAA2B,CAAA"}
|
|
1
|
+
{"version":3,"file":"eventCatalogs.js","sourceRoot":"","sources":["../../src/modules/eventCatalogs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,uBAAuB,CAAA;AAC9B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,8BAA8B,CAAA;AACrC,OAAO,2BAA2B,CAAA;AAClC,OAAO,mBAAmB,CAAA;AAC1B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,2BAA2B,CAAA;AAClC,OAAO,0BAA0B,CAAA;AACjC,OAAO,oBAAoB,CAAA;AAC3B,OAAO,oBAAoB,CAAA;AAC3B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,uBAAuB,CAAA;AAC9B,OAAO,sBAAsB,CAAA;AAC7B,OAAO,mBAAmB,CAAA;AAC1B,OAAO,2BAA2B,CAAA"}
|
|
@@ -8,13 +8,23 @@ import type { FormFieldRecord, FormRecord } from './repository.ts';
|
|
|
8
8
|
* characters that break out of either is the same.
|
|
9
9
|
*/
|
|
10
10
|
export declare function escapeHtml(text: string): string;
|
|
11
|
+
export type EmbedLayout = 'page' | 'embed';
|
|
11
12
|
export interface EmbedPageOptions {
|
|
12
13
|
readonly form: FormRecord;
|
|
13
14
|
readonly fields: readonly FormFieldRecord[];
|
|
15
|
+
/** Labels for the consent purposes the fields refer to, keyed by purpose id. */
|
|
16
|
+
readonly consentPurposeLabels: ReadonlyMap<string, string>;
|
|
14
17
|
/** Absolute URL of the public submit endpoint this page posts to. */
|
|
15
18
|
readonly submitUrl: string;
|
|
16
19
|
/** Per-response value tying the inline style and script to the CSP header. */
|
|
17
20
|
readonly nonce: string;
|
|
21
|
+
/** Workspace name shown above the form title on the hosted page layout. */
|
|
22
|
+
readonly workspaceName: string;
|
|
23
|
+
/**
|
|
24
|
+
* `page` is the standalone hosted URL (brand chrome). `embed` is the iframe
|
|
25
|
+
* document: fields only, no page design around them.
|
|
26
|
+
*/
|
|
27
|
+
readonly layout: EmbedLayout;
|
|
18
28
|
}
|
|
19
29
|
/**
|
|
20
30
|
* The whole page, as one document.
|
|
@@ -33,18 +43,22 @@ export declare function renderEmbedPage(options: EmbedPageOptions): string;
|
|
|
33
43
|
* must not also send `X-Frame-Options`.
|
|
34
44
|
*/
|
|
35
45
|
export declare function embedContentSecurityPolicy(nonce: string): string;
|
|
36
|
-
/** What a customer pastes into their site
|
|
46
|
+
/** What a customer pastes into their site, plus the standalone hosted URL. */
|
|
37
47
|
export interface EmbedSnippets {
|
|
48
|
+
/** Standalone hosted page (brand chrome). */
|
|
38
49
|
readonly url: string;
|
|
50
|
+
/** Bare document the iframe snippets load (fields only). */
|
|
51
|
+
readonly embedUrl: string;
|
|
39
52
|
readonly iframe: string;
|
|
40
53
|
readonly script: string;
|
|
41
54
|
}
|
|
42
55
|
/**
|
|
43
|
-
* The two ways to embed.
|
|
56
|
+
* The two ways to embed, plus the hosted page URL.
|
|
44
57
|
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
58
|
+
* Hosted `url` is the full page. The iframe snippets point at `embedUrl`, which
|
|
59
|
+
* is the same form without page chrome — what belongs inside somebody else's
|
|
60
|
+
* site. The plain iframe is fixed height; the script listens for height
|
|
61
|
+
* messages as fields appear and as the thank-you replaces the form.
|
|
48
62
|
*/
|
|
49
|
-
export declare function embedSnippets(
|
|
63
|
+
export declare function embedSnippets(hostedUrl: string, embedUrl: string, formId: string): EmbedSnippets;
|
|
50
64
|
//# sourceMappingURL=embed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../../src/modules/forms/embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"embed.d.ts","sourceRoot":"","sources":["../../../src/modules/forms/embed.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AA4BlE;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAuaD,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAA;AAE1C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,UAAU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