@kelpie/server 0.6.0 → 0.8.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 +13 -0
- package/dist/app.d.ts.map +1 -1
- package/dist/app.js +9 -0
- package/dist/app.js.map +1 -1
- package/dist/boot.d.ts +42 -0
- package/dist/boot.d.ts.map +1 -0
- package/dist/boot.js +57 -0
- package/dist/boot.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/config.d.ts +7 -0
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +2 -0
- package/dist/lib/config.js.map +1 -1
- 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 +2 -0
- package/dist/lib/ids.d.ts.map +1 -1
- package/dist/lib/ids.js +2 -0
- package/dist/lib/ids.js.map +1 -1
- package/dist/lib/kelpieConfigFile.d.ts +6 -0
- package/dist/lib/kelpieConfigFile.d.ts.map +1 -1
- package/dist/lib/kelpieConfigFile.js +1 -0
- package/dist/lib/kelpieConfigFile.js.map +1 -1
- package/dist/modules/attachedRecords.d.ts.map +1 -1
- package/dist/modules/attachedRecords.js +4 -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/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 +2 -0
- package/dist/modules/companies/routes.d.ts.map +1 -1
- package/dist/modules/companies/routes.js +11 -0
- package/dist/modules/companies/routes.js.map +1 -1
- package/dist/modules/companies/schema.d.ts +17 -0
- package/dist/modules/companies/schema.d.ts.map +1 -1
- package/dist/modules/companies/schema.js +5 -1
- package/dist/modules/companies/schema.js.map +1 -1
- package/dist/modules/companies/service.d.ts +1 -0
- package/dist/modules/companies/service.d.ts.map +1 -1
- package/dist/modules/companies/service.js +22 -0
- package/dist/modules/companies/service.js.map +1 -1
- package/dist/modules/core.d.ts.map +1 -1
- package/dist/modules/core.js +11 -0
- package/dist/modules/core.js.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/eventCatalogs.d.ts +36 -0
- package/dist/modules/eventCatalogs.d.ts.map +1 -0
- package/dist/modules/eventCatalogs.js +36 -0
- package/dist/modules/eventCatalogs.js.map +1 -0
- package/dist/modules/import-export/drafts.d.ts +9 -0
- package/dist/modules/import-export/drafts.d.ts.map +1 -1
- package/dist/modules/import-export/drafts.js +25 -0
- package/dist/modules/import-export/drafts.js.map +1 -1
- package/dist/modules/import-export/exportRows.d.ts +9 -0
- package/dist/modules/import-export/exportRows.d.ts.map +1 -1
- package/dist/modules/import-export/exportRows.js +10 -1
- package/dist/modules/import-export/exportRows.js.map +1 -1
- package/dist/modules/import-export/plan.d.ts +23 -1
- package/dist/modules/import-export/plan.d.ts.map +1 -1
- package/dist/modules/import-export/plan.js +62 -3
- 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 +25 -0
- package/dist/modules/import-export/presets.js.map +1 -1
- package/dist/modules/import-export/repository.d.ts +17 -0
- package/dist/modules/import-export/repository.d.ts.map +1 -1
- package/dist/modules/import-export/repository.js +21 -1
- 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 -1
- package/dist/modules/import-export/routes.js.map +1 -1
- package/dist/modules/import-export/schema.d.ts +55 -0
- package/dist/modules/import-export/schema.d.ts.map +1 -1
- package/dist/modules/import-export/schema.js +13 -1
- package/dist/modules/import-export/schema.js.map +1 -1
- package/dist/modules/import-export/service.d.ts +4 -1
- package/dist/modules/import-export/service.d.ts.map +1 -1
- package/dist/modules/import-export/service.js +51 -3
- package/dist/modules/import-export/service.js.map +1 -1
- package/dist/modules/import-export/tools.d.ts.map +1 -1
- package/dist/modules/import-export/tools.js +7 -1
- package/dist/modules/import-export/tools.js.map +1 -1
- package/dist/modules/import-export/writes.d.ts +16 -0
- package/dist/modules/import-export/writes.d.ts.map +1 -1
- package/dist/modules/import-export/writes.js +77 -2
- 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 +69 -0
- package/dist/modules/lists/repository.d.ts.map +1 -0
- package/dist/modules/lists/repository.js +165 -0
- package/dist/modules/lists/repository.js.map +1 -0
- package/dist/modules/lists/routes.d.ts +51 -0
- package/dist/modules/lists/routes.d.ts.map +1 -0
- package/dist/modules/lists/routes.js +160 -0
- package/dist/modules/lists/routes.js.map +1 -0
- package/dist/modules/lists/schema.d.ts +264 -0
- package/dist/modules/lists/schema.d.ts.map +1 -0
- package/dist/modules/lists/schema.js +73 -0
- package/dist/modules/lists/schema.js.map +1 -0
- package/dist/modules/lists/service.d.ts +70 -0
- package/dist/modules/lists/service.d.ts.map +1 -0
- package/dist/modules/lists/service.js +214 -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/people/repository.d.ts +11 -0
- package/dist/modules/people/repository.d.ts.map +1 -1
- package/dist/modules/people/repository.js +16 -0
- package/dist/modules/people/repository.js.map +1 -1
- package/dist/modules/people/service.d.ts.map +1 -1
- package/dist/modules/people/service.js +18 -0
- package/dist/modules/people/service.js.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/sample-data/fixture.d.ts +139 -0
- package/dist/modules/sample-data/fixture.d.ts.map +1 -0
- package/dist/modules/sample-data/fixture.js +461 -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 +43 -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 +24 -0
- package/dist/modules/sample-data/routes.js.map +1 -0
- package/dist/modules/sample-data/service.d.ts +38 -0
- package/dist/modules/sample-data/service.d.ts.map +1 -0
- package/dist/modules/sample-data/service.js +412 -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/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/workspace/service.d.ts.map +1 -1
- package/dist/modules/workspace/service.js +10 -1
- package/dist/modules/workspace/service.js.map +1 -1
- package/dist/schema/index.d.ts +1 -0
- package/dist/schema/index.d.ts.map +1 -1
- package/dist/schema/index.js +1 -0
- package/dist/schema/index.js.map +1 -1
- package/dist/testing/app.d.ts +5 -1
- package/dist/testing/app.d.ts.map +1 -1
- package/dist/testing/app.js +2 -0
- package/dist/testing/app.js.map +1 -1
- package/migrations/0019_sharp_red_skull.sql +4 -0
- package/migrations/0020_early_nemesis.sql +2 -0
- 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/meta/0019_snapshot.json +5138 -0
- package/migrations/meta/0020_snapshot.json +5138 -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/_journal.json +35 -0
- package/package.json +3 -2
- package/src/app.ts +26 -0
- package/src/boot.ts +89 -0
- package/src/index.ts +8 -0
- package/src/lib/config.ts +9 -0
- 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 +2 -0
- package/src/lib/kelpieConfigFile.ts +8 -0
- package/src/modules/attachedRecords.ts +9 -2
- 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/repository.ts +3 -0
- package/src/modules/companies/routes.ts +13 -0
- package/src/modules/companies/schema.ts +5 -1
- package/src/modules/companies/service.ts +25 -0
- package/src/modules/core.ts +11 -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/eventCatalogs.ts +36 -0
- package/src/modules/import-export/drafts.ts +27 -0
- package/src/modules/import-export/exportRows.ts +10 -1
- package/src/modules/import-export/plan.ts +107 -5
- package/src/modules/import-export/presets.ts +25 -0
- package/src/modules/import-export/repository.ts +35 -1
- package/src/modules/import-export/routes.ts +5 -0
- package/src/modules/import-export/schema.ts +13 -0
- package/src/modules/import-export/service.ts +70 -4
- package/src/modules/import-export/tools.ts +9 -0
- package/src/modules/import-export/writes.ts +116 -3
- package/src/modules/lists/events.ts +41 -0
- package/src/modules/lists/index.ts +41 -0
- package/src/modules/lists/repository.ts +313 -0
- package/src/modules/lists/routes.ts +247 -0
- package/src/modules/lists/schema.ts +85 -0
- package/src/modules/lists/service.ts +404 -0
- package/src/modules/lists/tools.ts +128 -0
- package/src/modules/people/repository.ts +26 -0
- package/src/modules/people/service.ts +20 -0
- package/src/modules/positions/routes.ts +4 -2
- package/src/modules/sample-data/fixture.ts +627 -0
- package/src/modules/sample-data/index.ts +50 -0
- package/src/modules/sample-data/routes.ts +49 -0
- package/src/modules/sample-data/service.ts +590 -0
- package/src/modules/sample-data/tools.ts +32 -0
- package/src/modules/smtp-email/index.ts +8 -1
- package/src/modules/workspace/service.ts +13 -1
- package/src/schema/index.ts +1 -0
- package/src/testing/app.ts +7 -1
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
import { and, count, eq, inArray } from 'drizzle-orm';
|
|
2
|
+
import { toEventActor } from '../../lib/actor.js';
|
|
3
|
+
import { AppError } from '../../lib/errors.js';
|
|
4
|
+
import { requireWorkspaceId } from '../auth/actor.js';
|
|
5
|
+
import * as authRepository from '../auth/repository.js';
|
|
6
|
+
import { companies } from '../companies/schema.js';
|
|
7
|
+
import { dealPeople, deals } from '../deals/schema.js';
|
|
8
|
+
import { candidates, roles } from '../hiring/schema.js';
|
|
9
|
+
import { notes } from '../notes/schema.js';
|
|
10
|
+
import { opportunities } from '../opportunities/schema.js';
|
|
11
|
+
import { partnershipPeople, partnerships } from '../partnerships/schema.js';
|
|
12
|
+
import { people } from '../people/schema.js';
|
|
13
|
+
import { pipelineStages } from '../pipelines/schema.js';
|
|
14
|
+
import { planItems } from '../plans/schema.js';
|
|
15
|
+
import { positions } from '../positions/schema.js';
|
|
16
|
+
import { raisePeople, raises } from '../raises/schema.js';
|
|
17
|
+
import { parseMemberRole, roleAllows } from '../workspace/roles.js';
|
|
18
|
+
import { SAMPLE_DATA_FIXTURE } from './fixture.js';
|
|
19
|
+
export function createSampleDataService(dependencies) {
|
|
20
|
+
async function requireAdmin(actor, workspaceId) {
|
|
21
|
+
if (actor.workspaceId !== workspaceId) {
|
|
22
|
+
throw AppError.notFound('Workspace not found');
|
|
23
|
+
}
|
|
24
|
+
if (actor.kind === 'api_key' && actor.userId === null) {
|
|
25
|
+
if (!roleAllows(actor.role, 'admin')) {
|
|
26
|
+
throw new AppError('forbidden', 'This action needs the admin role');
|
|
27
|
+
}
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const userId = actor.userId;
|
|
31
|
+
if (userId === null) {
|
|
32
|
+
throw AppError.notFound('Workspace not found');
|
|
33
|
+
}
|
|
34
|
+
const membership = await authRepository.findMembership(dependencies.db, workspaceId, userId);
|
|
35
|
+
if (membership === undefined) {
|
|
36
|
+
throw AppError.notFound('Workspace not found');
|
|
37
|
+
}
|
|
38
|
+
const role = parseMemberRole(membership.role);
|
|
39
|
+
if (role === undefined) {
|
|
40
|
+
throw new Error(`workspace_members.role holds "${membership.role}", which its check forbids`);
|
|
41
|
+
}
|
|
42
|
+
if (!roleAllows(role, 'admin')) {
|
|
43
|
+
throw new AppError('forbidden', 'This action needs the admin role');
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
async install(actor, workspaceId) {
|
|
48
|
+
// The path parameter must match the actor's workspace, and it must be an
|
|
49
|
+
// admin. `requireWorkspaceId` is what CRM endpoints call to reject an
|
|
50
|
+
// actor with no workspace at all.
|
|
51
|
+
requireWorkspaceId(actor);
|
|
52
|
+
await requireAdmin(actor, workspaceId);
|
|
53
|
+
const fixture = SAMPLE_DATA_FIXTURE;
|
|
54
|
+
return dependencies.transaction(async ({ tx }) => {
|
|
55
|
+
const [companiesTally] = await tx
|
|
56
|
+
.select({ value: count() })
|
|
57
|
+
.from(companies)
|
|
58
|
+
.where(eq(companies.workspaceId, workspaceId));
|
|
59
|
+
const [peopleTally] = await tx
|
|
60
|
+
.select({ value: count() })
|
|
61
|
+
.from(people)
|
|
62
|
+
.where(eq(people.workspaceId, workspaceId));
|
|
63
|
+
const alreadyHasData = (companiesTally?.value ?? 0) > 0 || (peopleTally?.value ?? 0) > 0;
|
|
64
|
+
if (alreadyHasData) {
|
|
65
|
+
throw AppError.conflict('This workspace already has CRM data');
|
|
66
|
+
}
|
|
67
|
+
// Every stage this workspace carries, grouped by kind so a deal, an
|
|
68
|
+
// opportunity, a raise and a partnership all resolve their fixture
|
|
69
|
+
// stage slugs against the same read.
|
|
70
|
+
const allStages = await tx
|
|
71
|
+
.select({
|
|
72
|
+
id: pipelineStages.id,
|
|
73
|
+
slug: pipelineStages.slug,
|
|
74
|
+
kind: pipelineStages.kind,
|
|
75
|
+
})
|
|
76
|
+
.from(pipelineStages)
|
|
77
|
+
.where(and(eq(pipelineStages.workspaceId, workspaceId), inArray(pipelineStages.kind, ['deal', 'opportunity', 'raise', 'partnership'])));
|
|
78
|
+
const stageIdByKindAndSlug = new Map();
|
|
79
|
+
for (const row of allStages) {
|
|
80
|
+
stageIdByKindAndSlug.set(stageLookupKey(row.kind, row.slug), row.id);
|
|
81
|
+
}
|
|
82
|
+
const now = dependencies.now();
|
|
83
|
+
const companyIds = new Map();
|
|
84
|
+
const personIds = new Map();
|
|
85
|
+
const dealIds = new Map();
|
|
86
|
+
const opportunityIds = new Map();
|
|
87
|
+
const raiseIds = new Map();
|
|
88
|
+
const partnershipIds = new Map();
|
|
89
|
+
const roleIds = new Map();
|
|
90
|
+
const candidateIds = new Map();
|
|
91
|
+
for (const record of fixture.companies) {
|
|
92
|
+
const id = dependencies.createId('company');
|
|
93
|
+
companyIds.set(record.key, id);
|
|
94
|
+
await tx.insert(companies).values({
|
|
95
|
+
id,
|
|
96
|
+
workspaceId,
|
|
97
|
+
name: record.name,
|
|
98
|
+
domain: record.domain,
|
|
99
|
+
industry: record.industry,
|
|
100
|
+
description: record.description,
|
|
101
|
+
stage: record.stage,
|
|
102
|
+
sizeBand: record.sizeBand,
|
|
103
|
+
hq: record.hq,
|
|
104
|
+
website: record.website,
|
|
105
|
+
accountType: record.accountType,
|
|
106
|
+
icpFit: record.icpFit,
|
|
107
|
+
techStack: [...record.techStack],
|
|
108
|
+
summary: record.summary,
|
|
109
|
+
tags: [...record.tags],
|
|
110
|
+
createdAt: now,
|
|
111
|
+
updatedAt: now,
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
for (const record of fixture.people) {
|
|
115
|
+
const id = dependencies.createId('person');
|
|
116
|
+
personIds.set(record.key, id);
|
|
117
|
+
await tx.insert(people).values({
|
|
118
|
+
id,
|
|
119
|
+
workspaceId,
|
|
120
|
+
name: record.name,
|
|
121
|
+
email: record.email,
|
|
122
|
+
location: record.location,
|
|
123
|
+
preferredChannel: record.preferredChannel,
|
|
124
|
+
influence: record.influence,
|
|
125
|
+
relationship: record.relationship,
|
|
126
|
+
summary: record.summary,
|
|
127
|
+
tags: [...record.tags],
|
|
128
|
+
createdAt: now,
|
|
129
|
+
updatedAt: now,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
for (const record of fixture.positions) {
|
|
133
|
+
const personId = personIds.get(record.personKey);
|
|
134
|
+
const companyId = companyIds.get(record.companyKey);
|
|
135
|
+
if (personId === undefined || companyId === undefined) {
|
|
136
|
+
throw new Error(`Sample position links unknown keys: person=${record.personKey}, company=${record.companyKey}`);
|
|
137
|
+
}
|
|
138
|
+
await tx.insert(positions).values({
|
|
139
|
+
id: dependencies.createId('position'),
|
|
140
|
+
workspaceId,
|
|
141
|
+
personId,
|
|
142
|
+
companyId,
|
|
143
|
+
title: record.title,
|
|
144
|
+
createdAt: now,
|
|
145
|
+
updatedAt: now,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
for (const record of fixture.deals) {
|
|
149
|
+
const stageId = stageIdByKindAndSlug.get(stageLookupKey('deal', record.stageSlug));
|
|
150
|
+
const companyId = companyIds.get(record.companyKey);
|
|
151
|
+
if (stageId === undefined) {
|
|
152
|
+
throw new Error(`Sample deal "${record.name}" names stage "${record.stageSlug}", which this workspace's deal pipeline does not carry`);
|
|
153
|
+
}
|
|
154
|
+
if (companyId === undefined) {
|
|
155
|
+
throw new Error(`Sample deal "${record.name}" names unknown company "${record.companyKey}"`);
|
|
156
|
+
}
|
|
157
|
+
const id = dependencies.createId('deal');
|
|
158
|
+
dealIds.set(record.key, id);
|
|
159
|
+
await tx.insert(deals).values({
|
|
160
|
+
id,
|
|
161
|
+
workspaceId,
|
|
162
|
+
name: record.name,
|
|
163
|
+
companyId,
|
|
164
|
+
stageId,
|
|
165
|
+
valueCents: record.valueCents,
|
|
166
|
+
currency: record.currency,
|
|
167
|
+
expectedClose: record.expectedClose,
|
|
168
|
+
competitors: [],
|
|
169
|
+
risks: record.risks,
|
|
170
|
+
whyWin: record.whyWin,
|
|
171
|
+
summary: record.summary,
|
|
172
|
+
tags: [...record.tags],
|
|
173
|
+
createdAt: now,
|
|
174
|
+
updatedAt: now,
|
|
175
|
+
});
|
|
176
|
+
for (const personKey of record.peopleKeys) {
|
|
177
|
+
const personId = personIds.get(personKey);
|
|
178
|
+
if (personId === undefined) {
|
|
179
|
+
throw new Error(`Sample deal "${record.name}" names unknown person "${personKey}"`);
|
|
180
|
+
}
|
|
181
|
+
await tx.insert(dealPeople).values({ dealId: id, personId });
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
for (const record of fixture.opportunities) {
|
|
185
|
+
const stageId = stageIdByKindAndSlug.get(stageLookupKey('opportunity', record.stageSlug));
|
|
186
|
+
if (stageId === undefined) {
|
|
187
|
+
throw new Error(`Sample opportunity "${record.name}" names stage "${record.stageSlug}", which this workspace's opportunity pipeline does not carry`);
|
|
188
|
+
}
|
|
189
|
+
const companyId = record.companyKey === null ? null : (companyIds.get(record.companyKey) ?? undefined);
|
|
190
|
+
if (companyId === undefined) {
|
|
191
|
+
throw new Error(`Sample opportunity "${record.name}" names unknown company "${String(record.companyKey)}"`);
|
|
192
|
+
}
|
|
193
|
+
const id = dependencies.createId('opportunity');
|
|
194
|
+
opportunityIds.set(record.key, id);
|
|
195
|
+
await tx.insert(opportunities).values({
|
|
196
|
+
id,
|
|
197
|
+
workspaceId,
|
|
198
|
+
name: record.name,
|
|
199
|
+
kind: record.kind,
|
|
200
|
+
stageId,
|
|
201
|
+
companyId,
|
|
202
|
+
expectedClose: record.expectedClose,
|
|
203
|
+
summary: record.summary,
|
|
204
|
+
tags: [...record.tags],
|
|
205
|
+
createdAt: now,
|
|
206
|
+
updatedAt: now,
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
for (const record of fixture.raises) {
|
|
210
|
+
const stageId = stageIdByKindAndSlug.get(stageLookupKey('raise', record.stageSlug));
|
|
211
|
+
const companyId = companyIds.get(record.companyKey);
|
|
212
|
+
if (stageId === undefined) {
|
|
213
|
+
throw new Error(`Sample raise "${record.name}" names stage "${record.stageSlug}", which this workspace's raise pipeline does not carry`);
|
|
214
|
+
}
|
|
215
|
+
if (companyId === undefined) {
|
|
216
|
+
throw new Error(`Sample raise "${record.name}" names unknown company "${record.companyKey}"`);
|
|
217
|
+
}
|
|
218
|
+
const id = dependencies.createId('raise');
|
|
219
|
+
raiseIds.set(record.key, id);
|
|
220
|
+
await tx.insert(raises).values({
|
|
221
|
+
id,
|
|
222
|
+
workspaceId,
|
|
223
|
+
name: record.name,
|
|
224
|
+
companyId,
|
|
225
|
+
stageId,
|
|
226
|
+
checkSizeCents: record.checkSizeCents,
|
|
227
|
+
currency: record.currency,
|
|
228
|
+
thesisFit: record.thesisFit,
|
|
229
|
+
expectedClose: record.expectedClose,
|
|
230
|
+
summary: record.summary,
|
|
231
|
+
tags: [...record.tags],
|
|
232
|
+
createdAt: now,
|
|
233
|
+
updatedAt: now,
|
|
234
|
+
});
|
|
235
|
+
for (const personKey of record.peopleKeys) {
|
|
236
|
+
const personId = personIds.get(personKey);
|
|
237
|
+
if (personId === undefined) {
|
|
238
|
+
throw new Error(`Sample raise "${record.name}" names unknown person "${personKey}"`);
|
|
239
|
+
}
|
|
240
|
+
await tx.insert(raisePeople).values({ raiseId: id, personId });
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
for (const record of fixture.partnerships) {
|
|
244
|
+
const stageId = stageIdByKindAndSlug.get(stageLookupKey('partnership', record.stageSlug));
|
|
245
|
+
const companyId = companyIds.get(record.companyKey);
|
|
246
|
+
if (stageId === undefined) {
|
|
247
|
+
throw new Error(`Sample partnership "${record.name}" names stage "${record.stageSlug}", which this workspace's partnership pipeline does not carry`);
|
|
248
|
+
}
|
|
249
|
+
if (companyId === undefined) {
|
|
250
|
+
throw new Error(`Sample partnership "${record.name}" names unknown company "${record.companyKey}"`);
|
|
251
|
+
}
|
|
252
|
+
const id = dependencies.createId('partnership');
|
|
253
|
+
partnershipIds.set(record.key, id);
|
|
254
|
+
await tx.insert(partnerships).values({
|
|
255
|
+
id,
|
|
256
|
+
workspaceId,
|
|
257
|
+
name: record.name,
|
|
258
|
+
companyId,
|
|
259
|
+
stageId,
|
|
260
|
+
kind: record.kind,
|
|
261
|
+
nextTouchpoint: record.nextTouchpoint,
|
|
262
|
+
goals: record.goals,
|
|
263
|
+
successLooksLike: record.successLooksLike,
|
|
264
|
+
summary: record.summary,
|
|
265
|
+
tags: [...record.tags],
|
|
266
|
+
createdAt: now,
|
|
267
|
+
updatedAt: now,
|
|
268
|
+
});
|
|
269
|
+
for (const personKey of record.peopleKeys) {
|
|
270
|
+
const personId = personIds.get(personKey);
|
|
271
|
+
if (personId === undefined) {
|
|
272
|
+
throw new Error(`Sample partnership "${record.name}" names unknown person "${personKey}"`);
|
|
273
|
+
}
|
|
274
|
+
await tx.insert(partnershipPeople).values({ partnershipId: id, personId });
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
for (const record of fixture.roles) {
|
|
278
|
+
const id = dependencies.createId('role');
|
|
279
|
+
roleIds.set(record.key, id);
|
|
280
|
+
await tx.insert(roles).values({
|
|
281
|
+
id,
|
|
282
|
+
workspaceId,
|
|
283
|
+
title: record.title,
|
|
284
|
+
status: record.status,
|
|
285
|
+
createdAt: now,
|
|
286
|
+
updatedAt: now,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
for (const record of fixture.candidates) {
|
|
290
|
+
const roleId = roleIds.get(record.roleKey);
|
|
291
|
+
const personId = personIds.get(record.personKey);
|
|
292
|
+
const referrerPersonId = record.referrerPersonKey === null
|
|
293
|
+
? null
|
|
294
|
+
: (personIds.get(record.referrerPersonKey) ?? undefined);
|
|
295
|
+
if (roleId === undefined) {
|
|
296
|
+
throw new Error(`Sample candidate "${record.key}" names unknown role "${record.roleKey}"`);
|
|
297
|
+
}
|
|
298
|
+
if (personId === undefined) {
|
|
299
|
+
throw new Error(`Sample candidate "${record.key}" names unknown person "${record.personKey}"`);
|
|
300
|
+
}
|
|
301
|
+
if (referrerPersonId === undefined) {
|
|
302
|
+
throw new Error(`Sample candidate "${record.key}" names unknown referrer "${String(record.referrerPersonKey)}"`);
|
|
303
|
+
}
|
|
304
|
+
const id = dependencies.createId('candidate');
|
|
305
|
+
candidateIds.set(record.key, id);
|
|
306
|
+
await tx.insert(candidates).values({
|
|
307
|
+
id,
|
|
308
|
+
workspaceId,
|
|
309
|
+
roleId,
|
|
310
|
+
personId,
|
|
311
|
+
status: record.status,
|
|
312
|
+
// The interview_stage column carries a value only while the
|
|
313
|
+
// candidate is in process. Every other status clears it, which
|
|
314
|
+
// the service does the same way `hiring` does for a PATCH.
|
|
315
|
+
interviewStage: record.status === 'in_process' ? record.interviewStage : null,
|
|
316
|
+
referrerPersonId,
|
|
317
|
+
createdAt: now,
|
|
318
|
+
updatedAt: now,
|
|
319
|
+
});
|
|
320
|
+
}
|
|
321
|
+
for (const record of fixture.plans) {
|
|
322
|
+
const dealId = dealIds.get(record.targetDealKey);
|
|
323
|
+
if (dealId === undefined) {
|
|
324
|
+
throw new Error(`Sample plan item "${record.title}" names unknown deal "${record.targetDealKey}"`);
|
|
325
|
+
}
|
|
326
|
+
await tx.insert(planItems).values({
|
|
327
|
+
id: dependencies.createId('planItem'),
|
|
328
|
+
workspaceId,
|
|
329
|
+
targetType: record.targetType,
|
|
330
|
+
targetId: dealId,
|
|
331
|
+
date: record.date,
|
|
332
|
+
title: record.title,
|
|
333
|
+
status: record.status,
|
|
334
|
+
createdAt: now,
|
|
335
|
+
updatedAt: now,
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
for (const record of fixture.notes) {
|
|
339
|
+
const targetId = resolveNoteTargetId(record.targetType, record.targetKey, {
|
|
340
|
+
companyIds,
|
|
341
|
+
personIds,
|
|
342
|
+
dealIds,
|
|
343
|
+
opportunityIds,
|
|
344
|
+
raiseIds,
|
|
345
|
+
partnershipIds,
|
|
346
|
+
candidateIds,
|
|
347
|
+
});
|
|
348
|
+
if (targetId === undefined) {
|
|
349
|
+
throw new Error(`Sample note names unknown ${record.targetType} "${record.targetKey}"`);
|
|
350
|
+
}
|
|
351
|
+
await tx.insert(notes).values({
|
|
352
|
+
id: dependencies.createId('note'),
|
|
353
|
+
workspaceId,
|
|
354
|
+
targetType: record.targetType,
|
|
355
|
+
targetId,
|
|
356
|
+
body: record.body,
|
|
357
|
+
pinned: record.pinned,
|
|
358
|
+
createdAt: now,
|
|
359
|
+
updatedAt: now,
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
return countsFor(fixture);
|
|
363
|
+
}, { workspaceId, actor: toEventActor(actor) });
|
|
364
|
+
},
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
function resolveNoteTargetId(targetType, targetKey, maps) {
|
|
368
|
+
switch (targetType) {
|
|
369
|
+
case 'company':
|
|
370
|
+
return maps.companyIds.get(targetKey);
|
|
371
|
+
case 'person':
|
|
372
|
+
return maps.personIds.get(targetKey);
|
|
373
|
+
case 'deal':
|
|
374
|
+
return maps.dealIds.get(targetKey);
|
|
375
|
+
case 'opportunity':
|
|
376
|
+
return maps.opportunityIds.get(targetKey);
|
|
377
|
+
case 'raise':
|
|
378
|
+
return maps.raiseIds.get(targetKey);
|
|
379
|
+
case 'partnership':
|
|
380
|
+
return maps.partnershipIds.get(targetKey);
|
|
381
|
+
case 'candidate':
|
|
382
|
+
return maps.candidateIds.get(targetKey);
|
|
383
|
+
default:
|
|
384
|
+
// A new RECORD_TARGET_TYPES value in the fixture requires a case here;
|
|
385
|
+
// falling through silently would drop a note on the floor.
|
|
386
|
+
return undefined;
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* The lookup key `stageIdByKindAndSlug` uses. A slug is only unique per kind
|
|
391
|
+
* (`won` is a stage in both `deal` and `opportunity`), so the map is keyed by
|
|
392
|
+
* both fields joined.
|
|
393
|
+
*/
|
|
394
|
+
function stageLookupKey(kind, slug) {
|
|
395
|
+
return `${kind}::${slug}`;
|
|
396
|
+
}
|
|
397
|
+
function countsFor(fixture) {
|
|
398
|
+
return {
|
|
399
|
+
companies: fixture.companies.length,
|
|
400
|
+
people: fixture.people.length,
|
|
401
|
+
positions: fixture.positions.length,
|
|
402
|
+
deals: fixture.deals.length,
|
|
403
|
+
planItems: fixture.plans.length,
|
|
404
|
+
notes: fixture.notes.length,
|
|
405
|
+
opportunities: fixture.opportunities.length,
|
|
406
|
+
raises: fixture.raises.length,
|
|
407
|
+
partnerships: fixture.partnerships.length,
|
|
408
|
+
roles: fixture.roles.length,
|
|
409
|
+
candidates: fixture.candidates.length,
|
|
410
|
+
};
|
|
411
|
+
}
|
|
412
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../../src/modules/sample-data/service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,aAAa,CAAA;AAErD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAA;AAEjD,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAI9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AACrD,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM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AC,aAAa,CAAC,MAAM;QAC3C,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM;QAC7B,YAAY,EAAE,OAAO,CAAC,YAAY,CAAC,MAAM;QACzC,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM;QAC3B,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC,MAAM;KACtC,CAAA;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/modules/sample-data/tools.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAE9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAA;AAWrD,wBAAgB,uBAAuB,CACrC,GAAG,EAAE,eAAe,EACpB,OAAO,EAAE,iBAAiB,GACzB,IAAI,CAYN"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { requireWorkspaceId } from '../auth/actor.js';
|
|
3
|
+
import { sampleDataResponse } from './routes.js';
|
|
4
|
+
/**
|
|
5
|
+
* `sample_data_install`: the MCP mirror of `POST /v1/workspaces/:id/sample-data`.
|
|
6
|
+
*
|
|
7
|
+
* Same admin check, same conflict on a workspace that already has data. The
|
|
8
|
+
* tool takes no arguments: it installs into the actor's own workspace.
|
|
9
|
+
*/
|
|
10
|
+
const installArgs = z.strictObject({});
|
|
11
|
+
export function registerSampleDataTools(mcp, service) {
|
|
12
|
+
mcp.tool({
|
|
13
|
+
name: 'sample_data_install',
|
|
14
|
+
description: 'Populate this workspace with a small sample of companies, people, positions, deals, plans and notes. Refuses if the workspace already has data.',
|
|
15
|
+
inputSchema: installArgs,
|
|
16
|
+
async invoke(_args, actor) {
|
|
17
|
+
const counts = await service.install(actor, requireWorkspaceId(actor));
|
|
18
|
+
return sampleDataResponse(counts);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../../src/modules/sample-data/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AAGhD;;;;;GAKG;AAEH,MAAM,WAAW,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,CAAC,CAAA;AAEtC,MAAM,UAAU,uBAAuB,CACrC,GAAoB,EACpB,OAA0B;IAE1B,GAAG,CAAC,IAAI,CAAC;QACP,IAAI,EAAE,qBAAqB;QAC3B,WAAW,EACT,iJAAiJ;QACnJ,WAAW,EAAE,WAAW;QACxB,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,KAAK;YACvB,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAC,CAAA;YAEtE,OAAO,kBAAkB,CAAC,MAAM,CAAC,CAAA;QACnC,CAAC;KACF,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/modules/smtp-email/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,KAAK,EAAgB,WAAW,EAAE,MAAM,oBAAoB,CAAA;AACnE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAA;AAE3D;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,eAAO,MAAM,mBAAmB,SAAS,CAAA;AAEzC,YAAY,EAAE,YAAY,EAAE,MAAM,oBAAoB,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Q,CAAC,SAAS,CAAC,EAAE,aAAa,CAAA;CACnC;AAED;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,GAAE,sBAA2B,GAAG,YAAY,CAiBxF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/smtp-email/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAKpD;;;;;;;;;;;GAWG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAA;AAIzC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC7B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC;IACxD,WAAW,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,MAAM,CAAC;IAC7E,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5B,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACjC,CAAC,CAAA;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/modules/smtp-email/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAA;AACnC,OAAO,E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C,GAAG,EAAE,OAAO,CAAC,SAAS,CAAC,CAAA;YACnE,CAAC,CAAC,CAAA;YAEF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAA;QAC1B,CAAC;KACF,CAAA;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/modules/workspace/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../../src/modules/workspace/service.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAGrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAEjD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAA;AAGxE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAA;AAEpE,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,aAAa,CAAA;AAKpB,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAgBzE,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,QAAQ,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,gBAAgB,CAAA;IACtC,QAAQ,CAAC,KAAK,EAAE,WAAW,CAAA;IAC3B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAA;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,IAAI,CAAA;IACxB,QAAQ,CAAC,YAAY,EAAE,mBAAmB,CAAA;IAC1C,6E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AAO,CAAC,iBAAiB,CAAC,CAAA;CACpH;AAuDD,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,qBAAqB,GAAG,gBAAgB,CAyqB5F"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { APP_LINK_PATHS, buildAppLink } from '../../lib/appUrl.js';
|
|
2
2
|
import { UNIQUE_VIOLATION, isReferenceViolation, postgresErrorCode } from '../../lib/database.js';
|
|
3
|
+
import { renderEmail } from '../../lib/emailContent.js';
|
|
3
4
|
import { AppError } from '../../lib/errors.js';
|
|
4
5
|
import { generateToken, hashToken } from '../../lib/tokens.js';
|
|
5
6
|
import { limitFor } from '../../runtime/entitlements.js';
|
|
@@ -173,10 +174,18 @@ export function createWorkspaceService(dependencies) {
|
|
|
173
174
|
}
|
|
174
175
|
function sendInviteEmail(to, token) {
|
|
175
176
|
const link = buildAppLink(dependencies.appBaseUrl, APP_LINK_PATHS.inviteAccept, token);
|
|
177
|
+
const { text, html } = renderEmail({
|
|
178
|
+
action: {
|
|
179
|
+
instructions: 'Accept the invitation within seven days:',
|
|
180
|
+
buttonText: 'Accept invitation',
|
|
181
|
+
link,
|
|
182
|
+
},
|
|
183
|
+
}, dependencies.appBaseUrl);
|
|
176
184
|
return dependencies.email.send({
|
|
177
185
|
to,
|
|
178
186
|
subject: 'You have been invited to a Kelpie workspace',
|
|
179
|
-
body:
|
|
187
|
+
body: text,
|
|
188
|
+
html,
|
|
180
189
|
});
|
|
181
190
|
}
|
|
182
191
|
/** The same membership with the name and email a reader needs, after a write. */
|