@visa-check-r/integrations 0.0.30 → 0.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1282,6 +1282,30 @@ var createChecklistItemService = (client) => ({
1282
1282
  }
1283
1283
  });
1284
1284
 
1285
+ // src/services/file/file.service.ts
1286
+ var createFileService = (client) => ({
1287
+ async uploadFile(formData) {
1288
+ const url = client["url"].replace("/graphql", "") + "/api/upload";
1289
+ const token = await client.token();
1290
+ const headers = {
1291
+ ...token ? { Authorization: `Bearer ${token}` } : {}
1292
+ };
1293
+ const res = await fetch(url, {
1294
+ method: "POST",
1295
+ headers,
1296
+ body: formData
1297
+ // native FormData works fine
1298
+ });
1299
+ const text = await res.text();
1300
+ if (!res.ok) throw new Error(`File upload failed: ${res.status} - ${text}`);
1301
+ try {
1302
+ return JSON.parse(text);
1303
+ } catch (e) {
1304
+ return text;
1305
+ }
1306
+ }
1307
+ });
1308
+
1285
1309
  // src/services/checklist/schemas/visaprofile-checklist-item.schema.ts
1286
1310
  var visaProfileChecklistItemSchema = {
1287
1311
  createVisaProfileChecklistItems: (query) => `
@@ -1369,6 +1393,11 @@ var deleteVisaProfileChecklistItemResponse = ["visaProfileChecklistItemId"];
1369
1393
 
1370
1394
  // src/services/checklist/visa-profile-checklist-item.service.ts
1371
1395
  var createVisaProfileChecklistItemService = (client) => ({
1396
+ // upload file
1397
+ async uploadChecklistImage(form) {
1398
+ const fileClient = createFileService(client);
1399
+ return (await fileClient.uploadFile(form)).visaProfileChecklistItem;
1400
+ },
1372
1401
  async deleteVisaProfileChecklistItem(input, fetchFields, option) {
1373
1402
  var _a, _b;
1374
1403
  const res = await client.request(