@talkpilot/core-db 1.3.14 → 1.3.16
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/README.md +55 -53
- package/README_OLD.md +160 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/municipal/index.d.ts +1 -1
- package/dist/municipal/index.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +3 -0
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +17 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +1 -2
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
- package/dist/talkpilot/flows/flows.schema.d.ts +0 -3
- package/dist/talkpilot/flows/flows.schema.d.ts.map +1 -1
- package/dist/talkpilot/flows/flows.schema.js +0 -1
- package/dist/talkpilot/flows/flows.schema.js.map +1 -1
- package/dist/talkpilot/flows/flows.types.d.ts +0 -2
- package/dist/talkpilot/flows/flows.types.d.ts.map +1 -1
- package/dist/test-utils/factories/index.d.ts +1 -0
- package/dist/test-utils/factories/index.d.ts.map +1 -1
- package/dist/test-utils/factories/index.js +1 -0
- package/dist/test-utils/factories/index.js.map +1 -1
- package/dist/test-utils/factories/websitalk/scans.d.ts.map +1 -1
- package/dist/test-utils/factories/websitalk/scans.js +2 -1
- package/dist/test-utils/factories/websitalk/scans.js.map +1 -1
- package/dist/test-utils/factories/websitalk/websiteUrls.d.ts +5 -0
- package/dist/test-utils/factories/websitalk/websiteUrls.d.ts.map +1 -0
- package/dist/test-utils/factories/websitalk/websiteUrls.js +17 -0
- package/dist/test-utils/factories/websitalk/websiteUrls.js.map +1 -0
- package/dist/websitalk/index.d.ts +1 -0
- package/dist/websitalk/index.d.ts.map +1 -1
- package/dist/websitalk/index.js +1 -0
- package/dist/websitalk/index.js.map +1 -1
- package/dist/websitalk/scans/index.d.ts +2 -0
- package/dist/websitalk/scans/index.d.ts.map +1 -1
- package/dist/websitalk/scans/index.js +2 -0
- package/dist/websitalk/scans/index.js.map +1 -1
- package/dist/websitalk/scans/scans.constants.d.ts +11 -0
- package/dist/websitalk/scans/scans.constants.d.ts.map +1 -0
- package/dist/websitalk/scans/scans.constants.js +18 -0
- package/dist/websitalk/scans/scans.constants.js.map +1 -0
- package/dist/websitalk/scans/scans.getters.d.ts +10 -3
- package/dist/websitalk/scans/scans.getters.d.ts.map +1 -1
- package/dist/websitalk/scans/scans.getters.js +49 -9
- package/dist/websitalk/scans/scans.getters.js.map +1 -1
- package/dist/websitalk/scans/scans.types.d.ts +3 -8
- package/dist/websitalk/scans/scans.types.d.ts.map +1 -1
- package/dist/websitalk/scans/scans.utils.d.ts +3 -0
- package/dist/websitalk/scans/scans.utils.d.ts.map +1 -0
- package/dist/websitalk/scans/scans.utils.js +7 -0
- package/dist/websitalk/scans/scans.utils.js.map +1 -0
- package/dist/websitalk/websitalk.setup.d.ts +3 -0
- package/dist/websitalk/websitalk.setup.d.ts.map +1 -0
- package/dist/websitalk/websitalk.setup.js +34 -0
- package/dist/websitalk/websitalk.setup.js.map +1 -0
- package/dist/websitalk/websiteUrls/index.d.ts +3 -0
- package/dist/websitalk/websiteUrls/index.d.ts.map +1 -0
- package/dist/websitalk/websiteUrls/index.js +19 -0
- package/dist/websitalk/websiteUrls/index.js.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.constants.d.ts +2 -0
- package/dist/websitalk/websiteUrls/websiteUrls.constants.d.ts.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.constants.js +5 -0
- package/dist/websitalk/websiteUrls/websiteUrls.constants.js.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.context.d.ts +11 -0
- package/dist/websitalk/websiteUrls/websiteUrls.context.d.ts.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.context.js +35 -0
- package/dist/websitalk/websiteUrls/websiteUrls.context.js.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.getters.d.ts +10 -0
- package/dist/websitalk/websiteUrls/websiteUrls.getters.d.ts.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.getters.js +47 -0
- package/dist/websitalk/websiteUrls/websiteUrls.getters.js.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.setters.d.ts +7 -0
- package/dist/websitalk/websiteUrls/websiteUrls.setters.d.ts.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.setters.js +29 -0
- package/dist/websitalk/websiteUrls/websiteUrls.setters.js.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.types.d.ts +13 -0
- package/dist/websitalk/websiteUrls/websiteUrls.types.d.ts.map +1 -0
- package/dist/websitalk/websiteUrls/websiteUrls.types.js +3 -0
- package/dist/websitalk/websiteUrls/websiteUrls.types.js.map +1 -0
- package/package.json +1 -1
- package/src/index.ts +1 -0
- package/src/municipal/index.ts +1 -1
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.getters.spec.ts +57 -5
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.spec.ts +0 -4
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +24 -0
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +1 -2
- package/src/talkpilot/flows/__tests__/flows.schema.spec.ts +0 -3
- package/src/talkpilot/flows/flows.schema.ts +0 -1
- package/src/talkpilot/flows/flows.types.ts +0 -2
- package/src/test-utils/factories/index.ts +1 -0
- package/src/test-utils/factories/websitalk/scans.ts +2 -1
- package/src/test-utils/factories/websitalk/websiteUrls.ts +17 -0
- package/src/websitalk/index.ts +1 -0
- package/src/websitalk/scans/__tests__/scans.spec.ts +121 -26
- package/src/websitalk/scans/index.ts +2 -0
- package/src/websitalk/scans/scans.constants.ts +15 -0
- package/src/websitalk/scans/scans.getters.ts +64 -17
- package/src/websitalk/scans/scans.types.ts +3 -11
- package/src/websitalk/scans/scans.utils.ts +5 -0
- package/src/websitalk/websiteUrls/__tests__/websiteUrls.spec.ts +77 -0
- package/src/websitalk/websiteUrls/index.ts +2 -0
- package/src/websitalk/websiteUrls/websiteUrls.getters.ts +65 -0
- package/src/websitalk/websiteUrls/websiteUrls.types.ts +13 -0
- package/tsconfig.json +4 -4
- package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts +0 -4
- package/dist/talkpilot/subscriptions/subscriptions.utils.d.ts.map +0 -1
- package/dist/talkpilot/subscriptions/subscriptions.utils.js +0 -20
- package/dist/talkpilot/subscriptions/subscriptions.utils.js.map +0 -1
|
@@ -4,12 +4,9 @@ import {
|
|
|
4
4
|
applyQueryOptions,
|
|
5
5
|
QueryOptions,
|
|
6
6
|
} from "../../talkpilot/utils/query.utils";
|
|
7
|
-
import type {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
ScanDoc,
|
|
11
|
-
ScanStatus,
|
|
12
|
-
} from "./scans.types";
|
|
7
|
+
import type { Scan, ScanDoc } from "./scans.types";
|
|
8
|
+
import { FINISHED_SCAN_STATUSES, SCAN_STATUSES } from "./scans.constants";
|
|
9
|
+
import { isInProgressScan } from "./scans.utils";
|
|
13
10
|
|
|
14
11
|
export const getScansCollection = (): Collection<Scan> => {
|
|
15
12
|
return getDb().collection<Scan>("scans");
|
|
@@ -57,11 +54,12 @@ export const getScanFieldsByClientAndDateRange = <K extends keyof Scan>(
|
|
|
57
54
|
};
|
|
58
55
|
|
|
59
56
|
export const createScanDoc = (
|
|
60
|
-
scan: Pick<Scan, "clientId" | "
|
|
57
|
+
scan: Pick<Scan, "clientId" | "websiteUrlId"> &
|
|
58
|
+
Partial<Pick<Scan, "notifyPhoneNumber">>,
|
|
61
59
|
) => {
|
|
62
60
|
return getScansCollection().insertOne({
|
|
63
61
|
...scan,
|
|
64
|
-
status:
|
|
62
|
+
status: SCAN_STATUSES.CHECKING,
|
|
65
63
|
activeTasksCount: 0,
|
|
66
64
|
pagesScanned: 0,
|
|
67
65
|
pagesSkipped: 0,
|
|
@@ -72,21 +70,48 @@ export const createScanDoc = (
|
|
|
72
70
|
});
|
|
73
71
|
};
|
|
74
72
|
|
|
75
|
-
const
|
|
73
|
+
export const getScanById = async (id: string): Promise<ScanDoc | null> => {
|
|
74
|
+
return getScansCollection().findOne({ _id: new ObjectId(id) });
|
|
75
|
+
};
|
|
76
76
|
|
|
77
|
-
export const
|
|
78
|
-
|
|
79
|
-
): Promise<
|
|
80
|
-
|
|
81
|
-
{
|
|
77
|
+
export const getScansByWebsiteUrl = async (
|
|
78
|
+
websiteUrlId: string,
|
|
79
|
+
): Promise<ScanDoc[]> => {
|
|
80
|
+
return getScansCollection()
|
|
81
|
+
.find({ websiteUrlId })
|
|
82
|
+
.sort({ createdAt: -1 })
|
|
83
|
+
.toArray();
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
export const getLatestScanByWebsiteUrl = async (
|
|
87
|
+
websiteUrlId: string,
|
|
88
|
+
): Promise<ScanDoc | null> => {
|
|
89
|
+
return getScansCollection().findOne(
|
|
90
|
+
{ websiteUrlId },
|
|
82
91
|
{ sort: { createdAt: -1 } },
|
|
83
92
|
);
|
|
93
|
+
};
|
|
84
94
|
|
|
85
|
-
|
|
86
|
-
|
|
95
|
+
export const getInProgressScanByWebsiteUrl = async (
|
|
96
|
+
websiteUrlId: string,
|
|
97
|
+
): Promise<ScanDoc | null> => {
|
|
98
|
+
const latestScan = await getLatestScanByWebsiteUrl(websiteUrlId);
|
|
99
|
+
if (!latestScan || !isInProgressScan(latestScan)) {
|
|
100
|
+
return null;
|
|
87
101
|
}
|
|
102
|
+
return latestScan;
|
|
103
|
+
};
|
|
88
104
|
|
|
89
|
-
|
|
105
|
+
export const findInProgressScansByClient = async (
|
|
106
|
+
clientId: string,
|
|
107
|
+
): Promise<ScanDoc[]> => {
|
|
108
|
+
return getScansCollection()
|
|
109
|
+
.find({
|
|
110
|
+
clientId,
|
|
111
|
+
status: { $nin: FINISHED_SCAN_STATUSES },
|
|
112
|
+
})
|
|
113
|
+
.sort({ createdAt: -1 })
|
|
114
|
+
.toArray();
|
|
90
115
|
};
|
|
91
116
|
|
|
92
117
|
export const updateScanDoc = async (
|
|
@@ -111,3 +136,25 @@ export const findScansByQuery = async (
|
|
|
111
136
|
export const countScans = async (query: Filter<Scan>): Promise<number> => {
|
|
112
137
|
return getScansCollection().countDocuments(query);
|
|
113
138
|
};
|
|
139
|
+
|
|
140
|
+
export const hasScansForWebsiteUrl = async (
|
|
141
|
+
websiteUrlId: string,
|
|
142
|
+
): Promise<boolean> => {
|
|
143
|
+
return (await countScans({ websiteUrlId })) > 0;
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export const getLatestCompletedScanByWebsiteUrl = async (
|
|
147
|
+
websiteUrlId: string,
|
|
148
|
+
): Promise<ScanDoc | null> => {
|
|
149
|
+
return getScansCollection().findOne(
|
|
150
|
+
{ websiteUrlId, status: SCAN_STATUSES.COMPLETED },
|
|
151
|
+
{ sort: { createdAt: -1 } },
|
|
152
|
+
);
|
|
153
|
+
};
|
|
154
|
+
|
|
155
|
+
export const deleteScansByWebsiteUrl = async (
|
|
156
|
+
websiteUrlId: string,
|
|
157
|
+
): Promise<number> => {
|
|
158
|
+
const result = await getScansCollection().deleteMany({ websiteUrlId });
|
|
159
|
+
return result.deletedCount;
|
|
160
|
+
};
|
|
@@ -1,16 +1,8 @@
|
|
|
1
1
|
import { WithId } from "mongodb";
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
| "CHECKING"
|
|
5
|
-
| "PREPARING"
|
|
6
|
-
| "SCANNING"
|
|
7
|
-
| "PROCESSING"
|
|
8
|
-
| "COMPLETED"
|
|
9
|
-
| "FAILED";
|
|
3
|
+
import type { SCAN_STATUSES } from "./scans.constants";
|
|
10
4
|
|
|
11
|
-
export type
|
|
12
|
-
| { isActive: true; status: ScanStatus }
|
|
13
|
-
| { isActive: false };
|
|
5
|
+
export type ScanStatus = (typeof SCAN_STATUSES)[keyof typeof SCAN_STATUSES];
|
|
14
6
|
|
|
15
7
|
export type SiteChromeEntry = {
|
|
16
8
|
url: string;
|
|
@@ -38,7 +30,7 @@ export type SkippedEntry = {
|
|
|
38
30
|
|
|
39
31
|
export type Scan = {
|
|
40
32
|
clientId: string;
|
|
41
|
-
|
|
33
|
+
websiteUrlId: string;
|
|
42
34
|
notifyPhoneNumber?: string | null;
|
|
43
35
|
status: ScanStatus;
|
|
44
36
|
activeTasksCount: number;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createWebsiteUrl,
|
|
3
|
+
getWebsiteUrlsByClient,
|
|
4
|
+
getWebsiteUrlById,
|
|
5
|
+
getWebsiteUrlsCollection,
|
|
6
|
+
updateWebsiteUrl,
|
|
7
|
+
deleteWebsiteUrl,
|
|
8
|
+
} from "../websiteUrls.getters";
|
|
9
|
+
import { createWebsiteUrlFixture } from "../../../test-utils/factories/websitalk/websiteUrls";
|
|
10
|
+
|
|
11
|
+
describe("db.websitalk.websiteUrls", () => {
|
|
12
|
+
const clientId = "test-client";
|
|
13
|
+
|
|
14
|
+
describe("createWebsiteUrl", () => {
|
|
15
|
+
it("should create a website URL configuration", async () => {
|
|
16
|
+
const id = await createWebsiteUrl({
|
|
17
|
+
clientId,
|
|
18
|
+
name: "Primary",
|
|
19
|
+
baseUrl: "https://example.com",
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const saved = await getWebsiteUrlById(id.toString());
|
|
23
|
+
expect(saved).toMatchObject({
|
|
24
|
+
clientId,
|
|
25
|
+
name: "Primary",
|
|
26
|
+
baseUrl: "https://example.com",
|
|
27
|
+
});
|
|
28
|
+
expect(saved?.createdAt).toBeInstanceOf(Date);
|
|
29
|
+
expect(saved?.updatedAt).toBeInstanceOf(Date);
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
describe("getWebsiteUrlsByClient", () => {
|
|
34
|
+
it("should return all configurations for a client", async () => {
|
|
35
|
+
await getWebsiteUrlsCollection().insertMany([
|
|
36
|
+
createWebsiteUrlFixture({ clientId, name: "A" }),
|
|
37
|
+
createWebsiteUrlFixture({ clientId, name: "B" }),
|
|
38
|
+
createWebsiteUrlFixture({ clientId: "other-client", name: "Other" }),
|
|
39
|
+
]);
|
|
40
|
+
|
|
41
|
+
const results = await getWebsiteUrlsByClient(clientId);
|
|
42
|
+
expect(results).toHaveLength(2);
|
|
43
|
+
expect(results.map((doc) => doc.name)).toEqual(["A", "B"]);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
describe("updateWebsiteUrl", () => {
|
|
48
|
+
it("should update name and baseUrl", async () => {
|
|
49
|
+
const id = await createWebsiteUrl({
|
|
50
|
+
clientId,
|
|
51
|
+
name: "Old",
|
|
52
|
+
baseUrl: "https://old.example",
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const updated = await updateWebsiteUrl(id.toString(), {
|
|
56
|
+
name: "New",
|
|
57
|
+
baseUrl: "https://new.example",
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
expect(updated?.name).toBe("New");
|
|
61
|
+
expect(updated?.baseUrl).toBe("https://new.example");
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
describe("deleteWebsiteUrl", () => {
|
|
66
|
+
it("should delete the website and return true", async () => {
|
|
67
|
+
const id = await createWebsiteUrl({
|
|
68
|
+
clientId: "delete-client",
|
|
69
|
+
name: "Gone",
|
|
70
|
+
baseUrl: "https://gone.example",
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
expect(await deleteWebsiteUrl(id.toString())).toBe(true);
|
|
74
|
+
expect(await getWebsiteUrlById(id.toString())).toBeNull();
|
|
75
|
+
});
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -0,0 +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
|
+
};
|
|
@@ -0,0 +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">;
|
package/tsconfig.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
3
|
"target": "ES2022",
|
|
4
|
-
"module": "
|
|
5
|
-
"moduleResolution": "
|
|
4
|
+
"module": "Node16",
|
|
5
|
+
"moduleResolution": "node16",
|
|
6
|
+
"isolatedModules": true,
|
|
6
7
|
"lib": ["ES2022"],
|
|
7
8
|
"declaration": true,
|
|
8
9
|
"declarationMap": true,
|
|
@@ -15,8 +16,7 @@
|
|
|
15
16
|
"skipLibCheck": true,
|
|
16
17
|
"resolveJsonModule": true,
|
|
17
18
|
"experimentalDecorators": true,
|
|
18
|
-
"emitDecoratorMetadata": true
|
|
19
|
-
"baseUrl": "."
|
|
19
|
+
"emitDecoratorMetadata": true
|
|
20
20
|
},
|
|
21
21
|
"include": ["src/**/*"],
|
|
22
22
|
"exclude": ["node_modules", "dist", "test", "**/*.test.ts", "**/__tests__/*", "**/*.spec.ts"]
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.utils.d.ts","sourceRoot":"","sources":["../../../src/talkpilot/subscriptions/subscriptions.utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAE,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,wBAAwB,EAA6B,MAAM,UAAU,CAAC;AAE7F,eAAO,MAAM,gBAAgB,GAAI,QAAQ,wBAAwB,KAAG,MAAM,CAAC,YAAY,CAetF,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildSimpleQuery = void 0;
|
|
4
|
-
const mongodb_1 = require("mongodb");
|
|
5
|
-
const index_1 = require("../index");
|
|
6
|
-
const buildSimpleQuery = (filter) => {
|
|
7
|
-
const query = {};
|
|
8
|
-
if (filter._id) {
|
|
9
|
-
query._id = new mongodb_1.ObjectId(filter._id);
|
|
10
|
-
}
|
|
11
|
-
index_1.simpleFields.forEach((field) => {
|
|
12
|
-
const val = filter[field];
|
|
13
|
-
if (val !== undefined) {
|
|
14
|
-
query[field] = val;
|
|
15
|
-
}
|
|
16
|
-
});
|
|
17
|
-
return query;
|
|
18
|
-
};
|
|
19
|
-
exports.buildSimpleQuery = buildSimpleQuery;
|
|
20
|
-
//# sourceMappingURL=subscriptions.utils.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subscriptions.utils.js","sourceRoot":"","sources":["../../../src/talkpilot/subscriptions/subscriptions.utils.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAC3C,oCAA6F;AAEtF,MAAM,gBAAgB,GAAG,CAAC,MAAgC,EAAwB,EAAE;IACzF,MAAM,KAAK,GAAyB,EAAE,CAAC;IAEvC,IAAI,MAAM,CAAC,GAAG,EAAE,CAAC;QACf,KAAK,CAAC,GAAG,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,oBAAY,CAAC,OAAO,CAAC,CAAC,KAAkB,EAAE,EAAE;QAC1C,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;YACtB,KAAK,CAAC,KAAK,CAAC,GAAG,GAAU,CAAC;QAC5B,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAfW,QAAA,gBAAgB,oBAe3B"}
|