@talkpilot/core-db 1.3.40 → 1.3.42
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 +0 -41
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/talkpilot/calls/calls.types.d.ts +0 -1
- package/dist/talkpilot/calls/calls.types.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts +0 -39
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js +1 -92
- package/dist/talkpilot/clientsConfig/clientsConfig.getters.js.map +1 -1
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts +0 -4
- package/dist/talkpilot/clientsConfig/clientsConfig.types.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/index.d.ts +0 -1
- package/dist/talkpilot/clientsConfig/index.d.ts.map +1 -1
- package/dist/talkpilot/clientsConfig/index.js +0 -1
- package/dist/talkpilot/clientsConfig/index.js.map +1 -1
- package/dist/test-utils/factories/index.d.ts +1 -1
- package/dist/test-utils/factories/index.d.ts.map +1 -1
- package/dist/test-utils/factories/index.js +1 -1
- package/dist/test-utils/factories/index.js.map +1 -1
- package/dist/test-utils/factories/websitalk/knowledgeDocuments.js +1 -1
- package/dist/test-utils/factories/websitalk/knowledgeDocuments.js.map +1 -1
- package/dist/test-utils/factories/websitalk/scans.d.ts.map +1 -1
- package/dist/test-utils/factories/websitalk/scans.js +0 -5
- package/dist/test-utils/factories/websitalk/scans.js.map +1 -1
- package/dist/websitalk/index.d.ts +1 -1
- package/dist/websitalk/index.d.ts.map +1 -1
- package/dist/websitalk/index.js +1 -1
- package/dist/websitalk/index.js.map +1 -1
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.getters.d.ts.map +1 -1
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.getters.js +1 -0
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.getters.js.map +1 -1
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.types.d.ts +1 -0
- package/dist/websitalk/knowledgeDocuments/knowledgeDocuments.types.d.ts.map +1 -1
- package/dist/websitalk/scans/scans.getters.d.ts.map +1 -1
- package/dist/websitalk/scans/scans.getters.js +2 -8
- package/dist/websitalk/scans/scans.getters.js.map +1 -1
- package/dist/websitalk/scans/scans.types.d.ts +0 -5
- package/dist/websitalk/scans/scans.types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +1 -1
- package/src/talkpilot/calls/calls.types.ts +0 -1
- package/src/talkpilot/clientsConfig/__tests__/clientsConfig.getters.spec.ts +0 -318
- package/src/talkpilot/clientsConfig/clientsConfig.getters.ts +2 -116
- package/src/talkpilot/clientsConfig/clientsConfig.types.ts +0 -4
- package/src/talkpilot/clientsConfig/index.ts +0 -1
- package/src/test-utils/factories/index.ts +1 -1
- package/src/test-utils/factories/websitalk/knowledgeDocuments.ts +28 -0
- package/src/test-utils/factories/websitalk/scans.ts +0 -5
- package/src/websitalk/index.ts +1 -1
- package/src/websitalk/knowledgeDocuments/__tests__/knowledgeDocuments.spec.ts +123 -0
- package/src/websitalk/knowledgeDocuments/index.ts +3 -0
- package/src/websitalk/knowledgeDocuments/knowledgeDocuments.constants.ts +19 -0
- package/src/websitalk/knowledgeDocuments/knowledgeDocuments.getters.ts +86 -0
- package/src/websitalk/knowledgeDocuments/knowledgeDocuments.types.ts +38 -0
- package/src/websitalk/scans/scans.getters.ts +2 -8
- package/src/websitalk/scans/scans.types.ts +0 -9
- package/src/talkpilot/clientsConfig/clientsConfig.constants.ts +0 -2
- package/src/test-utils/factories/websitalk/scanResources.ts +0 -26
- package/src/websitalk/scanResources/__tests__/scanResources.spec.ts +0 -136
- package/src/websitalk/scanResources/index.ts +0 -4
- package/src/websitalk/scanResources/scanResources.constants.ts +0 -47
- package/src/websitalk/scanResources/scanResources.getters.ts +0 -94
- package/src/websitalk/scanResources/scanResources.types.ts +0 -90
- package/src/websitalk/scanResources/scanResources.utils.ts +0 -28
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { WithId } from "mongodb";
|
|
2
|
-
import type {
|
|
3
|
-
BOARD_COLUMN_STATUSES,
|
|
4
|
-
URL_TASK_STATUSES,
|
|
5
|
-
} from "./scanResources.constants";
|
|
6
|
-
|
|
7
|
-
export type UrlTaskStatus =
|
|
8
|
-
(typeof URL_TASK_STATUSES)[keyof typeof URL_TASK_STATUSES];
|
|
9
|
-
|
|
10
|
-
export type BoardColumn = keyof typeof BOARD_COLUMN_STATUSES;
|
|
11
|
-
|
|
12
|
-
export type StageLogEntry = {
|
|
13
|
-
from: UrlTaskStatus | null;
|
|
14
|
-
to: UrlTaskStatus;
|
|
15
|
-
occurredAt: Date;
|
|
16
|
-
details: Record<string, unknown>;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type ScanResource = {
|
|
20
|
-
urlHashId: string;
|
|
21
|
-
clientId: string;
|
|
22
|
-
scanId: string;
|
|
23
|
-
websiteUrlId: string;
|
|
24
|
-
url: string;
|
|
25
|
-
urlCanonical?: string | null;
|
|
26
|
-
title?: string | null;
|
|
27
|
-
h1?: string | null;
|
|
28
|
-
language?: string | null;
|
|
29
|
-
sourceType?: string | null;
|
|
30
|
-
context?: string | null;
|
|
31
|
-
contentHash?: string | null;
|
|
32
|
-
duplicateOfTaskId?: string | null;
|
|
33
|
-
breadcrumbs?: unknown;
|
|
34
|
-
description?: string | null;
|
|
35
|
-
sourceUrl?: string | null;
|
|
36
|
-
errorMessage?: string | null;
|
|
37
|
-
|
|
38
|
-
status: UrlTaskStatus;
|
|
39
|
-
depth: number;
|
|
40
|
-
retryCount: number;
|
|
41
|
-
|
|
42
|
-
processRetryCount?: number;
|
|
43
|
-
globalResurrections?: number;
|
|
44
|
-
noRetry?: boolean;
|
|
45
|
-
reviveAt?: Date | null;
|
|
46
|
-
statusEnteredAt?: Date;
|
|
47
|
-
|
|
48
|
-
httpStatus?: number;
|
|
49
|
-
finalUrl?: string;
|
|
50
|
-
batchDone?: number;
|
|
51
|
-
batchTotal?: number;
|
|
52
|
-
|
|
53
|
-
stageLogs?: StageLogEntry[];
|
|
54
|
-
|
|
55
|
-
createdAt: Date;
|
|
56
|
-
updatedAt: Date;
|
|
57
|
-
fetchedAt?: Date | null;
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
export type ScanResourceDoc = WithId<ScanResource>;
|
|
61
|
-
|
|
62
|
-
export type ScanResourceBoardProjection = Pick<
|
|
63
|
-
ScanResourceDoc,
|
|
64
|
-
| "_id"
|
|
65
|
-
| "url"
|
|
66
|
-
| "title"
|
|
67
|
-
| "status"
|
|
68
|
-
| "statusEnteredAt"
|
|
69
|
-
| "retryCount"
|
|
70
|
-
| "processRetryCount"
|
|
71
|
-
| "globalResurrections"
|
|
72
|
-
| "noRetry"
|
|
73
|
-
| "errorMessage"
|
|
74
|
-
| "updatedAt"
|
|
75
|
-
| "sourceType"
|
|
76
|
-
>;
|
|
77
|
-
|
|
78
|
-
export type ScanPagesQuery = {
|
|
79
|
-
scanId: string;
|
|
80
|
-
column: BoardColumn;
|
|
81
|
-
search?: string;
|
|
82
|
-
cursor?: string | null;
|
|
83
|
-
since?: Date;
|
|
84
|
-
limit?: number;
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
export type PagedResult<T> = {
|
|
88
|
-
items: T[];
|
|
89
|
-
nextCursor: string | null;
|
|
90
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { ObjectId } from "mongodb";
|
|
2
|
-
import { BOARD_COLUMN_STATUSES } from "./scanResources.constants";
|
|
3
|
-
import type { BoardColumn, UrlTaskStatus } from "./scanResources.types";
|
|
4
|
-
|
|
5
|
-
const STATUS_TO_COLUMN: Record<UrlTaskStatus, BoardColumn> = Object.entries(
|
|
6
|
-
BOARD_COLUMN_STATUSES,
|
|
7
|
-
).reduce(
|
|
8
|
-
(acc, [column, statuses]) => {
|
|
9
|
-
for (const status of statuses) {
|
|
10
|
-
acc[status] = column as BoardColumn;
|
|
11
|
-
}
|
|
12
|
-
return acc;
|
|
13
|
-
},
|
|
14
|
-
{} as Record<UrlTaskStatus, BoardColumn>,
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
export const boardColumn = (status: UrlTaskStatus): BoardColumn =>
|
|
18
|
-
STATUS_TO_COLUMN[status];
|
|
19
|
-
|
|
20
|
-
export const statusesForColumn = (
|
|
21
|
-
column: BoardColumn,
|
|
22
|
-
): readonly UrlTaskStatus[] => BOARD_COLUMN_STATUSES[column];
|
|
23
|
-
|
|
24
|
-
export const encodeCursor = (id: ObjectId): string =>
|
|
25
|
-
Buffer.from(id.toHexString()).toString("base64");
|
|
26
|
-
|
|
27
|
-
export const decodeCursor = (cursor: string): ObjectId =>
|
|
28
|
-
new ObjectId(Buffer.from(cursor, "base64").toString("utf-8"));
|