@aravinthan_p/appnest-app-sdk-utils 1.0.3 → 1.0.5
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/appnestFunctions/appnestFunctions.MD +2 -1
- package/appnestFunctions/dbFunction/db.js +37 -37
- package/appnestFunctions/fileFunction/file.js +8 -8
- package/appnestFunctions/httpFunction/http.js +2 -2
- package/appnestFunctions/nextFunction/next.js +4 -4
- package/appnestFunctions/scheduleFunction/schedule.js +9 -9
- package/appnestFunctions/utils/apiConstants.js +4 -4
- package/package.json +1 -1
|
@@ -149,7 +149,8 @@ All functions return `Promise<{ data, status }>` unless noted.
|
|
|
149
149
|
Typical pattern inside a Lambda or handler:
|
|
150
150
|
|
|
151
151
|
```javascript
|
|
152
|
-
const {
|
|
152
|
+
const { AppnestFunctions } = require('appnest-app-sdk-utils');
|
|
153
|
+
const { $db, $http, $file, $next, $schedule, getTraceId } = AppnestFunctions;
|
|
153
154
|
|
|
154
155
|
exports.myHandler = async (event, context) => {
|
|
155
156
|
const traceId = getTraceId();
|
|
@@ -15,7 +15,7 @@ const validateKey = ({ key }) => {
|
|
|
15
15
|
}
|
|
16
16
|
return true;
|
|
17
17
|
} catch (error) {
|
|
18
|
-
console.error("$Db - validateKey - error:",
|
|
18
|
+
console.error("$Db - validateKey - error:", error);
|
|
19
19
|
throw error;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
@@ -44,7 +44,7 @@ const validateValue = ({ value, dataType }) => {
|
|
|
44
44
|
throw new Error('Value must be a valid JSON object');
|
|
45
45
|
}
|
|
46
46
|
} catch (error) {
|
|
47
|
-
console.error("$Db - validateValue - error:",
|
|
47
|
+
console.error("$Db - validateValue - error:", error);
|
|
48
48
|
throw error;
|
|
49
49
|
}
|
|
50
50
|
}
|
|
@@ -61,7 +61,7 @@ const validateValue = ({ value, dataType }) => {
|
|
|
61
61
|
return true;
|
|
62
62
|
}
|
|
63
63
|
catch (error) {
|
|
64
|
-
console.error("$Db - validateValue - error:",
|
|
64
|
+
console.error("$Db - validateValue - error:", error);
|
|
65
65
|
throw error;
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -77,7 +77,7 @@ const get = async ({ key }) => {
|
|
|
77
77
|
return await dbAPIWrapper({ apiPayload });
|
|
78
78
|
}
|
|
79
79
|
catch (error) {
|
|
80
|
-
console.error("$Db - get - error:",
|
|
80
|
+
console.error("$Db - get - error:", error);
|
|
81
81
|
throw error;
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -93,7 +93,7 @@ const create = async ({ key }) => {
|
|
|
93
93
|
}
|
|
94
94
|
return await dbAPIWrapper({ apiPayload });
|
|
95
95
|
} catch (error) {
|
|
96
|
-
console.error("$Db - create - error:",
|
|
96
|
+
console.error("$Db - create - error:", error);
|
|
97
97
|
throw error;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -109,7 +109,7 @@ const update = async ({ key, value }) => {
|
|
|
109
109
|
}
|
|
110
110
|
return await dbAPIWrapper({ apiPayload });
|
|
111
111
|
} catch (error) {
|
|
112
|
-
console.error("$Db - update - error:",
|
|
112
|
+
console.error("$Db - update - error:", error);
|
|
113
113
|
throw error;
|
|
114
114
|
}
|
|
115
115
|
}
|
|
@@ -125,7 +125,7 @@ const deleteOperation = async ({ key }) => {
|
|
|
125
125
|
return await dbAPIWrapper({ apiPayload });
|
|
126
126
|
}
|
|
127
127
|
catch (error) {
|
|
128
|
-
console.error("$Db - deleteOperation - error:",
|
|
128
|
+
console.error("$Db - deleteOperation - error:", error);
|
|
129
129
|
throw error;
|
|
130
130
|
}
|
|
131
131
|
}
|
|
@@ -140,7 +140,7 @@ const stringGet = async ({ key }) => {
|
|
|
140
140
|
}
|
|
141
141
|
return await dbAPIWrapper({ apiPayload });
|
|
142
142
|
} catch (error) {
|
|
143
|
-
console.error("$Db - stringGet - error:",
|
|
143
|
+
console.error("$Db - stringGet - error:", error);
|
|
144
144
|
throw error;
|
|
145
145
|
}
|
|
146
146
|
}
|
|
@@ -159,7 +159,7 @@ const stringCreate = async ({ key, value }) => {
|
|
|
159
159
|
}
|
|
160
160
|
return await dbAPIWrapper({ apiPayload });
|
|
161
161
|
} catch (error) {
|
|
162
|
-
console.error("$Db - stringSet - error:",
|
|
162
|
+
console.error("$Db - stringSet - error:", error);
|
|
163
163
|
throw error;
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -175,7 +175,7 @@ const stringUpdate = async ({ key, value }) => {
|
|
|
175
175
|
}
|
|
176
176
|
return await dbAPIWrapper({ apiPayload });
|
|
177
177
|
} catch (error) {
|
|
178
|
-
console.error("$Db - stringUpdate - error:",
|
|
178
|
+
console.error("$Db - stringUpdate - error:", error);
|
|
179
179
|
throw error;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
@@ -190,7 +190,7 @@ const stringDelete = async ({ key }) => {
|
|
|
190
190
|
}
|
|
191
191
|
return await dbAPIWrapper({ apiPayload });
|
|
192
192
|
} catch (error) {
|
|
193
|
-
console.error("$Db - stringDelete - error:",
|
|
193
|
+
console.error("$Db - stringDelete - error:", error);
|
|
194
194
|
throw error;
|
|
195
195
|
}
|
|
196
196
|
}
|
|
@@ -212,7 +212,7 @@ const numberGet = async ({ key }) => {
|
|
|
212
212
|
}
|
|
213
213
|
return await dbAPIWrapper({ apiPayload });
|
|
214
214
|
} catch (error) {
|
|
215
|
-
console.error("$Db - numberGet - error:",
|
|
215
|
+
console.error("$Db - numberGet - error:", error);
|
|
216
216
|
throw error;
|
|
217
217
|
}
|
|
218
218
|
}
|
|
@@ -229,7 +229,7 @@ const numberCreate = async ({ key, value }) => {
|
|
|
229
229
|
return await dbAPIWrapper({ apiPayload });
|
|
230
230
|
}
|
|
231
231
|
catch (error) {
|
|
232
|
-
console.error("$Db - numberCreate - error:",
|
|
232
|
+
console.error("$Db - numberCreate - error:", error);
|
|
233
233
|
throw error;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
@@ -246,7 +246,7 @@ const numberUpdate = async ({ key, value }) => {
|
|
|
246
246
|
return await dbAPIWrapper({ apiPayload });
|
|
247
247
|
}
|
|
248
248
|
catch (error) {
|
|
249
|
-
console.error("$Db - numberUpdate - error:",
|
|
249
|
+
console.error("$Db - numberUpdate - error:", error);
|
|
250
250
|
throw error;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
@@ -262,7 +262,7 @@ const numberDelete = async ({ key }) => {
|
|
|
262
262
|
return await dbAPIWrapper({ apiPayload });
|
|
263
263
|
}
|
|
264
264
|
catch (error) {
|
|
265
|
-
console.error("$Db - numberDelete - error:",
|
|
265
|
+
console.error("$Db - numberDelete - error:", error);
|
|
266
266
|
throw error;
|
|
267
267
|
}
|
|
268
268
|
}
|
|
@@ -278,7 +278,7 @@ const numberIncrement = async ({ key }) => {
|
|
|
278
278
|
return await dbAPIWrapper({ apiPayload });
|
|
279
279
|
}
|
|
280
280
|
catch (error) {
|
|
281
|
-
console.error("$Db - numberIncrement - error:",
|
|
281
|
+
console.error("$Db - numberIncrement - error:", error);
|
|
282
282
|
throw error;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
@@ -294,7 +294,7 @@ const numberDecrement = async ({ key }) => {
|
|
|
294
294
|
return await dbAPIWrapper({ apiPayload });
|
|
295
295
|
}
|
|
296
296
|
catch (error) {
|
|
297
|
-
console.error("$Db - numberDecrement - error:",
|
|
297
|
+
console.error("$Db - numberDecrement - error:", error);
|
|
298
298
|
throw error;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
@@ -318,7 +318,7 @@ const listGet = async ({ key }) => {
|
|
|
318
318
|
}
|
|
319
319
|
return await dbAPIWrapper({ apiPayload });
|
|
320
320
|
} catch (error) {
|
|
321
|
-
console.error("$Db - listGet - error:",
|
|
321
|
+
console.error("$Db - listGet - error:", error);
|
|
322
322
|
throw error;
|
|
323
323
|
}
|
|
324
324
|
}
|
|
@@ -334,7 +334,7 @@ const listCreate = async ({ key, value }) => {
|
|
|
334
334
|
}
|
|
335
335
|
return await dbAPIWrapper({ apiPayload });
|
|
336
336
|
} catch (error) {
|
|
337
|
-
console.error("$Db - listCreate - error:",
|
|
337
|
+
console.error("$Db - listCreate - error:", error);
|
|
338
338
|
throw error;
|
|
339
339
|
}
|
|
340
340
|
}
|
|
@@ -350,7 +350,7 @@ const listUpdate = async ({ key, value }) => {
|
|
|
350
350
|
}
|
|
351
351
|
return await dbAPIWrapper({ apiPayload });
|
|
352
352
|
} catch (error) {
|
|
353
|
-
console.error("$Db - listUpdate - error:",
|
|
353
|
+
console.error("$Db - listUpdate - error:", error);
|
|
354
354
|
throw error;
|
|
355
355
|
}
|
|
356
356
|
}
|
|
@@ -367,7 +367,7 @@ const listAppend = async ({ key, value }) => {
|
|
|
367
367
|
}
|
|
368
368
|
return await dbAPIWrapper({ apiPayload });
|
|
369
369
|
} catch (error) {
|
|
370
|
-
console.error("$Db - listAppend - error:",
|
|
370
|
+
console.error("$Db - listAppend - error:", error);
|
|
371
371
|
throw error;
|
|
372
372
|
}
|
|
373
373
|
}
|
|
@@ -383,7 +383,7 @@ const listPrepend = async ({ key, value }) => {
|
|
|
383
383
|
}
|
|
384
384
|
return await dbAPIWrapper({ apiPayload });
|
|
385
385
|
} catch (error) {
|
|
386
|
-
console.error("$Db - listPrepend - error:",
|
|
386
|
+
console.error("$Db - listPrepend - error:", error);
|
|
387
387
|
throw error;
|
|
388
388
|
}
|
|
389
389
|
}
|
|
@@ -399,7 +399,7 @@ const listUpdateItemAtIndex = async ({ key, value, index }) => {
|
|
|
399
399
|
}
|
|
400
400
|
return await dbAPIWrapper({ apiPayload });
|
|
401
401
|
} catch (error) {
|
|
402
|
-
console.error("$Db - listUpdateItemAtIndex - error:",
|
|
402
|
+
console.error("$Db - listUpdateItemAtIndex - error:", error);
|
|
403
403
|
throw error;
|
|
404
404
|
}
|
|
405
405
|
}
|
|
@@ -415,7 +415,7 @@ const listRemoveItemAtIndex = async ({ key, index }) => {
|
|
|
415
415
|
return await dbAPIWrapper({ apiPayload });
|
|
416
416
|
}
|
|
417
417
|
catch (error) {
|
|
418
|
-
console.error("$Db - listRemoveItemAtIndex - error:",
|
|
418
|
+
console.error("$Db - listRemoveItemAtIndex - error:", error);
|
|
419
419
|
throw error;
|
|
420
420
|
}
|
|
421
421
|
}
|
|
@@ -441,7 +441,7 @@ const mapGet = async ({ key }) => {
|
|
|
441
441
|
}
|
|
442
442
|
return await dbAPIWrapper({ apiPayload });
|
|
443
443
|
} catch (error) {
|
|
444
|
-
console.error("$Db - mapGet - error:",
|
|
444
|
+
console.error("$Db - mapGet - error:", error);
|
|
445
445
|
throw error;
|
|
446
446
|
}
|
|
447
447
|
}
|
|
@@ -461,10 +461,10 @@ const mapCreate = async ({ key, value }) => {
|
|
|
461
461
|
value,
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
console.log("$Db - mapCreate - apiPayload:",
|
|
464
|
+
console.log("$Db - mapCreate - apiPayload:", apiPayload);
|
|
465
465
|
return await dbAPIWrapper({ apiPayload });
|
|
466
466
|
} catch (error) {
|
|
467
|
-
console.error("$Db - mapCreate - error:",
|
|
467
|
+
console.error("$Db - mapCreate - error:", error);
|
|
468
468
|
throw error;
|
|
469
469
|
}
|
|
470
470
|
}
|
|
@@ -480,7 +480,7 @@ const mapUpdate = async ({ key, value }) => {
|
|
|
480
480
|
}
|
|
481
481
|
return await dbAPIWrapper({ apiPayload });
|
|
482
482
|
} catch (error) {
|
|
483
|
-
console.error("$Db - mapUpdate - error:",
|
|
483
|
+
console.error("$Db - mapUpdate - error:", error);
|
|
484
484
|
throw error;
|
|
485
485
|
}
|
|
486
486
|
}
|
|
@@ -495,7 +495,7 @@ const mapDelete = async ({ key }) => {
|
|
|
495
495
|
}
|
|
496
496
|
}
|
|
497
497
|
catch (error) {
|
|
498
|
-
console.error("$Db - mapDelete - error:",
|
|
498
|
+
console.error("$Db - mapDelete - error:", error);
|
|
499
499
|
throw error;
|
|
500
500
|
}
|
|
501
501
|
}
|
|
@@ -519,7 +519,7 @@ const booleanGet = async ({ key }) => {
|
|
|
519
519
|
}
|
|
520
520
|
return await dbAPIWrapper({ apiPayload });
|
|
521
521
|
} catch (error) {
|
|
522
|
-
console.error("$Db - booleanGet - error:",
|
|
522
|
+
console.error("$Db - booleanGet - error:", error);
|
|
523
523
|
throw error;
|
|
524
524
|
}
|
|
525
525
|
}
|
|
@@ -536,10 +536,10 @@ const booleanCreate = async ({ key, value }) => {
|
|
|
536
536
|
value,
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
console.log("$Db - booleanCreate - apiPayload:",
|
|
539
|
+
console.log("$Db - booleanCreate - apiPayload:", apiPayload);
|
|
540
540
|
return await dbAPIWrapper({ apiPayload });
|
|
541
541
|
} catch (error) {
|
|
542
|
-
console.error("$Db - booleanCreate - error:",
|
|
542
|
+
console.error("$Db - booleanCreate - error:", error);
|
|
543
543
|
throw error;
|
|
544
544
|
}
|
|
545
545
|
}
|
|
@@ -555,7 +555,7 @@ const booleanUpdate = async ({ key, value }) => {
|
|
|
555
555
|
}
|
|
556
556
|
return await dbAPIWrapper({ apiPayload });
|
|
557
557
|
} catch (error) {
|
|
558
|
-
console.error("$Db - booleanUpdate - error:",
|
|
558
|
+
console.error("$Db - booleanUpdate - error:", error);
|
|
559
559
|
throw error;
|
|
560
560
|
}
|
|
561
561
|
}
|
|
@@ -571,7 +571,7 @@ const booleanDelete = async ({ key }) => {
|
|
|
571
571
|
return await dbAPIWrapper({ apiPayload });
|
|
572
572
|
}
|
|
573
573
|
catch (error) {
|
|
574
|
-
console.error("$Db - booleanDelete - error:",
|
|
574
|
+
console.error("$Db - booleanDelete - error:", error);
|
|
575
575
|
throw error;
|
|
576
576
|
}
|
|
577
577
|
}
|
|
@@ -591,16 +591,16 @@ const dbAPIWrapper = async ({ apiPayload }) => {
|
|
|
591
591
|
userInstalledId: parentLayerConfigObject.userInstalledId,
|
|
592
592
|
...apiPayload
|
|
593
593
|
};
|
|
594
|
-
console.log("$Db - dbAPIWrapper - requestBody:",
|
|
594
|
+
console.log("$Db - dbAPIWrapper - requestBody:", requestBody);
|
|
595
595
|
const response = await makeSparrowAppAPICall({
|
|
596
596
|
method: DB_API.COMMON.method,
|
|
597
597
|
endpoint: DB_API.COMMON.endpoint,
|
|
598
598
|
requestBody
|
|
599
599
|
});
|
|
600
|
-
console.log("$Db - dbAPIWrapper - response:",
|
|
600
|
+
console.log("$Db - dbAPIWrapper - response:", response);
|
|
601
601
|
return { data: response?.data, status: response?.status };
|
|
602
602
|
} catch (error) {
|
|
603
|
-
console.error("$Db - dbAPIWrapper - error:",
|
|
603
|
+
console.error("$Db - dbAPIWrapper - error:", error);
|
|
604
604
|
throw error;
|
|
605
605
|
}
|
|
606
606
|
};
|
|
@@ -11,7 +11,7 @@ const getUploadUrl = async ({ path, visibility = "PUBLIC" }) => {
|
|
|
11
11
|
};
|
|
12
12
|
return await fileAPIWrapper({ apiUrl: FILE_STORAGE_API.GET_SIGNED_URL.endpoint, apiMethod: FILE_STORAGE_API.GET_SIGNED_URL.method, apiPayload });
|
|
13
13
|
} catch (error) {
|
|
14
|
-
console.log("$File - getUploadUrl - error:",
|
|
14
|
+
console.log("$File - getUploadUrl - error:", error);
|
|
15
15
|
throw error;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -25,7 +25,7 @@ const getDownloadUrl = async ({ path, visibility = "PUBLIC" }) => {
|
|
|
25
25
|
};
|
|
26
26
|
return await fileAPIWrapper({ apiUrl: FILE_STORAGE_API.GET_SIGNED_URL.endpoint, apiMethod: FILE_STORAGE_API.GET_SIGNED_URL.method, apiPayload });
|
|
27
27
|
} catch (error) {
|
|
28
|
-
console.log("$File - getDownloadUrl - error:",
|
|
28
|
+
console.log("$File - getDownloadUrl - error:", error);
|
|
29
29
|
throw error;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -39,7 +39,7 @@ const deleteOperation = async ({ path, visibility = "PUBLIC" }) => {
|
|
|
39
39
|
};
|
|
40
40
|
return await fileAPIWrapper({ apiUrl: FILE_STORAGE_API.DELETE_OBJECT.endpoint, apiMethod: FILE_STORAGE_API.DELETE_OBJECT.method, apiPayload });
|
|
41
41
|
} catch (error) {
|
|
42
|
-
console.log("$File - deleteOperation - error:",
|
|
42
|
+
console.log("$File - deleteOperation - error:", error);
|
|
43
43
|
throw error;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -53,7 +53,7 @@ const list = async ({ path, visibility = "PUBLIC" }) => {
|
|
|
53
53
|
};
|
|
54
54
|
return await fileAPIWrapper({ apiUrl: FILE_STORAGE_API.GET_OBJECTS.endpoint, apiMethod: FILE_STORAGE_API.GET_OBJECTS.method, apiPayload });
|
|
55
55
|
} catch (error) {
|
|
56
|
-
console.log("$File - list - error:",
|
|
56
|
+
console.log("$File - list - error:", error);
|
|
57
57
|
throw error;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
@@ -67,7 +67,7 @@ const exists = async ({ path, visibility = "PUBLIC" }) => {
|
|
|
67
67
|
};
|
|
68
68
|
return await fileAPIWrapper({ apiUrl: FILE_STORAGE_API.OBJECT_EXISTS.endpoint, apiMethod: FILE_STORAGE_API.OBJECT_EXISTS.method, apiPayload });
|
|
69
69
|
} catch (error) {
|
|
70
|
-
console.log("$File - exists - error:",
|
|
70
|
+
console.log("$File - exists - error:", error);
|
|
71
71
|
throw error;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
@@ -84,17 +84,17 @@ const fileAPIWrapper = async ({ apiUrl, apiMethod, apiPayload }) => {
|
|
|
84
84
|
traceId,
|
|
85
85
|
...apiPayload
|
|
86
86
|
};
|
|
87
|
-
console.log("$File - fileAPIWrapper - requestBody:",
|
|
87
|
+
console.log("$File - fileAPIWrapper - requestBody:", requestBody);
|
|
88
88
|
|
|
89
89
|
const response = await makeSparrowAppAPICall({
|
|
90
90
|
method: apiMethod,
|
|
91
91
|
endpoint: apiUrl,
|
|
92
92
|
requestBody
|
|
93
93
|
});
|
|
94
|
-
console.log("$File - fileAPIWrapper - response:",
|
|
94
|
+
console.log("$File - fileAPIWrapper - response:", response);
|
|
95
95
|
return { data: response?.data, status: response?.status };
|
|
96
96
|
} catch (error) {
|
|
97
|
-
console.error("$File - fileAPIWrapper - error:",
|
|
97
|
+
console.error("$File - fileAPIWrapper - error:", error);
|
|
98
98
|
throw error;
|
|
99
99
|
}
|
|
100
100
|
};
|
|
@@ -75,7 +75,7 @@ const request = async ({ url, query = {}, method, headers = {}, body = {} }) =>
|
|
|
75
75
|
const apiPayload = constructHttpApiPayload({ url, query, method, headers, body });
|
|
76
76
|
return await httpAPIWrapper({ apiPayload });
|
|
77
77
|
} catch (error) {
|
|
78
|
-
console.log("$http - request - error:",
|
|
78
|
+
console.log("$http - request - error:", error);
|
|
79
79
|
throw error;
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -91,7 +91,7 @@ const httpAPIWrapper = async ({ apiPayload }) => {
|
|
|
91
91
|
appVersion: parentLayerConfigObject.appVersion,
|
|
92
92
|
...apiPayload
|
|
93
93
|
};
|
|
94
|
-
console.log("$http - httpAPIWrapper - requestBody:",
|
|
94
|
+
console.log("$http - httpAPIWrapper - requestBody:", requestBody);
|
|
95
95
|
const response = await makeSparrowAppAPICall({
|
|
96
96
|
method: HTTP_API.COMMON.method,
|
|
97
97
|
endpoint: HTTP_API.COMMON.endpoint,
|
|
@@ -20,7 +20,7 @@ const run = async ({ functionName, payload, delay = 0 }) => {
|
|
|
20
20
|
};
|
|
21
21
|
return await nextAPIWrapper({ apiPayload });
|
|
22
22
|
} catch (error) {
|
|
23
|
-
console.log("$Next - run - error:",
|
|
23
|
+
console.log("$Next - run - error:", error);
|
|
24
24
|
throw error;
|
|
25
25
|
}
|
|
26
26
|
}
|
|
@@ -35,16 +35,16 @@ const nextAPIWrapper = async ({ apiPayload }) => {
|
|
|
35
35
|
traceId,
|
|
36
36
|
...apiPayload
|
|
37
37
|
};
|
|
38
|
-
console.log("$Next - nextAPIWrapper - requestBody:",
|
|
38
|
+
console.log("$Next - nextAPIWrapper - requestBody:", requestBody);
|
|
39
39
|
const response = await makeSparrowAppAPICall({
|
|
40
40
|
method: NEXT_API.COMMON.method,
|
|
41
41
|
endpoint: NEXT_API.COMMON.endpoint,
|
|
42
42
|
requestBody
|
|
43
43
|
});
|
|
44
|
-
console.log("$Next - nextAPIWrapper - response:",
|
|
44
|
+
console.log("$Next - nextAPIWrapper - response:", response);
|
|
45
45
|
return { data: response?.data, status: response?.status };
|
|
46
46
|
} catch (error) {
|
|
47
|
-
console.error("$Next - nextAPIWrapper - error:",
|
|
47
|
+
console.error("$Next - nextAPIWrapper - error:", error);
|
|
48
48
|
throw error;
|
|
49
49
|
}
|
|
50
50
|
};
|
|
@@ -93,7 +93,7 @@ const create = async ({ data, name, runAt, cronExpression, repeat, type }) => {
|
|
|
93
93
|
validateScheduleTypeConfiguration({ type, cronExpression, repeat, runAt });
|
|
94
94
|
validateScheduleData(data);
|
|
95
95
|
const scheduleRequest = { method: "POST", data, runAt, name, type, cronExpression, repeat };
|
|
96
|
-
console.log("$Schedule - create - storagePayload:",
|
|
96
|
+
console.log("$Schedule - create - storagePayload:", scheduleRequest);
|
|
97
97
|
return await scheduleAPIWrapper({ apiMethod: SCHEDULE_API.CREATE.method, apiUrl: SCHEDULE_API.CREATE.endpoint, schedulePayload: scheduleRequest });
|
|
98
98
|
} catch (error) {
|
|
99
99
|
console.error("$Schedule - create - error:", error);
|
|
@@ -106,7 +106,7 @@ const get = async ({ name, type }) => {
|
|
|
106
106
|
validateScheduleName(name);
|
|
107
107
|
validateScheduleType(type);
|
|
108
108
|
const schedulePayload = { method: "GET", name, type };
|
|
109
|
-
console.log("$Schedule - get - storagePayload:",
|
|
109
|
+
console.log("$Schedule - get - storagePayload:", schedulePayload);
|
|
110
110
|
return await scheduleAPIWrapper({ apiMethod: SCHEDULE_API.GET.method, apiUrl: SCHEDULE_API.GET.endpoint, schedulePayload });
|
|
111
111
|
} catch (error) {
|
|
112
112
|
console.error("$Schedule - get - error:", error);
|
|
@@ -121,7 +121,7 @@ const update = async ({ data, name, runAt, cronExpression, repeat, type }) => {
|
|
|
121
121
|
validateScheduleTypeConfiguration({ type, cronExpression, repeat, runAt });
|
|
122
122
|
validateScheduleData(data);
|
|
123
123
|
const request = { method: "PUT", data, runAt, name, type, cronExpression, repeat }
|
|
124
|
-
console.log("$Schedule - update - storagePayload:",
|
|
124
|
+
console.log("$Schedule - update - storagePayload:", request);
|
|
125
125
|
return await scheduleAPIWrapper({ apiMethod: SCHEDULE_API.UPDATE.method, apiUrl: SCHEDULE_API.UPDATE.endpoint, schedulePayload: request });
|
|
126
126
|
} catch (error) {
|
|
127
127
|
console.error("$Schedule - update - error:", error);
|
|
@@ -135,7 +135,7 @@ const pause = async ({ name, type }) => {
|
|
|
135
135
|
validateScheduleType(type);
|
|
136
136
|
validateScheduleName(name);
|
|
137
137
|
const request = { method: "PAUSE", name, type }
|
|
138
|
-
console.log("$Schedule - pause - storagePayload:",
|
|
138
|
+
console.log("$Schedule - pause - storagePayload:", request);
|
|
139
139
|
return await scheduleAPIWrapper({ apiMethod: SCHEDULE_API.PAUSE.method, apiUrl: SCHEDULE_API.PAUSE.endpoint, schedulePayload: request });
|
|
140
140
|
} catch (error) {
|
|
141
141
|
console.error("$Schedule - pause - error:", error);
|
|
@@ -149,7 +149,7 @@ const resume = async ({ name, type }) => {
|
|
|
149
149
|
validateScheduleType(type);
|
|
150
150
|
validateScheduleName(name);
|
|
151
151
|
const request = { method: "RESUME", name, type }
|
|
152
|
-
console.log("$Schedule - resume - storagePayload:",
|
|
152
|
+
console.log("$Schedule - resume - storagePayload:", request);
|
|
153
153
|
return await scheduleAPIWrapper({ apiMethod: SCHEDULE_API.RESUME.method, apiUrl: SCHEDULE_API.RESUME.endpoint, schedulePayload: request });
|
|
154
154
|
} catch (error) {
|
|
155
155
|
console.error("$Schedule - resume - error:", error);
|
|
@@ -161,7 +161,7 @@ const deleteOperation = async ({ name, type }) => {
|
|
|
161
161
|
try {
|
|
162
162
|
validateScheduleName(name);
|
|
163
163
|
const schedulePayload = { method: "DELETE", name, type };
|
|
164
|
-
console.log("$Schedule - deleteOperation - storagePayload:",
|
|
164
|
+
console.log("$Schedule - deleteOperation - storagePayload:", schedulePayload);
|
|
165
165
|
return await scheduleAPIWrapper({ apiMethod: SCHEDULE_API.DELETE.method, apiUrl: SCHEDULE_API.DELETE.endpoint, schedulePayload });
|
|
166
166
|
} catch (error) {
|
|
167
167
|
console.error("$Schedule - deleteOperation - error:", error);
|
|
@@ -182,16 +182,16 @@ const scheduleAPIWrapper = async ({ apiMethod, apiUrl, schedulePayload }) => {
|
|
|
182
182
|
userInstalledId: parentLayerConfigObject.userInstalledId,
|
|
183
183
|
...schedulePayload
|
|
184
184
|
};
|
|
185
|
-
console.log("$Schedule - scheduleAPIWrapper - requestBody:",
|
|
185
|
+
console.log("$Schedule - scheduleAPIWrapper - requestBody:", requestBody);
|
|
186
186
|
const response = await makeSparrowAppAPICall({
|
|
187
187
|
method: apiMethod,
|
|
188
188
|
endpoint: apiUrl,
|
|
189
189
|
requestBody
|
|
190
190
|
});
|
|
191
|
-
console.log("$Schedule - scheduleAPIWrapper - response:",
|
|
191
|
+
console.log("$Schedule - scheduleAPIWrapper - response:", response);
|
|
192
192
|
return { data: response?.data, status: response?.status };
|
|
193
193
|
} catch (error) {
|
|
194
|
-
console.error("$Schedule - scheduleAPIWrapper - error:",
|
|
194
|
+
console.error("$Schedule - scheduleAPIWrapper - error:", error);
|
|
195
195
|
throw error;
|
|
196
196
|
}
|
|
197
197
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
const FILE_STORAGE_API = {
|
|
2
2
|
GET_SIGNED_URL: {
|
|
3
|
-
endpoint: '/get-signed-url',
|
|
3
|
+
endpoint: '/v2/api/file-storage/get-signed-url',
|
|
4
4
|
method: 'POST',
|
|
5
5
|
},
|
|
6
6
|
OBJECT_EXISTS: {
|
|
7
|
-
endpoint: '/object-exists',
|
|
7
|
+
endpoint: '/v2/api/file-storage/object-exists',
|
|
8
8
|
method: 'POST',
|
|
9
9
|
},
|
|
10
10
|
GET_OBJECTS: {
|
|
11
|
-
endpoint: '/get-objects',
|
|
11
|
+
endpoint: '/v2/api/file-storage/get-objects',
|
|
12
12
|
method: 'POST',
|
|
13
13
|
},
|
|
14
14
|
DELETE_OBJECT: {
|
|
15
|
-
endpoint: '/delete-object',
|
|
15
|
+
endpoint: '/v2/api/file-storage/delete-object',
|
|
16
16
|
method: 'POST',
|
|
17
17
|
},
|
|
18
18
|
}
|