@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,5 +1,6 @@
|
|
|
1
1
|
import { changedKeys } from '../../lib/changes.js';
|
|
2
2
|
import { UNIQUE_VIOLATION, isReferenceViolation, postgresErrorCode } from '../../lib/database.js';
|
|
3
|
+
import { autoLinkPersonByEmailDomain } from '../../lib/emailDomainAutoLink.js';
|
|
3
4
|
import { AppError } from '../../lib/errors.js';
|
|
4
5
|
import { normaliseEmail } from '../../lib/normalisation.js';
|
|
5
6
|
import { mapPage, readListWindow, toPage } from '../../lib/pagination.js';
|
|
@@ -8,9 +9,13 @@ import { toEventActor } from '../../lib/actor.js';
|
|
|
8
9
|
import { requireWorkspaceId } from '../auth/actor.js';
|
|
9
10
|
import './events.js';
|
|
10
11
|
import { deleteRecordsAttachedTo, deleteRecordsAttachedToCandidaciesOf, } from '../attachedRecords.js';
|
|
11
|
-
import
|
|
12
|
+
import * as personLinks from '../personLinks.js';
|
|
13
|
+
import { referenceViolationTable } from '../../lib/database.js';
|
|
14
|
+
import { referencedByPipelineRecords, referencedElsewhere } from '../references.js';
|
|
12
15
|
import * as repository from './repository.js';
|
|
13
16
|
import { DEFAULT_PERSON_SORT, PERSON_SORTS } from './repository.js';
|
|
17
|
+
import { readConsentsFor, readConsentsForMany } from './consentHydration.js';
|
|
18
|
+
import { applyManualConsentWrites, consentChangedPaths } from './personConsentWrites.js';
|
|
14
19
|
/**
|
|
15
20
|
* What a changed column is called on a timeline.
|
|
16
21
|
*
|
|
@@ -20,6 +25,10 @@ import { DEFAULT_PERSON_SORT, PERSON_SORTS } from './repository.js';
|
|
|
20
25
|
*/
|
|
21
26
|
const PERSON_FIELD_LABELS = {
|
|
22
27
|
name: 'Name',
|
|
28
|
+
salutation: 'Salutation',
|
|
29
|
+
firstName: 'First name',
|
|
30
|
+
lastName: 'Last name',
|
|
31
|
+
suffix: 'Suffix',
|
|
23
32
|
email: 'Email',
|
|
24
33
|
phones: 'Phone numbers',
|
|
25
34
|
socialProfiles: 'Social profiles',
|
|
@@ -31,10 +40,11 @@ const PERSON_FIELD_LABELS = {
|
|
|
31
40
|
summary: 'Summary',
|
|
32
41
|
tags: 'Tags',
|
|
33
42
|
lastContactedAt: 'Last contacted',
|
|
43
|
+
doNotContact: 'Do not contact',
|
|
34
44
|
};
|
|
35
|
-
function toView(record) {
|
|
45
|
+
function toView(record, consents) {
|
|
36
46
|
const { workspaceId: _workspaceId, ...view } = record;
|
|
37
|
-
return view;
|
|
47
|
+
return { ...view, consents };
|
|
38
48
|
}
|
|
39
49
|
/**
|
|
40
50
|
* The stored form of what the caller sent. Blank normalises to null: the email is
|
|
@@ -44,6 +54,10 @@ function toView(record) {
|
|
|
44
54
|
function toStoredColumns(input) {
|
|
45
55
|
return {
|
|
46
56
|
...(input.name === undefined ? {} : { name: input.name }),
|
|
57
|
+
...(input.salutation === undefined ? {} : { salutation: input.salutation }),
|
|
58
|
+
...(input.firstName === undefined ? {} : { firstName: input.firstName }),
|
|
59
|
+
...(input.lastName === undefined ? {} : { lastName: input.lastName }),
|
|
60
|
+
...(input.suffix === undefined ? {} : { suffix: input.suffix }),
|
|
47
61
|
...(input.email === undefined ? {} : { email: input.email === null ? null : normaliseEmail(input.email) }),
|
|
48
62
|
...(input.phones === undefined ? {} : { phones: input.phones }),
|
|
49
63
|
...(input.socialProfiles === undefined ? {} : { socialProfiles: input.socialProfiles }),
|
|
@@ -55,6 +69,7 @@ function toStoredColumns(input) {
|
|
|
55
69
|
...(input.summary === undefined ? {} : { summary: input.summary }),
|
|
56
70
|
...(input.tags === undefined ? {} : { tags: [...input.tags] }),
|
|
57
71
|
...(input.lastContactedAt === undefined ? {} : { lastContactedAt: input.lastContactedAt }),
|
|
72
|
+
...(input.doNotContact === undefined ? {} : { doNotContact: input.doNotContact }),
|
|
58
73
|
};
|
|
59
74
|
}
|
|
60
75
|
function duplicateEmail() {
|
|
@@ -77,21 +92,30 @@ export function createPeopleService(dependencies) {
|
|
|
77
92
|
const workspaceId = requireWorkspaceId(actor);
|
|
78
93
|
const window = readListWindow(query, PERSON_SORTS, DEFAULT_PERSON_SORT);
|
|
79
94
|
const rows = await repository.listPeople(dependencies.db, workspaceId, filters, window);
|
|
80
|
-
|
|
95
|
+
const consentsByPerson = await readConsentsForMany(dependencies.db, workspaceId, rows.map((row) => row.id));
|
|
96
|
+
return mapPage(toPage(rows, window, (person) => person.id), (record) => toView(record, consentsByPerson.get(record.id) ?? []));
|
|
81
97
|
},
|
|
82
98
|
async get(actor, id) {
|
|
83
|
-
|
|
99
|
+
const workspaceId = requireWorkspaceId(actor);
|
|
100
|
+
const record = await require(workspaceId, id);
|
|
101
|
+
const consents = await readConsentsFor(dependencies.db, workspaceId, id);
|
|
102
|
+
return toView(record, consents);
|
|
84
103
|
},
|
|
85
104
|
async create(actor, input) {
|
|
86
105
|
const workspaceId = requireWorkspaceId(actor);
|
|
87
106
|
const id = dependencies.createId('person');
|
|
88
107
|
return dependencies.transaction(async ({ tx, events }) => {
|
|
108
|
+
const customFields = await dependencies.customFields.forCreate(tx, workspaceId, 'person', input.customFields);
|
|
89
109
|
let created;
|
|
90
110
|
try {
|
|
91
111
|
created = await repository.insertPerson(tx, {
|
|
92
112
|
id,
|
|
93
113
|
workspaceId,
|
|
94
114
|
name: input.name,
|
|
115
|
+
salutation: input.salutation,
|
|
116
|
+
firstName: input.firstName,
|
|
117
|
+
lastName: input.lastName,
|
|
118
|
+
suffix: input.suffix,
|
|
95
119
|
email: input.email === null ? null : normaliseEmail(input.email),
|
|
96
120
|
phones: input.phones,
|
|
97
121
|
socialProfiles: input.socialProfiles,
|
|
@@ -103,6 +127,8 @@ export function createPeopleService(dependencies) {
|
|
|
103
127
|
summary: input.summary,
|
|
104
128
|
tags: [...input.tags],
|
|
105
129
|
lastContactedAt: input.lastContactedAt,
|
|
130
|
+
doNotContact: input.doNotContact,
|
|
131
|
+
customFields,
|
|
106
132
|
});
|
|
107
133
|
}
|
|
108
134
|
catch (error) {
|
|
@@ -111,6 +137,9 @@ export function createPeopleService(dependencies) {
|
|
|
111
137
|
}
|
|
112
138
|
throw error;
|
|
113
139
|
}
|
|
140
|
+
if (input.consents.length > 0) {
|
|
141
|
+
await applyManualConsentWrites(tx, workspaceId, created.id, input.consents, dependencies.now());
|
|
142
|
+
}
|
|
114
143
|
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
115
144
|
targetType: 'person',
|
|
116
145
|
targetId: created.id,
|
|
@@ -118,45 +147,95 @@ export function createPeopleService(dependencies) {
|
|
|
118
147
|
...describeCreation('Person'),
|
|
119
148
|
});
|
|
120
149
|
events.emit('people.person.created', { type: 'person', id: created.id }, {});
|
|
121
|
-
|
|
150
|
+
// Sync auto-link. Inside the same transaction so the response returns
|
|
151
|
+
// with the Position already visible to a follow-up read; without this
|
|
152
|
+
// the UI would not see the new Position until a manual refresh.
|
|
153
|
+
await autoLinkPersonByEmailDomain(tx, events, workspaceId, created, {
|
|
154
|
+
createId: dependencies.createId,
|
|
155
|
+
now: dependencies.now,
|
|
156
|
+
recordActivity: dependencies.recordActivity,
|
|
157
|
+
});
|
|
158
|
+
const consents = await readConsentsFor(tx, workspaceId, created.id);
|
|
159
|
+
return toView(created, consents);
|
|
122
160
|
}, { workspaceId, actor: toEventActor(actor) });
|
|
123
161
|
},
|
|
124
162
|
async update(actor, id, changes) {
|
|
125
163
|
const workspaceId = requireWorkspaceId(actor);
|
|
126
164
|
const existing = await require(workspaceId, id);
|
|
127
165
|
const columns = toStoredColumns(changes);
|
|
128
|
-
const
|
|
129
|
-
|
|
130
|
-
// would make the record look freshly touched to everything that sorts or
|
|
131
|
-
// filters by it.
|
|
132
|
-
if (changed.length === 0) {
|
|
133
|
-
return toView(existing);
|
|
134
|
-
}
|
|
166
|
+
const scalarChanged = changedKeys(existing, columns);
|
|
167
|
+
const consentWrites = changes.consents ?? [];
|
|
135
168
|
return dependencies.transaction(async ({ tx, events }) => {
|
|
169
|
+
const cf = await dependencies.customFields.forUpdate(tx, workspaceId, 'person', existing.customFields, changes.customFields);
|
|
170
|
+
const customFieldsChanged = cf !== undefined && cf.changedPaths.length > 0;
|
|
171
|
+
const consentChanges = consentWrites.length > 0
|
|
172
|
+
? await applyManualConsentWrites(tx, workspaceId, id, consentWrites, dependencies.now())
|
|
173
|
+
: [];
|
|
174
|
+
const consentPaths = consentChangedPaths(consentChanges);
|
|
175
|
+
const consentActuallyChanged = consentPaths.length > 0;
|
|
176
|
+
// A PATCH that changes nothing is not a write. Bumping `updated_at`
|
|
177
|
+
// would make the record look freshly touched to everything that sorts
|
|
178
|
+
// or filters by it.
|
|
179
|
+
if (scalarChanged.length === 0 &&
|
|
180
|
+
!customFieldsChanged &&
|
|
181
|
+
!consentActuallyChanged) {
|
|
182
|
+
const consents = await readConsentsFor(tx, workspaceId, id);
|
|
183
|
+
return toView(existing, consents);
|
|
184
|
+
}
|
|
136
185
|
let updated;
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
186
|
+
if (scalarChanged.length > 0 || customFieldsChanged) {
|
|
187
|
+
try {
|
|
188
|
+
updated = await repository.updatePerson(tx, workspaceId, id, {
|
|
189
|
+
...columns,
|
|
190
|
+
...(customFieldsChanged ? { customFields: cf.merged } : {}),
|
|
191
|
+
updatedAt: dependencies.now(),
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
if (postgresErrorCode(error) === UNIQUE_VIOLATION) {
|
|
196
|
+
throw duplicateEmail();
|
|
197
|
+
}
|
|
198
|
+
throw error;
|
|
199
|
+
}
|
|
200
|
+
if (updated === undefined) {
|
|
201
|
+
throw AppError.notFound('Person not found');
|
|
202
|
+
}
|
|
142
203
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
204
|
+
else {
|
|
205
|
+
updated = existing;
|
|
206
|
+
}
|
|
207
|
+
const customFieldPaths = cf?.changedPaths ?? [];
|
|
208
|
+
const activityChanged = [...scalarChanged, ...customFieldPaths, ...consentPaths];
|
|
209
|
+
if (activityChanged.length > 0) {
|
|
210
|
+
const labels = { ...PERSON_FIELD_LABELS, ...cf?.labels };
|
|
211
|
+
for (const change of consentChanges) {
|
|
212
|
+
labels[`consents.${change.purposeSlug}`] = `Consent · ${change.purposeLabel}`;
|
|
146
213
|
}
|
|
147
|
-
|
|
214
|
+
const before = { ...existing, ...cf?.flatBefore };
|
|
215
|
+
const after = { ...columns, ...cf?.flatAfter };
|
|
216
|
+
for (const change of consentChanges) {
|
|
217
|
+
before[`consents.${change.purposeSlug}`] = change.previousStatus ?? 'inherits';
|
|
218
|
+
after[`consents.${change.purposeSlug}`] = change.status ?? 'inherits';
|
|
219
|
+
}
|
|
220
|
+
await dependencies.recordActivity(tx, workspaceId, actor, {
|
|
221
|
+
targetType: 'person',
|
|
222
|
+
targetId: id,
|
|
223
|
+
kind: 'updated',
|
|
224
|
+
...describeUpdate(activityChanged, labels, before, after),
|
|
225
|
+
});
|
|
148
226
|
}
|
|
149
|
-
|
|
150
|
-
|
|
227
|
+
events.emit('people.person.updated', { type: 'person', id }, { changed: activityChanged });
|
|
228
|
+
// Sync auto-link when the email moved. Same-transaction rationale as
|
|
229
|
+
// the create path above.
|
|
230
|
+
if (scalarChanged.includes('email')) {
|
|
231
|
+
await autoLinkPersonByEmailDomain(tx, events, workspaceId, updated, {
|
|
232
|
+
createId: dependencies.createId,
|
|
233
|
+
now: dependencies.now,
|
|
234
|
+
recordActivity: dependencies.recordActivity,
|
|
235
|
+
});
|
|
151
236
|
}
|
|
152
|
-
await
|
|
153
|
-
|
|
154
|
-
targetId: id,
|
|
155
|
-
kind: 'updated',
|
|
156
|
-
...describeUpdate(changed, PERSON_FIELD_LABELS, existing, columns),
|
|
157
|
-
});
|
|
158
|
-
events.emit('people.person.updated', { type: 'person', id }, { changed });
|
|
159
|
-
return toView(updated);
|
|
237
|
+
const consents = await readConsentsFor(tx, workspaceId, id);
|
|
238
|
+
return toView(updated, consents);
|
|
160
239
|
}, { workspaceId, actor: toEventActor(actor) });
|
|
161
240
|
},
|
|
162
241
|
async remove(actor, id) {
|
|
@@ -170,14 +249,30 @@ export function createPeopleService(dependencies) {
|
|
|
170
249
|
// The candidacy rows themselves cascade, which is why their interview
|
|
171
250
|
// notes have to be taken here: no hiring service sees that delete.
|
|
172
251
|
await deleteRecordsAttachedToCandidaciesOf(tx, workspaceId, id);
|
|
252
|
+
// A person delete failing on a foreign key aborts the enclosing
|
|
253
|
+
// transaction, so the follow-up read that names the referring pipeline
|
|
254
|
+
// types would run against a dead tx. Wrap only the delete in a nested
|
|
255
|
+
// transaction: drizzle emits SAVEPOINT/ROLLBACK TO for it, so the
|
|
256
|
+
// outer tx survives the refusal and the listLinkedTargetTypes read
|
|
257
|
+
// below sees person_links.
|
|
258
|
+
let deleteError = null;
|
|
173
259
|
try {
|
|
174
|
-
await
|
|
260
|
+
await tx.transaction(async (savepoint) => {
|
|
261
|
+
await repository.deletePerson(savepoint, workspaceId, id);
|
|
262
|
+
});
|
|
175
263
|
}
|
|
176
264
|
catch (error) {
|
|
177
|
-
|
|
178
|
-
|
|
265
|
+
deleteError = error;
|
|
266
|
+
}
|
|
267
|
+
if (deleteError !== null) {
|
|
268
|
+
if (isReferenceViolation(deleteError)) {
|
|
269
|
+
if (referenceViolationTable(deleteError) === 'person_links') {
|
|
270
|
+
const types = await personLinks.listLinkedTargetTypes(tx, workspaceId, id);
|
|
271
|
+
throw referencedByPipelineRecords('person', types);
|
|
272
|
+
}
|
|
273
|
+
throw referencedElsewhere(deleteError, 'person');
|
|
179
274
|
}
|
|
180
|
-
throw
|
|
275
|
+
throw deleteError;
|
|
181
276
|
}
|
|
182
277
|
events.emit('people.person.deleted', { type: 'person', id }, {});
|
|
183
278
|
}, { workspaceId, actor: toEventActor(actor) });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/modules/people/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAClD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAEjG,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAA;AAIzE,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE3E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,aAAa,CAAA;AACpB,OAAO,EACL,uBAAuB,EAC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AAE,CAC5C,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/modules/people/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAYjD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/modules/people/tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAG9D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAYjD,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,aAAa,GAAG,IAAI,CAkBtF"}
|
|
@@ -13,7 +13,10 @@ export function registerPeopleTools(mcp, service) {
|
|
|
13
13
|
registerCrudTools(mcp, {
|
|
14
14
|
resource: 'people',
|
|
15
15
|
subject: 'person',
|
|
16
|
-
about: 'Someone the workspace knows. A job title belongs to a position, never to the person.'
|
|
16
|
+
about: 'Someone the workspace knows. A job title belongs to a position, never to the person. ' +
|
|
17
|
+
'name is the display name every list shows; first_name, last_name, salutation and suffix ' +
|
|
18
|
+
'are optional parts beside it. A create with no name composes one from first_name and ' +
|
|
19
|
+
'last_name. Changing a part never rewrites name.',
|
|
17
20
|
service,
|
|
18
21
|
render: personResponse,
|
|
19
22
|
listArgs,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/modules/people/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,KAAK,EAAE,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FAAuF;YACvF,0FAA0F;YAC1F,uFAAuF;YACvF,iDAAiD;QACnD,OAAO;QACP,MAAM,EAAE,cAAc;QACtB,QAAQ;QACR,SAAS,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QAC3E,UAAU,EAAE,UAAU;QACtB,aAAa;QACb,UAAU,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;QAC5C,aAAa;KACd,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { sql } from 'drizzle-orm';
|
|
2
|
+
import type { AnyPgColumn } from 'drizzle-orm/pg-core';
|
|
3
|
+
import type { PipelineKind } from '@kelpie/schemas';
|
|
4
|
+
import type { IdFactory } from '../lib/ids.ts';
|
|
5
|
+
import type { Queryable } from '../runtime/transaction.ts';
|
|
6
|
+
/**
|
|
7
|
+
* Shared reader/writer for `person_links`, the polymorphic table that holds a
|
|
8
|
+
* person's involvement in a pipeline record. Every deal/opportunity/raise/
|
|
9
|
+
* partnership service reaches through here rather than owning its own join
|
|
10
|
+
* table. `personLinks` is defined in `people/schema.ts` because the person
|
|
11
|
+
* side of the relation is what gives it the real foreign key.
|
|
12
|
+
*
|
|
13
|
+
* All functions take the caller's `Queryable` and `workspaceId` so every
|
|
14
|
+
* query rides the `(workspace_id, target_type, target_id)` index and lands in
|
|
15
|
+
* whatever transaction the caller opened.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* One target the caller writes to. Kept named rather than positional so
|
|
19
|
+
* `linkPeople(db, ids, ws, 'deal', dealId, personIds)` cannot swap the last
|
|
20
|
+
* two arguments silently.
|
|
21
|
+
*/
|
|
22
|
+
export interface PipelineTarget {
|
|
23
|
+
readonly targetType: PipelineKind;
|
|
24
|
+
readonly targetId: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* The people on one pipeline record, ordered by person_id so a response is
|
|
28
|
+
* stable across reads. Mirrors the deals repository's old `listPersonIds`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function listPersonIds(db: Queryable, workspaceId: string, target: PipelineTarget): Promise<string[]>;
|
|
31
|
+
/**
|
|
32
|
+
* The people on each of a page of pipeline records of one type, in one query
|
|
33
|
+
* rather than one per row. Ids missing from the map have no people.
|
|
34
|
+
*/
|
|
35
|
+
export declare function listPersonIdsFor(db: Queryable, workspaceId: string, targetType: PipelineKind, targetIds: readonly string[]): Promise<ReadonlyMap<string, readonly string[]>>;
|
|
36
|
+
/**
|
|
37
|
+
* Every pipeline record a person is on, in one query. Used by the person
|
|
38
|
+
* activity roll-up and the agent-tasks person case, which used to run one
|
|
39
|
+
* query per join table.
|
|
40
|
+
*/
|
|
41
|
+
export declare function listTargetsOfPerson(db: Queryable, workspaceId: string, personId: string): Promise<readonly PipelineTarget[]>;
|
|
42
|
+
/**
|
|
43
|
+
* The distinct target types still pointing at a person. Used by the 409 on
|
|
44
|
+
* person delete to name each pipeline the person is on, without loading every
|
|
45
|
+
* row.
|
|
46
|
+
*/
|
|
47
|
+
export declare function listLinkedTargetTypes(db: Queryable, workspaceId: string, personId: string): Promise<readonly PipelineKind[]>;
|
|
48
|
+
/** Bulk insert; callers pre-dedupe as today. No-op on empty. */
|
|
49
|
+
export declare function linkPeople(db: Queryable, createId: IdFactory, workspaceId: string, target: PipelineTarget, personIds: readonly string[]): Promise<void>;
|
|
50
|
+
/** Bulk delete matching a set of people. No-op on empty. */
|
|
51
|
+
export declare function unlinkPeople(db: Queryable, workspaceId: string, target: PipelineTarget, personIds: readonly string[]): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Link one person, skipping if the row already exists. Used by the forms
|
|
54
|
+
* post-submit actions: a resubmitting visitor does not double-attach.
|
|
55
|
+
*
|
|
56
|
+
* @returns `true` when a row was inserted, `false` when the link already existed.
|
|
57
|
+
*/
|
|
58
|
+
export declare function linkPersonIfAbsent(db: Queryable, createId: IdFactory, workspaceId: string, target: PipelineTarget, personId: string): Promise<boolean>;
|
|
59
|
+
/**
|
|
60
|
+
* Target-side cleanup, called from `attachedRecords.deleteRecordsAttachedTo`
|
|
61
|
+
* when a pipeline record is deleted.
|
|
62
|
+
*
|
|
63
|
+
* @returns the number of rows removed.
|
|
64
|
+
*/
|
|
65
|
+
export declare function deleteLinksForTarget(db: Queryable, workspaceId: string, target: PipelineTarget): Promise<number>;
|
|
66
|
+
/**
|
|
67
|
+
* The `?person_id=` exists-subquery SQL builder, correlated on the outer
|
|
68
|
+
* table's id and workspace columns. Replaces the identical `hasAnyOfPeople`
|
|
69
|
+
* helpers that used to live in each pipeline module's repository.
|
|
70
|
+
*/
|
|
71
|
+
export declare function anyPersonLinked(targetType: PipelineKind, targetIdColumn: AnyPgColumn, workspaceIdColumn: AnyPgColumn, personIds: readonly string[]): ReturnType<typeof sql>;
|
|
72
|
+
/**
|
|
73
|
+
* The names of these people in this workspace, keyed by id. Reads the
|
|
74
|
+
* `people` table because that is where names live; used by every pipeline
|
|
75
|
+
* service to validate `person_ids` and label the `linked`/`unlinked`
|
|
76
|
+
* activity. An id missing from the map does not exist in this workspace.
|
|
77
|
+
*/
|
|
78
|
+
export declare function findPeopleNamed(db: Queryable, workspaceId: string, personIds: readonly string[]): Promise<ReadonlyMap<string, string>>;
|
|
79
|
+
//# sourceMappingURL=personLinks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personLinks.d.ts","sourceRoot":"","sources":["../../src/modules/personLinks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyB,GAAG,EAAE,MAAM,aAAa,CAAA;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAEnD,OAAO,KAAK,EAAE,SAAS,E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,EACtB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAef;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,SAAS,EACb,QAAQ,EAAE,SAAS,EACnB,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,OAAO,CAAC,CAgBlB;AAED;;;;;GAKG;AACH,wBAAsB,oBAAoB,CACxC,EAAE,EAAE,SAAS,EACb,WAAW,EAAE,MAAM,EACnB,MAAM,EAAE,cAAc,GACrB,OAAO,CAAC,MAAM,CAAC,CAajB;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAC7B,UAAU,EAAE,YAAY,EACxB,cAAc,EAAE,WAAW,EAC3B,iBAAiB,EAAE,WAAW,EAC9B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,UAAU,CAAC,OAAO,GAAG,CAAC,CASxB;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,EAAE,EAAE,SAAS,EACb,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,SAAS,MAAM,EAAE,GAC3B,OAAO,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAWtC"}
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { and, asc, eq, inArray, sql } from 'drizzle-orm';
|
|
2
|
+
import { people, personLinks } from './people/schema.js';
|
|
3
|
+
/**
|
|
4
|
+
* The people on one pipeline record, ordered by person_id so a response is
|
|
5
|
+
* stable across reads. Mirrors the deals repository's old `listPersonIds`.
|
|
6
|
+
*/
|
|
7
|
+
export async function listPersonIds(db, workspaceId, target) {
|
|
8
|
+
const rows = await db
|
|
9
|
+
.select({ personId: personLinks.personId })
|
|
10
|
+
.from(personLinks)
|
|
11
|
+
.where(and(eq(personLinks.workspaceId, workspaceId), eq(personLinks.targetType, target.targetType), eq(personLinks.targetId, target.targetId)))
|
|
12
|
+
.orderBy(asc(personLinks.personId));
|
|
13
|
+
return rows.map((row) => row.personId);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The people on each of a page of pipeline records of one type, in one query
|
|
17
|
+
* rather than one per row. Ids missing from the map have no people.
|
|
18
|
+
*/
|
|
19
|
+
export async function listPersonIdsFor(db, workspaceId, targetType, targetIds) {
|
|
20
|
+
if (targetIds.length === 0) {
|
|
21
|
+
return new Map();
|
|
22
|
+
}
|
|
23
|
+
const rows = await db
|
|
24
|
+
.select({ targetId: personLinks.targetId, personId: personLinks.personId })
|
|
25
|
+
.from(personLinks)
|
|
26
|
+
.where(and(eq(personLinks.workspaceId, workspaceId), eq(personLinks.targetType, targetType), inArray(personLinks.targetId, targetIds)))
|
|
27
|
+
.orderBy(asc(personLinks.personId));
|
|
28
|
+
const byTarget = new Map();
|
|
29
|
+
for (const row of rows) {
|
|
30
|
+
const existing = byTarget.get(row.targetId);
|
|
31
|
+
if (existing === undefined) {
|
|
32
|
+
byTarget.set(row.targetId, [row.personId]);
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
existing.push(row.personId);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
return byTarget;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Every pipeline record a person is on, in one query. Used by the person
|
|
42
|
+
* activity roll-up and the agent-tasks person case, which used to run one
|
|
43
|
+
* query per join table.
|
|
44
|
+
*/
|
|
45
|
+
export async function listTargetsOfPerson(db, workspaceId, personId) {
|
|
46
|
+
const rows = await db
|
|
47
|
+
.select({ targetType: personLinks.targetType, targetId: personLinks.targetId })
|
|
48
|
+
.from(personLinks)
|
|
49
|
+
.where(and(eq(personLinks.workspaceId, workspaceId), eq(personLinks.personId, personId)));
|
|
50
|
+
return rows.map((row) => ({
|
|
51
|
+
targetType: row.targetType,
|
|
52
|
+
targetId: row.targetId,
|
|
53
|
+
}));
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The distinct target types still pointing at a person. Used by the 409 on
|
|
57
|
+
* person delete to name each pipeline the person is on, without loading every
|
|
58
|
+
* row.
|
|
59
|
+
*/
|
|
60
|
+
export async function listLinkedTargetTypes(db, workspaceId, personId) {
|
|
61
|
+
const rows = await db
|
|
62
|
+
.selectDistinct({ targetType: personLinks.targetType })
|
|
63
|
+
.from(personLinks)
|
|
64
|
+
.where(and(eq(personLinks.workspaceId, workspaceId), eq(personLinks.personId, personId)));
|
|
65
|
+
return rows.map((row) => row.targetType);
|
|
66
|
+
}
|
|
67
|
+
/** Bulk insert; callers pre-dedupe as today. No-op on empty. */
|
|
68
|
+
export async function linkPeople(db, createId, workspaceId, target, personIds) {
|
|
69
|
+
if (personIds.length === 0) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
await db.insert(personLinks).values(personIds.map((personId) => ({
|
|
73
|
+
id: createId('personLink'),
|
|
74
|
+
workspaceId,
|
|
75
|
+
personId,
|
|
76
|
+
targetType: target.targetType,
|
|
77
|
+
targetId: target.targetId,
|
|
78
|
+
})));
|
|
79
|
+
}
|
|
80
|
+
/** Bulk delete matching a set of people. No-op on empty. */
|
|
81
|
+
export async function unlinkPeople(db, workspaceId, target, personIds) {
|
|
82
|
+
if (personIds.length === 0) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
await db
|
|
86
|
+
.delete(personLinks)
|
|
87
|
+
.where(and(eq(personLinks.workspaceId, workspaceId), eq(personLinks.targetType, target.targetType), eq(personLinks.targetId, target.targetId), inArray(personLinks.personId, personIds)));
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Link one person, skipping if the row already exists. Used by the forms
|
|
91
|
+
* post-submit actions: a resubmitting visitor does not double-attach.
|
|
92
|
+
*
|
|
93
|
+
* @returns `true` when a row was inserted, `false` when the link already existed.
|
|
94
|
+
*/
|
|
95
|
+
export async function linkPersonIfAbsent(db, createId, workspaceId, target, personId) {
|
|
96
|
+
const inserted = await db
|
|
97
|
+
.insert(personLinks)
|
|
98
|
+
.values({
|
|
99
|
+
id: createId('personLink'),
|
|
100
|
+
workspaceId,
|
|
101
|
+
personId,
|
|
102
|
+
targetType: target.targetType,
|
|
103
|
+
targetId: target.targetId,
|
|
104
|
+
})
|
|
105
|
+
.onConflictDoNothing({
|
|
106
|
+
target: [personLinks.personId, personLinks.targetType, personLinks.targetId],
|
|
107
|
+
})
|
|
108
|
+
.returning({ id: personLinks.id });
|
|
109
|
+
return inserted.length > 0;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Target-side cleanup, called from `attachedRecords.deleteRecordsAttachedTo`
|
|
113
|
+
* when a pipeline record is deleted.
|
|
114
|
+
*
|
|
115
|
+
* @returns the number of rows removed.
|
|
116
|
+
*/
|
|
117
|
+
export async function deleteLinksForTarget(db, workspaceId, target) {
|
|
118
|
+
const deleted = await db
|
|
119
|
+
.delete(personLinks)
|
|
120
|
+
.where(and(eq(personLinks.workspaceId, workspaceId), eq(personLinks.targetType, target.targetType), eq(personLinks.targetId, target.targetId)))
|
|
121
|
+
.returning({ id: personLinks.id });
|
|
122
|
+
return deleted.length;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The `?person_id=` exists-subquery SQL builder, correlated on the outer
|
|
126
|
+
* table's id and workspace columns. Replaces the identical `hasAnyOfPeople`
|
|
127
|
+
* helpers that used to live in each pipeline module's repository.
|
|
128
|
+
*/
|
|
129
|
+
export function anyPersonLinked(targetType, targetIdColumn, workspaceIdColumn, personIds) {
|
|
130
|
+
return sql `exists (
|
|
131
|
+
select 1
|
|
132
|
+
from ${personLinks}
|
|
133
|
+
where ${personLinks.workspaceId} = ${workspaceIdColumn}
|
|
134
|
+
and ${personLinks.targetType} = ${targetType}
|
|
135
|
+
and ${personLinks.targetId} = ${targetIdColumn}
|
|
136
|
+
and ${inArray(personLinks.personId, personIds)}
|
|
137
|
+
)`;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The names of these people in this workspace, keyed by id. Reads the
|
|
141
|
+
* `people` table because that is where names live; used by every pipeline
|
|
142
|
+
* service to validate `person_ids` and label the `linked`/`unlinked`
|
|
143
|
+
* activity. An id missing from the map does not exist in this workspace.
|
|
144
|
+
*/
|
|
145
|
+
export async function findPeopleNamed(db, workspaceId, personIds) {
|
|
146
|
+
if (personIds.length === 0) {
|
|
147
|
+
return new Map();
|
|
148
|
+
}
|
|
149
|
+
const rows = await db
|
|
150
|
+
.select({ id: people.id, name: people.name })
|
|
151
|
+
.from(people)
|
|
152
|
+
.where(and(eq(people.workspaceId, workspaceId), inArray(people.id, personIds)));
|
|
153
|
+
return new Map(rows.map((row) => [row.id, row.name]));
|
|
154
|
+
}
|
|
155
|
+
//# sourceMappingURL=personLinks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"personLinks.js","sourceRoot":"","sources":["../../src/modules/personLinks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAMxD,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAwBxD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,EAAa,EACb,WAAmB,EACnB,MAAsB;IAEtB,MAAM,IAAI,GAAG,MAAM,EAAE;SAClB,MAAM,CAAC,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,CAAC;SAC1C,IAAI,CAAC,WAAW,CAAC;SACjB,KAAK,CACJ,GAAG,CACD,EAAE,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,EACxC,EAAE,CAAC,WAAW,CAAC,UAAU,EAAE,MAAM,CAAC,UAAU,CAAC,EAC7C,EAAE,CAAC,WAAW,CAAC,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC,CAC1C,CACF;SACA,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,QAAQ,C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,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,GAAG,EAAE,CAAA;IAClB,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,EAAE;SAClB,MAAM,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,CAAC;SAC5C,IAAI,CAAC,MAAM,CAAC;SACZ,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAA;IAEjF,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACvD,CAAC"}
|
|
@@ -6,6 +6,7 @@ import type { CreateStageInput, PipelineStageView, PipelineStagesService, Update
|
|
|
6
6
|
export declare const createBody: z.ZodObject<{
|
|
7
7
|
kind: z.ZodEnum<{
|
|
8
8
|
deal: "deal";
|
|
9
|
+
enquiry: "enquiry";
|
|
9
10
|
opportunity: "opportunity";
|
|
10
11
|
partnership: "partnership";
|
|
11
12
|
raise: "raise";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/modules/pipelines/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAGpE,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,cAAc,CAAA;AAErB,yGAAyG;AAEzG,eAAO,MAAM,UAAU
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/modules/pipelines/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAMvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAGpE,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,cAAc,CAAA;AAErB,yGAAyG;AAEzG,eAAO,MAAM,UAAU;;;;;;;;;;kBAIrB,CAAA;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;kBAMX,CAAA;AAIZ,MAAM,WAAW,2BAA4B,SAAQ,sBAAsB;IACzE,QAAQ,CAAC,OAAO,EAAE,qBAAqB,CAAA;CACxC;AAqCD,wBAAgB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,GAAG,gBAAgB,CAEhF;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,GAAG,gBAAgB,CAMhF;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAW/E;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,IAAI,EACZ,YAAY,EAAE,2BAA2B,GACxC,IAAI,CAiDN"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../src/modules/plans/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAA;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAOvB,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAA;AAIpE,OAAO,KA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