@devrev/airsync-sdk 2.0.0-beta.1 → 2.0.0-beta.11

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 (229) hide show
  1. package/README.md +7 -21
  2. package/dist/attachments-streaming/attachments-streaming-pool.d.ts +6 -7
  3. package/dist/attachments-streaming/attachments-streaming-pool.d.ts.map +1 -1
  4. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts +4 -3
  5. package/dist/attachments-streaming/attachments-streaming-pool.interfaces.d.ts.map +1 -1
  6. package/dist/attachments-streaming/attachments-streaming-pool.js +69 -61
  7. package/dist/common/constants.d.ts +15 -12
  8. package/dist/common/constants.d.ts.map +1 -1
  9. package/dist/common/constants.js +20 -34
  10. package/dist/common/helpers.d.ts +3 -27
  11. package/dist/common/helpers.d.ts.map +1 -1
  12. package/dist/common/helpers.js +6 -36
  13. package/dist/http/client.d.ts +4 -0
  14. package/dist/http/client.d.ts.map +1 -0
  15. package/dist/http/client.js +80 -0
  16. package/dist/http/errors.d.ts +8 -0
  17. package/dist/http/errors.d.ts.map +1 -0
  18. package/dist/http/errors.js +31 -0
  19. package/dist/index.d.ts +30 -12
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +47 -28
  22. package/dist/logger/logger.d.ts +13 -70
  23. package/dist/logger/logger.d.ts.map +1 -1
  24. package/dist/logger/logger.interfaces.d.ts +4 -7
  25. package/dist/logger/logger.interfaces.d.ts.map +1 -1
  26. package/dist/logger/logger.js +67 -92
  27. package/dist/mappers/mappers.d.ts +10 -43
  28. package/dist/mappers/mappers.d.ts.map +1 -1
  29. package/dist/mappers/mappers.interfaces.d.ts +173 -0
  30. package/dist/mappers/mappers.interfaces.d.ts.map +1 -0
  31. package/dist/mappers/{mappers.interface.js → mappers.interfaces.js} +1 -10
  32. package/dist/mappers/mappers.js +32 -46
  33. package/dist/multithreading/adapters/base-adapter.d.ts +39 -0
  34. package/dist/multithreading/adapters/base-adapter.d.ts.map +1 -0
  35. package/dist/multithreading/adapters/base-adapter.js +212 -0
  36. package/dist/multithreading/adapters/extraction-adapter.d.ts +49 -0
  37. package/dist/multithreading/adapters/extraction-adapter.d.ts.map +1 -0
  38. package/dist/multithreading/adapters/extraction-adapter.js +375 -0
  39. package/dist/multithreading/adapters/loading-adapter.d.ts +26 -0
  40. package/dist/multithreading/adapters/loading-adapter.d.ts.map +1 -0
  41. package/dist/multithreading/adapters/loading-adapter.helpers.d.ts +12 -0
  42. package/dist/multithreading/adapters/loading-adapter.helpers.d.ts.map +1 -0
  43. package/dist/multithreading/{worker-adapter/worker-adapter.helpers.js → adapters/loading-adapter.helpers.js} +2 -12
  44. package/dist/multithreading/adapters/loading-adapter.js +279 -0
  45. package/dist/multithreading/emit.d.ts +11 -0
  46. package/dist/multithreading/emit.d.ts.map +1 -0
  47. package/dist/multithreading/emit.js +25 -0
  48. package/dist/multithreading/process-task.d.ts +6 -1
  49. package/dist/multithreading/process-task.d.ts.map +1 -1
  50. package/dist/multithreading/process-task.js +120 -82
  51. package/dist/multithreading/spawn/spawn.d.ts +10 -11
  52. package/dist/multithreading/spawn/spawn.d.ts.map +1 -1
  53. package/dist/multithreading/spawn/spawn.helpers.d.ts +12 -11
  54. package/dist/multithreading/spawn/spawn.helpers.d.ts.map +1 -1
  55. package/dist/multithreading/spawn/spawn.helpers.js +142 -77
  56. package/dist/multithreading/spawn/spawn.js +59 -75
  57. package/dist/multithreading/worker.js +16 -5
  58. package/dist/repo/repo.d.ts +14 -5
  59. package/dist/repo/repo.d.ts.map +1 -1
  60. package/dist/repo/repo.helpers.d.ts +6 -0
  61. package/dist/repo/repo.helpers.d.ts.map +1 -0
  62. package/dist/repo/repo.helpers.js +16 -0
  63. package/dist/repo/repo.interfaces.d.ts +11 -20
  64. package/dist/repo/repo.interfaces.d.ts.map +1 -1
  65. package/dist/repo/repo.js +36 -22
  66. package/dist/state/base-state.d.ts +58 -0
  67. package/dist/state/base-state.d.ts.map +1 -0
  68. package/dist/state/base-state.js +242 -0
  69. package/dist/state/extraction-state.d.ts +14 -0
  70. package/dist/state/extraction-state.d.ts.map +1 -0
  71. package/dist/state/extraction-state.js +146 -0
  72. package/dist/state/install-initial-domain-mapping.d.ts +4 -0
  73. package/dist/state/install-initial-domain-mapping.d.ts.map +1 -0
  74. package/dist/{common → state}/install-initial-domain-mapping.js +5 -7
  75. package/dist/state/loading-state.d.ts +8 -0
  76. package/dist/state/loading-state.d.ts.map +1 -0
  77. package/dist/state/loading-state.js +29 -0
  78. package/dist/state/state.d.ts +3 -29
  79. package/dist/state/state.d.ts.map +1 -1
  80. package/dist/state/state.interfaces.d.ts +31 -12
  81. package/dist/state/state.interfaces.d.ts.map +1 -1
  82. package/dist/state/state.interfaces.js +17 -1
  83. package/dist/state/state.js +9 -164
  84. package/dist/state/time-value-resolver.d.ts +17 -0
  85. package/dist/state/time-value-resolver.d.ts.map +1 -0
  86. package/dist/state/time-value-resolver.js +110 -0
  87. package/dist/testing/mock-event.d.ts +10 -0
  88. package/dist/testing/mock-event.d.ts.map +1 -0
  89. package/dist/testing/mock-event.js +96 -0
  90. package/dist/testing/mock-server.d.ts +31 -0
  91. package/dist/testing/mock-server.d.ts.map +1 -0
  92. package/dist/testing/mock-server.interfaces.d.ts +54 -0
  93. package/dist/testing/mock-server.interfaces.d.ts.map +1 -0
  94. package/dist/testing/mock-server.interfaces.js +4 -0
  95. package/dist/testing/mock-server.js +297 -0
  96. package/dist/testing/test-adapters.d.ts +22 -0
  97. package/dist/testing/test-adapters.d.ts.map +1 -0
  98. package/dist/testing/test-adapters.js +32 -0
  99. package/dist/types/common.d.ts +4 -37
  100. package/dist/types/common.d.ts.map +1 -1
  101. package/dist/types/common.js +2 -17
  102. package/dist/types/errors.d.ts +15 -0
  103. package/dist/types/errors.d.ts.map +1 -0
  104. package/dist/types/errors.js +28 -0
  105. package/dist/types/external-domain-metadata.d.ts +40 -162
  106. package/dist/types/external-domain-metadata.d.ts.map +1 -1
  107. package/dist/types/extraction.d.ts +135 -278
  108. package/dist/types/extraction.d.ts.map +1 -1
  109. package/dist/types/extraction.js +46 -133
  110. package/dist/types/loading.d.ts +15 -55
  111. package/dist/types/loading.d.ts.map +1 -1
  112. package/dist/types/loading.js +1 -23
  113. package/dist/types/workers.d.ts +70 -103
  114. package/dist/types/workers.d.ts.map +1 -1
  115. package/dist/types/workers.js +1 -6
  116. package/dist/uploader/uploader.d.ts +10 -61
  117. package/dist/uploader/uploader.d.ts.map +1 -1
  118. package/dist/uploader/uploader.helpers.d.ts +7 -27
  119. package/dist/uploader/uploader.helpers.d.ts.map +1 -1
  120. package/dist/uploader/uploader.helpers.js +80 -30
  121. package/dist/uploader/uploader.interfaces.d.ts +19 -54
  122. package/dist/uploader/uploader.interfaces.d.ts.map +1 -1
  123. package/dist/uploader/uploader.interfaces.js +8 -0
  124. package/dist/uploader/uploader.js +72 -124
  125. package/docs/MIGRATION.md +751 -0
  126. package/package.json +35 -22
  127. package/dist/attachments-streaming/attachments-streaming-pool.test.d.ts +0 -2
  128. package/dist/attachments-streaming/attachments-streaming-pool.test.d.ts.map +0 -1
  129. package/dist/attachments-streaming/attachments-streaming-pool.test.js +0 -321
  130. package/dist/common/control-protocol.d.ts +0 -10
  131. package/dist/common/control-protocol.d.ts.map +0 -1
  132. package/dist/common/control-protocol.js +0 -31
  133. package/dist/common/errors.d.ts +0 -6
  134. package/dist/common/errors.d.ts.map +0 -1
  135. package/dist/common/errors.js +0 -4
  136. package/dist/common/event-type-translation.d.ts +0 -24
  137. package/dist/common/event-type-translation.d.ts.map +0 -1
  138. package/dist/common/event-type-translation.js +0 -117
  139. package/dist/common/install-initial-domain-mapping.d.ts +0 -4
  140. package/dist/common/install-initial-domain-mapping.d.ts.map +0 -1
  141. package/dist/common/install-initial-domain-mapping.test.d.ts +0 -2
  142. package/dist/common/install-initial-domain-mapping.test.d.ts.map +0 -1
  143. package/dist/common/install-initial-domain-mapping.test.js +0 -208
  144. package/dist/deprecated/adapter/index.d.ts +0 -62
  145. package/dist/deprecated/adapter/index.d.ts.map +0 -1
  146. package/dist/deprecated/adapter/index.js +0 -151
  147. package/dist/deprecated/common/helpers.d.ts +0 -7
  148. package/dist/deprecated/common/helpers.d.ts.map +0 -1
  149. package/dist/deprecated/common/helpers.js +0 -47
  150. package/dist/deprecated/demo-extractor/external_domain_metadata.json +0 -38
  151. package/dist/deprecated/demo-extractor/index.d.ts +0 -18
  152. package/dist/deprecated/demo-extractor/index.d.ts.map +0 -1
  153. package/dist/deprecated/demo-extractor/index.js +0 -161
  154. package/dist/deprecated/http/client.d.ts +0 -22
  155. package/dist/deprecated/http/client.d.ts.map +0 -1
  156. package/dist/deprecated/http/client.js +0 -161
  157. package/dist/deprecated/uploader/index.d.ts +0 -35
  158. package/dist/deprecated/uploader/index.d.ts.map +0 -1
  159. package/dist/deprecated/uploader/index.js +0 -161
  160. package/dist/http/axios-client-internal.d.ts +0 -3
  161. package/dist/http/axios-client-internal.d.ts.map +0 -1
  162. package/dist/http/axios-client-internal.js +0 -66
  163. package/dist/http/axios-client-internal.test.d.ts +0 -2
  164. package/dist/http/axios-client-internal.test.d.ts.map +0 -1
  165. package/dist/http/axios-client-internal.test.js +0 -154
  166. package/dist/http/axios-client.d.ts +0 -27
  167. package/dist/http/axios-client.d.ts.map +0 -1
  168. package/dist/http/axios-client.js +0 -57
  169. package/dist/http/constants.d.ts +0 -4
  170. package/dist/http/constants.d.ts.map +0 -1
  171. package/dist/http/constants.js +0 -6
  172. package/dist/http/index.d.ts +0 -3
  173. package/dist/http/index.d.ts.map +0 -1
  174. package/dist/http/index.js +0 -18
  175. package/dist/http/types.d.ts +0 -17
  176. package/dist/http/types.d.ts.map +0 -1
  177. package/dist/http/types.js +0 -2
  178. package/dist/logger/logger.constants.d.ts +0 -6
  179. package/dist/logger/logger.constants.d.ts.map +0 -1
  180. package/dist/logger/logger.constants.js +0 -13
  181. package/dist/logger/logger.context.d.ts +0 -58
  182. package/dist/logger/logger.context.d.ts.map +0 -1
  183. package/dist/logger/logger.context.js +0 -86
  184. package/dist/logger/logger.test.d.ts +0 -2
  185. package/dist/logger/logger.test.d.ts.map +0 -1
  186. package/dist/logger/logger.test.js +0 -490
  187. package/dist/mappers/mappers.interface.d.ts +0 -294
  188. package/dist/mappers/mappers.interface.d.ts.map +0 -1
  189. package/dist/mappers/mappers.test.d.ts +0 -2
  190. package/dist/mappers/mappers.test.d.ts.map +0 -1
  191. package/dist/mappers/mappers.test.js +0 -107
  192. package/dist/multithreading/create-worker.test.d.ts +0 -2
  193. package/dist/multithreading/create-worker.test.d.ts.map +0 -1
  194. package/dist/multithreading/create-worker.test.js +0 -89
  195. package/dist/multithreading/spawn/spawn.helpers.test.d.ts +0 -2
  196. package/dist/multithreading/spawn/spawn.helpers.test.d.ts.map +0 -1
  197. package/dist/multithreading/spawn/spawn.helpers.test.js +0 -293
  198. package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.d.ts +0 -2
  199. package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.d.ts.map +0 -1
  200. package/dist/multithreading/worker-adapter/worker-adapter.artifacts.test.js +0 -127
  201. package/dist/multithreading/worker-adapter/worker-adapter.d.ts +0 -91
  202. package/dist/multithreading/worker-adapter/worker-adapter.d.ts.map +0 -1
  203. package/dist/multithreading/worker-adapter/worker-adapter.helpers.d.ts +0 -22
  204. package/dist/multithreading/worker-adapter/worker-adapter.helpers.d.ts.map +0 -1
  205. package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.d.ts +0 -2
  206. package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.d.ts.map +0 -1
  207. package/dist/multithreading/worker-adapter/worker-adapter.helpers.test.js +0 -514
  208. package/dist/multithreading/worker-adapter/worker-adapter.js +0 -745
  209. package/dist/multithreading/worker-adapter/worker-adapter.test.d.ts +0 -2
  210. package/dist/multithreading/worker-adapter/worker-adapter.test.d.ts.map +0 -1
  211. package/dist/multithreading/worker-adapter/worker-adapter.test.js +0 -483
  212. package/dist/repo/repo.test.d.ts +0 -2
  213. package/dist/repo/repo.test.d.ts.map +0 -1
  214. package/dist/repo/repo.test.js +0 -131
  215. package/dist/state/state.test.d.ts +0 -2
  216. package/dist/state/state.test.d.ts.map +0 -1
  217. package/dist/state/state.test.js +0 -224
  218. package/dist/types/extraction.test.d.ts +0 -2
  219. package/dist/types/extraction.test.d.ts.map +0 -1
  220. package/dist/types/extraction.test.js +0 -70
  221. package/dist/types/index.d.ts +0 -10
  222. package/dist/types/index.d.ts.map +0 -1
  223. package/dist/types/index.js +0 -18
  224. package/dist/uploader/uploader.helpers.test.d.ts +0 -2
  225. package/dist/uploader/uploader.helpers.test.d.ts.map +0 -1
  226. package/dist/uploader/uploader.helpers.test.js +0 -267
  227. package/dist/uploader/uploader.test.d.ts +0 -2
  228. package/dist/uploader/uploader.test.d.ts.map +0 -1
  229. package/dist/uploader/uploader.test.js +0 -589
@@ -1,294 +0,0 @@
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
@@ -1 +0,0 @@
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,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8B;IAC7C,kBAAkB,EAAE,gBAAgB,CAAC;CACtC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=mappers.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mappers.test.d.ts","sourceRoot":"","sources":["../../src/mappers/mappers.test.ts"],"names":[],"mappings":""}
@@ -1,107 +0,0 @@
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
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=create-worker.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-worker.test.d.ts","sourceRoot":"","sources":["../../src/multithreading/create-worker.test.ts"],"names":[],"mappings":""}
@@ -1,89 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const worker_threads_1 = require("worker_threads");
4
- const test_helpers_1 = require("../tests/test-helpers");
5
- const extraction_1 = require("../types/extraction");
6
- const create_worker_1 = require("./create-worker");
7
- describe(create_worker_1.createWorker.name, () => {
8
- it('should create a Worker instance when valid parameters are provided', async () => {
9
- const workerPath = __dirname + '../tests/dummy-worker.ts';
10
- const worker = worker_threads_1.isMainThread
11
- ? await (0, create_worker_1.createWorker)({
12
- event: (0, test_helpers_1.createEvent)({
13
- eventType: extraction_1.EventType.ExtractionExternalSyncUnitsStart,
14
- }),
15
- initialState: {},
16
- workerPath,
17
- })
18
- : null;
19
- expect(worker).not.toBeNull();
20
- expect(worker).toBeInstanceOf(worker_threads_1.Worker);
21
- if (worker) {
22
- await worker.terminate();
23
- }
24
- });
25
- it('should throw error when not in main thread', async () => {
26
- const originalIsMainThread = worker_threads_1.isMainThread;
27
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
- worker_threads_1.isMainThread = false;
29
- const workerPath = __dirname + '../tests/dummy-worker.ts';
30
- await expect((0, create_worker_1.createWorker)({
31
- event: (0, test_helpers_1.createEvent)({
32
- eventType: extraction_1.EventType.ExtractionExternalSyncUnitsStart,
33
- }),
34
- initialState: {},
35
- workerPath,
36
- })).rejects.toThrow('Worker threads can not start more worker threads.');
37
- // Restore original value
38
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
39
- worker_threads_1.isMainThread = originalIsMainThread;
40
- });
41
- it('[edge] should handle worker creation with minimal valid data', async () => {
42
- const workerPath = __dirname + '../tests/dummy-worker.ts';
43
- if (worker_threads_1.isMainThread) {
44
- const worker = await (0, create_worker_1.createWorker)({
45
- event: (0, test_helpers_1.createEvent)({
46
- eventType: extraction_1.EventType.ExtractionExternalSyncUnitsStart,
47
- }),
48
- initialState: {},
49
- workerPath,
50
- });
51
- expect(worker).toBeInstanceOf(worker_threads_1.Worker);
52
- await worker.terminate();
53
- }
54
- });
55
- it('[edge] should handle worker creation with complex initial state', async () => {
56
- const workerPath = __dirname + '../tests/dummy-worker.ts';
57
- const complexState = {
58
- nested: {
59
- data: [1, 2, 3],
60
- config: { enabled: true },
61
- },
62
- };
63
- if (worker_threads_1.isMainThread) {
64
- const worker = await (0, create_worker_1.createWorker)({
65
- event: (0, test_helpers_1.createEvent)({
66
- eventType: extraction_1.EventType.ExtractionDataStart,
67
- }),
68
- initialState: complexState,
69
- workerPath,
70
- });
71
- expect(worker).toBeInstanceOf(worker_threads_1.Worker);
72
- await worker.terminate();
73
- }
74
- });
75
- it('[edge] should handle different event types', async () => {
76
- const workerPath = __dirname + '../tests/dummy-worker.ts';
77
- if (worker_threads_1.isMainThread) {
78
- const worker = await (0, create_worker_1.createWorker)({
79
- event: (0, test_helpers_1.createEvent)({
80
- eventType: extraction_1.EventType.ExtractionMetadataStart,
81
- }),
82
- initialState: {},
83
- workerPath,
84
- });
85
- expect(worker).toBeInstanceOf(worker_threads_1.Worker);
86
- await worker.terminate();
87
- }
88
- });
89
- });
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=spawn.helpers.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spawn.helpers.test.d.ts","sourceRoot":"","sources":["../../../src/multithreading/spawn/spawn.helpers.test.ts"],"names":[],"mappings":""}