polytomic 0.1.2 → 0.2.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 (187) hide show
  1. package/Client.d.ts +8 -6
  2. package/Client.js +27 -22
  3. package/api/errors/BadRequestError.d.ts +8 -0
  4. package/api/errors/BadRequestError.js +41 -0
  5. package/api/errors/ForbiddenError.d.ts +8 -0
  6. package/api/errors/ForbiddenError.js +41 -0
  7. package/api/errors/InternalServerError.d.ts +8 -0
  8. package/api/errors/InternalServerError.js +41 -0
  9. package/api/errors/NotFoundError.d.ts +8 -0
  10. package/api/errors/NotFoundError.js +41 -0
  11. package/api/errors/UnprocessableEntityError.d.ts +8 -0
  12. package/api/errors/UnprocessableEntityError.js +41 -0
  13. package/api/errors/index.d.ts +5 -0
  14. package/api/errors/index.js +5 -0
  15. package/api/resources/bulkSync/client/Client.d.ts +78 -47
  16. package/api/resources/bulkSync/client/Client.js +188 -183
  17. package/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
  18. package/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
  19. package/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
  20. package/api/resources/bulkSync/client/requests/index.d.ts +3 -2
  21. package/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
  22. package/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
  23. package/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
  24. package/api/resources/bulkSync/resources/executions/client/index.js +0 -15
  25. package/api/resources/bulkSync/resources/index.d.ts +0 -1
  26. package/api/resources/bulkSync/resources/index.js +0 -1
  27. package/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
  28. package/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
  29. package/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
  30. package/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
  31. package/api/resources/connections/client/Client.d.ts +43 -45
  32. package/api/resources/connections/client/Client.js +116 -294
  33. package/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
  34. package/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
  35. package/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
  36. package/api/resources/connections/client/requests/index.d.ts +2 -4
  37. package/api/resources/events/client/Client.d.ts +9 -8
  38. package/api/resources/events/client/Client.js +16 -18
  39. package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
  40. package/api/resources/events/client/requests/index.d.ts +1 -1
  41. package/api/resources/identity/client/Client.d.ts +29 -0
  42. package/api/resources/identity/client/Client.js +114 -0
  43. package/api/resources/identity/client/index.d.ts +1 -0
  44. package/api/resources/identity/index.d.ts +1 -0
  45. package/api/resources/identity/index.js +17 -0
  46. package/api/resources/index.d.ts +3 -2
  47. package/api/resources/index.js +4 -3
  48. package/api/resources/jobs/client/Client.d.ts +6 -4
  49. package/api/resources/jobs/client/Client.js +13 -10
  50. package/api/resources/modelSync/client/Client.d.ts +82 -11
  51. package/api/resources/modelSync/client/Client.js +421 -79
  52. package/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
  53. package/{dist/api/resources/connections/client/requests/TargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
  54. package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
  55. package/api/resources/modelSync/client/requests/index.d.ts +3 -0
  56. package/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
  57. package/api/resources/modelSync/resources/executions/client/Client.js +43 -476
  58. package/api/resources/models/client/Client.d.ts +22 -11
  59. package/api/resources/models/client/Client.js +68 -46
  60. package/api/resources/organization/client/Client.d.ts +21 -14
  61. package/api/resources/organization/client/Client.js +52 -42
  62. package/api/resources/permissions/client/Client.d.ts +2 -3
  63. package/api/resources/permissions/client/Client.js +1 -1
  64. package/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
  65. package/api/resources/permissions/resources/policies/client/Client.js +69 -41
  66. package/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
  67. package/api/resources/permissions/resources/roles/client/Client.js +62 -37
  68. package/api/resources/schemas/client/Client.d.ts +39 -6
  69. package/api/resources/schemas/client/Client.js +208 -13
  70. package/api/resources/users/client/Client.d.ts +21 -11
  71. package/api/resources/users/client/Client.js +57 -40
  72. package/api/resources/webhooks/client/Client.d.ts +18 -11
  73. package/api/resources/webhooks/client/Client.js +53 -43
  74. package/api/types/ApiError.d.ts +8 -0
  75. package/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
  76. package/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
  77. package/api/types/SourceMeta.d.ts +8 -0
  78. package/api/types/SourceMeta.js +5 -0
  79. package/api/types/index.d.ts +4 -0
  80. package/api/types/index.js +4 -0
  81. package/dist/Client.d.ts +8 -6
  82. package/dist/Client.js +27 -22
  83. package/dist/api/errors/BadRequestError.d.ts +8 -0
  84. package/dist/api/errors/BadRequestError.js +41 -0
  85. package/dist/api/errors/ForbiddenError.d.ts +8 -0
  86. package/dist/api/errors/ForbiddenError.js +41 -0
  87. package/dist/api/errors/InternalServerError.d.ts +8 -0
  88. package/dist/api/errors/InternalServerError.js +41 -0
  89. package/dist/api/errors/NotFoundError.d.ts +8 -0
  90. package/dist/api/errors/NotFoundError.js +41 -0
  91. package/dist/api/errors/UnprocessableEntityError.d.ts +8 -0
  92. package/dist/api/errors/UnprocessableEntityError.js +41 -0
  93. package/dist/api/errors/index.d.ts +5 -0
  94. package/dist/api/errors/index.js +5 -0
  95. package/dist/api/resources/bulkSync/client/Client.d.ts +78 -47
  96. package/dist/api/resources/bulkSync/client/Client.js +188 -183
  97. package/dist/api/resources/bulkSync/client/requests/BulkSyncGetSourceRequest.d.ts +0 -1
  98. package/dist/api/resources/bulkSync/client/requests/CreateBulkSyncRequest.d.ts +8 -2
  99. package/dist/api/resources/bulkSync/client/requests/StartBulkSyncRequest.js +5 -0
  100. package/dist/api/resources/bulkSync/client/requests/UpdateBulkSyncRequest.d.ts +8 -2
  101. package/dist/api/resources/bulkSync/client/requests/index.d.ts +3 -2
  102. package/dist/api/resources/bulkSync/resources/executions/client/Client.d.ts +5 -14
  103. package/dist/api/resources/bulkSync/resources/executions/client/Client.js +12 -74
  104. package/dist/api/resources/bulkSync/resources/executions/client/index.d.ts +1 -1
  105. package/dist/api/resources/bulkSync/resources/executions/client/index.js +0 -15
  106. package/dist/api/resources/bulkSync/resources/index.d.ts +0 -1
  107. package/dist/api/resources/bulkSync/resources/index.js +0 -1
  108. package/dist/api/resources/bulkSync/resources/schemas/client/Client.d.ts +23 -9
  109. package/dist/api/resources/bulkSync/resources/schemas/client/Client.js +93 -24
  110. package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.d.ts +11 -0
  111. package/dist/api/resources/bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js +5 -0
  112. package/dist/api/resources/bulkSync/resources/schemas/client/requests/index.d.ts +1 -0
  113. package/dist/api/resources/connections/client/Client.d.ts +43 -45
  114. package/dist/api/resources/connections/client/Client.js +116 -294
  115. package/dist/api/resources/connections/client/requests/ConnectCardRequest.d.ts +20 -0
  116. package/dist/api/resources/connections/client/requests/ConnectCardRequest.js +5 -0
  117. package/dist/api/resources/connections/client/requests/CreateConnectionRequestSchema.d.ts +2 -2
  118. package/dist/api/resources/connections/client/requests/UpdateConnectionRequestSchema.d.ts +2 -2
  119. package/dist/api/resources/connections/client/requests/index.d.ts +2 -4
  120. package/dist/api/resources/events/client/Client.d.ts +9 -8
  121. package/dist/api/resources/events/client/Client.js +16 -18
  122. package/{api/resources/events/client/requests/EventsApiV2GetEventsRequest.d.ts → dist/api/resources/events/client/requests/EventsListRequest.d.ts} +1 -1
  123. package/dist/api/resources/events/client/requests/EventsListRequest.js +5 -0
  124. package/dist/api/resources/events/client/requests/index.d.ts +1 -1
  125. package/dist/api/resources/identity/client/Client.d.ts +29 -0
  126. package/dist/api/resources/identity/client/Client.js +114 -0
  127. package/dist/api/resources/identity/client/index.d.ts +1 -0
  128. package/dist/api/resources/identity/index.d.ts +1 -0
  129. package/dist/api/resources/identity/index.js +17 -0
  130. package/dist/api/resources/index.d.ts +3 -2
  131. package/dist/api/resources/index.js +4 -3
  132. package/dist/api/resources/jobs/client/Client.d.ts +6 -4
  133. package/dist/api/resources/jobs/client/Client.js +13 -10
  134. package/dist/api/resources/modelSync/client/Client.d.ts +82 -11
  135. package/dist/api/resources/modelSync/client/Client.js +421 -79
  136. package/dist/api/resources/{connections/client/requests/ModelFieldsRequest.d.ts → modelSync/client/requests/ModelSyncGetSourceRequest.d.ts} +2 -2
  137. package/dist/api/resources/modelSync/client/requests/ModelSyncGetSourceRequest.js +5 -0
  138. package/{api/resources/connections/client/requests/TargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.d.ts} +4 -4
  139. package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js +5 -0
  140. package/{api/resources/connections/client/requests/ConnectionsGetTargetRequest.d.ts → dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.d.ts} +2 -5
  141. package/dist/api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js +5 -0
  142. package/dist/api/resources/modelSync/client/requests/index.d.ts +3 -0
  143. package/dist/api/resources/modelSync/resources/executions/client/Client.d.ts +16 -64
  144. package/dist/api/resources/modelSync/resources/executions/client/Client.js +43 -476
  145. package/dist/api/resources/models/client/Client.d.ts +22 -11
  146. package/dist/api/resources/models/client/Client.js +68 -46
  147. package/dist/api/resources/organization/client/Client.d.ts +21 -14
  148. package/dist/api/resources/organization/client/Client.js +52 -42
  149. package/dist/api/resources/permissions/client/Client.d.ts +2 -3
  150. package/dist/api/resources/permissions/client/Client.js +1 -1
  151. package/dist/api/resources/permissions/resources/policies/client/Client.d.ts +24 -11
  152. package/dist/api/resources/permissions/resources/policies/client/Client.js +69 -41
  153. package/dist/api/resources/permissions/resources/roles/client/Client.d.ts +22 -10
  154. package/dist/api/resources/permissions/resources/roles/client/Client.js +62 -37
  155. package/dist/api/resources/schemas/client/Client.d.ts +39 -6
  156. package/dist/api/resources/schemas/client/Client.js +208 -13
  157. package/dist/api/resources/users/client/Client.d.ts +21 -11
  158. package/dist/api/resources/users/client/Client.js +57 -40
  159. package/dist/api/resources/webhooks/client/Client.d.ts +18 -11
  160. package/dist/api/resources/webhooks/client/Client.js +53 -43
  161. package/dist/api/types/ApiError.d.ts +8 -0
  162. package/dist/api/types/ApiError.js +5 -0
  163. package/dist/api/types/GetModelSyncSourceMetaEnvelope.d.ts +7 -0
  164. package/dist/api/types/GetModelSyncSourceMetaEnvelope.js +5 -0
  165. package/dist/api/types/ModelSyncSourceMetaResponse.d.ts +9 -0
  166. package/dist/api/types/ModelSyncSourceMetaResponse.js +5 -0
  167. package/dist/api/types/SourceMeta.d.ts +8 -0
  168. package/dist/api/types/SourceMeta.js +5 -0
  169. package/dist/api/types/index.d.ts +4 -0
  170. package/dist/api/types/index.js +4 -0
  171. package/package.json +1 -1
  172. package/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
  173. package/dist/api/resources/bulkSync/resources/executions/client/requests/index.d.ts +0 -1
  174. /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
  175. /package/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.js +0 -0
  176. /package/api/resources/{connections/client/requests/ConnectionsGetTargetRequest.js → bulkSync/resources/schemas/client/requests/BulkSyncSchemasRequest.js} +0 -0
  177. /package/api/resources/connections/client/requests/{ModelFieldsRequest.js → ConnectCardRequest.js} +0 -0
  178. /package/api/resources/{connections/client/requests/TargetRequest.js → events/client/requests/EventsListRequest.js} +0 -0
  179. /package/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
  180. /package/api/resources/{events/client/requests/EventsApiV2GetEventsRequest.js → modelSync/client/requests/ModelSyncGetSourceRequest.js} +0 -0
  181. /package/{dist/api/resources/bulkSync/resources/executions/client/requests/StartBulkSyncRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetFieldsRequest.js} +0 -0
  182. /package/{dist/api/resources/connections/client/requests/ConnectionsGetTargetRequest.js → api/resources/modelSync/client/requests/ModelSyncGetTargetRequest.js} +0 -0
  183. /package/{dist/api/resources/connections/client/requests/ModelFieldsRequest.js → api/types/ApiError.js} +0 -0
  184. /package/{dist/api/resources/connections/client/requests/TargetRequest.js → api/types/GetModelSyncSourceMetaEnvelope.js} +0 -0
  185. /package/{dist/api/resources/events/client/requests/EventsApiV2GetEventsRequest.js → api/types/ModelSyncSourceMetaResponse.js} +0 -0
  186. /package/dist/api/resources/bulkSync/{resources/executions/client → client}/requests/StartBulkSyncRequest.d.ts +0 -0
  187. /package/dist/api/resources/{bulkSync/resources/executions/client/requests → identity/client}/index.js +0 -0
@@ -45,11 +45,12 @@ const Polytomic = __importStar(require("../../../../.."));
45
45
  const url_join_1 = __importDefault(require("url-join"));
46
46
  const errors = __importStar(require("../../../../../../errors"));
47
47
  class Executions {
48
- constructor(_options = {}) {
48
+ constructor(_options) {
49
49
  this._options = _options;
50
50
  }
51
51
  /**
52
52
  * @throws {@link Polytomic.UnauthorizedError}
53
+ * @throws {@link Polytomic.NotFoundError}
53
54
  *
54
55
  * @example
55
56
  * await polytomic.modelSync.executions.list("248df4b7-aa70-47b8-a036-33ac447e668d")
@@ -62,12 +63,10 @@ class Executions {
62
63
  method: "GET",
63
64
  headers: {
64
65
  Authorization: yield this._getAuthorizationHeader(),
65
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
66
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
67
- : undefined,
66
+ "X-Polytomic-Version": "2024-02-08",
68
67
  "X-Fern-Language": "JavaScript",
69
68
  "X-Fern-SDK-Name": "polytomic",
70
- "X-Fern-SDK-Version": "0.1.2",
69
+ "X-Fern-SDK-Version": "0.2.0",
71
70
  "X-Fern-Runtime": core.RUNTIME.type,
72
71
  "X-Fern-Runtime-Version": core.RUNTIME.version,
73
72
  },
@@ -82,6 +81,8 @@ class Executions {
82
81
  switch (_response.error.statusCode) {
83
82
  case 401:
84
83
  throw new Polytomic.UnauthorizedError(_response.error.body);
84
+ case 404:
85
+ throw new Polytomic.NotFoundError(_response.error.body);
85
86
  default:
86
87
  throw new errors.PolytomicError({
87
88
  statusCode: _response.error.statusCode,
@@ -106,6 +107,8 @@ class Executions {
106
107
  }
107
108
  /**
108
109
  * @throws {@link Polytomic.UnauthorizedError}
110
+ * @throws {@link Polytomic.NotFoundError}
111
+ * @throws {@link Polytomic.InternalServerError}
109
112
  *
110
113
  * @example
111
114
  * await polytomic.modelSync.executions.get("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
@@ -118,12 +121,10 @@ class Executions {
118
121
  method: "GET",
119
122
  headers: {
120
123
  Authorization: yield this._getAuthorizationHeader(),
121
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
122
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
123
- : undefined,
124
+ "X-Polytomic-Version": "2024-02-08",
124
125
  "X-Fern-Language": "JavaScript",
125
126
  "X-Fern-SDK-Name": "polytomic",
126
- "X-Fern-SDK-Version": "0.1.2",
127
+ "X-Fern-SDK-Version": "0.2.0",
127
128
  "X-Fern-Runtime": core.RUNTIME.type,
128
129
  "X-Fern-Runtime-Version": core.RUNTIME.version,
129
130
  },
@@ -138,6 +139,10 @@ class Executions {
138
139
  switch (_response.error.statusCode) {
139
140
  case 401:
140
141
  throw new Polytomic.UnauthorizedError(_response.error.body);
142
+ case 404:
143
+ throw new Polytomic.NotFoundError(_response.error.body);
144
+ case 500:
145
+ throw new Polytomic.InternalServerError(_response.error.body);
141
146
  default:
142
147
  throw new errors.PolytomicError({
143
148
  statusCode: _response.error.statusCode,
@@ -161,25 +166,26 @@ class Executions {
161
166
  });
162
167
  }
163
168
  /**
169
+ * @throws {@link Polytomic.BadRequestError}
164
170
  * @throws {@link Polytomic.UnauthorizedError}
171
+ * @throws {@link Polytomic.NotFoundError}
172
+ * @throws {@link Polytomic.InternalServerError}
165
173
  *
166
174
  * @example
167
- * await polytomic.modelSync.executions.getErrorLogUrLs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
175
+ * await polytomic.modelSync.executions.getLogUrls("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "records")
168
176
  */
169
- getErrorLogUrLs(syncId, id, requestOptions) {
177
+ getLogUrls(syncId, id, type, requestOptions) {
170
178
  var _a;
171
179
  return __awaiter(this, void 0, void 0, function* () {
172
180
  const _response = yield core.fetcher({
173
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/errors`),
181
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/${type}`),
174
182
  method: "GET",
175
183
  headers: {
176
184
  Authorization: yield this._getAuthorizationHeader(),
177
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
178
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
179
- : undefined,
185
+ "X-Polytomic-Version": "2024-02-08",
180
186
  "X-Fern-Language": "JavaScript",
181
187
  "X-Fern-SDK-Name": "polytomic",
182
- "X-Fern-SDK-Version": "0.1.2",
188
+ "X-Fern-SDK-Version": "0.2.0",
183
189
  "X-Fern-Runtime": core.RUNTIME.type,
184
190
  "X-Fern-Runtime-Version": core.RUNTIME.version,
185
191
  },
@@ -192,8 +198,14 @@ class Executions {
192
198
  }
193
199
  if (_response.error.reason === "status-code") {
194
200
  switch (_response.error.statusCode) {
201
+ case 400:
202
+ throw new Polytomic.BadRequestError(_response.error.body);
195
203
  case 401:
196
204
  throw new Polytomic.UnauthorizedError(_response.error.body);
205
+ case 404:
206
+ throw new Polytomic.NotFoundError(_response.error.body);
207
+ case 500:
208
+ throw new Polytomic.InternalServerError(_response.error.body);
197
209
  default:
198
210
  throw new errors.PolytomicError({
199
211
  statusCode: _response.error.statusCode,
@@ -217,473 +229,26 @@ class Executions {
217
229
  });
218
230
  }
219
231
  /**
232
+ * @throws {@link Polytomic.BadRequestError}
220
233
  * @throws {@link Polytomic.UnauthorizedError}
234
+ * @throws {@link Polytomic.NotFoundError}
235
+ * @throws {@link Polytomic.InternalServerError}
221
236
  *
222
237
  * @example
223
- * await polytomic.modelSync.executions.getErrorLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "path/to/file.json")
238
+ * await polytomic.modelSync.executions.getLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "records", "path/to/file.json")
224
239
  */
225
- getErrorLogs(syncId, id, filename, requestOptions) {
240
+ getLogs(syncId, id, type, filename, requestOptions) {
226
241
  var _a;
227
242
  return __awaiter(this, void 0, void 0, function* () {
228
243
  const _response = yield core.fetcher({
229
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/errors/${filename}`),
244
+ url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/${type}/${filename}`),
230
245
  method: "GET",
231
246
  headers: {
232
247
  Authorization: yield this._getAuthorizationHeader(),
233
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
234
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
235
- : undefined,
248
+ "X-Polytomic-Version": "2024-02-08",
236
249
  "X-Fern-Language": "JavaScript",
237
250
  "X-Fern-SDK-Name": "polytomic",
238
- "X-Fern-SDK-Version": "0.1.2",
239
- "X-Fern-Runtime": core.RUNTIME.type,
240
- "X-Fern-Runtime-Version": core.RUNTIME.version,
241
- },
242
- contentType: "application/json",
243
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
244
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
245
- });
246
- if (_response.ok) {
247
- return;
248
- }
249
- if (_response.error.reason === "status-code") {
250
- switch (_response.error.statusCode) {
251
- case 401:
252
- throw new Polytomic.UnauthorizedError(_response.error.body);
253
- default:
254
- throw new errors.PolytomicError({
255
- statusCode: _response.error.statusCode,
256
- body: _response.error.body,
257
- });
258
- }
259
- }
260
- switch (_response.error.reason) {
261
- case "non-json":
262
- throw new errors.PolytomicError({
263
- statusCode: _response.error.statusCode,
264
- body: _response.error.rawBody,
265
- });
266
- case "timeout":
267
- throw new errors.PolytomicTimeoutError();
268
- case "unknown":
269
- throw new errors.PolytomicError({
270
- message: _response.error.errorMessage,
271
- });
272
- }
273
- });
274
- }
275
- /**
276
- * @throws {@link Polytomic.UnauthorizedError}
277
- *
278
- * @example
279
- * await polytomic.modelSync.executions.getInsertLogUrLs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
280
- */
281
- getInsertLogUrLs(syncId, id, requestOptions) {
282
- var _a;
283
- return __awaiter(this, void 0, void 0, function* () {
284
- const _response = yield core.fetcher({
285
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/inserts`),
286
- method: "GET",
287
- headers: {
288
- Authorization: yield this._getAuthorizationHeader(),
289
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
290
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
291
- : undefined,
292
- "X-Fern-Language": "JavaScript",
293
- "X-Fern-SDK-Name": "polytomic",
294
- "X-Fern-SDK-Version": "0.1.2",
295
- "X-Fern-Runtime": core.RUNTIME.type,
296
- "X-Fern-Runtime-Version": core.RUNTIME.version,
297
- },
298
- contentType: "application/json",
299
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
300
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
301
- });
302
- if (_response.ok) {
303
- return _response.body;
304
- }
305
- if (_response.error.reason === "status-code") {
306
- switch (_response.error.statusCode) {
307
- case 401:
308
- throw new Polytomic.UnauthorizedError(_response.error.body);
309
- default:
310
- throw new errors.PolytomicError({
311
- statusCode: _response.error.statusCode,
312
- body: _response.error.body,
313
- });
314
- }
315
- }
316
- switch (_response.error.reason) {
317
- case "non-json":
318
- throw new errors.PolytomicError({
319
- statusCode: _response.error.statusCode,
320
- body: _response.error.rawBody,
321
- });
322
- case "timeout":
323
- throw new errors.PolytomicTimeoutError();
324
- case "unknown":
325
- throw new errors.PolytomicError({
326
- message: _response.error.errorMessage,
327
- });
328
- }
329
- });
330
- }
331
- /**
332
- * @throws {@link Polytomic.UnauthorizedError}
333
- *
334
- * @example
335
- * await polytomic.modelSync.executions.getInsertLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "path/to/file.json")
336
- */
337
- getInsertLogs(syncId, id, filename, requestOptions) {
338
- var _a;
339
- return __awaiter(this, void 0, void 0, function* () {
340
- const _response = yield core.fetcher({
341
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/inserts/${filename}`),
342
- method: "GET",
343
- headers: {
344
- Authorization: yield this._getAuthorizationHeader(),
345
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
346
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
347
- : undefined,
348
- "X-Fern-Language": "JavaScript",
349
- "X-Fern-SDK-Name": "polytomic",
350
- "X-Fern-SDK-Version": "0.1.2",
351
- "X-Fern-Runtime": core.RUNTIME.type,
352
- "X-Fern-Runtime-Version": core.RUNTIME.version,
353
- },
354
- contentType: "application/json",
355
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
356
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
357
- });
358
- if (_response.ok) {
359
- return;
360
- }
361
- if (_response.error.reason === "status-code") {
362
- switch (_response.error.statusCode) {
363
- case 401:
364
- throw new Polytomic.UnauthorizedError(_response.error.body);
365
- default:
366
- throw new errors.PolytomicError({
367
- statusCode: _response.error.statusCode,
368
- body: _response.error.body,
369
- });
370
- }
371
- }
372
- switch (_response.error.reason) {
373
- case "non-json":
374
- throw new errors.PolytomicError({
375
- statusCode: _response.error.statusCode,
376
- body: _response.error.rawBody,
377
- });
378
- case "timeout":
379
- throw new errors.PolytomicTimeoutError();
380
- case "unknown":
381
- throw new errors.PolytomicError({
382
- message: _response.error.errorMessage,
383
- });
384
- }
385
- });
386
- }
387
- /**
388
- * @throws {@link Polytomic.UnauthorizedError}
389
- *
390
- * @example
391
- * await polytomic.modelSync.executions.getRecordLogUrLs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
392
- */
393
- getRecordLogUrLs(syncId, id, requestOptions) {
394
- var _a;
395
- return __awaiter(this, void 0, void 0, function* () {
396
- const _response = yield core.fetcher({
397
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/records`),
398
- method: "GET",
399
- headers: {
400
- Authorization: yield this._getAuthorizationHeader(),
401
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
402
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
403
- : undefined,
404
- "X-Fern-Language": "JavaScript",
405
- "X-Fern-SDK-Name": "polytomic",
406
- "X-Fern-SDK-Version": "0.1.2",
407
- "X-Fern-Runtime": core.RUNTIME.type,
408
- "X-Fern-Runtime-Version": core.RUNTIME.version,
409
- },
410
- contentType: "application/json",
411
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
412
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
413
- });
414
- if (_response.ok) {
415
- return _response.body;
416
- }
417
- if (_response.error.reason === "status-code") {
418
- switch (_response.error.statusCode) {
419
- case 401:
420
- throw new Polytomic.UnauthorizedError(_response.error.body);
421
- default:
422
- throw new errors.PolytomicError({
423
- statusCode: _response.error.statusCode,
424
- body: _response.error.body,
425
- });
426
- }
427
- }
428
- switch (_response.error.reason) {
429
- case "non-json":
430
- throw new errors.PolytomicError({
431
- statusCode: _response.error.statusCode,
432
- body: _response.error.rawBody,
433
- });
434
- case "timeout":
435
- throw new errors.PolytomicTimeoutError();
436
- case "unknown":
437
- throw new errors.PolytomicError({
438
- message: _response.error.errorMessage,
439
- });
440
- }
441
- });
442
- }
443
- /**
444
- * @throws {@link Polytomic.UnauthorizedError}
445
- *
446
- * @example
447
- * await polytomic.modelSync.executions.getRecordLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "path/to/file.json")
448
- */
449
- getRecordLogs(syncId, id, filename, requestOptions) {
450
- var _a;
451
- return __awaiter(this, void 0, void 0, function* () {
452
- const _response = yield core.fetcher({
453
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/records/${filename}`),
454
- method: "GET",
455
- headers: {
456
- Authorization: yield this._getAuthorizationHeader(),
457
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
458
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
459
- : undefined,
460
- "X-Fern-Language": "JavaScript",
461
- "X-Fern-SDK-Name": "polytomic",
462
- "X-Fern-SDK-Version": "0.1.2",
463
- "X-Fern-Runtime": core.RUNTIME.type,
464
- "X-Fern-Runtime-Version": core.RUNTIME.version,
465
- },
466
- contentType: "application/json",
467
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
468
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
469
- });
470
- if (_response.ok) {
471
- return;
472
- }
473
- if (_response.error.reason === "status-code") {
474
- switch (_response.error.statusCode) {
475
- case 401:
476
- throw new Polytomic.UnauthorizedError(_response.error.body);
477
- default:
478
- throw new errors.PolytomicError({
479
- statusCode: _response.error.statusCode,
480
- body: _response.error.body,
481
- });
482
- }
483
- }
484
- switch (_response.error.reason) {
485
- case "non-json":
486
- throw new errors.PolytomicError({
487
- statusCode: _response.error.statusCode,
488
- body: _response.error.rawBody,
489
- });
490
- case "timeout":
491
- throw new errors.PolytomicTimeoutError();
492
- case "unknown":
493
- throw new errors.PolytomicError({
494
- message: _response.error.errorMessage,
495
- });
496
- }
497
- });
498
- }
499
- /**
500
- * @throws {@link Polytomic.UnauthorizedError}
501
- *
502
- * @example
503
- * await polytomic.modelSync.executions.getUpdateLogUrLs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
504
- */
505
- getUpdateLogUrLs(syncId, id, requestOptions) {
506
- var _a;
507
- return __awaiter(this, void 0, void 0, function* () {
508
- const _response = yield core.fetcher({
509
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/updates`),
510
- method: "GET",
511
- headers: {
512
- Authorization: yield this._getAuthorizationHeader(),
513
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
514
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
515
- : undefined,
516
- "X-Fern-Language": "JavaScript",
517
- "X-Fern-SDK-Name": "polytomic",
518
- "X-Fern-SDK-Version": "0.1.2",
519
- "X-Fern-Runtime": core.RUNTIME.type,
520
- "X-Fern-Runtime-Version": core.RUNTIME.version,
521
- },
522
- contentType: "application/json",
523
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
524
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
525
- });
526
- if (_response.ok) {
527
- return _response.body;
528
- }
529
- if (_response.error.reason === "status-code") {
530
- switch (_response.error.statusCode) {
531
- case 401:
532
- throw new Polytomic.UnauthorizedError(_response.error.body);
533
- default:
534
- throw new errors.PolytomicError({
535
- statusCode: _response.error.statusCode,
536
- body: _response.error.body,
537
- });
538
- }
539
- }
540
- switch (_response.error.reason) {
541
- case "non-json":
542
- throw new errors.PolytomicError({
543
- statusCode: _response.error.statusCode,
544
- body: _response.error.rawBody,
545
- });
546
- case "timeout":
547
- throw new errors.PolytomicTimeoutError();
548
- case "unknown":
549
- throw new errors.PolytomicError({
550
- message: _response.error.errorMessage,
551
- });
552
- }
553
- });
554
- }
555
- /**
556
- * @throws {@link Polytomic.UnauthorizedError}
557
- *
558
- * @example
559
- * await polytomic.modelSync.executions.getUpdateLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "path/to/file.json")
560
- */
561
- getUpdateLogs(syncId, id, filename, requestOptions) {
562
- var _a;
563
- return __awaiter(this, void 0, void 0, function* () {
564
- const _response = yield core.fetcher({
565
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/updates/${filename}`),
566
- method: "GET",
567
- headers: {
568
- Authorization: yield this._getAuthorizationHeader(),
569
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
570
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
571
- : undefined,
572
- "X-Fern-Language": "JavaScript",
573
- "X-Fern-SDK-Name": "polytomic",
574
- "X-Fern-SDK-Version": "0.1.2",
575
- "X-Fern-Runtime": core.RUNTIME.type,
576
- "X-Fern-Runtime-Version": core.RUNTIME.version,
577
- },
578
- contentType: "application/json",
579
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
580
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
581
- });
582
- if (_response.ok) {
583
- return;
584
- }
585
- if (_response.error.reason === "status-code") {
586
- switch (_response.error.statusCode) {
587
- case 401:
588
- throw new Polytomic.UnauthorizedError(_response.error.body);
589
- default:
590
- throw new errors.PolytomicError({
591
- statusCode: _response.error.statusCode,
592
- body: _response.error.body,
593
- });
594
- }
595
- }
596
- switch (_response.error.reason) {
597
- case "non-json":
598
- throw new errors.PolytomicError({
599
- statusCode: _response.error.statusCode,
600
- body: _response.error.rawBody,
601
- });
602
- case "timeout":
603
- throw new errors.PolytomicTimeoutError();
604
- case "unknown":
605
- throw new errors.PolytomicError({
606
- message: _response.error.errorMessage,
607
- });
608
- }
609
- });
610
- }
611
- /**
612
- * @throws {@link Polytomic.UnauthorizedError}
613
- *
614
- * @example
615
- * await polytomic.modelSync.executions.getWarningLogUrLs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d")
616
- */
617
- getWarningLogUrLs(syncId, id, requestOptions) {
618
- var _a;
619
- return __awaiter(this, void 0, void 0, function* () {
620
- const _response = yield core.fetcher({
621
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/warnings`),
622
- method: "GET",
623
- headers: {
624
- Authorization: yield this._getAuthorizationHeader(),
625
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
626
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
627
- : undefined,
628
- "X-Fern-Language": "JavaScript",
629
- "X-Fern-SDK-Name": "polytomic",
630
- "X-Fern-SDK-Version": "0.1.2",
631
- "X-Fern-Runtime": core.RUNTIME.type,
632
- "X-Fern-Runtime-Version": core.RUNTIME.version,
633
- },
634
- contentType: "application/json",
635
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
636
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
637
- });
638
- if (_response.ok) {
639
- return _response.body;
640
- }
641
- if (_response.error.reason === "status-code") {
642
- switch (_response.error.statusCode) {
643
- case 401:
644
- throw new Polytomic.UnauthorizedError(_response.error.body);
645
- default:
646
- throw new errors.PolytomicError({
647
- statusCode: _response.error.statusCode,
648
- body: _response.error.body,
649
- });
650
- }
651
- }
652
- switch (_response.error.reason) {
653
- case "non-json":
654
- throw new errors.PolytomicError({
655
- statusCode: _response.error.statusCode,
656
- body: _response.error.rawBody,
657
- });
658
- case "timeout":
659
- throw new errors.PolytomicTimeoutError();
660
- case "unknown":
661
- throw new errors.PolytomicError({
662
- message: _response.error.errorMessage,
663
- });
664
- }
665
- });
666
- }
667
- /**
668
- * @throws {@link Polytomic.UnauthorizedError}
669
- *
670
- * @example
671
- * await polytomic.modelSync.executions.getWarningLogs("248df4b7-aa70-47b8-a036-33ac447e668d", "248df4b7-aa70-47b8-a036-33ac447e668d", "path/to/file.json")
672
- */
673
- getWarningLogs(syncId, id, filename, requestOptions) {
674
- var _a;
675
- return __awaiter(this, void 0, void 0, function* () {
676
- const _response = yield core.fetcher({
677
- url: (0, url_join_1.default)((_a = (yield core.Supplier.get(this._options.environment))) !== null && _a !== void 0 ? _a : environments.PolytomicEnvironment.Default, `api/syncs/${syncId}/executions/${id}/warnings/${filename}`),
678
- method: "GET",
679
- headers: {
680
- Authorization: yield this._getAuthorizationHeader(),
681
- "X-Polytomic-Version": (yield core.Supplier.get(this._options.xPolytomicVersion)) != null
682
- ? yield core.Supplier.get(this._options.xPolytomicVersion)
683
- : undefined,
684
- "X-Fern-Language": "JavaScript",
685
- "X-Fern-SDK-Name": "polytomic",
686
- "X-Fern-SDK-Version": "0.1.2",
251
+ "X-Fern-SDK-Version": "0.2.0",
687
252
  "X-Fern-Runtime": core.RUNTIME.type,
688
253
  "X-Fern-Runtime-Version": core.RUNTIME.version,
689
254
  },
@@ -696,8 +261,14 @@ class Executions {
696
261
  }
697
262
  if (_response.error.reason === "status-code") {
698
263
  switch (_response.error.statusCode) {
264
+ case 400:
265
+ throw new Polytomic.BadRequestError(_response.error.body);
699
266
  case 401:
700
267
  throw new Polytomic.UnauthorizedError(_response.error.body);
268
+ case 404:
269
+ throw new Polytomic.NotFoundError(_response.error.body);
270
+ case 500:
271
+ throw new Polytomic.InternalServerError(_response.error.body);
701
272
  default:
702
273
  throw new errors.PolytomicError({
703
274
  statusCode: _response.error.statusCode,
@@ -722,11 +293,7 @@ class Executions {
722
293
  }
723
294
  _getAuthorizationHeader() {
724
295
  return __awaiter(this, void 0, void 0, function* () {
725
- const bearer = yield core.Supplier.get(this._options.token);
726
- if (bearer != null) {
727
- return `Bearer ${bearer}`;
728
- }
729
- return undefined;
296
+ return `Bearer ${yield core.Supplier.get(this._options.token)}`;
730
297
  });
731
298
  }
732
299
  }