@konversi/konversi-client 1.0.11 → 1.0.13
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/axiosAPI.js +10 -10
- package/dist/crudEndpoints.d.ts +16 -2
- package/dist/crudEndpoints.js +24 -5
- package/dist/index.js +86 -23
- package/dist/test/getCustomer.d.ts +1 -0
- package/dist/test/getCustomer.js +8 -0
- package/package.json +1 -1
package/dist/axiosAPI.js
CHANGED
|
@@ -4,22 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.clearAuthToken = exports.setCompanyId = exports.setAuthToken = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
baseURL,
|
|
12
|
-
timeout
|
|
7
|
+
var axios_1 = __importDefault(require("axios"));
|
|
8
|
+
var baseURL = 'https://us.api.konversi.net/api';
|
|
9
|
+
var timeout = 30000;
|
|
10
|
+
var instance = axios_1.default.create({
|
|
11
|
+
baseURL: baseURL,
|
|
12
|
+
timeout: timeout
|
|
13
13
|
});
|
|
14
|
-
|
|
15
|
-
instance.defaults.headers.common.authorization =
|
|
14
|
+
var setAuthToken = function (token) {
|
|
15
|
+
instance.defaults.headers.common.authorization = "Bearer ".concat(token);
|
|
16
16
|
};
|
|
17
17
|
exports.setAuthToken = setAuthToken;
|
|
18
|
-
|
|
18
|
+
var setCompanyId = function (companyId) {
|
|
19
19
|
instance.defaults.headers.common['Company'] = companyId;
|
|
20
20
|
};
|
|
21
21
|
exports.setCompanyId = setCompanyId;
|
|
22
|
-
|
|
22
|
+
var clearAuthToken = function () {
|
|
23
23
|
instance.defaults.headers.common.authorization = '';
|
|
24
24
|
};
|
|
25
25
|
exports.clearAuthToken = clearAuthToken;
|
package/dist/crudEndpoints.d.ts
CHANGED
|
@@ -23,6 +23,8 @@ export declare const INTERNAL_DELIVERY = "delivery/internal-delivery";
|
|
|
23
23
|
export declare const INTERNAL_DELIVERY_LINE = "delivery/internal-delivery-line";
|
|
24
24
|
export declare const INVOICE = "invoice";
|
|
25
25
|
export declare const INVOICE_LINE = "invoice/invoice-line";
|
|
26
|
+
export declare const EXPENSE = "expense";
|
|
27
|
+
export declare const EXPENSE_LINE = "expense/expense-line";
|
|
26
28
|
export declare const PAYMENT = "accounting/payment";
|
|
27
29
|
export declare const INCOMING_PAYMENT_METHOD = "accounting/incoming-payment-method";
|
|
28
30
|
export declare const FIXED_ASSET = "fixed-asset";
|
|
@@ -34,15 +36,27 @@ export declare const JOURNAL_ENTRY = "accounting/journal-entry";
|
|
|
34
36
|
export declare const JOURNAL_ENTRY_LINE = "accounting/journal-entry-line";
|
|
35
37
|
export declare const BILL_OF_MATERIALS = "manufacturing/bill-of-materials";
|
|
36
38
|
export declare const BOM_COMPONENT = "manufacturing/bom-component";
|
|
39
|
+
export declare const BOM_OPERATION = "manufacturing/bom-operation";
|
|
37
40
|
export declare const PRODUCTION_ORDER = "manufacturing/production-order";
|
|
38
41
|
export declare const PRODUCTION_ORDER_LINE = "manufacturing/production-order-line";
|
|
39
42
|
export declare const SUBSIDIARY = "subsidiary";
|
|
40
43
|
export declare const EMPLOYEE = "human-resources/employee";
|
|
41
44
|
export declare const ATTENDANCE = "human-resources/attendance";
|
|
42
|
-
export declare const
|
|
43
|
-
export declare const
|
|
45
|
+
export declare const VEHICLE = "fleet/vehicle";
|
|
46
|
+
export declare const DELIVERY_JOB = "fleet/delivery-job";
|
|
47
|
+
export declare const CUSTOM_ENTITY_SCHEMA = "custom-entity/schema";
|
|
48
|
+
export declare const CUSTOM_ENTITY_OBJECT = "custom-entity";
|
|
49
|
+
export declare const CUSTOM_ENTITY_FIELD = "custom-entity/field";
|
|
50
|
+
export declare const AUTOMATION_JOB = "automation/job";
|
|
51
|
+
export declare const AUTOMATION_SCRIPT = "automation/script";
|
|
44
52
|
export declare const STOCK_ADJUSTMENT = "stock-adjustment";
|
|
45
53
|
export declare const PURCHASE_ORDER_APPROVER = "approval/approver/purchase-order";
|
|
46
54
|
export declare const SALES_ORDER_APPROVER = "approval/approver/sales-order";
|
|
55
|
+
export declare const CUSTOM_DOCUMENT = "document-generator/custom-document";
|
|
47
56
|
export declare const CUSTOM_FIELD = "custom-field";
|
|
48
57
|
export declare const AUDIT_LOG = "audit-log";
|
|
58
|
+
export declare const COMPANY_ALIAS = "company-alias";
|
|
59
|
+
export declare const PRINT_JOB = "thermal-printer/print-job";
|
|
60
|
+
export declare const WORK_ORDER = "order/sales-order?type=WORK_ORDER";
|
|
61
|
+
export declare const INCOMING_SHIPMENT = "shipment/incoming-shipment";
|
|
62
|
+
export declare const OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
|
package/dist/crudEndpoints.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AUTOMATION_JOB = exports.CUSTOM_ENTITY_FIELD = exports.CUSTOM_ENTITY_OBJECT = exports.CUSTOM_ENTITY_SCHEMA = exports.DELIVERY_JOB = exports.VEHICLE = exports.ATTENDANCE = exports.EMPLOYEE = exports.SUBSIDIARY = exports.PRODUCTION_ORDER_LINE = exports.PRODUCTION_ORDER = exports.BOM_OPERATION = exports.BOM_COMPONENT = exports.BILL_OF_MATERIALS = exports.JOURNAL_ENTRY_LINE = exports.JOURNAL_ENTRY = exports.ACCOUNT = exports.STORE_PRODUCT_GROUP = exports.STORE_PRODUCT = exports.STORE = exports.FIXED_ASSET = exports.INCOMING_PAYMENT_METHOD = exports.PAYMENT = exports.EXPENSE_LINE = exports.EXPENSE = exports.INVOICE_LINE = exports.INVOICE = exports.INTERNAL_DELIVERY_LINE = exports.INTERNAL_DELIVERY = exports.OUTGOING_DELIVERY_LINE = exports.OUTGOING_DELIVERY = exports.INCOMING_DELIVERY_LINE = exports.INCOMING_DELIVERY = exports.WAREHOUSE = exports.SUPPLIER = exports.RENTAL_ORDER_LINE = exports.RENTAL_ORDER = exports.SALES_ORDER_LINE = exports.SALES_ORDER = exports.QUOTE_LINE = exports.QUOTE = exports.PURCHASE_ORDER_LINE = exports.PURCHASE_ORDER = exports.PRODUCT_GROUP = exports.PRODUCT_ITEM = exports.PRODUCT = exports.CUSTOMER = exports.INVITATION = exports.COMPANY_OPTION = exports.COMPANY_PERMISSION = void 0;
|
|
4
|
+
exports.OUTGOING_SHIPMENT = exports.INCOMING_SHIPMENT = exports.WORK_ORDER = exports.PRINT_JOB = exports.COMPANY_ALIAS = exports.AUDIT_LOG = exports.CUSTOM_FIELD = exports.CUSTOM_DOCUMENT = exports.SALES_ORDER_APPROVER = exports.PURCHASE_ORDER_APPROVER = exports.STOCK_ADJUSTMENT = exports.AUTOMATION_SCRIPT = void 0;
|
|
4
5
|
exports.COMPANY_PERMISSION = 'company-permission';
|
|
5
6
|
exports.COMPANY_OPTION = 'company-option';
|
|
6
7
|
exports.INVITATION = 'user/invitation';
|
|
@@ -28,6 +29,8 @@ exports.INTERNAL_DELIVERY_LINE = 'delivery/internal-delivery-line';
|
|
|
28
29
|
// Finance
|
|
29
30
|
exports.INVOICE = 'invoice';
|
|
30
31
|
exports.INVOICE_LINE = 'invoice/invoice-line';
|
|
32
|
+
exports.EXPENSE = 'expense';
|
|
33
|
+
exports.EXPENSE_LINE = 'expense/expense-line';
|
|
31
34
|
exports.PAYMENT = 'accounting/payment';
|
|
32
35
|
exports.INCOMING_PAYMENT_METHOD = 'accounting/incoming-payment-method';
|
|
33
36
|
exports.FIXED_ASSET = 'fixed-asset';
|
|
@@ -42,18 +45,34 @@ exports.JOURNAL_ENTRY_LINE = 'accounting/journal-entry-line';
|
|
|
42
45
|
// Manufacturing
|
|
43
46
|
exports.BILL_OF_MATERIALS = 'manufacturing/bill-of-materials';
|
|
44
47
|
exports.BOM_COMPONENT = 'manufacturing/bom-component';
|
|
48
|
+
exports.BOM_OPERATION = 'manufacturing/bom-operation';
|
|
45
49
|
exports.PRODUCTION_ORDER = 'manufacturing/production-order';
|
|
46
50
|
exports.PRODUCTION_ORDER_LINE = 'manufacturing/production-order-line';
|
|
47
51
|
exports.SUBSIDIARY = 'subsidiary';
|
|
48
52
|
// HR
|
|
49
53
|
exports.EMPLOYEE = 'human-resources/employee';
|
|
50
54
|
exports.ATTENDANCE = 'human-resources/attendance';
|
|
51
|
-
//
|
|
52
|
-
exports.
|
|
53
|
-
exports.
|
|
54
|
-
|
|
55
|
+
// Fleet Management
|
|
56
|
+
exports.VEHICLE = 'fleet/vehicle';
|
|
57
|
+
exports.DELIVERY_JOB = 'fleet/delivery-job';
|
|
58
|
+
// Custom Objects
|
|
59
|
+
exports.CUSTOM_ENTITY_SCHEMA = 'custom-entity/schema';
|
|
60
|
+
exports.CUSTOM_ENTITY_OBJECT = 'custom-entity'; // Need to add schemaName after this
|
|
61
|
+
exports.CUSTOM_ENTITY_FIELD = 'custom-entity/field'; // Need to add schemaName after this
|
|
62
|
+
// Automation
|
|
63
|
+
exports.AUTOMATION_JOB = 'automation/job';
|
|
64
|
+
exports.AUTOMATION_SCRIPT = 'automation/script';
|
|
55
65
|
exports.STOCK_ADJUSTMENT = 'stock-adjustment';
|
|
56
66
|
exports.PURCHASE_ORDER_APPROVER = 'approval/approver/purchase-order';
|
|
57
67
|
exports.SALES_ORDER_APPROVER = 'approval/approver/sales-order';
|
|
68
|
+
// Document Generation
|
|
69
|
+
exports.CUSTOM_DOCUMENT = 'document-generator/custom-document';
|
|
58
70
|
exports.CUSTOM_FIELD = 'custom-field';
|
|
59
71
|
exports.AUDIT_LOG = 'audit-log';
|
|
72
|
+
exports.COMPANY_ALIAS = 'company-alias';
|
|
73
|
+
exports.PRINT_JOB = 'thermal-printer/print-job';
|
|
74
|
+
exports.WORK_ORDER = 'order/sales-order?type=WORK_ORDER';
|
|
75
|
+
// TODO: Deprecate
|
|
76
|
+
exports.INCOMING_SHIPMENT = 'shipment/incoming-shipment';
|
|
77
|
+
exports.OUTGOING_SHIPMENT = 'shipment/outgoing-shipment';
|
|
78
|
+
///
|
package/dist/index.js
CHANGED
|
@@ -31,47 +31,110 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
31
31
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
32
|
});
|
|
33
33
|
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
34
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
-
|
|
62
|
+
var axiosAPI_1 = __importStar(require("./axiosAPI"));
|
|
36
63
|
function getAllObjects(entity_1) {
|
|
37
|
-
return __awaiter(this, arguments, void 0, function
|
|
38
|
-
|
|
39
|
-
|
|
64
|
+
return __awaiter(this, arguments, void 0, function (entity, queryParams) {
|
|
65
|
+
var response;
|
|
66
|
+
if (queryParams === void 0) { queryParams = {}; }
|
|
67
|
+
return __generator(this, function (_a) {
|
|
68
|
+
switch (_a.label) {
|
|
69
|
+
case 0: return [4 /*yield*/, axiosAPI_1.default.get("".concat(entity), {
|
|
70
|
+
params: queryParams
|
|
71
|
+
})];
|
|
72
|
+
case 1:
|
|
73
|
+
response = _a.sent();
|
|
74
|
+
return [2 /*return*/, response.data];
|
|
75
|
+
}
|
|
40
76
|
});
|
|
41
|
-
return response.data;
|
|
42
77
|
});
|
|
43
78
|
}
|
|
44
79
|
function getObjectById(entity, id) {
|
|
45
|
-
return __awaiter(this, void 0, void 0, function
|
|
46
|
-
|
|
47
|
-
return
|
|
80
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
81
|
+
var response;
|
|
82
|
+
return __generator(this, function (_a) {
|
|
83
|
+
switch (_a.label) {
|
|
84
|
+
case 0: return [4 /*yield*/, axiosAPI_1.default.get("".concat(entity, "/").concat(id))];
|
|
85
|
+
case 1:
|
|
86
|
+
response = _a.sent();
|
|
87
|
+
return [2 /*return*/, response.data];
|
|
88
|
+
}
|
|
89
|
+
});
|
|
48
90
|
});
|
|
49
91
|
}
|
|
50
92
|
function updateObject(entity, id, newData) {
|
|
51
|
-
return __awaiter(this, void 0, void 0, function
|
|
52
|
-
|
|
53
|
-
return
|
|
93
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
94
|
+
var response;
|
|
95
|
+
return __generator(this, function (_a) {
|
|
96
|
+
switch (_a.label) {
|
|
97
|
+
case 0: return [4 /*yield*/, axiosAPI_1.default.put("".concat(entity, "/").concat(id), newData)];
|
|
98
|
+
case 1:
|
|
99
|
+
response = _a.sent();
|
|
100
|
+
return [2 /*return*/, response.data];
|
|
101
|
+
}
|
|
102
|
+
});
|
|
54
103
|
});
|
|
55
104
|
}
|
|
56
105
|
function createObject(entity, data) {
|
|
57
|
-
return __awaiter(this, void 0, void 0, function
|
|
58
|
-
|
|
59
|
-
return
|
|
106
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
107
|
+
var response;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
switch (_a.label) {
|
|
110
|
+
case 0: return [4 /*yield*/, axiosAPI_1.default.post("".concat(entity), data)];
|
|
111
|
+
case 1:
|
|
112
|
+
response = _a.sent();
|
|
113
|
+
return [2 /*return*/, response.data];
|
|
114
|
+
}
|
|
115
|
+
});
|
|
60
116
|
});
|
|
61
117
|
}
|
|
62
118
|
function deleteObject(entity, id) {
|
|
63
|
-
return __awaiter(this, void 0, void 0, function
|
|
64
|
-
|
|
65
|
-
return
|
|
119
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
120
|
+
var response;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0: return [4 /*yield*/, axiosAPI_1.default.delete("".concat(entity, "/").concat(id))];
|
|
124
|
+
case 1:
|
|
125
|
+
response = _a.sent();
|
|
126
|
+
return [2 /*return*/, response.data];
|
|
127
|
+
}
|
|
128
|
+
});
|
|
66
129
|
});
|
|
67
130
|
}
|
|
68
|
-
|
|
131
|
+
var konversiAPI = {
|
|
69
132
|
setToken: axiosAPI_1.setAuthToken,
|
|
70
133
|
setCompanyId: axiosAPI_1.setCompanyId,
|
|
71
|
-
getAllObjects,
|
|
72
|
-
getObjectById,
|
|
73
|
-
updateObject,
|
|
74
|
-
createObject,
|
|
75
|
-
deleteObject
|
|
134
|
+
getAllObjects: getAllObjects,
|
|
135
|
+
getObjectById: getObjectById,
|
|
136
|
+
updateObject: updateObject,
|
|
137
|
+
createObject: createObject,
|
|
138
|
+
deleteObject: deleteObject
|
|
76
139
|
};
|
|
77
140
|
exports.default = konversiAPI;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var crudEndpoints_1 = require("../crudEndpoints");
|
|
7
|
+
var index_1 = __importDefault(require("../index"));
|
|
8
|
+
index_1.default.createObject(crudEndpoints_1.CUSTOMER, {});
|