@chift/chift-nodejs 1.0.25 → 1.0.27
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/src/modules/accounting.d.ts +11 -5
- package/dist/src/modules/accounting.js +67 -21
- package/dist/src/modules/api.d.ts +3729 -583
- package/dist/src/modules/api.js +2 -0
- package/dist/src/modules/banking.d.ts +3 -1
- package/dist/src/modules/banking.js +10 -2
- package/dist/src/modules/consumer.d.ts +722 -113
- package/dist/src/modules/consumer.js +5 -0
- package/dist/src/modules/consumers.d.ts +3657 -597
- package/dist/src/modules/ecommerce.d.ts +2 -2
- package/dist/src/modules/integrations.d.ts +6 -0
- package/dist/src/modules/internalApi.d.ts +4 -4
- package/dist/src/modules/invoicing.d.ts +7 -2
- package/dist/src/modules/invoicing.js +24 -0
- package/dist/src/modules/issues.d.ts +68 -0
- package/dist/src/modules/issues.js +33 -0
- package/dist/src/modules/pms.d.ts +3 -0
- package/dist/src/modules/pms.js +15 -0
- package/dist/src/modules/pos.d.ts +1 -0
- package/dist/src/modules/pos.js +8 -0
- package/dist/src/modules/sync.d.ts +2930 -482
- package/dist/src/modules/syncs.d.ts +0 -1
- package/dist/src/modules/syncs.js +0 -5
- package/dist/src/types/public-api/mappings.d.ts +21 -3
- package/dist/src/types/public-api/schema.d.ts +5593 -1670
- package/dist/test/modules/accounting.test.js +1 -29
- package/dist/test/modules/banking.test.js +3 -1
- package/dist/test/modules/consumer.test.js +1 -1
- package/dist/test/modules/raw-data.test.js +6 -4
- package/package.json +2 -3
- package/src/types/public-api/schema.d.ts +5593 -1670
|
@@ -589,35 +589,6 @@ let miscOperations;
|
|
|
589
589
|
(0, globals_1.expect)(financialEntry).toBeTruthy();
|
|
590
590
|
(0, globals_1.expect)(financialEntry).toHaveProperty('journal_id', journal.id);
|
|
591
591
|
}));
|
|
592
|
-
/**
|
|
593
|
-
* @deprecated replaced by createFinancialEntry
|
|
594
|
-
*/
|
|
595
|
-
(0, globals_1.test)('createFinancialEntryOld', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
596
|
-
var _f;
|
|
597
|
-
const journal = journals.find((journal) => journal.journal_type === 'financial_operation');
|
|
598
|
-
if (!journal) {
|
|
599
|
-
throw new Error('No journal with type "financial_operation" found to create financial entry');
|
|
600
|
-
}
|
|
601
|
-
if (!((_f = clients === null || clients === void 0 ? void 0 : clients[0]) === null || _f === void 0 ? void 0 : _f.account_number)) {
|
|
602
|
-
throw new Error('[DEPRECATED] No client account_number found to create financial entry');
|
|
603
|
-
}
|
|
604
|
-
const financialEntry = yield consumer.accounting.createFinancialEntryOld({
|
|
605
|
-
date: '2022-01-01',
|
|
606
|
-
journal_id: journal.id,
|
|
607
|
-
currency: 'EUR',
|
|
608
|
-
currency_exchange_rate: 1,
|
|
609
|
-
items: [
|
|
610
|
-
{
|
|
611
|
-
type: 'customer_account',
|
|
612
|
-
account_number: clients[0].account_number,
|
|
613
|
-
partner_id: clients[0].id,
|
|
614
|
-
amount: 10,
|
|
615
|
-
},
|
|
616
|
-
],
|
|
617
|
-
});
|
|
618
|
-
(0, globals_1.expect)(financialEntry).toBeTruthy();
|
|
619
|
-
(0, globals_1.expect)(financialEntry).toHaveProperty('journal_id', journal.id);
|
|
620
|
-
}));
|
|
621
592
|
let folders = [];
|
|
622
593
|
(0, globals_1.test)('getFolders', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
623
594
|
folders = yield consumer.accounting.getFolders();
|
|
@@ -654,6 +625,7 @@ globals_1.test.skip('matchEntries', () => __awaiter(void 0, void 0, void 0, func
|
|
|
654
625
|
const body = {
|
|
655
626
|
name: 'sdk test',
|
|
656
627
|
number: '1324',
|
|
628
|
+
type: 'other',
|
|
657
629
|
};
|
|
658
630
|
const ledgerAccount = yield consumer.accounting.createLedgerAccount(body);
|
|
659
631
|
(0, globals_1.expect)(ledgerAccount).toBeTruthy();
|
|
@@ -74,7 +74,9 @@ let transactions;
|
|
|
74
74
|
if (!accounts.length) {
|
|
75
75
|
throw new Error('No accounts found to test getAccountTransactions');
|
|
76
76
|
}
|
|
77
|
-
transactions = yield consumer.banking.getAccountTransactions(
|
|
77
|
+
transactions = yield consumer.banking.getAccountTransactions({
|
|
78
|
+
account_id: accounts[0].id,
|
|
79
|
+
});
|
|
78
80
|
(0, globals_1.expect)(transactions).toBeInstanceOf(Array);
|
|
79
81
|
if (transactions.length > 0) {
|
|
80
82
|
(0, globals_1.expect)(transactions[0]).toHaveProperty('id', globals_1.expect.any(String));
|
|
@@ -56,7 +56,7 @@ let consumer;
|
|
|
56
56
|
syncConsumer = yield client.Consumers.getConsumerById(process.env.CHIFT_SYNC_CONSUMER_ID);
|
|
57
57
|
}));
|
|
58
58
|
(0, globals_1.test)('createConnection', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
59
|
-
const body = { integrationid: 1000, name: 'odoo test sdk' };
|
|
59
|
+
const body = { integrationid: 1000, name: 'odoo test sdk', redirect: false };
|
|
60
60
|
const result = yield consumer.createConnection(body);
|
|
61
61
|
(0, globals_1.expect)(result).toHaveProperty('url', globals_1.expect.any(String));
|
|
62
62
|
}));
|
|
@@ -30,10 +30,10 @@ const banking_1 = require("../../src/modules/banking");
|
|
|
30
30
|
});
|
|
31
31
|
(0, globals_1.test)('banking factory methods support rawData parameter', () => {
|
|
32
32
|
// Test that getAccountTransactions supports rawData parameter
|
|
33
|
-
const getTransactionsRequest = banking_1.bankingFactory.getAccountTransactions('test-account-id'
|
|
33
|
+
const getTransactionsRequest = banking_1.bankingFactory.getAccountTransactions({ account_id: 'test-account-id' }, { rawData: true });
|
|
34
34
|
(0, globals_1.expect)(getTransactionsRequest).toHaveProperty('rawData', true);
|
|
35
35
|
(0, globals_1.expect)(getTransactionsRequest).toHaveProperty('method', 'get');
|
|
36
|
-
(0, globals_1.expect)(getTransactionsRequest).toHaveProperty('url', '/consumers/{consumer_id}/banking/
|
|
36
|
+
(0, globals_1.expect)(getTransactionsRequest).toHaveProperty('url', '/consumers/{consumer_id}/banking/transactions');
|
|
37
37
|
});
|
|
38
38
|
(0, globals_1.test)('rawData parameter defaults to undefined when not specified', () => {
|
|
39
39
|
// Test that rawData is undefined when not specified
|
|
@@ -41,7 +41,9 @@ const banking_1 = require("../../src/modules/banking");
|
|
|
41
41
|
(0, globals_1.expect)(getInvoicesRequest.rawData).toBeUndefined();
|
|
42
42
|
const getOrdersRequest = ecommerce_1.ecommerceFactory.getOrders();
|
|
43
43
|
(0, globals_1.expect)(getOrdersRequest.rawData).toBeUndefined();
|
|
44
|
-
const getTransactionsRequest = banking_1.bankingFactory.getAccountTransactions(
|
|
44
|
+
const getTransactionsRequest = banking_1.bankingFactory.getAccountTransactions({
|
|
45
|
+
account_id: 'test-account-id',
|
|
46
|
+
});
|
|
45
47
|
(0, globals_1.expect)(getTransactionsRequest.rawData).toBeUndefined();
|
|
46
48
|
});
|
|
47
49
|
(0, globals_1.test)('rawData parameter can be explicitly set to false', () => {
|
|
@@ -50,6 +52,6 @@ const banking_1 = require("../../src/modules/banking");
|
|
|
50
52
|
(0, globals_1.expect)(getInvoicesRequest).toHaveProperty('rawData', false);
|
|
51
53
|
const getOrdersRequest = ecommerce_1.ecommerceFactory.getOrders({}, { rawData: false });
|
|
52
54
|
(0, globals_1.expect)(getOrdersRequest).toHaveProperty('rawData', false);
|
|
53
|
-
const getTransactionsRequest = banking_1.bankingFactory.getAccountTransactions('test-account-id'
|
|
55
|
+
const getTransactionsRequest = banking_1.bankingFactory.getAccountTransactions({ account_id: 'test-account-id' }, { rawData: false });
|
|
54
56
|
(0, globals_1.expect)(getTransactionsRequest).toHaveProperty('rawData', false);
|
|
55
57
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chift/chift-nodejs",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.27",
|
|
4
4
|
"description": "The Chift NodeJS library provides convenient access to the Chift API from applications written in the NodeJS language (Javascript/Typescript).",
|
|
5
5
|
"main": "dist/src/index.js",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"dev": "chokidar src --command 'npm run build' --debounce=5000",
|
|
13
13
|
"prepare": "husky install",
|
|
14
|
-
"build": "tsc
|
|
14
|
+
"build": "tsc",
|
|
15
15
|
"test": "jest --maxWorkers 1"
|
|
16
16
|
},
|
|
17
17
|
"keywords": [],
|
|
@@ -22,7 +22,6 @@
|
|
|
22
22
|
"@types/node": "^18.15.11",
|
|
23
23
|
"@typescript-eslint/eslint-plugin": "^5.53.0",
|
|
24
24
|
"chokidar-cli": "^3.0.0",
|
|
25
|
-
"coveralls": "^3.1.1",
|
|
26
25
|
"eslint": "^8.34.0",
|
|
27
26
|
"eslint-config-prettier": "^8.6.0",
|
|
28
27
|
"eslint-config-standard-with-typescript": "^34.0.0",
|