@kelpie/server 0.7.0 → 0.9.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/lib/consumerEmailDomains.d.ts +2 -0
- package/dist/lib/consumerEmailDomains.d.ts.map +1 -0
- package/dist/lib/consumerEmailDomains.js +62 -0
- package/dist/lib/consumerEmailDomains.js.map +1 -0
- package/dist/lib/email.d.ts +7 -0
- package/dist/lib/email.d.ts.map +1 -1
- package/dist/lib/email.js.map +1 -1
- package/dist/lib/emailContent.d.ts +33 -0
- package/dist/lib/emailContent.d.ts.map +1 -0
- package/dist/lib/emailContent.js +54 -0
- package/dist/lib/emailContent.js.map +1 -0
- package/dist/lib/emailDomainAutoLink.d.ts +27 -0
- package/dist/lib/emailDomainAutoLink.d.ts.map +1 -0
- package/dist/lib/emailDomainAutoLink.js +119 -0
- package/dist/lib/emailDomainAutoLink.js.map +1 -0
- package/dist/lib/ids.d.ts +13 -0
- package/dist/lib/ids.d.ts.map +1 -1
- package/dist/lib/ids.js +13 -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 +18 -2
- package/dist/modules/attachedRecords.js.map +1 -1
- package/dist/modules/auth/preferences.d.ts +11 -1
- package/dist/modules/auth/preferences.d.ts.map +1 -1
- package/dist/modules/auth/preferences.js +11 -0
- package/dist/modules/auth/preferences.js.map +1 -1
- package/dist/modules/auth/routes.d.ts.map +1 -1
- package/dist/modules/auth/routes.js +18 -0
- package/dist/modules/auth/routes.js.map +1 -1
- package/dist/modules/auth/schema.d.ts +20 -0
- package/dist/modules/auth/schema.d.ts.map +1 -1
- package/dist/modules/auth/schema.js +11 -1
- package/dist/modules/auth/schema.js.map +1 -1
- package/dist/modules/auth/service.d.ts.map +1 -1
- package/dist/modules/auth/service.js +27 -3
- package/dist/modules/auth/service.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/repository.d.ts +2 -0
- package/dist/modules/companies/repository.d.ts.map +1 -1
- package/dist/modules/companies/repository.js +1 -0
- package/dist/modules/companies/repository.js.map +1 -1
- package/dist/modules/companies/routes.d.ts +16 -0
- package/dist/modules/companies/routes.d.ts.map +1 -1
- package/dist/modules/companies/routes.js +18 -0
- package/dist/modules/companies/routes.js.map +1 -1
- package/dist/modules/companies/schema.d.ts +37 -0
- package/dist/modules/companies/schema.d.ts.map +1 -1
- package/dist/modules/companies/schema.js +10 -1
- package/dist/modules/companies/schema.js.map +1 -1
- package/dist/modules/companies/service.d.ts +6 -0
- package/dist/modules/companies/service.d.ts.map +1 -1
- package/dist/modules/companies/service.js +45 -11
- 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 +21 -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/email-domain-linker/index.d.ts +12 -0
- package/dist/modules/email-domain-linker/index.d.ts.map +1 -0
- package/dist/modules/email-domain-linker/index.js +34 -0
- package/dist/modules/email-domain-linker/index.js.map +1 -0
- package/dist/modules/email-domain-linker/routes.d.ts +14 -0
- package/dist/modules/email-domain-linker/routes.d.ts.map +1 -0
- package/dist/modules/email-domain-linker/routes.js +15 -0
- package/dist/modules/email-domain-linker/routes.js.map +1 -0
- package/dist/modules/email-domain-linker/service.d.ts +37 -0
- package/dist/modules/email-domain-linker/service.d.ts.map +1 -0
- package/dist/modules/email-domain-linker/service.js +63 -0
- package/dist/modules/email-domain-linker/service.js.map +1 -0
- 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 +4 -0
- package/dist/modules/eventCatalogs.d.ts.map +1 -1
- package/dist/modules/eventCatalogs.js +4 -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/events.d.ts +42 -0
- package/dist/modules/lists/events.d.ts.map +1 -0
- package/dist/modules/lists/events.js +16 -0
- package/dist/modules/lists/events.js.map +1 -0
- package/dist/modules/lists/index.d.ts +10 -0
- package/dist/modules/lists/index.d.ts.map +1 -0
- package/dist/modules/lists/index.js +35 -0
- package/dist/modules/lists/index.js.map +1 -0
- package/dist/modules/lists/repository.d.ts +80 -0
- package/dist/modules/lists/repository.d.ts.map +1 -0
- package/dist/modules/lists/repository.js +178 -0
- package/dist/modules/lists/repository.js.map +1 -0
- package/dist/modules/lists/routes.d.ts +55 -0
- package/dist/modules/lists/routes.d.ts.map +1 -0
- package/dist/modules/lists/routes.js +168 -0
- package/dist/modules/lists/routes.js.map +1 -0
- package/dist/modules/lists/schema.d.ts +281 -0
- package/dist/modules/lists/schema.d.ts.map +1 -0
- package/dist/modules/lists/schema.js +83 -0
- package/dist/modules/lists/schema.js.map +1 -0
- package/dist/modules/lists/service.d.ts +82 -0
- package/dist/modules/lists/service.d.ts.map +1 -0
- package/dist/modules/lists/service.js +262 -0
- package/dist/modules/lists/service.js.map +1 -0
- package/dist/modules/lists/tools.d.ts +4 -0
- package/dist/modules/lists/tools.d.ts.map +1 -0
- package/dist/modules/lists/tools.js +86 -0
- package/dist/modules/lists/tools.js.map +1 -0
- 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 +11 -0
- package/dist/modules/people/repository.d.ts.map +1 -1
- package/dist/modules/people/repository.js +21 -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 +131 -36
- 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/positions/routes.d.ts.map +1 -1
- package/dist/modules/positions/routes.js +4 -2
- package/dist/modules/positions/routes.js.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 +160 -0
- package/dist/modules/sample-data/fixture.d.ts.map +1 -0
- package/dist/modules/sample-data/fixture.js +501 -0
- package/dist/modules/sample-data/fixture.js.map +1 -0
- package/dist/modules/sample-data/index.d.ts +11 -0
- package/dist/modules/sample-data/index.d.ts.map +1 -0
- package/dist/modules/sample-data/index.js +44 -0
- package/dist/modules/sample-data/index.js.map +1 -0
- package/dist/modules/sample-data/routes.d.ts +15 -0
- package/dist/modules/sample-data/routes.d.ts.map +1 -0
- package/dist/modules/sample-data/routes.js +25 -0
- package/dist/modules/sample-data/routes.js.map +1 -0
- package/dist/modules/sample-data/service.d.ts +39 -0
- package/dist/modules/sample-data/service.d.ts.map +1 -0
- package/dist/modules/sample-data/service.js +481 -0
- package/dist/modules/sample-data/service.js.map +1 -0
- package/dist/modules/sample-data/tools.d.ts +4 -0
- package/dist/modules/sample-data/tools.d.ts.map +1 -0
- package/dist/modules/sample-data/tools.js +22 -0
- package/dist/modules/sample-data/tools.js.map +1 -0
- 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/smtp-email/index.d.ts +1 -0
- package/dist/modules/smtp-email/index.d.ts.map +1 -1
- package/dist/modules/smtp-email/index.js +1 -0
- package/dist/modules/smtp-email/index.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 +20 -1
- 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 +4 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +4 -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/0021_certain_maggott.sql +30 -0
- package/migrations/0022_stormy_manta.sql +1 -0
- package/migrations/0023_funny_maddog.sql +1 -0
- 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/0021_snapshot.json +5389 -0
- package/migrations/meta/0022_snapshot.json +5396 -0
- package/migrations/meta/0023_snapshot.json +5403 -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 +112 -0
- package/package.json +3 -2
- package/src/lib/consumerEmailDomains.ts +62 -0
- package/src/lib/email.ts +7 -0
- package/src/lib/emailContent.ts +91 -0
- package/src/lib/emailDomainAutoLink.ts +165 -0
- package/src/lib/ids.ts +13 -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 +37 -3
- package/src/modules/auth/preferences.ts +13 -1
- package/src/modules/auth/routes.ts +22 -0
- package/src/modules/auth/schema.ts +12 -2
- package/src/modules/auth/service.ts +37 -3
- package/src/modules/companies/index.ts +3 -1
- package/src/modules/companies/repository.ts +3 -0
- package/src/modules/companies/routes.ts +20 -0
- package/src/modules/companies/schema.ts +11 -1
- package/src/modules/companies/service.ts +72 -12
- 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 +21 -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/email-domain-linker/index.ts +40 -0
- package/src/modules/email-domain-linker/routes.ts +40 -0
- package/src/modules/email-domain-linker/service.ts +122 -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 +4 -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/events.ts +41 -0
- package/src/modules/lists/index.ts +41 -0
- package/src/modules/lists/repository.ts +343 -0
- package/src/modules/lists/routes.ts +255 -0
- package/src/modules/lists/schema.ts +95 -0
- package/src/modules/lists/service.ts +505 -0
- package/src/modules/lists/tools.ts +128 -0
- 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 +31 -0
- package/src/modules/people/routes.ts +127 -18
- package/src/modules/people/schema.ts +109 -3
- package/src/modules/people/service.ts +205 -39
- package/src/modules/people/tools.ts +5 -1
- package/src/modules/personLinks.ts +278 -0
- package/src/modules/positions/routes.ts +4 -2
- 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 +690 -0
- package/src/modules/sample-data/index.ts +51 -0
- package/src/modules/sample-data/routes.ts +50 -0
- package/src/modules/sample-data/service.ts +679 -0
- package/src/modules/sample-data/tools.ts +32 -0
- 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/smtp-email/index.ts +8 -1
- 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 +27 -1
- package/src/modules/workspace/starters.ts +5 -0
- package/src/runtime/events.ts +1 -0
- package/src/schema/index.ts +4 -0
- package/src/testing/database.ts +97 -11
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { and, asc, eq, ilike, inArray, or } from 'drizzle-orm'
|
|
2
2
|
import type { SQL } from 'drizzle-orm'
|
|
3
|
+
import type { AnyPgColumn } from 'drizzle-orm/pg-core'
|
|
4
|
+
import type { FormSubmissionLinkTarget, PipelineKind } from '@kelpie/schemas'
|
|
3
5
|
|
|
4
6
|
import { keysetCondition, orderByWindow, textSort, timestampSort } from '../../lib/pagination.ts'
|
|
5
7
|
import type { ListWindow, SortableFields } from '../../lib/pagination.ts'
|
|
6
8
|
import { containsPattern } from '../../lib/search.ts'
|
|
7
9
|
import type { Queryable } from '../../runtime/transaction.ts'
|
|
8
|
-
import {
|
|
10
|
+
import { lists } from '../lists/schema.ts'
|
|
11
|
+
import type { RecordTargetType } from '../recordTargets.ts'
|
|
12
|
+
import { formAttachTargets, formFields, formLists, formSubmissions, forms } from './schema.ts'
|
|
9
13
|
|
|
10
14
|
export type FormRecord = typeof forms.$inferSelect
|
|
11
15
|
export type FormFieldRecord = typeof formFields.$inferSelect
|
|
@@ -209,6 +213,72 @@ export function listSubmissions(
|
|
|
209
213
|
.limit(window.fetchLimit)
|
|
210
214
|
}
|
|
211
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Maps each `FormSubmissionLinkTarget` (declared in `@kelpie/schemas`) to the
|
|
218
|
+
* drizzle column that names the record. Keeping the enum in schemas keeps the
|
|
219
|
+
* wire shape one source of truth; the column mapping lives here because it
|
|
220
|
+
* references types the schemas package cannot see.
|
|
221
|
+
*/
|
|
222
|
+
const SUBMISSION_LINK_COLUMNS: Readonly<Record<FormSubmissionLinkTarget, AnyPgColumn>> = {
|
|
223
|
+
person: formSubmissions.personId,
|
|
224
|
+
company: formSubmissions.companyId,
|
|
225
|
+
position: formSubmissions.positionId,
|
|
226
|
+
deal: formSubmissions.dealId,
|
|
227
|
+
opportunity: formSubmissions.opportunityId,
|
|
228
|
+
partnership: formSubmissions.partnershipId,
|
|
229
|
+
enquiry: formSubmissions.enquiryId,
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Lists submissions whose {target}_id points at `targetId`.
|
|
234
|
+
*
|
|
235
|
+
* The record itself is not checked here — the workspace scope and the FK
|
|
236
|
+
* filter are enough for a read. A caller reaching for a target from another
|
|
237
|
+
* workspace or one that no longer exists gets an empty page, which mirrors
|
|
238
|
+
* the answer any other cross-workspace read gives.
|
|
239
|
+
*/
|
|
240
|
+
export function listSubmissionsLinkedTo(
|
|
241
|
+
db: Queryable,
|
|
242
|
+
workspaceId: string,
|
|
243
|
+
target: FormSubmissionLinkTarget,
|
|
244
|
+
targetId: string,
|
|
245
|
+
window: ListWindow<FormSubmissionRecord>,
|
|
246
|
+
): Promise<FormSubmissionRecord[]> {
|
|
247
|
+
return db
|
|
248
|
+
.select()
|
|
249
|
+
.from(formSubmissions)
|
|
250
|
+
.where(
|
|
251
|
+
and(
|
|
252
|
+
eq(formSubmissions.workspaceId, workspaceId),
|
|
253
|
+
eq(SUBMISSION_LINK_COLUMNS[target], targetId),
|
|
254
|
+
keysetCondition(window, formSubmissions.id),
|
|
255
|
+
),
|
|
256
|
+
)
|
|
257
|
+
.orderBy(...orderByWindow(window, formSubmissions.id))
|
|
258
|
+
.limit(window.fetchLimit)
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export async function findSubmission(
|
|
262
|
+
db: Queryable,
|
|
263
|
+
workspaceId: string,
|
|
264
|
+
formId: string,
|
|
265
|
+
id: string,
|
|
266
|
+
): Promise<FormSubmissionRecord | undefined> {
|
|
267
|
+
const [row] = await db
|
|
268
|
+
.select()
|
|
269
|
+
.from(formSubmissions)
|
|
270
|
+
.where(
|
|
271
|
+
and(
|
|
272
|
+
eq(formSubmissions.workspaceId, workspaceId),
|
|
273
|
+
eq(formSubmissions.formId, formId),
|
|
274
|
+
eq(formSubmissions.id, id),
|
|
275
|
+
),
|
|
276
|
+
)
|
|
277
|
+
.limit(1)
|
|
278
|
+
|
|
279
|
+
return row
|
|
280
|
+
}
|
|
281
|
+
|
|
212
282
|
export async function insertSubmission(
|
|
213
283
|
db: Queryable,
|
|
214
284
|
values: FormSubmissionColumns,
|
|
@@ -221,3 +291,94 @@ export async function insertSubmission(
|
|
|
221
291
|
|
|
222
292
|
return created
|
|
223
293
|
}
|
|
294
|
+
|
|
295
|
+
/** One form's configured list memberships, joined to the list for target-type. */
|
|
296
|
+
export interface FormListRow {
|
|
297
|
+
readonly listId: string
|
|
298
|
+
readonly targetType: RecordTargetType
|
|
299
|
+
/**
|
|
300
|
+
* When the list has a consent purpose, form-driven adds capture consent
|
|
301
|
+
* against it. Carried through so submission.ts needs no second query.
|
|
302
|
+
*/
|
|
303
|
+
readonly consentPurposeId: string | null
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
export async function listFormLists(db: Queryable, formId: string): Promise<FormListRow[]> {
|
|
307
|
+
const rows = await db
|
|
308
|
+
.select({
|
|
309
|
+
listId: formLists.listId,
|
|
310
|
+
targetType: lists.targetType,
|
|
311
|
+
consentPurposeId: lists.consentPurposeId,
|
|
312
|
+
})
|
|
313
|
+
.from(formLists)
|
|
314
|
+
.innerJoin(lists, eq(lists.id, formLists.listId))
|
|
315
|
+
.where(eq(formLists.formId, formId))
|
|
316
|
+
.orderBy(asc(formLists.listId))
|
|
317
|
+
|
|
318
|
+
return rows.map((row) => ({
|
|
319
|
+
listId: row.listId,
|
|
320
|
+
targetType: row.targetType as RecordTargetType,
|
|
321
|
+
consentPurposeId: row.consentPurposeId,
|
|
322
|
+
}))
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
export async function replaceFormLists(
|
|
326
|
+
db: Queryable,
|
|
327
|
+
workspaceId: string,
|
|
328
|
+
formId: string,
|
|
329
|
+
listIds: readonly string[],
|
|
330
|
+
): Promise<void> {
|
|
331
|
+
await db.delete(formLists).where(eq(formLists.formId, formId))
|
|
332
|
+
|
|
333
|
+
if (listIds.length === 0) {
|
|
334
|
+
return
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
await db.insert(formLists).values(listIds.map((listId) => ({ workspaceId, formId, listId })))
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
/** One form's configured attach targets, ordered so a resent identical set is not a write. */
|
|
341
|
+
export interface FormAttachTargetRow {
|
|
342
|
+
readonly targetType: PipelineKind
|
|
343
|
+
readonly targetId: string
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export async function listAttachTargets(
|
|
347
|
+
db: Queryable,
|
|
348
|
+
formId: string,
|
|
349
|
+
): Promise<FormAttachTargetRow[]> {
|
|
350
|
+
const rows = await db
|
|
351
|
+
.select({ targetType: formAttachTargets.targetType, targetId: formAttachTargets.targetId })
|
|
352
|
+
.from(formAttachTargets)
|
|
353
|
+
.where(eq(formAttachTargets.formId, formId))
|
|
354
|
+
.orderBy(asc(formAttachTargets.targetType), asc(formAttachTargets.targetId))
|
|
355
|
+
|
|
356
|
+
return rows.map((row) => ({
|
|
357
|
+
targetType: row.targetType as PipelineKind,
|
|
358
|
+
targetId: row.targetId,
|
|
359
|
+
}))
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export async function replaceAttachTargets(
|
|
363
|
+
db: Queryable,
|
|
364
|
+
workspaceId: string,
|
|
365
|
+
formId: string,
|
|
366
|
+
targets: readonly FormAttachTargetRow[],
|
|
367
|
+
): Promise<void> {
|
|
368
|
+
await db.delete(formAttachTargets).where(eq(formAttachTargets.formId, formId))
|
|
369
|
+
|
|
370
|
+
if (targets.length === 0) {
|
|
371
|
+
return
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
await db
|
|
375
|
+
.insert(formAttachTargets)
|
|
376
|
+
.values(
|
|
377
|
+
targets.map((target) => ({
|
|
378
|
+
workspaceId,
|
|
379
|
+
formId,
|
|
380
|
+
targetType: target.targetType,
|
|
381
|
+
targetId: target.targetId,
|
|
382
|
+
})),
|
|
383
|
+
)
|
|
384
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import type { Context, Hono } from 'hono'
|
|
2
2
|
import { z } from 'zod'
|
|
3
|
+
import { FORM_SUBMISSION_LINK_TARGETS, PIPELINE_KINDS } from '@kelpie/schemas'
|
|
4
|
+
import type { FormAttachTarget, FormSubmissionLinkTarget } from '@kelpie/schemas'
|
|
3
5
|
|
|
4
6
|
import { AppError } from '../../lib/errors.ts'
|
|
5
7
|
import {
|
|
@@ -52,10 +54,19 @@ const fieldBody = z.strictObject({
|
|
|
52
54
|
map_to: z.enum(FORM_FIELD_MAP_TARGETS),
|
|
53
55
|
options: z.array(optionBody).default([]),
|
|
54
56
|
placeholder: z.string().nullable().default(null),
|
|
57
|
+
statement: z.string().nullable().default(null),
|
|
58
|
+
consent_purpose_ids: z.array(z.string().min(1)).default([]),
|
|
59
|
+
consent_purpose_labels: z.record(z.string().min(1), z.string()).default({}),
|
|
60
|
+
})
|
|
61
|
+
|
|
62
|
+
const attachTargetBody = z.strictObject({
|
|
63
|
+
target_type: z.enum(PIPELINE_KINDS),
|
|
64
|
+
target_id: z.string().min(1),
|
|
55
65
|
})
|
|
56
66
|
|
|
57
67
|
const formShape = {
|
|
58
68
|
name: z.string().min(1),
|
|
69
|
+
title: z.string().min(1),
|
|
59
70
|
description: z.string().nullable(),
|
|
60
71
|
status: z.enum(FORM_STATUSES),
|
|
61
72
|
fields: z.array(fieldBody),
|
|
@@ -63,6 +74,25 @@ const formShape = {
|
|
|
63
74
|
create_deal: z.boolean(),
|
|
64
75
|
deal_stage_id: z.string().min(1).nullable(),
|
|
65
76
|
deal_name_template: z.string().nullable(),
|
|
77
|
+
create_opportunity: z.boolean(),
|
|
78
|
+
opportunity_kind: z.string().nullable(),
|
|
79
|
+
opportunity_stage_id: z.string().min(1).nullable(),
|
|
80
|
+
opportunity_name_template: z.string().nullable(),
|
|
81
|
+
opportunity_owner_id: z.string().min(1).nullable(),
|
|
82
|
+
create_partnership: z.boolean(),
|
|
83
|
+
partnership_kind: z.string().nullable(),
|
|
84
|
+
partnership_stage_id: z.string().min(1).nullable(),
|
|
85
|
+
partnership_name_template: z.string().nullable(),
|
|
86
|
+
partnership_owner_id: z.string().min(1).nullable(),
|
|
87
|
+
create_enquiry: z.boolean(),
|
|
88
|
+
enquiry_source: z.string().nullable(),
|
|
89
|
+
enquiry_stage_id: z.string().min(1).nullable(),
|
|
90
|
+
enquiry_name_template: z.string().nullable(),
|
|
91
|
+
enquiry_owner_id: z.string().min(1).nullable(),
|
|
92
|
+
person_tags: z.array(z.string().min(1)),
|
|
93
|
+
company_tags: z.array(z.string().min(1)),
|
|
94
|
+
list_ids: z.array(z.string().min(1)),
|
|
95
|
+
attach_targets: z.array(attachTargetBody),
|
|
66
96
|
}
|
|
67
97
|
|
|
68
98
|
/**
|
|
@@ -76,12 +106,34 @@ const formShape = {
|
|
|
76
106
|
*/
|
|
77
107
|
export const createBody = z.strictObject({
|
|
78
108
|
...formShape,
|
|
109
|
+
// Absent → copy of `name` in `toCreateInput`, so a create that only names the
|
|
110
|
+
// form still gets a public heading without a second field on every caller.
|
|
111
|
+
title: formShape.title.optional(),
|
|
79
112
|
description: formShape.description.default(null),
|
|
80
113
|
status: formShape.status.default('active'),
|
|
81
114
|
thank_you_message: formShape.thank_you_message.default('Thanks. We will be in touch.'),
|
|
82
115
|
create_deal: formShape.create_deal.default(false),
|
|
83
116
|
deal_stage_id: formShape.deal_stage_id.default(null),
|
|
84
117
|
deal_name_template: formShape.deal_name_template.default(null),
|
|
118
|
+
create_opportunity: formShape.create_opportunity.default(false),
|
|
119
|
+
opportunity_kind: formShape.opportunity_kind.default(null),
|
|
120
|
+
opportunity_stage_id: formShape.opportunity_stage_id.default(null),
|
|
121
|
+
opportunity_name_template: formShape.opportunity_name_template.default(null),
|
|
122
|
+
opportunity_owner_id: formShape.opportunity_owner_id.default(null),
|
|
123
|
+
create_partnership: formShape.create_partnership.default(false),
|
|
124
|
+
partnership_kind: formShape.partnership_kind.default(null),
|
|
125
|
+
partnership_stage_id: formShape.partnership_stage_id.default(null),
|
|
126
|
+
partnership_name_template: formShape.partnership_name_template.default(null),
|
|
127
|
+
partnership_owner_id: formShape.partnership_owner_id.default(null),
|
|
128
|
+
create_enquiry: formShape.create_enquiry.default(false),
|
|
129
|
+
enquiry_source: formShape.enquiry_source.default(null),
|
|
130
|
+
enquiry_stage_id: formShape.enquiry_stage_id.default(null),
|
|
131
|
+
enquiry_name_template: formShape.enquiry_name_template.default(null),
|
|
132
|
+
enquiry_owner_id: formShape.enquiry_owner_id.default(null),
|
|
133
|
+
person_tags: formShape.person_tags.default([]),
|
|
134
|
+
company_tags: formShape.company_tags.default([]),
|
|
135
|
+
list_ids: formShape.list_ids.default([]),
|
|
136
|
+
attach_targets: formShape.attach_targets.default([]),
|
|
85
137
|
})
|
|
86
138
|
|
|
87
139
|
export const updateBody = z.strictObject(formShape).partial()
|
|
@@ -123,12 +175,20 @@ function toFieldDraft(field: z.infer<typeof fieldBody>): FieldDraft {
|
|
|
123
175
|
valueType: option.value_type,
|
|
124
176
|
})),
|
|
125
177
|
placeholder: field.placeholder,
|
|
178
|
+
statement: field.statement,
|
|
179
|
+
consentPurposeIds: field.consent_purpose_ids,
|
|
180
|
+
consentPurposeLabels: field.consent_purpose_labels,
|
|
126
181
|
}
|
|
127
182
|
}
|
|
128
183
|
|
|
184
|
+
function toAttachTarget(body: z.infer<typeof attachTargetBody>): FormAttachTarget {
|
|
185
|
+
return { targetType: body.target_type, targetId: body.target_id }
|
|
186
|
+
}
|
|
187
|
+
|
|
129
188
|
export function toCreateInput(body: z.infer<typeof createBody>): CreateFormInput {
|
|
130
189
|
return {
|
|
131
190
|
name: body.name,
|
|
191
|
+
title: body.title ?? body.name,
|
|
132
192
|
description: body.description,
|
|
133
193
|
status: body.status,
|
|
134
194
|
fields: body.fields.map(toFieldDraft),
|
|
@@ -136,12 +196,32 @@ export function toCreateInput(body: z.infer<typeof createBody>): CreateFormInput
|
|
|
136
196
|
createDeal: body.create_deal,
|
|
137
197
|
dealStageId: body.deal_stage_id,
|
|
138
198
|
dealNameTemplate: body.deal_name_template,
|
|
199
|
+
createOpportunity: body.create_opportunity,
|
|
200
|
+
opportunityKind: body.opportunity_kind,
|
|
201
|
+
opportunityStageId: body.opportunity_stage_id,
|
|
202
|
+
opportunityNameTemplate: body.opportunity_name_template,
|
|
203
|
+
opportunityOwnerId: body.opportunity_owner_id,
|
|
204
|
+
createPartnership: body.create_partnership,
|
|
205
|
+
partnershipKind: body.partnership_kind,
|
|
206
|
+
partnershipStageId: body.partnership_stage_id,
|
|
207
|
+
partnershipNameTemplate: body.partnership_name_template,
|
|
208
|
+
partnershipOwnerId: body.partnership_owner_id,
|
|
209
|
+
createEnquiry: body.create_enquiry,
|
|
210
|
+
enquirySource: body.enquiry_source,
|
|
211
|
+
enquiryStageId: body.enquiry_stage_id,
|
|
212
|
+
enquiryNameTemplate: body.enquiry_name_template,
|
|
213
|
+
enquiryOwnerId: body.enquiry_owner_id,
|
|
214
|
+
personTags: body.person_tags,
|
|
215
|
+
companyTags: body.company_tags,
|
|
216
|
+
listIds: body.list_ids,
|
|
217
|
+
attachTargets: body.attach_targets.map(toAttachTarget),
|
|
139
218
|
}
|
|
140
219
|
}
|
|
141
220
|
|
|
142
221
|
export function toUpdateInput(body: z.infer<typeof updateBody>): UpdateFormInput {
|
|
143
222
|
return {
|
|
144
223
|
...(body.name === undefined ? {} : { name: body.name }),
|
|
224
|
+
...(body.title === undefined ? {} : { title: body.title }),
|
|
145
225
|
...(body.description === undefined ? {} : { description: body.description }),
|
|
146
226
|
...(body.status === undefined ? {} : { status: body.status }),
|
|
147
227
|
...(body.fields === undefined ? {} : { fields: body.fields.map(toFieldDraft) }),
|
|
@@ -151,6 +231,45 @@ export function toUpdateInput(body: z.infer<typeof updateBody>): UpdateFormInput
|
|
|
151
231
|
...(body.deal_name_template === undefined
|
|
152
232
|
? {}
|
|
153
233
|
: { dealNameTemplate: body.deal_name_template }),
|
|
234
|
+
...(body.create_opportunity === undefined
|
|
235
|
+
? {}
|
|
236
|
+
: { createOpportunity: body.create_opportunity }),
|
|
237
|
+
...(body.opportunity_kind === undefined ? {} : { opportunityKind: body.opportunity_kind }),
|
|
238
|
+
...(body.opportunity_stage_id === undefined
|
|
239
|
+
? {}
|
|
240
|
+
: { opportunityStageId: body.opportunity_stage_id }),
|
|
241
|
+
...(body.opportunity_name_template === undefined
|
|
242
|
+
? {}
|
|
243
|
+
: { opportunityNameTemplate: body.opportunity_name_template }),
|
|
244
|
+
...(body.opportunity_owner_id === undefined
|
|
245
|
+
? {}
|
|
246
|
+
: { opportunityOwnerId: body.opportunity_owner_id }),
|
|
247
|
+
...(body.create_partnership === undefined
|
|
248
|
+
? {}
|
|
249
|
+
: { createPartnership: body.create_partnership }),
|
|
250
|
+
...(body.partnership_kind === undefined ? {} : { partnershipKind: body.partnership_kind }),
|
|
251
|
+
...(body.partnership_stage_id === undefined
|
|
252
|
+
? {}
|
|
253
|
+
: { partnershipStageId: body.partnership_stage_id }),
|
|
254
|
+
...(body.partnership_name_template === undefined
|
|
255
|
+
? {}
|
|
256
|
+
: { partnershipNameTemplate: body.partnership_name_template }),
|
|
257
|
+
...(body.partnership_owner_id === undefined
|
|
258
|
+
? {}
|
|
259
|
+
: { partnershipOwnerId: body.partnership_owner_id }),
|
|
260
|
+
...(body.create_enquiry === undefined ? {} : { createEnquiry: body.create_enquiry }),
|
|
261
|
+
...(body.enquiry_source === undefined ? {} : { enquirySource: body.enquiry_source }),
|
|
262
|
+
...(body.enquiry_stage_id === undefined ? {} : { enquiryStageId: body.enquiry_stage_id }),
|
|
263
|
+
...(body.enquiry_name_template === undefined
|
|
264
|
+
? {}
|
|
265
|
+
: { enquiryNameTemplate: body.enquiry_name_template }),
|
|
266
|
+
...(body.enquiry_owner_id === undefined ? {} : { enquiryOwnerId: body.enquiry_owner_id }),
|
|
267
|
+
...(body.person_tags === undefined ? {} : { personTags: body.person_tags }),
|
|
268
|
+
...(body.company_tags === undefined ? {} : { companyTags: body.company_tags }),
|
|
269
|
+
...(body.list_ids === undefined ? {} : { listIds: body.list_ids }),
|
|
270
|
+
...(body.attach_targets === undefined
|
|
271
|
+
? {}
|
|
272
|
+
: { attachTargets: body.attach_targets.map(toAttachTarget) }),
|
|
154
273
|
}
|
|
155
274
|
}
|
|
156
275
|
|
|
@@ -158,6 +277,7 @@ export function formResponse(form: FormView): Record<string, unknown> {
|
|
|
158
277
|
return {
|
|
159
278
|
id: form.id,
|
|
160
279
|
name: form.name,
|
|
280
|
+
title: form.title,
|
|
161
281
|
description: form.description,
|
|
162
282
|
status: form.status,
|
|
163
283
|
fields: form.fields.map((field) => ({
|
|
@@ -172,12 +292,37 @@ export function formResponse(form: FormView): Record<string, unknown> {
|
|
|
172
292
|
value_type: option.valueType,
|
|
173
293
|
})),
|
|
174
294
|
placeholder: field.placeholder,
|
|
295
|
+
statement: field.statement,
|
|
296
|
+
consent_purpose_ids: field.consentPurposeIds,
|
|
297
|
+
consent_purpose_labels: field.consentPurposeLabels,
|
|
175
298
|
sort_order: field.sortOrder,
|
|
176
299
|
})),
|
|
177
300
|
thank_you_message: form.thankYouMessage,
|
|
178
301
|
create_deal: form.createDeal,
|
|
179
302
|
deal_stage_id: form.dealStageId,
|
|
180
303
|
deal_name_template: form.dealNameTemplate,
|
|
304
|
+
create_opportunity: form.createOpportunity,
|
|
305
|
+
opportunity_kind: form.opportunityKind,
|
|
306
|
+
opportunity_stage_id: form.opportunityStageId,
|
|
307
|
+
opportunity_name_template: form.opportunityNameTemplate,
|
|
308
|
+
opportunity_owner_id: form.opportunityOwnerId,
|
|
309
|
+
create_partnership: form.createPartnership,
|
|
310
|
+
partnership_kind: form.partnershipKind,
|
|
311
|
+
partnership_stage_id: form.partnershipStageId,
|
|
312
|
+
partnership_name_template: form.partnershipNameTemplate,
|
|
313
|
+
partnership_owner_id: form.partnershipOwnerId,
|
|
314
|
+
create_enquiry: form.createEnquiry,
|
|
315
|
+
enquiry_source: form.enquirySource,
|
|
316
|
+
enquiry_stage_id: form.enquiryStageId,
|
|
317
|
+
enquiry_name_template: form.enquiryNameTemplate,
|
|
318
|
+
enquiry_owner_id: form.enquiryOwnerId,
|
|
319
|
+
person_tags: form.personTags,
|
|
320
|
+
company_tags: form.companyTags,
|
|
321
|
+
list_ids: form.listIds,
|
|
322
|
+
attach_targets: form.attachTargets.map((target) => ({
|
|
323
|
+
target_type: target.targetType,
|
|
324
|
+
target_id: target.targetId,
|
|
325
|
+
})),
|
|
181
326
|
public_key: form.publicKey,
|
|
182
327
|
created_at: form.createdAt.toISOString(),
|
|
183
328
|
updated_at: form.updatedAt.toISOString(),
|
|
@@ -194,15 +339,28 @@ export function formSubmissionResponse(submission: FormSubmissionView): Record<s
|
|
|
194
339
|
company_id: submission.companyId,
|
|
195
340
|
position_id: submission.positionId,
|
|
196
341
|
deal_id: submission.dealId,
|
|
342
|
+
opportunity_id: submission.opportunityId,
|
|
343
|
+
partnership_id: submission.partnershipId,
|
|
344
|
+
enquiry_id: submission.enquiryId,
|
|
345
|
+
action_log: submission.actionLog.map((entry) => ({
|
|
346
|
+
action: entry.action,
|
|
347
|
+
status: entry.status,
|
|
348
|
+
detail: entry.detail,
|
|
349
|
+
})),
|
|
197
350
|
created_at: submission.createdAt.toISOString(),
|
|
198
351
|
}
|
|
199
352
|
}
|
|
200
353
|
|
|
201
|
-
/** The absolute URL of a form's
|
|
354
|
+
/** The absolute URL of a form's bare iframe document (fields only). */
|
|
202
355
|
export function embedUrlFor(context: Context, publicKey: string): string {
|
|
203
356
|
return `${requestOrigin(context)}${PUBLIC_ROUTE_PREFIX}/forms/${publicKey}/embed`
|
|
204
357
|
}
|
|
205
358
|
|
|
359
|
+
/** The absolute URL of a form's standalone hosted page (brand chrome). */
|
|
360
|
+
export function hostedUrlFor(context: Context, publicKey: string): string {
|
|
361
|
+
return `${embedUrlFor(context, publicKey)}?view=page`
|
|
362
|
+
}
|
|
363
|
+
|
|
206
364
|
export function mountFormsRoutes(router: Hono, dependencies: FormsRoutesDependencies): void {
|
|
207
365
|
const requireActor = (context: Context): Promise<Actor> => resolveActorFrom(dependencies, context)
|
|
208
366
|
|
|
@@ -256,6 +414,53 @@ export function mountFormsRoutes(router: Hono, dependencies: FormsRoutesDependen
|
|
|
256
414
|
return context.json(pageBody(page, formSubmissionResponse))
|
|
257
415
|
})
|
|
258
416
|
|
|
417
|
+
/**
|
|
418
|
+
* Submissions filtered by the record they touched.
|
|
419
|
+
*
|
|
420
|
+
* `target_type` names one of the seven FK columns a submission carries
|
|
421
|
+
* (person, company, position, deal, opportunity, partnership, enquiry) and
|
|
422
|
+
* `target_id` is the record's id. Both are required — an unfiltered global
|
|
423
|
+
* list of submissions is deliberately not a route here, since a workspace's
|
|
424
|
+
* submissions live under their form, not as a top-level browse.
|
|
425
|
+
*/
|
|
426
|
+
router.get('/form-submissions', async (context) => {
|
|
427
|
+
const rawTargetType = context.req.query('target_type')
|
|
428
|
+
const targetId = context.req.query('target_id')
|
|
429
|
+
|
|
430
|
+
if (rawTargetType === undefined || targetId === undefined) {
|
|
431
|
+
throw AppError.validationFailed('target_type and target_id are required', [
|
|
432
|
+
{ field: 'target_type', message: 'Missing filter' },
|
|
433
|
+
{ field: 'target_id', message: 'Missing filter' },
|
|
434
|
+
])
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (!(FORM_SUBMISSION_LINK_TARGETS as readonly string[]).includes(rawTargetType)) {
|
|
438
|
+
throw AppError.validationFailed(
|
|
439
|
+
`target_type must be one of ${FORM_SUBMISSION_LINK_TARGETS.join(', ')}`,
|
|
440
|
+
[{ field: 'target_type', message: `Got ${rawTargetType}` }],
|
|
441
|
+
)
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
const page = await dependencies.service.listSubmissionsLinkedTo(
|
|
445
|
+
await requireActor(context),
|
|
446
|
+
rawTargetType as FormSubmissionLinkTarget,
|
|
447
|
+
targetId,
|
|
448
|
+
readListParameters(context),
|
|
449
|
+
)
|
|
450
|
+
|
|
451
|
+
return context.json(pageBody(page, formSubmissionResponse))
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
router.get('/forms/:id/submissions/:submissionId', async (context) => {
|
|
455
|
+
const submission = await dependencies.service.getSubmission(
|
|
456
|
+
await requireActor(context),
|
|
457
|
+
context.req.param('id'),
|
|
458
|
+
context.req.param('submissionId'),
|
|
459
|
+
)
|
|
460
|
+
|
|
461
|
+
return context.json(formSubmissionResponse(submission))
|
|
462
|
+
})
|
|
463
|
+
|
|
259
464
|
/**
|
|
260
465
|
* What to paste into a website.
|
|
261
466
|
*
|
|
@@ -265,10 +470,15 @@ export function mountFormsRoutes(router: Hono, dependencies: FormsRoutesDependen
|
|
|
265
470
|
*/
|
|
266
471
|
router.get('/forms/:id/embed', async (context) => {
|
|
267
472
|
const form = await dependencies.service.get(await requireActor(context), context.req.param('id'))
|
|
268
|
-
const snippets = embedSnippets(
|
|
473
|
+
const snippets = embedSnippets(
|
|
474
|
+
hostedUrlFor(context, form.publicKey),
|
|
475
|
+
embedUrlFor(context, form.publicKey),
|
|
476
|
+
form.id,
|
|
477
|
+
)
|
|
269
478
|
|
|
270
479
|
return context.json({
|
|
271
480
|
url: snippets.url,
|
|
481
|
+
embed_url: snippets.embedUrl,
|
|
272
482
|
iframe_snippet: snippets.iframe,
|
|
273
483
|
script_snippet: snippets.script,
|
|
274
484
|
})
|