@devrev/airsync-sdk 2.0.0-beta.0 → 2.0.0-beta.1
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/dist/attachments-streaming/attachments-streaming-pool.d.ts +7 -0
- package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.js +31 -2
- package/dist/attachments-streaming/attachments-streaming-pool.test.js +58 -4
- package/dist/common/install-initial-domain-mapping.test.js +2 -1
- package/dist/http/axios-client-internal.test.js +6 -6
- package/dist/multithreading/process-task.d.ts.map +1 -1
- package/dist/multithreading/process-task.js +77 -42
- package/dist/multithreading/spawn/spawn.d.ts +1 -0
- package/dist/multithreading/spawn/spawn.d.ts.map +1 -1
- package/dist/multithreading/spawn/spawn.js +21 -6
- package/dist/multithreading/worker-adapter/worker-adapter.d.ts.map +1 -1
- package/dist/multithreading/worker-adapter/worker-adapter.js +1 -3
- package/dist/state/state.interfaces.d.ts +8 -1
- package/dist/state/state.interfaces.d.ts.map +1 -1
- package/dist/types/external-domain-metadata.d.ts +319 -0
- package/dist/types/external-domain-metadata.d.ts.map +1 -0
- package/dist/types/external-domain-metadata.js +2 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +9 -5
|
@@ -10,6 +10,13 @@ export declare class AttachmentsStreamingPool<ConnectorState> {
|
|
|
10
10
|
private readonly PROGRESS_REPORT_INTERVAL;
|
|
11
11
|
constructor({ adapter, attachments, batchSize, stream, }: AttachmentsStreamingPoolParams<ConnectorState>);
|
|
12
12
|
private updateProgress;
|
|
13
|
+
/**
|
|
14
|
+
* Migrates processed attachments from the legacy string[] format to the new ProcessedAttachment[] format.
|
|
15
|
+
*
|
|
16
|
+
* @param attachments - The attachments list to migrate (either string[] or ProcessedAttachment[])
|
|
17
|
+
* @returns Migrated array of ProcessedAttachment objects, or empty array if input is invalid
|
|
18
|
+
*/
|
|
19
|
+
private migrateProcessedAttachments;
|
|
13
20
|
streamAll(): Promise<ProcessAttachmentReturnType>;
|
|
14
21
|
startPoolStreaming(): Promise<void>;
|
|
15
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attachments-streaming-pool.d.ts","sourceRoot":"","sources":["../../src/attachments-streaming/attachments-streaming-pool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"attachments-streaming-pool.d.ts","sourceRoot":"","sources":["../../src/attachments-streaming/attachments-streaming-pool.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,2BAA2B,EAC5B,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAGzF,qBAAa,wBAAwB,CAAC,cAAc;IAClD,OAAO,CAAC,OAAO,CAAgC;IAC/C,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,KAAK,CAAqB;IAClC,OAAO,CAAC,MAAM,CAA4C;IAE1D,OAAO,CAAC,mBAAmB,CAAa;IACxC,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAM;gBAEnC,EACV,OAAO,EACP,WAAW,EACX,SAAc,EACd,MAAM,GACP,EAAE,8BAA8B,CAAC,cAAc,CAAC;YAQnC,cAAc;IAS5B;;;;;OAKG;IAEH,OAAO,CAAC,2BAA2B;IAsB7B,SAAS,IAAI,OAAO,CAAC,2BAA2B,CAAC;IA8CjD,kBAAkB;CA0EzB"}
|
|
@@ -20,6 +20,31 @@ class AttachmentsStreamingPool {
|
|
|
20
20
|
await (0, helpers_1.sleep)(100);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Migrates processed attachments from the legacy string[] format to the new ProcessedAttachment[] format.
|
|
25
|
+
*
|
|
26
|
+
* @param attachments - The attachments list to migrate (either string[] or ProcessedAttachment[])
|
|
27
|
+
* @returns Migrated array of ProcessedAttachment objects, or empty array if input is invalid
|
|
28
|
+
*/
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
30
|
+
migrateProcessedAttachments(attachments) {
|
|
31
|
+
// Handle null/undefined
|
|
32
|
+
if (!attachments || !Array.isArray(attachments)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
// If already migrated (first element is an object), return as-is
|
|
36
|
+
if (attachments.length > 0 && typeof attachments[0] === 'object') {
|
|
37
|
+
return attachments;
|
|
38
|
+
}
|
|
39
|
+
// Migrate old string[] format
|
|
40
|
+
if (attachments.length > 0 && typeof attachments[0] === 'string') {
|
|
41
|
+
return attachments.map((it) => ({
|
|
42
|
+
id: it,
|
|
43
|
+
parent_id: '',
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
23
48
|
async streamAll() {
|
|
24
49
|
console.log(`Starting download of ${this.attachments.length} attachments, streaming ${this.batchSize} at once.`);
|
|
25
50
|
if (!this.adapter.state.toDevRev) {
|
|
@@ -34,6 +59,10 @@ class AttachmentsStreamingPool {
|
|
|
34
59
|
this.adapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList =
|
|
35
60
|
[];
|
|
36
61
|
}
|
|
62
|
+
// Migrate old processed attachments to the new format.
|
|
63
|
+
this.adapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList =
|
|
64
|
+
this.migrateProcessedAttachments(this.adapter.state.toDevRev.attachmentsMetadata
|
|
65
|
+
.lastProcessedAttachmentsIdsList);
|
|
37
66
|
// Start initial batch of promises up to batchSize limit
|
|
38
67
|
const initialBatchSize = Math.min(this.batchSize, this.attachments.length);
|
|
39
68
|
const initialPromises = [];
|
|
@@ -66,7 +95,7 @@ class AttachmentsStreamingPool {
|
|
|
66
95
|
break; // Exit if no more attachments
|
|
67
96
|
}
|
|
68
97
|
if (this.adapter.state.toDevRev &&
|
|
69
|
-
((_a = this.adapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList) === null || _a === void 0 ? void 0 : _a.
|
|
98
|
+
((_a = this.adapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList) === null || _a === void 0 ? void 0 : _a.some((it) => it.id == attachment.id && it.parent_id == attachment.parent_id))) {
|
|
70
99
|
continue; // Skip if the attachment ID is already processed
|
|
71
100
|
}
|
|
72
101
|
try {
|
|
@@ -83,7 +112,7 @@ class AttachmentsStreamingPool {
|
|
|
83
112
|
}
|
|
84
113
|
// No rate limiting, process normally
|
|
85
114
|
if ((_c = (_b = this.adapter.state.toDevRev) === null || _b === void 0 ? void 0 : _b.attachmentsMetadata) === null || _c === void 0 ? void 0 : _c.lastProcessedAttachmentsIdsList) {
|
|
86
|
-
(_d = this.adapter.state.toDevRev) === null || _d === void 0 ? void 0 : _d.attachmentsMetadata.lastProcessedAttachmentsIdsList.push(attachment.id);
|
|
115
|
+
(_d = this.adapter.state.toDevRev) === null || _d === void 0 ? void 0 : _d.attachmentsMetadata.lastProcessedAttachmentsIdsList.push({ id: attachment.id, parent_id: attachment.parent_id });
|
|
87
116
|
}
|
|
88
117
|
await this.updateProgress();
|
|
89
118
|
}
|
|
@@ -135,11 +135,32 @@ describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
|
|
|
135
135
|
const result = await pool.streamAll();
|
|
136
136
|
expect(result).toEqual({ delay: 5000 });
|
|
137
137
|
});
|
|
138
|
+
it('should resume attachment extraction if it encounters old ids', async () => {
|
|
139
|
+
var _a;
|
|
140
|
+
// Test migration from old string[] format to new ProcessedAttachment[] format
|
|
141
|
+
// Using 'as any' because we're intentionally testing legacy data format
|
|
142
|
+
mockAdapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList =
|
|
143
|
+
['attachment-1', 'attachment-2'];
|
|
144
|
+
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
145
|
+
adapter: mockAdapter,
|
|
146
|
+
attachments: mockAttachments,
|
|
147
|
+
stream: mockStream,
|
|
148
|
+
});
|
|
149
|
+
const result = await pool.streamAll();
|
|
150
|
+
expect((_a = mockAdapter.state.toDevRev) === null || _a === void 0 ? void 0 : _a.attachmentsMetadata.lastProcessedAttachmentsIdsList).toEqual([
|
|
151
|
+
{ id: 'attachment-1', parent_id: '' },
|
|
152
|
+
{ id: 'attachment-2', parent_id: '' },
|
|
153
|
+
{ id: 'attachment-1', parent_id: 'parent-1' },
|
|
154
|
+
{ id: 'attachment-2', parent_id: 'parent-2' },
|
|
155
|
+
{ id: 'attachment-3', parent_id: 'parent-3' },
|
|
156
|
+
]);
|
|
157
|
+
expect(result).toEqual({});
|
|
158
|
+
});
|
|
138
159
|
});
|
|
139
160
|
describe(attachments_streaming_pool_1.AttachmentsStreamingPool.prototype.startPoolStreaming.name, () => {
|
|
140
161
|
it('should skip already processed attachments', async () => {
|
|
141
162
|
mockAdapter.state.toDevRev.attachmentsMetadata.lastProcessedAttachmentsIdsList =
|
|
142
|
-
['attachment-1'];
|
|
163
|
+
[{ id: 'attachment-1', parent_id: 'parent-1' }];
|
|
143
164
|
mockAdapter.processAttachment.mockResolvedValue({});
|
|
144
165
|
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
145
166
|
adapter: mockAdapter,
|
|
@@ -158,7 +179,11 @@ describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
|
|
|
158
179
|
});
|
|
159
180
|
await pool.streamAll();
|
|
160
181
|
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
161
|
-
.lastProcessedAttachmentsIdsList).toEqual([
|
|
182
|
+
.lastProcessedAttachmentsIdsList).toEqual([
|
|
183
|
+
{ id: 'attachment-1', parent_id: 'parent-1' },
|
|
184
|
+
{ id: 'attachment-2', parent_id: 'parent-2' },
|
|
185
|
+
{ id: 'attachment-3', parent_id: 'parent-3' },
|
|
186
|
+
]);
|
|
162
187
|
});
|
|
163
188
|
it('should handle processing errors gracefully', async () => {
|
|
164
189
|
const error = new Error('Processing failed');
|
|
@@ -174,7 +199,16 @@ describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
|
|
|
174
199
|
await pool.streamAll();
|
|
175
200
|
expect(console.warn).toHaveBeenCalledWith('Skipping attachment with ID attachment-2 due to error in processAttachment function', error);
|
|
176
201
|
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
177
|
-
.lastProcessedAttachmentsIdsList).toEqual([
|
|
202
|
+
.lastProcessedAttachmentsIdsList).toEqual([
|
|
203
|
+
{
|
|
204
|
+
id: 'attachment-1',
|
|
205
|
+
parent_id: 'parent-1',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
id: 'attachment-3',
|
|
209
|
+
parent_id: 'parent-3',
|
|
210
|
+
},
|
|
211
|
+
]);
|
|
178
212
|
});
|
|
179
213
|
it('should stop processing when rate limit delay is encountered', async () => {
|
|
180
214
|
mockAdapter.processAttachment
|
|
@@ -189,7 +223,10 @@ describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
|
|
|
189
223
|
await pool.streamAll();
|
|
190
224
|
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
191
225
|
expect(mockAdapter.state.toDevRev.attachmentsMetadata
|
|
192
|
-
.lastProcessedAttachmentsIdsList).toEqual([
|
|
226
|
+
.lastProcessedAttachmentsIdsList).toEqual([
|
|
227
|
+
{ id: 'attachment-1', parent_id: 'parent-1' },
|
|
228
|
+
{ id: 'attachment-3', parent_id: 'parent-3' },
|
|
229
|
+
]);
|
|
193
230
|
});
|
|
194
231
|
it('should pass correct parameters to processAttachment', async () => {
|
|
195
232
|
mockAdapter.processAttachment.mockResolvedValue({});
|
|
@@ -224,6 +261,23 @@ describe(attachments_streaming_pool_1.AttachmentsStreamingPool.name, () => {
|
|
|
224
261
|
await pool.streamAll();
|
|
225
262
|
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(3);
|
|
226
263
|
});
|
|
264
|
+
it('[edge] should upload attachments with same id, but different parent_id', async () => {
|
|
265
|
+
mockAdapter.processAttachment.mockResolvedValue({});
|
|
266
|
+
mockAttachments.push({
|
|
267
|
+
id: 'attachment-1',
|
|
268
|
+
url: 'http://example.com/file5.jpg',
|
|
269
|
+
file_name: 'file5.jpg',
|
|
270
|
+
parent_id: 'parent-4',
|
|
271
|
+
});
|
|
272
|
+
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
273
|
+
adapter: mockAdapter,
|
|
274
|
+
attachments: mockAttachments,
|
|
275
|
+
batchSize: 1,
|
|
276
|
+
stream: mockStream,
|
|
277
|
+
});
|
|
278
|
+
await pool.streamAll();
|
|
279
|
+
expect(mockAdapter.processAttachment).toHaveBeenCalledTimes(4);
|
|
280
|
+
});
|
|
227
281
|
it('[edge] should handle batch size of 1', async () => {
|
|
228
282
|
mockAdapter.processAttachment.mockResolvedValue({});
|
|
229
283
|
const pool = new attachments_streaming_pool_1.AttachmentsStreamingPool({
|
|
@@ -40,7 +40,8 @@ describe(install_initial_domain_mapping_1.installInitialDomainMapping.name, () =
|
|
|
40
40
|
},
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
|
-
|
|
43
|
+
// Use the endpoint from the event to support dynamic ports in parallel tests
|
|
44
|
+
const mockEndpoint = mockEvent.execution_metadata.devrev_endpoint;
|
|
44
45
|
const mockToken = 'test_token';
|
|
45
46
|
// After each test, clear all mocks to prevent state from leaking.
|
|
46
47
|
afterEach(() => {
|
|
@@ -47,7 +47,7 @@ describe('Internal Axios Client', () => {
|
|
|
47
47
|
await axios_client_internal_1.axiosClient.get(jest_setup_1.mockServer.baseUrl + '/test-endpoint');
|
|
48
48
|
expect(jest_setup_1.mockServer.getRequestCount('GET', '/test-endpoint')).toBe(3);
|
|
49
49
|
});
|
|
50
|
-
it('should retry once after
|
|
50
|
+
it('should retry once after delay when response is 429 and Retry-After header is valid value', async () => {
|
|
51
51
|
jest_setup_1.mockServer.setRoute({
|
|
52
52
|
path: '/test-endpoint',
|
|
53
53
|
method: 'GET',
|
|
@@ -56,14 +56,14 @@ describe('Internal Axios Client', () => {
|
|
|
56
56
|
failureCount: 1,
|
|
57
57
|
errorStatus: 429,
|
|
58
58
|
headers: {
|
|
59
|
-
'Retry-After': '
|
|
59
|
+
'Retry-After': '1',
|
|
60
60
|
},
|
|
61
61
|
},
|
|
62
62
|
});
|
|
63
63
|
await axios_client_internal_1.axiosClient.get(jest_setup_1.mockServer.baseUrl + '/test-endpoint');
|
|
64
64
|
expect(jest_setup_1.mockServer.getRequestCount('GET', '/test-endpoint')).toBe(2);
|
|
65
65
|
});
|
|
66
|
-
it('should retry once after
|
|
66
|
+
it('should retry once after delay and measure time between retries when response is 429 and Retry-After header is valid value', async () => {
|
|
67
67
|
jest_setup_1.mockServer.setRoute({
|
|
68
68
|
path: '/test-endpoint',
|
|
69
69
|
method: 'GET',
|
|
@@ -71,14 +71,14 @@ describe('Internal Axios Client', () => {
|
|
|
71
71
|
retry: {
|
|
72
72
|
failureCount: 1,
|
|
73
73
|
errorStatus: 429,
|
|
74
|
-
headers: { 'Retry-After': '
|
|
74
|
+
headers: { 'Retry-After': '1' },
|
|
75
75
|
},
|
|
76
76
|
});
|
|
77
77
|
const startTime = Date.now();
|
|
78
78
|
await axios_client_internal_1.axiosClient.get(jest_setup_1.mockServer.baseUrl + '/test-endpoint');
|
|
79
79
|
const endTime = Date.now();
|
|
80
80
|
const duration = endTime - startTime;
|
|
81
|
-
const expectedDuration =
|
|
81
|
+
const expectedDuration = 1 * 1000;
|
|
82
82
|
expect(duration).toBeGreaterThanOrEqual(expectedDuration);
|
|
83
83
|
expect(duration).toBeLessThan(expectedDuration + 1000);
|
|
84
84
|
});
|
|
@@ -90,7 +90,7 @@ describe('Internal Axios Client', () => {
|
|
|
90
90
|
retry: {
|
|
91
91
|
failureCount: 1,
|
|
92
92
|
errorStatus: 429,
|
|
93
|
-
headers: { 'retry-after': '
|
|
93
|
+
headers: { 'retry-after': '1' },
|
|
94
94
|
},
|
|
95
95
|
});
|
|
96
96
|
await axios_client_internal_1.axiosClient.get(jest_setup_1.mockServer.baseUrl + '/test-endpoint');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,WAAW,CAAC,cAAc,EAAE,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"process-task.d.ts","sourceRoot":"","sources":["../../src/multithreading/process-task.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,oBAAoB,EAGrB,MAAM,kBAAkB,CAAC;AAG1B,wBAAgB,WAAW,CAAC,cAAc,EAAE,EAC1C,IAAI,EACJ,SAAS,GACV,EAAE,oBAAoB,CAAC,cAAc,CAAC,QAqGtC"}
|
|
@@ -9,50 +9,85 @@ const state_1 = require("../state/state");
|
|
|
9
9
|
const workers_1 = require("../types/workers");
|
|
10
10
|
const worker_adapter_1 = require("./worker-adapter/worker-adapter");
|
|
11
11
|
function processTask({ task, onTimeout, }) {
|
|
12
|
-
if (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
12
|
+
if (node_worker_threads_1.isMainThread) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
void (async () => {
|
|
16
|
+
await (0, logger_context_1.runWithSdkLogContext)(async () => {
|
|
17
|
+
try {
|
|
18
|
+
const event = node_worker_threads_1.workerData.event;
|
|
19
|
+
// TODO: Remove when the old types are completely phased out
|
|
20
|
+
event.payload.event_type = (0, event_type_translation_1.translateIncomingEventType)(event.payload.event_type);
|
|
21
|
+
const initialState = node_worker_threads_1.workerData.initialState;
|
|
22
|
+
const initialDomainMapping = node_worker_threads_1.workerData.initialDomainMapping;
|
|
23
|
+
const options = node_worker_threads_1.workerData.options;
|
|
24
|
+
// eslint-disable-next-line no-global-assign
|
|
25
|
+
console = new logger_1.Logger({ event, options });
|
|
26
|
+
const adapterState = await (0, state_1.createAdapterState)({
|
|
27
|
+
event,
|
|
28
|
+
initialState,
|
|
29
|
+
initialDomainMapping,
|
|
30
|
+
options,
|
|
31
|
+
});
|
|
32
|
+
const adapter = new worker_adapter_1.WorkerAdapter({
|
|
33
|
+
event,
|
|
34
|
+
adapterState,
|
|
35
|
+
options,
|
|
36
|
+
});
|
|
37
|
+
// Timeout handling flow:
|
|
38
|
+
// The task() runs in the main flow below. Meanwhile, the parent thread may send
|
|
39
|
+
// a timeout message at any point. When that happens, the message handler signals
|
|
40
|
+
// the adapter to stop (handleTimeout), waits for task() to finish, then runs onTimeout().
|
|
41
|
+
// If task() completes before any timeout message arrives, the worker exits normally.
|
|
42
|
+
// isTimeoutReceived prevents both flows from calling process.exit.
|
|
43
|
+
let isTimeoutReceived = false;
|
|
44
|
+
let taskExecution;
|
|
45
|
+
node_worker_threads_1.parentPort === null || node_worker_threads_1.parentPort === void 0 ? void 0 : node_worker_threads_1.parentPort.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
|
|
46
|
+
if (message.subject !== workers_1.WorkerMessageSubject.WorkerMessageExit) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
isTimeoutReceived = true;
|
|
50
|
+
void (0, logger_context_1.runWithSdkLogContext)(async () => {
|
|
51
|
+
try {
|
|
52
|
+
console.log('Timeout received. Waiting for the task to finish.');
|
|
53
|
+
adapter.handleTimeout();
|
|
54
|
+
try {
|
|
55
|
+
await taskExecution;
|
|
56
|
+
}
|
|
57
|
+
catch (taskError) {
|
|
58
|
+
console.warn('Task error during timeout:', (0, logger_1.serializeError)(taskError));
|
|
59
|
+
}
|
|
60
|
+
console.log('Task finished. Running onTimeout handler.');
|
|
61
|
+
await (0, logger_context_1.runWithUserLogContext)(async () => onTimeout({ adapter }));
|
|
62
|
+
console.log('onTimeout handler complete. Exiting worker.');
|
|
63
|
+
process.exit(0);
|
|
64
|
+
}
|
|
65
|
+
catch (onTimeoutError) {
|
|
66
|
+
console.error('Error in onTimeout handler:', (0, logger_1.serializeError)(onTimeoutError));
|
|
67
|
+
process.exit(1);
|
|
68
|
+
}
|
|
29
69
|
});
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
console.log('Worker received message to gracefully exit. Setting isTimeout flag and executing onTimeout function.');
|
|
40
|
-
adapter.handleTimeout();
|
|
41
|
-
await (0, logger_context_1.runWithUserLogContext)(async () => onTimeout({ adapter }));
|
|
42
|
-
console.log('Finished executing onTimeout function. Exiting worker.');
|
|
43
|
-
process.exit(0);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
})());
|
|
47
|
-
await (0, logger_context_1.runWithUserLogContext)(async () => task({ adapter }));
|
|
48
|
-
process.exit(0);
|
|
70
|
+
});
|
|
71
|
+
taskExecution = (0, logger_context_1.runWithUserLogContext)(async () => task({ adapter }));
|
|
72
|
+
try {
|
|
73
|
+
await taskExecution;
|
|
74
|
+
}
|
|
75
|
+
catch (taskError) {
|
|
76
|
+
if (isTimeoutReceived) {
|
|
77
|
+
console.log('Task threw during timeout. Letting timeout handler finish.');
|
|
78
|
+
return;
|
|
49
79
|
}
|
|
80
|
+
throw taskError;
|
|
50
81
|
}
|
|
51
|
-
|
|
52
|
-
console.
|
|
53
|
-
process.exit(
|
|
82
|
+
if (!isTimeoutReceived) {
|
|
83
|
+
console.log('Task completed. Exiting worker.');
|
|
84
|
+
process.exit(0);
|
|
54
85
|
}
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
console.error('Error while processing task.', (0, logger_1.serializeError)(error));
|
|
89
|
+
process.exit(1);
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
})();
|
|
58
93
|
}
|
|
@@ -15,6 +15,7 @@ export declare function spawn<ConnectorState>({ event, initialState, workerPath,
|
|
|
15
15
|
export declare class Spawn {
|
|
16
16
|
private event;
|
|
17
17
|
private alreadyEmitted;
|
|
18
|
+
private softTimeoutSent;
|
|
18
19
|
private defaultLambdaTimeout;
|
|
19
20
|
private lambdaTimeout;
|
|
20
21
|
private softTimeoutTimer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AA+C7B;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"spawn.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,qBAAqB,EACrB,cAAc,EAGf,MAAM,qBAAqB,CAAC;AA+C7B;;;;;;;;;;;GAWG;AACH,wBAAsB,KAAK,CAAC,cAAc,EAAE,EAC1C,KAAK,EACL,YAAY,EACZ,UAAU,EACV,oBAAoB,EACpB,OAAO,EACP,cAAc,GACf,EAAE,qBAAqB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAwFvD;AAED,qBAAa,KAAK;IAChB,OAAO,CAAC,KAAK,CAAe;IAC5B,OAAO,CAAC,cAAc,CAAU;IAChC,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,oBAAoB,CAAkC;IAC9D,OAAO,CAAC,aAAa,CAAS;IAC9B,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,gBAAgB,CAA4C;IACpE,OAAO,CAAC,wBAAwB,CAA6C;IAC7E,OAAO,CAAC,OAAO,CAA4C;IAC3D,OAAO,CAAC,eAAe,CAAU;IACjC,OAAO,CAAC,MAAM,CAAS;gBACX,EACV,KAAK,EACL,MAAM,EACN,OAAO,EACP,OAAO,EACP,eAAe,GAChB,EAAE,cAAc;IA4GjB,OAAO,CAAC,aAAa;YAYP,kBAAkB;CAiCjC"}
|
|
@@ -137,6 +137,7 @@ class Spawn {
|
|
|
137
137
|
this.originalConsole = originalConsole || console;
|
|
138
138
|
this.logger = console;
|
|
139
139
|
this.alreadyEmitted = false;
|
|
140
|
+
this.softTimeoutSent = false;
|
|
140
141
|
this.event = event;
|
|
141
142
|
this.lambdaTimeout = (options === null || options === void 0 ? void 0 : options.timeout)
|
|
142
143
|
? Math.min(options.timeout, this.defaultLambdaTimeout)
|
|
@@ -145,6 +146,7 @@ class Spawn {
|
|
|
145
146
|
// If soft timeout is reached, send a message to the worker to gracefully exit.
|
|
146
147
|
this.softTimeoutTimer = setTimeout(() => void (async () => {
|
|
147
148
|
console.log('SOFT TIMEOUT: Sending a message to the worker to gracefully exit.');
|
|
149
|
+
this.softTimeoutSent = true;
|
|
148
150
|
if (worker) {
|
|
149
151
|
worker.postMessage({
|
|
150
152
|
subject: workers_1.WorkerMessageSubject.WorkerMessageExit,
|
|
@@ -167,12 +169,25 @@ class Spawn {
|
|
|
167
169
|
}
|
|
168
170
|
})(), this.lambdaTimeout * constants_1.HARD_TIMEOUT_MULTIPLIER);
|
|
169
171
|
// If worker exits with process.exit(code), clear the timeouts and exit from
|
|
170
|
-
// main thread.
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
// main thread. When a soft timeout was sent, we use setImmediate to defer
|
|
173
|
+
// processing so that any pending WorkerMessage events (e.g.
|
|
174
|
+
// WorkerMessageEmitted from onTimeout) already queued in the event loop are
|
|
175
|
+
// handled first, preventing a race condition where exitFromMainThread sees
|
|
176
|
+
// alreadyEmitted=false and emits an error even though the worker
|
|
177
|
+
// successfully emitted an event.
|
|
178
|
+
worker.on(workers_1.WorkerEvent.WorkerExit, (code) => {
|
|
179
|
+
const handler = async () => {
|
|
180
|
+
console.info('Worker exited with exit code: ' + code + '.');
|
|
181
|
+
this.clearTimeouts();
|
|
182
|
+
await this.exitFromMainThread();
|
|
183
|
+
};
|
|
184
|
+
if (this.softTimeoutSent) {
|
|
185
|
+
void setImmediate(() => void handler());
|
|
186
|
+
}
|
|
187
|
+
else {
|
|
188
|
+
void handler();
|
|
189
|
+
}
|
|
190
|
+
});
|
|
176
191
|
worker.on(workers_1.WorkerEvent.WorkerMessage, (message) => {
|
|
177
192
|
var _a, _b, _c, _d;
|
|
178
193
|
// Since logs from the worker thread are handled differently in snap-in
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-adapter.d.ts","sourceRoot":"","sources":["../../../src/multithreading/worker-adapter/worker-ad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OAAO,CAAC,QAAQ,CAAW;gBAEf,EACV,KAAK,EACL,YAAY,EACZ,OAAO,GACR,EAAE,sBAAsB,CAAC,cAAc,CAAC;IAqBzC,IAAI,KAAK,IAAI,YAAY,CAAC,cAAc,CAAC,CAExC;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,YAAY,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"worker-adapter.d.ts","sourceRoot":"","sources":["../../../src/multithreading/worker-adapter/worker-adapter.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAEhD,OAAO,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AACvC,OAAO,EACL,oBAAoB,EACpB,aAAa,EACd,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EACL,YAAY,EACZ,SAAS,EAET,kCAAkC,EAClC,yCAAyC,EACzC,kBAAkB,EAClB,2BAA2B,EAC3B,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAEL,wBAAwB,EACxB,kBAAkB,EAClB,6BAA6B,EAC7B,UAAU,EACV,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,YAAY,EACZ,gBAAgB,EAChB,qBAAqB,EAEtB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EAGrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,QAAQ,EAAkB,MAAM,oCAAoC,CAAC;AAG9E,wBAAgB,mBAAmB,CAAC,cAAc,EAAE,EAClD,KAAK,EACL,YAAY,EACZ,OAAO,GACR,EAAE,sBAAsB,CAAC,cAAc,CAAC,GAAG,aAAa,CAAC,cAAc,CAAC,CAMxE;AAED;;;;;;;;;;;;;;GAcG;AACH,qBAAa,aAAa,CAAC,cAAc;IACvC,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAC;IAC7B,QAAQ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AAC,EACpB,MAAM,GACP,EAAE;QACD,MAAM,EAAE,6BAA6B,CAAC,wBAAwB,CAAC,CAAC;KACjE,GAAG,OAAO,CAAC,qBAAqB,CAAC;IA6E5B,QAAQ,CAAC,EACb,IAAI,EACJ,cAAc,GACf,EAAE;QACD,IAAI,EAAE,kBAAkB,CAAC;QACzB,cAAc,EAAE,cAAc,CAAC;KAChC,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAkMvB,iBAAiB,CACrB,UAAU,EAAE,oBAAoB,EAChC,MAAM,EAAE,yCAAyC,GAChD,OAAO,CAAC,2BAA2B,CAAC;IAoGvC;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IAcnB,cAAc,CAAC,EACnB,IAAI,EACJ,MAAM,GACP,EAAE;QACD,IAAI,EAAE,wBAAwB,CAAC;QAC/B,MAAM,EAAE,6BAA6B,CAAC,wBAAwB,CAAC,CAAC;KACjE,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAqD7B;;;;;;OAMG;IACG,iBAAiB,CAAC,QAAQ,EAAE,EAChC,MAAM,EACN,UAAU,EACV,SAAa,GACd,EAAE;QACD,MAAM,EAAE,yCAAyC,CAAC;QAClD,UAAU,CAAC,EAAE,kCAAkC,CAC7C,cAAc,EACd,oBAAoB,EAAE,EACtB,QAAQ,CACT,CAAC;QACF,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,GAAG,OAAO,CAAC,2BAA2B,CAAC;CAyHzC"}
|
|
@@ -18,9 +18,16 @@ export interface ToDevRev {
|
|
|
18
18
|
attachmentsMetadata: {
|
|
19
19
|
artifactIds: string[];
|
|
20
20
|
lastProcessed: number;
|
|
21
|
-
lastProcessedAttachmentsIdsList?:
|
|
21
|
+
lastProcessedAttachmentsIdsList?: ProcessedAttachment[];
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
+
/**
|
|
25
|
+
* Attachment structure, that stores both attachment id and its parent_id for deduplication on the SDK side.
|
|
26
|
+
*/
|
|
27
|
+
export interface ProcessedAttachment {
|
|
28
|
+
id: string;
|
|
29
|
+
parent_id: string;
|
|
30
|
+
}
|
|
24
31
|
export interface FromDevRev {
|
|
25
32
|
filesToLoad: FileToLoad[];
|
|
26
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state.interfaces.d.ts","sourceRoot":"","sources":["../../src/state/state.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,QAAQ;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,cAAc,IAAI,cAAc,GAAG,QAAQ,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,mBAAmB,EAAE;QACnB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,+BAA+B,CAAC,EAAE,
|
|
1
|
+
{"version":3,"file":"state.interfaces.d.ts","sourceRoot":"","sources":["../../src/state/state.interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD,MAAM,WAAW,QAAQ;IACvB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,MAAM,MAAM,YAAY,CAAC,cAAc,IAAI,cAAc,GAAG,QAAQ,CAAC;AAErE,MAAM,WAAW,QAAQ;IACvB,mBAAmB,EAAE;QACnB,WAAW,EAAE,MAAM,EAAE,CAAC;QACtB,aAAa,EAAE,MAAM,CAAC;QACtB,+BAA+B,CAAC,EAAE,mBAAmB,EAAE,CAAC;KACzD,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,UAAU,EAAE,CAAC;CAC3B;AAED,MAAM,WAAW,cAAc,CAAC,cAAc;IAC5C,KAAK,EAAE,YAAY,CAAC;IACpB,YAAY,EAAE,cAAc,CAAC;IAC7B,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,OAAO,CAAC,EAAE,oBAAoB,CAAC;CAChC;AAED,eAAO,MAAM,kBAAkB;;;;;;;;;;;CAW9B,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;CAK3B,CAAC"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Schema version for the external domain metadata format.
|
|
3
|
+
*/
|
|
4
|
+
export type SchemaVersion = 'v0.2.0';
|
|
5
|
+
/** Key identifying a record type in the record_types map, refers_to maps, or type_keys arrays. */
|
|
6
|
+
export type RecordTypeKey = string;
|
|
7
|
+
/** Key identifying a field within a record type or struct type fields map. */
|
|
8
|
+
export type FieldKey = string;
|
|
9
|
+
/** Key identifying an enum value in EnumValue.key or stage diagram stages map keys. */
|
|
10
|
+
export type EnumValueKey = string;
|
|
11
|
+
/** Key identifying a struct type in the struct_types map. */
|
|
12
|
+
export type StructTypeKey = string;
|
|
13
|
+
/** Key identifying a record type category in the record_type_categories map. */
|
|
14
|
+
export type RecordTypeCategoryKey = string;
|
|
15
|
+
/** Key identifying a state in the stage diagram states map. */
|
|
16
|
+
export type StateKey = string;
|
|
17
|
+
/** Key identifying a stage in the stage diagram stages map. */
|
|
18
|
+
export type StageKey = string;
|
|
19
|
+
/**
|
|
20
|
+
* Field type discriminator.
|
|
21
|
+
*/
|
|
22
|
+
export type FieldType = 'bool' | 'int' | 'float' | 'text' | 'rich_text' | 'reference' | 'typed_reference' | 'enum' | 'date' | 'timestamp' | 'struct' | 'permission' | 'record_type_privilege' | 'field_privilege' | 'conditional_privilege';
|
|
23
|
+
/**
|
|
24
|
+
* Reference type indicating parent-child relationship.
|
|
25
|
+
*/
|
|
26
|
+
export type ReferenceType = 'child' | 'parent';
|
|
27
|
+
/**
|
|
28
|
+
* Comparator for field conditions.
|
|
29
|
+
*/
|
|
30
|
+
export type FieldConditionComparator = 'eq' | 'ne';
|
|
31
|
+
/**
|
|
32
|
+
* Effect applied when a field condition is met.
|
|
33
|
+
*/
|
|
34
|
+
export type FieldConditionEffect = 'require' | 'show';
|
|
35
|
+
/**
|
|
36
|
+
* Scope of a record type.
|
|
37
|
+
*/
|
|
38
|
+
export type RecordTypeScope = 'metadata_is_system_scoped' | 'data_is_system_scoped';
|
|
39
|
+
/**
|
|
40
|
+
* Collection constraints for fields that are collections of values.
|
|
41
|
+
*/
|
|
42
|
+
export interface CollectionData {
|
|
43
|
+
min_length?: number;
|
|
44
|
+
max_length?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Integer field constraints.
|
|
48
|
+
*/
|
|
49
|
+
export interface IntData {
|
|
50
|
+
min?: number;
|
|
51
|
+
max?: number;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Float field constraints.
|
|
55
|
+
*/
|
|
56
|
+
export interface FloatData {
|
|
57
|
+
min?: number;
|
|
58
|
+
max?: number;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Text field constraints.
|
|
62
|
+
*/
|
|
63
|
+
export interface TextData {
|
|
64
|
+
min_length?: number;
|
|
65
|
+
max_length?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Enum value definition.
|
|
69
|
+
*/
|
|
70
|
+
export interface EnumValue {
|
|
71
|
+
/** The enum value that actually occurs in the json data */
|
|
72
|
+
key: EnumValueKey;
|
|
73
|
+
/** The human readable name of the enum value */
|
|
74
|
+
name?: string;
|
|
75
|
+
description?: string;
|
|
76
|
+
/** Deprecated enum values may still occur in the data, but should not be used in new data */
|
|
77
|
+
is_deprecated?: boolean;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Enum field data containing possible values.
|
|
81
|
+
*/
|
|
82
|
+
export interface EnumData {
|
|
83
|
+
values: EnumValue[];
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Details about how a reference targets another record type.
|
|
87
|
+
*/
|
|
88
|
+
export interface ReferenceDetail {
|
|
89
|
+
/** The field in the target record type by which it is referenced. Assumed to be the primary key if not set. */
|
|
90
|
+
by_field?: FieldKey;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Reference field data specifying target record types.
|
|
94
|
+
*/
|
|
95
|
+
export interface ReferenceData {
|
|
96
|
+
/** The record types that this reference can refer to */
|
|
97
|
+
refers_to: Record<RecordTypeKey, ReferenceDetail>;
|
|
98
|
+
/** The parent reference refers to a record that has special ownership over the child */
|
|
99
|
+
reference_type?: ReferenceType;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Typed reference field data specifying target record types.
|
|
103
|
+
*/
|
|
104
|
+
export interface TypedReferenceData {
|
|
105
|
+
/** The record types that this reference can refer to */
|
|
106
|
+
refers_to: Record<RecordTypeKey, ReferenceDetail>;
|
|
107
|
+
/** The parent reference refers to a record that has special ownership over the child */
|
|
108
|
+
reference_type?: ReferenceType;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Struct field data referencing a struct type.
|
|
112
|
+
*/
|
|
113
|
+
export interface StructData {
|
|
114
|
+
key?: StructTypeKey;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Permission data associating a reference with a role.
|
|
118
|
+
*/
|
|
119
|
+
export interface PermissionData {
|
|
120
|
+
member_id?: ReferenceData;
|
|
121
|
+
role?: EnumData;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Conditional privilege data for authorization.
|
|
125
|
+
*/
|
|
126
|
+
export interface ConditionalPrivilegeData {
|
|
127
|
+
/** The possible record types or record type categories that can be targeted in conditional privilege. */
|
|
128
|
+
type_keys: RecordTypeKey[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Field privilege data for authorization.
|
|
132
|
+
*/
|
|
133
|
+
export interface FieldPrivilegeData {
|
|
134
|
+
/** The possible record types or record type categories that can be targeted in field privilege. */
|
|
135
|
+
type_keys: RecordTypeKey[];
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Record type privilege data for authorization.
|
|
139
|
+
*/
|
|
140
|
+
export interface RecordTypePrivilegeData {
|
|
141
|
+
/** The possible record types or record type categories that can be targeted in record type privilege. */
|
|
142
|
+
type_keys: RecordTypeKey[];
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Target type key data for authorization policy.
|
|
146
|
+
*/
|
|
147
|
+
export interface TargetTypeKeyData {
|
|
148
|
+
/** The possible record types or record type categories that can be targeted in authorization policy. */
|
|
149
|
+
type_keys: RecordTypeKey[];
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Field reference data (currently empty, reserved for future use).
|
|
153
|
+
*/
|
|
154
|
+
export interface FieldReferenceData {
|
|
155
|
+
[key: string]: never;
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Field definition with type discriminator and type-specific data.
|
|
159
|
+
*/
|
|
160
|
+
export interface Field {
|
|
161
|
+
/** The type of the field */
|
|
162
|
+
type: FieldType;
|
|
163
|
+
/** The human readable name of the field */
|
|
164
|
+
name?: string;
|
|
165
|
+
description?: string;
|
|
166
|
+
/** Required fields are required in the domain model of the external system. */
|
|
167
|
+
is_required?: boolean;
|
|
168
|
+
/** Read only fields can't be set (when creating or updating a record), but are filled in by some process in the system. */
|
|
169
|
+
is_read_only?: boolean | null;
|
|
170
|
+
/** Fields that are write only should only be written to. */
|
|
171
|
+
is_write_only?: boolean | null;
|
|
172
|
+
/** Indexed fields can be used for searching, sorting or filtering. */
|
|
173
|
+
is_indexed?: boolean | null;
|
|
174
|
+
/** Indicates that the field can be used to uniquely lookup a record. */
|
|
175
|
+
is_identifier?: boolean | null;
|
|
176
|
+
/** Default value for the field */
|
|
177
|
+
default_value?: boolean | number | string;
|
|
178
|
+
/** If collection is set, the field is a 'collection' of the given type. */
|
|
179
|
+
collection?: CollectionData;
|
|
180
|
+
int?: IntData;
|
|
181
|
+
float?: FloatData;
|
|
182
|
+
text?: TextData;
|
|
183
|
+
enum?: EnumData | null;
|
|
184
|
+
reference?: ReferenceData;
|
|
185
|
+
typed_reference?: TypedReferenceData;
|
|
186
|
+
struct?: StructData;
|
|
187
|
+
permission?: PermissionData;
|
|
188
|
+
type_key?: TargetTypeKeyData;
|
|
189
|
+
field_reference?: FieldReferenceData;
|
|
190
|
+
record_type_privilege?: RecordTypePrivilegeData;
|
|
191
|
+
field_privilege?: FieldPrivilegeData;
|
|
192
|
+
conditional_privilege?: ConditionalPrivilegeData;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Field condition definition.
|
|
196
|
+
*/
|
|
197
|
+
export interface FieldCondition {
|
|
198
|
+
/** The value of the controlling field that will be compared against to see if the condition is met. */
|
|
199
|
+
value: unknown;
|
|
200
|
+
/** The comparator that will be used to compare the controlling field's value against the Value. */
|
|
201
|
+
comparator: FieldConditionComparator;
|
|
202
|
+
/** The fields that will be affected by the condition being met. */
|
|
203
|
+
affected_fields: FieldKey[];
|
|
204
|
+
/** The effect that will be applied to the affected fields if the condition is met. */
|
|
205
|
+
effect: FieldConditionEffect;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Array of field conditions.
|
|
209
|
+
*/
|
|
210
|
+
export type FieldConditions = FieldCondition[];
|
|
211
|
+
/**
|
|
212
|
+
* Custom link names for forward and backward directions.
|
|
213
|
+
*/
|
|
214
|
+
export interface CustomLinkNames {
|
|
215
|
+
/** The forward name of the link */
|
|
216
|
+
forward_name: string;
|
|
217
|
+
/** The backward name of the link */
|
|
218
|
+
backward_name: string;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Custom link data for defining link types.
|
|
222
|
+
*/
|
|
223
|
+
export interface CustomLinkData {
|
|
224
|
+
/** The field that defines the link types in the system. */
|
|
225
|
+
link_type_field: FieldKey;
|
|
226
|
+
link_direction_names: Record<string, CustomLinkNames> | null;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Custom stage definition in a stage diagram.
|
|
230
|
+
*/
|
|
231
|
+
export interface CustomStage {
|
|
232
|
+
/** The state this stage belongs to. Must match the ones defined in the diagram 'states' field or be one of the default options: 'open', 'in_progress', 'closed'. */
|
|
233
|
+
state?: StateKey;
|
|
234
|
+
/** A list of stage names that this stage can transition to. */
|
|
235
|
+
transitions_to?: StageKey[];
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Custom state definition in a stage diagram.
|
|
239
|
+
*/
|
|
240
|
+
export interface CustomState {
|
|
241
|
+
/** The human readable name of the custom state. */
|
|
242
|
+
name: string;
|
|
243
|
+
/** Denotes that this state is an end state. */
|
|
244
|
+
is_end_state?: boolean;
|
|
245
|
+
/** The sort order of the state. */
|
|
246
|
+
ordinal?: number;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Stage diagram definition for record type workflow.
|
|
250
|
+
*/
|
|
251
|
+
export interface StageDiagram {
|
|
252
|
+
/** The field that represents the stage in the external system. */
|
|
253
|
+
controlling_field: FieldKey;
|
|
254
|
+
/** A map of the stages that should be created. Keys must match the enum values in the controlling field. */
|
|
255
|
+
stages: Record<StageKey, CustomStage>;
|
|
256
|
+
/** The stage that the parent record type starts in when it is created. */
|
|
257
|
+
starting_stage?: StageKey;
|
|
258
|
+
/** A map of the states/status categories that should be created. */
|
|
259
|
+
states?: Record<StateKey, CustomState>;
|
|
260
|
+
/** Denotes that this diagram has no explicit transitions and should be created as an 'all-to-all' diagram. */
|
|
261
|
+
all_transitions_allowed?: boolean;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Record type category definition.
|
|
265
|
+
*/
|
|
266
|
+
export interface RecordTypeCategory {
|
|
267
|
+
/** The human readable name of the record type category */
|
|
268
|
+
name?: string;
|
|
269
|
+
/** Indicates whether a record can move between the record types of this category while preserving its identity */
|
|
270
|
+
are_record_type_conversions_possible?: boolean;
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Record type definition.
|
|
274
|
+
*/
|
|
275
|
+
export interface RecordType {
|
|
276
|
+
/** The fields of the record type */
|
|
277
|
+
fields: Record<FieldKey, Field>;
|
|
278
|
+
/** The human readable name of the record type */
|
|
279
|
+
name?: string;
|
|
280
|
+
description?: string;
|
|
281
|
+
category?: RecordTypeCategoryKey;
|
|
282
|
+
/** Whether the record type can be loaded (connector supports creating it in the system) */
|
|
283
|
+
is_loadable?: boolean;
|
|
284
|
+
/** Whether the record type sends the complete system state in every sync */
|
|
285
|
+
is_snapshot?: boolean;
|
|
286
|
+
/** Denotes that the record type has no ID field, primarily used for authorization policies */
|
|
287
|
+
no_identifier?: boolean;
|
|
288
|
+
/** Indicates the scope of this record type */
|
|
289
|
+
scope?: RecordTypeScope;
|
|
290
|
+
/** Field conditions for this record type */
|
|
291
|
+
conditions?: Record<FieldKey, FieldConditions>;
|
|
292
|
+
/** Stage diagram for workflow */
|
|
293
|
+
stage_diagram?: StageDiagram;
|
|
294
|
+
/** Link naming data for custom links */
|
|
295
|
+
link_naming_data?: CustomLinkData;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Struct type definition for reusable field structures.
|
|
299
|
+
*/
|
|
300
|
+
export interface StructType {
|
|
301
|
+
/** The fields of the struct type */
|
|
302
|
+
fields: Record<FieldKey, Field>;
|
|
303
|
+
/** The human readable name of the struct type */
|
|
304
|
+
name?: string;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* External domain metadata describing the logical structure of an external system.
|
|
308
|
+
*/
|
|
309
|
+
export interface ExternalDomainMetadata {
|
|
310
|
+
/** The record types in the domain */
|
|
311
|
+
record_types: Record<RecordTypeKey, RecordType>;
|
|
312
|
+
/** Record type categories */
|
|
313
|
+
record_type_categories?: Record<RecordTypeCategoryKey, RecordTypeCategory>;
|
|
314
|
+
/** Struct types for reusable field structures */
|
|
315
|
+
struct_types?: Record<StructTypeKey, StructType>;
|
|
316
|
+
/** The schema version of the metadata format itself. */
|
|
317
|
+
schema_version?: SchemaVersion;
|
|
318
|
+
}
|
|
319
|
+
//# sourceMappingURL=external-domain-metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"external-domain-metadata.d.ts","sourceRoot":"","sources":["../../src/types/external-domain-metadata.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC;AAErC,kGAAkG;AAClG,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,8EAA8E;AAC9E,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,uFAAuF;AACvF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,6DAA6D;AAC7D,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,gFAAgF;AAChF,MAAM,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAE3C,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,MAAM,CA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6,5 @@ export { AdapterState } from '../state/state.interfaces';
|
|
|
6
6
|
export { Artifact, ArtifactsPrepareResponse, SsorAttachment, StreamAttachmentsResponse, StreamResponse, UploadResponse, } from '../uploader/uploader.interfaces';
|
|
7
7
|
export type { MappersCreateParams, MappersGetByExternalIdParams, MappersGetByTargetIdParams, MappersUpdateParams, } from '../mappers/mappers.interface';
|
|
8
8
|
export { SyncMapperRecordStatus, SyncMapperRecordTargetType, } from '../mappers/mappers.interface';
|
|
9
|
+
export type { CollectionData, ConditionalPrivilegeData, CustomLinkData, CustomLinkNames, CustomStage, CustomState, EnumData, EnumValue, EnumValueKey, ExternalDomainMetadata, Field, FieldCondition, FieldConditionComparator, FieldConditionEffect, FieldConditions, FieldKey, FieldPrivilegeData, FieldReferenceData, FieldType, FloatData, IntData, PermissionData, RecordType, RecordTypeCategory, RecordTypeCategoryKey, RecordTypeKey, RecordTypePrivilegeData, RecordTypeScope, ReferenceData, ReferenceDetail, ReferenceType, SchemaVersion, StageKey, StageDiagram, StateKey, StructData, StructTypeKey, StructType, TargetTypeKeyData, TextData, TypedReferenceData, } from './external-domain-metadata';
|
|
9
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,QAAQ,GACT,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,SAAS,EACT,SAAS,EACT,iCAAiC,EACjC,gBAAgB,EAChB,wCAAwC,EACxC,uCAAuC,EACvC,yCAAyC,EACzC,uCAAuC,EACvC,yCAAyC,EACzC,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,+BAA+B,EAC/B,iCAAiC,EACjC,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,cAAc,GACf,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,WAAW,EACX,oBAAoB,EACpB,SAAS,EACT,QAAQ,GACT,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,eAAe,EACf,SAAS,EACT,SAAS,EACT,iCAAiC,EACjC,gBAAgB,EAChB,wCAAwC,EACxC,uCAAuC,EACvC,yCAAyC,EACzC,uCAAuC,EACvC,yCAAyC,EACzC,cAAc,EACd,cAAc,EACd,kBAAkB,EAClB,2BAA2B,GAC5B,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,wBAAwB,EACxB,kBAAkB,EAClB,+BAA+B,EAC/B,iCAAiC,EACjC,eAAe,GAChB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,aAAa,GACd,MAAM,yBAAyB,CAAC;AAGjC,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAGzD,OAAO,EACL,QAAQ,EACR,wBAAwB,EACxB,cAAc,EACd,yBAAyB,EACzB,cAAc,EACd,cAAc,GACf,MAAM,iCAAiC,CAAC;AAGzC,YAAY,EACV,mBAAmB,EACnB,4BAA4B,EAC5B,0BAA0B,EAC1B,mBAAmB,GACpB,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EACL,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,8BAA8B,CAAC;AAGtC,YAAY,EACV,cAAc,EACd,wBAAwB,EACxB,cAAc,EACd,eAAe,EACf,WAAW,EACX,WAAW,EACX,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,sBAAsB,EACtB,KAAK,EACL,cAAc,EACd,wBAAwB,EACxB,oBAAoB,EACpB,eAAe,EACf,QAAQ,EACR,kBAAkB,EAClB,kBAAkB,EAClB,SAAS,EACT,SAAS,EACT,OAAO,EACP,cAAc,EACd,UAAU,EACV,kBAAkB,EAClB,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,eAAe,EACf,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,kBAAkB,GACnB,MAAM,4BAA4B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@devrev/airsync-sdk",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "TypeScript SDK for building AirSync snap-ins on the DevRev platform.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -11,15 +11,18 @@
|
|
|
11
11
|
"start": "ts-node src/index.ts",
|
|
12
12
|
"lint": "eslint .",
|
|
13
13
|
"lint:fix": "eslint . --fix",
|
|
14
|
-
"test": "jest --forceExit --
|
|
15
|
-
"test:backwards-compatibility": "jest --forceExit --
|
|
14
|
+
"test": "jest --forceExit --maxWorkers=50% --selectProjects default --",
|
|
15
|
+
"test:backwards-compatibility": "jest --forceExit --selectProjects backwards-compatibility --",
|
|
16
|
+
"test:timeout-handling": "jest --forceExit --selectProjects timeout-handling --",
|
|
17
|
+
"test:slow": "jest --forceExit --selectProjects slow --",
|
|
18
|
+
"test:coverage": "jest --forceExit --coverage --runInBand --"
|
|
16
19
|
},
|
|
17
20
|
"repository": {
|
|
18
21
|
"type": "git",
|
|
19
22
|
"url": "git+https://github.com/devrev/adaas-sdk.git"
|
|
20
23
|
},
|
|
21
24
|
"publishConfig": {
|
|
22
|
-
"registry": "https://
|
|
25
|
+
"registry": "https://registry.npmjs.org"
|
|
23
26
|
},
|
|
24
27
|
"keywords": [],
|
|
25
28
|
"author": "devrev",
|
|
@@ -33,6 +36,7 @@
|
|
|
33
36
|
"@types/yargs": "^17.0.33",
|
|
34
37
|
"@typescript-eslint/eslint-plugin": "^8.46.0",
|
|
35
38
|
"@typescript-eslint/parser": "^8.46.0",
|
|
39
|
+
"ajv": "^8.18.0",
|
|
36
40
|
"eslint": "9.32.0",
|
|
37
41
|
"eslint-config-prettier": "^9.1.2",
|
|
38
42
|
"eslint-plugin-prettier": "4.0.0",
|
|
@@ -45,7 +49,7 @@
|
|
|
45
49
|
},
|
|
46
50
|
"dependencies": {
|
|
47
51
|
"@devrev/typescript-sdk": "^1.1.59",
|
|
48
|
-
"axios": "^1.
|
|
52
|
+
"axios": "^1.13.5",
|
|
49
53
|
"axios-retry": "^4.5.0",
|
|
50
54
|
"express": "^5.2.1",
|
|
51
55
|
"form-data": "^4.0.4",
|