polytomic 1.11.3 → 1.14.4

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 (501) hide show
  1. package/Client.d.ts +20 -15
  2. package/Client.js +9 -9
  3. package/LICENSE +1 -1
  4. package/api/errors/BadRequestError.js +17 -7
  5. package/api/errors/ConflictError.js +17 -7
  6. package/api/errors/ForbiddenError.js +17 -7
  7. package/api/errors/InternalServerError.js +17 -7
  8. package/api/errors/NotFoundError.js +17 -7
  9. package/api/errors/UnauthorizedError.js +17 -7
  10. package/api/errors/UnprocessableEntityError.js +17 -7
  11. package/api/resources/bulkSync/client/Client.d.ts +47 -6
  12. package/api/resources/bulkSync/client/Client.js +135 -157
  13. package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +11 -3
  14. package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +11 -3
  15. package/api/resources/bulkSync/resources/executions/client/Client.d.ts +13 -2
  16. package/api/resources/bulkSync/resources/executions/client/Client.js +75 -79
  17. package/api/resources/bulkSync/resources/executions/client/requests/ExecutionsListRequest.d.ts +18 -0
  18. package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +1 -0
  19. package/api/resources/bulkSync/resources/index.d.ts +2 -0
  20. package/api/resources/bulkSync/resources/index.js +20 -8
  21. package/api/resources/bulkSync/resources/schedules/client/Client.d.ts +113 -0
  22. package/api/resources/bulkSync/resources/schedules/client/Client.js +398 -0
  23. package/api/resources/bulkSync/resources/schedules/client/index.d.ts +1 -0
  24. package/api/resources/bulkSync/resources/schedules/client/index.js +17 -0
  25. package/api/resources/bulkSync/resources/schedules/client/requests/CreateScheduleRequest.d.ts +15 -0
  26. package/api/resources/bulkSync/resources/schedules/client/requests/UpdateScheduleRequest.d.ts +15 -0
  27. package/api/resources/bulkSync/resources/schedules/client/requests/index.d.ts +2 -0
  28. package/api/resources/bulkSync/resources/schedules/client/requests/index.js +2 -0
  29. package/api/resources/bulkSync/resources/schedules/index.d.ts +1 -0
  30. package/api/resources/bulkSync/resources/schedules/index.js +17 -0
  31. package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +5 -0
  32. package/api/resources/bulkSync/resources/schemas/client/Client.js +49 -66
  33. package/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +3 -1
  34. package/api/resources/bulkSync/types/V2CreateBulkSyncRequestSchemasItem.d.ts +1 -1
  35. package/api/resources/bulkSync/types/V2UpdateBulkSyncRequestSchemasItem.d.ts +1 -1
  36. package/api/resources/connections/client/Client.d.ts +41 -2
  37. package/api/resources/connections/client/Client.js +159 -128
  38. package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +7 -0
  39. package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +3 -1
  40. package/api/resources/connections/client/requests/TestConnectionRequest.d.ts +24 -0
  41. package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +3 -1
  42. package/api/resources/connections/client/requests/index.d.ts +1 -0
  43. package/api/resources/events/client/Client.d.ts +7 -2
  44. package/api/resources/events/client/Client.js +33 -37
  45. package/api/resources/events/client/requests/EventsListRequest.d.ts +2 -2
  46. package/api/resources/identity/client/Client.d.ts +7 -0
  47. package/api/resources/identity/client/Client.js +25 -20
  48. package/api/resources/index.d.ts +2 -1
  49. package/api/resources/index.js +20 -9
  50. package/api/resources/jobs/client/Client.d.ts +7 -2
  51. package/api/resources/jobs/client/Client.js +25 -22
  52. package/api/resources/modelSync/client/Client.d.ts +83 -52
  53. package/api/resources/modelSync/client/Client.js +228 -403
  54. package/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +14 -5
  55. package/api/resources/modelSync/client/requests/ModelSyncListRequest.d.ts +1 -1
  56. package/api/resources/modelSync/client/requests/StartModelSyncRequest.d.ts +1 -0
  57. package/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +14 -5
  58. package/api/resources/modelSync/client/requests/index.d.ts +0 -2
  59. package/api/resources/modelSync/resources/executions/client/Client.d.ts +36 -8
  60. package/api/resources/modelSync/resources/executions/client/Client.js +137 -68
  61. package/api/resources/modelSync/resources/executions/client/index.d.ts +1 -1
  62. package/api/resources/modelSync/resources/executions/client/index.js +15 -0
  63. package/api/resources/modelSync/resources/executions/client/requests/ExecutionsListRequest.d.ts +16 -0
  64. package/api/resources/modelSync/resources/executions/client/requests/ExecutionsListRequest.js +5 -0
  65. package/api/resources/modelSync/resources/executions/client/requests/UpdateExecutionRequest.d.ts +13 -0
  66. package/api/resources/modelSync/resources/executions/client/requests/UpdateExecutionRequest.js +5 -0
  67. package/api/resources/modelSync/resources/executions/client/requests/index.d.ts +2 -0
  68. package/api/resources/modelSync/resources/executions/client/requests/index.js +2 -0
  69. package/api/resources/modelSync/resources/index.d.ts +3 -0
  70. package/api/resources/modelSync/resources/index.js +23 -7
  71. package/api/resources/modelSync/resources/targets/client/Client.d.ts +143 -0
  72. package/api/resources/modelSync/resources/targets/client/Client.js +395 -0
  73. package/api/resources/modelSync/resources/targets/client/index.d.ts +1 -0
  74. package/api/resources/modelSync/resources/targets/client/index.js +17 -0
  75. package/api/resources/modelSync/{client/requests/ModelSyncGetTargetFieldsRequest.d.ts → resources/targets/client/requests/TargetsGetTargetFieldsRequest.d.ts} +1 -1
  76. package/api/resources/modelSync/resources/targets/client/requests/TargetsGetTargetFieldsRequest.js +5 -0
  77. package/{dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts → api/resources/modelSync/resources/targets/client/requests/TargetsGetTargetRequest.d.ts} +1 -1
  78. package/api/resources/modelSync/resources/targets/client/requests/TargetsGetTargetRequest.js +5 -0
  79. package/api/resources/modelSync/resources/targets/client/requests/index.d.ts +2 -0
  80. package/api/resources/modelSync/resources/targets/client/requests/index.js +2 -0
  81. package/api/resources/modelSync/resources/targets/index.d.ts +1 -0
  82. package/api/resources/modelSync/resources/targets/index.js +17 -0
  83. package/api/resources/models/client/Client.d.ts +5 -0
  84. package/api/resources/models/client/Client.js +83 -135
  85. package/api/resources/organization/client/Client.d.ts +7 -0
  86. package/api/resources/organization/client/Client.js +53 -72
  87. package/api/resources/permissions/client/Client.d.ts +7 -2
  88. package/api/resources/permissions/resources/index.js +17 -7
  89. package/api/resources/permissions/resources/policies/client/Client.d.ts +5 -0
  90. package/api/resources/permissions/resources/policies/client/Client.js +47 -72
  91. package/api/resources/permissions/resources/roles/client/Client.d.ts +5 -0
  92. package/api/resources/permissions/resources/roles/client/Client.js +47 -72
  93. package/api/resources/queryRunner/client/Client.d.ts +5 -0
  94. package/api/resources/queryRunner/client/Client.js +33 -37
  95. package/api/resources/schemas/client/Client.d.ts +68 -0
  96. package/api/resources/schemas/client/Client.js +302 -59
  97. package/api/resources/schemas/client/index.d.ts +1 -1
  98. package/api/resources/schemas/client/index.js +15 -0
  99. package/api/resources/schemas/client/requests/SetPrimaryKeysRequest.d.ts +11 -0
  100. package/api/resources/schemas/client/requests/SetPrimaryKeysRequest.js +5 -0
  101. package/api/resources/schemas/client/requests/UpsertSchemaFieldRequest.d.ts +11 -0
  102. package/api/resources/schemas/client/requests/UpsertSchemaFieldRequest.js +5 -0
  103. package/api/resources/schemas/client/requests/index.d.ts +2 -0
  104. package/api/resources/schemas/client/requests/index.js +2 -0
  105. package/api/resources/users/client/Client.d.ts +5 -0
  106. package/api/resources/users/client/Client.js +55 -87
  107. package/api/resources/webhooks/client/Client.d.ts +33 -4
  108. package/api/resources/webhooks/client/Client.js +169 -76
  109. package/api/types/BackendConnectionCapabilities.d.ts +9 -0
  110. package/api/types/BackendConnectionCapabilities.js +5 -0
  111. package/api/types/BackendOAuthPrompt.d.ts +8 -0
  112. package/api/types/BackendOAuthPrompt.js +5 -0
  113. package/api/types/BulkBulkSyncSchedule.d.ts +20 -0
  114. package/api/types/BulkBulkSyncSchedule.js +5 -0
  115. package/api/types/BulkDiscover.d.ts +1 -1
  116. package/api/types/BulkExecutionStatus.d.ts +2 -1
  117. package/api/types/BulkExecutionStatus.js +1 -0
  118. package/api/types/BulkFetchMode.d.ts +1 -1
  119. package/api/types/BulkField.d.ts +2 -0
  120. package/api/types/BulkNormalizeNames.d.ts +9 -0
  121. package/api/types/BulkNormalizeNames.js +11 -0
  122. package/api/types/BulkSchema.d.ts +1 -0
  123. package/api/types/BulkSchemaExecutionStatus.d.ts +2 -1
  124. package/api/types/BulkSchemaExecutionStatus.js +1 -0
  125. package/api/types/BulkSelectiveMode.d.ts +1 -1
  126. package/api/types/BulkSyncExecution.d.ts +6 -0
  127. package/api/types/BulkSyncMode.d.ts +11 -0
  128. package/api/types/BulkSyncMode.js +10 -0
  129. package/api/types/BulkSyncResponse.d.ts +10 -1
  130. package/api/types/BulkSyncSchemaExecution.d.ts +3 -0
  131. package/api/types/CancelModelSyncResponse.d.ts +6 -0
  132. package/api/types/CancelModelSyncResponse.js +5 -0
  133. package/api/types/CancelModelSyncResponseEnvelope.d.ts +7 -0
  134. package/api/types/CancelModelSyncResponseEnvelope.js +5 -0
  135. package/api/types/ConnectCardResponse.d.ts +1 -0
  136. package/api/types/ConnectionResponseSchema.d.ts +5 -0
  137. package/api/types/ConnectionType.d.ts +6 -0
  138. package/api/types/ConnectionTypeSchema.d.ts +1 -0
  139. package/api/types/CreateConnectionResponseSchema.d.ts +3 -0
  140. package/api/types/EventBody.d.ts +1 -1
  141. package/api/types/ExecutionCounts.d.ts +2 -0
  142. package/api/types/ExecutionStatus.d.ts +1 -1
  143. package/api/types/FilterFieldReferenceType.d.ts +1 -1
  144. package/api/types/FilterFunction.d.ts +3 -1
  145. package/api/types/FilterFunction.js +2 -0
  146. package/api/types/GetIdentityResponseSchema.d.ts +7 -0
  147. package/api/types/JsonschemaDefinitions.d.ts +1 -1
  148. package/api/types/JsonschemaForm.d.ts +1 -1
  149. package/api/types/LabelLabel.d.ts +1 -1
  150. package/api/types/ListBulkSyncExecutionsEnvelope.d.ts +1 -0
  151. package/api/types/ListExecutionResponseEnvelope.d.ts +1 -0
  152. package/api/types/ModelField.d.ts +4 -0
  153. package/api/types/ModelSyncField.d.ts +2 -0
  154. package/api/types/{SyncMode.d.ts → ModelSyncMode.d.ts} +2 -4
  155. package/{dist/api/types/SyncMode.js → api/types/ModelSyncMode.js} +2 -4
  156. package/api/types/ModelSyncResponse.d.ts +6 -1
  157. package/api/types/PaginationDetails.d.ts +6 -0
  158. package/api/types/PaginationDetails.js +5 -0
  159. package/api/types/ScheduleEnvelope.d.ts +7 -0
  160. package/api/types/ScheduleEnvelope.js +5 -0
  161. package/api/types/ScheduleFrequency.d.ts +1 -1
  162. package/api/types/SchedulesEnvelope.d.ts +7 -0
  163. package/api/types/SchedulesEnvelope.js +5 -0
  164. package/api/types/SchemaField.d.ts +2 -0
  165. package/api/types/SchemaIdentityFunction.d.ts +3 -1
  166. package/api/types/SchemaIdentityFunction.js +2 -0
  167. package/api/types/SchemaPrimaryKeyOverrideInput.d.ts +7 -0
  168. package/api/types/SchemaPrimaryKeyOverrideInput.js +5 -0
  169. package/api/types/StartModelSyncResponseSchema.d.ts +1 -0
  170. package/api/types/SupportedBulkMode.d.ts +1 -1
  171. package/api/types/SupportedMode.d.ts +1 -1
  172. package/api/types/SyncDestinationProperties.d.ts +1 -0
  173. package/api/types/Target.d.ts +4 -1
  174. package/api/types/TargetCreateInput.d.ts +11 -0
  175. package/api/types/TargetCreateInput.js +5 -0
  176. package/api/types/TargetField.d.ts +1 -0
  177. package/api/types/TypesType.d.ts +1 -1
  178. package/api/types/UpdateBulkField.d.ts +9 -0
  179. package/api/types/UpdateBulkField.js +5 -0
  180. package/api/types/UtilEnumValue.d.ts +7 -0
  181. package/api/types/UtilEnumValue.js +5 -0
  182. package/api/types/UtilFieldType.d.ts +1 -1
  183. package/api/types/V2ConnectionForm.d.ts +7 -0
  184. package/api/types/V2ConnectionForm.js +5 -0
  185. package/api/types/V2EnricherConfiguration.d.ts +1 -1
  186. package/api/types/V2EnricherMapping.d.ts +1 -1
  187. package/api/types/V2ExecutionLogType.d.ts +1 -1
  188. package/api/types/V2OrderedMapStringGithubComInvopopJsonschemaSchema.d.ts +1 -1
  189. package/api/types/V2SampleRecord.d.ts +1 -1
  190. package/api/types/V2SchemaConfigurationFieldsItem.d.ts +1 -1
  191. package/api/types/V4BulkSyncExecutionLogs.d.ts +1 -1
  192. package/api/types/V4BulkSyncScheduleApi.d.ts +13 -0
  193. package/api/types/V4BulkSyncScheduleApi.js +5 -0
  194. package/api/types/V4TargetCreator.d.ts +10 -0
  195. package/api/types/V4TargetCreator.js +5 -0
  196. package/api/types/V4TargetObjectsResponseEnvelope.d.ts +1 -0
  197. package/api/types/V4TargetPropertyValues.d.ts +14 -0
  198. package/api/types/V4TargetPropertyValues.js +5 -0
  199. package/api/types/V4TargetPropertyValuesEnvelope.d.ts +7 -0
  200. package/api/types/V4TargetPropertyValuesEnvelope.js +5 -0
  201. package/api/types/V4UserFieldRequest.d.ts +10 -0
  202. package/api/types/V4UserFieldRequest.js +5 -0
  203. package/api/types/Webhook.d.ts +1 -0
  204. package/api/types/WorkTaskStatus.d.ts +1 -1
  205. package/api/types/index.d.ts +21 -1
  206. package/api/types/index.js +21 -1
  207. package/core/auth/BearerToken.d.ts +1 -1
  208. package/core/fetcher/APIResponse.d.ts +1 -1
  209. package/core/fetcher/Fetcher.d.ts +6 -3
  210. package/core/fetcher/Fetcher.js +20 -189
  211. package/core/fetcher/Supplier.d.ts +1 -1
  212. package/core/fetcher/createRequestUrl.d.ts +1 -0
  213. package/core/fetcher/createRequestUrl.js +12 -0
  214. package/core/fetcher/getFetchFn.d.ts +4 -0
  215. package/core/fetcher/getFetchFn.js +68 -0
  216. package/core/fetcher/getHeader.js +1 -2
  217. package/core/fetcher/getRequestBody.d.ts +7 -0
  218. package/core/fetcher/getRequestBody.js +23 -0
  219. package/core/fetcher/getResponseBody.d.ts +1 -0
  220. package/core/fetcher/getResponseBody.js +54 -0
  221. package/core/fetcher/makeRequest.d.ts +1 -0
  222. package/core/fetcher/makeRequest.js +42 -0
  223. package/core/fetcher/requestWithRetries.d.ts +1 -0
  224. package/core/fetcher/requestWithRetries.js +40 -0
  225. package/core/fetcher/signals.d.ts +11 -0
  226. package/core/fetcher/signals.js +36 -0
  227. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  228. package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  229. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  230. package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  231. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  232. package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  233. package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  234. package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  235. package/core/json.d.ts +15 -0
  236. package/core/json.js +24 -0
  237. package/core/runtime/runtime.d.ts +2 -1
  238. package/core/runtime/runtime.js +52 -41
  239. package/dist/Client.d.ts +20 -15
  240. package/dist/Client.js +9 -9
  241. package/dist/api/errors/BadRequestError.js +17 -7
  242. package/dist/api/errors/ConflictError.js +17 -7
  243. package/dist/api/errors/ForbiddenError.js +17 -7
  244. package/dist/api/errors/InternalServerError.js +17 -7
  245. package/dist/api/errors/NotFoundError.js +17 -7
  246. package/dist/api/errors/UnauthorizedError.js +17 -7
  247. package/dist/api/errors/UnprocessableEntityError.js +17 -7
  248. package/dist/api/resources/bulkSync/client/Client.d.ts +47 -6
  249. package/dist/api/resources/bulkSync/client/Client.js +135 -157
  250. package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +11 -3
  251. package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +11 -3
  252. package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +13 -2
  253. package/dist/api/resources/bulkSync/resources/executions/client/Client.js +75 -79
  254. package/dist/api/resources/bulkSync/resources/executions/client/requests/ExecutionsListRequest.d.ts +18 -0
  255. package/dist/api/resources/bulkSync/resources/executions/client/requests/ExecutionsListRequest.js +5 -0
  256. package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +1 -0
  257. package/dist/api/resources/bulkSync/resources/index.d.ts +2 -0
  258. package/dist/api/resources/bulkSync/resources/index.js +20 -8
  259. package/dist/api/resources/bulkSync/resources/schedules/client/Client.d.ts +113 -0
  260. package/dist/api/resources/bulkSync/resources/schedules/client/Client.js +398 -0
  261. package/dist/api/resources/bulkSync/resources/schedules/client/index.d.ts +1 -0
  262. package/dist/api/resources/bulkSync/resources/schedules/client/index.js +17 -0
  263. package/dist/api/resources/bulkSync/resources/schedules/client/requests/CreateScheduleRequest.d.ts +15 -0
  264. package/dist/api/resources/bulkSync/resources/schedules/client/requests/CreateScheduleRequest.js +5 -0
  265. package/dist/api/resources/bulkSync/resources/schedules/client/requests/UpdateScheduleRequest.d.ts +15 -0
  266. package/dist/api/resources/bulkSync/resources/schedules/client/requests/UpdateScheduleRequest.js +5 -0
  267. package/dist/api/resources/bulkSync/resources/schedules/client/requests/index.d.ts +2 -0
  268. package/dist/api/resources/bulkSync/resources/schedules/client/requests/index.js +2 -0
  269. package/dist/api/resources/bulkSync/resources/schedules/index.d.ts +1 -0
  270. package/dist/api/resources/bulkSync/resources/schedules/index.js +17 -0
  271. package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +5 -0
  272. package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +49 -66
  273. package/dist/api/resources/bulkSync/resources/schemas/client/requests/UpdateBulkSchema.d.ts +3 -1
  274. package/dist/api/resources/bulkSync/types/V2CreateBulkSyncRequestSchemasItem.d.ts +1 -1
  275. package/dist/api/resources/bulkSync/types/V2UpdateBulkSyncRequestSchemasItem.d.ts +1 -1
  276. package/dist/api/resources/connections/client/Client.d.ts +41 -2
  277. package/dist/api/resources/connections/client/Client.js +159 -128
  278. package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +7 -0
  279. package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +3 -1
  280. package/dist/api/resources/connections/client/requests/TestConnectionRequest.d.ts +24 -0
  281. package/dist/api/resources/connections/client/requests/TestConnectionRequest.js +5 -0
  282. package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +3 -1
  283. package/dist/api/resources/connections/client/requests/index.d.ts +1 -0
  284. package/dist/api/resources/events/client/Client.d.ts +7 -2
  285. package/dist/api/resources/events/client/Client.js +33 -37
  286. package/dist/api/resources/events/client/requests/EventsListRequest.d.ts +2 -2
  287. package/dist/api/resources/identity/client/Client.d.ts +7 -0
  288. package/dist/api/resources/identity/client/Client.js +25 -20
  289. package/dist/api/resources/index.d.ts +2 -1
  290. package/dist/api/resources/index.js +20 -9
  291. package/dist/api/resources/jobs/client/Client.d.ts +7 -2
  292. package/dist/api/resources/jobs/client/Client.js +25 -22
  293. package/dist/api/resources/modelSync/client/Client.d.ts +83 -52
  294. package/dist/api/resources/modelSync/client/Client.js +228 -403
  295. package/dist/api/resources/modelSync/client/requests/CreateModelSyncRequest.d.ts +14 -5
  296. package/dist/api/resources/modelSync/client/requests/ModelSyncListRequest.d.ts +1 -1
  297. package/dist/api/resources/modelSync/client/requests/StartModelSyncRequest.d.ts +1 -0
  298. package/dist/api/resources/modelSync/client/requests/UpdateModelSyncRequest.d.ts +14 -5
  299. package/dist/api/resources/modelSync/client/requests/index.d.ts +0 -2
  300. package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +36 -8
  301. package/dist/api/resources/modelSync/resources/executions/client/Client.js +137 -68
  302. package/dist/api/resources/modelSync/resources/executions/client/index.d.ts +1 -1
  303. package/dist/api/resources/modelSync/resources/executions/client/index.js +15 -0
  304. package/dist/api/resources/modelSync/resources/executions/client/requests/ExecutionsListRequest.d.ts +16 -0
  305. package/dist/api/resources/modelSync/resources/executions/client/requests/ExecutionsListRequest.js +5 -0
  306. package/dist/api/resources/modelSync/resources/executions/client/requests/UpdateExecutionRequest.d.ts +13 -0
  307. package/dist/api/resources/modelSync/resources/executions/client/requests/UpdateExecutionRequest.js +5 -0
  308. package/dist/api/resources/modelSync/resources/executions/client/requests/index.d.ts +2 -0
  309. package/dist/api/resources/modelSync/resources/executions/client/requests/index.js +2 -0
  310. package/dist/api/resources/modelSync/resources/index.d.ts +3 -0
  311. package/dist/api/resources/modelSync/resources/index.js +23 -7
  312. package/dist/api/resources/modelSync/resources/targets/client/Client.d.ts +143 -0
  313. package/dist/api/resources/modelSync/resources/targets/client/Client.js +395 -0
  314. package/dist/api/resources/modelSync/resources/targets/client/index.d.ts +1 -0
  315. package/dist/api/resources/modelSync/resources/targets/client/index.js +17 -0
  316. package/dist/api/resources/modelSync/{client/requests/ModelSyncGetTargetFieldsRequest.d.ts → resources/targets/client/requests/TargetsGetTargetFieldsRequest.d.ts} +1 -1
  317. package/dist/api/resources/modelSync/resources/targets/client/requests/TargetsGetTargetFieldsRequest.js +5 -0
  318. package/{api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts → dist/api/resources/modelSync/resources/targets/client/requests/TargetsGetTargetRequest.d.ts} +1 -1
  319. package/dist/api/resources/modelSync/resources/targets/client/requests/TargetsGetTargetRequest.js +5 -0
  320. package/dist/api/resources/modelSync/resources/targets/client/requests/index.d.ts +2 -0
  321. package/dist/api/resources/modelSync/resources/targets/client/requests/index.js +2 -0
  322. package/dist/api/resources/modelSync/resources/targets/index.d.ts +1 -0
  323. package/dist/api/resources/modelSync/resources/targets/index.js +17 -0
  324. package/dist/api/resources/models/client/Client.d.ts +5 -0
  325. package/dist/api/resources/models/client/Client.js +83 -135
  326. package/dist/api/resources/organization/client/Client.d.ts +7 -0
  327. package/dist/api/resources/organization/client/Client.js +53 -72
  328. package/dist/api/resources/permissions/client/Client.d.ts +7 -2
  329. package/dist/api/resources/permissions/resources/index.js +17 -7
  330. package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +5 -0
  331. package/dist/api/resources/permissions/resources/policies/client/Client.js +47 -72
  332. package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +5 -0
  333. package/dist/api/resources/permissions/resources/roles/client/Client.js +47 -72
  334. package/dist/api/resources/queryRunner/client/Client.d.ts +5 -0
  335. package/dist/api/resources/queryRunner/client/Client.js +33 -37
  336. package/dist/api/resources/schemas/client/Client.d.ts +68 -0
  337. package/dist/api/resources/schemas/client/Client.js +302 -59
  338. package/dist/api/resources/schemas/client/index.d.ts +1 -1
  339. package/dist/api/resources/schemas/client/index.js +15 -0
  340. package/dist/api/resources/schemas/client/requests/SetPrimaryKeysRequest.d.ts +11 -0
  341. package/dist/api/resources/schemas/client/requests/SetPrimaryKeysRequest.js +5 -0
  342. package/dist/api/resources/schemas/client/requests/UpsertSchemaFieldRequest.d.ts +11 -0
  343. package/dist/api/resources/schemas/client/requests/UpsertSchemaFieldRequest.js +5 -0
  344. package/dist/api/resources/schemas/client/requests/index.d.ts +2 -0
  345. package/dist/api/resources/schemas/client/requests/index.js +2 -0
  346. package/dist/api/resources/users/client/Client.d.ts +5 -0
  347. package/dist/api/resources/users/client/Client.js +55 -87
  348. package/dist/api/resources/webhooks/client/Client.d.ts +33 -4
  349. package/dist/api/resources/webhooks/client/Client.js +169 -76
  350. package/dist/api/types/BackendConnectionCapabilities.d.ts +9 -0
  351. package/dist/api/types/BackendConnectionCapabilities.js +5 -0
  352. package/dist/api/types/BackendOAuthPrompt.d.ts +8 -0
  353. package/dist/api/types/BackendOAuthPrompt.js +5 -0
  354. package/dist/api/types/BulkBulkSyncSchedule.d.ts +20 -0
  355. package/dist/api/types/BulkBulkSyncSchedule.js +5 -0
  356. package/dist/api/types/BulkDiscover.d.ts +1 -1
  357. package/dist/api/types/BulkExecutionStatus.d.ts +2 -1
  358. package/dist/api/types/BulkExecutionStatus.js +1 -0
  359. package/dist/api/types/BulkFetchMode.d.ts +1 -1
  360. package/dist/api/types/BulkField.d.ts +2 -0
  361. package/dist/api/types/BulkNormalizeNames.d.ts +9 -0
  362. package/dist/api/types/BulkNormalizeNames.js +11 -0
  363. package/dist/api/types/BulkSchema.d.ts +1 -0
  364. package/dist/api/types/BulkSchemaExecutionStatus.d.ts +2 -1
  365. package/dist/api/types/BulkSchemaExecutionStatus.js +1 -0
  366. package/dist/api/types/BulkSelectiveMode.d.ts +1 -1
  367. package/dist/api/types/BulkSyncExecution.d.ts +6 -0
  368. package/dist/api/types/BulkSyncMode.d.ts +11 -0
  369. package/dist/api/types/BulkSyncMode.js +10 -0
  370. package/dist/api/types/BulkSyncResponse.d.ts +10 -1
  371. package/dist/api/types/BulkSyncSchemaExecution.d.ts +3 -0
  372. package/dist/api/types/CancelModelSyncResponse.d.ts +6 -0
  373. package/dist/api/types/CancelModelSyncResponse.js +5 -0
  374. package/dist/api/types/CancelModelSyncResponseEnvelope.d.ts +7 -0
  375. package/dist/api/types/CancelModelSyncResponseEnvelope.js +5 -0
  376. package/dist/api/types/ConnectCardResponse.d.ts +1 -0
  377. package/dist/api/types/ConnectionResponseSchema.d.ts +5 -0
  378. package/dist/api/types/ConnectionType.d.ts +6 -0
  379. package/dist/api/types/ConnectionTypeSchema.d.ts +1 -0
  380. package/dist/api/types/CreateConnectionResponseSchema.d.ts +3 -0
  381. package/dist/api/types/EventBody.d.ts +1 -1
  382. package/dist/api/types/ExecutionCounts.d.ts +2 -0
  383. package/dist/api/types/ExecutionStatus.d.ts +1 -1
  384. package/dist/api/types/FilterFieldReferenceType.d.ts +1 -1
  385. package/dist/api/types/FilterFunction.d.ts +3 -1
  386. package/dist/api/types/FilterFunction.js +2 -0
  387. package/dist/api/types/GetIdentityResponseSchema.d.ts +7 -0
  388. package/dist/api/types/JsonschemaDefinitions.d.ts +1 -1
  389. package/dist/api/types/JsonschemaForm.d.ts +1 -1
  390. package/dist/api/types/LabelLabel.d.ts +1 -1
  391. package/dist/api/types/ListBulkSyncExecutionsEnvelope.d.ts +1 -0
  392. package/dist/api/types/ListExecutionResponseEnvelope.d.ts +1 -0
  393. package/dist/api/types/ModelField.d.ts +4 -0
  394. package/dist/api/types/ModelSyncField.d.ts +2 -0
  395. package/dist/api/types/{SyncMode.d.ts → ModelSyncMode.d.ts} +2 -4
  396. package/{api/types/SyncMode.js → dist/api/types/ModelSyncMode.js} +2 -4
  397. package/dist/api/types/ModelSyncResponse.d.ts +6 -1
  398. package/dist/api/types/PaginationDetails.d.ts +6 -0
  399. package/dist/api/types/PaginationDetails.js +5 -0
  400. package/dist/api/types/ScheduleEnvelope.d.ts +7 -0
  401. package/dist/api/types/ScheduleEnvelope.js +5 -0
  402. package/dist/api/types/ScheduleFrequency.d.ts +1 -1
  403. package/dist/api/types/SchedulesEnvelope.d.ts +7 -0
  404. package/dist/api/types/SchedulesEnvelope.js +5 -0
  405. package/dist/api/types/SchemaField.d.ts +2 -0
  406. package/dist/api/types/SchemaIdentityFunction.d.ts +3 -1
  407. package/dist/api/types/SchemaIdentityFunction.js +2 -0
  408. package/dist/api/types/SchemaPrimaryKeyOverrideInput.d.ts +7 -0
  409. package/dist/api/types/SchemaPrimaryKeyOverrideInput.js +5 -0
  410. package/dist/api/types/StartModelSyncResponseSchema.d.ts +1 -0
  411. package/dist/api/types/SupportedBulkMode.d.ts +1 -1
  412. package/dist/api/types/SupportedMode.d.ts +1 -1
  413. package/dist/api/types/SyncDestinationProperties.d.ts +1 -0
  414. package/dist/api/types/Target.d.ts +4 -1
  415. package/dist/api/types/TargetCreateInput.d.ts +11 -0
  416. package/dist/api/types/TargetCreateInput.js +5 -0
  417. package/dist/api/types/TargetField.d.ts +1 -0
  418. package/dist/api/types/TypesType.d.ts +1 -1
  419. package/dist/api/types/UpdateBulkField.d.ts +9 -0
  420. package/dist/api/types/UpdateBulkField.js +5 -0
  421. package/dist/api/types/UtilEnumValue.d.ts +7 -0
  422. package/dist/api/types/UtilEnumValue.js +5 -0
  423. package/dist/api/types/UtilFieldType.d.ts +1 -1
  424. package/dist/api/types/V2ConnectionForm.d.ts +7 -0
  425. package/dist/api/types/V2ConnectionForm.js +5 -0
  426. package/dist/api/types/V2EnricherConfiguration.d.ts +1 -1
  427. package/dist/api/types/V2EnricherMapping.d.ts +1 -1
  428. package/dist/api/types/V2ExecutionLogType.d.ts +1 -1
  429. package/dist/api/types/V2OrderedMapStringGithubComInvopopJsonschemaSchema.d.ts +1 -1
  430. package/dist/api/types/V2SampleRecord.d.ts +1 -1
  431. package/dist/api/types/V2SchemaConfigurationFieldsItem.d.ts +1 -1
  432. package/dist/api/types/V4BulkSyncExecutionLogs.d.ts +1 -1
  433. package/dist/api/types/V4BulkSyncScheduleApi.d.ts +13 -0
  434. package/dist/api/types/V4BulkSyncScheduleApi.js +5 -0
  435. package/dist/api/types/V4TargetCreator.d.ts +10 -0
  436. package/dist/api/types/V4TargetCreator.js +5 -0
  437. package/dist/api/types/V4TargetObjectsResponseEnvelope.d.ts +1 -0
  438. package/dist/api/types/V4TargetPropertyValues.d.ts +14 -0
  439. package/dist/api/types/V4TargetPropertyValues.js +5 -0
  440. package/dist/api/types/V4TargetPropertyValuesEnvelope.d.ts +7 -0
  441. package/dist/api/types/V4TargetPropertyValuesEnvelope.js +5 -0
  442. package/dist/api/types/V4UserFieldRequest.d.ts +10 -0
  443. package/dist/api/types/V4UserFieldRequest.js +5 -0
  444. package/dist/api/types/Webhook.d.ts +1 -0
  445. package/dist/api/types/WorkTaskStatus.d.ts +1 -1
  446. package/dist/api/types/index.d.ts +21 -1
  447. package/dist/api/types/index.js +21 -1
  448. package/dist/core/auth/BearerToken.d.ts +1 -1
  449. package/dist/core/fetcher/APIResponse.d.ts +1 -1
  450. package/dist/core/fetcher/Fetcher.d.ts +6 -3
  451. package/dist/core/fetcher/Fetcher.js +20 -189
  452. package/dist/core/fetcher/Supplier.d.ts +1 -1
  453. package/dist/core/fetcher/createRequestUrl.d.ts +1 -0
  454. package/dist/core/fetcher/createRequestUrl.js +12 -0
  455. package/dist/core/fetcher/getFetchFn.d.ts +4 -0
  456. package/dist/core/fetcher/getFetchFn.js +68 -0
  457. package/dist/core/fetcher/getHeader.js +1 -2
  458. package/dist/core/fetcher/getRequestBody.d.ts +7 -0
  459. package/dist/core/fetcher/getRequestBody.js +23 -0
  460. package/dist/core/fetcher/getResponseBody.d.ts +1 -0
  461. package/dist/core/fetcher/getResponseBody.js +54 -0
  462. package/dist/core/fetcher/makeRequest.d.ts +1 -0
  463. package/dist/core/fetcher/makeRequest.js +42 -0
  464. package/dist/core/fetcher/requestWithRetries.d.ts +1 -0
  465. package/dist/core/fetcher/requestWithRetries.js +40 -0
  466. package/dist/core/fetcher/signals.d.ts +11 -0
  467. package/dist/core/fetcher/signals.js +36 -0
  468. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +30 -0
  469. package/dist/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +247 -0
  470. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +21 -0
  471. package/dist/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +126 -0
  472. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +31 -0
  473. package/dist/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +229 -0
  474. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +18 -0
  475. package/dist/core/fetcher/stream-wrappers/chooseStreamWrapper.js +59 -0
  476. package/dist/core/json.d.ts +15 -0
  477. package/dist/core/json.js +24 -0
  478. package/dist/core/runtime/runtime.d.ts +2 -1
  479. package/dist/core/runtime/runtime.js +52 -41
  480. package/dist/environments.d.ts +1 -1
  481. package/dist/errors/PolytomicError.js +2 -1
  482. package/dist/errors/PolytomicTimeoutError.d.ts +1 -1
  483. package/dist/errors/PolytomicTimeoutError.js +2 -2
  484. package/dist/index.js +17 -7
  485. package/dist/version.d.ts +1 -0
  486. package/dist/version.js +4 -0
  487. package/environments.d.ts +1 -1
  488. package/errors/PolytomicError.js +2 -1
  489. package/errors/PolytomicTimeoutError.d.ts +1 -1
  490. package/errors/PolytomicTimeoutError.js +2 -2
  491. package/index.js +17 -7
  492. package/{jest.config.js → jest.config.mjs} +4 -1
  493. package/package.json +18 -14
  494. package/reference.md +6382 -0
  495. package/scripts/rename-to-esm-files.js +115 -0
  496. package/version.d.ts +1 -0
  497. package/version.js +4 -0
  498. /package/api/resources/{modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js → bulkSync/resources/executions/client/requests/ExecutionsListRequest.js} +0 -0
  499. /package/api/resources/{modelSync/client/requests/ModelSyncGetTargetRequest.js → bulkSync/resources/schedules/client/requests/CreateScheduleRequest.js} +0 -0
  500. /package/{dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js → api/resources/bulkSync/resources/schedules/client/requests/UpdateScheduleRequest.js} +0 -0
  501. /package/{dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js → api/resources/connections/client/requests/TestConnectionRequest.js} +0 -0
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
+ return new (P || (P = Promise))(function (resolve, reject) {
38
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
42
+ });
43
+ };
44
+ Object.defineProperty(exports, "__esModule", { value: true });
45
+ exports.getFetchFn = getFetchFn;
46
+ const runtime_1 = require("../runtime");
47
+ /**
48
+ * Returns a fetch function based on the runtime
49
+ */
50
+ function getFetchFn() {
51
+ return __awaiter(this, void 0, void 0, function* () {
52
+ // In Node.js 18+ environments, use native fetch
53
+ if (runtime_1.RUNTIME.type === "node" && runtime_1.RUNTIME.parsedVersion != null && runtime_1.RUNTIME.parsedVersion >= 18) {
54
+ return fetch;
55
+ }
56
+ // In Node.js 18 or lower environments, the SDK always uses`node-fetch`.
57
+ if (runtime_1.RUNTIME.type === "node") {
58
+ return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
59
+ }
60
+ // Otherwise the SDK uses global fetch if available,
61
+ // and falls back to node-fetch.
62
+ if (typeof fetch == "function") {
63
+ return fetch;
64
+ }
65
+ // Defaults to node `node-fetch` if global fetch isn't available
66
+ return (yield Promise.resolve().then(() => __importStar(require("node-fetch")))).default;
67
+ });
68
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getHeader = void 0;
3
+ exports.getHeader = getHeader;
4
4
  function getHeader(headers, header) {
5
5
  for (const [headerKey, headerValue] of Object.entries(headers)) {
6
6
  if (headerKey.toLowerCase() === header.toLowerCase()) {
@@ -9,4 +9,3 @@ function getHeader(headers, header) {
9
9
  }
10
10
  return undefined;
11
11
  }
12
- exports.getHeader = getHeader;
@@ -0,0 +1,7 @@
1
+ export declare namespace GetRequestBody {
2
+ interface Args {
3
+ body: unknown;
4
+ type: "json" | "file" | "bytes" | "other";
5
+ }
6
+ }
7
+ export declare function getRequestBody({ body, type }: GetRequestBody.Args): Promise<BodyInit | undefined>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getRequestBody = getRequestBody;
13
+ const json_1 = require("../json");
14
+ function getRequestBody(_a) {
15
+ return __awaiter(this, arguments, void 0, function* ({ body, type }) {
16
+ if (type.includes("json")) {
17
+ return (0, json_1.toJson)(body);
18
+ }
19
+ else {
20
+ return body;
21
+ }
22
+ });
23
+ }
@@ -0,0 +1 @@
1
+ export declare function getResponseBody(response: Response, responseType?: string): Promise<unknown>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getResponseBody = getResponseBody;
13
+ const chooseStreamWrapper_1 = require("./stream-wrappers/chooseStreamWrapper");
14
+ function getResponseBody(response, responseType) {
15
+ return __awaiter(this, void 0, void 0, function* () {
16
+ if (response.body != null && responseType === "blob") {
17
+ return yield response.blob();
18
+ }
19
+ else if (response.body != null && responseType === "arrayBuffer") {
20
+ return yield response.arrayBuffer();
21
+ }
22
+ else if (response.body != null && responseType === "sse") {
23
+ return response.body;
24
+ }
25
+ else if (response.body != null && responseType === "streaming") {
26
+ return (0, chooseStreamWrapper_1.chooseStreamWrapper)(response.body);
27
+ }
28
+ else if (response.body != null && responseType === "text") {
29
+ return yield response.text();
30
+ }
31
+ else {
32
+ const text = yield response.text();
33
+ if (text.length > 0) {
34
+ try {
35
+ let responseBody = JSON.parse(text);
36
+ return responseBody;
37
+ }
38
+ catch (err) {
39
+ return {
40
+ ok: false,
41
+ error: {
42
+ reason: "non-json",
43
+ statusCode: response.status,
44
+ rawBody: text,
45
+ },
46
+ };
47
+ }
48
+ }
49
+ else {
50
+ return undefined;
51
+ }
52
+ }
53
+ });
54
+ }
@@ -0,0 +1 @@
1
+ export declare const makeRequest: (fetchFn: (url: string, init: RequestInit) => Promise<Response>, url: string, method: string, headers: Record<string, string>, requestBody: BodyInit | undefined, timeoutMs?: number, abortSignal?: AbortSignal, withCredentials?: boolean, duplex?: "half") => Promise<Response>;
@@ -0,0 +1,42 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.makeRequest = void 0;
13
+ const signals_1 = require("./signals");
14
+ const makeRequest = (fetchFn, url, method, headers, requestBody, timeoutMs, abortSignal, withCredentials, duplex) => __awaiter(void 0, void 0, void 0, function* () {
15
+ const signals = [];
16
+ // Add timeout signal
17
+ let timeoutAbortId = undefined;
18
+ if (timeoutMs != null) {
19
+ const { signal, abortId } = (0, signals_1.getTimeoutSignal)(timeoutMs);
20
+ timeoutAbortId = abortId;
21
+ signals.push(signal);
22
+ }
23
+ // Add arbitrary signal
24
+ if (abortSignal != null) {
25
+ signals.push(abortSignal);
26
+ }
27
+ let newSignals = (0, signals_1.anySignal)(signals);
28
+ const response = yield fetchFn(url, {
29
+ method: method,
30
+ headers,
31
+ body: requestBody,
32
+ signal: newSignals,
33
+ credentials: withCredentials ? "include" : undefined,
34
+ // @ts-ignore
35
+ duplex,
36
+ });
37
+ if (timeoutAbortId != null) {
38
+ clearTimeout(timeoutAbortId);
39
+ }
40
+ return response;
41
+ });
42
+ exports.makeRequest = makeRequest;
@@ -0,0 +1 @@
1
+ export declare function requestWithRetries(requestFn: () => Promise<Response>, maxRetries?: number): Promise<Response>;
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.requestWithRetries = requestWithRetries;
13
+ const INITIAL_RETRY_DELAY = 1000; // in milliseconds
14
+ const MAX_RETRY_DELAY = 60000; // in milliseconds
15
+ const DEFAULT_MAX_RETRIES = 2;
16
+ const JITTER_FACTOR = 0.2; // 20% random jitter
17
+ function addJitter(delay) {
18
+ // Generate a random value between -JITTER_FACTOR and +JITTER_FACTOR
19
+ const jitterMultiplier = 1 + (Math.random() * 2 - 1) * JITTER_FACTOR;
20
+ return delay * jitterMultiplier;
21
+ }
22
+ function requestWithRetries(requestFn_1) {
23
+ return __awaiter(this, arguments, void 0, function* (requestFn, maxRetries = DEFAULT_MAX_RETRIES) {
24
+ let response = yield requestFn();
25
+ for (let i = 0; i < maxRetries; ++i) {
26
+ if ([408, 429].includes(response.status) || response.status >= 500) {
27
+ // Calculate base delay using exponential backoff (in milliseconds)
28
+ const baseDelay = Math.min(INITIAL_RETRY_DELAY * Math.pow(2, i), MAX_RETRY_DELAY);
29
+ // Add jitter to the delay
30
+ const delayWithJitter = addJitter(baseDelay);
31
+ yield new Promise((resolve) => setTimeout(resolve, delayWithJitter));
32
+ response = yield requestFn();
33
+ }
34
+ else {
35
+ break;
36
+ }
37
+ }
38
+ return response;
39
+ });
40
+ }
@@ -0,0 +1,11 @@
1
+ export declare function getTimeoutSignal(timeoutMs: number): {
2
+ signal: AbortSignal;
3
+ abortId: NodeJS.Timeout;
4
+ };
5
+ /**
6
+ * Returns an abort signal that is getting aborted when
7
+ * at least one of the specified abort signals is aborted.
8
+ *
9
+ * Requires at least node.js 18.
10
+ */
11
+ export declare function anySignal(...args: AbortSignal[] | [AbortSignal[]]): AbortSignal;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getTimeoutSignal = getTimeoutSignal;
4
+ exports.anySignal = anySignal;
5
+ const TIMEOUT = "timeout";
6
+ function getTimeoutSignal(timeoutMs) {
7
+ const controller = new AbortController();
8
+ const abortId = setTimeout(() => controller.abort(TIMEOUT), timeoutMs);
9
+ return { signal: controller.signal, abortId };
10
+ }
11
+ /**
12
+ * Returns an abort signal that is getting aborted when
13
+ * at least one of the specified abort signals is aborted.
14
+ *
15
+ * Requires at least node.js 18.
16
+ */
17
+ function anySignal(...args) {
18
+ // Allowing signals to be passed either as array
19
+ // of signals or as multiple arguments.
20
+ const signals = (args.length === 1 && Array.isArray(args[0]) ? args[0] : args);
21
+ const controller = new AbortController();
22
+ for (const signal of signals) {
23
+ if (signal.aborted) {
24
+ // Exiting early if one of the signals
25
+ // is already aborted.
26
+ controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason);
27
+ break;
28
+ }
29
+ // Listening for signals and removing the listeners
30
+ // when at least one symbol is aborted.
31
+ signal.addEventListener("abort", () => controller.abort(signal === null || signal === void 0 ? void 0 : signal.reason), {
32
+ signal: controller.signal,
33
+ });
34
+ }
35
+ return controller.signal;
36
+ }
@@ -0,0 +1,30 @@
1
+ import type { Writable } from "readable-stream";
2
+ import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
3
+ export declare class Node18UniversalStreamWrapper<ReadFormat extends Uint8Array | Uint16Array | Uint32Array> implements StreamWrapper<Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>, ReadFormat> {
4
+ private readableStream;
5
+ private reader;
6
+ private events;
7
+ private paused;
8
+ private resumeCallback;
9
+ private encoding;
10
+ constructor(readableStream: ReadableStream<ReadFormat>);
11
+ on(event: string, callback: EventCallback): void;
12
+ off(event: string, callback: EventCallback): void;
13
+ pipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
14
+ pipeTo(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>;
15
+ unpipe(dest: Node18UniversalStreamWrapper<ReadFormat> | Writable | WritableStream<ReadFormat>): void;
16
+ destroy(error?: Error): void;
17
+ pause(): void;
18
+ resume(): void;
19
+ get isPaused(): boolean;
20
+ read(): Promise<ReadFormat | undefined>;
21
+ setEncoding(encoding: string): void;
22
+ text(): Promise<string>;
23
+ json<T>(): Promise<T>;
24
+ private _write;
25
+ private _end;
26
+ private _error;
27
+ private _emit;
28
+ private _startReading;
29
+ [Symbol.asyncIterator](): AsyncIterableIterator<ReadFormat>;
30
+ }
@@ -0,0 +1,247 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.Node18UniversalStreamWrapper = void 0;
13
+ class Node18UniversalStreamWrapper {
14
+ constructor(readableStream) {
15
+ this.readableStream = readableStream;
16
+ this.reader = this.readableStream.getReader();
17
+ this.events = {
18
+ data: [],
19
+ end: [],
20
+ error: [],
21
+ readable: [],
22
+ close: [],
23
+ pause: [],
24
+ resume: [],
25
+ };
26
+ this.paused = false;
27
+ this.resumeCallback = null;
28
+ this.encoding = null;
29
+ }
30
+ on(event, callback) {
31
+ var _a;
32
+ (_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.push(callback);
33
+ }
34
+ off(event, callback) {
35
+ var _a;
36
+ this.events[event] = (_a = this.events[event]) === null || _a === void 0 ? void 0 : _a.filter((cb) => cb !== callback);
37
+ }
38
+ pipe(dest) {
39
+ this.on("data", (chunk) => __awaiter(this, void 0, void 0, function* () {
40
+ if (dest instanceof Node18UniversalStreamWrapper) {
41
+ dest._write(chunk);
42
+ }
43
+ else if (dest instanceof WritableStream) {
44
+ const writer = dest.getWriter();
45
+ writer.write(chunk).then(() => writer.releaseLock());
46
+ }
47
+ else {
48
+ dest.write(chunk);
49
+ }
50
+ }));
51
+ this.on("end", () => __awaiter(this, void 0, void 0, function* () {
52
+ if (dest instanceof Node18UniversalStreamWrapper) {
53
+ dest._end();
54
+ }
55
+ else if (dest instanceof WritableStream) {
56
+ const writer = dest.getWriter();
57
+ writer.close();
58
+ }
59
+ else {
60
+ dest.end();
61
+ }
62
+ }));
63
+ this.on("error", (error) => __awaiter(this, void 0, void 0, function* () {
64
+ if (dest instanceof Node18UniversalStreamWrapper) {
65
+ dest._error(error);
66
+ }
67
+ else if (dest instanceof WritableStream) {
68
+ const writer = dest.getWriter();
69
+ writer.abort(error);
70
+ }
71
+ else {
72
+ dest.destroy(error);
73
+ }
74
+ }));
75
+ this._startReading();
76
+ return dest;
77
+ }
78
+ pipeTo(dest) {
79
+ return this.pipe(dest);
80
+ }
81
+ unpipe(dest) {
82
+ this.off("data", (chunk) => __awaiter(this, void 0, void 0, function* () {
83
+ if (dest instanceof Node18UniversalStreamWrapper) {
84
+ dest._write(chunk);
85
+ }
86
+ else if (dest instanceof WritableStream) {
87
+ const writer = dest.getWriter();
88
+ writer.write(chunk).then(() => writer.releaseLock());
89
+ }
90
+ else {
91
+ dest.write(chunk);
92
+ }
93
+ }));
94
+ this.off("end", () => __awaiter(this, void 0, void 0, function* () {
95
+ if (dest instanceof Node18UniversalStreamWrapper) {
96
+ dest._end();
97
+ }
98
+ else if (dest instanceof WritableStream) {
99
+ const writer = dest.getWriter();
100
+ writer.close();
101
+ }
102
+ else {
103
+ dest.end();
104
+ }
105
+ }));
106
+ this.off("error", (error) => __awaiter(this, void 0, void 0, function* () {
107
+ if (dest instanceof Node18UniversalStreamWrapper) {
108
+ dest._error(error);
109
+ }
110
+ else if (dest instanceof WritableStream) {
111
+ const writer = dest.getWriter();
112
+ writer.abort(error);
113
+ }
114
+ else {
115
+ dest.destroy(error);
116
+ }
117
+ }));
118
+ }
119
+ destroy(error) {
120
+ this.reader
121
+ .cancel(error)
122
+ .then(() => {
123
+ this._emit("close");
124
+ })
125
+ .catch((err) => {
126
+ this._emit("error", err);
127
+ });
128
+ }
129
+ pause() {
130
+ this.paused = true;
131
+ this._emit("pause");
132
+ }
133
+ resume() {
134
+ if (this.paused) {
135
+ this.paused = false;
136
+ this._emit("resume");
137
+ if (this.resumeCallback) {
138
+ this.resumeCallback();
139
+ this.resumeCallback = null;
140
+ }
141
+ }
142
+ }
143
+ get isPaused() {
144
+ return this.paused;
145
+ }
146
+ read() {
147
+ return __awaiter(this, void 0, void 0, function* () {
148
+ if (this.paused) {
149
+ yield new Promise((resolve) => {
150
+ this.resumeCallback = resolve;
151
+ });
152
+ }
153
+ const { done, value } = yield this.reader.read();
154
+ if (done) {
155
+ return undefined;
156
+ }
157
+ return value;
158
+ });
159
+ }
160
+ setEncoding(encoding) {
161
+ this.encoding = encoding;
162
+ }
163
+ text() {
164
+ return __awaiter(this, void 0, void 0, function* () {
165
+ const chunks = [];
166
+ while (true) {
167
+ const { done, value } = yield this.reader.read();
168
+ if (done) {
169
+ break;
170
+ }
171
+ if (value) {
172
+ chunks.push(value);
173
+ }
174
+ }
175
+ const decoder = new TextDecoder(this.encoding || "utf-8");
176
+ return decoder.decode(yield new Blob(chunks).arrayBuffer());
177
+ });
178
+ }
179
+ json() {
180
+ return __awaiter(this, void 0, void 0, function* () {
181
+ const text = yield this.text();
182
+ return JSON.parse(text);
183
+ });
184
+ }
185
+ _write(chunk) {
186
+ this._emit("data", chunk);
187
+ }
188
+ _end() {
189
+ this._emit("end");
190
+ }
191
+ _error(error) {
192
+ this._emit("error", error);
193
+ }
194
+ _emit(event, data) {
195
+ if (this.events[event]) {
196
+ for (const callback of this.events[event] || []) {
197
+ callback(data);
198
+ }
199
+ }
200
+ }
201
+ _startReading() {
202
+ return __awaiter(this, void 0, void 0, function* () {
203
+ try {
204
+ this._emit("readable");
205
+ while (true) {
206
+ if (this.paused) {
207
+ yield new Promise((resolve) => {
208
+ this.resumeCallback = resolve;
209
+ });
210
+ }
211
+ const { done, value } = yield this.reader.read();
212
+ if (done) {
213
+ this._emit("end");
214
+ this._emit("close");
215
+ break;
216
+ }
217
+ if (value) {
218
+ this._emit("data", value);
219
+ }
220
+ }
221
+ }
222
+ catch (error) {
223
+ this._emit("error", error);
224
+ }
225
+ });
226
+ }
227
+ [Symbol.asyncIterator]() {
228
+ return {
229
+ next: () => __awaiter(this, void 0, void 0, function* () {
230
+ if (this.paused) {
231
+ yield new Promise((resolve) => {
232
+ this.resumeCallback = resolve;
233
+ });
234
+ }
235
+ const { done, value } = yield this.reader.read();
236
+ if (done) {
237
+ return { done: true, value: undefined };
238
+ }
239
+ return { done: false, value };
240
+ }),
241
+ [Symbol.asyncIterator]() {
242
+ return this;
243
+ },
244
+ };
245
+ }
246
+ }
247
+ exports.Node18UniversalStreamWrapper = Node18UniversalStreamWrapper;
@@ -0,0 +1,21 @@
1
+ import type { Readable, Writable } from "readable-stream";
2
+ import { EventCallback, StreamWrapper } from "./chooseStreamWrapper";
3
+ export declare class NodePre18StreamWrapper implements StreamWrapper<Writable, Buffer> {
4
+ private readableStream;
5
+ private encoding;
6
+ constructor(readableStream: Readable);
7
+ on(event: string, callback: EventCallback): void;
8
+ off(event: string, callback: EventCallback): void;
9
+ pipe(dest: Writable): Writable;
10
+ pipeTo(dest: Writable): Writable;
11
+ unpipe(dest?: Writable): void;
12
+ destroy(error?: Error): void;
13
+ pause(): void;
14
+ resume(): void;
15
+ get isPaused(): boolean;
16
+ read(): Promise<Buffer | undefined>;
17
+ setEncoding(encoding?: string): void;
18
+ text(): Promise<string>;
19
+ json<T>(): Promise<T>;
20
+ [Symbol.asyncIterator](): AsyncIterableIterator<Buffer>;
21
+ }