@kelpie/server 0.10.0 → 0.11.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/app.d.ts.map +1 -1
- package/dist/app.js +2 -0
- package/dist/app.js.map +1 -1
- package/dist/lib/actor.d.ts +3 -1
- package/dist/lib/actor.d.ts.map +1 -1
- package/dist/lib/actor.js.map +1 -1
- package/dist/lib/apiKeyScopes.d.ts +8 -0
- package/dist/lib/apiKeyScopes.d.ts.map +1 -0
- package/dist/lib/apiKeyScopes.js +166 -0
- package/dist/lib/apiKeyScopes.js.map +1 -0
- package/dist/modules/activities/repository.d.ts +2 -0
- package/dist/modules/activities/repository.d.ts.map +1 -1
- package/dist/modules/activities/repository.js +9 -0
- package/dist/modules/activities/repository.js.map +1 -1
- package/dist/modules/agent-tasks/repository.d.ts +2 -0
- package/dist/modules/agent-tasks/repository.d.ts.map +1 -1
- package/dist/modules/agent-tasks/repository.js +9 -0
- package/dist/modules/agent-tasks/repository.js.map +1 -1
- package/dist/modules/api-keys/routes.d.ts.map +1 -1
- package/dist/modules/api-keys/routes.js +4 -1
- package/dist/modules/api-keys/routes.js.map +1 -1
- package/dist/modules/api-keys/schema.d.ts +43 -0
- package/dist/modules/api-keys/schema.d.ts.map +1 -1
- package/dist/modules/api-keys/schema.js +2 -0
- package/dist/modules/api-keys/schema.js.map +1 -1
- package/dist/modules/api-keys/scopeMiddleware.d.ts +8 -0
- package/dist/modules/api-keys/scopeMiddleware.d.ts.map +1 -0
- package/dist/modules/api-keys/scopeMiddleware.js +21 -0
- package/dist/modules/api-keys/scopeMiddleware.js.map +1 -0
- package/dist/modules/api-keys/service.d.ts +3 -1
- package/dist/modules/api-keys/service.d.ts.map +1 -1
- package/dist/modules/api-keys/service.js +26 -1
- package/dist/modules/api-keys/service.js.map +1 -1
- package/dist/modules/auth/credentials.d.ts.map +1 -1
- package/dist/modules/auth/credentials.js +2 -0
- package/dist/modules/auth/credentials.js.map +1 -1
- package/dist/modules/consent-purposes/index.d.ts +1 -1
- package/dist/modules/consent-purposes/index.js +1 -1
- package/dist/modules/consent-purposes/schema.d.ts +3 -3
- package/dist/modules/consent-purposes/schema.js +3 -3
- package/dist/modules/consent-purposes/service.d.ts +1 -1
- package/dist/modules/consent-purposes/service.d.ts.map +1 -1
- package/dist/modules/consent-purposes/service.js +7 -16
- package/dist/modules/consent-purposes/service.js.map +1 -1
- package/dist/modules/consent-purposes/starters.d.ts +1 -1
- package/dist/modules/consent-purposes/tools.js +1 -1
- package/dist/modules/consent-purposes/tools.js.map +1 -1
- package/dist/modules/conversions/clearPointers.d.ts +10 -0
- package/dist/modules/conversions/clearPointers.d.ts.map +1 -0
- package/dist/modules/conversions/clearPointers.js +40 -0
- package/dist/modules/conversions/clearPointers.js.map +1 -0
- package/dist/modules/conversions/factory.d.ts +5 -0
- package/dist/modules/conversions/factory.d.ts.map +1 -0
- package/dist/modules/conversions/factory.js +18 -0
- package/dist/modules/conversions/factory.js.map +1 -0
- package/dist/modules/conversions/fieldMap.d.ts +55 -0
- package/dist/modules/conversions/fieldMap.d.ts.map +1 -0
- package/dist/modules/conversions/fieldMap.js +398 -0
- package/dist/modules/conversions/fieldMap.js.map +1 -0
- package/dist/modules/conversions/index.d.ts +7 -0
- package/dist/modules/conversions/index.d.ts.map +1 -0
- package/dist/modules/conversions/index.js +6 -0
- package/dist/modules/conversions/index.js.map +1 -0
- package/dist/modules/conversions/mcp.d.ts +7 -0
- package/dist/modules/conversions/mcp.d.ts.map +1 -0
- package/dist/modules/conversions/mcp.js +47 -0
- package/dist/modules/conversions/mcp.js.map +1 -0
- package/dist/modules/conversions/repoint.d.ts +19 -0
- package/dist/modules/conversions/repoint.d.ts.map +1 -0
- package/dist/modules/conversions/repoint.js +51 -0
- package/dist/modules/conversions/repoint.js.map +1 -0
- package/dist/modules/conversions/routes.d.ts +26 -0
- package/dist/modules/conversions/routes.d.ts.map +1 -0
- package/dist/modules/conversions/routes.js +23 -0
- package/dist/modules/conversions/routes.js.map +1 -0
- package/dist/modules/conversions/service.d.ts +28 -0
- package/dist/modules/conversions/service.d.ts.map +1 -0
- package/dist/modules/conversions/service.js +170 -0
- package/dist/modules/conversions/service.js.map +1 -0
- package/dist/modules/conversions/wire.d.ts +4 -0
- package/dist/modules/conversions/wire.d.ts.map +1 -0
- package/dist/modules/conversions/wire.js +28 -0
- package/dist/modules/conversions/wire.js.map +1 -0
- package/dist/modules/deals/events.d.ts +9 -0
- package/dist/modules/deals/events.d.ts.map +1 -1
- package/dist/modules/deals/events.js +4 -0
- package/dist/modules/deals/events.js.map +1 -1
- package/dist/modules/deals/index.d.ts.map +1 -1
- package/dist/modules/deals/index.js +4 -2
- package/dist/modules/deals/index.js.map +1 -1
- package/dist/modules/deals/routes.d.ts +2 -0
- package/dist/modules/deals/routes.d.ts.map +1 -1
- package/dist/modules/deals/routes.js +8 -1
- package/dist/modules/deals/routes.js.map +1 -1
- package/dist/modules/deals/schema.d.ts +34 -0
- package/dist/modules/deals/schema.d.ts.map +1 -1
- package/dist/modules/deals/schema.js +7 -2
- package/dist/modules/deals/schema.js.map +1 -1
- package/dist/modules/deals/service.d.ts.map +1 -1
- package/dist/modules/deals/service.js +2 -0
- package/dist/modules/deals/service.js.map +1 -1
- package/dist/modules/deals/tools.d.ts +2 -1
- package/dist/modules/deals/tools.d.ts.map +1 -1
- package/dist/modules/deals/tools.js +3 -1
- package/dist/modules/deals/tools.js.map +1 -1
- package/dist/modules/decisions/repository.d.ts +2 -1
- package/dist/modules/decisions/repository.d.ts.map +1 -1
- package/dist/modules/decisions/repository.js +9 -1
- package/dist/modules/decisions/repository.js.map +1 -1
- package/dist/modules/enquiries/events.d.ts +6 -2
- package/dist/modules/enquiries/events.d.ts.map +1 -1
- package/dist/modules/enquiries/events.js +5 -1
- package/dist/modules/enquiries/events.js.map +1 -1
- package/dist/modules/enquiries/index.d.ts.map +1 -1
- package/dist/modules/enquiries/index.js +4 -2
- package/dist/modules/enquiries/index.js.map +1 -1
- package/dist/modules/enquiries/routes.d.ts +2 -0
- package/dist/modules/enquiries/routes.d.ts.map +1 -1
- package/dist/modules/enquiries/routes.js +9 -9
- package/dist/modules/enquiries/routes.js.map +1 -1
- package/dist/modules/enquiries/schema.d.ts +36 -1
- package/dist/modules/enquiries/schema.d.ts.map +1 -1
- package/dist/modules/enquiries/schema.js +9 -3
- package/dist/modules/enquiries/schema.js.map +1 -1
- package/dist/modules/enquiries/service.d.ts +0 -8
- package/dist/modules/enquiries/service.d.ts.map +1 -1
- package/dist/modules/enquiries/service.js +3 -95
- package/dist/modules/enquiries/service.js.map +1 -1
- package/dist/modules/enquiries/tools.d.ts +2 -1
- package/dist/modules/enquiries/tools.d.ts.map +1 -1
- package/dist/modules/enquiries/tools.js +4 -16
- package/dist/modules/enquiries/tools.js.map +1 -1
- package/dist/modules/forms/applyMappedFields.d.ts +20 -0
- package/dist/modules/forms/applyMappedFields.d.ts.map +1 -0
- package/dist/modules/forms/applyMappedFields.js +169 -0
- package/dist/modules/forms/applyMappedFields.js.map +1 -0
- package/dist/modules/forms/applySubmissionFields.d.ts +18 -0
- package/dist/modules/forms/applySubmissionFields.d.ts.map +1 -0
- package/dist/modules/forms/applySubmissionFields.js +230 -0
- package/dist/modules/forms/applySubmissionFields.js.map +1 -0
- package/dist/modules/forms/fields.d.ts +7 -2
- package/dist/modules/forms/fields.d.ts.map +1 -1
- package/dist/modules/forms/fields.js +17 -6
- package/dist/modules/forms/fields.js.map +1 -1
- package/dist/modules/forms/mapping.d.ts +8 -2
- package/dist/modules/forms/mapping.d.ts.map +1 -1
- package/dist/modules/forms/mapping.js +11 -0
- package/dist/modules/forms/mapping.js.map +1 -1
- package/dist/modules/forms/repository.d.ts +0 -5
- package/dist/modules/forms/repository.d.ts.map +1 -1
- package/dist/modules/forms/repository.js +0 -2
- package/dist/modules/forms/repository.js.map +1 -1
- package/dist/modules/forms/routes.d.ts +2 -30
- package/dist/modules/forms/routes.d.ts.map +1 -1
- package/dist/modules/forms/routes.js +2 -2
- package/dist/modules/forms/routes.js.map +1 -1
- package/dist/modules/forms/schema.d.ts.map +1 -1
- package/dist/modules/forms/schema.js +1 -2
- package/dist/modules/forms/schema.js.map +1 -1
- package/dist/modules/forms/service.d.ts.map +1 -1
- package/dist/modules/forms/service.js +18 -3
- package/dist/modules/forms/service.js.map +1 -1
- package/dist/modules/forms/starters.d.ts +31 -0
- package/dist/modules/forms/starters.d.ts.map +1 -0
- package/dist/modules/forms/starters.js +94 -0
- package/dist/modules/forms/starters.js.map +1 -0
- package/dist/modules/forms/submission.d.ts +1 -0
- package/dist/modules/forms/submission.d.ts.map +1 -1
- package/dist/modules/forms/submission.js +58 -37
- package/dist/modules/forms/submission.js.map +1 -1
- package/dist/modules/import-export/customFieldCsv.d.ts +9 -0
- package/dist/modules/import-export/customFieldCsv.d.ts.map +1 -0
- package/dist/modules/import-export/customFieldCsv.js +39 -0
- package/dist/modules/import-export/customFieldCsv.js.map +1 -0
- package/dist/modules/import-export/customFieldImport.d.ts +19 -0
- package/dist/modules/import-export/customFieldImport.d.ts.map +1 -0
- package/dist/modules/import-export/customFieldImport.js +76 -0
- package/dist/modules/import-export/customFieldImport.js.map +1 -0
- package/dist/modules/import-export/drafts.d.ts +57 -3
- package/dist/modules/import-export/drafts.d.ts.map +1 -1
- package/dist/modules/import-export/drafts.js +65 -3
- package/dist/modules/import-export/drafts.js.map +1 -1
- package/dist/modules/import-export/exportRows.d.ts +15 -13
- package/dist/modules/import-export/exportRows.d.ts.map +1 -1
- package/dist/modules/import-export/exportRows.js +99 -26
- package/dist/modules/import-export/exportRows.js.map +1 -1
- package/dist/modules/import-export/plan.d.ts +42 -11
- package/dist/modules/import-export/plan.d.ts.map +1 -1
- package/dist/modules/import-export/plan.js +198 -56
- package/dist/modules/import-export/plan.js.map +1 -1
- package/dist/modules/import-export/repository.d.ts +58 -2
- package/dist/modules/import-export/repository.d.ts.map +1 -1
- package/dist/modules/import-export/repository.js +201 -12
- 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 +5 -5
- package/dist/modules/import-export/routes.js.map +1 -1
- package/dist/modules/import-export/service.d.ts +8 -3
- package/dist/modules/import-export/service.d.ts.map +1 -1
- package/dist/modules/import-export/service.js +133 -40
- package/dist/modules/import-export/service.js.map +1 -1
- package/dist/modules/import-export/streams.d.ts +2 -2
- package/dist/modules/import-export/streams.d.ts.map +1 -1
- package/dist/modules/import-export/streams.js +50 -9
- 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 +13 -7
- package/dist/modules/import-export/tools.js.map +1 -1
- package/dist/modules/import-export/validation.d.ts +5 -1
- package/dist/modules/import-export/validation.d.ts.map +1 -1
- package/dist/modules/import-export/validation.js +89 -2
- package/dist/modules/import-export/validation.js.map +1 -1
- package/dist/modules/import-export/writes.d.ts +2 -1
- package/dist/modules/import-export/writes.d.ts.map +1 -1
- package/dist/modules/import-export/writes.js +358 -25
- package/dist/modules/import-export/writes.js.map +1 -1
- package/dist/modules/lists/repository.d.ts +0 -1
- package/dist/modules/lists/repository.d.ts.map +1 -1
- package/dist/modules/lists/repository.js +0 -1
- package/dist/modules/lists/repository.js.map +1 -1
- package/dist/modules/lists/routes.d.ts +0 -2
- package/dist/modules/lists/routes.d.ts.map +1 -1
- package/dist/modules/lists/routes.js +0 -8
- package/dist/modules/lists/routes.js.map +1 -1
- package/dist/modules/lists/schema.d.ts +0 -17
- package/dist/modules/lists/schema.d.ts.map +1 -1
- package/dist/modules/lists/schema.js +0 -10
- package/dist/modules/lists/schema.js.map +1 -1
- package/dist/modules/lists/service.d.ts +2 -14
- package/dist/modules/lists/service.d.ts.map +1 -1
- package/dist/modules/lists/service.js +7 -53
- package/dist/modules/lists/service.js.map +1 -1
- package/dist/modules/lists/starters.d.ts +12 -0
- package/dist/modules/lists/starters.d.ts.map +1 -0
- package/dist/modules/lists/starters.js +4 -0
- package/dist/modules/lists/starters.js.map +1 -0
- package/dist/modules/mcp/protocol.d.ts.map +1 -1
- package/dist/modules/mcp/protocol.js +13 -0
- package/dist/modules/mcp/protocol.js.map +1 -1
- package/dist/modules/notes/repository.d.ts +2 -0
- package/dist/modules/notes/repository.d.ts.map +1 -1
- package/dist/modules/notes/repository.js +9 -0
- package/dist/modules/notes/repository.js.map +1 -1
- package/dist/modules/opportunities/events.d.ts +9 -0
- package/dist/modules/opportunities/events.d.ts.map +1 -1
- package/dist/modules/opportunities/events.js +4 -0
- package/dist/modules/opportunities/events.js.map +1 -1
- package/dist/modules/opportunities/index.d.ts.map +1 -1
- package/dist/modules/opportunities/index.js +4 -2
- package/dist/modules/opportunities/index.js.map +1 -1
- package/dist/modules/opportunities/routes.d.ts +2 -0
- package/dist/modules/opportunities/routes.d.ts.map +1 -1
- package/dist/modules/opportunities/routes.js +8 -1
- package/dist/modules/opportunities/routes.js.map +1 -1
- package/dist/modules/opportunities/schema.d.ts +34 -0
- package/dist/modules/opportunities/schema.d.ts.map +1 -1
- package/dist/modules/opportunities/schema.js +7 -2
- package/dist/modules/opportunities/schema.js.map +1 -1
- package/dist/modules/opportunities/service.d.ts.map +1 -1
- package/dist/modules/opportunities/service.js +2 -0
- package/dist/modules/opportunities/service.js.map +1 -1
- package/dist/modules/opportunities/tools.d.ts +2 -1
- package/dist/modules/opportunities/tools.d.ts.map +1 -1
- package/dist/modules/opportunities/tools.js +3 -1
- package/dist/modules/opportunities/tools.js.map +1 -1
- package/dist/modules/partnerships/events.d.ts +9 -0
- package/dist/modules/partnerships/events.d.ts.map +1 -1
- package/dist/modules/partnerships/events.js +4 -0
- package/dist/modules/partnerships/events.js.map +1 -1
- package/dist/modules/partnerships/index.d.ts.map +1 -1
- package/dist/modules/partnerships/index.js +4 -2
- package/dist/modules/partnerships/index.js.map +1 -1
- package/dist/modules/partnerships/routes.d.ts +2 -0
- package/dist/modules/partnerships/routes.d.ts.map +1 -1
- package/dist/modules/partnerships/routes.js +8 -1
- package/dist/modules/partnerships/routes.js.map +1 -1
- package/dist/modules/partnerships/schema.d.ts +34 -0
- package/dist/modules/partnerships/schema.d.ts.map +1 -1
- package/dist/modules/partnerships/schema.js +7 -2
- package/dist/modules/partnerships/schema.js.map +1 -1
- package/dist/modules/partnerships/service.d.ts.map +1 -1
- package/dist/modules/partnerships/service.js +2 -0
- package/dist/modules/partnerships/service.js.map +1 -1
- package/dist/modules/partnerships/tools.d.ts +2 -1
- package/dist/modules/partnerships/tools.d.ts.map +1 -1
- package/dist/modules/partnerships/tools.js +3 -1
- package/dist/modules/partnerships/tools.js.map +1 -1
- package/dist/modules/people/personConsentWrites.d.ts +1 -1
- package/dist/modules/people/schema.js +1 -1
- package/dist/modules/people/schema.js.map +1 -1
- package/dist/modules/plans/repository.d.ts +2 -0
- package/dist/modules/plans/repository.d.ts.map +1 -1
- package/dist/modules/plans/repository.js +9 -0
- package/dist/modules/plans/repository.js.map +1 -1
- package/dist/modules/raises/events.d.ts +9 -0
- package/dist/modules/raises/events.d.ts.map +1 -1
- package/dist/modules/raises/events.js +4 -0
- package/dist/modules/raises/events.js.map +1 -1
- package/dist/modules/raises/index.d.ts.map +1 -1
- package/dist/modules/raises/index.js +4 -2
- package/dist/modules/raises/index.js.map +1 -1
- package/dist/modules/raises/routes.d.ts +2 -0
- package/dist/modules/raises/routes.d.ts.map +1 -1
- package/dist/modules/raises/routes.js +8 -1
- package/dist/modules/raises/routes.js.map +1 -1
- package/dist/modules/raises/schema.d.ts +34 -0
- package/dist/modules/raises/schema.d.ts.map +1 -1
- package/dist/modules/raises/schema.js +7 -2
- package/dist/modules/raises/schema.js.map +1 -1
- package/dist/modules/raises/service.d.ts.map +1 -1
- package/dist/modules/raises/service.js +2 -0
- package/dist/modules/raises/service.js.map +1 -1
- package/dist/modules/raises/tools.d.ts +2 -1
- package/dist/modules/raises/tools.d.ts.map +1 -1
- package/dist/modules/raises/tools.js +3 -1
- package/dist/modules/raises/tools.js.map +1 -1
- package/dist/modules/workspace/routes.d.ts +0 -2
- package/dist/modules/workspace/routes.d.ts.map +1 -1
- package/dist/modules/workspace/routes.js +0 -6
- package/dist/modules/workspace/routes.js.map +1 -1
- package/dist/modules/workspace/schema.d.ts +0 -34
- package/dist/modules/workspace/schema.d.ts.map +1 -1
- package/dist/modules/workspace/schema.js +0 -2
- package/dist/modules/workspace/schema.js.map +1 -1
- package/dist/modules/workspace/seedStarterForms.d.ts +17 -0
- package/dist/modules/workspace/seedStarterForms.d.ts.map +1 -0
- package/dist/modules/workspace/seedStarterForms.js +71 -0
- package/dist/modules/workspace/seedStarterForms.js.map +1 -0
- package/dist/modules/workspace/service.d.ts +0 -4
- package/dist/modules/workspace/service.d.ts.map +1 -1
- package/dist/modules/workspace/service.js +20 -10
- package/dist/modules/workspace/service.js.map +1 -1
- package/dist/modules/workspace/tools.js +1 -1
- package/dist/modules/workspace/tools.js.map +1 -1
- package/dist/testing/fixtures.d.ts.map +1 -1
- package/dist/testing/fixtures.js +1 -0
- package/dist/testing/fixtures.js.map +1 -1
- package/migrations/0037_drop_lists_consent_purpose_id.sql +2 -0
- package/migrations/0038_smart_white_queen.sql +2 -0
- package/migrations/0039_form_map_to_open.sql +1 -0
- package/migrations/0040_pipeline_converted_to.sql +20 -0
- package/migrations/0041_api_key_scopes.sql +1 -0
- package/migrations/0042_drop_workspace_identity.sql +2 -0
- package/migrations/meta/0038_snapshot.json +6554 -0
- package/migrations/meta/_journal.json +42 -0
- package/package.json +2 -2
- package/src/app.ts +3 -0
- package/src/lib/actor.ts +3 -1
- package/src/lib/apiKeyScopes.ts +213 -0
- package/src/modules/activities/repository.ts +24 -0
- package/src/modules/agent-tasks/repository.ts +24 -0
- package/src/modules/api-keys/routes.ts +5 -0
- package/src/modules/api-keys/schema.ts +2 -0
- package/src/modules/api-keys/scopeMiddleware.ts +30 -0
- package/src/modules/api-keys/service.ts +36 -2
- package/src/modules/auth/credentials.ts +4 -0
- package/src/modules/consent-purposes/index.ts +1 -1
- package/src/modules/consent-purposes/schema.ts +3 -3
- package/src/modules/consent-purposes/service.ts +7 -16
- package/src/modules/consent-purposes/starters.ts +1 -1
- package/src/modules/consent-purposes/tools.ts +1 -1
- package/src/modules/conversions/clearPointers.ts +81 -0
- package/src/modules/conversions/factory.ts +20 -0
- package/src/modules/conversions/fieldMap.ts +548 -0
- package/src/modules/conversions/index.ts +6 -0
- package/src/modules/conversions/mcp.ts +71 -0
- package/src/modules/conversions/repoint.ts +146 -0
- package/src/modules/conversions/routes.ts +68 -0
- package/src/modules/conversions/service.ts +310 -0
- package/src/modules/conversions/wire.ts +42 -0
- package/src/modules/deals/events.ts +9 -0
- package/src/modules/deals/index.ts +4 -2
- package/src/modules/deals/routes.ts +11 -1
- package/src/modules/deals/schema.ts +10 -2
- package/src/modules/deals/service.ts +3 -0
- package/src/modules/deals/tools.ts +9 -1
- package/src/modules/decisions/repository.ts +23 -1
- package/src/modules/enquiries/events.ts +8 -2
- package/src/modules/enquiries/index.ts +4 -2
- package/src/modules/enquiries/routes.ts +11 -13
- package/src/modules/enquiries/schema.ts +12 -3
- package/src/modules/enquiries/service.ts +3 -150
- package/src/modules/enquiries/tools.ts +9 -18
- package/src/modules/forms/applyMappedFields.ts +248 -0
- package/src/modules/forms/applySubmissionFields.ts +435 -0
- package/src/modules/forms/fields.ts +31 -7
- package/src/modules/forms/mapping.ts +20 -3
- package/src/modules/forms/repository.ts +0 -7
- package/src/modules/forms/routes.ts +1 -2
- package/src/modules/forms/schema.ts +0 -2
- package/src/modules/forms/service.ts +31 -4
- package/src/modules/forms/starters.ts +129 -0
- package/src/modules/forms/submission.ts +135 -69
- package/src/modules/import-export/customFieldCsv.ts +55 -0
- package/src/modules/import-export/customFieldImport.ts +111 -0
- package/src/modules/import-export/drafts.ts +151 -3
- package/src/modules/import-export/exportRows.ts +222 -68
- package/src/modules/import-export/plan.ts +321 -67
- package/src/modules/import-export/repository.ts +356 -14
- package/src/modules/import-export/routes.ts +8 -8
- package/src/modules/import-export/service.ts +208 -45
- package/src/modules/import-export/streams.ts +95 -13
- package/src/modules/import-export/tools.ts +14 -6
- package/src/modules/import-export/validation.ts +128 -0
- package/src/modules/import-export/writes.ts +559 -27
- package/src/modules/lists/repository.ts +0 -2
- package/src/modules/lists/routes.ts +0 -8
- package/src/modules/lists/schema.ts +0 -10
- package/src/modules/lists/service.ts +9 -107
- package/src/modules/lists/starters.ts +16 -0
- package/src/modules/mcp/protocol.ts +18 -0
- package/src/modules/notes/repository.ts +24 -0
- package/src/modules/opportunities/events.ts +9 -0
- package/src/modules/opportunities/index.ts +4 -2
- package/src/modules/opportunities/routes.ts +11 -1
- package/src/modules/opportunities/schema.ts +10 -2
- package/src/modules/opportunities/service.ts +3 -0
- package/src/modules/opportunities/tools.ts +9 -1
- package/src/modules/partnerships/events.ts +9 -0
- package/src/modules/partnerships/index.ts +4 -2
- package/src/modules/partnerships/routes.ts +11 -1
- package/src/modules/partnerships/schema.ts +10 -2
- package/src/modules/partnerships/service.ts +3 -0
- package/src/modules/partnerships/tools.ts +9 -1
- package/src/modules/people/personConsentWrites.ts +1 -1
- package/src/modules/people/schema.ts +1 -1
- package/src/modules/plans/repository.ts +24 -0
- package/src/modules/raises/events.ts +9 -0
- package/src/modules/raises/index.ts +4 -2
- package/src/modules/raises/routes.ts +11 -1
- package/src/modules/raises/schema.ts +10 -2
- package/src/modules/raises/service.ts +3 -0
- package/src/modules/raises/tools.ts +9 -1
- package/src/modules/workspace/routes.ts +0 -6
- package/src/modules/workspace/schema.ts +0 -2
- package/src/modules/workspace/seedStarterForms.ts +98 -0
- package/src/modules/workspace/service.ts +23 -15
- package/src/modules/workspace/tools.ts +1 -1
- package/src/testing/fixtures.ts +1 -0
|
@@ -1,22 +1,28 @@
|
|
|
1
|
-
import { OBJECT_COLUMNS } from '@kelpie/schemas'
|
|
2
|
-
import type {
|
|
1
|
+
import { OBJECT_COLUMNS, customFieldObjectTypeForExport } from '@kelpie/schemas'
|
|
2
|
+
import type { CsvColumn, CustomFieldValue, ExportObject } from '@kelpie/schemas'
|
|
3
3
|
|
|
4
|
+
import type { CustomFieldDefinitionRecord } from '../custom-fields/repository.ts'
|
|
5
|
+
import { customFieldCells, customFieldDefinitionCells, customFieldHeaderKeys } from './customFieldCsv.ts'
|
|
4
6
|
import { centsToMoney } from './mapping.ts'
|
|
5
7
|
import type {
|
|
6
8
|
ExportCompanyRow,
|
|
7
9
|
ExportDealRow,
|
|
10
|
+
ExportEnquiryRow,
|
|
11
|
+
ExportOpportunityRow,
|
|
12
|
+
ExportPartnershipRow,
|
|
8
13
|
ExportPersonRow,
|
|
9
14
|
ExportPositionRow,
|
|
15
|
+
ExportRaiseRow,
|
|
10
16
|
} from './repository.ts'
|
|
11
17
|
|
|
12
18
|
/**
|
|
13
|
-
* Records as CSV cells, in the header order of `OBJECT_COLUMNS
|
|
19
|
+
* Records as CSV cells, in the header order of `OBJECT_COLUMNS` and
|
|
20
|
+
* `EXPORT_ONLY_COLUMNS`, plus workspace custom field keys when the object
|
|
21
|
+
* carries them.
|
|
14
22
|
*
|
|
15
|
-
* An export writes what an import reads: the stage is its
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* `custom` source and no mapping at all — every header matches a column name
|
|
19
|
-
* exactly.
|
|
23
|
+
* An export writes what an import reads where import exists: the stage is its
|
|
24
|
+
* **slug**, and money is the major unit rather than cents. Custom field values
|
|
25
|
+
* append as columns named by definition key.
|
|
20
26
|
*
|
|
21
27
|
* Pure.
|
|
22
28
|
*/
|
|
@@ -26,85 +32,233 @@ function joinList(values: readonly string[]): string {
|
|
|
26
32
|
return values.join('|')
|
|
27
33
|
}
|
|
28
34
|
|
|
35
|
+
function baseColumnsFor(object: ExportObject): readonly CsvColumn[] {
|
|
36
|
+
return OBJECT_COLUMNS[object]
|
|
37
|
+
}
|
|
38
|
+
|
|
29
39
|
/**
|
|
30
40
|
* The header row of an export and of a template.
|
|
31
41
|
*
|
|
32
|
-
* `importOnly` columns are left out
|
|
33
|
-
*
|
|
34
|
-
* writes, but none is a field on the person row. A template also leaves out
|
|
35
|
-
* `exportOnly` columns (`do_not_contact`, `consents`), which the export writes
|
|
36
|
-
* for readability but a caller round-trips through the per-purpose columns and
|
|
37
|
-
* `consent_purpose_id` on the job.
|
|
42
|
+
* `importOnly` columns are left out. Custom field definition keys append in
|
|
43
|
+
* workspace sort order when the object type carries custom fields.
|
|
38
44
|
*/
|
|
39
|
-
export function headersFor(
|
|
40
|
-
|
|
45
|
+
export function headersFor(
|
|
46
|
+
object: ExportObject,
|
|
47
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
48
|
+
): readonly string[] {
|
|
49
|
+
const base = baseColumnsFor(object)
|
|
41
50
|
.filter((column) => column.importOnly !== true)
|
|
42
51
|
.map((column) => column.key)
|
|
52
|
+
|
|
53
|
+
if (customFieldObjectTypeForExport(object) === null) {
|
|
54
|
+
return base
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return [...base, ...customFieldHeaderKeys(definitions)]
|
|
43
58
|
}
|
|
44
59
|
|
|
45
60
|
/** The template's headers — the round-trippable ones for a caller to fill in. */
|
|
46
|
-
export function templateHeadersFor(
|
|
47
|
-
|
|
61
|
+
export function templateHeadersFor(
|
|
62
|
+
object: ExportObject,
|
|
63
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
64
|
+
): readonly string[] {
|
|
65
|
+
const base = baseColumnsFor(object)
|
|
48
66
|
.filter((column) => column.importOnly !== true && column.exportOnly !== true)
|
|
49
67
|
.map((column) => column.key)
|
|
68
|
+
|
|
69
|
+
if (customFieldObjectTypeForExport(object) === null) {
|
|
70
|
+
return base
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return [...base, ...customFieldHeaderKeys(definitions)]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function withCustomFields(
|
|
77
|
+
base: readonly string[],
|
|
78
|
+
customFields: Readonly<Record<string, CustomFieldValue>> | undefined,
|
|
79
|
+
definitions: readonly CustomFieldDefinitionRecord[],
|
|
80
|
+
): readonly string[] {
|
|
81
|
+
if (definitions.length === 0) {
|
|
82
|
+
return base
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return [...base, ...customFieldCells(customFields, customFieldHeaderKeys(definitions))]
|
|
50
86
|
}
|
|
51
87
|
|
|
52
|
-
export function companyCells(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
export function companyCells(
|
|
89
|
+
row: ExportCompanyRow,
|
|
90
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
91
|
+
): readonly string[] {
|
|
92
|
+
return withCustomFields(
|
|
93
|
+
[
|
|
94
|
+
row.name,
|
|
95
|
+
row.domain ?? '',
|
|
96
|
+
row.industry ?? '',
|
|
97
|
+
row.stage,
|
|
98
|
+
row.sizeBand,
|
|
99
|
+
row.accountType,
|
|
100
|
+
row.icpFit,
|
|
101
|
+
row.description,
|
|
102
|
+
row.summary,
|
|
103
|
+
joinList(row.tags),
|
|
104
|
+
row.website ?? '',
|
|
105
|
+
row.hq ?? '',
|
|
106
|
+
],
|
|
107
|
+
row.customFields,
|
|
108
|
+
definitions,
|
|
109
|
+
)
|
|
67
110
|
}
|
|
68
111
|
|
|
69
|
-
export function personCells(
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
112
|
+
export function personCells(
|
|
113
|
+
row: ExportPersonRow,
|
|
114
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
115
|
+
): readonly string[] {
|
|
116
|
+
return withCustomFields(
|
|
117
|
+
[
|
|
118
|
+
row.name,
|
|
119
|
+
row.salutation ?? '',
|
|
120
|
+
row.firstName ?? '',
|
|
121
|
+
row.lastName ?? '',
|
|
122
|
+
row.suffix ?? '',
|
|
123
|
+
row.email ?? '',
|
|
124
|
+
row.timezone ?? '',
|
|
125
|
+
row.location ?? '',
|
|
126
|
+
row.preferredChannel,
|
|
127
|
+
row.influence,
|
|
128
|
+
row.relationship,
|
|
129
|
+
row.summary,
|
|
130
|
+
joinList(row.tags),
|
|
131
|
+
joinList(row.phones),
|
|
132
|
+
row.doNotContact ? 'true' : 'false',
|
|
133
|
+
row.consents,
|
|
134
|
+
],
|
|
135
|
+
row.customFields,
|
|
136
|
+
definitions,
|
|
137
|
+
)
|
|
88
138
|
}
|
|
89
139
|
|
|
90
140
|
export function positionCells(row: ExportPositionRow): readonly string[] {
|
|
91
141
|
return [row.personEmail ?? '', row.companyDomain ?? '', row.title]
|
|
92
142
|
}
|
|
93
143
|
|
|
94
|
-
export function dealCells(
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
144
|
+
export function dealCells(
|
|
145
|
+
row: ExportDealRow,
|
|
146
|
+
personEmails: readonly string[],
|
|
147
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
148
|
+
): readonly string[] {
|
|
149
|
+
return withCustomFields(
|
|
150
|
+
[
|
|
151
|
+
row.name,
|
|
152
|
+
row.companyDomain ?? '',
|
|
153
|
+
row.stageSlug,
|
|
154
|
+
centsToMoney(row.valueCents),
|
|
155
|
+
row.ownerEmail ?? '',
|
|
156
|
+
row.expectedClose ?? '',
|
|
157
|
+
joinList(personEmails),
|
|
158
|
+
joinList(row.competitors),
|
|
159
|
+
row.risks,
|
|
160
|
+
row.whyWin,
|
|
161
|
+
row.summary,
|
|
162
|
+
joinList(row.tags),
|
|
163
|
+
row.externalId ?? '',
|
|
164
|
+
],
|
|
165
|
+
row.customFields,
|
|
166
|
+
definitions,
|
|
167
|
+
)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
export function opportunityCells(
|
|
171
|
+
row: ExportOpportunityRow,
|
|
172
|
+
personEmails: readonly string[],
|
|
173
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
174
|
+
): readonly string[] {
|
|
175
|
+
return withCustomFields(
|
|
176
|
+
[
|
|
177
|
+
row.name,
|
|
178
|
+
row.kind,
|
|
179
|
+
row.companyDomain ?? '',
|
|
180
|
+
row.stageSlug,
|
|
181
|
+
row.ownerEmail ?? '',
|
|
182
|
+
row.expectedClose ?? '',
|
|
183
|
+
joinList(personEmails),
|
|
184
|
+
row.summary,
|
|
185
|
+
joinList(row.tags),
|
|
186
|
+
],
|
|
187
|
+
row.customFields,
|
|
188
|
+
definitions,
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
export function enquiryCells(
|
|
193
|
+
row: ExportEnquiryRow,
|
|
194
|
+
personEmails: readonly string[],
|
|
195
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
196
|
+
): readonly string[] {
|
|
197
|
+
return withCustomFields(
|
|
198
|
+
[
|
|
199
|
+
row.name,
|
|
200
|
+
row.source,
|
|
201
|
+
row.companyDomain ?? '',
|
|
202
|
+
row.stageSlug,
|
|
203
|
+
row.ownerEmail ?? '',
|
|
204
|
+
joinList(personEmails),
|
|
205
|
+
row.summary,
|
|
206
|
+
joinList(row.tags),
|
|
207
|
+
],
|
|
208
|
+
row.customFields,
|
|
209
|
+
definitions,
|
|
210
|
+
)
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export function partnershipCells(
|
|
214
|
+
row: ExportPartnershipRow,
|
|
215
|
+
personEmails: readonly string[],
|
|
216
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
217
|
+
): readonly string[] {
|
|
218
|
+
return withCustomFields(
|
|
219
|
+
[
|
|
220
|
+
row.name,
|
|
221
|
+
row.companyDomain ?? '',
|
|
222
|
+
row.stageSlug,
|
|
223
|
+
row.kind,
|
|
224
|
+
row.nextTouchpoint ?? '',
|
|
225
|
+
row.ownerEmail ?? '',
|
|
226
|
+
row.goals,
|
|
227
|
+
row.successLooksLike,
|
|
228
|
+
joinList(personEmails),
|
|
229
|
+
row.summary,
|
|
230
|
+
joinList(row.tags),
|
|
231
|
+
],
|
|
232
|
+
row.customFields,
|
|
233
|
+
definitions,
|
|
234
|
+
)
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export function raiseCells(
|
|
238
|
+
row: ExportRaiseRow,
|
|
239
|
+
personEmails: readonly string[],
|
|
240
|
+
definitions: readonly CustomFieldDefinitionRecord[] = [],
|
|
241
|
+
): readonly string[] {
|
|
242
|
+
return withCustomFields(
|
|
243
|
+
[
|
|
244
|
+
row.name,
|
|
245
|
+
row.companyDomain ?? '',
|
|
246
|
+
row.stageSlug,
|
|
247
|
+
row.checkSizeCents === null ? '' : centsToMoney(row.checkSizeCents),
|
|
248
|
+
row.currency ?? '',
|
|
249
|
+
row.thesisFit,
|
|
250
|
+
row.passReason ?? '',
|
|
251
|
+
row.ownerEmail ?? '',
|
|
252
|
+
row.expectedClose ?? '',
|
|
253
|
+
joinList(personEmails),
|
|
254
|
+
row.summary,
|
|
255
|
+
joinList(row.tags),
|
|
256
|
+
],
|
|
257
|
+
row.customFields,
|
|
258
|
+
definitions,
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export function customFieldDefinitionRowCells(row: CustomFieldDefinitionRecord): readonly string[] {
|
|
263
|
+
return customFieldDefinitionCells(row)
|
|
110
264
|
}
|