@talkpilot/core-db 1.3.19 → 1.3.21
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/.claude/settings.local.json +13 -0
- package/.cursor/rules/development.mdc +65 -65
- package/DEVELOPMENT.md +141 -141
- package/README.md +500 -465
- package/dist/talkpilot/calls/calls.constants.d.ts +4 -0
- package/dist/talkpilot/calls/calls.constants.d.ts.map +1 -1
- package/dist/talkpilot/calls/calls.constants.js +11 -1
- package/dist/talkpilot/calls/calls.constants.js.map +1 -1
- package/dist/talkpilot/calls/calls.getters.d.ts +3 -0
- package/dist/talkpilot/calls/calls.getters.d.ts.map +1 -1
- package/dist/talkpilot/calls/calls.getters.js +12 -1
- package/dist/talkpilot/calls/calls.getters.js.map +1 -1
- package/dist/talkpilot/calls/calls.types.d.ts +9 -0
- package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
- package/dist/talkpilot/leads/leads.setter.d.ts +4 -0
- package/dist/talkpilot/leads/leads.setter.d.ts.map +1 -0
- package/dist/talkpilot/leads/leads.setter.js +16 -0
- package/dist/talkpilot/leads/leads.setter.js.map +1 -0
- package/jest.config.js +20 -20
- package/package.json +46 -46
- package/src/__tests__/setup.ts +20 -20
- package/src/connection.ts +54 -54
- package/src/index.ts +27 -27
- package/src/municipal/__tests__/validation.spec.ts +62 -62
- package/src/municipal/cities/cities.getters.ts +50 -50
- package/src/municipal/cities/cities.types.ts +11 -11
- package/src/municipal/cities/index.ts +2 -2
- package/src/municipal/departmentsSubjects/departmentsSubjects.getters.ts +282 -282
- package/src/municipal/departmentsSubjects/departmentsSubjects.types.ts +72 -72
- package/src/municipal/departmentsSubjects/index.ts +9 -9
- package/src/municipal/index.ts +22 -22
- package/src/municipal/mongodb-client.ts +61 -61
- package/src/municipal/muniIssues/__tests__/muniIssues.setters.spec.ts +94 -94
- package/src/municipal/muniIssues/__tests__/muniIssues.setup.spec.ts +92 -92
- package/src/municipal/muniIssues/index.ts +17 -17
- package/src/municipal/muniIssues/muniIssues.constants.ts +18 -18
- package/src/municipal/muniIssues/muniIssues.getters.ts +24 -24
- package/src/municipal/muniIssues/muniIssues.schema.ts +66 -66
- package/src/municipal/muniIssues/muniIssues.setters.ts +24 -24
- package/src/municipal/muniIssues/muniIssues.setup.ts +65 -65
- package/src/municipal/muniIssues/muniIssues.types.ts +37 -37
- package/src/municipal/streets/index.ts +2 -2
- package/src/municipal/streets/streets.getters.ts +125 -125
- package/src/municipal/streets/streets.types.ts +18 -18
- package/src/municipal/systemInstructions/__tests__/getters.spec.ts +113 -113
- package/src/municipal/systemInstructions/__tests__/setters.spec.ts +274 -274
- package/src/municipal/systemInstructions/index.ts +7 -7
- package/src/municipal/systemInstructions/instructions.getters.ts +57 -57
- package/src/municipal/systemInstructions/instructions.setters.ts +119 -119
- package/src/municipal/systemInstructions/instructions.types.ts +30 -30
- package/src/municipal/tickets/__tests__/tickets.getters.spec.ts +30 -30
- package/src/municipal/tickets/__tests__/tickets.statistics.spec.ts +99 -99
- package/src/municipal/tickets/index.ts +9 -9
- package/src/municipal/tickets/tickets.constants.ts +8 -8
- package/src/municipal/tickets/tickets.getters.ts +121 -121
- package/src/municipal/tickets/tickets.statistics.aggregation.ts +110 -110
- package/src/municipal/tickets/tickets.statistics.getters.ts +145 -145
- package/src/municipal/tickets/tickets.types.ts +54 -54
- package/src/municipal/utils/types.ts +11 -11
- package/src/talkpilot/__tests__/db.spec.ts +38 -38
- package/src/talkpilot/__tests__/mongodb-client.spec.ts +18 -18
- package/src/talkpilot/__tests__/validation.spec.ts +68 -68
- package/src/talkpilot/agents/__tests__/agents.getters.spec.ts +29 -29
- package/src/talkpilot/agents/agents.getters.ts +34 -34
- package/src/talkpilot/agents/agents.types.ts +14 -14
- package/src/talkpilot/agents/index.ts +2 -2
- package/src/talkpilot/backgroundToolResults/__tests__/backgroundToolResults.getters.spec.ts +147 -147
- package/src/talkpilot/backgroundToolResults/backgroundToolResults.getters.ts +65 -65
- package/src/talkpilot/backgroundToolResults/backgroundToolResults.types.ts +23 -23
- package/src/talkpilot/backgroundToolResults/index.ts +2 -2
- package/src/talkpilot/calls/__tests__/callStats.utils.spec.ts +128 -128
- package/src/talkpilot/calls/__tests__/calls.dashboard.spec.ts +229 -229
- package/src/talkpilot/calls/__tests__/calls.spec.ts +471 -283
- package/src/talkpilot/calls/__tests__/calls.statistics.spec.ts +483 -483
- package/src/talkpilot/calls/calls.constants.ts +35 -23
- package/src/talkpilot/calls/calls.getters.ts +277 -258
- package/src/talkpilot/calls/calls.statistics.getters.ts +668 -668
- package/src/talkpilot/calls/calls.statistics.types.ts +48 -48
- package/src/talkpilot/calls/calls.types.ts +141 -130
- package/src/talkpilot/calls/dashboard/calls.dashboard.ts +295 -295
- package/src/talkpilot/calls/dashboard/calls.dashboard.types.ts +57 -57
- package/src/talkpilot/calls/index.ts +6 -6
- package/src/talkpilot/clientAudioBuffers/__tests__/clientAudioBuffer.getters.spec.ts +160 -160
- package/src/talkpilot/clientAudioBuffers/clientAudioBuffer.getters.ts +117 -117
- package/src/talkpilot/clientAudioBuffers/clientsAudioBuffers.types.ts +25 -25
- package/src/talkpilot/clientAudioBuffers/index.ts +2 -2
- package/src/talkpilot/clients/clients.getters.ts +16 -16
- package/src/talkpilot/clients/clients.types.ts +14 -14
- package/src/talkpilot/clients/index.ts +2 -2
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.getters.spec.ts +105 -105
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +186 -186
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +79 -79
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +127 -127
- package/src/talkpilot/clientsConfig/index.ts +2 -2
- package/src/talkpilot/contextNotes/__tests__/contextNotes.getters.spec.ts +217 -217
- package/src/talkpilot/contextNotes/contextNotes.getters.ts +85 -85
- package/src/talkpilot/contextNotes/contextNotes.types.ts +20 -20
- package/src/talkpilot/contextNotes/index.ts +2 -2
- package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +99 -99
- package/src/talkpilot/flows/flows.getter.ts +14 -14
- package/src/talkpilot/flows/flows.schema.ts +155 -155
- package/src/talkpilot/flows/flows.types.ts +189 -189
- package/src/talkpilot/flows/index.ts +2 -2
- package/src/talkpilot/groups/__tests__/groups.spec.ts +90 -90
- package/src/talkpilot/groups/__tests__/phone.utils.spec.ts +32 -32
- package/src/talkpilot/groups/groups.getters.ts +30 -30
- package/src/talkpilot/groups/groups.types.ts +29 -29
- package/src/talkpilot/groups/index.ts +3 -3
- package/src/talkpilot/groups/phone.utils.ts +46 -46
- package/src/talkpilot/index.ts +31 -31
- package/src/talkpilot/leads/index.ts +2 -2
- package/src/talkpilot/leads/leads.getter.ts +6 -6
- package/src/talkpilot/leads/leads.schema.ts +33 -33
- package/src/talkpilot/leads/leads.types.ts +20 -20
- package/src/talkpilot/mongodb-client.ts +78 -78
- package/src/talkpilot/phone_numbers/__tests__/phone_numbers.spec.ts +252 -252
- package/src/talkpilot/phone_numbers/index.ts +2 -2
- package/src/talkpilot/phone_numbers/phone_numbers.getter.ts +171 -171
- package/src/talkpilot/phone_numbers/phone_numbers.schema.ts +17 -17
- package/src/talkpilot/phone_numbers/phone_numbers.types.ts +30 -30
- package/src/talkpilot/plans/__tests__/plans.spec.ts +70 -70
- package/src/talkpilot/plans/index.ts +2 -2
- package/src/talkpilot/plans/plans.getters.ts +132 -132
- package/src/talkpilot/plans/plans.types.ts +89 -89
- package/src/talkpilot/products/__tests__/products.getters.spec.ts +44 -44
- package/src/talkpilot/products/index.ts +2 -2
- package/src/talkpilot/products/products.getters.ts +12 -12
- package/src/talkpilot/products/products.types.ts +9 -9
- package/src/talkpilot/results/index.ts +7 -7
- package/src/talkpilot/results/results.getter.ts +39 -39
- package/src/talkpilot/results/results.schema.ts +25 -25
- package/src/talkpilot/results/results.types.ts +34 -34
- package/src/talkpilot/retry_analyze/__tests__/retryAnalyze.getters.spec.ts +156 -156
- package/src/talkpilot/retry_analyze/index.ts +2 -2
- package/src/talkpilot/retry_analyze/retryAnalyze.getters.ts +84 -84
- package/src/talkpilot/retry_analyze/retryAnalyze.types.ts +13 -13
- package/src/talkpilot/sessions/__tests__/sessions.spec.ts +147 -147
- package/src/talkpilot/sessions/index.ts +2 -2
- package/src/talkpilot/sessions/sessions.getter.ts +92 -92
- package/src/talkpilot/sessions/sessions.schema.ts +34 -34
- package/src/talkpilot/sessions/sessions.types.ts +30 -30
- package/src/talkpilot/subscriptions/__tests__/subscriptions.getters.utils.spec.ts +45 -45
- package/src/talkpilot/subscriptions/index.ts +3 -3
- package/src/talkpilot/subscriptions/subscriptions.getters.ts +146 -146
- package/src/talkpilot/subscriptions/subscriptions.getters.utils.ts +33 -33
- package/src/talkpilot/subscriptions/subscriptions.types.ts +66 -66
- package/src/talkpilot/utils/__tests__/query.utils.spec.ts +49 -49
- package/src/talkpilot/utils/query.utils.ts +21 -21
- package/src/test-utils/db-utils.ts +26 -26
- package/src/test-utils/factories/index.ts +16 -16
- package/src/test-utils/factories/municipal/cities.ts +16 -16
- package/src/test-utils/factories/municipal/departmentsSubjects.ts +37 -37
- package/src/test-utils/factories/municipal/muniIssues.ts +32 -32
- package/src/test-utils/factories/municipal/streets.ts +22 -22
- package/src/test-utils/factories/municipal/tickets.ts +39 -39
- package/src/test-utils/factories/talkpilot/agents.ts +19 -19
- package/src/test-utils/factories/talkpilot/calls.ts +37 -37
- package/src/test-utils/factories/talkpilot/clientAudioBuffers.ts +20 -20
- package/src/test-utils/factories/talkpilot/clientsConfig.ts +18 -18
- package/src/test-utils/factories/talkpilot/contextNotes.ts +40 -40
- package/src/test-utils/factories/talkpilot/flows.ts +33 -33
- package/src/test-utils/factories/talkpilot/groups.ts +33 -33
- package/src/test-utils/factories/talkpilot/phone_numbers.ts +22 -22
- package/src/test-utils/factories/talkpilot/sessions.ts +35 -35
- package/src/test-utils/factories/websitalk/scans.ts +24 -24
- package/src/test-utils/factories/websitalk/websiteUrls.ts +17 -17
- package/src/utils/date.utils.ts +126 -126
- package/src/utils/shared.types.ts +4 -4
- package/src/utils/validation.ts +23 -23
- package/src/websitalk/index.ts +16 -16
- package/src/websitalk/mongodb-client.ts +61 -61
- package/src/websitalk/scans/__tests__/scans.spec.ts +313 -313
- package/src/websitalk/scans/index.ts +4 -4
- package/src/websitalk/scans/scans.constants.ts +15 -15
- package/src/websitalk/scans/scans.getters.ts +160 -160
- package/src/websitalk/scans/scans.types.ts +45 -45
- package/src/websitalk/scans/scans.utils.ts +5 -5
- package/src/websitalk/websiteUrls/__tests__/websiteUrls.spec.ts +77 -77
- package/src/websitalk/websiteUrls/index.ts +2 -2
- package/src/websitalk/websiteUrls/websiteUrls.getters.ts +65 -65
- package/src/websitalk/websiteUrls/websiteUrls.types.ts +13 -13
- package/tsconfig.json +23 -23
- package/dist/talkpilot/flows/flows.setter.d.ts +0 -13
- package/dist/talkpilot/flows/flows.setter.d.ts.map +0 -1
- package/dist/talkpilot/flows/flows.setter.js +0 -90
- package/dist/talkpilot/flows/flows.setter.js.map +0 -1
- package/dist/websitalk/websitalk.setup.d.ts +0 -3
- package/dist/websitalk/websitalk.setup.d.ts.map +0 -1
- package/dist/websitalk/websitalk.setup.js +0 -34
- package/dist/websitalk/websitalk.setup.js.map +0 -1
- package/dist/websitalk/websiteUrls/websiteUrls.constants.d.ts +0 -2
- package/dist/websitalk/websiteUrls/websiteUrls.constants.d.ts.map +0 -1
- package/dist/websitalk/websiteUrls/websiteUrls.constants.js +0 -5
- package/dist/websitalk/websiteUrls/websiteUrls.constants.js.map +0 -1
- package/dist/websitalk/websiteUrls/websiteUrls.context.d.ts +0 -11
- package/dist/websitalk/websiteUrls/websiteUrls.context.d.ts.map +0 -1
- package/dist/websitalk/websiteUrls/websiteUrls.context.js +0 -35
- package/dist/websitalk/websiteUrls/websiteUrls.context.js.map +0 -1
- package/dist/websitalk/websiteUrls/websiteUrls.setters.d.ts +0 -7
- package/dist/websitalk/websiteUrls/websiteUrls.setters.d.ts.map +0 -1
- package/dist/websitalk/websiteUrls/websiteUrls.setters.js +0 -29
- package/dist/websitalk/websiteUrls/websiteUrls.setters.js.map +0 -1
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { Collection, Filter, ObjectId as MongoObjectId } from "mongodb";
|
|
2
|
-
import { getDb, ObjectId } from "../index";
|
|
3
|
-
import type {
|
|
4
|
-
CreateWebsiteUrlInput,
|
|
5
|
-
WebsiteUrl,
|
|
6
|
-
WebsiteUrlDoc,
|
|
7
|
-
} from "./websiteUrls.types";
|
|
8
|
-
|
|
9
|
-
export const getWebsiteUrlsCollection = (): Collection<WebsiteUrl> => {
|
|
10
|
-
return getDb().collection<WebsiteUrl>("websiteUrls");
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const getWebsiteUrlsByClient = async (
|
|
14
|
-
clientId: string,
|
|
15
|
-
): Promise<WebsiteUrlDoc[]> => {
|
|
16
|
-
return getWebsiteUrlsCollection()
|
|
17
|
-
.find({ clientId })
|
|
18
|
-
.sort({ createdAt: 1 })
|
|
19
|
-
.toArray();
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export const getWebsiteUrlById = async (
|
|
23
|
-
id: string,
|
|
24
|
-
): Promise<WebsiteUrlDoc | null> => {
|
|
25
|
-
return getWebsiteUrlsCollection().findOne({ _id: new ObjectId(id) });
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export const findWebsiteUrls = async (
|
|
29
|
-
filter: Filter<WebsiteUrl> = {},
|
|
30
|
-
): Promise<WebsiteUrlDoc[]> => {
|
|
31
|
-
return getWebsiteUrlsCollection().find(filter).toArray();
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const createWebsiteUrl = async (
|
|
35
|
-
input: CreateWebsiteUrlInput,
|
|
36
|
-
): Promise<MongoObjectId> => {
|
|
37
|
-
const now = new Date();
|
|
38
|
-
const { insertedId } = await getWebsiteUrlsCollection().insertOne({
|
|
39
|
-
clientId: input.clientId,
|
|
40
|
-
name: input.name,
|
|
41
|
-
baseUrl: input.baseUrl,
|
|
42
|
-
createdAt: now,
|
|
43
|
-
updatedAt: now,
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return insertedId;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export const updateWebsiteUrl = async (
|
|
50
|
-
id: string,
|
|
51
|
-
updates: Partial<Pick<WebsiteUrl, "name" | "baseUrl">>,
|
|
52
|
-
): Promise<WebsiteUrlDoc | null> => {
|
|
53
|
-
return getWebsiteUrlsCollection().findOneAndUpdate(
|
|
54
|
-
{ _id: new ObjectId(id) },
|
|
55
|
-
{ $set: { ...updates, updatedAt: new Date() } },
|
|
56
|
-
{ returnDocument: "after" },
|
|
57
|
-
);
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export const deleteWebsiteUrl = async (id: string): Promise<boolean> => {
|
|
61
|
-
const result = await getWebsiteUrlsCollection().deleteOne({
|
|
62
|
-
_id: new ObjectId(id),
|
|
63
|
-
});
|
|
64
|
-
return result.deletedCount === 1;
|
|
65
|
-
};
|
|
1
|
+
import { Collection, Filter, ObjectId as MongoObjectId } from "mongodb";
|
|
2
|
+
import { getDb, ObjectId } from "../index";
|
|
3
|
+
import type {
|
|
4
|
+
CreateWebsiteUrlInput,
|
|
5
|
+
WebsiteUrl,
|
|
6
|
+
WebsiteUrlDoc,
|
|
7
|
+
} from "./websiteUrls.types";
|
|
8
|
+
|
|
9
|
+
export const getWebsiteUrlsCollection = (): Collection<WebsiteUrl> => {
|
|
10
|
+
return getDb().collection<WebsiteUrl>("websiteUrls");
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export const getWebsiteUrlsByClient = async (
|
|
14
|
+
clientId: string,
|
|
15
|
+
): Promise<WebsiteUrlDoc[]> => {
|
|
16
|
+
return getWebsiteUrlsCollection()
|
|
17
|
+
.find({ clientId })
|
|
18
|
+
.sort({ createdAt: 1 })
|
|
19
|
+
.toArray();
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const getWebsiteUrlById = async (
|
|
23
|
+
id: string,
|
|
24
|
+
): Promise<WebsiteUrlDoc | null> => {
|
|
25
|
+
return getWebsiteUrlsCollection().findOne({ _id: new ObjectId(id) });
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const findWebsiteUrls = async (
|
|
29
|
+
filter: Filter<WebsiteUrl> = {},
|
|
30
|
+
): Promise<WebsiteUrlDoc[]> => {
|
|
31
|
+
return getWebsiteUrlsCollection().find(filter).toArray();
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const createWebsiteUrl = async (
|
|
35
|
+
input: CreateWebsiteUrlInput,
|
|
36
|
+
): Promise<MongoObjectId> => {
|
|
37
|
+
const now = new Date();
|
|
38
|
+
const { insertedId } = await getWebsiteUrlsCollection().insertOne({
|
|
39
|
+
clientId: input.clientId,
|
|
40
|
+
name: input.name,
|
|
41
|
+
baseUrl: input.baseUrl,
|
|
42
|
+
createdAt: now,
|
|
43
|
+
updatedAt: now,
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
return insertedId;
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const updateWebsiteUrl = async (
|
|
50
|
+
id: string,
|
|
51
|
+
updates: Partial<Pick<WebsiteUrl, "name" | "baseUrl">>,
|
|
52
|
+
): Promise<WebsiteUrlDoc | null> => {
|
|
53
|
+
return getWebsiteUrlsCollection().findOneAndUpdate(
|
|
54
|
+
{ _id: new ObjectId(id) },
|
|
55
|
+
{ $set: { ...updates, updatedAt: new Date() } },
|
|
56
|
+
{ returnDocument: "after" },
|
|
57
|
+
);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const deleteWebsiteUrl = async (id: string): Promise<boolean> => {
|
|
61
|
+
const result = await getWebsiteUrlsCollection().deleteOne({
|
|
62
|
+
_id: new ObjectId(id),
|
|
63
|
+
});
|
|
64
|
+
return result.deletedCount === 1;
|
|
65
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { ObjectId } from "mongodb";
|
|
2
|
-
|
|
3
|
-
export type WebsiteUrl = {
|
|
4
|
-
clientId: string;
|
|
5
|
-
name: string;
|
|
6
|
-
baseUrl: string;
|
|
7
|
-
createdAt: Date;
|
|
8
|
-
updatedAt: Date;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export type WebsiteUrlDoc = WebsiteUrl & { _id: ObjectId };
|
|
12
|
-
|
|
13
|
-
export type CreateWebsiteUrlInput = Omit<WebsiteUrl, "createdAt" | "updatedAt">;
|
|
1
|
+
import { ObjectId } from "mongodb";
|
|
2
|
+
|
|
3
|
+
export type WebsiteUrl = {
|
|
4
|
+
clientId: string;
|
|
5
|
+
name: string;
|
|
6
|
+
baseUrl: string;
|
|
7
|
+
createdAt: Date;
|
|
8
|
+
updatedAt: Date;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type WebsiteUrlDoc = WebsiteUrl & { _id: ObjectId };
|
|
12
|
+
|
|
13
|
+
export type CreateWebsiteUrlInput = Omit<WebsiteUrl, "createdAt" | "updatedAt">;
|
package/tsconfig.json
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"moduleResolution": "node16",
|
|
6
|
-
"isolatedModules": true,
|
|
7
|
-
"lib": ["ES2022"],
|
|
8
|
-
"declaration": true,
|
|
9
|
-
"declarationMap": true,
|
|
10
|
-
"sourceMap": true,
|
|
11
|
-
"outDir": "dist",
|
|
12
|
-
"rootDir": "src",
|
|
13
|
-
"strict": true,
|
|
14
|
-
"esModuleInterop": true,
|
|
15
|
-
"forceConsistentCasingInFileNames": true,
|
|
16
|
-
"skipLibCheck": true,
|
|
17
|
-
"resolveJsonModule": true,
|
|
18
|
-
"experimentalDecorators": true,
|
|
19
|
-
"emitDecoratorMetadata": true
|
|
20
|
-
},
|
|
21
|
-
"include": ["src/**/*"],
|
|
22
|
-
"exclude": ["node_modules", "dist", "test", "**/*.test.ts", "**/__tests__/*", "**/*.spec.ts"]
|
|
23
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"moduleResolution": "node16",
|
|
6
|
+
"isolatedModules": true,
|
|
7
|
+
"lib": ["ES2022"],
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"declarationMap": true,
|
|
10
|
+
"sourceMap": true,
|
|
11
|
+
"outDir": "dist",
|
|
12
|
+
"rootDir": "src",
|
|
13
|
+
"strict": true,
|
|
14
|
+
"esModuleInterop": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"skipLibCheck": true,
|
|
17
|
+
"resolveJsonModule": true,
|
|
18
|
+
"experimentalDecorators": true,
|
|
19
|
+
"emitDecoratorMetadata": true
|
|
20
|
+
},
|
|
21
|
+
"include": ["src/**/*"],
|
|
22
|
+
"exclude": ["node_modules", "dist", "test", "**/*.test.ts", "**/__tests__/*", "**/*.spec.ts"]
|
|
23
|
+
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Flow } from "./flows.types";
|
|
2
|
-
export type FlowTemplateParams = {
|
|
3
|
-
companyName: string;
|
|
4
|
-
companyInfo: string;
|
|
5
|
-
language: string;
|
|
6
|
-
wtisBaseUrl: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const extractCompanyInfoFromFlow: (flow: Flow) => string;
|
|
9
|
-
type FlowTemplateFields = Omit<Flow, "_id" | "clientId" | "createdAt" | "updatedAt">;
|
|
10
|
-
export declare const applyFlowClientParams: (flow: Flow, params: FlowTemplateParams) => FlowTemplateFields;
|
|
11
|
-
export declare const substituteFlowTemplate: (template: Flow, params: FlowTemplateParams) => FlowTemplateFields;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=flows.setter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flows.setter.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/flows/flows.setter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAE1C,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AA2BF,eAAO,MAAM,0BAA0B,GAAI,MAAM,IAAI,KAAG,MAUvD,CAAC;AAgBF,KAAK,kBAAkB,GAAG,IAAI,CAC5B,IAAI,EACJ,KAAK,GAAG,UAAU,GAAG,WAAW,GAAG,WAAW,CAC/C,CAAC;AAKF,eAAO,MAAM,qBAAqB,GAChC,MAAM,IAAI,EACV,QAAQ,kBAAkB,KACzB,kBA+CF,CAAC;AAEF,eAAO,MAAM,sBAAsB,GACjC,UAAU,IAAI,EACd,QAAQ,kBAAkB,KACzB,kBAkCF,CAAC"}
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.substituteFlowTemplate = exports.applyFlowClientParams = exports.extractCompanyInfoFromFlow = void 0;
|
|
4
|
-
const PLACEHOLDER_RE = /\{\{(\w+)\}\}/g;
|
|
5
|
-
const substituteInString = (value, params) => value.replace(PLACEHOLDER_RE, (_, key) => params[key] ?? `{{${key}}}`);
|
|
6
|
-
const substituteDeep = (value, params) => {
|
|
7
|
-
if (typeof value === "string")
|
|
8
|
-
return substituteInString(value, params);
|
|
9
|
-
if (Array.isArray(value))
|
|
10
|
-
return value.map((item) => substituteDeep(item, params));
|
|
11
|
-
if (value && typeof value === "object") {
|
|
12
|
-
return Object.fromEntries(Object.entries(value).map(([key, item]) => [
|
|
13
|
-
key,
|
|
14
|
-
substituteDeep(item, params),
|
|
15
|
-
]));
|
|
16
|
-
}
|
|
17
|
-
return value;
|
|
18
|
-
};
|
|
19
|
-
const extractCompanyInfoFromFlow = (flow) => {
|
|
20
|
-
if (!flow.freeTextContent)
|
|
21
|
-
return "";
|
|
22
|
-
try {
|
|
23
|
-
const parsed = JSON.parse(flow.freeTextContent);
|
|
24
|
-
return parsed.config?.companyInfo ?? "";
|
|
25
|
-
}
|
|
26
|
-
catch {
|
|
27
|
-
return "";
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
exports.extractCompanyInfoFromFlow = extractCompanyInfoFromFlow;
|
|
31
|
-
const applyFreeTextContentParams = (freeTextContent, params) => {
|
|
32
|
-
const parsed = JSON.parse(freeTextContent);
|
|
33
|
-
const substituted = substituteDeep(parsed, {
|
|
34
|
-
companyName: params.companyName,
|
|
35
|
-
companyInfo: params.companyInfo,
|
|
36
|
-
language: params.language,
|
|
37
|
-
wtisBaseUrl: params.wtisBaseUrl,
|
|
38
|
-
});
|
|
39
|
-
return JSON.stringify(substituted, null, 2);
|
|
40
|
-
};
|
|
41
|
-
const webSearchUrl = (wtisBaseUrl) => `${wtisBaseUrl.replace(/\/$/, "")}/api/v1/websitalk/search`;
|
|
42
|
-
const applyFlowClientParams = (flow, params) => {
|
|
43
|
-
const { _id: _omitId, clientId: _omitClientId, createdAt: _omitCreatedAt, updatedAt: _omitUpdatedAt, freeTextContent, tools, ...rest } = flow;
|
|
44
|
-
const result = {
|
|
45
|
-
...rest,
|
|
46
|
-
flowName: `${params.companyName} - website talk`,
|
|
47
|
-
products: flow.products ?? ["websiteTalk"],
|
|
48
|
-
};
|
|
49
|
-
if (freeTextContent) {
|
|
50
|
-
const parsed = JSON.parse(freeTextContent);
|
|
51
|
-
result.freeTextContent = JSON.stringify({
|
|
52
|
-
...parsed,
|
|
53
|
-
config: {
|
|
54
|
-
...parsed.config,
|
|
55
|
-
companyName: params.companyName,
|
|
56
|
-
companyInfo: params.companyInfo,
|
|
57
|
-
},
|
|
58
|
-
agent: { ...parsed.agent, language: params.language },
|
|
59
|
-
}, null, 2);
|
|
60
|
-
}
|
|
61
|
-
if (tools?.length) {
|
|
62
|
-
const searchUrl = webSearchUrl(params.wtisBaseUrl);
|
|
63
|
-
result.tools = tools.map((tool) => tool.id === "webSearch" || tool.name === "webSearch"
|
|
64
|
-
? { ...tool, url: searchUrl }
|
|
65
|
-
: tool);
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
};
|
|
69
|
-
exports.applyFlowClientParams = applyFlowClientParams;
|
|
70
|
-
const substituteFlowTemplate = (template, params) => {
|
|
71
|
-
const placeholderParams = {
|
|
72
|
-
companyName: params.companyName,
|
|
73
|
-
wtisBaseUrl: params.wtisBaseUrl,
|
|
74
|
-
};
|
|
75
|
-
const { _id: _omitId, clientId: _omitClientId, createdAt: _omitCreatedAt, updatedAt: _omitUpdatedAt, freeTextContent, flowName, tools, ...rest } = template;
|
|
76
|
-
const flow = {
|
|
77
|
-
...rest,
|
|
78
|
-
flowName: substituteInString(flowName, placeholderParams),
|
|
79
|
-
products: ["websiteTalk"],
|
|
80
|
-
};
|
|
81
|
-
if (freeTextContent) {
|
|
82
|
-
flow.freeTextContent = applyFreeTextContentParams(freeTextContent, params);
|
|
83
|
-
}
|
|
84
|
-
if (tools?.length) {
|
|
85
|
-
flow.tools = tools.map((tool) => substituteDeep(tool, placeholderParams));
|
|
86
|
-
}
|
|
87
|
-
return flow;
|
|
88
|
-
};
|
|
89
|
-
exports.substituteFlowTemplate = substituteFlowTemplate;
|
|
90
|
-
//# sourceMappingURL=flows.setter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flows.setter.js","sourceRoot":"","sources":["../../../src/talkpilot/flows/flows.setter.ts"],"names":[],"mappings":";;;AASA,MAAM,cAAc,GAAG,gBAAgB,CAAC;AAExC,MAAM,kBAAkB,GAAG,CACzB,KAAa,EACb,MAA8B,EACtB,EAAE,CACV,KAAK,CAAC,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,GAAW,EAAE,EAAE,CAAC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AC9B,cAAc,CAAC,IAAI,EAAE,iBAAiB,CAAC,CACvB,CAAC;IACrB,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AArCW,QAAA,sBAAsB,0BAqCjC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websitalk.setup.d.ts","sourceRoot":"","sources":["../../src/websitalk/websitalk.setup.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,sBAAsB,QAAa,OAAO,CAAC,IAAI,CAW3D,CAAC;AAIF,eAAO,MAAM,0BAA0B,QAAO,OAAO,CAAC,IAAI,CAWzD,CAAC"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ensureWebsitalkIndexesOnce = exports.ensureWebsitalkIndexes = void 0;
|
|
4
|
-
const index_1 = require("./index");
|
|
5
|
-
const scans_getters_1 = require("./scans/scans.getters");
|
|
6
|
-
const websiteUrls_getters_1 = require("./websiteUrls/websiteUrls.getters");
|
|
7
|
-
const ensureWebsitalkIndexes = async () => {
|
|
8
|
-
await (0, index_1.getDb)().collection(websiteUrls_getters_1.WEBSITE_URLS_COLLECTION).createIndex({ clientId: 1 });
|
|
9
|
-
await (0, scans_getters_1.getScansCollection)().createIndexes([
|
|
10
|
-
{ key: { clientId: 1, createdAt: -1 } },
|
|
11
|
-
{ key: { websiteUrlId: 1, createdAt: -1 } },
|
|
12
|
-
{
|
|
13
|
-
key: { websiteUrlId: 1, status: 1 },
|
|
14
|
-
unique: true,
|
|
15
|
-
partialFilterExpression: { status: "COMPLETED" },
|
|
16
|
-
},
|
|
17
|
-
]);
|
|
18
|
-
};
|
|
19
|
-
exports.ensureWebsitalkIndexes = ensureWebsitalkIndexes;
|
|
20
|
-
const provisioningByDb = new WeakMap();
|
|
21
|
-
const ensureWebsitalkIndexesOnce = () => {
|
|
22
|
-
const db = (0, index_1.getDb)();
|
|
23
|
-
let provisioning = provisioningByDb.get(db);
|
|
24
|
-
if (!provisioning) {
|
|
25
|
-
provisioning = (0, exports.ensureWebsitalkIndexes)().catch((err) => {
|
|
26
|
-
provisioningByDb.delete(db);
|
|
27
|
-
throw err;
|
|
28
|
-
});
|
|
29
|
-
provisioningByDb.set(db, provisioning);
|
|
30
|
-
}
|
|
31
|
-
return provisioning;
|
|
32
|
-
};
|
|
33
|
-
exports.ensureWebsitalkIndexesOnce = ensureWebsitalkIndexesOnce;
|
|
34
|
-
//# sourceMappingURL=websitalk.setup.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websitalk.setup.js","sourceRoot":"","sources":["../../src/websitalk/websitalk.setup.ts"],"names":[],"mappings":";;;AACA,mCAAgC;AAChC,yDAA2D;AAC3D,2EAA4E;AAErE,MAAM,sBAAsB,GAAG,KAAK,IAAmB,EAAE;IAC9D,MAAM,IAAA,aAAK,GAAE,CAAC,UAAU,CAAC,6CAAuB,CAAC,CAAC,WAAW,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;IAC/E,MAAM,IAAA,kCAAkB,GAAE,CAAC,aAAa,CAAC;QACvC,EAAE,GAAG,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;QACvC,EAAE,GAAG,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE;QAC3C;YACE,GAAG,EAAE,EAAE,YAAY,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;YACnC,MAAM,EAAE,IAAI;YACZ,uBAAuB,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE;SACjD;KACF,CAAC,CAAC;AACL,CAAC,CAAC;AAXW,QAAA,sBAAsB,0BAWjC;AAEF,MAAM,gBAAgB,GAAG,IAAI,OAAO,EAAqB,CAAC;AAEnD,MAAM,0BAA0B,GAAG,GAAkB,EAAE;IAC5D,MAAM,EAAE,GAAG,IAAA,aAAK,GAAE,CAAC;IACnB,IAAI,YAAY,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC5C,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,IAAA,8BAAsB,GAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;YACpD,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC5B,MAAM,GAAG,CAAC;QACZ,CAAC,CAAC,CAAC;QACH,gBAAgB,CAAC,GAAG,CAAC,EAAE,EAAE,YAAY,CAAC,CAAC;IACzC,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAXW,QAAA,0BAA0B,8BAWrC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websiteUrls.constants.d.ts","sourceRoot":"","sources":["../../../src/websitalk/websiteUrls/websiteUrls.constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,gBAAgB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websiteUrls.constants.js","sourceRoot":"","sources":["../../../src/websitalk/websiteUrls/websiteUrls.constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,uBAAuB,GAAG,aAAa,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { ScanDoc } from "../scans/scans.types";
|
|
2
|
-
import type { WebsiteUrlDoc } from "./websiteUrls.types";
|
|
3
|
-
export type ActiveWebsiteContext = {
|
|
4
|
-
websiteUrl: WebsiteUrlDoc | null;
|
|
5
|
-
scan: ScanDoc | null;
|
|
6
|
-
activeScanId: string | null;
|
|
7
|
-
};
|
|
8
|
-
export declare const resolveActiveWebsiteContext: (clientId: string) => Promise<ActiveWebsiteContext>;
|
|
9
|
-
export declare const getSelectedScanByClient: (clientId: string) => Promise<ScanDoc | null>;
|
|
10
|
-
export declare const getActiveWebsiteUrlByClient: (clientId: string) => Promise<WebsiteUrlDoc | null>;
|
|
11
|
-
//# sourceMappingURL=websiteUrls.context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websiteUrls.context.d.ts","sourceRoot":"","sources":["../../../src/websitalk/websiteUrls/websiteUrls.context.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAIpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,MAAM,MAAM,oBAAoB,GAAG;IACjC,UAAU,EAAE,aAAa,GAAG,IAAI,CAAC;IACjC,IAAI,EAAE,OAAO,GAAG,IAAI,CAAC;IACrB,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,KACf,OAAO,CAAC,oBAAoB,CAgB9B,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,UAAU,MAAM,KACf,OAAO,CAAC,OAAO,GAAG,IAAI,CAOxB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GACtC,UAAU,MAAM,KACf,OAAO,CAAC,aAAa,GAAG,IAAI,CAG9B,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getActiveWebsiteUrlByClient = exports.getSelectedScanByClient = exports.resolveActiveWebsiteContext = void 0;
|
|
4
|
-
const clientsConfig_getters_1 = require("../../talkpilot/clientsConfig/clientsConfig.getters");
|
|
5
|
-
const scans_getters_1 = require("../scans/scans.getters");
|
|
6
|
-
const websiteUrls_getters_1 = require("./websiteUrls.getters");
|
|
7
|
-
const resolveActiveWebsiteContext = async (clientId) => {
|
|
8
|
-
const config = await (0, clientsConfig_getters_1.getClientConfig)(clientId);
|
|
9
|
-
const activeScanId = config?.products?.websiteTalk?.activeScanId ?? null;
|
|
10
|
-
if (!activeScanId) {
|
|
11
|
-
return { websiteUrl: null, scan: null, activeScanId: null };
|
|
12
|
-
}
|
|
13
|
-
const scan = await (0, scans_getters_1.getScanById)(activeScanId);
|
|
14
|
-
if (!scan) {
|
|
15
|
-
return { websiteUrl: null, scan: null, activeScanId };
|
|
16
|
-
}
|
|
17
|
-
const websiteUrl = await (0, websiteUrls_getters_1.getWebsiteUrlById)(scan.websiteUrlId);
|
|
18
|
-
return { websiteUrl, scan, activeScanId };
|
|
19
|
-
};
|
|
20
|
-
exports.resolveActiveWebsiteContext = resolveActiveWebsiteContext;
|
|
21
|
-
const getSelectedScanByClient = async (clientId) => {
|
|
22
|
-
const config = await (0, clientsConfig_getters_1.getClientConfig)(clientId);
|
|
23
|
-
const activeScanId = config?.products?.websiteTalk?.activeScanId;
|
|
24
|
-
if (!activeScanId) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
return (0, scans_getters_1.getScanById)(activeScanId);
|
|
28
|
-
};
|
|
29
|
-
exports.getSelectedScanByClient = getSelectedScanByClient;
|
|
30
|
-
const getActiveWebsiteUrlByClient = async (clientId) => {
|
|
31
|
-
const context = await (0, exports.resolveActiveWebsiteContext)(clientId);
|
|
32
|
-
return context.websiteUrl;
|
|
33
|
-
};
|
|
34
|
-
exports.getActiveWebsiteUrlByClient = getActiveWebsiteUrlByClient;
|
|
35
|
-
//# sourceMappingURL=websiteUrls.context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websiteUrls.context.js","sourceRoot":"","sources":["../../../src/websitalk/websiteUrls/websiteUrls.context.ts"],"names":[],"mappings":";;;AAAA,+FAAsF;AACtF,0DAAqD;AAErD,+DAE+B;AASxB,MAAM,2BAA2B,GAAG,KAAK,EAC9C,QAAgB,EACe,EAAE;IACjC,MAAM,MAAM,GAAG,MAAM,IAAA,uCAAe,EAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,YAAY,GAAG,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,YA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WebsiteUrlDoc } from "./websiteUrls.types";
|
|
3
|
-
export type CreateWebsiteUrlInput = Omit<WebsiteUrl, "createdAt" | "updatedAt">;
|
|
4
|
-
export declare const createWebsiteUrl: (input: CreateWebsiteUrlInput) => Promise<MongoObjectId>;
|
|
5
|
-
export declare const updateWebsiteUrl: (id: string, updates: Partial<Pick<WebsiteUrl, "name" | "baseUrl">>) => Promise<WebsiteUrlDoc | null>;
|
|
6
|
-
export declare const deleteWebsiteUrl: (id: string) => Promise<boolean>;
|
|
7
|
-
//# sourceMappingURL=websiteUrls.setters.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websiteUrls.setters.d.ts","sourceRoot":"","sources":["../../../src/websitalk/websiteUrls/websiteUrls.setters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,aAAa,EAAE,MAAM,SAAS,CAAC;AAGpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,MAAM,qBAAqB,GAAG,IAAI,CACtC,UAAU,EACV,WAAW,GAAG,WAAW,CAC1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,OAAO,qBAAqB,KAC3B,OAAO,CAAC,aAAa,CAWvB,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,IAAI,MAAM,EACV,SAAS,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,KACrD,OAAO,CAAC,aAAa,GAAG,IAAI,CAM9B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,IAAI,MAAM,KAAG,OAAO,CAAC,OAAO,CAMlE,CAAC"}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.deleteWebsiteUrl = exports.updateWebsiteUrl = exports.createWebsiteUrl = void 0;
|
|
4
|
-
const index_1 = require("../index");
|
|
5
|
-
const websiteUrls_getters_1 = require("./websiteUrls.getters");
|
|
6
|
-
const createWebsiteUrl = async (input) => {
|
|
7
|
-
const now = new Date();
|
|
8
|
-
const { insertedId } = await (0, websiteUrls_getters_1.getWebsiteUrlsCollection)().insertOne({
|
|
9
|
-
clientId: input.clientId,
|
|
10
|
-
name: input.name,
|
|
11
|
-
baseUrl: input.baseUrl,
|
|
12
|
-
createdAt: now,
|
|
13
|
-
updatedAt: now,
|
|
14
|
-
});
|
|
15
|
-
return insertedId;
|
|
16
|
-
};
|
|
17
|
-
exports.createWebsiteUrl = createWebsiteUrl;
|
|
18
|
-
const updateWebsiteUrl = async (id, updates) => {
|
|
19
|
-
return (0, websiteUrls_getters_1.getWebsiteUrlsCollection)().findOneAndUpdate({ _id: new index_1.ObjectId(id) }, { $set: { ...updates, updatedAt: new Date() } }, { returnDocument: "after" });
|
|
20
|
-
};
|
|
21
|
-
exports.updateWebsiteUrl = updateWebsiteUrl;
|
|
22
|
-
const deleteWebsiteUrl = async (id) => {
|
|
23
|
-
const result = await (0, websiteUrls_getters_1.getWebsiteUrlsCollection)().deleteOne({
|
|
24
|
-
_id: new index_1.ObjectId(id),
|
|
25
|
-
});
|
|
26
|
-
return result.deletedCount > 0;
|
|
27
|
-
};
|
|
28
|
-
exports.deleteWebsiteUrl = deleteWebsiteUrl;
|
|
29
|
-
//# sourceMappingURL=websiteUrls.setters.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"websiteUrls.setters.js","sourceRoot":"","sources":["../../../src/websitalk/websiteUrls/websiteUrls.setters.ts"],"names":[],"mappings":";;;AACA,oCAAoC;AACpC,+DAAoF;AAQ7E,MAAM,gBAAgB,GAAG,KAAK,EACnC,KAA4B,EACJ,EAAE;IAC1B,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,MAAM,EAAE,UAAU,EAAE,GAAG,MAAM,IAAA,8CAAwB,GAAE,CAAC,SAAS,CAAC;QAChE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