@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
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { and, eq, ilike, inArray, or, sql } from 'drizzle-orm';
|
|
2
|
+
import { keysetCondition, orderByWindow, textSort, timestampSort } from '../../lib/pagination.js';
|
|
3
|
+
import { arrayContainsPattern, containsPattern } from '../../lib/search.js';
|
|
4
|
+
import { companies } from '../companies/schema.js';
|
|
5
|
+
import { anyPersonLinked } from '../personLinks.js';
|
|
6
|
+
import { workspaceMembers } from '../workspace/schema.js';
|
|
7
|
+
import { enquiries } from './schema.js';
|
|
8
|
+
/** The sort fields `?sort=` documents. */
|
|
9
|
+
export const ENQUIRY_SORTS = {
|
|
10
|
+
name: textSort(enquiries.name, (enquiry) => enquiry.name),
|
|
11
|
+
created_at: timestampSort(enquiries.createdAt, (enquiry) => enquiry.createdAt),
|
|
12
|
+
updated_at: timestampSort(enquiries.updatedAt, (enquiry) => enquiry.updatedAt),
|
|
13
|
+
};
|
|
14
|
+
export const DEFAULT_ENQUIRY_SORT = '-created_at';
|
|
15
|
+
/**
|
|
16
|
+
* The company half of `?q=`. Reads the `companies` *table*, never its
|
|
17
|
+
* repository, the rule set for a filter spanning a relation (`architecture.md`).
|
|
18
|
+
*/
|
|
19
|
+
function companyNameMatches(pattern) {
|
|
20
|
+
return sql `exists (
|
|
21
|
+
select 1
|
|
22
|
+
from ${companies}
|
|
23
|
+
where ${companies.id} = ${enquiries.companyId}
|
|
24
|
+
and ${companies.workspaceId} = ${enquiries.workspaceId}
|
|
25
|
+
and ${companies.name} ilike ${pattern}
|
|
26
|
+
)`;
|
|
27
|
+
}
|
|
28
|
+
function matchesTerm(term) {
|
|
29
|
+
const pattern = containsPattern(term);
|
|
30
|
+
return or(ilike(enquiries.name, pattern), ilike(enquiries.source, pattern), ilike(enquiries.summary, pattern), arrayContainsPattern(enquiries.tags, pattern), companyNameMatches(pattern));
|
|
31
|
+
}
|
|
32
|
+
function conditionsFor(workspaceId, filters) {
|
|
33
|
+
return [
|
|
34
|
+
eq(enquiries.workspaceId, workspaceId),
|
|
35
|
+
filters.term === undefined ? undefined : matchesTerm(filters.term),
|
|
36
|
+
filters.sources === undefined ? undefined : inArray(enquiries.source, filters.sources),
|
|
37
|
+
filters.companyIds === undefined
|
|
38
|
+
? undefined
|
|
39
|
+
: inArray(enquiries.companyId, filters.companyIds),
|
|
40
|
+
filters.stageIds === undefined ? undefined : inArray(enquiries.stageId, filters.stageIds),
|
|
41
|
+
filters.personIds === undefined
|
|
42
|
+
? undefined
|
|
43
|
+
: anyPersonLinked('enquiry', enquiries.id, enquiries.workspaceId, filters.personIds),
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
/** @returns Up to `window.fetchLimit` rows: one more than the page, so the caller can tell there is a next one. */
|
|
47
|
+
export function listEnquiries(db, workspaceId, filters, window) {
|
|
48
|
+
return db
|
|
49
|
+
.select()
|
|
50
|
+
.from(enquiries)
|
|
51
|
+
.where(and(...conditionsFor(workspaceId, filters), keysetCondition(window, enquiries.id)))
|
|
52
|
+
.orderBy(...orderByWindow(window, enquiries.id))
|
|
53
|
+
.limit(window.fetchLimit);
|
|
54
|
+
}
|
|
55
|
+
export async function findEnquiry(db, workspaceId, id) {
|
|
56
|
+
const [found] = await db
|
|
57
|
+
.select()
|
|
58
|
+
.from(enquiries)
|
|
59
|
+
.where(and(eq(enquiries.workspaceId, workspaceId), eq(enquiries.id, id)))
|
|
60
|
+
.limit(1);
|
|
61
|
+
return found;
|
|
62
|
+
}
|
|
63
|
+
export async function insertEnquiry(db, values) {
|
|
64
|
+
const [created] = await db.insert(enquiries).values(values).returning();
|
|
65
|
+
if (created === undefined) {
|
|
66
|
+
throw new Error(`Inserting enquiry ${values.id} returned no row`);
|
|
67
|
+
}
|
|
68
|
+
return created;
|
|
69
|
+
}
|
|
70
|
+
export async function updateEnquiry(db, workspaceId, id, changes) {
|
|
71
|
+
const [updated] = await db
|
|
72
|
+
.update(enquiries)
|
|
73
|
+
.set(changes)
|
|
74
|
+
.where(and(eq(enquiries.workspaceId, workspaceId), eq(enquiries.id, id)))
|
|
75
|
+
.returning();
|
|
76
|
+
return updated;
|
|
77
|
+
}
|
|
78
|
+
export async function deleteEnquiry(db, workspaceId, id) {
|
|
79
|
+
const deleted = await db
|
|
80
|
+
.delete(enquiries)
|
|
81
|
+
.where(and(eq(enquiries.workspaceId, workspaceId), eq(enquiries.id, id)))
|
|
82
|
+
.returning({ id: enquiries.id });
|
|
83
|
+
return deleted.length;
|
|
84
|
+
}
|
|
85
|
+
/** Whether a member belongs to this workspace, for validating `owner_id`. */
|
|
86
|
+
export async function memberExists(db, workspaceId, memberId) {
|
|
87
|
+
const [found] = await db
|
|
88
|
+
.select({ id: workspaceMembers.id })
|
|
89
|
+
.from(workspaceMembers)
|
|
90
|
+
.where(and(eq(workspaceMembers.workspaceId, workspaceId), eq(workspaceMembers.id, memberId)))
|
|
91
|
+
.limit(1);
|
|
92
|
+
return found !== undefined;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=repository.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"repository.js","sourceRoot":"","sources":["../../../src/modules/enquiries/repository.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAG9D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAA;AAEjG,OAAO,EAAE,oBAAoB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAE3E,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAA;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAOvC,0CAA0C;AAC1C,MAAM,CAAC,MAAM,aAAa,GAAkC;IAC1D,IAAI,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC;IACzD,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;IAC9E,UAAU,EAAE,aAAa,CAAC,SAAS,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC;CAC/E,CAAA;AAED,MAAM,CAAC,MAAM,oBAAoB,GAAG,aAAa,CAAA;AAejD;;;GAGG;AACH,SAAS,kBAAkB,CAAC,OAAe;IACzC,OAAO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AAE,CAAC,gBAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;SAC5F,KAAK,CAAC,CAAC,CAAC,CAAA;IAEX,OAAO,KAAK,KAAK,SAAS,CAAA;AAC5B,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Hono } from 'hono';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import type { CredentialDependencies } from '../auth/credentials.ts';
|
|
4
|
+
import type { CreateEnquiryInput, EnquiriesService, EnquiryView, UpdateEnquiryInput } from './service.ts';
|
|
5
|
+
/**
|
|
6
|
+
* Only `name` is required: an enquiry need not belong to a company. An absent
|
|
7
|
+
* `stage_id` lands in the pipeline's first open stage and an absent
|
|
8
|
+
* `owner_id` goes to the caller, both resolved in the service. `source`
|
|
9
|
+
* defaults to empty; an unclassified enquiry should read as unclassified.
|
|
10
|
+
*/
|
|
11
|
+
export declare const createBody: z.ZodObject<{
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
source: z.ZodDefault<z.ZodString>;
|
|
14
|
+
stage_id: z.ZodOptional<z.ZodString>;
|
|
15
|
+
company_id: z.ZodDefault<z.ZodNullable<z.ZodString>>;
|
|
16
|
+
owner_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
17
|
+
person_ids: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
18
|
+
summary: z.ZodDefault<z.ZodString>;
|
|
19
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
20
|
+
custom_fields: z.ZodDefault<z.ZodType<Readonly<Record<string, string | number | boolean | string[] | {
|
|
21
|
+
amount_cents: number;
|
|
22
|
+
currency: string;
|
|
23
|
+
} | null>>, unknown, z.core.$ZodTypeInternals<Readonly<Record<string, string | number | boolean | string[] | {
|
|
24
|
+
amount_cents: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
} | null>>, unknown>>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export declare const updateBody: z.ZodObject<{
|
|
29
|
+
name: z.ZodOptional<z.ZodString>;
|
|
30
|
+
source: z.ZodOptional<z.ZodString>;
|
|
31
|
+
stage_id: z.ZodOptional<z.ZodString>;
|
|
32
|
+
company_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
33
|
+
owner_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
34
|
+
person_ids: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
35
|
+
summary: z.ZodOptional<z.ZodString>;
|
|
36
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
37
|
+
custom_fields: z.ZodOptional<z.ZodType<Readonly<Record<string, string | number | boolean | string[] | {
|
|
38
|
+
amount_cents: number;
|
|
39
|
+
currency: string;
|
|
40
|
+
} | null>>, unknown, z.core.$ZodTypeInternals<Readonly<Record<string, string | number | boolean | string[] | {
|
|
41
|
+
amount_cents: number;
|
|
42
|
+
currency: string;
|
|
43
|
+
} | null>>, unknown>>>;
|
|
44
|
+
}, z.core.$strict>;
|
|
45
|
+
export interface EnquiriesRoutesDependencies extends CredentialDependencies {
|
|
46
|
+
readonly service: EnquiriesService;
|
|
47
|
+
}
|
|
48
|
+
export declare function toCreateInput(body: z.infer<typeof createBody>): CreateEnquiryInput;
|
|
49
|
+
export declare function toUpdateInput(body: z.infer<typeof updateBody>): UpdateEnquiryInput;
|
|
50
|
+
export declare function enquiryResponse(enquiry: EnquiryView): Record<string, unknown>;
|
|
51
|
+
export declare function mountEnquiriesRoutes(router: Hono, dependencies: EnquiriesRoutesDependencies): void;
|
|
52
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/modules/enquiries/routes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAKvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAGpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAsBzG;;;;;GAKG;AACH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;kBAUrB,CAAA;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;kBAAyC,CAAA;AAEhE,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,QAAQ,CAAC,OAAO,EAAE,gBAAgB,CAAA;CACnC;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,GAAG,kBAAkB,CAYlF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,GAAG,kBAAkB,CAYlF;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAgB7E;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,2BAA2B,GACxC,IAAI,CAkEN"}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { customFieldsPatchShape } from '@kelpie/schemas';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { pageBody, readIdFilter, readJsonBody, readListParameters } from '../../lib/http.js';
|
|
4
|
+
import { resolveActorFrom } from '../auth/credentials.js';
|
|
5
|
+
import { renderCustomFieldsForWire } from '../custom-fields/wire.js';
|
|
6
|
+
import { dealResponse } from '../deals/routes.js';
|
|
7
|
+
/** Wire shapes for `/v1/enquiries`. Bodies are strict; an unknown field is a 422, per `api.md`. */
|
|
8
|
+
/**
|
|
9
|
+
* The full field set, without defaults. `createBody` adds those; `updateBody`
|
|
10
|
+
* makes it partial. `converted_deal_id` is read-only: it is set only by
|
|
11
|
+
* `POST /v1/enquiries/:id/convert`, so it is not in this shape and any
|
|
12
|
+
* `PATCH` that carries it is `422`.
|
|
13
|
+
*/
|
|
14
|
+
const enquiryShape = {
|
|
15
|
+
name: z.string().min(1),
|
|
16
|
+
source: z.string(),
|
|
17
|
+
stage_id: z.string().min(1),
|
|
18
|
+
company_id: z.string().min(1).nullable(),
|
|
19
|
+
owner_id: z.string().min(1).nullable(),
|
|
20
|
+
person_ids: z.array(z.string().min(1)),
|
|
21
|
+
summary: z.string(),
|
|
22
|
+
tags: z.array(z.string().min(1)),
|
|
23
|
+
custom_fields: customFieldsPatchShape,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* Only `name` is required: an enquiry need not belong to a company. An absent
|
|
27
|
+
* `stage_id` lands in the pipeline's first open stage and an absent
|
|
28
|
+
* `owner_id` goes to the caller, both resolved in the service. `source`
|
|
29
|
+
* defaults to empty; an unclassified enquiry should read as unclassified.
|
|
30
|
+
*/
|
|
31
|
+
export const createBody = z.strictObject({
|
|
32
|
+
...enquiryShape,
|
|
33
|
+
source: enquiryShape.source.default(''),
|
|
34
|
+
stage_id: enquiryShape.stage_id.optional(),
|
|
35
|
+
company_id: enquiryShape.company_id.default(null),
|
|
36
|
+
owner_id: enquiryShape.owner_id.optional(),
|
|
37
|
+
person_ids: enquiryShape.person_ids.default([]),
|
|
38
|
+
summary: enquiryShape.summary.default(''),
|
|
39
|
+
tags: enquiryShape.tags.default([]),
|
|
40
|
+
custom_fields: enquiryShape.custom_fields.default({}),
|
|
41
|
+
});
|
|
42
|
+
export const updateBody = z.strictObject(enquiryShape).partial();
|
|
43
|
+
export function toCreateInput(body) {
|
|
44
|
+
return {
|
|
45
|
+
name: body.name,
|
|
46
|
+
source: body.source,
|
|
47
|
+
stageId: body.stage_id,
|
|
48
|
+
companyId: body.company_id,
|
|
49
|
+
ownerId: body.owner_id,
|
|
50
|
+
personIds: body.person_ids,
|
|
51
|
+
summary: body.summary,
|
|
52
|
+
tags: body.tags,
|
|
53
|
+
customFields: body.custom_fields,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function toUpdateInput(body) {
|
|
57
|
+
return {
|
|
58
|
+
...(body.name === undefined ? {} : { name: body.name }),
|
|
59
|
+
...(body.source === undefined ? {} : { source: body.source }),
|
|
60
|
+
...(body.stage_id === undefined ? {} : { stageId: body.stage_id }),
|
|
61
|
+
...(body.company_id === undefined ? {} : { companyId: body.company_id }),
|
|
62
|
+
...(body.owner_id === undefined ? {} : { ownerId: body.owner_id }),
|
|
63
|
+
...(body.person_ids === undefined ? {} : { personIds: body.person_ids }),
|
|
64
|
+
...(body.summary === undefined ? {} : { summary: body.summary }),
|
|
65
|
+
...(body.tags === undefined ? {} : { tags: body.tags }),
|
|
66
|
+
...(body.custom_fields === undefined ? {} : { customFields: body.custom_fields }),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export function enquiryResponse(enquiry) {
|
|
70
|
+
return {
|
|
71
|
+
id: enquiry.id,
|
|
72
|
+
name: enquiry.name,
|
|
73
|
+
source: enquiry.source,
|
|
74
|
+
stage_id: enquiry.stageId,
|
|
75
|
+
company_id: enquiry.companyId,
|
|
76
|
+
owner_id: enquiry.ownerId,
|
|
77
|
+
converted_deal_id: enquiry.convertedDealId,
|
|
78
|
+
person_ids: enquiry.personIds,
|
|
79
|
+
summary: enquiry.summary,
|
|
80
|
+
tags: enquiry.tags,
|
|
81
|
+
custom_fields: renderCustomFieldsForWire(enquiry.customFields),
|
|
82
|
+
created_at: enquiry.createdAt.toISOString(),
|
|
83
|
+
updated_at: enquiry.updatedAt.toISOString(),
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
export function mountEnquiriesRoutes(router, dependencies) {
|
|
87
|
+
const requireActor = (context) => resolveActorFrom(dependencies, context);
|
|
88
|
+
router.get('/enquiries', async (context) => {
|
|
89
|
+
const page = await dependencies.service.list(await requireActor(context), {
|
|
90
|
+
term: context.req.query('q'),
|
|
91
|
+
sources: readIdFilter(context, 'source'),
|
|
92
|
+
companyIds: readIdFilter(context, 'company_id'),
|
|
93
|
+
stageIds: readIdFilter(context, 'stage_id'),
|
|
94
|
+
personIds: readIdFilter(context, 'person_id'),
|
|
95
|
+
}, readListParameters(context));
|
|
96
|
+
return context.json(pageBody(page, enquiryResponse));
|
|
97
|
+
});
|
|
98
|
+
router.post('/enquiries', async (context) => {
|
|
99
|
+
const body = await readJsonBody(context, createBody);
|
|
100
|
+
const enquiry = await dependencies.service.create(await requireActor(context), toCreateInput(body));
|
|
101
|
+
return context.json(enquiryResponse(enquiry), 201);
|
|
102
|
+
});
|
|
103
|
+
router.get('/enquiries/:id', async (context) => {
|
|
104
|
+
const enquiry = await dependencies.service.get(await requireActor(context), context.req.param('id'));
|
|
105
|
+
return context.json(enquiryResponse(enquiry));
|
|
106
|
+
});
|
|
107
|
+
router.patch('/enquiries/:id', async (context) => {
|
|
108
|
+
const body = await readJsonBody(context, updateBody);
|
|
109
|
+
const enquiry = await dependencies.service.update(await requireActor(context), context.req.param('id'), toUpdateInput(body));
|
|
110
|
+
return context.json(enquiryResponse(enquiry));
|
|
111
|
+
});
|
|
112
|
+
router.delete('/enquiries/:id', async (context) => {
|
|
113
|
+
await dependencies.service.remove(await requireActor(context), context.req.param('id'));
|
|
114
|
+
return context.body(null, 204);
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* Convert an enquiry to a deal. Idempotent-ish: a second call 409s and
|
|
118
|
+
* carries the existing deal id in `details`. Returns the freshly created
|
|
119
|
+
* deal, wire-shaped, so the caller can navigate straight to it.
|
|
120
|
+
*/
|
|
121
|
+
router.post('/enquiries/:id/convert', async (context) => {
|
|
122
|
+
const { deal, personIds } = await dependencies.service.convertToDeal(await requireActor(context), context.req.param('id'));
|
|
123
|
+
const { workspaceId: _workspaceId, ...dealView } = deal;
|
|
124
|
+
return context.json(dealResponse({ ...dealView, personIds }), 201);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=routes.js.map
|
|
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CAAA;IAEF,MAAM,CAAC,MAAM,CAAC,gBAAgB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QAChD,MAAM,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,YAAY,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;QAEvF,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAChC,CAAC,CAAC,CAAA;IAEF;;;;OAIG;IACH,MAAM,CAAC,IAAI,CAAC,wBAAwB,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;QACtD,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,MAAM,YAAY,CAAC,OAAO,CAAC,aAAa,CAClE,MAAM,YAAY,CAAC,OAAO,CAAC,EAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CACxB,CAAA;QACD,MAAM,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAA;QAEvD,OAAO,OAAO,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,GAAG,QAAQ,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;IACpE,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
import type { CustomFieldValue } from '@kelpie/schemas';
|
|
2
|
+
/**
|
|
3
|
+
* Enquiries: the top-of-funnel pipeline. An inbound request — website form,
|
|
4
|
+
* email, referral — that may become a Deal once qualified.
|
|
5
|
+
*
|
|
6
|
+
* `source` is free text like Opportunity's `kind`; a form is a source, and the
|
|
7
|
+
* kinds a workspace uses vary. `company_id` is nullable because an early
|
|
8
|
+
* enquiry may arrive before a company is on file. `converted_deal_id` becomes
|
|
9
|
+
* non-null when the enquiry is converted via
|
|
10
|
+
* `POST /v1/enquiries/:id/convert`; deleting the deal nulls it back so a
|
|
11
|
+
* fresh conversion is possible.
|
|
12
|
+
*/
|
|
13
|
+
export declare const enquiries: import("drizzle-orm/pg-core").PgTableWithColumns<{
|
|
14
|
+
name: "enquiries";
|
|
15
|
+
schema: undefined;
|
|
16
|
+
columns: {
|
|
17
|
+
id: import("drizzle-orm/pg-core").PgColumn<{
|
|
18
|
+
name: "id";
|
|
19
|
+
tableName: "enquiries";
|
|
20
|
+
dataType: "string";
|
|
21
|
+
columnType: "PgText";
|
|
22
|
+
data: string;
|
|
23
|
+
driverParam: string;
|
|
24
|
+
notNull: true;
|
|
25
|
+
hasDefault: false;
|
|
26
|
+
isPrimaryKey: true;
|
|
27
|
+
isAutoincrement: false;
|
|
28
|
+
hasRuntimeDefault: false;
|
|
29
|
+
enumValues: [string, ...string[]];
|
|
30
|
+
baseColumn: never;
|
|
31
|
+
identity: undefined;
|
|
32
|
+
generated: undefined;
|
|
33
|
+
}, {}, {}>;
|
|
34
|
+
workspaceId: import("drizzle-orm/pg-core").PgColumn<{
|
|
35
|
+
name: "workspace_id";
|
|
36
|
+
tableName: "enquiries";
|
|
37
|
+
dataType: "string";
|
|
38
|
+
columnType: "PgText";
|
|
39
|
+
data: string;
|
|
40
|
+
driverParam: string;
|
|
41
|
+
notNull: true;
|
|
42
|
+
hasDefault: false;
|
|
43
|
+
isPrimaryKey: false;
|
|
44
|
+
isAutoincrement: false;
|
|
45
|
+
hasRuntimeDefault: false;
|
|
46
|
+
enumValues: [string, ...string[]];
|
|
47
|
+
baseColumn: never;
|
|
48
|
+
identity: undefined;
|
|
49
|
+
generated: undefined;
|
|
50
|
+
}, {}, {}>;
|
|
51
|
+
name: import("drizzle-orm/pg-core").PgColumn<{
|
|
52
|
+
name: "name";
|
|
53
|
+
tableName: "enquiries";
|
|
54
|
+
dataType: "string";
|
|
55
|
+
columnType: "PgText";
|
|
56
|
+
data: string;
|
|
57
|
+
driverParam: string;
|
|
58
|
+
notNull: true;
|
|
59
|
+
hasDefault: false;
|
|
60
|
+
isPrimaryKey: false;
|
|
61
|
+
isAutoincrement: false;
|
|
62
|
+
hasRuntimeDefault: false;
|
|
63
|
+
enumValues: [string, ...string[]];
|
|
64
|
+
baseColumn: never;
|
|
65
|
+
identity: undefined;
|
|
66
|
+
generated: undefined;
|
|
67
|
+
}, {}, {}>;
|
|
68
|
+
source: import("drizzle-orm/pg-core").PgColumn<{
|
|
69
|
+
name: "source";
|
|
70
|
+
tableName: "enquiries";
|
|
71
|
+
dataType: "string";
|
|
72
|
+
columnType: "PgText";
|
|
73
|
+
data: string;
|
|
74
|
+
driverParam: string;
|
|
75
|
+
notNull: true;
|
|
76
|
+
hasDefault: true;
|
|
77
|
+
isPrimaryKey: false;
|
|
78
|
+
isAutoincrement: false;
|
|
79
|
+
hasRuntimeDefault: false;
|
|
80
|
+
enumValues: [string, ...string[]];
|
|
81
|
+
baseColumn: never;
|
|
82
|
+
identity: undefined;
|
|
83
|
+
generated: undefined;
|
|
84
|
+
}, {}, {}>;
|
|
85
|
+
stageId: import("drizzle-orm/pg-core").PgColumn<{
|
|
86
|
+
name: "stage_id";
|
|
87
|
+
tableName: "enquiries";
|
|
88
|
+
dataType: "string";
|
|
89
|
+
columnType: "PgText";
|
|
90
|
+
data: string;
|
|
91
|
+
driverParam: string;
|
|
92
|
+
notNull: true;
|
|
93
|
+
hasDefault: false;
|
|
94
|
+
isPrimaryKey: false;
|
|
95
|
+
isAutoincrement: false;
|
|
96
|
+
hasRuntimeDefault: false;
|
|
97
|
+
enumValues: [string, ...string[]];
|
|
98
|
+
baseColumn: never;
|
|
99
|
+
identity: undefined;
|
|
100
|
+
generated: undefined;
|
|
101
|
+
}, {}, {}>;
|
|
102
|
+
companyId: import("drizzle-orm/pg-core").PgColumn<{
|
|
103
|
+
name: "company_id";
|
|
104
|
+
tableName: "enquiries";
|
|
105
|
+
dataType: "string";
|
|
106
|
+
columnType: "PgText";
|
|
107
|
+
data: string;
|
|
108
|
+
driverParam: string;
|
|
109
|
+
notNull: false;
|
|
110
|
+
hasDefault: false;
|
|
111
|
+
isPrimaryKey: false;
|
|
112
|
+
isAutoincrement: false;
|
|
113
|
+
hasRuntimeDefault: false;
|
|
114
|
+
enumValues: [string, ...string[]];
|
|
115
|
+
baseColumn: never;
|
|
116
|
+
identity: undefined;
|
|
117
|
+
generated: undefined;
|
|
118
|
+
}, {}, {}>;
|
|
119
|
+
ownerId: import("drizzle-orm/pg-core").PgColumn<{
|
|
120
|
+
name: "owner_id";
|
|
121
|
+
tableName: "enquiries";
|
|
122
|
+
dataType: "string";
|
|
123
|
+
columnType: "PgText";
|
|
124
|
+
data: string;
|
|
125
|
+
driverParam: string;
|
|
126
|
+
notNull: false;
|
|
127
|
+
hasDefault: false;
|
|
128
|
+
isPrimaryKey: false;
|
|
129
|
+
isAutoincrement: false;
|
|
130
|
+
hasRuntimeDefault: false;
|
|
131
|
+
enumValues: [string, ...string[]];
|
|
132
|
+
baseColumn: never;
|
|
133
|
+
identity: undefined;
|
|
134
|
+
generated: undefined;
|
|
135
|
+
}, {}, {}>;
|
|
136
|
+
convertedDealId: import("drizzle-orm/pg-core").PgColumn<{
|
|
137
|
+
name: "converted_deal_id";
|
|
138
|
+
tableName: "enquiries";
|
|
139
|
+
dataType: "string";
|
|
140
|
+
columnType: "PgText";
|
|
141
|
+
data: string;
|
|
142
|
+
driverParam: string;
|
|
143
|
+
notNull: false;
|
|
144
|
+
hasDefault: false;
|
|
145
|
+
isPrimaryKey: false;
|
|
146
|
+
isAutoincrement: false;
|
|
147
|
+
hasRuntimeDefault: false;
|
|
148
|
+
enumValues: [string, ...string[]];
|
|
149
|
+
baseColumn: never;
|
|
150
|
+
identity: undefined;
|
|
151
|
+
generated: undefined;
|
|
152
|
+
}, {}, {}>;
|
|
153
|
+
summary: import("drizzle-orm/pg-core").PgColumn<{
|
|
154
|
+
name: "summary";
|
|
155
|
+
tableName: "enquiries";
|
|
156
|
+
dataType: "string";
|
|
157
|
+
columnType: "PgText";
|
|
158
|
+
data: string;
|
|
159
|
+
driverParam: string;
|
|
160
|
+
notNull: true;
|
|
161
|
+
hasDefault: true;
|
|
162
|
+
isPrimaryKey: false;
|
|
163
|
+
isAutoincrement: false;
|
|
164
|
+
hasRuntimeDefault: false;
|
|
165
|
+
enumValues: [string, ...string[]];
|
|
166
|
+
baseColumn: never;
|
|
167
|
+
identity: undefined;
|
|
168
|
+
generated: undefined;
|
|
169
|
+
}, {}, {}>;
|
|
170
|
+
tags: import("drizzle-orm/pg-core").PgColumn<{
|
|
171
|
+
name: "tags";
|
|
172
|
+
tableName: "enquiries";
|
|
173
|
+
dataType: "array";
|
|
174
|
+
columnType: "PgArray";
|
|
175
|
+
data: string[];
|
|
176
|
+
driverParam: string | string[];
|
|
177
|
+
notNull: true;
|
|
178
|
+
hasDefault: true;
|
|
179
|
+
isPrimaryKey: false;
|
|
180
|
+
isAutoincrement: false;
|
|
181
|
+
hasRuntimeDefault: false;
|
|
182
|
+
enumValues: [string, ...string[]];
|
|
183
|
+
baseColumn: import("drizzle-orm").Column<{
|
|
184
|
+
name: "tags";
|
|
185
|
+
tableName: "enquiries";
|
|
186
|
+
dataType: "string";
|
|
187
|
+
columnType: "PgText";
|
|
188
|
+
data: string;
|
|
189
|
+
driverParam: string;
|
|
190
|
+
notNull: false;
|
|
191
|
+
hasDefault: false;
|
|
192
|
+
isPrimaryKey: false;
|
|
193
|
+
isAutoincrement: false;
|
|
194
|
+
hasRuntimeDefault: false;
|
|
195
|
+
enumValues: [string, ...string[]];
|
|
196
|
+
baseColumn: never;
|
|
197
|
+
identity: undefined;
|
|
198
|
+
generated: undefined;
|
|
199
|
+
}, {}, {}>;
|
|
200
|
+
identity: undefined;
|
|
201
|
+
generated: undefined;
|
|
202
|
+
}, {}, {
|
|
203
|
+
baseBuilder: import("drizzle-orm/pg-core").PgColumnBuilder<{
|
|
204
|
+
name: "tags";
|
|
205
|
+
dataType: 'string';
|
|
206
|
+
columnType: 'PgText';
|
|
207
|
+
data: string;
|
|
208
|
+
enumValues: [string, ...string[]];
|
|
209
|
+
driverParam: string;
|
|
210
|
+
}, {}, {}, import("drizzle-orm").ColumnBuilderExtraConfig>;
|
|
211
|
+
size: undefined;
|
|
212
|
+
}>;
|
|
213
|
+
customFields: import("drizzle-orm/pg-core").PgColumn<{
|
|
214
|
+
name: "custom_fields";
|
|
215
|
+
tableName: "enquiries";
|
|
216
|
+
dataType: "json";
|
|
217
|
+
columnType: "PgJsonb";
|
|
218
|
+
data: Readonly<Record<string, CustomFieldValue>>;
|
|
219
|
+
driverParam: unknown;
|
|
220
|
+
notNull: true;
|
|
221
|
+
hasDefault: true;
|
|
222
|
+
isPrimaryKey: false;
|
|
223
|
+
isAutoincrement: false;
|
|
224
|
+
hasRuntimeDefault: false;
|
|
225
|
+
enumValues: undefined;
|
|
226
|
+
baseColumn: never;
|
|
227
|
+
identity: undefined;
|
|
228
|
+
generated: undefined;
|
|
229
|
+
}, {}, {
|
|
230
|
+
$type: Readonly<Record<string, CustomFieldValue>>;
|
|
231
|
+
}>;
|
|
232
|
+
createdAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
233
|
+
name: "created_at";
|
|
234
|
+
tableName: "enquiries";
|
|
235
|
+
dataType: "date";
|
|
236
|
+
columnType: "PgTimestamp";
|
|
237
|
+
data: Date;
|
|
238
|
+
driverParam: string;
|
|
239
|
+
notNull: true;
|
|
240
|
+
hasDefault: true;
|
|
241
|
+
isPrimaryKey: false;
|
|
242
|
+
isAutoincrement: false;
|
|
243
|
+
hasRuntimeDefault: false;
|
|
244
|
+
enumValues: undefined;
|
|
245
|
+
baseColumn: never;
|
|
246
|
+
identity: undefined;
|
|
247
|
+
generated: undefined;
|
|
248
|
+
}, {}, {}>;
|
|
249
|
+
updatedAt: import("drizzle-orm/pg-core").PgColumn<{
|
|
250
|
+
name: "updated_at";
|
|
251
|
+
tableName: "enquiries";
|
|
252
|
+
dataType: "date";
|
|
253
|
+
columnType: "PgTimestamp";
|
|
254
|
+
data: Date;
|
|
255
|
+
driverParam: string;
|
|
256
|
+
notNull: true;
|
|
257
|
+
hasDefault: true;
|
|
258
|
+
isPrimaryKey: false;
|
|
259
|
+
isAutoincrement: false;
|
|
260
|
+
hasRuntimeDefault: false;
|
|
261
|
+
enumValues: undefined;
|
|
262
|
+
baseColumn: never;
|
|
263
|
+
identity: undefined;
|
|
264
|
+
generated: undefined;
|
|
265
|
+
}, {}, {}>;
|
|
266
|
+
searchVector: import("drizzle-orm/pg-core").PgColumn<{
|
|
267
|
+
name: string;
|
|
268
|
+
tableName: "enquiries";
|
|
269
|
+
dataType: "custom";
|
|
270
|
+
columnType: "PgCustomColumn";
|
|
271
|
+
data: string;
|
|
272
|
+
driverParam: string;
|
|
273
|
+
notNull: false;
|
|
274
|
+
hasDefault: true;
|
|
275
|
+
isPrimaryKey: false;
|
|
276
|
+
isAutoincrement: false;
|
|
277
|
+
hasRuntimeDefault: false;
|
|
278
|
+
enumValues: undefined;
|
|
279
|
+
baseColumn: never;
|
|
280
|
+
identity: undefined;
|
|
281
|
+
generated: {
|
|
282
|
+
type: 'always';
|
|
283
|
+
};
|
|
284
|
+
}, {}, {
|
|
285
|
+
pgColumnBuilderBrand: 'PgCustomColumnBuilderBrand';
|
|
286
|
+
}>;
|
|
287
|
+
};
|
|
288
|
+
dialect: 'pg';
|
|
289
|
+
}>;
|
|
290
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../../src/modules/enquiries/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAUvD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqCrB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { index, jsonb, pgTable, text } from 'drizzle-orm/pg-core';
|
|
2
|
+
import { createdAt, primaryId, searchVector, updatedAt } from '../../lib/columns.js';
|
|
3
|
+
import { companies } from '../companies/schema.js';
|
|
4
|
+
import { deals } from '../deals/schema.js';
|
|
5
|
+
import { pipelineStages } from '../pipelines/schema.js';
|
|
6
|
+
import { workspaceMembers, workspaces } from '../workspace/schema.js';
|
|
7
|
+
/**
|
|
8
|
+
* Enquiries: the top-of-funnel pipeline. An inbound request — website form,
|
|
9
|
+
* email, referral — that may become a Deal once qualified.
|
|
10
|
+
*
|
|
11
|
+
* `source` is free text like Opportunity's `kind`; a form is a source, and the
|
|
12
|
+
* kinds a workspace uses vary. `company_id` is nullable because an early
|
|
13
|
+
* enquiry may arrive before a company is on file. `converted_deal_id` becomes
|
|
14
|
+
* non-null when the enquiry is converted via
|
|
15
|
+
* `POST /v1/enquiries/:id/convert`; deleting the deal nulls it back so a
|
|
16
|
+
* fresh conversion is possible.
|
|
17
|
+
*/
|
|
18
|
+
export const enquiries = pgTable('enquiries', {
|
|
19
|
+
id: primaryId(),
|
|
20
|
+
workspaceId: text('workspace_id')
|
|
21
|
+
.notNull()
|
|
22
|
+
.references(() => workspaces.id, { onDelete: 'cascade' }),
|
|
23
|
+
name: text('name').notNull(),
|
|
24
|
+
source: text('source').notNull().default(''),
|
|
25
|
+
stageId: text('stage_id')
|
|
26
|
+
.notNull()
|
|
27
|
+
.references(() => pipelineStages.id, { onDelete: 'restrict' }),
|
|
28
|
+
companyId: text('company_id').references(() => companies.id, { onDelete: 'restrict' }),
|
|
29
|
+
ownerId: text('owner_id').references(() => workspaceMembers.id, { onDelete: 'restrict' }),
|
|
30
|
+
convertedDealId: text('converted_deal_id').references(() => deals.id, { onDelete: 'set null' }),
|
|
31
|
+
summary: text('summary').notNull().default(''),
|
|
32
|
+
tags: text('tags').array().notNull().default([]),
|
|
33
|
+
// Workspace-defined fields, keyed by definition key. See people/schema.ts.
|
|
34
|
+
customFields: jsonb('custom_fields')
|
|
35
|
+
.$type()
|
|
36
|
+
.notNull()
|
|
37
|
+
.default({}),
|
|
38
|
+
createdAt: createdAt(),
|
|
39
|
+
updatedAt: updatedAt(),
|
|
40
|
+
searchVector: searchVector(() => [
|
|
41
|
+
{ column: enquiries.name, weight: 'A' },
|
|
42
|
+
{ column: enquiries.source, weight: 'B' },
|
|
43
|
+
{ column: enquiries.summary, weight: 'B' },
|
|
44
|
+
{ column: enquiries.tags, weight: 'C', array: true },
|
|
45
|
+
]),
|
|
46
|
+
}, (table) => [
|
|
47
|
+
index('enquiries_workspace_idx').on(table.workspaceId),
|
|
48
|
+
index('enquiries_stage_idx').on(table.stageId),
|
|
49
|
+
index('enquiries_converted_deal_idx').on(table.convertedDealId),
|
|
50
|
+
index('enquiries_search_idx').using('gin', table.searchVector),
|
|
51
|
+
]);
|
|
52
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/modules/enquiries/schema.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAEjE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAEpF,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAA;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,UAAU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