@konversi/konversi-client 1.4.9 → 1.4.11
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.js +7 -2
- package/dist/index.mjs +7 -2
- package/package.json +4 -1
- package/.github/workflows/publish_npm.yaml +0 -20
- package/KonversiError.ts +0 -31
- package/axiosAPI.ts +0 -27
- package/crudEndpoints.ts +0 -122
- package/index.ts +0 -173
- package/test/createCustomObject.ts +0 -21
- package/test/getCustomer.ts +0 -5
- package/tsconfig.json +0 -109
package/dist/index.js
CHANGED
|
@@ -406,7 +406,7 @@ function deleteObject(entity, id) {
|
|
|
406
406
|
}
|
|
407
407
|
function runScript(scriptNameOrId, input, sync = false) {
|
|
408
408
|
return __async(this, null, function* () {
|
|
409
|
-
var _a2, _b;
|
|
409
|
+
var _a2, _b, _c, _d, _e;
|
|
410
410
|
try {
|
|
411
411
|
if (sync) {
|
|
412
412
|
const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
|
|
@@ -415,7 +415,12 @@ function runScript(scriptNameOrId, input, sync = false) {
|
|
|
415
415
|
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
416
416
|
return response.data;
|
|
417
417
|
} catch (e) {
|
|
418
|
-
|
|
418
|
+
let errorMessage = e.message;
|
|
419
|
+
errorMessage = ((_b = (_a2 = e == null ? void 0 : e.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || errorMessage;
|
|
420
|
+
if (((_c = e.response) == null ? void 0 : _c.status) === 422) {
|
|
421
|
+
errorMessage = (_e = (_d = e.response) == null ? void 0 : _d.data) == null ? void 0 : _e.errorMessage;
|
|
422
|
+
}
|
|
423
|
+
throw new KonversiError(errorMessage, e);
|
|
419
424
|
}
|
|
420
425
|
});
|
|
421
426
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -374,7 +374,7 @@ function deleteObject(entity, id) {
|
|
|
374
374
|
}
|
|
375
375
|
function runScript(scriptNameOrId, input, sync = false) {
|
|
376
376
|
return __async(this, null, function* () {
|
|
377
|
-
var _a2, _b;
|
|
377
|
+
var _a2, _b, _c, _d, _e;
|
|
378
378
|
try {
|
|
379
379
|
if (sync) {
|
|
380
380
|
const response2 = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, { input });
|
|
@@ -383,7 +383,12 @@ function runScript(scriptNameOrId, input, sync = false) {
|
|
|
383
383
|
const response = yield axiosAPI_default.post(`/automation/script/${scriptNameOrId}/run`, { input });
|
|
384
384
|
return response.data;
|
|
385
385
|
} catch (e) {
|
|
386
|
-
|
|
386
|
+
let errorMessage = e.message;
|
|
387
|
+
errorMessage = ((_b = (_a2 = e == null ? void 0 : e.response) == null ? void 0 : _a2.data) == null ? void 0 : _b.message) || errorMessage;
|
|
388
|
+
if (((_c = e.response) == null ? void 0 : _c.status) === 422) {
|
|
389
|
+
errorMessage = (_e = (_d = e.response) == null ? void 0 : _d.data) == null ? void 0 : _e.errorMessage;
|
|
390
|
+
}
|
|
391
|
+
throw new KonversiError(errorMessage, e);
|
|
387
392
|
}
|
|
388
393
|
});
|
|
389
394
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@konversi/konversi-client",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.11",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,5 +21,8 @@
|
|
|
21
21
|
"tsup": "^8.2.4",
|
|
22
22
|
"typescript": "^5.4.5"
|
|
23
23
|
},
|
|
24
|
+
"files": [
|
|
25
|
+
"dist"
|
|
26
|
+
],
|
|
24
27
|
"packageManager": "pnpm@10.6.5+sha512.cdf928fca20832cd59ec53826492b7dc25dc524d4370b6b4adbf65803d32efaa6c1c88147c0ae4e8d579a6c9eec715757b50d4fa35eea179d868eada4ed043af"
|
|
25
28
|
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
name: Publish to npm
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches:
|
|
6
|
-
- main
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
publish:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
steps:
|
|
12
|
-
- uses: actions/checkout@v2
|
|
13
|
-
- name: Install dependencies
|
|
14
|
-
run: npm install
|
|
15
|
-
- name: Build and publish
|
|
16
|
-
env:
|
|
17
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
18
|
-
run: |
|
|
19
|
-
npm run build
|
|
20
|
-
npm publish
|
package/KonversiError.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export default class KonversiError extends Error {
|
|
2
|
-
originalError?: Error;
|
|
3
|
-
|
|
4
|
-
constructor(message: string, originalError?: Error) {
|
|
5
|
-
super(message);
|
|
6
|
-
|
|
7
|
-
this.originalError = originalError;
|
|
8
|
-
|
|
9
|
-
// Type assertion to access captureStackTrace which exists in Node.js
|
|
10
|
-
const errorConstructor = Error as any;
|
|
11
|
-
if (errorConstructor.captureStackTrace) {
|
|
12
|
-
errorConstructor.captureStackTrace(this, this.constructor);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
if (originalError?.stack) {
|
|
16
|
-
// Filter the stack trace to show only application code
|
|
17
|
-
const filteredStack = originalError.stack
|
|
18
|
-
.split('\n')
|
|
19
|
-
.filter(line =>
|
|
20
|
-
!line.includes('node_modules') &&
|
|
21
|
-
!line.includes('(node:') &&
|
|
22
|
-
!line.includes('node:internal/')
|
|
23
|
-
)
|
|
24
|
-
.join('\n');
|
|
25
|
-
|
|
26
|
-
this.stack = `${this.stack}\nCaused by: ${filteredStack}`;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
this.name = this.constructor.name;
|
|
30
|
-
}
|
|
31
|
-
}
|
package/axiosAPI.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import axios from 'axios';
|
|
2
|
-
|
|
3
|
-
const baseURL = 'https://api.konversi.id/api'
|
|
4
|
-
const timeout = 120000
|
|
5
|
-
|
|
6
|
-
const instance = axios.create({
|
|
7
|
-
baseURL,
|
|
8
|
-
timeout
|
|
9
|
-
})
|
|
10
|
-
|
|
11
|
-
export const setBaseUrl = (baseUrl: string) => {
|
|
12
|
-
instance.defaults.baseURL = baseUrl
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const setAuthToken = (token: string) => {
|
|
16
|
-
instance.defaults.headers.common.authorization = `Bearer ${token}`
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export const setCompanyId = (companyId: string) => {
|
|
20
|
-
instance.defaults.headers.common['Company'] = companyId;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export const clearAuthToken = () => {
|
|
24
|
-
instance.defaults.headers.common.authorization = ''
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export default instance;
|
package/crudEndpoints.ts
DELETED
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
export const NOTIFICATION = 'notification';
|
|
2
|
-
|
|
3
|
-
export const USER_PERSONA = 'user/user-persona';
|
|
4
|
-
export const USER_PERSONA_CUSTOM_SCHEMA_PERMISSION = 'user/user-persona-custom-schema-permission';
|
|
5
|
-
export const USER_PERSONA_ENTITY_PERMISSION = 'user/user-persona-entity-permission';
|
|
6
|
-
export const USER_PERSONA_ENTITY_ACCESS_STATUS = 'user/user-persona-entity-access-status';
|
|
7
|
-
|
|
8
|
-
export const COMPANY_PERMISSION = 'company-permission';
|
|
9
|
-
export const COMPANY_OPTION = 'company-option';
|
|
10
|
-
export const INVITATION = 'user/invitation';
|
|
11
|
-
|
|
12
|
-
export const CUSTOMER = 'contact/customer';
|
|
13
|
-
|
|
14
|
-
export const PRODUCT = 'product'
|
|
15
|
-
export const PRODUCT_ITEM = 'product/product-item'
|
|
16
|
-
export const PRODUCT_GROUP = 'product-group'
|
|
17
|
-
export const PRODUCT_SUPPLIER = 'product/product-supplier'
|
|
18
|
-
|
|
19
|
-
export const PURCHASE_ORDER = 'order/purchase-order'
|
|
20
|
-
export const PURCHASE_ORDER_LINE = 'order/purchase-order-line'
|
|
21
|
-
export const QUOTE = 'order/quote'
|
|
22
|
-
export const QUOTE_LINE = 'order/quote-line'
|
|
23
|
-
export const SALES_ORDER = 'order/sales-order'
|
|
24
|
-
export const SALES_ORDER_LINE = 'order/sales-order-line'
|
|
25
|
-
export const RENTAL_ORDER = 'order/rental-order'
|
|
26
|
-
export const RENTAL_ORDER_LINE = 'order/rental-order-line'
|
|
27
|
-
export const SUPPLIER = 'contact/supplier'
|
|
28
|
-
export const WAREHOUSE = 'warehouse'
|
|
29
|
-
|
|
30
|
-
// Deliveries
|
|
31
|
-
export const INCOMING_DELIVERY = 'delivery/incoming-delivery'
|
|
32
|
-
export const INCOMING_DELIVERY_LINE = 'delivery/incoming-delivery-line'
|
|
33
|
-
export const OUTGOING_DELIVERY = 'delivery/outgoing-delivery'
|
|
34
|
-
export const OUTGOING_DELIVERY_LINE = 'delivery/outgoing-delivery-line'
|
|
35
|
-
export const INTERNAL_DELIVERY = 'delivery/internal-delivery'
|
|
36
|
-
export const INTERNAL_DELIVERY_LINE = 'delivery/internal-delivery-line'
|
|
37
|
-
|
|
38
|
-
// Finance
|
|
39
|
-
export const INVOICE = 'invoice'
|
|
40
|
-
export const INVOICE_LINE = 'invoice/invoice-line'
|
|
41
|
-
export const EXPENSE = 'expense'
|
|
42
|
-
export const EXPENSE_LINE = 'expense/expense-line'
|
|
43
|
-
export const PAYMENT = 'accounting/payment'
|
|
44
|
-
export const INCOMING_PAYMENT_METHOD = 'accounting/incoming-payment-method'
|
|
45
|
-
export const FIXED_ASSET = 'fixed-asset'
|
|
46
|
-
|
|
47
|
-
// ECommerce
|
|
48
|
-
export const STORE = 'store'
|
|
49
|
-
export const STORE_PRODUCT = 'store/store-product'
|
|
50
|
-
export const STORE_PRODUCT_GROUP = 'store/store-product-group'
|
|
51
|
-
export const STORE_PRODUCT_ATTRIBUTE = 'store/store-product-attribute'
|
|
52
|
-
export const STORE_PRODUCT_ATTRIBUTE_VALUE = 'store/store-product-attribute-value'
|
|
53
|
-
|
|
54
|
-
// Accounting
|
|
55
|
-
export const ACCOUNT = 'accounting/account';
|
|
56
|
-
export const JOURNAL_ENTRY = 'accounting/journal-entry';
|
|
57
|
-
export const JOURNAL_ENTRY_LINE = 'accounting/journal-entry-line';
|
|
58
|
-
|
|
59
|
-
// Manufacturing
|
|
60
|
-
export const BILL_OF_MATERIALS = 'manufacturing/bill-of-materials'
|
|
61
|
-
export const BOM_COMPONENT = 'manufacturing/bom-component'
|
|
62
|
-
export const BOM_OPERATION = 'manufacturing/bom-operation'
|
|
63
|
-
export const PRODUCTION_ORDER = 'manufacturing/production-order'
|
|
64
|
-
export const PRODUCTION_ORDER_LINE = 'manufacturing/production-order-line'
|
|
65
|
-
export const JOB_CARD = 'manufacturing/job-card'
|
|
66
|
-
export const WORKSTATION = 'manufacturing/workstation'
|
|
67
|
-
|
|
68
|
-
export const SUBSIDIARY = 'subsidiary'
|
|
69
|
-
|
|
70
|
-
// HR
|
|
71
|
-
export const EMPLOYEE = 'human-resources/employee'
|
|
72
|
-
export const GEOFENCE = 'geofence'
|
|
73
|
-
export const SHIFT = 'human-resources/employee/shift'
|
|
74
|
-
export const ATTENDANCE = 'human-resources/attendance'
|
|
75
|
-
|
|
76
|
-
// Fleet Management
|
|
77
|
-
export const VEHICLE = 'fleet/vehicle'
|
|
78
|
-
export const DELIVERY_JOB = 'fleet/delivery-job'
|
|
79
|
-
|
|
80
|
-
// Custom Objects
|
|
81
|
-
export const CUSTOM_ENTITY_SCHEMA = 'custom-entity/schema'
|
|
82
|
-
export const CUSTOM_ENTITY_OBJECT = 'custom-entity/object'; // Need to add schemaName after this
|
|
83
|
-
export const CUSTOM_ENTITY_FIELD = 'custom-entity/field'; // Need to add schemaName after this
|
|
84
|
-
export const FORM = 'form';
|
|
85
|
-
export const CUSTOM_REPORT = 'report/custom-report';
|
|
86
|
-
|
|
87
|
-
// Automation
|
|
88
|
-
export const AUTOMATION_JOB = 'automation/job'
|
|
89
|
-
export const AUTOMATION_SCRIPT = 'automation/script'
|
|
90
|
-
export const USER_ACTION = 'automation/user-action'
|
|
91
|
-
|
|
92
|
-
// IOT
|
|
93
|
-
export const IOT_DEVICE = 'iot/device';
|
|
94
|
-
export const IOT_JOB = 'iot/job';
|
|
95
|
-
|
|
96
|
-
export const STOCK_ADJUSTMENT = 'stock-adjustment'
|
|
97
|
-
|
|
98
|
-
export const PURCHASE_ORDER_APPROVER = 'approval/approver/purchase-order'
|
|
99
|
-
export const SALES_ORDER_APPROVER = 'approval/approver/sales-order'
|
|
100
|
-
|
|
101
|
-
// Document Generation
|
|
102
|
-
export const CUSTOM_DOCUMENT = 'document-generator/custom-document';
|
|
103
|
-
|
|
104
|
-
export const CUSTOM_FIELD = 'custom-field'
|
|
105
|
-
|
|
106
|
-
export const AUDIT_LOG = 'audit-log'
|
|
107
|
-
|
|
108
|
-
export const COMPANY_ALIAS = 'company-alias'
|
|
109
|
-
|
|
110
|
-
export const PRINT_JOB = 'thermal-printer/print-job'
|
|
111
|
-
|
|
112
|
-
export const WORK_ORDER = 'order/sales-order?type=WORK_ORDER';
|
|
113
|
-
|
|
114
|
-
export const SERVICE_ORDER = 'order/sales-order?type=SERVICE_ORDER';
|
|
115
|
-
export const IDENTIFIER_GROUP = 'identifier/identifier-group';
|
|
116
|
-
export const IDENTIFIER_TOKEN = 'identifier/identifier-token';
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
// TODO: Deprecate
|
|
120
|
-
export const INCOMING_SHIPMENT = 'shipment/incoming-shipment'
|
|
121
|
-
export const OUTGOING_SHIPMENT = 'shipment/outgoing-shipment'
|
|
122
|
-
///
|
package/index.ts
DELETED
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
import { Axios, AxiosRequestConfig } from "axios";
|
|
2
|
-
import axiosAPI, { setAuthToken, setBaseUrl, setCompanyId } from "./axiosAPI";
|
|
3
|
-
|
|
4
|
-
import * as crudEndpoints from "./crudEndpoints";
|
|
5
|
-
import KonversiError from "./KonversiError";
|
|
6
|
-
|
|
7
|
-
async function call(axiosRequest: AxiosRequestConfig) {
|
|
8
|
-
return await axiosAPI.request(axiosRequest);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
async function getAllCustomObjects(schemaName: string, queryParams: any = {}) {
|
|
12
|
-
try {
|
|
13
|
-
const response = await axiosAPI.request({
|
|
14
|
-
method: 'get',
|
|
15
|
-
url: `custom-entity/object/${schemaName}`,
|
|
16
|
-
params: queryParams
|
|
17
|
-
})
|
|
18
|
-
return response.data;
|
|
19
|
-
} catch (e: any) {
|
|
20
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
async function getCustomObjectById(schemaName: string, id: string) {
|
|
25
|
-
try {
|
|
26
|
-
const response = await axiosAPI.request({
|
|
27
|
-
method: 'get',
|
|
28
|
-
url: `custom-entity/object/${schemaName}/${id}`,
|
|
29
|
-
})
|
|
30
|
-
return response.data;
|
|
31
|
-
} catch (e: any) {
|
|
32
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async function updateCustomObject(schemaName: string, id: string, newData: any) {
|
|
37
|
-
try {
|
|
38
|
-
const response = await axiosAPI.request({
|
|
39
|
-
method: 'put',
|
|
40
|
-
url: `custom-entity/object/${schemaName}/${id}`,
|
|
41
|
-
headers: {
|
|
42
|
-
'Content-Type': 'application/json'
|
|
43
|
-
},
|
|
44
|
-
data: JSON.stringify(newData)
|
|
45
|
-
})
|
|
46
|
-
return response.data;
|
|
47
|
-
} catch (e: any) {
|
|
48
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
async function createCustomObject(schemaName: string, data: any) {
|
|
53
|
-
try {
|
|
54
|
-
const response = await axiosAPI.request({
|
|
55
|
-
method: 'post',
|
|
56
|
-
url: `custom-entity/object/${schemaName}`,
|
|
57
|
-
data: data
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
return response.data;
|
|
61
|
-
} catch (e: any) {
|
|
62
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
async function deleteCustomObject(schemaName: string, id: string) {
|
|
67
|
-
try {
|
|
68
|
-
const response = await axiosAPI.request({
|
|
69
|
-
method: 'delete',
|
|
70
|
-
maxBodyLength: Infinity,
|
|
71
|
-
url: `custom-entity/object/${schemaName}/${id}`,
|
|
72
|
-
})
|
|
73
|
-
return response.data;
|
|
74
|
-
} catch (e: any) {
|
|
75
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
// CRUD Base Objects
|
|
81
|
-
async function getAllObjects(entity: any, queryParams: any = {}) {
|
|
82
|
-
try {
|
|
83
|
-
const response = await axiosAPI.get(`${entity}`, {
|
|
84
|
-
params: queryParams
|
|
85
|
-
})
|
|
86
|
-
return response.data;
|
|
87
|
-
} catch (e: any) {
|
|
88
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
async function getObjectById(entity: any, id: string) {
|
|
93
|
-
try {
|
|
94
|
-
const response = await axiosAPI.get(`${entity}/${id}`)
|
|
95
|
-
return response.data;
|
|
96
|
-
} catch (e: any) {
|
|
97
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
async function updateObject(entity: any, id: string, newData: any) {
|
|
102
|
-
try {
|
|
103
|
-
const response = await axiosAPI.put(`${entity}/${id}`, newData)
|
|
104
|
-
return response.data;
|
|
105
|
-
} catch (e: any) {
|
|
106
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
async function createObject(entity: any, data: any) {
|
|
111
|
-
try {
|
|
112
|
-
const response = await axiosAPI.post(`${entity}`, data)
|
|
113
|
-
|
|
114
|
-
return response.data;
|
|
115
|
-
} catch (e: any) {
|
|
116
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async function deleteObject(entity: any, id: string) {
|
|
121
|
-
try {
|
|
122
|
-
const response = await axiosAPI.delete(`${entity}/${id}`)
|
|
123
|
-
|
|
124
|
-
return response.data;
|
|
125
|
-
} catch (e: any) {
|
|
126
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
export async function runScript(scriptNameOrId: string, input: any, sync= false) {
|
|
132
|
-
try {
|
|
133
|
-
if (sync) {
|
|
134
|
-
const response = await axiosAPI.post(`/automation/script/${scriptNameOrId}/run?mode=sync`, {input})
|
|
135
|
-
return response.data;
|
|
136
|
-
}
|
|
137
|
-
const response = await axiosAPI.post(`/automation/script/${scriptNameOrId}/run`, {input})
|
|
138
|
-
|
|
139
|
-
return response.data;
|
|
140
|
-
} catch (e: any) {
|
|
141
|
-
throw new KonversiError(e.message + ` ${e.response?.status} ${JSON.stringify(e.response?.data)}`, e);
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const konversiAPI = {
|
|
146
|
-
setToken: setAuthToken,
|
|
147
|
-
setCompanyId,
|
|
148
|
-
setBaseUrl,
|
|
149
|
-
|
|
150
|
-
getAllCustomObjects,
|
|
151
|
-
getCustomObjectById,
|
|
152
|
-
updateCustomObject,
|
|
153
|
-
deleteCustomObject,
|
|
154
|
-
createCustomObject,
|
|
155
|
-
|
|
156
|
-
getAllObjects,
|
|
157
|
-
getObjectById,
|
|
158
|
-
updateObject,
|
|
159
|
-
createObject,
|
|
160
|
-
deleteObject,
|
|
161
|
-
|
|
162
|
-
runScript,
|
|
163
|
-
|
|
164
|
-
call,
|
|
165
|
-
|
|
166
|
-
baseUrl: axiosAPI.defaults.baseURL,
|
|
167
|
-
token: axiosAPI.defaults.headers.common['Authorization']?.toString().split(' ')[1] || '',
|
|
168
|
-
companyId: axiosAPI.defaults.headers.common['Company'],
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
export default konversiAPI;
|
|
172
|
-
|
|
173
|
-
export const Entity = crudEndpoints;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import K from '../index';
|
|
2
|
-
|
|
3
|
-
async function main() {
|
|
4
|
-
console.log('Starting test...')
|
|
5
|
-
let createdObject = await K.createCustomObject('ticket', {numEntries: 100, amount: 500000, code: "TICKET-123456"})
|
|
6
|
-
console.log(`created object`, createdObject);
|
|
7
|
-
|
|
8
|
-
let allObjects = await K.getAllCustomObjects('ticket');
|
|
9
|
-
|
|
10
|
-
console.log(`all objects`, allObjects);
|
|
11
|
-
|
|
12
|
-
let updateResult = await K.updateCustomObject('ticket', createdObject.id, {numEntries: 200});
|
|
13
|
-
console.log(`updated object`, updateResult);
|
|
14
|
-
|
|
15
|
-
// let deleteResult = await K.deleteCustomObject('ticket', createdObject.id);
|
|
16
|
-
// console.log(`deleted object`, deleteResult);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
main();
|
package/test/getCustomer.ts
DELETED
package/tsconfig.json
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
4
|
-
|
|
5
|
-
/* Projects */
|
|
6
|
-
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
7
|
-
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
8
|
-
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
9
|
-
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
10
|
-
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
11
|
-
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
12
|
-
|
|
13
|
-
/* Language and Environment */
|
|
14
|
-
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
|
15
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
16
|
-
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
17
|
-
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
18
|
-
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
19
|
-
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
20
|
-
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
21
|
-
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
22
|
-
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
23
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
24
|
-
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
25
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
26
|
-
|
|
27
|
-
/* Modules */
|
|
28
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
|
29
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
|
30
|
-
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
31
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
32
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
33
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
34
|
-
// "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
|
|
35
|
-
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
36
|
-
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
37
|
-
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
38
|
-
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
39
|
-
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
40
|
-
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
41
|
-
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
42
|
-
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
43
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
44
|
-
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
45
|
-
|
|
46
|
-
/* JavaScript Support */
|
|
47
|
-
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
48
|
-
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
49
|
-
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
50
|
-
|
|
51
|
-
/* Emit */
|
|
52
|
-
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
53
|
-
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
54
|
-
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
55
|
-
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
56
|
-
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
57
|
-
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
58
|
-
// "outDir": "./", /* Specify an output folder for all emitted files. */
|
|
59
|
-
// "removeComments": true, /* Disable emitting comments. */
|
|
60
|
-
"noEmit": true, /* Disable emitting files from a compilation. */
|
|
61
|
-
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
62
|
-
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */
|
|
63
|
-
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
64
|
-
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
65
|
-
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
66
|
-
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
67
|
-
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
68
|
-
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
69
|
-
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
70
|
-
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
71
|
-
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
72
|
-
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
73
|
-
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
74
|
-
// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
|
|
75
|
-
|
|
76
|
-
/* Interop Constraints */
|
|
77
|
-
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
78
|
-
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
79
|
-
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
80
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
|
81
|
-
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
82
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
|
83
|
-
|
|
84
|
-
/* Type Checking */
|
|
85
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
86
|
-
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
87
|
-
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
88
|
-
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
89
|
-
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
90
|
-
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
91
|
-
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
92
|
-
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
93
|
-
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
94
|
-
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
95
|
-
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
96
|
-
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
97
|
-
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
98
|
-
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
99
|
-
"noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
100
|
-
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
101
|
-
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
102
|
-
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
103
|
-
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
104
|
-
|
|
105
|
-
/* Completeness */
|
|
106
|
-
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
107
|
-
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
108
|
-
}
|
|
109
|
-
}
|