@devrev/airsync-sdk 2.0.0-beta.1 → 2.0.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -4
- package/dist/airsync-sdk.d.ts +1802 -0
- package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
- package/dist/attachments-streaming/attachments-streaming-pool.js +13 -2
- package/dist/attachments-streaming/attachments-streaming-pool.test.js +201 -6
- package/dist/common/constants.d.ts +16 -5
- package/dist/common/constants.d.ts.map +1 -1
- package/dist/common/constants.js +20 -6
- package/dist/common/control-protocol.d.ts +2 -2
- package/dist/common/control-protocol.d.ts.map +1 -1
- package/dist/common/control-protocol.js +1 -5
- package/dist/common/helpers.d.ts +8 -0
- package/dist/common/helpers.d.ts.map +1 -1
- package/dist/common/helpers.js +15 -0
- package/dist/common/install-initial-domain-mapping.d.ts +2 -2
- package/dist/common/install-initial-domain-mapping.test.js +5 -2
- package/dist/common/test-utils.d.ts +19 -0
- package/dist/common/test-utils.d.ts.map +1 -0
- package/dist/common/test-utils.js +101 -0
- package/dist/common/time-value-resolver.d.ts +47 -0
- package/dist/common/time-value-resolver.d.ts.map +1 -0
- package/dist/common/time-value-resolver.js +141 -0
- package/dist/common/time-value-resolver.test.d.ts +2 -0
- package/dist/common/time-value-resolver.test.d.ts.map +1 -0
- package/dist/common/time-value-resolver.test.js +268 -0
- package/dist/http/axios-client-internal.d.ts.map +1 -1
- package/dist/http/axios-client-internal.js +7 -0
- package/dist/http/axios-client-internal.test.js +21 -0
- package/dist/http/axios-client.d.ts.map +1 -1
- package/dist/http/axios-client.js +6 -3
- package/dist/http/index.d.ts +0 -1
- package/dist/http/index.d.ts.map +1 -1
- package/dist/http/index.js +0 -1
- package/dist/index.d.ts +9 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -10
- package/dist/logger/logger.d.ts +1 -17
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.interfaces.d.ts +2 -2
- package/dist/logger/logger.js +35 -27
- package/dist/logger/logger.test.js +66 -19
- package/dist/mappers/mappers.interface.d.ts +5 -5
- package/dist/mappers/mappers.interface.js +3 -3
- package/dist/mappers/mappers.test.js +8 -10
- package/dist/mock-server/mock-server.d.ts +47 -0
- package/dist/mock-server/mock-server.d.ts.map +1 -0
- package/dist/mock-server/mock-server.interfaces.d.ts +73 -0
- package/dist/mock-server/mock-server.interfaces.d.ts.map +1 -0
- package/dist/mock-server/mock-server.interfaces.js +4 -0
- package/dist/mock-server/mock-server.js +278 -0
- package/dist/multithreading/create-worker.test.js +36 -17
- package/dist/multithreading/process-task.d.ts.map +1 -1
- package/dist/multithreading/process-task.js +15 -48
- package/dist/multithreading/process-task.test.d.ts +2 -0
- package/dist/multithreading/process-task.test.d.ts.map +1 -0
- package/dist/multithreading/process-task.test.js +146 -0
- package/dist/multithreading/spawn/spawn.d.ts +3 -3
- package/dist/multithreading/spawn/spawn.d.ts.map +1 -1
- package/dist/multithreading/spawn/spawn.helpers.d.ts.map +1 -1
- package/dist/multithreading/spawn/spawn.helpers.js +6 -14
- package/dist/multithreading/spawn/spawn.helpers.test.js +8 -8
- package/dist/multithreading/spawn/spawn.js +20 -25
- package/dist/multithreading/spawn/spawn.test.d.ts +2 -0
- package/dist/multithreading/spawn/spawn.test.d.ts.map +1 -0
- package/dist/multithreading/spawn/spawn.test.js +232 -0
- package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.js +49 -1
- package/dist/multithreading/worker-adapter/worker-adapter.d.ts +11 -5
- package/dist/multithreading/worker-adapter/worker-adapter.d.ts.map +1 -1
- package/dist/multithreading/worker-adapter/worker-adapter.emit.test.d.ts +2 -0
- package/dist/multithreading/worker-adapter/worker-adapter.emit.test.d.ts.map +1 -0
- package/dist/multithreading/worker-adapter/worker-adapter.emit.test.js +390 -0
- package/dist/multithreading/worker-adapter/worker-adapter.extraction.test.d.ts +2 -0
- package/dist/multithreading/worker-adapter/worker-adapter.extraction.test.d.ts.map +1 -0
- package/dist/multithreading/worker-adapter/worker-adapter.extraction.test.js +799 -0
- package/dist/multithreading/worker-adapter/worker-adapter.js +232 -131
- package/dist/multithreading/worker-adapter/worker-adapter.loading.test.d.ts +2 -0
- package/dist/multithreading/worker-adapter/worker-adapter.loading.test.d.ts.map +1 -0
- package/dist/multithreading/worker-adapter/worker-adapter.loading.test.js +596 -0
- package/dist/multithreading/worker-adapter/worker-adapter.serialization.test.d.ts +2 -0
- package/dist/multithreading/worker-adapter/worker-adapter.serialization.test.d.ts.map +1 -0
- package/dist/multithreading/worker-adapter/worker-adapter.serialization.test.js +71 -0
- package/dist/repo/repo.d.ts.map +1 -1
- package/dist/repo/repo.interfaces.d.ts +4 -2
- package/dist/repo/repo.interfaces.d.ts.map +1 -1
- package/dist/repo/repo.js +4 -3
- package/dist/repo/repo.test.js +60 -7
- package/dist/state/state.d.ts +7 -1
- package/dist/state/state.d.ts.map +1 -1
- package/dist/state/state.extract-window.test.d.ts +2 -0
- package/dist/state/state.extract-window.test.d.ts.map +1 -0
- package/dist/state/state.extract-window.test.js +163 -0
- package/dist/state/state.interfaces.d.ts +17 -7
- package/dist/state/state.interfaces.d.ts.map +1 -1
- package/dist/state/state.interfaces.js +4 -2
- package/dist/state/state.js +111 -12
- package/dist/state/state.pending-boundaries.test.d.ts +2 -0
- package/dist/state/state.pending-boundaries.test.d.ts.map +1 -0
- package/dist/state/state.pending-boundaries.test.js +189 -0
- package/dist/state/state.post-state.test.d.ts +2 -0
- package/dist/state/state.post-state.test.d.ts.map +1 -0
- package/dist/state/state.post-state.test.js +77 -0
- package/dist/state/state.test.js +117 -73
- package/dist/state/state.time-value-resolution.test.d.ts +2 -0
- package/dist/state/state.time-value-resolution.test.d.ts.map +1 -0
- package/dist/state/state.time-value-resolution.test.js +175 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/common.d.ts +0 -25
- package/dist/types/common.d.ts.map +1 -1
- package/dist/types/common.js +1 -11
- package/dist/types/external-domain-metadata.d.ts +20 -1
- package/dist/types/external-domain-metadata.d.ts.map +1 -1
- package/dist/types/extraction.d.ts +89 -218
- package/dist/types/extraction.d.ts.map +1 -1
- package/dist/types/extraction.js +56 -124
- package/dist/types/extraction.test.js +69 -43
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +6 -3
- package/dist/types/loading.d.ts +4 -24
- package/dist/types/loading.d.ts.map +1 -1
- package/dist/types/loading.js +1 -22
- package/dist/types/workers.d.ts +31 -14
- package/dist/types/workers.d.ts.map +1 -1
- package/dist/types/workers.js +1 -0
- package/dist/uploader/uploader.d.ts +1 -0
- package/dist/uploader/uploader.d.ts.map +1 -1
- package/dist/uploader/uploader.helpers.test.js +0 -11
- package/dist/uploader/uploader.interfaces.d.ts +3 -3
- package/dist/uploader/uploader.js +53 -20
- package/dist/uploader/uploader.test.js +22 -10
- package/package.json +10 -13
- 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/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/types.d.ts +0 -17
- package/dist/http/types.d.ts.map +0 -1
- package/dist/http/types.js +0 -2
- 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
|
@@ -0,0 +1,1802 @@
|
|
|
1
|
+
import axios from 'axios';
|
|
2
|
+
import { AxiosError } from 'axios';
|
|
3
|
+
import { AxiosInstance } from 'axios';
|
|
4
|
+
import { AxiosResponse } from 'axios';
|
|
5
|
+
import { InputData } from '@devrev/typescript-sdk/dist/snap-ins';
|
|
6
|
+
import type { RawAxiosResponseHeaders } from 'axios';
|
|
7
|
+
import { Worker as Worker_2 } from 'worker_threads';
|
|
8
|
+
|
|
9
|
+
declare enum ActionType {
|
|
10
|
+
CREATED = "created",
|
|
11
|
+
UPDATED = "updated",
|
|
12
|
+
SKIPPED = "skipped",
|
|
13
|
+
DELETED = "deleted",
|
|
14
|
+
FAILED = "failed"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* AdapterState is an interface that defines the structure of the adapter state that is used by the external extractor.
|
|
19
|
+
* It extends the connector state with additional fields including snapInVersionId and attachmentsMetadata.
|
|
20
|
+
*/
|
|
21
|
+
export declare type AdapterState<ConnectorState> = ConnectorState & SdkState;
|
|
22
|
+
|
|
23
|
+
export declare enum AirSyncDefaultItemTypes {
|
|
24
|
+
EXTERNAL_DOMAIN_METADATA = "external_domain_metadata",
|
|
25
|
+
ATTACHMENTS = "attachments",
|
|
26
|
+
EXTERNAL_SYNC_UNITS = "external_sync_units"
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* AirSyncEvent is an interface that defines the structure of the event that is sent to the external extractor from the AirSync platform.
|
|
31
|
+
* It contains the context, payload, execution metadata, and input data as common snap-ins.
|
|
32
|
+
*/
|
|
33
|
+
export declare interface AirSyncEvent {
|
|
34
|
+
context: {
|
|
35
|
+
secrets: {
|
|
36
|
+
service_account_token: string;
|
|
37
|
+
};
|
|
38
|
+
snap_in_version_id: string;
|
|
39
|
+
snap_in_id: string;
|
|
40
|
+
};
|
|
41
|
+
payload: AirSyncMessage;
|
|
42
|
+
execution_metadata: {
|
|
43
|
+
devrev_endpoint: string;
|
|
44
|
+
};
|
|
45
|
+
input_data: InputData;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* AirSyncMessage is an interface that defines the structure of the payload/message that is sent to the external extractor from the AirSync platform.
|
|
50
|
+
*/
|
|
51
|
+
export declare interface AirSyncMessage {
|
|
52
|
+
connection_data: ConnectionData;
|
|
53
|
+
event_context: EventContext;
|
|
54
|
+
event_type: EventType;
|
|
55
|
+
event_data?: EventData;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* Artifact is an interface that defines the structure of an artifact. Artifact is a file that is generated by the extractor and uploaded to the AirSync platform.
|
|
60
|
+
*/
|
|
61
|
+
export declare interface Artifact {
|
|
62
|
+
id: string;
|
|
63
|
+
item_type: string;
|
|
64
|
+
item_count: number;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* ArtifactsPrepareResponse is an interface that defines the structure of the response from the prepare artifacts endpoint.
|
|
69
|
+
*/
|
|
70
|
+
export declare interface ArtifactsPrepareResponse {
|
|
71
|
+
url: string;
|
|
72
|
+
id: string;
|
|
73
|
+
form_data: {
|
|
74
|
+
key: string;
|
|
75
|
+
value: string;
|
|
76
|
+
}[];
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Attachments configuration for a record type.
|
|
81
|
+
*/
|
|
82
|
+
declare interface Attachments {
|
|
83
|
+
/** Whether attachments can be extracted */
|
|
84
|
+
is_extractable?: boolean;
|
|
85
|
+
/** Whether attachments can be loaded: that is, whether the connector supports creating it in the system */
|
|
86
|
+
is_loadable?: boolean;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export { axios }
|
|
90
|
+
|
|
91
|
+
export declare const axiosClient: AxiosInstance;
|
|
92
|
+
|
|
93
|
+
declare interface AxiosErrorResponse {
|
|
94
|
+
config: {
|
|
95
|
+
method: string | undefined;
|
|
96
|
+
params: any;
|
|
97
|
+
url: string | undefined;
|
|
98
|
+
};
|
|
99
|
+
isAxiosError: boolean;
|
|
100
|
+
isCorsOrNoNetworkError: boolean;
|
|
101
|
+
response?: {
|
|
102
|
+
data: unknown;
|
|
103
|
+
headers: RawAxiosResponseHeaders;
|
|
104
|
+
status: number;
|
|
105
|
+
statusText: string;
|
|
106
|
+
};
|
|
107
|
+
code?: string;
|
|
108
|
+
message?: string;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Collection constraints for fields that are collections of values.
|
|
113
|
+
*/
|
|
114
|
+
export declare interface CollectionData {
|
|
115
|
+
min_length?: number;
|
|
116
|
+
max_length?: number;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Conditional privilege data for authorization.
|
|
121
|
+
*/
|
|
122
|
+
export declare interface ConditionalPrivilegeData {
|
|
123
|
+
/** The possible record types or record type categories that can be targeted in conditional privilege. */
|
|
124
|
+
type_keys: RecordTypeKey[];
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* ConnectionData is an interface that defines the structure of the connection data that is sent to the external extractor from the AirSync platform.
|
|
129
|
+
* It contains the organization ID, organization name, key, and key type.
|
|
130
|
+
*/
|
|
131
|
+
export declare interface ConnectionData {
|
|
132
|
+
org_id: string;
|
|
133
|
+
org_name: string;
|
|
134
|
+
key: string;
|
|
135
|
+
key_type: string;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Creates a mock AirSyncEvent for testing.
|
|
140
|
+
*
|
|
141
|
+
* @param mockServerUrl - Base URL for the mock server. Defaults to {@link MOCK_SERVER_DEFAULT_URL}.
|
|
142
|
+
* The `callback_url`, `worker_data_url`, and `devrev_endpoint` fields are
|
|
143
|
+
* derived from this value unless explicitly overridden.
|
|
144
|
+
* @param overrides - Deep partial of AirSyncEvent. Any provided fields are
|
|
145
|
+
* deep-merged on top of the defaults.
|
|
146
|
+
*/
|
|
147
|
+
export declare function createMockEvent(mockServerUrl?: string, overrides?: DeepPartial<AirSyncEvent>): AirSyncEvent;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Custom link data for defining link types.
|
|
151
|
+
*/
|
|
152
|
+
export declare interface CustomLinkData {
|
|
153
|
+
/** The field that defines the link types in the system. */
|
|
154
|
+
link_type_field: FieldKey;
|
|
155
|
+
link_direction_names: Record<string, CustomLinkNames> | null;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Custom link names for forward and backward directions.
|
|
160
|
+
*/
|
|
161
|
+
export declare interface CustomLinkNames {
|
|
162
|
+
/** The forward name of the link */
|
|
163
|
+
forward_name: string;
|
|
164
|
+
/** The backward name of the link */
|
|
165
|
+
backward_name: string;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Custom stage definition in a stage diagram.
|
|
170
|
+
*/
|
|
171
|
+
export declare interface CustomStage {
|
|
172
|
+
/** 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'. */
|
|
173
|
+
state?: StateKey;
|
|
174
|
+
/** A list of stage names that this stage can transition to. */
|
|
175
|
+
transitions_to?: StageKey[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* Custom state definition in a stage diagram.
|
|
180
|
+
*/
|
|
181
|
+
export declare interface CustomState {
|
|
182
|
+
/** The human readable name of the custom state. */
|
|
183
|
+
name: string;
|
|
184
|
+
/** Denotes that this state is an end state. */
|
|
185
|
+
is_end_state?: boolean;
|
|
186
|
+
/** The sort order of the state. */
|
|
187
|
+
ordinal?: number;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
/**
|
|
191
|
+
* Recursively makes all properties of T optional.
|
|
192
|
+
*/
|
|
193
|
+
export declare type DeepPartial<T> = {
|
|
194
|
+
[P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
declare type DonV2 = string;
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Enum field data containing possible values.
|
|
201
|
+
*/
|
|
202
|
+
export declare interface EnumData {
|
|
203
|
+
values: EnumValue[];
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Enum value definition.
|
|
208
|
+
*/
|
|
209
|
+
export declare interface EnumValue {
|
|
210
|
+
/** The enum value that actually occurs in the json data */
|
|
211
|
+
key: EnumValueKey;
|
|
212
|
+
/** The human readable name of the enum value */
|
|
213
|
+
name?: string;
|
|
214
|
+
description?: string;
|
|
215
|
+
/** Deprecated enum values may still occur in the data, but should not be used in new data */
|
|
216
|
+
is_deprecated?: boolean;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/** Key identifying an enum value in EnumValue.key or stage diagram stages map keys. */
|
|
220
|
+
export declare type EnumValueKey = string;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* ErrorRecord is an interface that defines the structure of an error record.
|
|
224
|
+
*/
|
|
225
|
+
export declare interface ErrorRecord {
|
|
226
|
+
message: string;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* EventContext is an interface that defines the structure of the event context that is sent to the external connector from AirSync.
|
|
231
|
+
*/
|
|
232
|
+
export declare interface EventContext {
|
|
233
|
+
callback_url: string;
|
|
234
|
+
dev_oid: string;
|
|
235
|
+
dev_org_id: string;
|
|
236
|
+
dev_uid: string;
|
|
237
|
+
event_type_adaas: string;
|
|
238
|
+
external_sync_unit_id: string;
|
|
239
|
+
external_sync_unit_name: string;
|
|
240
|
+
external_system_id: string;
|
|
241
|
+
external_system_name: string;
|
|
242
|
+
external_system_type: string;
|
|
243
|
+
/**
|
|
244
|
+
* Resolved start timestamp of extraction (ISO 8601 format).
|
|
245
|
+
* Automatically computed by the SDK from extraction_start_time and worker state.
|
|
246
|
+
* This is the field developers should read to know when to start extracting from.
|
|
247
|
+
*/
|
|
248
|
+
extract_from?: string;
|
|
249
|
+
import_slug: string;
|
|
250
|
+
initial_sync_scope?: InitialSyncScope;
|
|
251
|
+
mode: string;
|
|
252
|
+
request_id: string;
|
|
253
|
+
request_id_adaas: string;
|
|
254
|
+
run_id: string;
|
|
255
|
+
sequence_version: string;
|
|
256
|
+
snap_in_slug: string;
|
|
257
|
+
snap_in_version_id: string;
|
|
258
|
+
sync_tier: string;
|
|
259
|
+
sync_unit: DonV2;
|
|
260
|
+
sync_unit_id: string;
|
|
261
|
+
worker_data_url: string;
|
|
262
|
+
/**
|
|
263
|
+
* Start time value for extraction, as sent by the platform.
|
|
264
|
+
* The SDK resolves this into a concrete ISO 8601 timestamp on extract_from.
|
|
265
|
+
*/
|
|
266
|
+
extraction_start_time?: TimeValue;
|
|
267
|
+
/**
|
|
268
|
+
* End time value for extraction, as sent by the platform.
|
|
269
|
+
* The SDK resolves this into a concrete ISO 8601 timestamp on extract_to.
|
|
270
|
+
*/
|
|
271
|
+
extraction_end_time?: TimeValue;
|
|
272
|
+
/**
|
|
273
|
+
* Resolved end timestamp of extraction (ISO 8601 format).
|
|
274
|
+
* Automatically computed by the SDK from extraction_end_time and worker state.
|
|
275
|
+
* This is the field developers should read to know when to stop extracting at.
|
|
276
|
+
*/
|
|
277
|
+
extract_to?: string;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* EventData is an interface that defines the structure of the event data that is sent from the external extractor to the AirSync platform.
|
|
282
|
+
*/
|
|
283
|
+
export declare interface EventData {
|
|
284
|
+
error?: ErrorRecord;
|
|
285
|
+
delay?: number;
|
|
286
|
+
artifacts?: Artifact[];
|
|
287
|
+
reports?: LoaderReport[];
|
|
288
|
+
processed_files?: string[];
|
|
289
|
+
stats_file?: string;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* EventType is an enum that defines the different types of events that can be sent to the external extractor from the AirSync platform.
|
|
294
|
+
* The external extractor can use these events to know what to do next in the extraction process.
|
|
295
|
+
*/
|
|
296
|
+
export declare enum EventType {
|
|
297
|
+
StartExtractingExternalSyncUnits = "START_EXTRACTING_EXTERNAL_SYNC_UNITS",
|
|
298
|
+
StartExtractingMetadata = "START_EXTRACTING_METADATA",
|
|
299
|
+
StartExtractingData = "START_EXTRACTING_DATA",
|
|
300
|
+
ContinueExtractingData = "CONTINUE_EXTRACTING_DATA",
|
|
301
|
+
StartDeletingExtractorState = "START_DELETING_EXTRACTOR_STATE",
|
|
302
|
+
StartExtractingAttachments = "START_EXTRACTING_ATTACHMENTS",
|
|
303
|
+
ContinueExtractingAttachments = "CONTINUE_EXTRACTING_ATTACHMENTS",
|
|
304
|
+
StartDeletingExtractorAttachmentsState = "START_DELETING_EXTRACTOR_ATTACHMENTS_STATE",
|
|
305
|
+
StartLoadingData = "START_LOADING_DATA",
|
|
306
|
+
ContinueLoadingData = "CONTINUE_LOADING_DATA",
|
|
307
|
+
StartLoadingAttachments = "START_LOADING_ATTACHMENTS",
|
|
308
|
+
ContinueLoadingAttachments = "CONTINUE_LOADING_ATTACHMENTS",
|
|
309
|
+
StartDeletingLoaderState = "START_DELETING_LOADER_STATE",
|
|
310
|
+
StartDeletingLoaderAttachmentState = "START_DELETING_LOADER_ATTACHMENT_STATE",
|
|
311
|
+
UnknownEventType = "UNKNOWN_EVENT_TYPE"
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
/**
|
|
315
|
+
* External domain metadata describing the logical structure of an external system.
|
|
316
|
+
*/
|
|
317
|
+
export declare interface ExternalDomainMetadata {
|
|
318
|
+
/** The record types in the domain */
|
|
319
|
+
record_types: Record<RecordTypeKey, RecordType>;
|
|
320
|
+
/** Record type categories */
|
|
321
|
+
record_type_categories?: Record<RecordTypeCategoryKey, RecordTypeCategory>;
|
|
322
|
+
/** Struct types for reusable field structures */
|
|
323
|
+
struct_types?: Record<StructTypeKey, StructType>;
|
|
324
|
+
/** The schema version of the metadata format itself. */
|
|
325
|
+
schema_version?: SchemaVersion;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export declare type ExternalProcessAttachmentFunction = ({ attachment, stream, }: {
|
|
329
|
+
attachment: NormalizedAttachment;
|
|
330
|
+
stream: ExternalSystemAttachmentStreamingFunction;
|
|
331
|
+
}) => Promise<ProcessAttachmentReturnType>;
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* ExternalSyncUnit is an interface that defines the structure of an external sync unit (repos, projects, ...) that can be extracted.
|
|
335
|
+
* It must contain an ID, a name, and a description. It can also contain the number of items in the external sync unit.
|
|
336
|
+
*/
|
|
337
|
+
export declare interface ExternalSyncUnit {
|
|
338
|
+
id: string;
|
|
339
|
+
name: string;
|
|
340
|
+
description: string;
|
|
341
|
+
item_count?: number;
|
|
342
|
+
item_type?: string;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
export declare interface ExternalSystemAttachment {
|
|
346
|
+
reference_id: DonV2;
|
|
347
|
+
parent_type: string;
|
|
348
|
+
parent_reference_id: DonV2;
|
|
349
|
+
file_name: string;
|
|
350
|
+
file_type: string;
|
|
351
|
+
file_size: number;
|
|
352
|
+
url: string;
|
|
353
|
+
valid_until: string;
|
|
354
|
+
created_by_id: string;
|
|
355
|
+
created_date: string;
|
|
356
|
+
modified_by_id: string;
|
|
357
|
+
modified_date: string;
|
|
358
|
+
parent_id?: string;
|
|
359
|
+
grand_parent_id?: string;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
export declare type ExternalSystemAttachmentIteratorFunction<NewBatch, ConnectorState> = ({ reducedAttachments, adapter, stream, }: {
|
|
363
|
+
reducedAttachments: NewBatch;
|
|
364
|
+
adapter: WorkerAdapter<ConnectorState>;
|
|
365
|
+
stream: ExternalSystemAttachmentStreamingFunction;
|
|
366
|
+
}) => Promise<ProcessAttachmentReturnType>;
|
|
367
|
+
|
|
368
|
+
declare interface ExternalSystemAttachmentProcessors<ConnectorState, Batch, NewBatch> {
|
|
369
|
+
reducer: ExternalSystemAttachmentReducerFunction<Batch, NewBatch, ConnectorState>;
|
|
370
|
+
iterator: ExternalSystemAttachmentIteratorFunction<NewBatch, ConnectorState>;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export declare type ExternalSystemAttachmentReducerFunction<Batch, NewBatch, ConnectorState> = ({ attachments, adapter, batchSize, }: {
|
|
374
|
+
attachments: Batch;
|
|
375
|
+
adapter: WorkerAdapter<ConnectorState>;
|
|
376
|
+
batchSize?: number;
|
|
377
|
+
}) => NewBatch;
|
|
378
|
+
|
|
379
|
+
export declare type ExternalSystemAttachmentStreamingFunction = ({ item, event, }: ExternalSystemAttachmentStreamingParams) => Promise<ExternalSystemAttachmentStreamingResponse>;
|
|
380
|
+
|
|
381
|
+
export declare interface ExternalSystemAttachmentStreamingParams {
|
|
382
|
+
item: NormalizedAttachment;
|
|
383
|
+
event: AirSyncEvent;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
export declare interface ExternalSystemAttachmentStreamingResponse {
|
|
387
|
+
httpStream?: AxiosResponse;
|
|
388
|
+
error?: ErrorRecord;
|
|
389
|
+
delay?: number;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
export declare interface ExternalSystemItem {
|
|
393
|
+
id: {
|
|
394
|
+
devrev: DonV2;
|
|
395
|
+
external?: string;
|
|
396
|
+
};
|
|
397
|
+
created_date: string;
|
|
398
|
+
modified_date: string;
|
|
399
|
+
data: any;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
export declare interface ExternalSystemItem {
|
|
403
|
+
id: {
|
|
404
|
+
devrev: DonV2;
|
|
405
|
+
external?: string;
|
|
406
|
+
};
|
|
407
|
+
created_date: string;
|
|
408
|
+
modified_date: string;
|
|
409
|
+
data: any;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export declare interface ExternalSystemItemLoadingParams<Type> {
|
|
413
|
+
item: Type;
|
|
414
|
+
mappers: Mappers;
|
|
415
|
+
event: AirSyncEvent;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export declare interface ExternalSystemItemLoadingResponse {
|
|
419
|
+
id?: string;
|
|
420
|
+
error?: string;
|
|
421
|
+
modifiedDate?: string;
|
|
422
|
+
delay?: number;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
declare type ExternalSystemLoadingFunction<Item> = ({ item, mappers, event, }: ExternalSystemItemLoadingParams<Item>) => Promise<ExternalSystemItemLoadingResponse>;
|
|
426
|
+
|
|
427
|
+
export declare const enum ExtractionCommonError {
|
|
428
|
+
EXTERNAL_SYNC_UNIT_DELETED = "ERROR_CODE=EXTERNAL_SYNC_UNIT_DELETED",
|
|
429
|
+
EXTERNAL_SYNC_UNIT_DEACTIVATED = "ERROR_CODE=EXTERNAL_SYNC_UNIT_DEACTIVATED",
|
|
430
|
+
USER_DELETED = "ERROR_CODE=USER_DELETED"
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* ExtractionScope represents the parsed extraction scope from the platform.
|
|
435
|
+
* Each key is an item type name, and the value indicates whether it should be extracted.
|
|
436
|
+
*/
|
|
437
|
+
export declare type ExtractionScope = Record<string, {
|
|
438
|
+
extract: boolean;
|
|
439
|
+
}>;
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
|
+
* ExtractorEvent is an interface that defines the structure of the event that is sent from the external extractor to the AirSync platform.
|
|
443
|
+
* It contains the event type, event context, extractor state, and event data.
|
|
444
|
+
*/
|
|
445
|
+
export declare interface ExtractorEvent {
|
|
446
|
+
event_type: string;
|
|
447
|
+
event_context: EventContext;
|
|
448
|
+
event_data?: EventData;
|
|
449
|
+
worker_metadata?: WorkerMetadata;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* ExtractorEventType is an enum that defines the different types of events that can be sent from the external extractor to the AirSync platform.
|
|
454
|
+
* The external extractor can use these events to inform the AirSync platform about the progress of the extraction process.
|
|
455
|
+
*/
|
|
456
|
+
export declare enum ExtractorEventType {
|
|
457
|
+
ExternalSyncUnitExtractionDone = "EXTERNAL_SYNC_UNIT_EXTRACTION_DONE",
|
|
458
|
+
ExternalSyncUnitExtractionError = "EXTERNAL_SYNC_UNIT_EXTRACTION_ERROR",
|
|
459
|
+
MetadataExtractionDone = "METADATA_EXTRACTION_DONE",
|
|
460
|
+
MetadataExtractionError = "METADATA_EXTRACTION_ERROR",
|
|
461
|
+
DataExtractionProgress = "DATA_EXTRACTION_PROGRESS",
|
|
462
|
+
DataExtractionDelayed = "DATA_EXTRACTION_DELAYED",
|
|
463
|
+
DataExtractionDone = "DATA_EXTRACTION_DONE",
|
|
464
|
+
DataExtractionError = "DATA_EXTRACTION_ERROR",
|
|
465
|
+
ExtractorStateDeletionDone = "EXTRACTOR_STATE_DELETION_DONE",
|
|
466
|
+
ExtractorStateDeletionError = "EXTRACTOR_STATE_DELETION_ERROR",
|
|
467
|
+
AttachmentExtractionProgress = "ATTACHMENT_EXTRACTION_PROGRESS",
|
|
468
|
+
AttachmentExtractionDelayed = "ATTACHMENT_EXTRACTION_DELAYED",
|
|
469
|
+
AttachmentExtractionDone = "ATTACHMENT_EXTRACTION_DONE",
|
|
470
|
+
AttachmentExtractionError = "ATTACHMENT_EXTRACTION_ERROR",
|
|
471
|
+
ExtractorAttachmentsStateDeletionDone = "EXTRACTOR_ATTACHMENTS_STATE_DELETION_DONE",
|
|
472
|
+
ExtractorAttachmentsStateDeletionError = "EXTRACTOR_ATTACHMENTS_STATE_DELETION_ERROR",
|
|
473
|
+
UnknownEventType = "UNKNOWN_EVENT_TYPE"
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
|
+
* Field definition with type discriminator and type-specific data.
|
|
478
|
+
*/
|
|
479
|
+
export declare interface Field {
|
|
480
|
+
/** The type of the field */
|
|
481
|
+
type: FieldType;
|
|
482
|
+
/** The human readable name of the field */
|
|
483
|
+
name?: string;
|
|
484
|
+
description?: string;
|
|
485
|
+
/** Required fields are required in the domain model of the external system. */
|
|
486
|
+
is_required?: boolean;
|
|
487
|
+
/** Read only fields can't be set (when creating or updating a record), but are filled in by some process in the system. */
|
|
488
|
+
is_read_only?: boolean | null;
|
|
489
|
+
/** Fields that are write only should only be written to. */
|
|
490
|
+
is_write_only?: boolean | null;
|
|
491
|
+
/** Indexed fields can be used for searching, sorting or filtering. */
|
|
492
|
+
is_indexed?: boolean | null;
|
|
493
|
+
/** Indicates that the field can be used to uniquely lookup a record. */
|
|
494
|
+
is_identifier?: boolean | null;
|
|
495
|
+
/** Default value for the field */
|
|
496
|
+
default_value?: boolean | number | string;
|
|
497
|
+
/** If collection is set, the field is a 'collection' of the given type. */
|
|
498
|
+
collection?: CollectionData;
|
|
499
|
+
int?: IntData;
|
|
500
|
+
float?: FloatData;
|
|
501
|
+
text?: TextData;
|
|
502
|
+
enum?: EnumData | null;
|
|
503
|
+
reference?: ReferenceData;
|
|
504
|
+
typed_reference?: TypedReferenceData;
|
|
505
|
+
struct?: StructData;
|
|
506
|
+
permission?: PermissionData;
|
|
507
|
+
type_key?: TargetTypeKeyData;
|
|
508
|
+
field_reference?: FieldReferenceData;
|
|
509
|
+
record_type_privilege?: RecordTypePrivilegeData;
|
|
510
|
+
field_privilege?: FieldPrivilegeData;
|
|
511
|
+
conditional_privilege?: ConditionalPrivilegeData;
|
|
512
|
+
participation?: ParticipationData;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
/**
|
|
516
|
+
* Field condition definition.
|
|
517
|
+
*/
|
|
518
|
+
export declare interface FieldCondition {
|
|
519
|
+
/** The value of the controlling field that will be compared against to see if the condition is met. */
|
|
520
|
+
value: unknown;
|
|
521
|
+
/** The comparator that will be used to compare the controlling field's value against the Value. */
|
|
522
|
+
comparator: FieldConditionComparator;
|
|
523
|
+
/** The fields that will be affected by the condition being met. */
|
|
524
|
+
affected_fields: FieldKey[];
|
|
525
|
+
/** The effect that will be applied to the affected fields if the condition is met. */
|
|
526
|
+
effect: FieldConditionEffect;
|
|
527
|
+
}
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Comparator for field conditions.
|
|
531
|
+
*/
|
|
532
|
+
export declare type FieldConditionComparator = 'eq' | 'ne';
|
|
533
|
+
|
|
534
|
+
/**
|
|
535
|
+
* Effect applied when a field condition is met.
|
|
536
|
+
*/
|
|
537
|
+
export declare type FieldConditionEffect = 'require' | 'show';
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
|
+
* Array of field conditions.
|
|
541
|
+
*/
|
|
542
|
+
export declare type FieldConditions = FieldCondition[];
|
|
543
|
+
|
|
544
|
+
/** Key identifying a field within a record type or struct type fields map. */
|
|
545
|
+
export declare type FieldKey = string;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Field privilege data for authorization.
|
|
549
|
+
*/
|
|
550
|
+
export declare interface FieldPrivilegeData {
|
|
551
|
+
/** The possible record types or record type categories that can be targeted in field privilege. */
|
|
552
|
+
type_keys: RecordTypeKey[];
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Field reference data (currently empty, reserved for future use).
|
|
557
|
+
*/
|
|
558
|
+
export declare interface FieldReferenceData {
|
|
559
|
+
[key: string]: never;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Field type discriminator.
|
|
564
|
+
*/
|
|
565
|
+
export declare type FieldType = 'bool' | 'int' | 'float' | 'text' | 'rich_text' | 'reference' | 'typed_reference' | 'enum' | 'date' | 'timestamp' | 'struct' | 'permission' | 'record_type_privilege' | 'field_privilege' | 'conditional_privilege' | 'participation';
|
|
566
|
+
|
|
567
|
+
declare interface FileToLoad {
|
|
568
|
+
id: string;
|
|
569
|
+
file_name: string;
|
|
570
|
+
itemType: string;
|
|
571
|
+
count: number;
|
|
572
|
+
lineToProcess: number;
|
|
573
|
+
completed: boolean;
|
|
574
|
+
}
|
|
575
|
+
|
|
576
|
+
/**
|
|
577
|
+
* Float field constraints.
|
|
578
|
+
*/
|
|
579
|
+
export declare interface FloatData {
|
|
580
|
+
min?: number;
|
|
581
|
+
max?: number;
|
|
582
|
+
}
|
|
583
|
+
|
|
584
|
+
declare interface FromDevRev {
|
|
585
|
+
filesToLoad: FileToLoad[];
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* GetWorkerPathInterface is an interface for getting the worker path.
|
|
590
|
+
*/
|
|
591
|
+
export declare interface GetWorkerPathInterface {
|
|
592
|
+
event: AirSyncEvent;
|
|
593
|
+
workerBasePath?: string | null;
|
|
594
|
+
}
|
|
595
|
+
|
|
596
|
+
/**
|
|
597
|
+
* InitialDomainMapping is an interface that defines the structure of the initial domain mapping.
|
|
598
|
+
*/
|
|
599
|
+
export declare interface InitialDomainMapping {
|
|
600
|
+
starting_recipe_blueprint?: object;
|
|
601
|
+
additional_mappings?: object;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
/**
|
|
605
|
+
* InitialSyncScope is an enum that defines the different scopes of initial sync that can be used by the external extractor.
|
|
606
|
+
*/
|
|
607
|
+
export declare enum InitialSyncScope {
|
|
608
|
+
FULL_HISTORY = "full-history",
|
|
609
|
+
TIME_SCOPED = "time-scoped"
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
export declare function installInitialDomainMapping(event: AirSyncEvent, initialDomainMappingJson: InitialDomainMapping): Promise<void>;
|
|
613
|
+
|
|
614
|
+
/**
|
|
615
|
+
* Integer field constraints.
|
|
616
|
+
*/
|
|
617
|
+
export declare interface IntData {
|
|
618
|
+
min?: number;
|
|
619
|
+
max?: number;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Item is an interface that defines the structure of an item.
|
|
624
|
+
*/
|
|
625
|
+
declare type Item = Record<string, any>;
|
|
626
|
+
|
|
627
|
+
declare interface ItemTypesToLoadParams {
|
|
628
|
+
itemTypesToLoad: ItemTypeToLoad[];
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
declare interface ItemTypeToLoad {
|
|
632
|
+
itemType: string;
|
|
633
|
+
create: ExternalSystemLoadingFunction<ExternalSystemItem>;
|
|
634
|
+
update: ExternalSystemLoadingFunction<ExternalSystemItem>;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
export declare enum LoaderEventType {
|
|
638
|
+
DataLoadingProgress = "DATA_LOADING_PROGRESS",
|
|
639
|
+
DataLoadingDelayed = "DATA_LOADING_DELAYED",
|
|
640
|
+
DataLoadingDone = "DATA_LOADING_DONE",
|
|
641
|
+
DataLoadingError = "DATA_LOADING_ERROR",
|
|
642
|
+
AttachmentLoadingProgress = "ATTACHMENT_LOADING_PROGRESS",
|
|
643
|
+
AttachmentLoadingDelayed = "ATTACHMENT_LOADING_DELAYED",
|
|
644
|
+
AttachmentLoadingDone = "ATTACHMENT_LOADING_DONE",
|
|
645
|
+
AttachmentLoadingError = "ATTACHMENT_LOADING_ERROR",
|
|
646
|
+
LoaderStateDeletionDone = "LOADER_STATE_DELETION_DONE",
|
|
647
|
+
LoaderStateDeletionError = "LOADER_STATE_DELETION_ERROR",
|
|
648
|
+
LoaderAttachmentStateDeletionDone = "LOADER_ATTACHMENT_STATE_DELETION_DONE",
|
|
649
|
+
LoaderAttachmentStateDeletionError = "LOADER_ATTACHMENT_STATE_DELETION_ERROR",
|
|
650
|
+
UnknownEventType = "UNKNOWN_EVENT_TYPE"
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
declare interface LoaderReport {
|
|
654
|
+
item_type: string;
|
|
655
|
+
[ActionType.CREATED]?: number;
|
|
656
|
+
[ActionType.UPDATED]?: number;
|
|
657
|
+
[ActionType.SKIPPED]?: number;
|
|
658
|
+
[ActionType.DELETED]?: number;
|
|
659
|
+
[ActionType.FAILED]?: number;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
declare interface LoadItemResponse {
|
|
663
|
+
error?: ErrorRecord;
|
|
664
|
+
report?: LoaderReport;
|
|
665
|
+
rateLimit?: RateLimited;
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
declare interface LoadItemTypesResponse {
|
|
669
|
+
reports: LoaderReport[];
|
|
670
|
+
processed_files: string[];
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
declare enum LogLevel {
|
|
674
|
+
INFO = "info",
|
|
675
|
+
WARN = "warn",
|
|
676
|
+
ERROR = "error"
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
/**
|
|
680
|
+
* Manages sync mapper records that link external system items to DevRev items.
|
|
681
|
+
*
|
|
682
|
+
* Used for tracking relationships between external and DevRev entities during sync operations.
|
|
683
|
+
*/
|
|
684
|
+
declare class Mappers {
|
|
685
|
+
private devrevApiEndpoint;
|
|
686
|
+
private devrevApiToken;
|
|
687
|
+
constructor({ event }: MappersFactoryInterface);
|
|
688
|
+
/**
|
|
689
|
+
* Retrieves a sync mapper record by DevRev ID.
|
|
690
|
+
*
|
|
691
|
+
* Used to find the mapping when you know the DevRev ID and want to find the external system ID.
|
|
692
|
+
*
|
|
693
|
+
* @param params - Query parameters of type MappersGetByTargetIdParams
|
|
694
|
+
* @returns Promise with response data containing the sync mapper record
|
|
695
|
+
*/
|
|
696
|
+
getByTargetId(params: MappersGetByTargetIdParams): Promise<AxiosResponse<MappersGetByTargetIdResponse>>;
|
|
697
|
+
/**
|
|
698
|
+
* Retrieves a sync mapper record by external system ID.
|
|
699
|
+
*
|
|
700
|
+
* Used to find the mapping when you know the external system ID and want to find the DevRev ID.
|
|
701
|
+
*
|
|
702
|
+
* @param params - Query parameters of type MappersGetByExternalIdParams
|
|
703
|
+
* @returns Promise with response data containing the sync mapper record
|
|
704
|
+
*/
|
|
705
|
+
getByExternalId(params: MappersGetByExternalIdParams): Promise<AxiosResponse<MappersGetByExternalIdResponse>>;
|
|
706
|
+
/**
|
|
707
|
+
* Creates a new sync mapper record to establish a relationship between external system
|
|
708
|
+
* entities and DevRev entities.
|
|
709
|
+
*
|
|
710
|
+
* This is called after importing an item from external system to DevRev to record
|
|
711
|
+
* the mapping for future synchronization operations.
|
|
712
|
+
*
|
|
713
|
+
* @param params - Creation parameters of type MappersCreateParams
|
|
714
|
+
* @returns Promise with response data containing the created sync mapper record
|
|
715
|
+
*/
|
|
716
|
+
create(params: MappersCreateParams): Promise<AxiosResponse<MappersCreateResponse>>;
|
|
717
|
+
/**
|
|
718
|
+
* Updates an existing sync mapper record.
|
|
719
|
+
*
|
|
720
|
+
* Used to modify existing mappings when external system entities change or when
|
|
721
|
+
* additional DevRev entities need to be associated.
|
|
722
|
+
*
|
|
723
|
+
* @param params - Update parameters of type MappersUpdateParams
|
|
724
|
+
* @returns Promise with response data containing the updated sync mapper record
|
|
725
|
+
*/
|
|
726
|
+
update(params: MappersUpdateParams): Promise<AxiosResponse<MappersUpdateResponse>>;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Parameters for creating a new sync mapper record.
|
|
731
|
+
*/
|
|
732
|
+
export declare interface MappersCreateParams {
|
|
733
|
+
/** The sync unit ID that scopes the synchronization context */
|
|
734
|
+
sync_unit: DonV2;
|
|
735
|
+
/** Array of external system identifiers */
|
|
736
|
+
external_ids: string[];
|
|
737
|
+
/**
|
|
738
|
+
* Optional map that labels values in `external_ids` with their usage context.
|
|
739
|
+
* Use when an external system requires different identifiers for different API calls
|
|
740
|
+
* (for example, a UUID for one endpoint and a login username for another).
|
|
741
|
+
*
|
|
742
|
+
* Example:
|
|
743
|
+
* external_ids: ["2a1c...-uuid", "john_doe"]
|
|
744
|
+
* secondary_ids: { "username": "john_doe" }
|
|
745
|
+
*
|
|
746
|
+
* Note: Values in `secondary_ids` are not indexed. If you need to look up by a
|
|
747
|
+
* secondary value (e.g., username), you must also include that value in `external_ids`.
|
|
748
|
+
*/
|
|
749
|
+
secondary_ids?: Record<string, string>;
|
|
750
|
+
/** Array of DevRev entity IDs this mapping points to */
|
|
751
|
+
targets: DonV2[];
|
|
752
|
+
status: SyncMapperRecordStatus;
|
|
753
|
+
/**
|
|
754
|
+
* Input file names where the object was encountered.
|
|
755
|
+
* Used for observability and tracking.
|
|
756
|
+
*/
|
|
757
|
+
input_files?: string[];
|
|
758
|
+
/**
|
|
759
|
+
* External version markers used to avoid update loops.
|
|
760
|
+
* After creating or updating the object in the external system, add its
|
|
761
|
+
* modified_date here. On subsequent extraction, the Loader skips applying the
|
|
762
|
+
* update if the modified_date is present (change originated in DevRev).
|
|
763
|
+
*/
|
|
764
|
+
external_versions?: SyncMapperRecordExternalVersion[];
|
|
765
|
+
/**
|
|
766
|
+
* Opaque data for storing additional client-specific information.
|
|
767
|
+
* Fully managed by snapin authors.
|
|
768
|
+
*/
|
|
769
|
+
extra_data?: string;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
/**
|
|
773
|
+
* Response containing the newly created sync mapper record.
|
|
774
|
+
*/
|
|
775
|
+
declare interface MappersCreateResponse {
|
|
776
|
+
sync_mapper_record: SyncMapperRecord;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/**
|
|
780
|
+
* Configuration interface for creating a Mappers instance.
|
|
781
|
+
*/
|
|
782
|
+
declare interface MappersFactoryInterface {
|
|
783
|
+
event: AirSyncEvent;
|
|
784
|
+
options?: WorkerAdapterOptions;
|
|
785
|
+
}
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Parameters for retrieving a sync mapper record by external system ID.
|
|
789
|
+
*/
|
|
790
|
+
export declare interface MappersGetByExternalIdParams {
|
|
791
|
+
/** The sync unit ID that scopes the synchronization context */
|
|
792
|
+
sync_unit: DonV2;
|
|
793
|
+
/** The identifier from the external system */
|
|
794
|
+
external_id: string;
|
|
795
|
+
/** The type of DevRev entity to look for */
|
|
796
|
+
target_type: SyncMapperRecordTargetType;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
|
+
* Response containing a sync mapper record retrieved by external ID.
|
|
801
|
+
*/
|
|
802
|
+
declare interface MappersGetByExternalIdResponse {
|
|
803
|
+
sync_mapper_record: SyncMapperRecord;
|
|
804
|
+
}
|
|
805
|
+
|
|
806
|
+
/**
|
|
807
|
+
* Parameters for retrieving a sync mapper record by DevRev target ID.
|
|
808
|
+
*/
|
|
809
|
+
export declare interface MappersGetByTargetIdParams {
|
|
810
|
+
/** The sync unit ID that scopes the synchronization context */
|
|
811
|
+
sync_unit: DonV2;
|
|
812
|
+
/** The DevRev entity ID to look up */
|
|
813
|
+
target: DonV2;
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
/**
|
|
817
|
+
* Response containing a sync mapper record retrieved by target ID.
|
|
818
|
+
*/
|
|
819
|
+
declare interface MappersGetByTargetIdResponse {
|
|
820
|
+
sync_mapper_record: SyncMapperRecord;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
/**
|
|
824
|
+
* Parameters for updating an existing sync mapper record.
|
|
825
|
+
*/
|
|
826
|
+
export declare interface MappersUpdateParams {
|
|
827
|
+
/** The ID of the existing sync mapper record to update */
|
|
828
|
+
id: DonV2;
|
|
829
|
+
/** The sync unit ID that scopes the synchronization context */
|
|
830
|
+
sync_unit: DonV2;
|
|
831
|
+
/** External system IDs to add to the existing mapping */
|
|
832
|
+
external_ids: {
|
|
833
|
+
add: string[];
|
|
834
|
+
};
|
|
835
|
+
/**
|
|
836
|
+
* Optional map that labels values in `external_ids` with their usage context.
|
|
837
|
+
* Use when an external system requires different identifiers for different API calls
|
|
838
|
+
* (for example, a UUID for one endpoint and a login username for another).
|
|
839
|
+
*
|
|
840
|
+
* Example:
|
|
841
|
+
* external_ids: ["2a1c...-uuid", "john_doe"]
|
|
842
|
+
* secondary_ids: { "username": "john_doe" }
|
|
843
|
+
*
|
|
844
|
+
* Note: Values in `secondary_ids` are not indexed. If you need to look up by a
|
|
845
|
+
* secondary value (e.g., username), you must also include that value in `external_ids`.
|
|
846
|
+
*/
|
|
847
|
+
secondary_ids?: Record<string, string>;
|
|
848
|
+
/** DevRev entity IDs to add to the existing mapping */
|
|
849
|
+
targets: {
|
|
850
|
+
add: DonV2[];
|
|
851
|
+
};
|
|
852
|
+
status: SyncMapperRecordStatus;
|
|
853
|
+
/**
|
|
854
|
+
* Input file names where the object was encountered.
|
|
855
|
+
* Used for observability and tracking.
|
|
856
|
+
*/
|
|
857
|
+
input_files?: {
|
|
858
|
+
add: string[];
|
|
859
|
+
};
|
|
860
|
+
/**
|
|
861
|
+
* External version markers used to avoid update loops.
|
|
862
|
+
* After creating or updating the object in the external system, add its
|
|
863
|
+
* modified_date here. On subsequent extraction, the Loader skips applying the
|
|
864
|
+
* update if the modified_date is present (change originated in DevRev).
|
|
865
|
+
*/
|
|
866
|
+
external_versions?: {
|
|
867
|
+
add: SyncMapperRecordExternalVersion[];
|
|
868
|
+
};
|
|
869
|
+
/**
|
|
870
|
+
* Opaque data for storing additional client-specific information.
|
|
871
|
+
* Fully managed by snapin authors.
|
|
872
|
+
*/
|
|
873
|
+
extra_data?: string;
|
|
874
|
+
}
|
|
875
|
+
|
|
876
|
+
/**
|
|
877
|
+
* Response containing the updated sync mapper record.
|
|
878
|
+
*/
|
|
879
|
+
declare interface MappersUpdateResponse {
|
|
880
|
+
sync_mapper_record: SyncMapperRecord;
|
|
881
|
+
}
|
|
882
|
+
|
|
883
|
+
export declare const MOCK_SERVER_DEFAULT_URL = "http://localhost:0";
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* MockServer used in tests to mock internal AirSync endpoints.
|
|
887
|
+
* This is a simple mock server that listens on a port and responds to requests.
|
|
888
|
+
* Supports per-test route configuration to simulate different response scenarios.
|
|
889
|
+
*/
|
|
890
|
+
export declare class MockServer {
|
|
891
|
+
private server;
|
|
892
|
+
private internalPort;
|
|
893
|
+
port: number;
|
|
894
|
+
baseUrl: string;
|
|
895
|
+
private routeHandlers;
|
|
896
|
+
private requests;
|
|
897
|
+
private requestCounts;
|
|
898
|
+
constructor(port?: number);
|
|
899
|
+
start(): Promise<void>;
|
|
900
|
+
stop(): Promise<void>;
|
|
901
|
+
private handleRequest;
|
|
902
|
+
/**
|
|
903
|
+
* Default route handler for the mock server. Returns { success: true } for
|
|
904
|
+
* routes that are not explicitly set.
|
|
905
|
+
*/
|
|
906
|
+
private defaultRouteHandler;
|
|
907
|
+
private getRouteKey;
|
|
908
|
+
/**
|
|
909
|
+
* Configures a route to return a specific status code and optional response body.
|
|
910
|
+
*/
|
|
911
|
+
setRoute(config: RouteConfig): void;
|
|
912
|
+
/**
|
|
913
|
+
* Resets all custom route handlers, restoring all default handlers.
|
|
914
|
+
* Also clears request tracking data.
|
|
915
|
+
*/
|
|
916
|
+
resetRoutes(): void;
|
|
917
|
+
/**
|
|
918
|
+
* Returns the most recent request or undefined if no requests exist.
|
|
919
|
+
*/
|
|
920
|
+
getLastRequest(): RequestInfo_2 | undefined;
|
|
921
|
+
/**
|
|
922
|
+
* Gets the number of requests made to a specific endpoint.
|
|
923
|
+
*/
|
|
924
|
+
getRequestCount(method: string, path: string): number;
|
|
925
|
+
/**
|
|
926
|
+
* Gets all requests made to a specific endpoint.
|
|
927
|
+
*/
|
|
928
|
+
getRequests(method: string, path: string): RequestInfo_2[];
|
|
929
|
+
}
|
|
930
|
+
|
|
931
|
+
/**
|
|
932
|
+
* NormalizedAttachment is an interface of attachment after normalization.
|
|
933
|
+
*/
|
|
934
|
+
export declare interface NormalizedAttachment {
|
|
935
|
+
url: string;
|
|
936
|
+
id: string;
|
|
937
|
+
file_name: string;
|
|
938
|
+
parent_id: string;
|
|
939
|
+
author_id?: string;
|
|
940
|
+
inline?: boolean;
|
|
941
|
+
content_type?: string;
|
|
942
|
+
grand_parent_id?: number | string;
|
|
943
|
+
}
|
|
944
|
+
|
|
945
|
+
/**
|
|
946
|
+
* NormalizedItem is an interface of item after normalization.
|
|
947
|
+
*/
|
|
948
|
+
export declare interface NormalizedItem {
|
|
949
|
+
id: string;
|
|
950
|
+
created_date: string;
|
|
951
|
+
modified_date: string;
|
|
952
|
+
data: object;
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Participation field data specifying target record types.
|
|
957
|
+
*/
|
|
958
|
+
declare interface ParticipationData {
|
|
959
|
+
/** The record types that this participation reference can refer to */
|
|
960
|
+
refers_to: Record<RecordTypeKey, ReferenceDetail>;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
/**
|
|
964
|
+
* Permission data associating a reference with a role.
|
|
965
|
+
*/
|
|
966
|
+
export declare interface PermissionData {
|
|
967
|
+
member_id?: ReferenceData;
|
|
968
|
+
role?: EnumData;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
export declare type ProcessAttachmentReturnType = {
|
|
972
|
+
delay?: number;
|
|
973
|
+
error?: {
|
|
974
|
+
message: string;
|
|
975
|
+
fileSize?: number;
|
|
976
|
+
};
|
|
977
|
+
} | undefined;
|
|
978
|
+
|
|
979
|
+
/**
|
|
980
|
+
* Attachment structure, that stores both attachment id and its parent_id for deduplication on the SDK side.
|
|
981
|
+
*/
|
|
982
|
+
declare interface ProcessedAttachment {
|
|
983
|
+
id: string;
|
|
984
|
+
parent_id: string;
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
export declare function processTask<ConnectorState>({ task, onTimeout, }: ProcessTaskInterface<ConnectorState>): void;
|
|
988
|
+
|
|
989
|
+
/**
|
|
990
|
+
* ProcessTaskInterface is an interface for ProcessTask class.
|
|
991
|
+
* @interface ProcessTaskInterface
|
|
992
|
+
* @constructor
|
|
993
|
+
* @param {function} task - The task to be executed, returns exit code
|
|
994
|
+
* @param {function} onTimeout - The task to be executed on timeout, returns exit code
|
|
995
|
+
*/
|
|
996
|
+
export declare interface ProcessTaskInterface<ConnectorState> {
|
|
997
|
+
task: (params: TaskAdapterInterface<ConnectorState>) => Promise<void>;
|
|
998
|
+
onTimeout: (params: TaskAdapterInterface<ConnectorState>) => Promise<void>;
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
declare interface RateLimited {
|
|
1002
|
+
delay: number;
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
/**
|
|
1006
|
+
* Record type definition.
|
|
1007
|
+
*/
|
|
1008
|
+
export declare interface RecordType {
|
|
1009
|
+
/** The fields of the record type */
|
|
1010
|
+
fields: Record<FieldKey, Field>;
|
|
1011
|
+
/** The human readable name of the record type */
|
|
1012
|
+
name?: string;
|
|
1013
|
+
description?: string;
|
|
1014
|
+
category?: RecordTypeCategoryKey;
|
|
1015
|
+
/** Whether the record type can be loaded (connector supports creating it in the system) */
|
|
1016
|
+
is_loadable?: boolean;
|
|
1017
|
+
/** Whether the record type sends the complete system state in every sync */
|
|
1018
|
+
is_snapshot?: boolean;
|
|
1019
|
+
/** Denotes that the record type has no ID field, primarily used for authorization policies */
|
|
1020
|
+
no_identifier?: boolean;
|
|
1021
|
+
/** Indicates the scope of this record type */
|
|
1022
|
+
scope?: RecordTypeScope;
|
|
1023
|
+
/** Field conditions for this record type */
|
|
1024
|
+
conditions?: Record<FieldKey, FieldConditions>;
|
|
1025
|
+
/** Stage diagram for workflow */
|
|
1026
|
+
stage_diagram?: StageDiagram;
|
|
1027
|
+
/** Link naming data for custom links */
|
|
1028
|
+
link_naming_data?: CustomLinkData;
|
|
1029
|
+
/** Attachments configuration */
|
|
1030
|
+
attachments?: Attachments;
|
|
1031
|
+
}
|
|
1032
|
+
|
|
1033
|
+
/**
|
|
1034
|
+
* Record type category definition.
|
|
1035
|
+
*/
|
|
1036
|
+
export declare interface RecordTypeCategory {
|
|
1037
|
+
/** The human readable name of the record type category */
|
|
1038
|
+
name?: string;
|
|
1039
|
+
/** Indicates whether a record can move between the record types of this category while preserving its identity */
|
|
1040
|
+
are_record_type_conversions_possible?: boolean;
|
|
1041
|
+
}
|
|
1042
|
+
|
|
1043
|
+
/** Key identifying a record type category in the record_type_categories map. */
|
|
1044
|
+
export declare type RecordTypeCategoryKey = string;
|
|
1045
|
+
|
|
1046
|
+
/** Key identifying a record type in the record_types map, refers_to maps, or type_keys arrays. */
|
|
1047
|
+
export declare type RecordTypeKey = string;
|
|
1048
|
+
|
|
1049
|
+
/**
|
|
1050
|
+
* Record type privilege data for authorization.
|
|
1051
|
+
*/
|
|
1052
|
+
export declare interface RecordTypePrivilegeData {
|
|
1053
|
+
/** The possible record types or record type categories that can be targeted in record type privilege. */
|
|
1054
|
+
type_keys: RecordTypeKey[];
|
|
1055
|
+
}
|
|
1056
|
+
|
|
1057
|
+
/**
|
|
1058
|
+
* Scope of a record type.
|
|
1059
|
+
*/
|
|
1060
|
+
export declare type RecordTypeScope = 'metadata_is_system_scoped' | 'data_is_system_scoped';
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Reference field data specifying target record types.
|
|
1064
|
+
*/
|
|
1065
|
+
export declare interface ReferenceData {
|
|
1066
|
+
/** The record types that this reference can refer to */
|
|
1067
|
+
refers_to: Record<RecordTypeKey, ReferenceDetail>;
|
|
1068
|
+
/** The parent reference refers to a record that has special ownership over the child */
|
|
1069
|
+
reference_type?: ReferenceType;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
/**
|
|
1073
|
+
* Details about how a reference targets another record type.
|
|
1074
|
+
*/
|
|
1075
|
+
export declare interface ReferenceDetail {
|
|
1076
|
+
/** The field in the target record type by which it is referenced. Assumed to be the primary key if not set. */
|
|
1077
|
+
by_field?: FieldKey;
|
|
1078
|
+
}
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* Reference type indicating parent-child relationship.
|
|
1082
|
+
*/
|
|
1083
|
+
export declare type ReferenceType = 'child' | 'parent';
|
|
1084
|
+
|
|
1085
|
+
declare class Repo {
|
|
1086
|
+
readonly itemType: string;
|
|
1087
|
+
private items;
|
|
1088
|
+
private normalize?;
|
|
1089
|
+
private uploader;
|
|
1090
|
+
private onUpload;
|
|
1091
|
+
private options?;
|
|
1092
|
+
uploadedArtifacts: Artifact[];
|
|
1093
|
+
constructor({ event, itemType, normalize, onUpload, options, }: RepoFactoryInterface);
|
|
1094
|
+
getItems(): (NormalizedItem | NormalizedAttachment | Item)[];
|
|
1095
|
+
upload(batch?: (NormalizedItem | NormalizedAttachment | Item)[]): Promise<void | ErrorRecord>;
|
|
1096
|
+
push(items: Item[]): Promise<boolean>;
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
/**
|
|
1100
|
+
* RepoFactoryInterface is an interface that defines the structure of a repo factory which is used to create a repo.
|
|
1101
|
+
*/
|
|
1102
|
+
declare interface RepoFactoryInterface {
|
|
1103
|
+
event: AirSyncEvent;
|
|
1104
|
+
itemType: string;
|
|
1105
|
+
normalize?: (record: object) => NormalizedItem | NormalizedAttachment;
|
|
1106
|
+
onUpload: (artifact: Artifact) => void;
|
|
1107
|
+
options?: WorkerAdapterOptions;
|
|
1108
|
+
}
|
|
1109
|
+
|
|
1110
|
+
/**
|
|
1111
|
+
* RepoInterface is an interface that defines the structure of a repo which is used to store and upload extracted data.
|
|
1112
|
+
*/
|
|
1113
|
+
export declare interface RepoInterface {
|
|
1114
|
+
itemType: string;
|
|
1115
|
+
normalize?: (record: object) => NormalizedItem | NormalizedAttachment;
|
|
1116
|
+
overridenOptions?: WorkerAdapterOptions;
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1119
|
+
/**
|
|
1120
|
+
* Information about a request received by the mock server.
|
|
1121
|
+
*/
|
|
1122
|
+
declare interface RequestInfo_2 {
|
|
1123
|
+
/** The HTTP method (e.g., 'GET', 'POST') */
|
|
1124
|
+
method: string;
|
|
1125
|
+
/** The full URL path of the request */
|
|
1126
|
+
url: string;
|
|
1127
|
+
/** Optional request body (for POST/PUT requests) */
|
|
1128
|
+
body?: unknown;
|
|
1129
|
+
}
|
|
1130
|
+
export { RequestInfo_2 as RequestInfo }
|
|
1131
|
+
|
|
1132
|
+
/**
|
|
1133
|
+
* Configuration for retry simulation behavior.
|
|
1134
|
+
*/
|
|
1135
|
+
export declare interface RetryConfig {
|
|
1136
|
+
/** Number of times to return error before succeeding (default: 4) */
|
|
1137
|
+
failureCount?: number;
|
|
1138
|
+
/** 5xx status code to return during failures (default: 500) */
|
|
1139
|
+
errorStatus?: number;
|
|
1140
|
+
/** Optional error response body to send as JSON during failures */
|
|
1141
|
+
errorBody?: unknown;
|
|
1142
|
+
/** Optional headers to send with the error response */
|
|
1143
|
+
headers?: Record<string, string>;
|
|
1144
|
+
/** Optional delay in milliseconds before sending each failure response */
|
|
1145
|
+
delay?: number;
|
|
1146
|
+
}
|
|
1147
|
+
|
|
1148
|
+
/**
|
|
1149
|
+
* Configuration object for setting up a route response.
|
|
1150
|
+
*/
|
|
1151
|
+
export declare interface RouteConfig {
|
|
1152
|
+
/** The path of the route (e.g., '/callback_url', '/worker_data_url.get') */
|
|
1153
|
+
path: string;
|
|
1154
|
+
/** The HTTP method (e.g., 'GET', 'POST', 'PUT', 'DELETE') */
|
|
1155
|
+
method: string;
|
|
1156
|
+
/** The HTTP status code to return (e.g., 200, 401, 500) */
|
|
1157
|
+
status: number;
|
|
1158
|
+
/** Optional response body to send as JSON */
|
|
1159
|
+
body?: unknown;
|
|
1160
|
+
/** Optional headers to send with the response */
|
|
1161
|
+
headers?: Record<string, string>;
|
|
1162
|
+
/** Optional retry configuration for simulating failures before success */
|
|
1163
|
+
retry?: RetryConfig;
|
|
1164
|
+
/** Optional delay in milliseconds before sending the response */
|
|
1165
|
+
delay?: number;
|
|
1166
|
+
}
|
|
1167
|
+
|
|
1168
|
+
/**
|
|
1169
|
+
* Schema version for the external domain metadata format.
|
|
1170
|
+
*/
|
|
1171
|
+
export declare type SchemaVersion = 'v0.2.0';
|
|
1172
|
+
|
|
1173
|
+
declare interface SdkState {
|
|
1174
|
+
/** The pending (not yet committed) oldest extraction boundary (ISO 8601 timestamp).
|
|
1175
|
+
* Set on StartExtractingMetadata, reused across subsequent phases, cleared on AttachmentExtractionDone. */
|
|
1176
|
+
pendingWorkersOldest?: string;
|
|
1177
|
+
/** The pending (not yet committed) newest extraction boundary (ISO 8601 timestamp).
|
|
1178
|
+
* Set on StartExtractingMetadata, reused across subsequent phases, cleared on AttachmentExtractionDone. */
|
|
1179
|
+
pendingWorkersNewest?: string;
|
|
1180
|
+
/** The oldest point of extraction (ISO 8601 timestamp). */
|
|
1181
|
+
workersOldest?: string;
|
|
1182
|
+
/** The newest point of extraction (ISO 8601 timestamp). */
|
|
1183
|
+
workersNewest?: string;
|
|
1184
|
+
toDevRev?: ToDevRev;
|
|
1185
|
+
fromDevRev?: FromDevRev;
|
|
1186
|
+
snapInVersionId?: string;
|
|
1187
|
+
}
|
|
1188
|
+
|
|
1189
|
+
/**
|
|
1190
|
+
* Serializes an Axios error into a structured format with HTTP request/response details.
|
|
1191
|
+
* Extracts method, URL, parameters, status code, headers, and data.
|
|
1192
|
+
* Includes CORS/network failure indicator when no response is available.
|
|
1193
|
+
*
|
|
1194
|
+
* @param error - Axios error to serialize
|
|
1195
|
+
* @returns Structured object with error details
|
|
1196
|
+
*/
|
|
1197
|
+
export declare function serializeAxiosError(error: AxiosError): AxiosErrorResponse;
|
|
1198
|
+
|
|
1199
|
+
/**
|
|
1200
|
+
* Creates a new instance of Spawn class.
|
|
1201
|
+
* Spawn class is responsible for spawning a new worker thread and managing the lifecycle of the worker.
|
|
1202
|
+
* The class provides utilities to emit control events to the platform and exit the worker gracefully.
|
|
1203
|
+
* In case of lambda timeout, the class emits a lambda timeout event to the platform.
|
|
1204
|
+
* @param {SpawnFactoryInterface} options - The options to create a new instance of Spawn class
|
|
1205
|
+
* @param {AirSyncEvent} options.event - The event object received from the platform
|
|
1206
|
+
* @param {object} options.initialState - The initial state of the adapter
|
|
1207
|
+
* @param {string} [options.baseWorkerPath] - The base path for the worker files, usually `__dirname`
|
|
1208
|
+
* @returns {Promise<Spawn>} - A new instance of Spawn class
|
|
1209
|
+
*/
|
|
1210
|
+
export declare function spawn<ConnectorState>({ event, initialState, initialDomainMapping, options, baseWorkerPath, }: SpawnFactoryInterface<ConnectorState>): Promise<void>;
|
|
1211
|
+
|
|
1212
|
+
/**
|
|
1213
|
+
* SpawnFactoryInterface is an interface for Spawn class factory.
|
|
1214
|
+
* Spawn class is responsible for spawning a new worker thread and managing the lifecycle of the worker.
|
|
1215
|
+
* The class provides utilities to emit control events to the platform and exit the worker gracefully.
|
|
1216
|
+
* In case of lambda timeout, the class emits a lambda timeout event to the platform.
|
|
1217
|
+
* @interface SpawnFactoryInterface
|
|
1218
|
+
* @constructor
|
|
1219
|
+
* @param {AirSyncEvent} event - The event object received from the platform
|
|
1220
|
+
* @param {object=} initialState - The initial state of the adapter
|
|
1221
|
+
* @param {string} initialDomainMapping - The initial domain mapping
|
|
1222
|
+
* @param {WorkerAdapterOptions} options - The options to create a new instance of Spawn class
|
|
1223
|
+
* @param {string=} baseWorkerPath - The base path for the worker files, usually `__dirname`
|
|
1224
|
+
*/
|
|
1225
|
+
export declare interface SpawnFactoryInterface<ConnectorState> {
|
|
1226
|
+
event: AirSyncEvent;
|
|
1227
|
+
initialState: ConnectorState;
|
|
1228
|
+
options?: WorkerAdapterOptions;
|
|
1229
|
+
initialDomainMapping?: InitialDomainMapping;
|
|
1230
|
+
baseWorkerPath?: string;
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* SpawnInterface is an interface for Spawn class.
|
|
1235
|
+
* @interface SpawnInterface
|
|
1236
|
+
* @constructor
|
|
1237
|
+
* @param {AirSyncEvent} event - The event object received from the platform
|
|
1238
|
+
* @param {Worker} worker - The worker thread
|
|
1239
|
+
*/
|
|
1240
|
+
export declare interface SpawnInterface {
|
|
1241
|
+
event: AirSyncEvent;
|
|
1242
|
+
worker: Worker_2;
|
|
1243
|
+
options?: WorkerAdapterOptions;
|
|
1244
|
+
resolve: (value: void | PromiseLike<void>) => void;
|
|
1245
|
+
originalConsole?: Console;
|
|
1246
|
+
}
|
|
1247
|
+
|
|
1248
|
+
/**
|
|
1249
|
+
* SsorAttachment is an interface that defines the structure of the SSOR attachment.
|
|
1250
|
+
*/
|
|
1251
|
+
export declare interface SsorAttachment {
|
|
1252
|
+
id: {
|
|
1253
|
+
devrev: string;
|
|
1254
|
+
external: string;
|
|
1255
|
+
};
|
|
1256
|
+
parent_id: {
|
|
1257
|
+
external: string;
|
|
1258
|
+
};
|
|
1259
|
+
actor_id?: {
|
|
1260
|
+
external: string;
|
|
1261
|
+
};
|
|
1262
|
+
inline?: boolean;
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
/**
|
|
1266
|
+
* Stage diagram definition for record type workflow.
|
|
1267
|
+
*/
|
|
1268
|
+
export declare interface StageDiagram {
|
|
1269
|
+
/** The field that represents the stage in the external system. */
|
|
1270
|
+
controlling_field: FieldKey;
|
|
1271
|
+
/** A map of the stages that should be created. Keys must match the enum values in the controlling field. */
|
|
1272
|
+
stages: Record<StageKey, CustomStage>;
|
|
1273
|
+
/** The stage that the parent record type starts in when it is created. */
|
|
1274
|
+
starting_stage?: StageKey;
|
|
1275
|
+
/** A map of the states/status categories that should be created. */
|
|
1276
|
+
states?: Record<StateKey, CustomState>;
|
|
1277
|
+
/** Denotes that this diagram has no explicit transitions and should be created as an 'all-to-all' diagram. */
|
|
1278
|
+
all_transitions_allowed?: boolean;
|
|
1279
|
+
}
|
|
1280
|
+
|
|
1281
|
+
/** Key identifying a stage in the stage diagram stages map. */
|
|
1282
|
+
export declare type StageKey = string;
|
|
1283
|
+
|
|
1284
|
+
declare class State<ConnectorState> {
|
|
1285
|
+
private _state;
|
|
1286
|
+
private _extractionScope;
|
|
1287
|
+
private initialSdkState;
|
|
1288
|
+
private workerUrl;
|
|
1289
|
+
private devrevToken;
|
|
1290
|
+
private syncUnitId;
|
|
1291
|
+
private requestId;
|
|
1292
|
+
constructor({ event, initialState }: StateInterface<ConnectorState>);
|
|
1293
|
+
get state(): AdapterState<ConnectorState>;
|
|
1294
|
+
set state(value: AdapterState<ConnectorState>);
|
|
1295
|
+
get extractionScope(): ExtractionScope;
|
|
1296
|
+
/**
|
|
1297
|
+
* Initializes the state for this adapter instance by fetching from API
|
|
1298
|
+
* or creating an initial state if none exists (404).
|
|
1299
|
+
* @param initialState The initial connector state provided by the spawn function
|
|
1300
|
+
*/
|
|
1301
|
+
init(initialState: ConnectorState): Promise<void>;
|
|
1302
|
+
/**
|
|
1303
|
+
* Updates the state of the adapter by posting to API.
|
|
1304
|
+
* @param {object} state - The state to be updated
|
|
1305
|
+
*/
|
|
1306
|
+
postState(state?: AdapterState<ConnectorState>): Promise<void>;
|
|
1307
|
+
/**
|
|
1308
|
+
* Fetches the state of the adapter from API.
|
|
1309
|
+
* @return The raw state data from API
|
|
1310
|
+
*/
|
|
1311
|
+
fetchState(): Promise<{
|
|
1312
|
+
state: string;
|
|
1313
|
+
objects?: string;
|
|
1314
|
+
}>;
|
|
1315
|
+
}
|
|
1316
|
+
|
|
1317
|
+
declare interface StateInterface<ConnectorState> {
|
|
1318
|
+
event: AirSyncEvent;
|
|
1319
|
+
initialState: ConnectorState;
|
|
1320
|
+
initialDomainMapping?: InitialDomainMapping;
|
|
1321
|
+
options?: WorkerAdapterOptions;
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
/** Key identifying a state in the stage diagram states map. */
|
|
1325
|
+
export declare type StateKey = string;
|
|
1326
|
+
|
|
1327
|
+
/**
|
|
1328
|
+
* StreamAttachmentsResponse is an interface that defines the structure of the response from the stream attachments through Uploader.
|
|
1329
|
+
*/
|
|
1330
|
+
export declare interface StreamAttachmentsResponse {
|
|
1331
|
+
ssorAttachments?: SsorAttachment[];
|
|
1332
|
+
error?: ErrorRecord;
|
|
1333
|
+
}
|
|
1334
|
+
|
|
1335
|
+
declare type StreamAttachmentsReturnType = {
|
|
1336
|
+
delay?: number;
|
|
1337
|
+
error?: ErrorRecord;
|
|
1338
|
+
} | undefined;
|
|
1339
|
+
|
|
1340
|
+
/**
|
|
1341
|
+
* StreamResponse is an interface that defines the structure of the response from the stream of single attachment through Uploader.
|
|
1342
|
+
*/
|
|
1343
|
+
export declare interface StreamResponse {
|
|
1344
|
+
ssorAttachment?: SsorAttachment;
|
|
1345
|
+
error?: ErrorRecord;
|
|
1346
|
+
}
|
|
1347
|
+
|
|
1348
|
+
/**
|
|
1349
|
+
* Struct field data referencing a struct type.
|
|
1350
|
+
*/
|
|
1351
|
+
export declare interface StructData {
|
|
1352
|
+
key?: StructTypeKey;
|
|
1353
|
+
}
|
|
1354
|
+
|
|
1355
|
+
/**
|
|
1356
|
+
* Struct type definition for reusable field structures.
|
|
1357
|
+
*/
|
|
1358
|
+
export declare interface StructType {
|
|
1359
|
+
/** The fields of the struct type */
|
|
1360
|
+
fields: Record<FieldKey, Field>;
|
|
1361
|
+
/** The human readable name of the struct type */
|
|
1362
|
+
name?: string;
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
/** Key identifying a struct type in the struct_types map. */
|
|
1366
|
+
export declare type StructTypeKey = string;
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* Represents a sync mapper record that links external system entities to DevRev entities.
|
|
1370
|
+
*/
|
|
1371
|
+
declare interface SyncMapperRecord {
|
|
1372
|
+
id: DonV2;
|
|
1373
|
+
/** Array of external system IDs that map to the same DevRev object */
|
|
1374
|
+
external_ids: string[];
|
|
1375
|
+
/**
|
|
1376
|
+
* Optional map that labels values in `external_ids` with their usage context.
|
|
1377
|
+
* Use when an external system requires different identifiers for different API calls
|
|
1378
|
+
* (for example, a UUID for one endpoint and a login username for another).
|
|
1379
|
+
*
|
|
1380
|
+
* Example:
|
|
1381
|
+
* external_ids: ["2a1c...-uuid", "john_doe"]
|
|
1382
|
+
* secondary_ids: { "username": "john_doe" }
|
|
1383
|
+
*
|
|
1384
|
+
* Note: Values in `secondary_ids` are not indexed. If you need to look up by a
|
|
1385
|
+
* secondary value (e.g., username), you must also include that value in `external_ids`.
|
|
1386
|
+
*/
|
|
1387
|
+
secondary_ids?: Record<string, string>;
|
|
1388
|
+
/** Array of DevRev entity IDs this mapping points to */
|
|
1389
|
+
targets: DonV2[];
|
|
1390
|
+
status: SyncMapperRecordStatus;
|
|
1391
|
+
/**
|
|
1392
|
+
* Optional file name where the object data was found.
|
|
1393
|
+
* Useful for debugging - helps locate the source of object data later.
|
|
1394
|
+
*/
|
|
1395
|
+
input_files?: string[];
|
|
1396
|
+
/**
|
|
1397
|
+
* Records external-system changes to prevent update loops.
|
|
1398
|
+
* When the Loader writes to the external system, store the object's
|
|
1399
|
+
* modified_date here. During the next sync back to DevRev, if the extracted
|
|
1400
|
+
* object's modified_date exists in this list the update is skipped (avoids
|
|
1401
|
+
* re-applying a DevRev-originated change).
|
|
1402
|
+
*/
|
|
1403
|
+
external_versions?: SyncMapperRecordExternalVersion[];
|
|
1404
|
+
/**
|
|
1405
|
+
* Free-form data storage for your use. Store any additional information here.
|
|
1406
|
+
* Completely opaque to the platform - use however you need.
|
|
1407
|
+
*/
|
|
1408
|
+
extra_data?: string;
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* External version tracking to prevent update loops.
|
|
1413
|
+
* Used to identify changes that originated from your system.
|
|
1414
|
+
*/
|
|
1415
|
+
declare interface SyncMapperRecordExternalVersion {
|
|
1416
|
+
/** Sync recipe version at the time the external change was written */
|
|
1417
|
+
recipe_version: number;
|
|
1418
|
+
/** External system modified timestamp (ISO 8601 string) used for loop detection */
|
|
1419
|
+
modified_date: string;
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
/**
|
|
1423
|
+
* Status of a sync mapper record indicating its operational state.
|
|
1424
|
+
*/
|
|
1425
|
+
export declare enum SyncMapperRecordStatus {
|
|
1426
|
+
/** The mapping is active and operational (default) */
|
|
1427
|
+
OPERATIONAL = "operational",
|
|
1428
|
+
/** The mapping was filtered out by user filter settings */
|
|
1429
|
+
FILTERED = "filtered",
|
|
1430
|
+
/**
|
|
1431
|
+
* The external object should be ignored in sync operations.
|
|
1432
|
+
* Use to prevent objects from being created or updated in DevRev.
|
|
1433
|
+
*/
|
|
1434
|
+
IGNORED = "ignored"
|
|
1435
|
+
}
|
|
1436
|
+
|
|
1437
|
+
/**
|
|
1438
|
+
* Types of DevRev entities that can be targets in sync mapper records.
|
|
1439
|
+
*/
|
|
1440
|
+
export declare enum SyncMapperRecordTargetType {
|
|
1441
|
+
ACCESS_CONTROL_ENTRY = "access_control_entry",
|
|
1442
|
+
ACCOUNT = "account",
|
|
1443
|
+
AIRSYNC_AUTHORIZATION_POLICY = "airdrop_authorization_policy",
|
|
1444
|
+
AIRSYNC_FIELD_AUTHORIZATION_POLICY = "airdrop_field_authorization_policy",
|
|
1445
|
+
AIRSYNC_PLATFORM_GROUP = "airdrop_platform_group",
|
|
1446
|
+
ARTICLE = "article",
|
|
1447
|
+
ARTIFACT = "artifact",
|
|
1448
|
+
CHAT = "chat",
|
|
1449
|
+
CONVERSATION = "conversation",
|
|
1450
|
+
CUSTOM_OBJECT = "custom_object",
|
|
1451
|
+
DIRECTORY = "directory",
|
|
1452
|
+
GROUP = "group",
|
|
1453
|
+
INCIDENT = "incident",
|
|
1454
|
+
LINK = "link",
|
|
1455
|
+
MEETING = "meeting",
|
|
1456
|
+
OBJECT_MEMBER = "object_member",
|
|
1457
|
+
PART = "part",
|
|
1458
|
+
REV_ORG = "rev_org",
|
|
1459
|
+
ROLE = "role",
|
|
1460
|
+
ROLE_SET = "role_set",
|
|
1461
|
+
TAG = "tag",
|
|
1462
|
+
TIMELINE_COMMENT = "timeline_comment",
|
|
1463
|
+
USER = "user",
|
|
1464
|
+
WORK = "work"
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1467
|
+
/**
|
|
1468
|
+
* SyncMode is an enum that defines the different modes of sync that can be used by the external extractor.
|
|
1469
|
+
* It can be either INITIAL, INCREMENTAL or LOADING. INITIAL mode is used for
|
|
1470
|
+
* the first/initial import, while INCREMENTAL mode is used for doing syncs. LOADING mode is used for
|
|
1471
|
+
* loading data from DevRev to the external system.
|
|
1472
|
+
*/
|
|
1473
|
+
export declare enum SyncMode {
|
|
1474
|
+
INITIAL = "INITIAL",
|
|
1475
|
+
INCREMENTAL = "INCREMENTAL",
|
|
1476
|
+
LOADING = "LOADING"
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
/**
|
|
1480
|
+
* Target type key data for authorization policy.
|
|
1481
|
+
*/
|
|
1482
|
+
export declare interface TargetTypeKeyData {
|
|
1483
|
+
/** The possible record types or record type categories that can be targeted in authorization policy. */
|
|
1484
|
+
type_keys: RecordTypeKey[];
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
/**
|
|
1488
|
+
* TaskAdapterInterface is an interface for TaskAdapter class.
|
|
1489
|
+
* @interface TaskAdapterInterface
|
|
1490
|
+
* @constructor
|
|
1491
|
+
* @param {WorkerAdapter} adapter - The adapter object
|
|
1492
|
+
*/
|
|
1493
|
+
export declare interface TaskAdapterInterface<ConnectorState> {
|
|
1494
|
+
adapter: WorkerAdapter<ConnectorState>;
|
|
1495
|
+
}
|
|
1496
|
+
|
|
1497
|
+
/**
|
|
1498
|
+
* Text field constraints.
|
|
1499
|
+
*/
|
|
1500
|
+
export declare interface TextData {
|
|
1501
|
+
min_length?: number;
|
|
1502
|
+
max_length?: number;
|
|
1503
|
+
}
|
|
1504
|
+
|
|
1505
|
+
/**
|
|
1506
|
+
* TimeUnit is an enum that defines the supported Go duration units for time window calculations.
|
|
1507
|
+
* These correspond directly to Go's time.ParseDuration units.
|
|
1508
|
+
*/
|
|
1509
|
+
export declare enum TimeUnit {
|
|
1510
|
+
/** Nanoseconds */
|
|
1511
|
+
NANOSECONDS = "ns",
|
|
1512
|
+
/** Microseconds (ASCII alias) */
|
|
1513
|
+
MICROSECONDS = "us",
|
|
1514
|
+
/** Microseconds (Unicode alias) */
|
|
1515
|
+
MICROSECONDS_MU = "\u00B5s",
|
|
1516
|
+
/** Milliseconds */
|
|
1517
|
+
MILLISECONDS = "ms",
|
|
1518
|
+
/** Seconds */
|
|
1519
|
+
SECONDS = "s",
|
|
1520
|
+
/** Minutes */
|
|
1521
|
+
MINUTES = "m",
|
|
1522
|
+
/** Hours */
|
|
1523
|
+
HOURS = "h"
|
|
1524
|
+
}
|
|
1525
|
+
|
|
1526
|
+
/**
|
|
1527
|
+
* TimeValue is an interface that represents a time value used in extraction start/end times.
|
|
1528
|
+
* It contains a type (which denotes how the value should be resolved) and an optional value.
|
|
1529
|
+
* - For ABSOLUTE: value is an ISO 8601 timestamp
|
|
1530
|
+
* - For *_WINDOW types: value is a Go duration string (e.g. '500ms', '30s', '5m', '2h')
|
|
1531
|
+
* - For other types: value is not used
|
|
1532
|
+
*/
|
|
1533
|
+
export declare interface TimeValue {
|
|
1534
|
+
type: TimeValueType;
|
|
1535
|
+
value?: string;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
/**
|
|
1539
|
+
* TimeValueType is an enum that defines the type of a time value used in extraction start/end times.
|
|
1540
|
+
* The platform sends these types to indicate how the extraction time should be resolved by the SDK.
|
|
1541
|
+
*/
|
|
1542
|
+
export declare enum TimeValueType {
|
|
1543
|
+
/** Oldest timestamp from worker state */
|
|
1544
|
+
WORKERS_OLDEST = "workers_oldest",
|
|
1545
|
+
/** Oldest timestamp from worker state minus a duration window */
|
|
1546
|
+
WORKERS_OLDEST_MINUS_WINDOW = "workers_oldest_minus_window",
|
|
1547
|
+
/** Newest timestamp from worker state */
|
|
1548
|
+
WORKERS_NEWEST = "workers_newest",
|
|
1549
|
+
/** Newest timestamp from worker state plus a duration window */
|
|
1550
|
+
WORKERS_NEWEST_PLUS_WINDOW = "workers_newest_plus_window",
|
|
1551
|
+
/** Current time */
|
|
1552
|
+
CURRENT_TIME = "current_time",
|
|
1553
|
+
/** User-specified absolute timestamp */
|
|
1554
|
+
ABSOLUTE_TIME = "absolute_time",
|
|
1555
|
+
/** No bound - extract all available data */
|
|
1556
|
+
UNBOUNDED = "unbounded"
|
|
1557
|
+
}
|
|
1558
|
+
|
|
1559
|
+
declare interface ToDevRev {
|
|
1560
|
+
attachmentsMetadata: {
|
|
1561
|
+
artifactIds: string[];
|
|
1562
|
+
lastProcessed: number;
|
|
1563
|
+
lastProcessedAttachmentsIdsList?: ProcessedAttachment[];
|
|
1564
|
+
};
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
/**
|
|
1568
|
+
* Typed reference field data specifying target record types.
|
|
1569
|
+
*/
|
|
1570
|
+
export declare interface TypedReferenceData {
|
|
1571
|
+
/** The record types that this reference can refer to */
|
|
1572
|
+
refers_to: Record<RecordTypeKey, ReferenceDetail>;
|
|
1573
|
+
/** The parent reference refers to a record that has special ownership over the child */
|
|
1574
|
+
reference_type?: ReferenceType;
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
/**
|
|
1578
|
+
* Sentinel value representing an unbounded (no limit) extraction timestamp.
|
|
1579
|
+
* Used as the resolved value for TimeValueType.UNBOUNDED, stored as workersOldest
|
|
1580
|
+
* when the initial import has no lower time bound. The Unix epoch ensures that
|
|
1581
|
+
* no real extraction timestamp can be earlier, preventing accidental overwrites
|
|
1582
|
+
* of the boundary by subsequent syncs (e.g. reconciliation with absolute dates).
|
|
1583
|
+
*/
|
|
1584
|
+
export declare const UNBOUNDED_DATE_TIME_VALUE = "1970-01-01T00:00:00.000Z";
|
|
1585
|
+
|
|
1586
|
+
/**
|
|
1587
|
+
* UploadResponse is an interface that defines the structure of the response from upload through Uploader.
|
|
1588
|
+
*/
|
|
1589
|
+
export declare interface UploadResponse {
|
|
1590
|
+
artifact?: Artifact;
|
|
1591
|
+
error?: ErrorRecord;
|
|
1592
|
+
}
|
|
1593
|
+
|
|
1594
|
+
/**
|
|
1595
|
+
* WorkerAdapter class is used to interact with AirSync platform. It is passed to the snap-in
|
|
1596
|
+
* as parameter in processTask and onTimeout functions. The class provides
|
|
1597
|
+
* utilities to emit control events to the platform, update the state of the connector,
|
|
1598
|
+
* and upload artifacts to the platform.
|
|
1599
|
+
* @class WorkerAdapter
|
|
1600
|
+
* @constructor
|
|
1601
|
+
* @param options - The options to create a new instance of WorkerAdapter class
|
|
1602
|
+
* @param event - The event object received from the platform
|
|
1603
|
+
* @param initialState - The initial state of the adapter
|
|
1604
|
+
* @param isLocalDevelopment - A flag to indicate if the adapter is being used in local development
|
|
1605
|
+
* @param workerPath - The path to the worker file
|
|
1606
|
+
*
|
|
1607
|
+
* @public
|
|
1608
|
+
*/
|
|
1609
|
+
export declare class WorkerAdapter<ConnectorState> {
|
|
1610
|
+
readonly event: AirSyncEvent;
|
|
1611
|
+
readonly options?: WorkerAdapterOptions;
|
|
1612
|
+
isTimeout: boolean;
|
|
1613
|
+
hasWorkerEmitted: boolean;
|
|
1614
|
+
private adapterState;
|
|
1615
|
+
private _artifacts;
|
|
1616
|
+
private repos;
|
|
1617
|
+
private currentEventDataLength;
|
|
1618
|
+
private loaderReports;
|
|
1619
|
+
private _processedFiles;
|
|
1620
|
+
private _mappers;
|
|
1621
|
+
private uploader;
|
|
1622
|
+
constructor({ event, adapterState, options, }: WorkerAdapterInterface<ConnectorState>);
|
|
1623
|
+
get state(): AdapterState<ConnectorState>;
|
|
1624
|
+
set state(value: AdapterState<ConnectorState>);
|
|
1625
|
+
get reports(): LoaderReport[];
|
|
1626
|
+
get processedFiles(): string[];
|
|
1627
|
+
get mappers(): Mappers;
|
|
1628
|
+
get extractionScope(): ExtractionScope;
|
|
1629
|
+
/**
|
|
1630
|
+
* Returns whether the given item type should be extracted.
|
|
1631
|
+
* Defaults to true if the scope is empty or the item type is not listed.
|
|
1632
|
+
*/
|
|
1633
|
+
shouldExtract(itemType: string): boolean;
|
|
1634
|
+
initializeRepos(repos: RepoInterface[]): void;
|
|
1635
|
+
getRepo(itemType: string): Repo | undefined;
|
|
1636
|
+
postState(): Promise<void>;
|
|
1637
|
+
get artifacts(): Artifact[];
|
|
1638
|
+
set artifacts(artifacts: Artifact[]);
|
|
1639
|
+
/**
|
|
1640
|
+
* Emits an event to the platform.
|
|
1641
|
+
*
|
|
1642
|
+
* @param newEventType - The event type to be emitted
|
|
1643
|
+
* @param data - The data to be sent with the event
|
|
1644
|
+
*/
|
|
1645
|
+
emit(newEventType: ExtractorEventType | LoaderEventType, data?: EventData): Promise<void>;
|
|
1646
|
+
uploadAllRepos(): Promise<void>;
|
|
1647
|
+
loadItemTypes({ itemTypesToLoad, }: ItemTypesToLoadParams): Promise<LoadItemTypesResponse>;
|
|
1648
|
+
getLoaderBatches({ supportedItemTypes, }: {
|
|
1649
|
+
supportedItemTypes: string[];
|
|
1650
|
+
}): Promise<FileToLoad[]>;
|
|
1651
|
+
loadAttachments({ create, }: {
|
|
1652
|
+
create: ExternalSystemLoadingFunction<ExternalSystemAttachment>;
|
|
1653
|
+
}): Promise<LoadItemTypesResponse>;
|
|
1654
|
+
loadItem({ item, itemTypeToLoad, }: {
|
|
1655
|
+
item: ExternalSystemItem;
|
|
1656
|
+
itemTypeToLoad: ItemTypeToLoad;
|
|
1657
|
+
}): Promise<LoadItemResponse>;
|
|
1658
|
+
processAttachment(attachment: NormalizedAttachment, stream: ExternalSystemAttachmentStreamingFunction): Promise<ProcessAttachmentReturnType>;
|
|
1659
|
+
/**
|
|
1660
|
+
* Destroys a stream to prevent memory leaks.
|
|
1661
|
+
* @param httpStream - The axios response stream to destroy
|
|
1662
|
+
*/
|
|
1663
|
+
private destroyHttpStream;
|
|
1664
|
+
loadAttachment({ item, create, }: {
|
|
1665
|
+
item: ExternalSystemAttachment;
|
|
1666
|
+
create: ExternalSystemLoadingFunction<ExternalSystemAttachment>;
|
|
1667
|
+
}): Promise<LoadItemResponse>;
|
|
1668
|
+
/**
|
|
1669
|
+
* Streams the attachments to the DevRev platform.
|
|
1670
|
+
* The attachments are streamed to the platform and the artifact information is returned.
|
|
1671
|
+
* @param params - The parameters to stream the attachments
|
|
1672
|
+
* @returns The response object containing the ssorAttachment artifact information
|
|
1673
|
+
* or error information if there was an error
|
|
1674
|
+
*/
|
|
1675
|
+
streamAttachments<NewBatch>({ stream, processors, batchSize, }: {
|
|
1676
|
+
stream: ExternalSystemAttachmentStreamingFunction;
|
|
1677
|
+
processors?: ExternalSystemAttachmentProcessors<ConnectorState, NormalizedAttachment[], NewBatch>;
|
|
1678
|
+
batchSize?: number;
|
|
1679
|
+
}): Promise<StreamAttachmentsReturnType>;
|
|
1680
|
+
}
|
|
1681
|
+
|
|
1682
|
+
/**
|
|
1683
|
+
* WorkerAdapterInterface is an interface for WorkerAdapter class.
|
|
1684
|
+
* @interface WorkerAdapterInterface
|
|
1685
|
+
* @constructor
|
|
1686
|
+
* @param {AirSyncEvent} event - The event object received from the platform
|
|
1687
|
+
* @param {object=} initialState - The initial state of the adapter
|
|
1688
|
+
* @param {WorkerAdapterInterface} options - The options to create a new instance of WorkerAdapter class
|
|
1689
|
+
*/
|
|
1690
|
+
export declare interface WorkerAdapterInterface<ConnectorState> {
|
|
1691
|
+
event: AirSyncEvent;
|
|
1692
|
+
adapterState: State<ConnectorState>;
|
|
1693
|
+
options?: WorkerAdapterOptions;
|
|
1694
|
+
}
|
|
1695
|
+
|
|
1696
|
+
/**
|
|
1697
|
+
* WorkerAdapterOptions represents the options for WorkerAdapter class.
|
|
1698
|
+
* @interface WorkerAdapterOptions
|
|
1699
|
+
* @constructor
|
|
1700
|
+
* @param {boolean=} isLocalDevelopment - A flag to indicate if the adapter is being used in local development
|
|
1701
|
+
* @param {number=} timeout - The timeout for the worker thread
|
|
1702
|
+
* @param {number=} batchSize - Maximum number of extracted items in a batch
|
|
1703
|
+
* @param {Record<EventType, string>=} workerPathOverrides - A map of event types to custom worker paths to override default worker paths
|
|
1704
|
+
*/
|
|
1705
|
+
export declare interface WorkerAdapterOptions {
|
|
1706
|
+
isLocalDevelopment?: boolean;
|
|
1707
|
+
timeout?: number;
|
|
1708
|
+
batchSize?: number;
|
|
1709
|
+
workerPathOverrides?: WorkerPathOverrides;
|
|
1710
|
+
skipConfirmation?: boolean;
|
|
1711
|
+
}
|
|
1712
|
+
|
|
1713
|
+
/**
|
|
1714
|
+
* WorkerData represents the structure of the worker data object.
|
|
1715
|
+
*/
|
|
1716
|
+
export declare interface WorkerData<ConnectorState> {
|
|
1717
|
+
event: AirSyncEvent;
|
|
1718
|
+
initialState: ConnectorState;
|
|
1719
|
+
workerPath: string;
|
|
1720
|
+
initialDomainMapping?: InitialDomainMapping;
|
|
1721
|
+
options?: WorkerAdapterOptions;
|
|
1722
|
+
}
|
|
1723
|
+
|
|
1724
|
+
/**
|
|
1725
|
+
* WorkerEvent represents the standard worker events.
|
|
1726
|
+
*/
|
|
1727
|
+
export declare enum WorkerEvent {
|
|
1728
|
+
WorkerMessage = "message",
|
|
1729
|
+
WorkerOnline = "online",
|
|
1730
|
+
WorkerError = "error",
|
|
1731
|
+
WorkerExit = "exit"
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
/**
|
|
1735
|
+
* WorkerMessage represents the structure of the worker message.
|
|
1736
|
+
*/
|
|
1737
|
+
export declare type WorkerMessage = WorkerMessageEmitted | WorkerMessageExit | WorkerMessageLog | WorkerMessageFailed;
|
|
1738
|
+
|
|
1739
|
+
/**
|
|
1740
|
+
* WorkerMessageEmitted interface represents the structure of the emitted worker message.
|
|
1741
|
+
*/
|
|
1742
|
+
export declare interface WorkerMessageEmitted {
|
|
1743
|
+
subject: WorkerMessageSubject.WorkerMessageEmitted;
|
|
1744
|
+
payload: {
|
|
1745
|
+
eventType: ExtractorEventType | LoaderEventType;
|
|
1746
|
+
};
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
/**
|
|
1750
|
+
* WorkerMessageExit interface represents the structure of the exit worker message.
|
|
1751
|
+
*/
|
|
1752
|
+
export declare interface WorkerMessageExit {
|
|
1753
|
+
subject: WorkerMessageSubject.WorkerMessageExit;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
/**
|
|
1757
|
+
* WorkerMessageFailed interface represents the structure of the worker failed message.
|
|
1758
|
+
* Sent from the worker thread before calling process.exit(1) to convey the specific
|
|
1759
|
+
* error reason to the main thread.
|
|
1760
|
+
*/
|
|
1761
|
+
export declare interface WorkerMessageFailed {
|
|
1762
|
+
subject: WorkerMessageSubject.WorkerMessageFailed;
|
|
1763
|
+
payload: {
|
|
1764
|
+
message: string;
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
/**
|
|
1769
|
+
* WorkerMessageLog interface represents the structure of the worker log message.
|
|
1770
|
+
*/
|
|
1771
|
+
export declare interface WorkerMessageLog {
|
|
1772
|
+
subject: WorkerMessageSubject.WorkerMessageLog;
|
|
1773
|
+
payload: {
|
|
1774
|
+
stringifiedArgs: string;
|
|
1775
|
+
level: LogLevel;
|
|
1776
|
+
isSdkLog?: boolean;
|
|
1777
|
+
};
|
|
1778
|
+
}
|
|
1779
|
+
|
|
1780
|
+
/**
|
|
1781
|
+
* WorkerMessageSubject represents the handled worker message subjects.
|
|
1782
|
+
*/
|
|
1783
|
+
export declare enum WorkerMessageSubject {
|
|
1784
|
+
WorkerMessageEmitted = "emit",
|
|
1785
|
+
WorkerMessageExit = "exit",
|
|
1786
|
+
WorkerMessageLog = "log",
|
|
1787
|
+
WorkerMessageFailed = "failed"
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
/**
|
|
1791
|
+
* WorkerMetadata is an interface that defines the structure of the worker metadata that is sent from the external extractor to the AirSync platform.
|
|
1792
|
+
*/
|
|
1793
|
+
declare interface WorkerMetadata {
|
|
1794
|
+
adaas_library_version: string;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
/**
|
|
1798
|
+
* WorkerPathOverrides represents a mapping of event types to custom worker paths.
|
|
1799
|
+
*/
|
|
1800
|
+
export declare type WorkerPathOverrides = Partial<Record<EventType, string>>;
|
|
1801
|
+
|
|
1802
|
+
export { }
|