@devrev/airsync-sdk 2.0.0-beta.0

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.
Files changed (180) hide show
  1. package/README.md +31 -0
  2. package/dist/attachments-streaming/attachments-streaming-pool.d.ts +16 -0
  3. package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -0
  4. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts +9 -0
  5. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts.map +1 -0
  6. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.js +2 -0
  7. package/dist/attachments-streaming/attachments-streaming-pool.js +97 -0
  8. package/dist/attachments-streaming/attachments-streaming-pool.test.d.ts +2 -0
  9. package/dist/attachments-streaming/attachments-streaming-pool.test.d.ts.map +1 -0
  10. package/dist/attachments-streaming/attachments-streaming-pool.test.js +267 -0
  11. package/dist/common/constants.d.ts +25 -0
  12. package/dist/common/constants.d.ts.map +1 -0
  13. package/dist/common/constants.js +58 -0
  14. package/dist/common/control-protocol.d.ts +10 -0
  15. package/dist/common/control-protocol.d.ts.map +1 -0
  16. package/dist/common/control-protocol.js +31 -0
  17. package/dist/common/errors.d.ts +6 -0
  18. package/dist/common/errors.d.ts.map +1 -0
  19. package/dist/common/errors.js +4 -0
  20. package/dist/common/event-type-translation.d.ts +24 -0
  21. package/dist/common/event-type-translation.d.ts.map +1 -0
  22. package/dist/common/event-type-translation.js +117 -0
  23. package/dist/common/helpers.d.ts +41 -0
  24. package/dist/common/helpers.d.ts.map +1 -0
  25. package/dist/common/helpers.js +124 -0
  26. package/dist/common/install-initial-domain-mapping.d.ts +4 -0
  27. package/dist/common/install-initial-domain-mapping.d.ts.map +1 -0
  28. package/dist/common/install-initial-domain-mapping.js +58 -0
  29. package/dist/common/install-initial-domain-mapping.test.d.ts +2 -0
  30. package/dist/common/install-initial-domain-mapping.test.d.ts.map +1 -0
  31. package/dist/common/install-initial-domain-mapping.test.js +207 -0
  32. package/dist/deprecated/adapter/index.d.ts +62 -0
  33. package/dist/deprecated/adapter/index.d.ts.map +1 -0
  34. package/dist/deprecated/adapter/index.js +151 -0
  35. package/dist/deprecated/common/helpers.d.ts +7 -0
  36. package/dist/deprecated/common/helpers.d.ts.map +1 -0
  37. package/dist/deprecated/common/helpers.js +47 -0
  38. package/dist/deprecated/demo-extractor/external_domain_metadata.json +38 -0
  39. package/dist/deprecated/demo-extractor/index.d.ts +18 -0
  40. package/dist/deprecated/demo-extractor/index.d.ts.map +1 -0
  41. package/dist/deprecated/demo-extractor/index.js +161 -0
  42. package/dist/deprecated/http/client.d.ts +22 -0
  43. package/dist/deprecated/http/client.d.ts.map +1 -0
  44. package/dist/deprecated/http/client.js +161 -0
  45. package/dist/deprecated/uploader/index.d.ts +35 -0
  46. package/dist/deprecated/uploader/index.d.ts.map +1 -0
  47. package/dist/deprecated/uploader/index.js +161 -0
  48. package/dist/http/axios-client-internal.d.ts +3 -0
  49. package/dist/http/axios-client-internal.d.ts.map +1 -0
  50. package/dist/http/axios-client-internal.js +66 -0
  51. package/dist/http/axios-client-internal.test.d.ts +2 -0
  52. package/dist/http/axios-client-internal.test.d.ts.map +1 -0
  53. package/dist/http/axios-client-internal.test.js +154 -0
  54. package/dist/http/axios-client.d.ts +27 -0
  55. package/dist/http/axios-client.d.ts.map +1 -0
  56. package/dist/http/axios-client.js +57 -0
  57. package/dist/http/constants.d.ts +4 -0
  58. package/dist/http/constants.d.ts.map +1 -0
  59. package/dist/http/constants.js +6 -0
  60. package/dist/http/index.d.ts +3 -0
  61. package/dist/http/index.d.ts.map +1 -0
  62. package/dist/http/index.js +18 -0
  63. package/dist/http/types.d.ts +17 -0
  64. package/dist/http/types.d.ts.map +1 -0
  65. package/dist/http/types.js +2 -0
  66. package/dist/index.d.ts +14 -0
  67. package/dist/index.d.ts.map +1 -0
  68. package/dist/index.js +34 -0
  69. package/dist/logger/logger.constants.d.ts +6 -0
  70. package/dist/logger/logger.constants.d.ts.map +1 -0
  71. package/dist/logger/logger.constants.js +13 -0
  72. package/dist/logger/logger.context.d.ts +58 -0
  73. package/dist/logger/logger.context.d.ts.map +1 -0
  74. package/dist/logger/logger.context.js +86 -0
  75. package/dist/logger/logger.d.ts +89 -0
  76. package/dist/logger/logger.d.ts.map +1 -0
  77. package/dist/logger/logger.interfaces.d.ts +43 -0
  78. package/dist/logger/logger.interfaces.d.ts.map +1 -0
  79. package/dist/logger/logger.interfaces.js +9 -0
  80. package/dist/logger/logger.js +196 -0
  81. package/dist/logger/logger.test.d.ts +2 -0
  82. package/dist/logger/logger.test.d.ts.map +1 -0
  83. package/dist/logger/logger.test.js +490 -0
  84. package/dist/mappers/mappers.d.ts +52 -0
  85. package/dist/mappers/mappers.d.ts.map +1 -0
  86. package/dist/mappers/mappers.interface.d.ts +294 -0
  87. package/dist/mappers/mappers.interface.d.ts.map +1 -0
  88. package/dist/mappers/mappers.interface.js +48 -0
  89. package/dist/mappers/mappers.js +83 -0
  90. package/dist/mappers/mappers.test.d.ts +2 -0
  91. package/dist/mappers/mappers.test.d.ts.map +1 -0
  92. package/dist/mappers/mappers.test.js +107 -0
  93. package/dist/multithreading/create-worker.d.ts +5 -0
  94. package/dist/multithreading/create-worker.d.ts.map +1 -0
  95. package/dist/multithreading/create-worker.js +28 -0
  96. package/dist/multithreading/create-worker.test.d.ts +2 -0
  97. package/dist/multithreading/create-worker.test.d.ts.map +1 -0
  98. package/dist/multithreading/create-worker.test.js +89 -0
  99. package/dist/multithreading/process-task.d.ts +3 -0
  100. package/dist/multithreading/process-task.d.ts.map +1 -0
  101. package/dist/multithreading/process-task.js +58 -0
  102. package/dist/multithreading/spawn/spawn.d.ts +30 -0
  103. package/dist/multithreading/spawn/spawn.d.ts.map +1 -0
  104. package/dist/multithreading/spawn/spawn.helpers.d.ts +21 -0
  105. package/dist/multithreading/spawn/spawn.helpers.d.ts.map +1 -0
  106. package/dist/multithreading/spawn/spawn.helpers.js +114 -0
  107. package/dist/multithreading/spawn/spawn.helpers.test.d.ts +2 -0
  108. package/dist/multithreading/spawn/spawn.helpers.test.d.ts.map +1 -0
  109. package/dist/multithreading/spawn/spawn.helpers.test.js +293 -0
  110. package/dist/multithreading/spawn/spawn.js +249 -0
  111. package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.d.ts +2 -0
  112. package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.d.ts.map +1 -0
  113. package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.js +127 -0
  114. package/dist/multithreading/worker-adapter/worker-adapter.d.ts +91 -0
  115. package/dist/multithreading/worker-adapter/worker-adapter.d.ts.map +1 -0
  116. package/dist/multithreading/worker-adapter/worker-adapter.helpers.d.ts +22 -0
  117. package/dist/multithreading/worker-adapter/worker-adapter.helpers.d.ts.map +1 -0
  118. package/dist/multithreading/worker-adapter/worker-adapter.helpers.js +64 -0
  119. package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.d.ts +2 -0
  120. package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.d.ts.map +1 -0
  121. package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.js +514 -0
  122. package/dist/multithreading/worker-adapter/worker-adapter.js +747 -0
  123. package/dist/multithreading/worker-adapter/worker-adapter.test.d.ts +2 -0
  124. package/dist/multithreading/worker-adapter/worker-adapter.test.d.ts.map +1 -0
  125. package/dist/multithreading/worker-adapter/worker-adapter.test.js +483 -0
  126. package/dist/multithreading/worker.d.ts +2 -0
  127. package/dist/multithreading/worker.d.ts.map +1 -0
  128. package/dist/multithreading/worker.js +9 -0
  129. package/dist/repo/repo.d.ts +18 -0
  130. package/dist/repo/repo.d.ts.map +1 -0
  131. package/dist/repo/repo.interfaces.d.ts +46 -0
  132. package/dist/repo/repo.interfaces.d.ts.map +1 -0
  133. package/dist/repo/repo.interfaces.js +2 -0
  134. package/dist/repo/repo.js +75 -0
  135. package/dist/repo/repo.test.d.ts +2 -0
  136. package/dist/repo/repo.test.d.ts.map +1 -0
  137. package/dist/repo/repo.test.js +131 -0
  138. package/dist/state/state.d.ts +30 -0
  139. package/dist/state/state.d.ts.map +1 -0
  140. package/dist/state/state.interfaces.d.ts +51 -0
  141. package/dist/state/state.interfaces.d.ts.map +1 -0
  142. package/dist/state/state.interfaces.js +21 -0
  143. package/dist/state/state.js +166 -0
  144. package/dist/state/state.test.d.ts +2 -0
  145. package/dist/state/state.test.d.ts.map +1 -0
  146. package/dist/state/state.test.js +224 -0
  147. package/dist/types/common.d.ts +50 -0
  148. package/dist/types/common.d.ts.map +1 -0
  149. package/dist/types/common.js +25 -0
  150. package/dist/types/extraction.d.ts +417 -0
  151. package/dist/types/extraction.d.ts.map +1 -0
  152. package/dist/types/extraction.js +170 -0
  153. package/dist/types/extraction.test.d.ts +2 -0
  154. package/dist/types/extraction.test.d.ts.map +1 -0
  155. package/dist/types/extraction.test.js +70 -0
  156. package/dist/types/index.d.ts +9 -0
  157. package/dist/types/index.d.ts.map +1 -0
  158. package/dist/types/index.js +18 -0
  159. package/dist/types/loading.d.ts +147 -0
  160. package/dist/types/loading.d.ts.map +1 -0
  161. package/dist/types/loading.js +48 -0
  162. package/dist/types/workers.d.ts +161 -0
  163. package/dist/types/workers.d.ts.map +1 -0
  164. package/dist/types/workers.js +22 -0
  165. package/dist/uploader/uploader.d.ts +92 -0
  166. package/dist/uploader/uploader.d.ts.map +1 -0
  167. package/dist/uploader/uploader.helpers.d.ts +33 -0
  168. package/dist/uploader/uploader.helpers.d.ts.map +1 -0
  169. package/dist/uploader/uploader.helpers.js +139 -0
  170. package/dist/uploader/uploader.helpers.test.d.ts +2 -0
  171. package/dist/uploader/uploader.helpers.test.d.ts.map +1 -0
  172. package/dist/uploader/uploader.helpers.test.js +267 -0
  173. package/dist/uploader/uploader.interfaces.d.ts +95 -0
  174. package/dist/uploader/uploader.interfaces.d.ts.map +1 -0
  175. package/dist/uploader/uploader.interfaces.js +2 -0
  176. package/dist/uploader/uploader.js +305 -0
  177. package/dist/uploader/uploader.test.d.ts +2 -0
  178. package/dist/uploader/uploader.test.d.ts.map +1 -0
  179. package/dist/uploader/uploader.test.js +589 -0
  180. package/package.json +60 -0
@@ -0,0 +1,294 @@
1
+ import { AirdropEvent } from '../types';
2
+ import { DonV2 } from '../types/loading';
3
+ import { WorkerAdapterOptions } from '../types/workers';
4
+ /**
5
+ * Configuration interface for creating a Mappers instance.
6
+ */
7
+ export interface MappersFactoryInterface {
8
+ event: AirdropEvent;
9
+ options?: WorkerAdapterOptions;
10
+ }
11
+ /**
12
+ * Parameters for updating a sync mapper record.
13
+ */
14
+ export interface UpdateSyncMapperRecordParams {
15
+ /** External system IDs to add */
16
+ external_ids: {
17
+ add: string[];
18
+ };
19
+ /**
20
+ * Optional map that labels values in `external_ids` with their usage context.
21
+ * Use for example when an external system requires different identifiers for different API calls
22
+ * (for example, a UUID for one endpoint and a login username for another).
23
+ *
24
+ * Example:
25
+ * external_ids: ["2a1c...-uuid", "john_doe"]
26
+ * secondary_ids: { "username": "john_doe" }
27
+ *
28
+ * Note: Values in `secondary_ids` are not indexed. If you need to look up by a
29
+ * secondary value (e.g., username), you must also include that value in `external_ids`.
30
+ */
31
+ secondary_ids?: Record<string, string>;
32
+ /** DevRev entity IDs to add */
33
+ targets: {
34
+ add: DonV2[];
35
+ };
36
+ status: SyncMapperRecordStatus;
37
+ /**
38
+ * Optionally populated with the file name of the input file that contains the
39
+ * object data. Can be populated on create and on update of the object to help
40
+ * in finding the object later if some debugging is needed.
41
+ */
42
+ input_files?: {
43
+ add: string[];
44
+ };
45
+ /**
46
+ * Records external-system changes to prevent update loops.
47
+ * When you create/update the object in the external system during loading,
48
+ * add that object's modified_date here. Later, when the object is extracted
49
+ * and the DevRev Loader evaluates whether to apply it, if the modified_date
50
+ * is present in this list the update is skipped (because the change
51
+ * originated in DevRev).
52
+ */
53
+ external_versions?: {
54
+ add: SyncMapperRecordExternalVersion[];
55
+ };
56
+ /**
57
+ * Free-form data storage for your use. Store any additional information here.
58
+ */
59
+ extra_data?: string;
60
+ }
61
+ /**
62
+ * Represents a sync mapper record that links external system entities to DevRev entities.
63
+ */
64
+ export interface SyncMapperRecord {
65
+ id: DonV2;
66
+ /** Array of external system IDs that map to the same DevRev object */
67
+ external_ids: string[];
68
+ /**
69
+ * Optional map that labels values in `external_ids` with their usage context.
70
+ * Use when an external system requires different identifiers for different API calls
71
+ * (for example, a UUID for one endpoint and a login username for another).
72
+ *
73
+ * Example:
74
+ * external_ids: ["2a1c...-uuid", "john_doe"]
75
+ * secondary_ids: { "username": "john_doe" }
76
+ *
77
+ * Note: Values in `secondary_ids` are not indexed. If you need to look up by a
78
+ * secondary value (e.g., username), you must also include that value in `external_ids`.
79
+ */
80
+ secondary_ids?: Record<string, string>;
81
+ /** Array of DevRev entity IDs this mapping points to */
82
+ targets: DonV2[];
83
+ status: SyncMapperRecordStatus;
84
+ /**
85
+ * Optional file name where the object data was found.
86
+ * Useful for debugging - helps locate the source of object data later.
87
+ */
88
+ input_files?: string[];
89
+ /**
90
+ * Records external-system changes to prevent update loops.
91
+ * When the Loader writes to the external system, store the object's
92
+ * modified_date here. During the next sync back to DevRev, if the extracted
93
+ * object's modified_date exists in this list the update is skipped (avoids
94
+ * re-applying a DevRev-originated change).
95
+ */
96
+ external_versions?: SyncMapperRecordExternalVersion[];
97
+ /**
98
+ * Free-form data storage for your use. Store any additional information here.
99
+ * Completely opaque to the platform - use however you need.
100
+ */
101
+ extra_data?: string;
102
+ }
103
+ /**
104
+ * Parameters for retrieving a sync mapper record by DevRev target ID.
105
+ */
106
+ export interface MappersGetByTargetIdParams {
107
+ /** The sync unit ID that scopes the synchronization context */
108
+ sync_unit: DonV2;
109
+ /** The DevRev entity ID to look up */
110
+ target: DonV2;
111
+ }
112
+ /**
113
+ * Response containing a sync mapper record retrieved by target ID.
114
+ */
115
+ export interface MappersGetByTargetIdResponse {
116
+ sync_mapper_record: SyncMapperRecord;
117
+ }
118
+ /**
119
+ * Parameters for creating a new sync mapper record.
120
+ */
121
+ export interface MappersCreateParams {
122
+ /** The sync unit ID that scopes the synchronization context */
123
+ sync_unit: DonV2;
124
+ /** Array of external system identifiers */
125
+ external_ids: string[];
126
+ /**
127
+ * Optional map that labels values in `external_ids` with their usage context.
128
+ * Use when an external system requires different identifiers for different API calls
129
+ * (for example, a UUID for one endpoint and a login username for another).
130
+ *
131
+ * Example:
132
+ * external_ids: ["2a1c...-uuid", "john_doe"]
133
+ * secondary_ids: { "username": "john_doe" }
134
+ *
135
+ * Note: Values in `secondary_ids` are not indexed. If you need to look up by a
136
+ * secondary value (e.g., username), you must also include that value in `external_ids`.
137
+ */
138
+ secondary_ids?: Record<string, string>;
139
+ /** Array of DevRev entity IDs this mapping points to */
140
+ targets: DonV2[];
141
+ status: SyncMapperRecordStatus;
142
+ /**
143
+ * Input file names where the object was encountered.
144
+ * Used for observability and tracking.
145
+ */
146
+ input_files?: string[];
147
+ /**
148
+ * External version markers used to avoid update loops.
149
+ * After creating or updating the object in the external system, add its
150
+ * modified_date here. On subsequent extraction, the Loader skips applying the
151
+ * update if the modified_date is present (change originated in DevRev).
152
+ */
153
+ external_versions?: SyncMapperRecordExternalVersion[];
154
+ /**
155
+ * Opaque data for storing additional client-specific information.
156
+ * Fully managed by snapin authors.
157
+ */
158
+ extra_data?: string;
159
+ }
160
+ /**
161
+ * Response containing the newly created sync mapper record.
162
+ */
163
+ export interface MappersCreateResponse {
164
+ sync_mapper_record: SyncMapperRecord;
165
+ }
166
+ /**
167
+ * Parameters for updating an existing sync mapper record.
168
+ */
169
+ export interface MappersUpdateParams {
170
+ /** The ID of the existing sync mapper record to update */
171
+ id: DonV2;
172
+ /** The sync unit ID that scopes the synchronization context */
173
+ sync_unit: DonV2;
174
+ /** External system IDs to add to the existing mapping */
175
+ external_ids: {
176
+ add: string[];
177
+ };
178
+ /**
179
+ * Optional map that labels values in `external_ids` with their usage context.
180
+ * Use when an external system requires different identifiers for different API calls
181
+ * (for example, a UUID for one endpoint and a login username for another).
182
+ *
183
+ * Example:
184
+ * external_ids: ["2a1c...-uuid", "john_doe"]
185
+ * secondary_ids: { "username": "john_doe" }
186
+ *
187
+ * Note: Values in `secondary_ids` are not indexed. If you need to look up by a
188
+ * secondary value (e.g., username), you must also include that value in `external_ids`.
189
+ */
190
+ secondary_ids?: Record<string, string>;
191
+ /** DevRev entity IDs to add to the existing mapping */
192
+ targets: {
193
+ add: DonV2[];
194
+ };
195
+ status: SyncMapperRecordStatus;
196
+ /**
197
+ * Input file names where the object was encountered.
198
+ * Used for observability and tracking.
199
+ */
200
+ input_files?: {
201
+ add: string[];
202
+ };
203
+ /**
204
+ * External version markers used to avoid update loops.
205
+ * After creating or updating the object in the external system, add its
206
+ * modified_date here. On subsequent extraction, the Loader skips applying the
207
+ * update if the modified_date is present (change originated in DevRev).
208
+ */
209
+ external_versions?: {
210
+ add: SyncMapperRecordExternalVersion[];
211
+ };
212
+ /**
213
+ * Opaque data for storing additional client-specific information.
214
+ * Fully managed by snapin authors.
215
+ */
216
+ extra_data?: string;
217
+ }
218
+ /**
219
+ * Response containing the updated sync mapper record.
220
+ */
221
+ export interface MappersUpdateResponse {
222
+ sync_mapper_record: SyncMapperRecord;
223
+ }
224
+ /**
225
+ * Status of a sync mapper record indicating its operational state.
226
+ */
227
+ export declare enum SyncMapperRecordStatus {
228
+ /** The mapping is active and operational (default) */
229
+ OPERATIONAL = "operational",
230
+ /** The mapping was filtered out by user filter settings */
231
+ FILTERED = "filtered",
232
+ /**
233
+ * The external object should be ignored in sync operations.
234
+ * Use to prevent objects from being created or updated in DevRev.
235
+ */
236
+ IGNORED = "ignored"
237
+ }
238
+ /**
239
+ * External version tracking to prevent update loops.
240
+ * Used to identify changes that originated from your system.
241
+ */
242
+ export interface SyncMapperRecordExternalVersion {
243
+ /** Sync recipe version at the time the external change was written */
244
+ recipe_version: number;
245
+ /** External system modified timestamp (ISO 8601 string) used for loop detection */
246
+ modified_date: string;
247
+ }
248
+ /**
249
+ * Parameters for retrieving a sync mapper record by external system ID.
250
+ */
251
+ export interface MappersGetByExternalIdParams {
252
+ /** The sync unit ID that scopes the synchronization context */
253
+ sync_unit: DonV2;
254
+ /** The identifier from the external system */
255
+ external_id: string;
256
+ /** The type of DevRev entity to look for */
257
+ target_type: SyncMapperRecordTargetType;
258
+ }
259
+ /**
260
+ * Types of DevRev entities that can be targets in sync mapper records.
261
+ */
262
+ export declare enum SyncMapperRecordTargetType {
263
+ ACCESS_CONTROL_ENTRY = "access_control_entry",
264
+ ACCOUNT = "account",
265
+ AIRDROP_AUTHORIZATION_POLICY = "airdrop_authorization_policy",
266
+ AIRDROP_FIELD_AUTHORIZATION_POLICY = "airdrop_field_authorization_policy",
267
+ AIRDROP_PLATFORM_GROUP = "airdrop_platform_group",
268
+ ARTICLE = "article",
269
+ ARTIFACT = "artifact",
270
+ CHAT = "chat",
271
+ CONVERSATION = "conversation",
272
+ CUSTOM_OBJECT = "custom_object",
273
+ DIRECTORY = "directory",
274
+ GROUP = "group",
275
+ INCIDENT = "incident",
276
+ LINK = "link",
277
+ MEETING = "meeting",
278
+ OBJECT_MEMBER = "object_member",
279
+ PART = "part",
280
+ REV_ORG = "rev_org",
281
+ ROLE = "role",
282
+ ROLE_SET = "role_set",
283
+ TAG = "tag",
284
+ TIMELINE_COMMENT = "timeline_comment",
285
+ USER = "user",
286
+ WORK = "work"
287
+ }
288
+ /**
289
+ * Response containing a sync mapper record retrieved by external ID.
290
+ */
291
+ export interface MappersGetByExternalIdResponse {
292
+ sync_mapper_record: SyncMapperRecord;
293
+ }
294
+ //# sourceMappingURL=mappers.interface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappers.interface.d.ts","sourceRoot":"","sources":["../../src/mappers/mappers.interface.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAExD;;GAEG;AACH,M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", { value: true });
3
+ exports.SyncMapperRecordTargetType = exports.SyncMapperRecordStatus = void 0;
4
+ /**
5
+ * Status of a sync mapper record indicating its operational state.
6
+ */
7
+ var SyncMapperRecordStatus;
8
+ (function (SyncMapperRecordStatus) {
9
+ /** The mapping is active and operational (default) */
10
+ SyncMapperRecordStatus["OPERATIONAL"] = "operational";
11
+ /** The mapping was filtered out by user filter settings */
12
+ SyncMapperRecordStatus["FILTERED"] = "filtered";
13
+ /**
14
+ * The external object should be ignored in sync operations.
15
+ * Use to prevent objects from being created or updated in DevRev.
16
+ */
17
+ SyncMapperRecordStatus["IGNORED"] = "ignored";
18
+ })(SyncMapperRecordStatus || (exports.SyncMapperRecordStatus = SyncMapperRecordStatus = {}));
19
+ /**
20
+ * Types of DevRev entities that can be targets in sync mapper records.
21
+ */
22
+ var SyncMapperRecordTargetType;
23
+ (function (SyncMapperRecordTargetType) {
24
+ SyncMapperRecordTargetType["ACCESS_CONTROL_ENTRY"] = "access_control_entry";
25
+ SyncMapperRecordTargetType["ACCOUNT"] = "account";
26
+ SyncMapperRecordTargetType["AIRDROP_AUTHORIZATION_POLICY"] = "airdrop_authorization_policy";
27
+ SyncMapperRecordTargetType["AIRDROP_FIELD_AUTHORIZATION_POLICY"] = "airdrop_field_authorization_policy";
28
+ SyncMapperRecordTargetType["AIRDROP_PLATFORM_GROUP"] = "airdrop_platform_group";
29
+ SyncMapperRecordTargetType["ARTICLE"] = "article";
30
+ SyncMapperRecordTargetType["ARTIFACT"] = "artifact";
31
+ SyncMapperRecordTargetType["CHAT"] = "chat";
32
+ SyncMapperRecordTargetType["CONVERSATION"] = "conversation";
33
+ SyncMapperRecordTargetType["CUSTOM_OBJECT"] = "custom_object";
34
+ SyncMapperRecordTargetType["DIRECTORY"] = "directory";
35
+ SyncMapperRecordTargetType["GROUP"] = "group";
36
+ SyncMapperRecordTargetType["INCIDENT"] = "incident";
37
+ SyncMapperRecordTargetType["LINK"] = "link";
38
+ SyncMapperRecordTargetType["MEETING"] = "meeting";
39
+ SyncMapperRecordTargetType["OBJECT_MEMBER"] = "object_member";
40
+ SyncMapperRecordTargetType["PART"] = "part";
41
+ SyncMapperRecordTargetType["REV_ORG"] = "rev_org";
42
+ SyncMapperRecordTargetType["ROLE"] = "role";
43
+ SyncMapperRecordTargetType["ROLE_SET"] = "role_set";
44
+ SyncMapperRecordTargetType["TAG"] = "tag";
45
+ SyncMapperRecordTargetType["TIMELINE_COMMENT"] = "timeline_comment";
46
+ SyncMapperRecordTargetType["USER"] = "user";
47
+ SyncMapperRecordTargetType["WORK"] = "work";
48
+ })(SyncMapperRecordTargetType || (exports.SyncMapperRecordTargetType = SyncMapperRecordTargetType = {}));
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Mappers = void 0;
4
+ const axios_client_internal_1 = require("../http/axios-client-internal");
5
+ /**
6
+ * Manages sync mapper records that link external system items to DevRev items.
7
+ *
8
+ * Used for tracking relationships between external and DevRev entities during sync operations.
9
+ */
10
+ class Mappers {
11
+ constructor({ event }) {
12
+ this.devrevApiEndpoint = event.execution_metadata.devrev_endpoint;
13
+ this.devrevApiToken = event.context.secrets.service_account_token;
14
+ }
15
+ /**
16
+ * Retrieves a sync mapper record by DevRev ID.
17
+ *
18
+ * Used to find the mapping when you know the DevRev ID and want to find the external system ID.
19
+ *
20
+ * @param params - Query parameters of type MappersGetByTargetIdParams
21
+ * @returns Promise with response data containing the sync mapper record
22
+ */
23
+ async getByTargetId(params) {
24
+ const { sync_unit, target } = params;
25
+ return axios_client_internal_1.axiosClient.get(`${this.devrevApiEndpoint}/internal/airdrop.sync-mapper-record.get-by-target`, {
26
+ headers: {
27
+ Authorization: this.devrevApiToken,
28
+ },
29
+ params: { sync_unit, target },
30
+ });
31
+ }
32
+ /**
33
+ * Retrieves a sync mapper record by external system ID.
34
+ *
35
+ * Used to find the mapping when you know the external system ID and want to find the DevRev ID.
36
+ *
37
+ * @param params - Query parameters of type MappersGetByExternalIdParams
38
+ * @returns Promise with response data containing the sync mapper record
39
+ */
40
+ async getByExternalId(params) {
41
+ const { sync_unit, external_id, target_type } = params;
42
+ return axios_client_internal_1.axiosClient.get(`${this.devrevApiEndpoint}/internal/airdrop.sync-mapper-record.get-by-external-id`, {
43
+ headers: {
44
+ Authorization: this.devrevApiToken,
45
+ },
46
+ params: { sync_unit, external_id, target_type },
47
+ });
48
+ }
49
+ /**
50
+ * Creates a new sync mapper record to establish a relationship between external system
51
+ * entities and DevRev entities.
52
+ *
53
+ * This is called after importing an item from external system to DevRev to record
54
+ * the mapping for future synchronization operations.
55
+ *
56
+ * @param params - Creation parameters of type MappersCreateParams
57
+ * @returns Promise with response data containing the created sync mapper record
58
+ */
59
+ async create(params) {
60
+ return axios_client_internal_1.axiosClient.post(`${this.devrevApiEndpoint}/internal/airdrop.sync-mapper-record.create`, params, {
61
+ headers: {
62
+ Authorization: this.devrevApiToken,
63
+ },
64
+ });
65
+ }
66
+ /**
67
+ * Updates an existing sync mapper record.
68
+ *
69
+ * Used to modify existing mappings when external system entities change or when
70
+ * additional DevRev entities need to be associated.
71
+ *
72
+ * @param params - Update parameters of type MappersUpdateParams
73
+ * @returns Promise with response data containing the updated sync mapper record
74
+ */
75
+ async update(params) {
76
+ return axios_client_internal_1.axiosClient.post(`${this.devrevApiEndpoint}/internal/airdrop.sync-mapper-record.update`, params, {
77
+ headers: {
78
+ Authorization: this.devrevApiToken,
79
+ },
80
+ });
81
+ }
82
+ }
83
+ exports.Mappers = Mappers;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mappers.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappers.test.d.ts","sourceRoot":"","sources":["../../src/mappers/mappers.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const axios_client_internal_1 = require("../http/axios-client-internal");
4
+ const test_helpers_1 = require("../tests/test-helpers");
5
+ const extraction_1 = require("../types/extraction");
6
+ const mappers_1 = require("./mappers");
7
+ const mappers_interface_1 = require("./mappers.interface");
8
+ // Mock the axios client
9
+ jest.mock('../http/axios-client-internal');
10
+ const mockAxiosClient = axios_client_internal_1.axiosClient;
11
+ describe(mappers_1.Mappers.name, () => {
12
+ const apiEndpoint = 'test_devrev_endpoint';
13
+ const apiToken = 'test_service_token';
14
+ const syncUnit = 'test_sync_unit';
15
+ const targetId = 'test_target_id';
16
+ const externalId = 'test_external_id';
17
+ const id = 'test_id';
18
+ const externalIds = ['test_external_id'];
19
+ const targets = ['test_target_id'];
20
+ const mockEvent = (0, test_helpers_1.createEvent)({
21
+ eventType: extraction_1.EventType.ExtractionDataStart,
22
+ executionMetadataOverrides: { devrev_endpoint: apiEndpoint },
23
+ contextOverrides: {
24
+ secrets: { service_account_token: apiToken },
25
+ },
26
+ });
27
+ const mappers = new mappers_1.Mappers({ event: mockEvent });
28
+ beforeEach(() => {
29
+ jest.clearAllMocks();
30
+ });
31
+ it(`should call ${mappers.getByTargetId.name} with correct endpoint, headers and params`, async () => {
32
+ // Arrange
33
+ const params = {
34
+ sync_unit: syncUnit,
35
+ target: targetId,
36
+ };
37
+ mockAxiosClient.get.mockResolvedValue({ data: {} });
38
+ // Act
39
+ await mappers.getByTargetId(params);
40
+ // Assert
41
+ expect(mockAxiosClient.get).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.get-by-target`, {
42
+ headers: {
43
+ Authorization: apiToken,
44
+ },
45
+ params: { sync_unit: syncUnit, target: targetId },
46
+ });
47
+ });
48
+ it(`should call ${mappers.getByExternalId.name} with correct endpoint, headers and params`, async () => {
49
+ // Arrange
50
+ const params = {
51
+ sync_unit: syncUnit,
52
+ external_id: externalId,
53
+ target_type: mappers_interface_1.SyncMapperRecordTargetType.USER,
54
+ };
55
+ mockAxiosClient.get.mockResolvedValue({ data: {} });
56
+ // Act
57
+ await mappers.getByExternalId(params);
58
+ // Assert
59
+ expect(mockAxiosClient.get).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.get-by-external-id`, {
60
+ headers: {
61
+ Authorization: apiToken,
62
+ },
63
+ params: {
64
+ sync_unit: syncUnit,
65
+ external_id: externalId,
66
+ target_type: mappers_interface_1.SyncMapperRecordTargetType.USER,
67
+ },
68
+ });
69
+ });
70
+ it(`should call ${mappers.create.name} with correct endpoint, headers and data`, async () => {
71
+ // Arrange
72
+ const params = {
73
+ sync_unit: syncUnit,
74
+ external_ids: externalIds,
75
+ targets: targets,
76
+ status: mappers_interface_1.SyncMapperRecordStatus.OPERATIONAL,
77
+ };
78
+ mockAxiosClient.post.mockResolvedValue({ data: {} });
79
+ // Act
80
+ await mappers.create(params);
81
+ // Assert
82
+ expect(mockAxiosClient.post).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.create`, params, {
83
+ headers: {
84
+ Authorization: apiToken,
85
+ },
86
+ });
87
+ });
88
+ it(`should call ${mappers.update.name} with correct endpoint, headers and data`, async () => {
89
+ // Arrange
90
+ const params = {
91
+ id: id,
92
+ sync_unit: syncUnit,
93
+ external_ids: { add: externalIds },
94
+ targets: { add: targets },
95
+ status: mappers_interface_1.SyncMapperRecordStatus.OPERATIONAL,
96
+ };
97
+ mockAxiosClient.post.mockResolvedValue({ data: {} });
98
+ // Act
99
+ await mappers.update(params);
100
+ // Assert
101
+ expect(mockAxiosClient.post).toHaveBeenCalledWith(`${apiEndpoint}/internal/airdrop.sync-mapper-record.update`, params, {
102
+ headers: {
103
+ Authorization: apiToken,
104
+ },
105
+ });
106
+ });
107
+ });
@@ -0,0 +1,5 @@
1
+ import { Worker } from 'node:worker_threads';
2
+ import { WorkerData } from '../types/workers';
3
+ declare function createWorker<ConnectorState>(workerData: WorkerData<ConnectorState>): Promise<Worker>;
4
+ export { createWorker };
5
+ //# sourceMappingURL=create-worker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-worker.d.ts","sourceRoot":"","sources":["../../src/multithreading/create-worker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,UAAU,EAAe,MAAM,kBAAkB,CAAC;AAE3D,iBAAe,YAAY,CAAC,cAAc,EACxC,UAAU,EAAE,UAAU,CAAC,cAAc,CAAC,GACrC,OAAO,CAAC,MAAM,CAAC,CAyBjB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createWorker = createWorker;
4
+ const node_worker_threads_1 = require("node:worker_threads");
5
+ const workers_1 = require("../types/workers");
6
+ async function createWorker(workerData) {
7
+ return new Promise((resolve, reject) => {
8
+ if (node_worker_threads_1.isMainThread) {
9
+ const workerFile = __dirname + '/worker.js';
10
+ const worker = new node_worker_threads_1.Worker(workerFile, {
11
+ workerData,
12
+ });
13
+ worker.on(workers_1.WorkerEvent.WorkerError, (error) => {
14
+ console.error('Worker error', error);
15
+ reject(error);
16
+ });
17
+ worker.on(workers_1.WorkerEvent.WorkerOnline, () => {
18
+ resolve(worker);
19
+ console.info('Worker is online. Started processing the task with event type: ' +
20
+ workerData.event.payload.event_type +
21
+ '.');
22
+ });
23
+ }
24
+ else {
25
+ reject(new Error('Worker threads can not start more worker threads.'));
26
+ }
27
+ });
28
+ }
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=create-worker.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-worker.test.d.ts","sourceRoot":"","sources":["../../src/multithreading/create-worker.test.ts"],"names":[],"mappings":""}