@devrev/airsync-sdk 2.0.0-beta.0 → 2.0.0-beta.10
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 +7 -21
- package/dist/attachments-streaming/attachments-streaming-pool.d.ts +7 -1
- package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts +4 -3
- package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.js +70 -33
- package/dist/common/constants.d.ts +15 -12
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/common/constants.js +20 -34
- package/dist/common/helpers.d.ts +3 -27
- package/dist/common/helpers.d.ts.map +1 -1
- package/dist/common/helpers.js +6 -36
- package/dist/http/{axios-client-internal.d.ts → client.d.ts} +1 -1
- package/dist/http/client.d.ts.map +1 -0
- package/dist/http/{axios-client-internal.js → client.js} +7 -4
- package/dist/http/errors.d.ts +8 -0
- package/dist/http/errors.d.ts.map +1 -0
- package/dist/http/errors.js +31 -0
- package/dist/index.d.ts +30 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +47 -28
- package/dist/logger/logger.d.ts +13 -70
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.interfaces.d.ts +4 -7
- package/dist/logger/logger.interfaces.d.ts.map +1 -1
- package/dist/logger/logger.js +67 -92
- package/dist/mappers/mappers.d.ts +10 -43
- package/dist/mappers/mappers.d.ts.map +1 -1
- package/dist/mappers/mappers.interfaces.d.ts +173 -0
- package/dist/mappers/mappers.interfaces.d.ts.map +1 -0
- package/dist/mappers/{mappers.interface.js → mappers.interfaces.js} +1 -10
- package/dist/mappers/mappers.js +32 -46
- package/dist/multithreading/adapters/base-adapter.d.ts +39 -0
- package/dist/multithreading/adapters/base-adapter.d.ts.map +1 -0
- package/dist/multithreading/adapters/base-adapter.js +212 -0
- package/dist/multithreading/adapters/extraction-adapter.d.ts +49 -0
- package/dist/multithreading/adapters/extraction-adapter.d.ts.map +1 -0
- package/dist/multithreading/adapters/extraction-adapter.js +375 -0
- package/dist/multithreading/adapters/loading-adapter.d.ts +26 -0
- package/dist/multithreading/adapters/loading-adapter.d.ts.map +1 -0
- package/dist/multithreading/adapters/loading-adapter.helpers.d.ts +12 -0
- package/dist/multithreading/adapters/loading-adapter.helpers.d.ts.map +1 -0
- package/dist/multithreading/{worker-adapter/worker-adapter.helpers.js → adapters/loading-adapter.helpers.js} +2 -12
- package/dist/multithreading/adapters/loading-adapter.js +279 -0
- package/dist/multithreading/emit.d.ts +11 -0
- package/dist/multithreading/emit.d.ts.map +1 -0
- package/dist/multithreading/emit.js +25 -0
- package/dist/multithreading/process-task.d.ts +6 -1
- package/dist/multithreading/process-task.d.ts.map +1 -1
- package/dist/multithreading/process-task.js +124 -51
- package/dist/multithreading/spawn/spawn.d.ts +11 -11
- package/dist/multithreading/spawn/spawn.d.ts.map +1 -1
- package/dist/multithreading/spawn/spawn.helpers.d.ts +12 -11
- package/dist/multithreading/spawn/spawn.helpers.d.ts.map +1 -1
- package/dist/multithreading/spawn/spawn.helpers.js +142 -77
- package/dist/multithreading/spawn/spawn.js +74 -75
- package/dist/multithreading/worker.js +16 -5
- package/dist/repo/repo.d.ts +14 -5
- package/dist/repo/repo.d.ts.map +1 -1
- package/dist/repo/repo.helpers.d.ts +6 -0
- package/dist/repo/repo.helpers.d.ts.map +1 -0
- package/dist/repo/repo.helpers.js +16 -0
- package/dist/repo/repo.interfaces.d.ts +11 -20
- package/dist/repo/repo.interfaces.d.ts.map +1 -1
- package/dist/repo/repo.js +36 -22
- package/dist/state/base-state.d.ts +58 -0
- package/dist/state/base-state.d.ts.map +1 -0
- package/dist/state/base-state.js +242 -0
- package/dist/state/extraction-state.d.ts +14 -0
- package/dist/state/extraction-state.d.ts.map +1 -0
- package/dist/state/extraction-state.js +140 -0
- package/dist/state/install-initial-domain-mapping.d.ts +4 -0
- package/dist/state/install-initial-domain-mapping.d.ts.map +1 -0
- package/dist/{common → state}/install-initial-domain-mapping.js +5 -7
- package/dist/state/loading-state.d.ts +8 -0
- package/dist/state/loading-state.d.ts.map +1 -0
- package/dist/state/loading-state.js +29 -0
- package/dist/state/state.d.ts +3 -29
- package/dist/state/state.d.ts.map +1 -1
- package/dist/state/state.interfaces.d.ts +36 -10
- package/dist/state/state.interfaces.d.ts.map +1 -1
- package/dist/state/state.interfaces.js +17 -1
- package/dist/state/state.js +9 -164
- package/dist/state/time-value-resolver.d.ts +17 -0
- package/dist/state/time-value-resolver.d.ts.map +1 -0
- package/dist/state/time-value-resolver.js +110 -0
- package/dist/testing/mock-event.d.ts +10 -0
- package/dist/testing/mock-event.d.ts.map +1 -0
- package/dist/testing/mock-event.js +96 -0
- package/dist/testing/mock-server.d.ts +31 -0
- package/dist/testing/mock-server.d.ts.map +1 -0
- package/dist/testing/mock-server.interfaces.d.ts +54 -0
- package/dist/testing/mock-server.interfaces.d.ts.map +1 -0
- package/dist/testing/mock-server.interfaces.js +4 -0
- package/dist/testing/mock-server.js +297 -0
- package/dist/testing/test-adapters.d.ts +22 -0
- package/dist/testing/test-adapters.d.ts.map +1 -0
- package/dist/testing/test-adapters.js +32 -0
- package/dist/types/common.d.ts +4 -37
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +2 -17
- package/dist/types/errors.d.ts +15 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/errors.js +28 -0
- package/dist/types/external-domain-metadata.d.ts +197 -0
- package/dist/types/external-domain-metadata.d.ts.map +1 -0
- package/dist/types/extraction.d.ts +135 -278
- package/dist/types/extraction.d.ts.map +1 -1
- package/dist/types/extraction.js +46 -133
- package/dist/types/loading.d.ts +15 -55
- package/dist/types/loading.d.ts.map +1 -1
- package/dist/types/loading.js +1 -23
- package/dist/types/workers.d.ts +70 -103
- package/dist/types/workers.d.ts.map +1 -1
- package/dist/types/workers.js +1 -6
- package/dist/uploader/uploader.d.ts +10 -61
- package/dist/uploader/uploader.d.ts.map +1 -1
- package/dist/uploader/uploader.helpers.d.ts +7 -27
- package/dist/uploader/uploader.helpers.d.ts.map +1 -1
- package/dist/uploader/uploader.helpers.js +80 -30
- package/dist/uploader/uploader.interfaces.d.ts +19 -54
- package/dist/uploader/uploader.interfaces.d.ts.map +1 -1
- package/dist/uploader/uploader.interfaces.js +8 -0
- package/dist/uploader/uploader.js +72 -124
- package/docs/MIGRATION.md +696 -0
- package/package.json +37 -20
- package/dist/attachments-streaming/attachments-streaming-pool.test.d.ts +0 -2
- package/dist/attachments-streaming/attachments-streaming-pool.test.d.ts.map +0 -1
- package/dist/attachments-streaming/attachments-streaming-pool.test.js +0 -267
- package/dist/common/control-protocol.d.ts +0 -10
- package/dist/common/control-protocol.d.ts.map +0 -1
- package/dist/common/control-protocol.js +0 -31
- package/dist/common/errors.d.ts +0 -6
- package/dist/common/errors.d.ts.map +0 -1
- package/dist/common/errors.js +0 -4
- package/dist/common/event-type-translation.d.ts +0 -24
- package/dist/common/event-type-translation.d.ts.map +0 -1
- package/dist/common/event-type-translation.js +0 -117
- package/dist/common/install-initial-domain-mapping.d.ts +0 -4
- package/dist/common/install-initial-domain-mapping.d.ts.map +0 -1
- package/dist/common/install-initial-domain-mapping.test.d.ts +0 -2
- package/dist/common/install-initial-domain-mapping.test.d.ts.map +0 -1
- package/dist/common/install-initial-domain-mapping.test.js +0 -207
- package/dist/deprecated/adapter/index.d.ts +0 -62
- package/dist/deprecated/adapter/index.d.ts.map +0 -1
- package/dist/deprecated/adapter/index.js +0 -151
- package/dist/deprecated/common/helpers.d.ts +0 -7
- package/dist/deprecated/common/helpers.d.ts.map +0 -1
- package/dist/deprecated/common/helpers.js +0 -47
- package/dist/deprecated/demo-extractor/external_domain_metadata.json +0 -38
- package/dist/deprecated/demo-extractor/index.d.ts +0 -18
- package/dist/deprecated/demo-extractor/index.d.ts.map +0 -1
- package/dist/deprecated/demo-extractor/index.js +0 -161
- package/dist/deprecated/http/client.d.ts +0 -22
- package/dist/deprecated/http/client.d.ts.map +0 -1
- package/dist/deprecated/http/client.js +0 -161
- package/dist/deprecated/uploader/index.d.ts +0 -35
- package/dist/deprecated/uploader/index.d.ts.map +0 -1
- package/dist/deprecated/uploader/index.js +0 -161
- package/dist/http/axios-client-internal.d.ts.map +0 -1
- package/dist/http/axios-client-internal.test.d.ts +0 -2
- package/dist/http/axios-client-internal.test.d.ts.map +0 -1
- package/dist/http/axios-client-internal.test.js +0 -154
- package/dist/http/axios-client.d.ts +0 -27
- package/dist/http/axios-client.d.ts.map +0 -1
- package/dist/http/axios-client.js +0 -57
- package/dist/http/constants.d.ts +0 -4
- package/dist/http/constants.d.ts.map +0 -1
- package/dist/http/constants.js +0 -6
- package/dist/http/index.d.ts +0 -3
- package/dist/http/index.d.ts.map +0 -1
- package/dist/http/index.js +0 -18
- package/dist/http/types.d.ts +0 -17
- package/dist/http/types.d.ts.map +0 -1
- package/dist/logger/logger.constants.d.ts +0 -6
- package/dist/logger/logger.constants.d.ts.map +0 -1
- package/dist/logger/logger.constants.js +0 -13
- package/dist/logger/logger.context.d.ts +0 -58
- package/dist/logger/logger.context.d.ts.map +0 -1
- package/dist/logger/logger.context.js +0 -86
- package/dist/logger/logger.test.d.ts +0 -2
- package/dist/logger/logger.test.d.ts.map +0 -1
- package/dist/logger/logger.test.js +0 -490
- package/dist/mappers/mappers.interface.d.ts +0 -294
- package/dist/mappers/mappers.interface.d.ts.map +0 -1
- package/dist/mappers/mappers.test.d.ts +0 -2
- package/dist/mappers/mappers.test.d.ts.map +0 -1
- package/dist/mappers/mappers.test.js +0 -107
- package/dist/multithreading/create-worker.test.d.ts +0 -2
- package/dist/multithreading/create-worker.test.d.ts.map +0 -1
- package/dist/multithreading/create-worker.test.js +0 -89
- package/dist/multithreading/spawn/spawn.helpers.test.d.ts +0 -2
- package/dist/multithreading/spawn/spawn.helpers.test.d.ts.map +0 -1
- package/dist/multithreading/spawn/spawn.helpers.test.js +0 -293
- package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.d.ts +0 -2
- package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.d.ts.map +0 -1
- package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.js +0 -127
- package/dist/multithreading/worker-adapter/worker-adapter.d.ts +0 -91
- package/dist/multithreading/worker-adapter/worker-adapter.d.ts.map +0 -1
- package/dist/multithreading/worker-adapter/worker-adapter.helpers.d.ts +0 -22
- package/dist/multithreading/worker-adapter/worker-adapter.helpers.d.ts.map +0 -1
- package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.d.ts +0 -2
- package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.d.ts.map +0 -1
- package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.js +0 -514
- package/dist/multithreading/worker-adapter/worker-adapter.js +0 -747
- package/dist/multithreading/worker-adapter/worker-adapter.test.d.ts +0 -2
- package/dist/multithreading/worker-adapter/worker-adapter.test.d.ts.map +0 -1
- package/dist/multithreading/worker-adapter/worker-adapter.test.js +0 -483
- package/dist/repo/repo.test.d.ts +0 -2
- package/dist/repo/repo.test.d.ts.map +0 -1
- package/dist/repo/repo.test.js +0 -131
- package/dist/state/state.test.d.ts +0 -2
- package/dist/state/state.test.d.ts.map +0 -1
- package/dist/state/state.test.js +0 -224
- package/dist/types/extraction.test.d.ts +0 -2
- package/dist/types/extraction.test.d.ts.map +0 -1
- package/dist/types/extraction.test.js +0 -70
- package/dist/types/index.d.ts +0 -9
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -18
- package/dist/uploader/uploader.helpers.test.d.ts +0 -2
- package/dist/uploader/uploader.helpers.test.d.ts.map +0 -1
- package/dist/uploader/uploader.helpers.test.js +0 -267
- package/dist/uploader/uploader.test.d.ts +0 -2
- package/dist/uploader/uploader.test.d.ts.map +0 -1
- package/dist/uploader/uploader.test.js +0 -589
- /package/dist/{http/types.js → types/external-domain-metadata.js} +0 -0
package/package.json
CHANGED
|
@@ -1,60 +1,77 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devrev/airsync-sdk",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "2.0.0-beta.10",
|
|
4
|
+
"description": "Typescript SDK for building AirSync snap-ins on the DevRev platform.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"typings": "./dist/index.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
11
|
+
"default": "./dist/index.js"
|
|
12
|
+
},
|
|
13
|
+
"./package.json": "./package.json"
|
|
14
|
+
},
|
|
8
15
|
"scripts": {
|
|
9
|
-
"build": "tsc -p ./tsconfig.json",
|
|
16
|
+
"build": "tsc -p ./tsconfig.build.json",
|
|
10
17
|
"prepare": "npm run build",
|
|
11
|
-
"start": "ts-node src/index.ts",
|
|
12
18
|
"lint": "eslint .",
|
|
13
19
|
"lint:fix": "eslint . --fix",
|
|
14
|
-
"test": "jest --
|
|
15
|
-
"test:backwards-compatibility": "jest --
|
|
20
|
+
"test": "jest --silent --forceExit --maxWorkers=50% --selectProjects default --",
|
|
21
|
+
"test:backwards-compatibility": "jest --silent --forceExit --selectProjects backwards-compatibility --",
|
|
22
|
+
"test:timeout-handling": "jest --silent --forceExit --selectProjects timeout-handling --",
|
|
23
|
+
"test:slow": "jest --silent --forceExit --selectProjects slow --",
|
|
24
|
+
"test:coverage": "jest --silent --forceExit --coverage --runInBand --",
|
|
25
|
+
"test:debug": "jest --forceExit --selectProjects default --"
|
|
16
26
|
},
|
|
17
27
|
"repository": {
|
|
18
28
|
"type": "git",
|
|
19
29
|
"url": "git+https://github.com/devrev/adaas-sdk.git"
|
|
20
30
|
},
|
|
21
31
|
"publishConfig": {
|
|
22
|
-
"registry": "https://
|
|
32
|
+
"registry": "https://registry.npmjs.org"
|
|
23
33
|
},
|
|
24
34
|
"keywords": [],
|
|
25
35
|
"author": "devrev",
|
|
26
36
|
"license": "ISC",
|
|
27
37
|
"devDependencies": {
|
|
28
|
-
"@microsoft/api-extractor": "^7.
|
|
38
|
+
"@microsoft/api-extractor": "^7.57.6",
|
|
29
39
|
"@microsoft/api-extractor-model": "^7.30.7",
|
|
30
|
-
"@types/express": "^5.0.3",
|
|
31
40
|
"@types/jest": "^29.5.14",
|
|
32
41
|
"@types/node": "^22.18.0",
|
|
33
|
-
"
|
|
34
|
-
"@typescript-eslint/eslint-plugin": "^8.46.0",
|
|
35
|
-
"@typescript-eslint/parser": "^8.46.0",
|
|
42
|
+
"ajv": "^8.18.0",
|
|
36
43
|
"eslint": "9.32.0",
|
|
37
44
|
"eslint-config-prettier": "^9.1.2",
|
|
38
45
|
"eslint-plugin-prettier": "4.0.0",
|
|
46
|
+
"eslint-plugin-simple-import-sort": "^13.0.0",
|
|
39
47
|
"jest": "^29.7.0",
|
|
40
48
|
"jiti": "^2.6.1",
|
|
41
49
|
"prettier": "^2.8.3",
|
|
42
50
|
"ts-jest": "^29.4.4",
|
|
51
|
+
"ts-node": "^10.9.2",
|
|
43
52
|
"typescript": "^5.3.3",
|
|
44
53
|
"typescript-eslint": "^8.46.1"
|
|
45
54
|
},
|
|
46
55
|
"dependencies": {
|
|
47
|
-
"
|
|
48
|
-
"axios": "^1.12.1",
|
|
56
|
+
"axios": "^1.20.0",
|
|
49
57
|
"axios-retry": "^4.5.0",
|
|
50
|
-
"express": "^5.2.1",
|
|
51
58
|
"form-data": "^4.0.4",
|
|
52
|
-
"js-jsonl": "^1.1.1"
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
"js-jsonl": "^1.1.1"
|
|
60
|
+
},
|
|
61
|
+
"peerDependencies": {
|
|
62
|
+
"ts-node": "^10.9.2"
|
|
63
|
+
},
|
|
64
|
+
"peerDependenciesMeta": {
|
|
65
|
+
"ts-node": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
55
68
|
},
|
|
56
69
|
"files": [
|
|
57
70
|
"dist/**/*",
|
|
58
|
-
"!dist/tests/**/*"
|
|
59
|
-
|
|
71
|
+
"!dist/tests/**/*",
|
|
72
|
+
"docs/MIGRATION.md"
|
|
73
|
+
],
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=20"
|
|
76
|
+
}
|
|
60
77
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"attachments-streaming-pool.test.d.ts","sourceRoot":"","sources":["../../src/attachments-streaming/attachments-streaming-pool.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const attachments_streaming_pool_1 = require("./attachments-streaming-pool");
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
5
|
-
describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
|
|
6
|
-
let mockAdapter;
|
|
7
|
-
let mockStream;
|
|
8
|
-
let mockAttachments;
|
|
9
|
-
beforeEach(() => {
|
|
10
|
-
// Create mock adapter
|
|
11
|
-
mockAdapter = {
|
|
12
|
-
state: {
|
|
13
|
-
attachments: { completed: false },
|
|
14
|
-
toDevRev: {
|
|
15
|
-
attachmentsMetadata: {
|
|
16
|
-
lastProcessedAttachmentsIdsList: [],
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
processAttachment: jest
|
|
21
|
-
.fn()
|
|
22
|
-
.mockResolvedValue({}),
|
|
23
|
-
};
|
|
24
|
-
// Create mock stream function
|
|
25
|
-
mockStream = jest.fn().mockResolvedValue({ success: true });
|
|
26
|
-
// Create mock attachments
|
|
27
|
-
mockAttachments = [
|
|
28
|
-
{
|
|
29
|
-
id: 'attachment-1',
|
|
30
|
-
url: 'https://example.com/file1.pdf',
|
|
31
|
-
file_name: 'file1.pdf',
|
|
32
|
-
parent_id: 'parent-1',
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
id: 'attachment-2',
|
|
36
|
-
url: 'https://example.com/file2.jpg',
|
|
37
|
-
file_name: 'file2.jpg',
|
|
38
|
-
parent_id: 'parent-2',
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
id: 'attachment-3',
|
|
42
|
-
url: 'https://example.com/file3.doc',
|
|
43
|
-
file_name: 'file3.doc',
|
|
44
|
-
parent_id: 'parent-3',
|
|
45
|
-
},
|
|
46
|
-
];
|
|
47
|
-
// Mock console methods
|
|
48
|
-
jest.spyOn(console, 'log').mockImplementation();
|
|
49
|
-
jest.spyOn(console, 'error').mockImplementation();
|
|
50
|
-
jest.spyOn(console, 'warn').mockImplementation();
|
|
51
|
-
});
|
|
52
|
-
afterEach(() => {
|
|
53
|
-
jest.clearAllMocks();
|
|
54
|
-
jest.restoreAllMocks();
|
|
55
|
-
});
|
|
56
|
-
describe(attachments_streaming_pool_1.AttachmentsStreamingPool.prototype.constructor.name, () => {
|
|
57
|
-
it('should initialize with default values', () => {
|
|
58
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
59
|
-
adapter: mockAdapter,
|
|
60
|
-
attachments: mockAttachments,
|
|
61
|
-
stream: mockStream,
|
|
62
|
-
});
|
|
63
|
-
expect(pool).toBeDefined();
|
|
64
|
-
expect(pool['adapter']).toBe(mockAdapter);
|
|
65
|
-
expect(pool['attachments']).toEqual(mockAttachments);
|
|
66
|
-
expect(pool['batchSize']).toBe(10);
|
|
67
|
-
expect(pool['stream']).toBe(mockStream);
|
|
68
|
-
});
|
|
69
|
-
it('should initialize with custom batch size', () => {
|
|
70
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
71
|
-
adapter: mockAdapter,
|
|
72
|
-
attachments: mockAttachments,
|
|
73
|
-
batchSize: 5,
|
|
74
|
-
stream: mockStream,
|
|
75
|
-
});
|
|
76
|
-
expect(pool['batchSize']).toBe(5);
|
|
77
|
-
});
|
|
78
|
-
it('should create a copy of attachments array', () => {
|
|
79
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
80
|
-
adapter: mockAdapter,
|
|
81
|
-
attachments: mockAttachments,
|
|
82
|
-
stream: mockStream,
|
|
83
|
-
});
|
|
84
|
-
expect(pool['attachments']).toEqual(mockAttachments);
|
|
85
|
-
expect(pool['attachments']).not.toBe(mockAttachments); // Different reference
|
|
86
|
-
});
|
|
87
|
-
});
|
|
88
|
-
describe(attachments_streaming_pool_1.AttachmentsStreamingPool.prototype.streamAll.name, () => {
|
|
89
|
-
it('should initialize lastProcessedAttachmentsIdsList if it does not exist', async () => {
|
|
90
|
-
mockAdapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList =
|
|
91
|
-
undefined;
|
|
92
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
93
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
94
|
-
adapter: mockAdapter,
|
|
95
|
-
attachments: mockAttachments,
|
|
96
|
-
stream: mockStream,
|
|
97
|
-
});
|
|
98
|
-
// Mock startPoolStreaming to avoid actual processing
|
|
99
|
-
jest
|
|
100
|
-
.spyOn(pool, 'startPoolStreaming')
|
|
101
|
-
.mockResolvedValue(undefined);
|
|
102
|
-
await pool.streamAll();
|
|
103
|
-
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
104
|
-
.lastProcessedAttachmentsIdsList).toEqual([]);
|
|
105
|
-
});
|
|
106
|
-
it('should process all attachments successfully', async () => {
|
|
107
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
108
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
109
|
-
adapter: mockAdapter,
|
|
110
|
-
attachments: mockAttachments,
|
|
111
|
-
stream: mockStream,
|
|
112
|
-
});
|
|
113
|
-
const result = await pool.streamAll();
|
|
114
|
-
expect(result).toEqual({});
|
|
115
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
116
|
-
});
|
|
117
|
-
it('should handle empty attachments array', async () => {
|
|
118
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
119
|
-
adapter: mockAdapter,
|
|
120
|
-
attachments: [],
|
|
121
|
-
stream: mockStream,
|
|
122
|
-
});
|
|
123
|
-
const result = await pool.streamAll();
|
|
124
|
-
expect(result).toEqual({});
|
|
125
|
-
expect(mockAdapter.processAttachment).not.toHaveBeenCalled();
|
|
126
|
-
});
|
|
127
|
-
it('should return delay when rate limit is hit', async () => {
|
|
128
|
-
const delayResponse = { delay: 5000 };
|
|
129
|
-
mockAdapter.processAttachment.mockResolvedValue(delayResponse);
|
|
130
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
131
|
-
adapter: mockAdapter,
|
|
132
|
-
attachments: mockAttachments,
|
|
133
|
-
stream: mockStream,
|
|
134
|
-
});
|
|
135
|
-
const result = await pool.streamAll();
|
|
136
|
-
expect(result).toEqual({ delay: 5000 });
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
describe(attachments_streaming_pool_1.AttachmentsStreamingPool.prototype.startPoolStreaming.name, () => {
|
|
140
|
-
it('should skip already processed attachments', async () => {
|
|
141
|
-
mockAdapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList =
|
|
142
|
-
['attachment-1'];
|
|
143
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
144
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
145
|
-
adapter: mockAdapter,
|
|
146
|
-
attachments: mockAttachments,
|
|
147
|
-
stream: mockStream,
|
|
148
|
-
});
|
|
149
|
-
await pool.streamAll();
|
|
150
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(2); // Only 2 out of 3
|
|
151
|
-
});
|
|
152
|
-
it('should add successfully processed attachment IDs to the list', async () => {
|
|
153
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
154
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
155
|
-
adapter: mockAdapter,
|
|
156
|
-
attachments: mockAttachments,
|
|
157
|
-
stream: mockStream,
|
|
158
|
-
});
|
|
159
|
-
await pool.streamAll();
|
|
160
|
-
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
161
|
-
.lastProcessedAttachmentsIdsList).toEqual(['attachment-1', 'attachment-2', 'attachment-3']);
|
|
162
|
-
});
|
|
163
|
-
it('should handle processing errors gracefully', async () => {
|
|
164
|
-
const error = new Error('Processing failed');
|
|
165
|
-
mockAdapter.processAttachment
|
|
166
|
-
.mockResolvedValueOnce({}) // First attachment succeeds
|
|
167
|
-
.mockRejectedValueOnce(error) // Second attachment fails
|
|
168
|
-
.mockResolvedValueOnce({}); // Third attachment succeeds
|
|
169
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
170
|
-
adapter: mockAdapter,
|
|
171
|
-
attachments: mockAttachments,
|
|
172
|
-
stream: mockStream,
|
|
173
|
-
});
|
|
174
|
-
await pool.streamAll();
|
|
175
|
-
expect(console.warn).toHaveBeenCalledWith('Skipping attachment with ID attachment-2 due to error in processAttachment function', error);
|
|
176
|
-
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
177
|
-
.lastProcessedAttachmentsIdsList).toEqual(['attachment-1', 'attachment-3']);
|
|
178
|
-
});
|
|
179
|
-
it('should stop processing when rate limit delay is encountered', async () => {
|
|
180
|
-
mockAdapter.processAttachment
|
|
181
|
-
.mockResolvedValueOnce({}) // First attachment succeeds
|
|
182
|
-
.mockResolvedValueOnce({ delay: 5000 }) // Second attachment triggers rate limit
|
|
183
|
-
.mockResolvedValueOnce({}); // Third attachment succeeds
|
|
184
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
185
|
-
adapter: mockAdapter,
|
|
186
|
-
attachments: mockAttachments,
|
|
187
|
-
stream: mockStream,
|
|
188
|
-
});
|
|
189
|
-
await pool.streamAll();
|
|
190
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
191
|
-
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
192
|
-
.lastProcessedAttachmentsIdsList).toEqual(['attachment-1', 'attachment-3']);
|
|
193
|
-
});
|
|
194
|
-
it('should pass correct parameters to processAttachment', async () => {
|
|
195
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
196
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
197
|
-
adapter: mockAdapter,
|
|
198
|
-
attachments: [mockAttachments[0]],
|
|
199
|
-
stream: mockStream,
|
|
200
|
-
});
|
|
201
|
-
await pool.streamAll();
|
|
202
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledWith(mockAttachments[0], mockStream);
|
|
203
|
-
});
|
|
204
|
-
});
|
|
205
|
-
it('[edge] should handle single attachment', async () => {
|
|
206
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
207
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
208
|
-
adapter: mockAdapter,
|
|
209
|
-
attachments: [mockAttachments[0]],
|
|
210
|
-
stream: mockStream,
|
|
211
|
-
});
|
|
212
|
-
const result = await pool.streamAll();
|
|
213
|
-
expect(result).toEqual({});
|
|
214
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(1);
|
|
215
|
-
});
|
|
216
|
-
it('[edge] should handle batch size larger than attachments array', async () => {
|
|
217
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
218
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
219
|
-
adapter: mockAdapter,
|
|
220
|
-
attachments: mockAttachments,
|
|
221
|
-
batchSize: 100,
|
|
222
|
-
stream: mockStream,
|
|
223
|
-
});
|
|
224
|
-
await pool.streamAll();
|
|
225
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
226
|
-
});
|
|
227
|
-
it('[edge] should handle batch size of 1', async () => {
|
|
228
|
-
mockAdapter.processAttachment.mockResolvedValue({});
|
|
229
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
230
|
-
adapter: mockAdapter,
|
|
231
|
-
attachments: mockAttachments,
|
|
232
|
-
batchSize: 1,
|
|
233
|
-
stream: mockStream,
|
|
234
|
-
});
|
|
235
|
-
await pool.streamAll();
|
|
236
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
237
|
-
});
|
|
238
|
-
describe('concurrency behavior', () => {
|
|
239
|
-
it('should process attachments concurrently within batch size', async () => {
|
|
240
|
-
let processCallCount = 0;
|
|
241
|
-
const processPromises = [];
|
|
242
|
-
mockAdapter.processAttachment.mockImplementation(async () => {
|
|
243
|
-
const promise = new Promise((resolve) => {
|
|
244
|
-
setTimeout(() => {
|
|
245
|
-
processCallCount++;
|
|
246
|
-
resolve({});
|
|
247
|
-
}, 100);
|
|
248
|
-
});
|
|
249
|
-
processPromises.push(promise);
|
|
250
|
-
return promise;
|
|
251
|
-
});
|
|
252
|
-
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
253
|
-
adapter: mockAdapter,
|
|
254
|
-
attachments: mockAttachments,
|
|
255
|
-
batchSize: 2,
|
|
256
|
-
stream: mockStream,
|
|
257
|
-
});
|
|
258
|
-
const startTime = Date.now();
|
|
259
|
-
await pool.streamAll();
|
|
260
|
-
const endTime = Date.now();
|
|
261
|
-
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
262
|
-
expect(processCallCount).toBe(3);
|
|
263
|
-
// Should complete in roughly 200ms (2 batches of 100ms each) rather than 300ms (sequential)
|
|
264
|
-
expect(endTime - startTime).toBeLessThan(250);
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { AirdropEvent, EventData, ExtractorEventType } from '../types/extraction';
|
|
3
|
-
import { LoaderEventType } from '../types/loading';
|
|
4
|
-
export interface EmitInterface {
|
|
5
|
-
event: AirdropEvent;
|
|
6
|
-
eventType: ExtractorEventType | LoaderEventType;
|
|
7
|
-
data?: EventData;
|
|
8
|
-
}
|
|
9
|
-
export declare const emit: ({ event, eventType, data, }: EmitInterface) => Promise<AxiosResponse>;
|
|
10
|
-
//# sourceMappingURL=control-protocol.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"control-protocol.d.ts","sourceRoot":"","sources":["../../src/common/control-protocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,SAAS,EAET,kBAAkB,EAEnB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAInD,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,YAAY,CAAC;IACpB,SAAS,EAAE,kBAAkB,GAAG,eAAe,CAAC;IAChD,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,IAAI,GAAU,6BAIxB,aAAa,KAAG,OAAO,CAAC,aAAa,CAgCvC,CAAC"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.emit = void 0;
|
|
4
|
-
const axios_client_internal_1 = require("../http/axios-client-internal");
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
const event_type_translation_1 = require("./event-type-translation");
|
|
7
|
-
const emit = async ({ event, eventType, data, }) => {
|
|
8
|
-
// Translate outgoing event type to ensure we always send new event types
|
|
9
|
-
// TODO: Remove when the old types are completely phased out
|
|
10
|
-
const translatedEventType = (0, event_type_translation_1.translateOutgoingEventType)(eventType);
|
|
11
|
-
const newEvent = {
|
|
12
|
-
event_type: translatedEventType,
|
|
13
|
-
event_context: event.payload.event_context,
|
|
14
|
-
event_data: Object.assign({}, data),
|
|
15
|
-
worker_metadata: {
|
|
16
|
-
adaas_library_version: constants_1.LIBRARY_VERSION,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
console.info('Emitting event', newEvent);
|
|
20
|
-
return axios_client_internal_1.axiosClient.post(event.payload.event_context.callback_url, Object.assign({}, newEvent), {
|
|
21
|
-
headers: {
|
|
22
|
-
Accept: 'application/json, text/plain, */*',
|
|
23
|
-
Authorization: event.context.secrets.service_account_token,
|
|
24
|
-
'Content-Type': 'application/json',
|
|
25
|
-
'X-DevRev-Client-Platform': event.payload.event_context.snap_in_slug,
|
|
26
|
-
'X-DevRev-Client-Id': event.payload.event_context.snap_in_version_id,
|
|
27
|
-
'X-DevRev-Client-Version': constants_1.LIBRARY_VERSION,
|
|
28
|
-
},
|
|
29
|
-
});
|
|
30
|
-
};
|
|
31
|
-
exports.emit = emit;
|
package/dist/common/errors.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const enum ExtractionCommonError {
|
|
2
|
-
EXTERNAL_SYNC_UNIT_DELETED = "ERROR_CODE=EXTERNAL_SYNC_UNIT_DELETED",
|
|
3
|
-
EXTERNAL_SYNC_UNIT_DEACTIVATED = "ERROR_CODE=EXTERNAL_SYNC_UNIT_DEACTIVATED",
|
|
4
|
-
USER_DELETED = "ERROR_CODE=USER_DELETED"
|
|
5
|
-
}
|
|
6
|
-
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/common/errors.ts"],"names":[],"mappings":"AAGA,0BAAkB,qBAAqB;IACrC,0BAA0B,0CAAgE;IAC1F,8BAA8B,8CAAoE;IAClG,YAAY,4BAAkD;CAC/D"}
|
package/dist/common/errors.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { EventType, ExtractorEventType } from '../types/extraction';
|
|
2
|
-
import { LoaderEventType } from '../types/loading';
|
|
3
|
-
/**
|
|
4
|
-
* Maps old incoming event type strings to new EventType enum values.
|
|
5
|
-
* This ensures backwards compatibility when the platform sends old event types.
|
|
6
|
-
* @param eventTypeString The raw event type string from the platform
|
|
7
|
-
* @returns The translated EventType enum value
|
|
8
|
-
*/
|
|
9
|
-
export declare function translateIncomingEventType(eventTypeString: string): EventType;
|
|
10
|
-
/**
|
|
11
|
-
* Translates ExtractorEventType enum values by converting old enum members to new ones.
|
|
12
|
-
* Old enum members are deprecated and should be replaced with new ones.
|
|
13
|
-
*/
|
|
14
|
-
export declare function translateExtractorEventType(eventType: ExtractorEventType): ExtractorEventType;
|
|
15
|
-
/**
|
|
16
|
-
* Translates LoaderEventType enum values by converting old enum members to new ones.
|
|
17
|
-
* Old enum members are deprecated and should be replaced with new ones.
|
|
18
|
-
*/
|
|
19
|
-
export declare function translateLoaderEventType(eventType: LoaderEventType): LoaderEventType;
|
|
20
|
-
/**
|
|
21
|
-
* Translates any outgoing event type (Extractor or Loader) to ensure new event types are used.
|
|
22
|
-
*/
|
|
23
|
-
export declare function translateOutgoingEventType(eventType: ExtractorEventType | LoaderEventType): ExtractorEventType | LoaderEventType;
|
|
24
|
-
//# sourceMappingURL=event-type-translation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-type-translation.d.ts","sourceRoot":"","sources":["../../src/common/event-type-translation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAEnD;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,eAAe,EAAE,MAAM,GAAG,SAAS,CAwD7E;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,kBAAkB,GAC5B,kBAAkB,CA0CpB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,eAAe,GACzB,eAAe,CAmBjB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,kBAAkB,GAAG,eAAe,GAC9C,kBAAkB,GAAG,eAAe,CAatC"}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.translateIncomingEventType = translateIncomingEventType;
|
|
4
|
-
exports.translateExtractorEventType = translateExtractorEventType;
|
|
5
|
-
exports.translateLoaderEventType = translateLoaderEventType;
|
|
6
|
-
exports.translateOutgoingEventType = translateOutgoingEventType;
|
|
7
|
-
const extraction_1 = require("../types/extraction");
|
|
8
|
-
const loading_1 = require("../types/loading");
|
|
9
|
-
/**
|
|
10
|
-
* Maps old incoming event type strings to new EventType enum values.
|
|
11
|
-
* This ensures backwards compatibility when the platform sends old event types.
|
|
12
|
-
* @param eventTypeString The raw event type string from the platform
|
|
13
|
-
* @returns The translated EventType enum value
|
|
14
|
-
*/
|
|
15
|
-
function translateIncomingEventType(eventTypeString) {
|
|
16
|
-
// Create a reverse mapping from OLD string values to NEW enum member names
|
|
17
|
-
const eventTypeMap = {
|
|
18
|
-
// Old extraction event types from platform -> New enum members
|
|
19
|
-
[extraction_1.EventType.ExtractionExternalSyncUnitsStart]: extraction_1.EventType.StartExtractingExternalSyncUnits,
|
|
20
|
-
[extraction_1.EventType.ExtractionMetadataStart]: extraction_1.EventType.StartExtractingMetadata,
|
|
21
|
-
[extraction_1.EventType.ExtractionDataStart]: extraction_1.EventType.StartExtractingData,
|
|
22
|
-
[extraction_1.EventType.ExtractionDataContinue]: extraction_1.EventType.ContinueExtractingData,
|
|
23
|
-
[extraction_1.EventType.ExtractionDataDelete]: extraction_1.EventType.StartDeletingExtractorState,
|
|
24
|
-
[extraction_1.EventType.ExtractionAttachmentsStart]: extraction_1.EventType.StartExtractingAttachments,
|
|
25
|
-
[extraction_1.EventType.ExtractionAttachmentsContinue]: extraction_1.EventType.ContinueExtractingAttachments,
|
|
26
|
-
[extraction_1.EventType.ExtractionAttachmentsDelete]: extraction_1.EventType.StartDeletingExtractorAttachmentsState,
|
|
27
|
-
// New extraction event types (already correct, map to new enum members)
|
|
28
|
-
[extraction_1.EventType.StartExtractingExternalSyncUnits]: extraction_1.EventType.StartExtractingExternalSyncUnits,
|
|
29
|
-
[extraction_1.EventType.StartExtractingMetadata]: extraction_1.EventType.StartExtractingMetadata,
|
|
30
|
-
[extraction_1.EventType.StartExtractingData]: extraction_1.EventType.StartExtractingData,
|
|
31
|
-
[extraction_1.EventType.ContinueExtractingData]: extraction_1.EventType.ContinueExtractingData,
|
|
32
|
-
[extraction_1.EventType.StartDeletingExtractorState]: extraction_1.EventType.StartDeletingExtractorState,
|
|
33
|
-
[extraction_1.EventType.StartExtractingAttachments]: extraction_1.EventType.StartExtractingAttachments,
|
|
34
|
-
[extraction_1.EventType.ContinueExtractingAttachments]: extraction_1.EventType.ContinueExtractingAttachments,
|
|
35
|
-
[extraction_1.EventType.StartDeletingExtractorAttachmentsState]: extraction_1.EventType.StartDeletingExtractorAttachmentsState,
|
|
36
|
-
// Loading events
|
|
37
|
-
[extraction_1.EventType.StartLoadingData]: extraction_1.EventType.StartLoadingData,
|
|
38
|
-
[extraction_1.EventType.ContinueLoadingData]: extraction_1.EventType.ContinueLoadingData,
|
|
39
|
-
[extraction_1.EventType.StartLoadingAttachments]: extraction_1.EventType.StartLoadingAttachments,
|
|
40
|
-
[extraction_1.EventType.ContinueLoadingAttachments]: extraction_1.EventType.ContinueLoadingAttachments,
|
|
41
|
-
[extraction_1.EventType.StartDeletingLoaderState]: extraction_1.EventType.StartDeletingLoaderState,
|
|
42
|
-
[extraction_1.EventType.StartDeletingLoaderAttachmentState]: extraction_1.EventType.StartDeletingLoaderAttachmentState,
|
|
43
|
-
// Unknown
|
|
44
|
-
[extraction_1.EventType.UnknownEventType]: extraction_1.EventType.UnknownEventType,
|
|
45
|
-
};
|
|
46
|
-
const translated = eventTypeMap[eventTypeString];
|
|
47
|
-
if (!translated) {
|
|
48
|
-
console.warn(`Unknown event type received: ${eventTypeString}. This may indicate a new event type or a typo.`);
|
|
49
|
-
// Return the original string cast as EventType as a fallback
|
|
50
|
-
return eventTypeString;
|
|
51
|
-
}
|
|
52
|
-
return translated;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Translates ExtractorEventType enum values by converting old enum members to new ones.
|
|
56
|
-
* Old enum members are deprecated and should be replaced with new ones.
|
|
57
|
-
*/
|
|
58
|
-
function translateExtractorEventType(eventType) {
|
|
59
|
-
var _a;
|
|
60
|
-
// Map old enum members to new enum members
|
|
61
|
-
const stringValue = eventType;
|
|
62
|
-
const mapping = {
|
|
63
|
-
// Old string values -> New enum members
|
|
64
|
-
[extraction_1.ExtractorEventType.ExtractionExternalSyncUnitsDone]: extraction_1.ExtractorEventType.ExternalSyncUnitExtractionDone,
|
|
65
|
-
[extraction_1.ExtractorEventType.ExtractionExternalSyncUnitsError]: extraction_1.ExtractorEventType.ExternalSyncUnitExtractionError,
|
|
66
|
-
[extraction_1.ExtractorEventType.ExtractionMetadataDone]: extraction_1.ExtractorEventType.MetadataExtractionDone,
|
|
67
|
-
[extraction_1.ExtractorEventType.ExtractionMetadataError]: extraction_1.ExtractorEventType.MetadataExtractionError,
|
|
68
|
-
[extraction_1.ExtractorEventType.ExtractionDataProgress]: extraction_1.ExtractorEventType.DataExtractionProgress,
|
|
69
|
-
[extraction_1.ExtractorEventType.ExtractionDataDelay]: extraction_1.ExtractorEventType.DataExtractionDelayed,
|
|
70
|
-
[extraction_1.ExtractorEventType.ExtractionDataDone]: extraction_1.ExtractorEventType.DataExtractionDone,
|
|
71
|
-
[extraction_1.ExtractorEventType.ExtractionDataError]: extraction_1.ExtractorEventType.DataExtractionError,
|
|
72
|
-
[extraction_1.ExtractorEventType.ExtractionDataDeleteDone]: extraction_1.ExtractorEventType.ExtractorStateDeletionDone,
|
|
73
|
-
[extraction_1.ExtractorEventType.ExtractionDataDeleteError]: extraction_1.ExtractorEventType.ExtractorStateDeletionError,
|
|
74
|
-
[extraction_1.ExtractorEventType.ExtractionAttachmentsProgress]: extraction_1.ExtractorEventType.AttachmentExtractionProgress,
|
|
75
|
-
[extraction_1.ExtractorEventType.ExtractionAttachmentsDelay]: extraction_1.ExtractorEventType.AttachmentExtractionDelayed,
|
|
76
|
-
[extraction_1.ExtractorEventType.ExtractionAttachmentsDone]: extraction_1.ExtractorEventType.AttachmentExtractionDone,
|
|
77
|
-
[extraction_1.ExtractorEventType.ExtractionAttachmentsError]: extraction_1.ExtractorEventType.AttachmentExtractionError,
|
|
78
|
-
[extraction_1.ExtractorEventType.ExtractionAttachmentsDeleteDone]: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionDone,
|
|
79
|
-
[extraction_1.ExtractorEventType.ExtractionAttachmentsDeleteError]: extraction_1.ExtractorEventType.ExtractorAttachmentsStateDeletionError,
|
|
80
|
-
};
|
|
81
|
-
// If there's a mapping, use it; otherwise return original (already new)
|
|
82
|
-
return (_a = mapping[stringValue]) !== null && _a !== void 0 ? _a : eventType;
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Translates LoaderEventType enum values by converting old enum members to new ones.
|
|
86
|
-
* Old enum members are deprecated and should be replaced with new ones.
|
|
87
|
-
*/
|
|
88
|
-
function translateLoaderEventType(eventType) {
|
|
89
|
-
var _a;
|
|
90
|
-
// Map old enum members to new enum members
|
|
91
|
-
const stringValue = eventType;
|
|
92
|
-
const mapping = {
|
|
93
|
-
// Old string values -> New enum members
|
|
94
|
-
[loading_1.LoaderEventType.DataLoadingDelay]: loading_1.LoaderEventType.DataLoadingDelayed,
|
|
95
|
-
[loading_1.LoaderEventType.AttachmentsLoadingProgress]: loading_1.LoaderEventType.AttachmentLoadingProgress,
|
|
96
|
-
[loading_1.LoaderEventType.AttachmentsLoadingDelayed]: loading_1.LoaderEventType.AttachmentLoadingDelayed,
|
|
97
|
-
[loading_1.LoaderEventType.AttachmentsLoadingDone]: loading_1.LoaderEventType.AttachmentLoadingDone,
|
|
98
|
-
[loading_1.LoaderEventType.AttachmentsLoadingError]: loading_1.LoaderEventType.AttachmentLoadingError,
|
|
99
|
-
};
|
|
100
|
-
// If there's a mapping, use it; otherwise return original (already new)
|
|
101
|
-
return (_a = mapping[stringValue]) !== null && _a !== void 0 ? _a : eventType;
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Translates any outgoing event type (Extractor or Loader) to ensure new event types are used.
|
|
105
|
-
*/
|
|
106
|
-
function translateOutgoingEventType(eventType) {
|
|
107
|
-
// Check if it's an ExtractorEventType by checking if the value exists in ExtractorEventType
|
|
108
|
-
if (Object.values(extraction_1.ExtractorEventType).includes(eventType)) {
|
|
109
|
-
return translateExtractorEventType(eventType);
|
|
110
|
-
}
|
|
111
|
-
// Otherwise treat as LoaderEventType
|
|
112
|
-
if (Object.values(loading_1.LoaderEventType).includes(eventType)) {
|
|
113
|
-
return translateLoaderEventType(eventType);
|
|
114
|
-
}
|
|
115
|
-
// If neither, return as-is
|
|
116
|
-
return eventType;
|
|
117
|
-
}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { AirdropEvent } from '../types/extraction';
|
|
2
|
-
import { InitialDomainMapping } from '../types/common';
|
|
3
|
-
export declare function installInitialDomainMapping(event: AirdropEvent, initialDomainMappingJson: InitialDomainMapping): Promise<void>;
|
|
4
|
-
//# sourceMappingURL=install-initial-domain-mapping.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-initial-domain-mapping.d.ts","sourceRoot":"","sources":["../../src/common/install-initial-domain-mapping.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD,wBAAsB,2BAA2B,CAC/C,KAAK,EAAE,YAAY,EACnB,wBAAwB,EAAE,oBAAoB,GAC7C,OAAO,CAAC,IAAI,CAAC,CA0Ff"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"install-initial-domain-mapping.test.d.ts","sourceRoot":"","sources":["../../src/common/install-initial-domain-mapping.test.ts"],"names":[],"mappings":""}
|