@konversi/konversi-client 1.2.5 → 1.3.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.
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +15 -2
- package/dist/index.mjs +13 -1
- package/index.ts +13 -0
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -153,6 +153,7 @@ declare function getObjectById(entity: any, id: string): Promise<any>;
|
|
|
153
153
|
declare function updateObject(entity: any, id: string, newData: any): Promise<any>;
|
|
154
154
|
declare function createObject(entity: any, data: any): Promise<any>;
|
|
155
155
|
declare function deleteObject(entity: any, id: string): Promise<any>;
|
|
156
|
+
declare function runScript(scriptNameOrId: string, input: any, sync?: boolean): Promise<any>;
|
|
156
157
|
declare const konversiAPI: {
|
|
157
158
|
setToken: (token: string) => void;
|
|
158
159
|
setCompanyId: (companyId: string) => void;
|
|
@@ -167,6 +168,7 @@ declare const konversiAPI: {
|
|
|
167
168
|
updateObject: typeof updateObject;
|
|
168
169
|
createObject: typeof createObject;
|
|
169
170
|
deleteObject: typeof deleteObject;
|
|
171
|
+
runScript: typeof runScript;
|
|
170
172
|
baseUrl: string | undefined;
|
|
171
173
|
token: string;
|
|
172
174
|
companyId: axios.AxiosHeaderValue | undefined;
|
|
@@ -174,4 +176,4 @@ declare const konversiAPI: {
|
|
|
174
176
|
|
|
175
177
|
declare const Entity: typeof crudEndpoints;
|
|
176
178
|
|
|
177
|
-
export { Entity, konversiAPI as default };
|
|
179
|
+
export { Entity, konversiAPI as default, runScript };
|
package/dist/index.d.ts
CHANGED
|
@@ -153,6 +153,7 @@ declare function getObjectById(entity: any, id: string): Promise<any>;
|
|
|
153
153
|
declare function updateObject(entity: any, id: string, newData: any): Promise<any>;
|
|
154
154
|
declare function createObject(entity: any, data: any): Promise<any>;
|
|
155
155
|
declare function deleteObject(entity: any, id: string): Promise<any>;
|
|
156
|
+
declare function runScript(scriptNameOrId: string, input: any, sync?: boolean): Promise<any>;
|
|
156
157
|
declare const konversiAPI: {
|
|
157
158
|
setToken: (token: string) => void;
|
|
158
159
|
setCompanyId: (companyId: string) => void;
|
|
@@ -167,6 +168,7 @@ declare const konversiAPI: {
|
|
|
167
168
|
updateObject: typeof updateObject;
|
|
168
169
|
createObject: typeof createObject;
|
|
169
170
|
deleteObject: typeof deleteObject;
|
|
171
|
+
runScript: typeof runScript;
|
|
170
172
|
baseUrl: string | undefined;
|
|
171
173
|
token: string;
|
|
172
174
|
companyId: axios.AxiosHeaderValue | undefined;
|
|
@@ -174,4 +176,4 @@ declare const konversiAPI: {
|
|
|
174
176
|
|
|
175
177
|
declare const Entity: typeof crudEndpoints;
|
|
176
178
|
|
|
177
|
-
export { Entity, konversiAPI as default };
|
|
179
|
+
export { Entity, konversiAPI as default, runScript };
|
package/dist/index.js
CHANGED
|
@@ -51,7 +51,8 @@ var __async = (__this, __arguments, generator) => {
|
|
|
51
51
|
var konversi_client_exports = {};
|
|
52
52
|
__export(konversi_client_exports, {
|
|
53
53
|
Entity: () => Entity,
|
|
54
|
-
default: () => konversi_client_default
|
|
54
|
+
default: () => konversi_client_default,
|
|
55
|
+
runScript: () => runScript
|
|
55
56
|
});
|
|
56
57
|
module.exports = __toCommonJS(konversi_client_exports);
|
|
57
58
|
|
|
@@ -302,6 +303,16 @@ function deleteObject(entity, id) {
|
|
|
302
303
|
return response.data;
|
|
303
304
|
});
|
|
304
305
|
}
|
|
306
|
+
function runScript(scriptNameOrId, input, sync = false) {
|
|
307
|
+
return __async(this, null, function* () {
|
|
308
|
+
if (sync) {
|
|
309
|
+
const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
|
|
310
|
+
return response2.data;
|
|
311
|
+
}
|
|
312
|
+
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
313
|
+
return response.data;
|
|
314
|
+
});
|
|
315
|
+
}
|
|
305
316
|
var _a;
|
|
306
317
|
var konversiAPI = {
|
|
307
318
|
setToken: setAuthToken,
|
|
@@ -317,6 +328,7 @@ var konversiAPI = {
|
|
|
317
328
|
updateObject,
|
|
318
329
|
createObject,
|
|
319
330
|
deleteObject,
|
|
331
|
+
runScript,
|
|
320
332
|
baseUrl: axiosAPI_default.defaults.baseURL,
|
|
321
333
|
token: ((_a = axiosAPI_default.defaults.headers.common["Authorization"]) == null ? void 0 : _a.toString().split(" ")[1]) || "",
|
|
322
334
|
companyId: axiosAPI_default.defaults.headers.common["Company"]
|
|
@@ -325,5 +337,6 @@ var konversi_client_default = konversiAPI;
|
|
|
325
337
|
var Entity = crudEndpoints_exports;
|
|
326
338
|
// Annotate the CommonJS export names for ESM import in node:
|
|
327
339
|
0 && (module.exports = {
|
|
328
|
-
Entity
|
|
340
|
+
Entity,
|
|
341
|
+
runScript
|
|
329
342
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -271,6 +271,16 @@ function deleteObject(entity, id) {
|
|
|
271
271
|
return response.data;
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
|
+
function runScript(scriptNameOrId, input, sync = false) {
|
|
275
|
+
return __async(this, null, function* () {
|
|
276
|
+
if (sync) {
|
|
277
|
+
const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
|
|
278
|
+
return response2.data;
|
|
279
|
+
}
|
|
280
|
+
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
281
|
+
return response.data;
|
|
282
|
+
});
|
|
283
|
+
}
|
|
274
284
|
var _a;
|
|
275
285
|
var konversiAPI = {
|
|
276
286
|
setToken: setAuthToken,
|
|
@@ -286,6 +296,7 @@ var konversiAPI = {
|
|
|
286
296
|
updateObject,
|
|
287
297
|
createObject,
|
|
288
298
|
deleteObject,
|
|
299
|
+
runScript,
|
|
289
300
|
baseUrl: axiosAPI_default.defaults.baseURL,
|
|
290
301
|
token: ((_a = axiosAPI_default.defaults.headers.common["Authorization"]) == null ? void 0 : _a.toString().split(" ")[1]) || "",
|
|
291
302
|
companyId: axiosAPI_default.defaults.headers.common["Company"]
|
|
@@ -294,5 +305,6 @@ var konversi_client_default = konversiAPI;
|
|
|
294
305
|
var Entity = crudEndpoints_exports;
|
|
295
306
|
export {
|
|
296
307
|
Entity,
|
|
297
|
-
konversi_client_default as default
|
|
308
|
+
konversi_client_default as default,
|
|
309
|
+
runScript
|
|
298
310
|
};
|
package/index.ts
CHANGED
|
@@ -81,6 +81,17 @@ async function deleteObject(entity: any, id: string) {
|
|
|
81
81
|
return response.data;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
+
|
|
85
|
+
export async function runScript(scriptNameOrId: string, input: any, sync= false) {
|
|
86
|
+
if (sync) {
|
|
87
|
+
const response = await axiosAPI.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, {input})
|
|
88
|
+
return response.data;
|
|
89
|
+
}
|
|
90
|
+
const response = await axiosAPI.post(`/automation/script/${scriptNameOrId}/run`, {input})
|
|
91
|
+
|
|
92
|
+
return response.data;
|
|
93
|
+
}
|
|
94
|
+
|
|
84
95
|
const konversiAPI = {
|
|
85
96
|
setToken: setAuthToken,
|
|
86
97
|
setCompanyId,
|
|
@@ -98,6 +109,8 @@ const konversiAPI = {
|
|
|
98
109
|
createObject,
|
|
99
110
|
deleteObject,
|
|
100
111
|
|
|
112
|
+
runScript,
|
|
113
|
+
|
|
101
114
|
baseUrl: axiosAPI.defaults.baseURL,
|
|
102
115
|
token: axiosAPI.defaults.headers.common['Authorization']?.toString().split(' ')[1] || '',
|
|
103
116
|
companyId: axiosAPI.defaults.headers.common['Company'],
|