@konversi/konversi-client 1.0.6 → 1.0.8

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/axiosAPI.ts CHANGED
@@ -1,23 +1,23 @@
1
- import axios from 'axios';
2
-
3
- const baseURL = 'https://us.api.konversi.net/api'
4
- const timeout = 30000
5
-
6
- const instance = axios.create({
7
- baseURL,
8
- timeout
9
- })
10
-
11
- export const setAuthToken = (token: string) => {
12
- instance.defaults.headers.common.authorization = `Bearer ${token}`
13
- }
14
-
15
- export const setCompanyId = (companyId: string) => {
16
- instance.defaults.headers.common['Company'] = companyId;
17
- }
18
-
19
- export const clearAuthToken = () => {
20
- instance.defaults.headers.common.authorization = ''
21
- }
22
-
1
+ import axios from 'axios';
2
+
3
+ const baseURL = 'https://us.api.konversi.net/api'
4
+ const timeout = 30000
5
+
6
+ const instance = axios.create({
7
+ baseURL,
8
+ timeout
9
+ })
10
+
11
+ export const setAuthToken = (token: string) => {
12
+ instance.defaults.headers.common.authorization = `Bearer ${token}`
13
+ }
14
+
15
+ export const setCompanyId = (companyId: string) => {
16
+ instance.defaults.headers.common['Company'] = companyId;
17
+ }
18
+
19
+ export const clearAuthToken = () => {
20
+ instance.defaults.headers.common.authorization = ''
21
+ }
22
+
23
23
  export default instance;
package/crudEndpoints.ts CHANGED
@@ -1,71 +1,96 @@
1
- export const COMPANY_PERMISSION = 'company-permission';
2
- export const COMPANY_OPTION = 'company-option';
3
- export const INVITATION = 'user/invitation';
4
-
5
- export const CUSTOMER = 'contact/customer';
6
-
7
- export const PRODUCT = 'product'
8
- export const PRODUCT_ITEM = 'product/product-item'
9
- export const PRODUCT_GROUP = 'product-group'
10
-
11
- export const PURCHASE_ORDER = 'order/purchase-order'
12
- export const PURCHASE_ORDER_LINE = 'order/purchase-order-line'
13
- export const QUOTE = 'order/quote'
14
- export const QUOTE_LINE = 'order/quote-line'
15
- export const SALES_ORDER = 'order/sales-order'
16
- export const SALES_ORDER_LINE = 'order/sales-order-line'
17
- export const RENTAL_ORDER = 'order/rental-order'
18
- export const RENTAL_ORDER_LINE = 'order/rental-order-line'
19
- export const SUPPLIER = 'contact/supplier'
20
- export const WAREHOUSE = 'warehouse'
21
-
22
- // Deliveries
23
- export const INCOMING_DELIVERY = 'delivery/incoming-delivery'
24
- export const INCOMING_DELIVERY_LINE = 'delivery/incoming-delivery-line'
25
- export const OUTGOING_DELIVERY = 'delivery/outgoing-delivery'
26
- export const OUTGOING_DELIVERY_LINE = 'delivery/outgoing-delivery-line'
27
- export const INTERNAL_DELIVERY = 'delivery/internal-delivery'
28
- export const INTERNAL_DELIVERY_LINE = 'delivery/internal-delivery-line'
29
-
30
- // Finance
31
- export const INVOICE = 'invoice'
32
- export const INVOICE_LINE = 'invoice/invoice-line'
33
- export const PAYMENT = 'accounting/payment'
34
- export const INCOMING_PAYMENT_METHOD = 'accounting/incoming-payment-method'
35
- export const FIXED_ASSET = 'fixed-asset'
36
-
37
- // ECommerce
38
- export const STORE = 'store'
39
- export const STORE_PRODUCT = 'store/store-product'
40
- export const STORE_PRODUCT_GROUP = 'store/store-product-group'
41
-
42
- // Accounting
43
- export const ACCOUNT = 'accounting/account';
44
- export const JOURNAL_ENTRY = 'accounting/journal-entry';
45
- export const JOURNAL_ENTRY_LINE = 'accounting/journal-entry-line';
46
-
47
- // Manufacturing
48
- export const BILL_OF_MATERIALS = 'manufacturing/bill-of-materials'
49
- export const BOM_COMPONENT = 'manufacturing/bom-component'
50
- export const PRODUCTION_ORDER = 'manufacturing/production-order'
51
- export const PRODUCTION_ORDER_LINE = 'manufacturing/production-order-line'
52
-
53
- export const SUBSIDIARY = 'subsidiary'
54
-
55
- // HR
56
- export const EMPLOYEE = 'human-resources/employee'
57
- export const ATTENDANCE = 'human-resources/attendance'
58
-
59
- // TODO: Deprecate
60
- export const INCOMING_SHIPMENT = 'shipment/incoming-shipment'
61
- export const OUTGOING_SHIPMENT = 'shipment/outgoing-shipment'
62
- ///
63
-
64
- export const STOCK_ADJUSTMENT = 'stock-adjustment'
65
-
66
- export const PURCHASE_ORDER_APPROVER = 'approval/approver/purchase-order'
67
- export const SALES_ORDER_APPROVER = 'approval/approver/sales-order'
68
-
69
- export const CUSTOM_FIELD = 'custom-field'
70
-
71
- export const AUDIT_LOG = 'audit-log'
1
+ export const COMPANY_PERMISSION = 'company-permission';
2
+ export const COMPANY_OPTION = 'company-option';
3
+ export const INVITATION = 'user/invitation';
4
+
5
+ export const CUSTOMER = 'contact/customer';
6
+
7
+ export const PRODUCT = 'product'
8
+ export const PRODUCT_ITEM = 'product/product-item'
9
+ export const PRODUCT_GROUP = 'product-group'
10
+
11
+ export const PURCHASE_ORDER = 'order/purchase-order'
12
+ export const PURCHASE_ORDER_LINE = 'order/purchase-order-line'
13
+ export const QUOTE = 'order/quote'
14
+ export const QUOTE_LINE = 'order/quote-line'
15
+ export const SALES_ORDER = 'order/sales-order'
16
+ export const SALES_ORDER_LINE = 'order/sales-order-line'
17
+ export const RENTAL_ORDER = 'order/rental-order'
18
+ export const RENTAL_ORDER_LINE = 'order/rental-order-line'
19
+ export const SUPPLIER = 'contact/supplier'
20
+ export const WAREHOUSE = 'warehouse'
21
+
22
+ // Deliveries
23
+ export const INCOMING_DELIVERY = 'delivery/incoming-delivery'
24
+ export const INCOMING_DELIVERY_LINE = 'delivery/incoming-delivery-line'
25
+ export const OUTGOING_DELIVERY = 'delivery/outgoing-delivery'
26
+ export const OUTGOING_DELIVERY_LINE = 'delivery/outgoing-delivery-line'
27
+ export const INTERNAL_DELIVERY = 'delivery/internal-delivery'
28
+ export const INTERNAL_DELIVERY_LINE = 'delivery/internal-delivery-line'
29
+
30
+ // Finance
31
+ export const INVOICE = 'invoice'
32
+ export const INVOICE_LINE = 'invoice/invoice-line'
33
+ export const EXPENSE = 'expense'
34
+ export const EXPENSE_LINE = 'expense/expense-line'
35
+ export const PAYMENT = 'accounting/payment'
36
+ export const INCOMING_PAYMENT_METHOD = 'accounting/incoming-payment-method'
37
+ export const FIXED_ASSET = 'fixed-asset'
38
+
39
+ // ECommerce
40
+ export const STORE = 'store'
41
+ export const STORE_PRODUCT = 'store/store-product'
42
+ export const STORE_PRODUCT_GROUP = 'store/store-product-group'
43
+
44
+ // Accounting
45
+ export const ACCOUNT = 'accounting/account';
46
+ export const JOURNAL_ENTRY = 'accounting/journal-entry';
47
+ export const JOURNAL_ENTRY_LINE = 'accounting/journal-entry-line';
48
+
49
+ // Manufacturing
50
+ export const BILL_OF_MATERIALS = 'manufacturing/bill-of-materials'
51
+ export const BOM_COMPONENT = 'manufacturing/bom-component'
52
+ export const BOM_OPERATION = 'manufacturing/bom-operation'
53
+ export const PRODUCTION_ORDER = 'manufacturing/production-order'
54
+ export const PRODUCTION_ORDER_LINE = 'manufacturing/production-order-line'
55
+
56
+ export const SUBSIDIARY = 'subsidiary'
57
+
58
+ // HR
59
+ export const EMPLOYEE = 'human-resources/employee'
60
+ export const ATTENDANCE = 'human-resources/attendance'
61
+
62
+ // Fleet Management
63
+ export const VEHICLE = 'fleet/vehicle'
64
+ export const DELIVERY_JOB = 'fleet/delivery-job'
65
+
66
+ // Custom Objects
67
+ export const CUSTOM_ENTITY_SCHEMA = 'custom-entity/schema'
68
+ export const CUSTOM_ENTITY_OBJECT = 'custom-entity'; // Need to add schemaName after this
69
+ export const CUSTOM_ENTITY_FIELD = 'custom-entity/field'; // Need to add schemaName after this
70
+
71
+ // Automation
72
+ export const AUTOMATION_JOB = 'automation/job'
73
+ export const AUTOMATION_SCRIPT = 'automation/script'
74
+
75
+ export const STOCK_ADJUSTMENT = 'stock-adjustment'
76
+
77
+ export const PURCHASE_ORDER_APPROVER = 'approval/approver/purchase-order'
78
+ export const SALES_ORDER_APPROVER = 'approval/approver/sales-order'
79
+
80
+ // Document Generation
81
+ export const CUSTOM_DOCUMENT = 'document-generator/custom-document';
82
+
83
+ export const CUSTOM_FIELD = 'custom-field'
84
+
85
+ export const AUDIT_LOG = 'audit-log'
86
+
87
+ export const COMPANY_ALIAS = 'company-alias'
88
+
89
+ export const PRINT_JOB = 'thermal-printer/print-job'
90
+
91
+ export const WORK_ORDER = 'order/sales-order?type=WORK_ORDER';
92
+
93
+ // TODO: Deprecate
94
+ export const INCOMING_SHIPMENT = 'shipment/incoming-shipment'
95
+ export const OUTGOING_SHIPMENT = 'shipment/outgoing-shipment'
96
+ ///
package/index.ts CHANGED
@@ -1,42 +1,42 @@
1
- import axiosAPI, { setAuthToken, setCompanyId } from "./axiosAPI";
2
-
3
- async function getAllObjects(entity: any, queryParams: any = {}) {
4
- const response = await axiosAPI.get(`${entity}`, {
5
- params: queryParams
6
- })
7
- return response.data;
8
- }
9
-
10
- async function getObjectById(entity: any, id: string) {
11
- const response = await axiosAPI.get(`${entity}/${id}`)
12
- return response.data;
13
- }
14
-
15
- async function updateObject(entity: any, id: string, newData: any) {
16
- const response = await axiosAPI.put(`${entity}/${id}`, newData)
17
- return response.data;
18
- }
19
-
20
- async function createObject(entity: any, data: any) {
21
- const response = await axiosAPI.post(`${entity}`, data)
22
-
23
- return response.data;
24
- }
25
-
26
- async function deleteObject(entity: any, id: string) {
27
- const response = await axiosAPI.delete(`${entity}/${id}`)
28
-
29
- return response.data;
30
- }
31
-
32
- const konversiAPI = {
33
- setToken: setAuthToken,
34
- setCompanyId,
35
- getAllObjects,
36
- getObjectById,
37
- updateObject,
38
- createObject,
39
- deleteObject
40
- }
41
-
1
+ import axiosAPI, { setAuthToken, setCompanyId } from "./axiosAPI";
2
+
3
+ async function getAllObjects(entity: any, queryParams: any = {}) {
4
+ const response = await axiosAPI.get(`${entity}`, {
5
+ params: queryParams
6
+ })
7
+ return response.data;
8
+ }
9
+
10
+ async function getObjectById(entity: any, id: string) {
11
+ const response = await axiosAPI.get(`${entity}/${id}`)
12
+ return response.data;
13
+ }
14
+
15
+ async function updateObject(entity: any, id: string, newData: any) {
16
+ const response = await axiosAPI.put(`${entity}/${id}`, newData)
17
+ return response.data;
18
+ }
19
+
20
+ async function createObject(entity: any, data: any) {
21
+ const response = await axiosAPI.post(`${entity}`, data)
22
+
23
+ return response.data;
24
+ }
25
+
26
+ async function deleteObject(entity: any, id: string) {
27
+ const response = await axiosAPI.delete(`${entity}/${id}`)
28
+
29
+ return response.data;
30
+ }
31
+
32
+ const konversiAPI = {
33
+ setToken: setAuthToken,
34
+ setCompanyId,
35
+ getAllObjects,
36
+ getObjectById,
37
+ updateObject,
38
+ createObject,
39
+ deleteObject
40
+ }
41
+
42
42
  export default konversiAPI;
package/package.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "name": "@konversi/konversi-client",
3
- "version": "1.0.6",
4
- "main": "dist/index.js",
5
- "types": "dist/index.d.ts",
6
- "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
8
- "build": "tsc",
9
- "prepublish": "tsc"
10
- },
11
- "keywords": [],
12
- "author": "",
13
- "license": "ISC",
14
- "dependencies": {
15
- "axios": "^1.6.8",
16
- "typescript": "^5.4.5"
17
- },
18
- "description": ""
19
- }
1
+ {
2
+ "name": "@konversi/konversi-client",
3
+ "version": "1.0.8",
4
+ "main": "dist/index.js",
5
+ "types": "dist/index.d.ts",
6
+ "scripts": {
7
+ "test": "echo \"Error: no test specified\" && exit 1",
8
+ "build": "tsc",
9
+ "prepublish": "tsc"
10
+ },
11
+ "keywords": [],
12
+ "author": "",
13
+ "license": "ISC",
14
+ "dependencies": {
15
+ "axios": "^1.6.8",
16
+ "typescript": "^5.4.5"
17
+ },
18
+ "description": ""
19
+ }
package/tsconfig.json CHANGED
@@ -1,109 +1,15 @@
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": "./dist", /* 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
- }
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es5",
4
+ "module": "commonjs",
5
+ "lib": ["es2017", "es7", "es6", "dom"],
6
+ "declaration": true,
7
+ "outDir": "dist",
8
+ "strict": true,
9
+ "esModuleInterop": true
10
+ },
11
+ "exclude": [
12
+ "node_modules",
13
+ "dist"
14
+ ]
15
+ }
@@ -1,5 +0,0 @@
1
- declare const instance: import("axios").AxiosInstance;
2
- export declare const setAuthToken: (token: string) => void;
3
- export declare const setCompanyId: (companyId: string) => void;
4
- export declare const clearAuthToken: () => void;
5
- export default instance;
package/dist/axiosAPI.js DELETED
@@ -1,26 +0,0 @@
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
- exports.clearAuthToken = exports.setCompanyId = exports.setAuthToken = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
- const baseURL = 'https://us.api.konversi.net/api';
9
- const timeout = 30000;
10
- const instance = axios_1.default.create({
11
- baseURL,
12
- timeout
13
- });
14
- const setAuthToken = (token) => {
15
- instance.defaults.headers.common.authorization = `Bearer ${token}`;
16
- };
17
- exports.setAuthToken = setAuthToken;
18
- const setCompanyId = (companyId) => {
19
- instance.defaults.headers.common['Company'] = companyId;
20
- };
21
- exports.setCompanyId = setCompanyId;
22
- const clearAuthToken = () => {
23
- instance.defaults.headers.common.authorization = '';
24
- };
25
- exports.clearAuthToken = clearAuthToken;
26
- exports.default = instance;
@@ -1,48 +0,0 @@
1
- export declare const COMPANY_PERMISSION = "company-permission";
2
- export declare const COMPANY_OPTION = "company-option";
3
- export declare const INVITATION = "user/invitation";
4
- export declare const CUSTOMER = "contact/customer";
5
- export declare const PRODUCT = "product";
6
- export declare const PRODUCT_ITEM = "product/product-item";
7
- export declare const PRODUCT_GROUP = "product-group";
8
- export declare const PURCHASE_ORDER = "order/purchase-order";
9
- export declare const PURCHASE_ORDER_LINE = "order/purchase-order-line";
10
- export declare const QUOTE = "order/quote";
11
- export declare const QUOTE_LINE = "order/quote-line";
12
- export declare const SALES_ORDER = "order/sales-order";
13
- export declare const SALES_ORDER_LINE = "order/sales-order-line";
14
- export declare const RENTAL_ORDER = "order/rental-order";
15
- export declare const RENTAL_ORDER_LINE = "order/rental-order-line";
16
- export declare const SUPPLIER = "contact/supplier";
17
- export declare const WAREHOUSE = "warehouse";
18
- export declare const INCOMING_DELIVERY = "delivery/incoming-delivery";
19
- export declare const INCOMING_DELIVERY_LINE = "delivery/incoming-delivery-line";
20
- export declare const OUTGOING_DELIVERY = "delivery/outgoing-delivery";
21
- export declare const OUTGOING_DELIVERY_LINE = "delivery/outgoing-delivery-line";
22
- export declare const INTERNAL_DELIVERY = "delivery/internal-delivery";
23
- export declare const INTERNAL_DELIVERY_LINE = "delivery/internal-delivery-line";
24
- export declare const INVOICE = "invoice";
25
- export declare const INVOICE_LINE = "invoice/invoice-line";
26
- export declare const PAYMENT = "accounting/payment";
27
- export declare const INCOMING_PAYMENT_METHOD = "accounting/incoming-payment-method";
28
- export declare const FIXED_ASSET = "fixed-asset";
29
- export declare const STORE = "store";
30
- export declare const STORE_PRODUCT = "store/store-product";
31
- export declare const STORE_PRODUCT_GROUP = "store/store-product-group";
32
- export declare const ACCOUNT = "accounting/account";
33
- export declare const JOURNAL_ENTRY = "accounting/journal-entry";
34
- export declare const JOURNAL_ENTRY_LINE = "accounting/journal-entry-line";
35
- export declare const BILL_OF_MATERIALS = "manufacturing/bill-of-materials";
36
- export declare const BOM_COMPONENT = "manufacturing/bom-component";
37
- export declare const PRODUCTION_ORDER = "manufacturing/production-order";
38
- export declare const PRODUCTION_ORDER_LINE = "manufacturing/production-order-line";
39
- export declare const SUBSIDIARY = "subsidiary";
40
- export declare const EMPLOYEE = "human-resources/employee";
41
- export declare const ATTENDANCE = "human-resources/attendance";
42
- export declare const INCOMING_SHIPMENT = "shipment/incoming-shipment";
43
- export declare const OUTGOING_SHIPMENT = "shipment/outgoing-shipment";
44
- export declare const STOCK_ADJUSTMENT = "stock-adjustment";
45
- export declare const PURCHASE_ORDER_APPROVER = "approval/approver/purchase-order";
46
- export declare const SALES_ORDER_APPROVER = "approval/approver/sales-order";
47
- export declare const CUSTOM_FIELD = "custom-field";
48
- export declare const AUDIT_LOG = "audit-log";
@@ -1,59 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AUDIT_LOG = exports.CUSTOM_FIELD = exports.SALES_ORDER_APPROVER = exports.PURCHASE_ORDER_APPROVER = exports.STOCK_ADJUSTMENT = exports.OUTGOING_SHIPMENT = exports.INCOMING_SHIPMENT = exports.ATTENDANCE = exports.EMPLOYEE = exports.SUBSIDIARY = exports.PRODUCTION_ORDER_LINE = exports.PRODUCTION_ORDER = 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.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.COMPANY_PERMISSION = 'company-permission';
5
- exports.COMPANY_OPTION = 'company-option';
6
- exports.INVITATION = 'user/invitation';
7
- exports.CUSTOMER = 'contact/customer';
8
- exports.PRODUCT = 'product';
9
- exports.PRODUCT_ITEM = 'product/product-item';
10
- exports.PRODUCT_GROUP = 'product-group';
11
- exports.PURCHASE_ORDER = 'order/purchase-order';
12
- exports.PURCHASE_ORDER_LINE = 'order/purchase-order-line';
13
- exports.QUOTE = 'order/quote';
14
- exports.QUOTE_LINE = 'order/quote-line';
15
- exports.SALES_ORDER = 'order/sales-order';
16
- exports.SALES_ORDER_LINE = 'order/sales-order-line';
17
- exports.RENTAL_ORDER = 'order/rental-order';
18
- exports.RENTAL_ORDER_LINE = 'order/rental-order-line';
19
- exports.SUPPLIER = 'contact/supplier';
20
- exports.WAREHOUSE = 'warehouse';
21
- // Deliveries
22
- exports.INCOMING_DELIVERY = 'delivery/incoming-delivery';
23
- exports.INCOMING_DELIVERY_LINE = 'delivery/incoming-delivery-line';
24
- exports.OUTGOING_DELIVERY = 'delivery/outgoing-delivery';
25
- exports.OUTGOING_DELIVERY_LINE = 'delivery/outgoing-delivery-line';
26
- exports.INTERNAL_DELIVERY = 'delivery/internal-delivery';
27
- exports.INTERNAL_DELIVERY_LINE = 'delivery/internal-delivery-line';
28
- // Finance
29
- exports.INVOICE = 'invoice';
30
- exports.INVOICE_LINE = 'invoice/invoice-line';
31
- exports.PAYMENT = 'accounting/payment';
32
- exports.INCOMING_PAYMENT_METHOD = 'accounting/incoming-payment-method';
33
- exports.FIXED_ASSET = 'fixed-asset';
34
- // ECommerce
35
- exports.STORE = 'store';
36
- exports.STORE_PRODUCT = 'store/store-product';
37
- exports.STORE_PRODUCT_GROUP = 'store/store-product-group';
38
- // Accounting
39
- exports.ACCOUNT = 'accounting/account';
40
- exports.JOURNAL_ENTRY = 'accounting/journal-entry';
41
- exports.JOURNAL_ENTRY_LINE = 'accounting/journal-entry-line';
42
- // Manufacturing
43
- exports.BILL_OF_MATERIALS = 'manufacturing/bill-of-materials';
44
- exports.BOM_COMPONENT = 'manufacturing/bom-component';
45
- exports.PRODUCTION_ORDER = 'manufacturing/production-order';
46
- exports.PRODUCTION_ORDER_LINE = 'manufacturing/production-order-line';
47
- exports.SUBSIDIARY = 'subsidiary';
48
- // HR
49
- exports.EMPLOYEE = 'human-resources/employee';
50
- exports.ATTENDANCE = 'human-resources/attendance';
51
- // TODO: Deprecate
52
- exports.INCOMING_SHIPMENT = 'shipment/incoming-shipment';
53
- exports.OUTGOING_SHIPMENT = 'shipment/outgoing-shipment';
54
- ///
55
- exports.STOCK_ADJUSTMENT = 'stock-adjustment';
56
- exports.PURCHASE_ORDER_APPROVER = 'approval/approver/purchase-order';
57
- exports.SALES_ORDER_APPROVER = 'approval/approver/sales-order';
58
- exports.CUSTOM_FIELD = 'custom-field';
59
- exports.AUDIT_LOG = 'audit-log';
package/dist/index.d.ts DELETED
@@ -1,15 +0,0 @@
1
- declare function getAllObjects(entity: any, queryParams?: any): Promise<any>;
2
- declare function getObjectById(entity: any, id: string): Promise<any>;
3
- declare function updateObject(entity: any, id: string, newData: any): Promise<any>;
4
- declare function createObject(entity: any, data: any): Promise<any>;
5
- declare function deleteObject(entity: any, id: string): Promise<any>;
6
- declare const konversiAPI: {
7
- setToken: (token: string) => void;
8
- setCompanyId: (companyId: string) => void;
9
- getAllObjects: typeof getAllObjects;
10
- getObjectById: typeof getObjectById;
11
- updateObject: typeof updateObject;
12
- createObject: typeof createObject;
13
- deleteObject: typeof deleteObject;
14
- };
15
- export default konversiAPI;
package/dist/index.js DELETED
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- Object.defineProperty(exports, "__esModule", { value: true });
35
- const axiosAPI_1 = __importStar(require("./axiosAPI"));
36
- function getAllObjects(entity_1) {
37
- return __awaiter(this, arguments, void 0, function* (entity, queryParams = {}) {
38
- const response = yield axiosAPI_1.default.get(`${entity}`, {
39
- params: queryParams
40
- });
41
- return response.data;
42
- });
43
- }
44
- function getObjectById(entity, id) {
45
- return __awaiter(this, void 0, void 0, function* () {
46
- const response = yield axiosAPI_1.default.get(`${entity}/${id}`);
47
- return response.data;
48
- });
49
- }
50
- function updateObject(entity, id, newData) {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- const response = yield axiosAPI_1.default.put(`${entity}/${id}`, newData);
53
- return response.data;
54
- });
55
- }
56
- function createObject(entity, data) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- const response = yield axiosAPI_1.default.post(`${entity}`, data);
59
- return response.data;
60
- });
61
- }
62
- function deleteObject(entity, id) {
63
- return __awaiter(this, void 0, void 0, function* () {
64
- const response = yield axiosAPI_1.default.delete(`${entity}/${id}`);
65
- return response.data;
66
- });
67
- }
68
- const konversiAPI = {
69
- setToken: axiosAPI_1.setAuthToken,
70
- setCompanyId: axiosAPI_1.setCompanyId,
71
- getAllObjects,
72
- getObjectById,
73
- updateObject,
74
- createObject,
75
- deleteObject
76
- };
77
- exports.default = konversiAPI;