@devrev/airsync-sdk 2.0.0-beta.3 → 2.0.0-beta.5
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/MIGRATION.md +1028 -0
- package/README.md +5 -11
- package/dist/attachments-streaming/attachments-streaming-pool.d.ts +7 -9
- package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts +2 -7
- package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.js +54 -56
- package/dist/common/constants.d.ts +4 -5
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/common/constants.js +6 -7
- package/dist/common/helpers.d.ts +3 -35
- package/dist/common/helpers.d.ts.map +1 -1
- package/dist/common/helpers.js +5 -50
- 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} +4 -8
- package/dist/index.d.ts +24 -13
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +43 -32
- package/dist/logger/logger.d.ts +12 -53
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.interfaces.d.ts +0 -1
- package/dist/logger/logger.interfaces.d.ts.map +1 -1
- package/dist/logger/logger.js +36 -68
- package/dist/mappers/mappers.d.ts +7 -46
- package/dist/mappers/mappers.d.ts.map +1 -1
- package/dist/mappers/mappers.interfaces.d.ts +175 -0
- package/dist/mappers/mappers.interfaces.d.ts.map +1 -0
- package/dist/mappers/{mappers.interface.js → mappers.interfaces.js} +4 -13
- package/dist/mappers/mappers.js +11 -45
- package/dist/multithreading/adapters/base-adapter.d.ts +30 -32
- package/dist/multithreading/adapters/base-adapter.d.ts.map +1 -1
- package/dist/multithreading/adapters/base-adapter.js +97 -62
- package/dist/multithreading/adapters/extraction-adapter.d.ts +16 -29
- package/dist/multithreading/adapters/extraction-adapter.d.ts.map +1 -1
- package/dist/multithreading/adapters/extraction-adapter.js +203 -206
- package/dist/multithreading/adapters/loading-adapter.d.ts +8 -13
- package/dist/multithreading/adapters/loading-adapter.d.ts.map +1 -1
- package/dist/multithreading/adapters/loading-adapter.helpers.d.ts +2 -12
- package/dist/multithreading/adapters/loading-adapter.helpers.d.ts.map +1 -1
- package/dist/multithreading/adapters/loading-adapter.helpers.js +2 -12
- package/dist/multithreading/adapters/loading-adapter.js +294 -346
- package/dist/multithreading/emit.d.ts +11 -0
- package/dist/multithreading/emit.d.ts.map +1 -0
- package/dist/{common/control-protocol.js → multithreading/emit.js} +5 -7
- package/dist/multithreading/process-task.d.ts +2 -12
- package/dist/multithreading/process-task.d.ts.map +1 -1
- package/dist/multithreading/process-task.js +46 -43
- package/dist/multithreading/spawn/spawn.d.ts +3 -9
- 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 +128 -20
- package/dist/multithreading/spawn/spawn.js +24 -39
- package/dist/multithreading/worker.js +1 -4
- package/dist/repo/repo.d.ts +10 -0
- 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 +4 -16
- package/dist/repo/repo.interfaces.d.ts.map +1 -1
- package/dist/repo/repo.js +23 -8
- package/dist/state/base-state.d.ts +16 -38
- package/dist/state/base-state.d.ts.map +1 -1
- package/dist/state/base-state.js +19 -41
- package/dist/state/extraction-state.d.ts +6 -21
- package/dist/state/extraction-state.d.ts.map +1 -1
- package/dist/state/extraction-state.js +8 -25
- package/dist/{common → state}/install-initial-domain-mapping.d.ts +1 -1
- 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 +3 -14
- package/dist/state/loading-state.d.ts.map +1 -1
- package/dist/state/loading-state.js +3 -14
- package/dist/state/state.d.ts +4 -0
- package/dist/state/state.d.ts.map +1 -0
- package/dist/state/state.interfaces.d.ts +33 -37
- package/dist/state/state.interfaces.d.ts.map +1 -1
- package/dist/state/state.interfaces.js +16 -11
- package/dist/state/state.js +11 -0
- package/dist/state/time-value-resolver.d.ts +17 -0
- package/dist/state/time-value-resolver.d.ts.map +1 -0
- package/dist/{common → state}/time-value-resolver.js +9 -41
- package/dist/testing/mock-event.d.ts +10 -0
- package/dist/testing/mock-event.d.ts.map +1 -0
- package/dist/{common/test-utils.js → testing/mock-event.js} +17 -14
- package/dist/testing/mock-server.d.ts +29 -0
- package/dist/testing/mock-server.d.ts.map +1 -0
- package/dist/testing/mock-server.interfaces.d.ts +48 -0
- package/dist/testing/mock-server.interfaces.d.ts.map +1 -0
- package/dist/{mock-server → testing}/mock-server.js +21 -33
- package/dist/types/common.d.ts +1 -12
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +1 -6
- package/dist/types/errors.d.ts +9 -0
- package/dist/types/errors.d.ts.map +1 -0
- package/dist/types/external-domain-metadata.d.ts +30 -171
- package/dist/types/external-domain-metadata.d.ts.map +1 -1
- package/dist/types/extraction.d.ts +64 -94
- package/dist/types/extraction.d.ts.map +1 -1
- package/dist/types/extraction.js +6 -34
- package/dist/types/loading.d.ts +1 -2
- package/dist/types/loading.d.ts.map +1 -1
- package/dist/types/loading.js +0 -1
- package/dist/types/workers.d.ts +39 -94
- package/dist/types/workers.d.ts.map +1 -1
- package/dist/types/workers.js +0 -6
- package/dist/uploader/uploader.d.ts +8 -59
- package/dist/uploader/uploader.d.ts.map +1 -1
- package/dist/uploader/uploader.helpers.d.ts +4 -27
- package/dist/uploader/uploader.helpers.d.ts.map +1 -1
- package/dist/uploader/uploader.helpers.js +64 -30
- package/dist/uploader/uploader.interfaces.d.ts +15 -25
- package/dist/uploader/uploader.interfaces.d.ts.map +1 -1
- package/dist/uploader/uploader.interfaces.js +8 -0
- package/dist/uploader/uploader.js +23 -89
- package/package.json +8 -6
- package/dist/airsync-sdk.d.ts +0 -2059
- 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 -540
- package/dist/common/control-protocol.d.ts +0 -10
- package/dist/common/control-protocol.d.ts.map +0 -1
- package/dist/common/errors.d.ts +0 -6
- package/dist/common/errors.d.ts.map +0 -1
- 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 -211
- package/dist/common/test-utils.d.ts +0 -19
- package/dist/common/test-utils.d.ts.map +0 -1
- package/dist/common/time-value-resolver.d.ts +0 -47
- package/dist/common/time-value-resolver.d.ts.map +0 -1
- package/dist/common/time-value-resolver.test.d.ts +0 -2
- package/dist/common/time-value-resolver.test.d.ts.map +0 -1
- package/dist/common/time-value-resolver.test.js +0 -268
- 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 -175
- 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 -60
- 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 -2
- package/dist/http/index.d.ts.map +0 -1
- package/dist/http/index.js +0 -17
- 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 -537
- 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 -105
- package/dist/mock-server/mock-server.d.ts +0 -47
- package/dist/mock-server/mock-server.d.ts.map +0 -1
- package/dist/mock-server/mock-server.interfaces.d.ts +0 -73
- package/dist/mock-server/mock-server.interfaces.d.ts.map +0 -1
- package/dist/multithreading/adapters/base-adapter.emit.test.d.ts +0 -2
- package/dist/multithreading/adapters/base-adapter.emit.test.d.ts.map +0 -1
- package/dist/multithreading/adapters/base-adapter.emit.test.js +0 -403
- package/dist/multithreading/adapters/extraction-adapter.artifacts.test.d.ts +0 -2
- package/dist/multithreading/adapters/extraction-adapter.artifacts.test.d.ts.map +0 -1
- package/dist/multithreading/adapters/extraction-adapter.artifacts.test.js +0 -175
- package/dist/multithreading/adapters/extraction-adapter.test.d.ts +0 -2
- package/dist/multithreading/adapters/extraction-adapter.test.d.ts.map +0 -1
- package/dist/multithreading/adapters/extraction-adapter.test.js +0 -789
- package/dist/multithreading/adapters/loading-adapter.helpers.test.d.ts +0 -2
- package/dist/multithreading/adapters/loading-adapter.helpers.test.d.ts.map +0 -1
- package/dist/multithreading/adapters/loading-adapter.helpers.test.js +0 -514
- package/dist/multithreading/adapters/loading-adapter.test.d.ts +0 -2
- package/dist/multithreading/adapters/loading-adapter.test.d.ts.map +0 -1
- package/dist/multithreading/adapters/loading-adapter.test.js +0 -589
- package/dist/multithreading/adapters/serialization.test.d.ts +0 -2
- package/dist/multithreading/adapters/serialization.test.d.ts.map +0 -1
- package/dist/multithreading/adapters/serialization.test.js +0 -71
- 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 -108
- package/dist/multithreading/process-task.test.d.ts +0 -2
- package/dist/multithreading/process-task.test.d.ts.map +0 -1
- package/dist/multithreading/process-task.test.js +0 -146
- 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/spawn/spawn.test.d.ts +0 -2
- package/dist/multithreading/spawn/spawn.test.d.ts.map +0 -1
- package/dist/multithreading/spawn/spawn.test.js +0 -232
- 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 -184
- package/dist/state/state.extract-window.test.d.ts +0 -2
- package/dist/state/state.extract-window.test.d.ts.map +0 -1
- package/dist/state/state.extract-window.test.js +0 -163
- package/dist/state/state.pending-boundaries.test.d.ts +0 -2
- package/dist/state/state.pending-boundaries.test.d.ts.map +0 -1
- package/dist/state/state.pending-boundaries.test.js +0 -189
- package/dist/state/state.post-state.test.d.ts +0 -2
- package/dist/state/state.post-state.test.d.ts.map +0 -1
- package/dist/state/state.post-state.test.js +0 -78
- 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 -271
- package/dist/state/state.time-value-resolution.test.d.ts +0 -2
- package/dist/state/state.time-value-resolution.test.d.ts.map +0 -1
- package/dist/state/state.time-value-resolution.test.js +0 -175
- package/dist/tsdoc-metadata.json +0 -11
- 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 -96
- package/dist/types/index.d.ts +0 -10
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -21
- 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 -256
- 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 -601
- /package/dist/{mock-server → testing}/mock-server.interfaces.js +0 -0
- /package/dist/{common → types}/errors.js +0 -0
|
@@ -6,19 +6,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.LoadingAdapter = void 0;
|
|
7
7
|
const axios_1 = __importDefault(require("axios"));
|
|
8
8
|
const logger_1 = require("../../logger/logger");
|
|
9
|
-
const logger_context_1 = require("../../logger/logger.context");
|
|
10
9
|
const mappers_1 = require("../../mappers/mappers");
|
|
11
|
-
const
|
|
10
|
+
const mappers_interfaces_1 = require("../../mappers/mappers.interfaces");
|
|
12
11
|
const extraction_1 = require("../../types/extraction");
|
|
13
12
|
const loading_1 = require("../../types/loading");
|
|
14
13
|
const base_adapter_1 = require("./base-adapter");
|
|
15
14
|
const loading_adapter_helpers_1 = require("./loading-adapter.helpers");
|
|
16
|
-
/**
|
|
17
|
-
* LoadingAdapter is the adapter passed to loading tasks. It exposes the loading
|
|
18
|
-
* surface (item/attachment loading, mappers, loader reports).
|
|
19
|
-
*
|
|
20
|
-
* @public
|
|
21
|
-
*/
|
|
15
|
+
/** Adapter passed to loading tasks (item/attachment loading, mappers, loader reports). @public */
|
|
22
16
|
class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
23
17
|
constructor(params) {
|
|
24
18
|
super(params);
|
|
@@ -39,7 +33,7 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
39
33
|
return this._mappers;
|
|
40
34
|
}
|
|
41
35
|
async beforeEmit() {
|
|
42
|
-
// Loading has no pre-emit work
|
|
36
|
+
// Loading has no pre-emit work.
|
|
43
37
|
}
|
|
44
38
|
buildEmitPayload(newEventType) {
|
|
45
39
|
const isLoaderEvent = Object.values(loading_1.LoaderEventType).includes(newEventType);
|
|
@@ -54,408 +48,362 @@ class LoadingAdapter extends base_adapter_1.BaseAdapter {
|
|
|
54
48
|
// Loading keeps its accumulated reports/processed files across emits.
|
|
55
49
|
}
|
|
56
50
|
async loadItemTypes({ itemTypesToLoad, }) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
51
|
+
var _a;
|
|
52
|
+
if (this.event.payload.event_type === extraction_1.EventType.StartLoadingData) {
|
|
53
|
+
const itemTypes = itemTypesToLoad.map((itemTypeToLoad) => itemTypeToLoad.itemType);
|
|
54
|
+
if (!itemTypes.length) {
|
|
55
|
+
console.warn('No item types to load, returning.');
|
|
56
|
+
return { status: 'success' };
|
|
57
|
+
}
|
|
58
|
+
const filesToLoad = await this.getLoaderBatches({
|
|
59
|
+
supportedItemTypes: itemTypes,
|
|
60
|
+
});
|
|
61
|
+
this.sdkState.fromDevRev = {
|
|
62
|
+
filesToLoad,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (!this.sdkState.fromDevRev ||
|
|
66
|
+
!this.sdkState.fromDevRev.filesToLoad.length) {
|
|
67
|
+
console.warn('No files to load, returning.');
|
|
68
|
+
return { status: 'success' };
|
|
69
|
+
}
|
|
70
|
+
console.log('Files to load in state', (_a = this.sdkState.fromDevRev) === null || _a === void 0 ? void 0 : _a.filesToLoad);
|
|
71
|
+
try {
|
|
72
|
+
for (const fileToLoad of this.sdkState.fromDevRev.filesToLoad) {
|
|
73
|
+
const itemTypeToLoad = itemTypesToLoad.find((itemTypeToLoad) => itemTypeToLoad.itemType === fileToLoad.itemType);
|
|
74
|
+
if (!itemTypeToLoad) {
|
|
75
|
+
console.error(`Item type to load not found for item type: ${fileToLoad.itemType}.`);
|
|
63
76
|
return {
|
|
64
|
-
|
|
65
|
-
|
|
77
|
+
status: 'error',
|
|
78
|
+
error: {
|
|
79
|
+
message: `Item type to load not found for item type: ${fileToLoad.itemType}.`,
|
|
80
|
+
},
|
|
66
81
|
};
|
|
67
82
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
console.warn('No files to load, returning.');
|
|
78
|
-
return {
|
|
79
|
-
reports: this.reports,
|
|
80
|
-
processed_files: this.processedFiles,
|
|
81
|
-
};
|
|
82
|
-
}
|
|
83
|
-
console.log('Files to load in state', (_a = this.adapterState.sdkState.fromDevRev) === null || _a === void 0 ? void 0 : _a.filesToLoad);
|
|
84
|
-
try {
|
|
85
|
-
outerloop: for (const fileToLoad of this.adapterState.sdkState
|
|
86
|
-
.fromDevRev.filesToLoad) {
|
|
87
|
-
const itemTypeToLoad = itemTypesToLoad.find((itemTypeToLoad) => itemTypeToLoad.itemType === fileToLoad.itemType);
|
|
88
|
-
if (!itemTypeToLoad) {
|
|
89
|
-
console.error(`Item type to load not found for item type: ${fileToLoad.itemType}.`);
|
|
90
|
-
await this.emit(loading_1.LoaderEventType.DataLoadingError, {
|
|
83
|
+
if (!fileToLoad.completed) {
|
|
84
|
+
const { response, error: transformerFileError } = await this.uploader.getJsonObjectByArtifactId({
|
|
85
|
+
artifactId: fileToLoad.id,
|
|
86
|
+
isGzipped: true,
|
|
87
|
+
});
|
|
88
|
+
if (transformerFileError) {
|
|
89
|
+
console.error(`Transformer file not found for artifact ID: ${fileToLoad.id}.`);
|
|
90
|
+
return {
|
|
91
|
+
status: 'error',
|
|
91
92
|
error: {
|
|
92
|
-
message: `
|
|
93
|
+
message: `Transformer file not found for artifact ID: ${fileToLoad.id}.`,
|
|
93
94
|
},
|
|
94
|
-
}
|
|
95
|
-
break;
|
|
95
|
+
};
|
|
96
96
|
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
const transformerFile = response;
|
|
98
|
+
for (let i = fileToLoad.lineToProcess; i < fileToLoad.count; i++) {
|
|
99
|
+
if (this.isTimeout) {
|
|
100
|
+
console.log('Timeout detected during data loading. Returning progress to allow continuation.');
|
|
101
|
+
return { status: 'progress' };
|
|
102
|
+
}
|
|
103
|
+
const { report, rateLimit } = await this.loadItem({
|
|
104
|
+
item: transformerFile[i],
|
|
105
|
+
itemTypeToLoad,
|
|
101
106
|
});
|
|
102
|
-
if (
|
|
103
|
-
|
|
104
|
-
await this.emit(loading_1.LoaderEventType.DataLoadingError, {
|
|
105
|
-
error: {
|
|
106
|
-
message: `Transformer file not found for artifact ID: ${fileToLoad.id}.`,
|
|
107
|
-
},
|
|
108
|
-
});
|
|
109
|
-
break outerloop;
|
|
107
|
+
if (rateLimit === null || rateLimit === void 0 ? void 0 : rateLimit.delay) {
|
|
108
|
+
return { status: 'delay', delaySeconds: rateLimit.delay };
|
|
110
109
|
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
await this.emit(loading_1.LoaderEventType.DataLoadingProgress);
|
|
116
|
-
process.exit(0);
|
|
117
|
-
}
|
|
118
|
-
const { report, rateLimit } = await this.loadItem({
|
|
119
|
-
item: transformerFile[i],
|
|
120
|
-
itemTypeToLoad,
|
|
110
|
+
if (report) {
|
|
111
|
+
(0, loading_adapter_helpers_1.addReportToLoaderReport)({
|
|
112
|
+
loaderReports: this.loaderReports,
|
|
113
|
+
report,
|
|
121
114
|
});
|
|
122
|
-
|
|
123
|
-
await this.emit(loading_1.LoaderEventType.DataLoadingDelayed, {
|
|
124
|
-
delay: rateLimit.delay,
|
|
125
|
-
reports: this.reports,
|
|
126
|
-
processed_files: this.processedFiles,
|
|
127
|
-
});
|
|
128
|
-
break outerloop;
|
|
129
|
-
}
|
|
130
|
-
if (report) {
|
|
131
|
-
(0, loading_adapter_helpers_1.addReportToLoaderReport)({
|
|
132
|
-
loaderReports: this.loaderReports,
|
|
133
|
-
report,
|
|
134
|
-
});
|
|
135
|
-
fileToLoad.lineToProcess = fileToLoad.lineToProcess + 1;
|
|
136
|
-
}
|
|
115
|
+
fileToLoad.lineToProcess = fileToLoad.lineToProcess + 1;
|
|
137
116
|
}
|
|
138
|
-
fileToLoad.completed = true;
|
|
139
|
-
this._processedFiles.push(fileToLoad.id);
|
|
140
117
|
}
|
|
118
|
+
fileToLoad.completed = true;
|
|
119
|
+
this._processedFiles.push(fileToLoad.id);
|
|
141
120
|
}
|
|
142
121
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
error: {
|
|
147
|
-
message: `Error during data loading. ${(0, logger_1.serializeError)(error)}`,
|
|
148
|
-
},
|
|
149
|
-
});
|
|
150
|
-
process.exit(1);
|
|
151
|
-
}
|
|
122
|
+
}
|
|
123
|
+
catch (error) {
|
|
124
|
+
console.error('Error during data loading.', (0, logger_1.serializeError)(error));
|
|
152
125
|
return {
|
|
153
|
-
|
|
154
|
-
|
|
126
|
+
status: 'error',
|
|
127
|
+
error: {
|
|
128
|
+
message: `Error during data loading. ${(0, logger_1.serializeError)(error)}`,
|
|
129
|
+
},
|
|
155
130
|
};
|
|
156
|
-
}
|
|
131
|
+
}
|
|
132
|
+
return { status: 'success' };
|
|
157
133
|
}
|
|
158
134
|
async getLoaderBatches({ supportedItemTypes, }) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
return [];
|
|
169
|
-
}
|
|
170
|
-
const filesToLoad = (0, loading_adapter_helpers_1.getFilesToLoad)({
|
|
171
|
-
supportedItemTypes,
|
|
172
|
-
statsFile,
|
|
173
|
-
});
|
|
174
|
-
return filesToLoad;
|
|
135
|
+
var _a;
|
|
136
|
+
const statsFileArtifactId = (_a = this.event.payload.event_data) === null || _a === void 0 ? void 0 : _a.stats_file;
|
|
137
|
+
if (statsFileArtifactId) {
|
|
138
|
+
const { response, error: statsFileError } = await this.uploader.getJsonObjectByArtifactId({
|
|
139
|
+
artifactId: statsFileArtifactId,
|
|
140
|
+
});
|
|
141
|
+
const statsFile = response;
|
|
142
|
+
if (statsFileError || statsFile.length === 0) {
|
|
143
|
+
return [];
|
|
175
144
|
}
|
|
176
|
-
|
|
177
|
-
|
|
145
|
+
const filesToLoad = (0, loading_adapter_helpers_1.getFilesToLoad)({
|
|
146
|
+
supportedItemTypes,
|
|
147
|
+
statsFile,
|
|
148
|
+
});
|
|
149
|
+
return filesToLoad;
|
|
150
|
+
}
|
|
151
|
+
return [];
|
|
178
152
|
}
|
|
179
153
|
async loadAttachments({ create, }) {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
this.
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
154
|
+
var _a, _b;
|
|
155
|
+
if (this.event.payload.event_type === extraction_1.EventType.StartLoadingAttachments) {
|
|
156
|
+
this.sdkState.fromDevRev = {
|
|
157
|
+
filesToLoad: await this.getLoaderBatches({
|
|
158
|
+
supportedItemTypes: ['attachment'],
|
|
159
|
+
}),
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
if (!this.sdkState.fromDevRev ||
|
|
163
|
+
((_a = this.sdkState.fromDevRev) === null || _a === void 0 ? void 0 : _a.filesToLoad.length) === 0) {
|
|
164
|
+
console.log('No files to load, returning.');
|
|
165
|
+
return { status: 'success' };
|
|
166
|
+
}
|
|
167
|
+
const filesToLoad = (_b = this.sdkState.fromDevRev) === null || _b === void 0 ? void 0 : _b.filesToLoad;
|
|
168
|
+
try {
|
|
169
|
+
for (const fileToLoad of filesToLoad) {
|
|
170
|
+
if (!fileToLoad.completed) {
|
|
171
|
+
const { response, error: transformerFileError } = await this.uploader.getJsonObjectByArtifactId({
|
|
172
|
+
artifactId: fileToLoad.id,
|
|
173
|
+
isGzipped: true,
|
|
174
|
+
});
|
|
175
|
+
const transformerFile = response;
|
|
176
|
+
if (transformerFileError) {
|
|
177
|
+
console.error(`Transformer file not found for artifact ID: ${fileToLoad.id}.`);
|
|
178
|
+
return {
|
|
179
|
+
status: 'error',
|
|
180
|
+
error: {
|
|
181
|
+
message: `Transformer file not found for artifact ID: ${fileToLoad.id}.`,
|
|
182
|
+
},
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
for (let i = fileToLoad.lineToProcess; i < fileToLoad.count; i++) {
|
|
186
|
+
if (this.isTimeout) {
|
|
187
|
+
console.log('Timeout detected during attachment loading. Returning progress to allow continuation.');
|
|
188
|
+
return { status: 'progress' };
|
|
189
|
+
}
|
|
190
|
+
const { report, rateLimit } = await this.loadAttachment({
|
|
191
|
+
item: transformerFile[i],
|
|
192
|
+
create,
|
|
204
193
|
});
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
console.error(`Transformer file not found for artifact ID: ${fileToLoad.id}.`);
|
|
208
|
-
await this.emit(loading_1.LoaderEventType.AttachmentLoadingError, {
|
|
209
|
-
error: {
|
|
210
|
-
message: `Transformer file not found for artifact ID: ${fileToLoad.id}.`,
|
|
211
|
-
},
|
|
212
|
-
});
|
|
213
|
-
break outerloop;
|
|
194
|
+
if (rateLimit === null || rateLimit === void 0 ? void 0 : rateLimit.delay) {
|
|
195
|
+
return { status: 'delay', delaySeconds: rateLimit.delay };
|
|
214
196
|
}
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
process.exit(0);
|
|
220
|
-
}
|
|
221
|
-
const { report, rateLimit } = await this.loadAttachment({
|
|
222
|
-
item: transformerFile[i],
|
|
223
|
-
create,
|
|
197
|
+
if (report) {
|
|
198
|
+
(0, loading_adapter_helpers_1.addReportToLoaderReport)({
|
|
199
|
+
loaderReports: this.loaderReports,
|
|
200
|
+
report,
|
|
224
201
|
});
|
|
225
|
-
|
|
226
|
-
await this.emit(loading_1.LoaderEventType.AttachmentLoadingDelayed, {
|
|
227
|
-
delay: rateLimit.delay,
|
|
228
|
-
reports: this.reports,
|
|
229
|
-
processed_files: this.processedFiles,
|
|
230
|
-
});
|
|
231
|
-
break outerloop;
|
|
232
|
-
}
|
|
233
|
-
if (report) {
|
|
234
|
-
(0, loading_adapter_helpers_1.addReportToLoaderReport)({
|
|
235
|
-
loaderReports: this.loaderReports,
|
|
236
|
-
report,
|
|
237
|
-
});
|
|
238
|
-
fileToLoad.lineToProcess = fileToLoad.lineToProcess + 1;
|
|
239
|
-
}
|
|
202
|
+
fileToLoad.lineToProcess = fileToLoad.lineToProcess + 1;
|
|
240
203
|
}
|
|
241
|
-
fileToLoad.completed = true;
|
|
242
|
-
this._processedFiles.push(fileToLoad.id);
|
|
243
204
|
}
|
|
205
|
+
fileToLoad.completed = true;
|
|
206
|
+
this._processedFiles.push(fileToLoad.id);
|
|
244
207
|
}
|
|
245
208
|
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
error: {
|
|
250
|
-
message: `Error during attachment loading. ${(0, logger_1.serializeError)(error)}`,
|
|
251
|
-
},
|
|
252
|
-
});
|
|
253
|
-
process.exit(1);
|
|
254
|
-
}
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
console.error('Error during attachment loading.', (0, logger_1.serializeError)(error));
|
|
255
212
|
return {
|
|
256
|
-
|
|
257
|
-
|
|
213
|
+
status: 'error',
|
|
214
|
+
error: {
|
|
215
|
+
message: `Error during attachment loading. ${(0, logger_1.serializeError)(error)}`,
|
|
216
|
+
},
|
|
258
217
|
};
|
|
259
|
-
}
|
|
218
|
+
}
|
|
219
|
+
return { status: 'success' };
|
|
260
220
|
}
|
|
261
221
|
async loadItem({ item, itemTypeToLoad, }) {
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
222
|
+
var _a;
|
|
223
|
+
const devrevId = item.id.devrev;
|
|
224
|
+
try {
|
|
225
|
+
const syncMapperRecord = await this._mappers.getByTargetId({
|
|
226
|
+
sync_unit: this.event.payload.event_context.sync_unit,
|
|
227
|
+
target: devrevId,
|
|
228
|
+
});
|
|
229
|
+
if (!syncMapperRecord) {
|
|
230
|
+
console.warn('Failed to get sync mapper record from response.');
|
|
231
|
+
return {
|
|
232
|
+
error: {
|
|
233
|
+
message: 'Failed to get sync mapper record from response.',
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
const { id, modifiedDate, delay, error } = await itemTypeToLoad.update({
|
|
238
|
+
item,
|
|
239
|
+
mappers: this._mappers,
|
|
240
|
+
event: this.event,
|
|
241
|
+
});
|
|
242
|
+
if (id) {
|
|
243
|
+
try {
|
|
244
|
+
const syncMapperRecordUpdate = await this._mappers.update(Object.assign(Object.assign({ id: syncMapperRecord.sync_mapper_record.id, sync_unit: this.event.payload.event_context.sync_unit, status: mappers_interfaces_1.SyncMapperRecordStatus.OPERATIONAL }, (modifiedDate && {
|
|
245
|
+
external_versions: {
|
|
246
|
+
add: [
|
|
247
|
+
{
|
|
248
|
+
modified_date: modifiedDate,
|
|
249
|
+
recipe_version: 0,
|
|
250
|
+
},
|
|
251
|
+
],
|
|
252
|
+
},
|
|
253
|
+
})), { external_ids: {
|
|
254
|
+
add: [id],
|
|
255
|
+
}, targets: {
|
|
256
|
+
add: [devrevId],
|
|
257
|
+
} }));
|
|
258
|
+
console.log('Successfully updated sync mapper record.', syncMapperRecordUpdate);
|
|
259
|
+
}
|
|
260
|
+
catch (error) {
|
|
261
|
+
console.warn('Failed to update sync mapper record.', (0, logger_1.serializeError)(error));
|
|
273
262
|
return {
|
|
274
263
|
error: {
|
|
275
|
-
message: 'Failed to
|
|
264
|
+
message: 'Failed to update sync mapper record' + (0, logger_1.serializeError)(error),
|
|
276
265
|
},
|
|
277
266
|
};
|
|
278
267
|
}
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
268
|
+
return {
|
|
269
|
+
report: {
|
|
270
|
+
item_type: itemTypeToLoad.itemType,
|
|
271
|
+
[loading_1.ActionType.UPDATED]: 1,
|
|
272
|
+
},
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
else if (delay) {
|
|
276
|
+
console.log(`Rate limited while updating item in external system, delaying for ${delay} seconds.`);
|
|
277
|
+
return {
|
|
278
|
+
rateLimit: {
|
|
279
|
+
delay,
|
|
280
|
+
},
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
else {
|
|
284
|
+
console.warn('Failed to update item in external system', error);
|
|
285
|
+
return {
|
|
286
|
+
report: {
|
|
287
|
+
item_type: itemTypeToLoad.itemType,
|
|
288
|
+
[loading_1.ActionType.FAILED]: 1,
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
// TODO: Update mapper (optional)
|
|
293
|
+
}
|
|
294
|
+
catch (error) {
|
|
295
|
+
if (axios_1.default.isAxiosError(error)) {
|
|
296
|
+
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
297
|
+
// Create item in external system if mapper record not found
|
|
298
|
+
const { id, modifiedDate, delay, error } = await itemTypeToLoad.create({
|
|
282
299
|
item,
|
|
283
300
|
mappers: this._mappers,
|
|
284
301
|
event: this.event,
|
|
285
302
|
});
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
external_versions: {
|
|
291
|
-
add: [
|
|
303
|
+
if (id) {
|
|
304
|
+
try {
|
|
305
|
+
const syncMapperRecordCreate = await this._mappers.create(Object.assign({ sync_unit: this.event.payload.event_context.sync_unit, status: mappers_interfaces_1.SyncMapperRecordStatus.OPERATIONAL, external_ids: [id], targets: [devrevId] }, (modifiedDate && {
|
|
306
|
+
external_versions: [
|
|
292
307
|
{
|
|
293
308
|
modified_date: modifiedDate,
|
|
294
309
|
recipe_version: 0,
|
|
295
310
|
},
|
|
296
311
|
],
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
add: [id],
|
|
300
|
-
}, targets: {
|
|
301
|
-
add: [devrevId],
|
|
302
|
-
} }));
|
|
303
|
-
console.log('Successfully updated sync mapper record.', syncMapperRecordUpdateResponse.data);
|
|
304
|
-
}
|
|
305
|
-
catch (error) {
|
|
306
|
-
console.warn('Failed to update sync mapper record.', (0, logger_1.serializeError)(error));
|
|
307
|
-
return {
|
|
308
|
-
error: {
|
|
309
|
-
message: 'Failed to update sync mapper record' + (0, logger_1.serializeError)(error),
|
|
310
|
-
},
|
|
311
|
-
};
|
|
312
|
-
}
|
|
313
|
-
return {
|
|
314
|
-
report: {
|
|
315
|
-
item_type: itemTypeToLoad.itemType,
|
|
316
|
-
[loading_1.ActionType.UPDATED]: 1,
|
|
317
|
-
},
|
|
318
|
-
};
|
|
319
|
-
}
|
|
320
|
-
else if (delay) {
|
|
321
|
-
console.log(`Rate limited while updating item in external system, delaying for ${delay} seconds.`);
|
|
322
|
-
return {
|
|
323
|
-
rateLimit: {
|
|
324
|
-
delay,
|
|
325
|
-
},
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
else {
|
|
329
|
-
console.warn('Failed to update item in external system', error);
|
|
330
|
-
return {
|
|
331
|
-
report: {
|
|
332
|
-
item_type: itemTypeToLoad.itemType,
|
|
333
|
-
[loading_1.ActionType.FAILED]: 1,
|
|
334
|
-
},
|
|
335
|
-
};
|
|
336
|
-
}
|
|
337
|
-
// TODO: Update mapper (optional)
|
|
338
|
-
}
|
|
339
|
-
catch (error) {
|
|
340
|
-
if (axios_1.default.isAxiosError(error)) {
|
|
341
|
-
if (((_a = error.response) === null || _a === void 0 ? void 0 : _a.status) === 404) {
|
|
342
|
-
// Create item in external system if mapper record not found
|
|
343
|
-
const { id, modifiedDate, delay, error } = await (0, logger_context_1.runWithUserLogContext)(async () => {
|
|
344
|
-
return await itemTypeToLoad.create({
|
|
345
|
-
item,
|
|
346
|
-
mappers: this._mappers,
|
|
347
|
-
event: this.event,
|
|
348
|
-
});
|
|
349
|
-
});
|
|
350
|
-
if (id) {
|
|
351
|
-
// Create mapper
|
|
352
|
-
try {
|
|
353
|
-
const syncMapperRecordCreateResponse = await this._mappers.create(Object.assign({ sync_unit: this.event.payload.event_context.sync_unit, status: mappers_interface_1.SyncMapperRecordStatus.OPERATIONAL, external_ids: [id], targets: [devrevId] }, (modifiedDate && {
|
|
354
|
-
external_versions: [
|
|
355
|
-
{
|
|
356
|
-
modified_date: modifiedDate,
|
|
357
|
-
recipe_version: 0,
|
|
358
|
-
},
|
|
359
|
-
],
|
|
360
|
-
})));
|
|
361
|
-
console.log('Successfully created sync mapper record.', syncMapperRecordCreateResponse.data);
|
|
362
|
-
return {
|
|
363
|
-
report: {
|
|
364
|
-
item_type: itemTypeToLoad.itemType,
|
|
365
|
-
[loading_1.ActionType.CREATED]: 1,
|
|
366
|
-
},
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
catch (error) {
|
|
370
|
-
console.warn('Failed to create sync mapper record.', (0, logger_1.serializeError)(error));
|
|
371
|
-
return {
|
|
372
|
-
error: {
|
|
373
|
-
message: 'Failed to create sync mapper record. ' +
|
|
374
|
-
(0, logger_1.serializeError)(error),
|
|
375
|
-
},
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
else if (delay) {
|
|
312
|
+
})));
|
|
313
|
+
console.log('Successfully created sync mapper record.', syncMapperRecordCreate);
|
|
380
314
|
return {
|
|
381
|
-
|
|
382
|
-
|
|
315
|
+
report: {
|
|
316
|
+
item_type: itemTypeToLoad.itemType,
|
|
317
|
+
[loading_1.ActionType.CREATED]: 1,
|
|
383
318
|
},
|
|
384
319
|
};
|
|
385
320
|
}
|
|
386
|
-
|
|
387
|
-
console.warn('Failed to create
|
|
321
|
+
catch (error) {
|
|
322
|
+
console.warn('Failed to create sync mapper record.', (0, logger_1.serializeError)(error));
|
|
388
323
|
return {
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
324
|
+
error: {
|
|
325
|
+
message: 'Failed to create sync mapper record. ' +
|
|
326
|
+
(0, logger_1.serializeError)(error),
|
|
392
327
|
},
|
|
393
328
|
};
|
|
394
329
|
}
|
|
395
330
|
}
|
|
331
|
+
else if (delay) {
|
|
332
|
+
return {
|
|
333
|
+
rateLimit: {
|
|
334
|
+
delay,
|
|
335
|
+
},
|
|
336
|
+
};
|
|
337
|
+
}
|
|
396
338
|
else {
|
|
397
|
-
console.warn('Failed to
|
|
339
|
+
console.warn('Failed to create item in external system.', (0, logger_1.serializeError)(error));
|
|
398
340
|
return {
|
|
399
|
-
|
|
400
|
-
|
|
341
|
+
report: {
|
|
342
|
+
item_type: itemTypeToLoad.itemType,
|
|
343
|
+
[loading_1.ActionType.FAILED]: 1,
|
|
401
344
|
},
|
|
402
345
|
};
|
|
403
346
|
}
|
|
404
347
|
}
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
348
|
+
else {
|
|
349
|
+
console.warn('Failed to get sync mapper record.', (0, logger_1.serializeError)(error));
|
|
350
|
+
return {
|
|
351
|
+
error: {
|
|
352
|
+
message: error.message,
|
|
353
|
+
},
|
|
354
|
+
};
|
|
355
|
+
}
|
|
411
356
|
}
|
|
412
|
-
|
|
357
|
+
console.warn('Failed to get sync mapper record.', (0, logger_1.serializeError)(error));
|
|
358
|
+
return {
|
|
359
|
+
error: {
|
|
360
|
+
message: 'Failed to get sync mapper record. ' + (0, logger_1.serializeError)(error),
|
|
361
|
+
},
|
|
362
|
+
};
|
|
363
|
+
}
|
|
413
364
|
}
|
|
414
365
|
async loadAttachment({ item, create, }) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
});
|
|
437
|
-
console.log('Successfully created sync mapper record.', syncMapperRecordCreateResponse.data);
|
|
438
|
-
}
|
|
439
|
-
catch (error) {
|
|
440
|
-
console.warn('Failed to create sync mapper record.', (0, logger_1.serializeError)(error));
|
|
441
|
-
}
|
|
442
|
-
return {
|
|
443
|
-
report: {
|
|
444
|
-
item_type: 'attachment',
|
|
445
|
-
[loading_1.ActionType.CREATED]: 1,
|
|
446
|
-
},
|
|
447
|
-
};
|
|
366
|
+
const { id, delay, error } = await create({
|
|
367
|
+
item,
|
|
368
|
+
mappers: this._mappers,
|
|
369
|
+
event: this.event,
|
|
370
|
+
});
|
|
371
|
+
if (delay) {
|
|
372
|
+
return {
|
|
373
|
+
rateLimit: {
|
|
374
|
+
delay,
|
|
375
|
+
},
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
else if (id) {
|
|
379
|
+
try {
|
|
380
|
+
const syncMapperRecordCreate = await this._mappers.create({
|
|
381
|
+
sync_unit: this.event.payload.event_context.sync_unit,
|
|
382
|
+
external_ids: [id],
|
|
383
|
+
targets: [item.reference_id],
|
|
384
|
+
status: mappers_interfaces_1.SyncMapperRecordStatus.OPERATIONAL,
|
|
385
|
+
});
|
|
386
|
+
console.log('Successfully created sync mapper record.', syncMapperRecordCreate);
|
|
448
387
|
}
|
|
449
|
-
|
|
450
|
-
console.warn('Failed to create
|
|
451
|
-
return {
|
|
452
|
-
report: {
|
|
453
|
-
item_type: 'attachment',
|
|
454
|
-
[loading_1.ActionType.FAILED]: 1,
|
|
455
|
-
},
|
|
456
|
-
};
|
|
388
|
+
catch (error) {
|
|
389
|
+
console.warn('Failed to create sync mapper record.', (0, logger_1.serializeError)(error));
|
|
457
390
|
}
|
|
458
|
-
|
|
391
|
+
return {
|
|
392
|
+
report: {
|
|
393
|
+
item_type: 'attachments',
|
|
394
|
+
[loading_1.ActionType.CREATED]: 1,
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
console.warn('Failed to create attachment in external system', error);
|
|
400
|
+
return {
|
|
401
|
+
report: {
|
|
402
|
+
item_type: 'attachments',
|
|
403
|
+
[loading_1.ActionType.FAILED]: 1,
|
|
404
|
+
},
|
|
405
|
+
};
|
|
406
|
+
}
|
|
459
407
|
}
|
|
460
408
|
}
|
|
461
409
|
exports.LoadingAdapter = LoadingAdapter;
|