bexio 3.6.2 → 3.7.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/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/interfaces/PositionsStatic.d.ts +46 -0
- package/lib/interfaces/PositionsStatic.js +3 -0
- package/lib/interfaces/PositionsStatic.js.map +1 -0
- package/lib/resources/DefaultPositions.d.ts +33 -0
- package/lib/resources/DefaultPositions.js +61 -0
- package/lib/resources/DefaultPositions.js.map +1 -0
- package/lib/resources/Invoices.d.ts +28 -0
- package/lib/resources/Invoices.js +42 -0
- package/lib/resources/Invoices.js.map +1 -1
- package/lib/resources/ItemPositions.d.ts +33 -0
- package/lib/resources/ItemPositions.js +61 -0
- package/lib/resources/ItemPositions.js.map +1 -0
- package/lib/resources/Orders.d.ts +28 -0
- package/lib/resources/Orders.js +51 -0
- package/lib/resources/Orders.js.map +1 -1
- package/lib/resources/TextPositions.d.ts +33 -0
- package/lib/resources/TextPositions.js +61 -0
- package/lib/resources/TextPositions.js.map +1 -0
- package/lib/tests/DefaultPositions.test.d.ts +1 -0
- package/lib/tests/DefaultPositions.test.js +22 -0
- package/lib/tests/DefaultPositions.test.js.map +1 -0
- package/lib/tests/Invoices.test.js +55 -0
- package/lib/tests/Invoices.test.js.map +1 -1
- package/lib/tests/ItemPositions.test.d.ts +1 -0
- package/lib/tests/ItemPositions.test.js +22 -0
- package/lib/tests/ItemPositions.test.js.map +1 -0
- package/lib/tests/Orders.test.js +116 -0
- package/lib/tests/Orders.test.js.map +1 -1
- package/lib/tests/TextPositions.test.d.ts +1 -0
- package/lib/tests/TextPositions.test.js +22 -0
- package/lib/tests/TextPositions.test.js.map +1 -0
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ export * from "./interfaces/UsersStatic";
|
|
|
43
43
|
export * from "./interfaces/ItemsStatic";
|
|
44
44
|
export * from "./interfaces/InvoicesStatic";
|
|
45
45
|
export * from "./interfaces/PositionStatic";
|
|
46
|
+
export * from "./interfaces/PositionsStatic";
|
|
46
47
|
export * from "./interfaces/CurrenciesStatic";
|
|
47
48
|
export * from "./interfaces/BillsV4Static";
|
|
48
49
|
export * from "./interfaces/OutgoingPaymentsStatic";
|
package/lib/index.js
CHANGED
|
@@ -62,6 +62,7 @@ __exportStar(require("./interfaces/UsersStatic"), exports);
|
|
|
62
62
|
__exportStar(require("./interfaces/ItemsStatic"), exports);
|
|
63
63
|
__exportStar(require("./interfaces/InvoicesStatic"), exports);
|
|
64
64
|
__exportStar(require("./interfaces/PositionStatic"), exports);
|
|
65
|
+
__exportStar(require("./interfaces/PositionsStatic"), exports);
|
|
65
66
|
__exportStar(require("./interfaces/CurrenciesStatic"), exports);
|
|
66
67
|
__exportStar(require("./interfaces/BillsV4Static"), exports);
|
|
67
68
|
__exportStar(require("./interfaces/OutgoingPaymentsStatic"), exports);
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA,wFAAgE;AAChE,oEAA4C;AAC5C,4EAAoD;AACpD,gFAAwD;AACxD,8EAAsD;AACtD,oFAA4D;AAC5D,oEAA4C;AAC5C,8DAAsC;AACtC,gEAAwC;AACxC,oEAA4C;AAC5C,kFAA0D;AAC1D,4EAAoD;AACpD,8EAAsD;AACtD,4FAAoE;AACpE,8DAAsC;AACtC,8DAAsC;AACtC,oEAA4C;AAC5C,wEAAgD;AAChD,kEAA0C;AAC1C,oFAA4D;AAC5D,4EAAoD;AACpD,oEAA4C;AAC5C,8EAAsD;AACtD,8DAAsC;AAEtC,2DAAyC;AACzC,wEAAsD;AACtD,8DAA4C;AAC5C,mEAAiD;AACjD,sEAAoD;AACpD,oEAAkD;AAClD,kEAAgD;AAChD,8DAA4C;AAC5C,8DAA4C;AAC5C,2DAAyC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,IAAI,CAAC,YAAY,GAAG,IAAI,sBAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACjD,IAAI,CAAC,QAAQ,GAAG,IAAI,kBAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,aAAa,GAAG,IAAI,uBAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACnD,IAAI,CAAC,KAAK,GAAG,IAAI,eAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACrC,CAAC;CACF;AA/ED,wBA+EC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export declare namespace PositionsStatic {
|
|
2
|
+
type KbDocumentType = "kb_invoice" | "kb_offer" | "kb_order";
|
|
3
|
+
interface DefaultPositionCreate {
|
|
4
|
+
amount: string;
|
|
5
|
+
amount_reserved: string;
|
|
6
|
+
amount_open: string;
|
|
7
|
+
amount_completed: string;
|
|
8
|
+
unit_id: number;
|
|
9
|
+
account_id: number;
|
|
10
|
+
tax_id: number;
|
|
11
|
+
text: string;
|
|
12
|
+
unit_price: string;
|
|
13
|
+
discount_in_percent: string | null;
|
|
14
|
+
is_optional: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface DefaultPosition extends Omit<DefaultPositionCreate, "unit_price"> {
|
|
17
|
+
id: number;
|
|
18
|
+
unit_name: string;
|
|
19
|
+
tax_value: string;
|
|
20
|
+
position_total: string;
|
|
21
|
+
unit_price: string | null;
|
|
22
|
+
pos: string;
|
|
23
|
+
internal_pos: number;
|
|
24
|
+
type: "KbPositionCustom";
|
|
25
|
+
parent_id: number | null;
|
|
26
|
+
}
|
|
27
|
+
interface ItemPositionCreate extends DefaultPositionCreate {
|
|
28
|
+
article_id: number;
|
|
29
|
+
}
|
|
30
|
+
interface ItemPosition extends Omit<DefaultPosition, "type"> {
|
|
31
|
+
article_id: number;
|
|
32
|
+
type: "KbPositionArticle";
|
|
33
|
+
}
|
|
34
|
+
interface TextPositionCreate {
|
|
35
|
+
text: string;
|
|
36
|
+
show_pos_nr: boolean;
|
|
37
|
+
}
|
|
38
|
+
interface TextPosition extends TextPositionCreate {
|
|
39
|
+
id: number;
|
|
40
|
+
pos: string | null;
|
|
41
|
+
internal_pos: number;
|
|
42
|
+
is_optional: boolean;
|
|
43
|
+
type: "KbPositionText";
|
|
44
|
+
parent_id: number | null;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PositionsStatic.js","sourceRoot":"","sources":["../../src/interfaces/PositionsStatic.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseCrud from "./BaseCrud";
|
|
2
|
+
import { PositionsStatic } from "../interfaces/PositionsStatic";
|
|
3
|
+
import { BaseStatic } from "../interfaces/BaseStatic";
|
|
4
|
+
export default class DefaultPositions extends BaseCrud<PositionsStatic.DefaultPosition, PositionsStatic.DefaultPosition, {}, {}, PositionsStatic.DefaultPositionCreate, {}> {
|
|
5
|
+
constructor(apiToken: string, documentType: PositionsStatic.KbDocumentType, documentId: number);
|
|
6
|
+
/**
|
|
7
|
+
* Not implemented by Bexio yet
|
|
8
|
+
*
|
|
9
|
+
* @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
|
|
10
|
+
* @param {BaseStatic.BaseOptions} [options]
|
|
11
|
+
* @returns {Promise<Array<{}>>}
|
|
12
|
+
* @memberof DefaultPositions
|
|
13
|
+
*/
|
|
14
|
+
search(searchOptions: Array<BaseStatic.SearchParameter<{}>>, options?: BaseStatic.BaseOptions): Promise<Array<{}>>;
|
|
15
|
+
/**
|
|
16
|
+
* Not implemented by Bexio yet
|
|
17
|
+
*
|
|
18
|
+
* @param {number} id
|
|
19
|
+
* @param {{}} ressource
|
|
20
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
21
|
+
* @memberof DefaultPositions
|
|
22
|
+
*/
|
|
23
|
+
overwrite(id: number, ressource: {}): Promise<PositionsStatic.DefaultPosition>;
|
|
24
|
+
/**
|
|
25
|
+
* Not implemented by Bexio yet
|
|
26
|
+
*
|
|
27
|
+
* @param {number} id
|
|
28
|
+
* @param {Partial<{}>} ressource
|
|
29
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
30
|
+
* @memberof DefaultPositions
|
|
31
|
+
*/
|
|
32
|
+
edit(id: number, ressource: Partial<{}>): Promise<PositionsStatic.DefaultPosition>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseCrud_1 = __importDefault(require("./BaseCrud"));
|
|
16
|
+
class DefaultPositions extends BaseCrud_1.default {
|
|
17
|
+
constructor(apiToken, documentType, documentId) {
|
|
18
|
+
super(apiToken, `/2.0/${documentType}/${documentId}/kb_position_custom`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Not implemented by Bexio yet
|
|
22
|
+
*
|
|
23
|
+
* @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
|
|
24
|
+
* @param {BaseStatic.BaseOptions} [options]
|
|
25
|
+
* @returns {Promise<Array<{}>>}
|
|
26
|
+
* @memberof DefaultPositions
|
|
27
|
+
*/
|
|
28
|
+
search(searchOptions, options) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
throw new Error("not implemented by Bexio yet");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Not implemented by Bexio yet
|
|
35
|
+
*
|
|
36
|
+
* @param {number} id
|
|
37
|
+
* @param {{}} ressource
|
|
38
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
39
|
+
* @memberof DefaultPositions
|
|
40
|
+
*/
|
|
41
|
+
overwrite(id, ressource) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
throw new Error("not implemented by Bexio yet");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Not implemented by Bexio yet
|
|
48
|
+
*
|
|
49
|
+
* @param {number} id
|
|
50
|
+
* @param {Partial<{}>} ressource
|
|
51
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
52
|
+
* @memberof DefaultPositions
|
|
53
|
+
*/
|
|
54
|
+
edit(id, ressource) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
throw new Error("not implemented by Bexio yet");
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.default = DefaultPositions;
|
|
61
|
+
//# sourceMappingURL=DefaultPositions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultPositions.js","sourceRoot":"","sources":["../../src/resources/DefaultPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0DAAkC;AAIlC,MAAqB,gBAAiB,SAAQ,kBAO7C;IACC,YACE,QAAgB,EAChB,YAA4C,EAC5C,UAAkB;QAElB,KAAK,CACH,QAAQ,EACR,QAAQ,YAAY,IAAI,UAAU,qBAAqB,CACxD,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACU,MAAM,CACjB,aAAoD,EACpD,OAAgC;;YAEhC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,SAAS,CACpB,EAAU,EACV,SAAa;;YAEb,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,IAAI,CACf,EAAU,EACV,SAAsB;;YAEtB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;CACF;AA/DD,mCA+DC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import BaseCrud from "./BaseCrud";
|
|
2
2
|
import { InvoicesStatic } from "../interfaces/InvoicesStatic";
|
|
3
|
+
import { PositionsStatic } from "../interfaces/PositionsStatic";
|
|
3
4
|
export default class Invoices extends BaseCrud<InvoicesStatic.Invoice, InvoicesStatic.Invoice, InvoicesStatic.Invoice, InvoicesStatic.InvoiceSearchParameters, InvoicesStatic.InvoiceCreate, InvoicesStatic.InvoiceOverwrite> {
|
|
4
5
|
constructor(apiToken: string);
|
|
5
6
|
sent(id: number, ressource: Partial<InvoicesStatic.InvoiceSent>): Promise<InvoicesStatic.InvoiceSentAnswer>;
|
|
@@ -44,4 +45,31 @@ export default class Invoices extends BaseCrud<InvoicesStatic.Invoice, InvoicesS
|
|
|
44
45
|
* @memberof Invoices
|
|
45
46
|
*/
|
|
46
47
|
deletePayment(invoiceId: number, paymentId: number): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a default position for an invoice
|
|
50
|
+
*
|
|
51
|
+
* @param {number} invoiceId
|
|
52
|
+
* @param {PositionsStatic.DefaultPositionCreate} position
|
|
53
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
54
|
+
* @memberof Invoices
|
|
55
|
+
*/
|
|
56
|
+
createDefaultPosition(invoiceId: number, position: PositionsStatic.DefaultPositionCreate): Promise<PositionsStatic.DefaultPosition>;
|
|
57
|
+
/**
|
|
58
|
+
* Create an item position for an invoice
|
|
59
|
+
*
|
|
60
|
+
* @param {number} invoiceId
|
|
61
|
+
* @param {PositionsStatic.ItemPositionCreate} position
|
|
62
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
63
|
+
* @memberof Invoices
|
|
64
|
+
*/
|
|
65
|
+
createItemPosition(invoiceId: number, position: PositionsStatic.ItemPositionCreate): Promise<PositionsStatic.ItemPosition>;
|
|
66
|
+
/**
|
|
67
|
+
* Create a text position for an invoice
|
|
68
|
+
*
|
|
69
|
+
* @param {number} invoiceId
|
|
70
|
+
* @param {PositionsStatic.TextPositionCreate} position
|
|
71
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
72
|
+
* @memberof Invoices
|
|
73
|
+
*/
|
|
74
|
+
createTextPosition(invoiceId: number, position: PositionsStatic.TextPositionCreate): Promise<PositionsStatic.TextPosition>;
|
|
47
75
|
}
|
|
@@ -13,6 +13,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
const BaseCrud_1 = __importDefault(require("./BaseCrud"));
|
|
16
|
+
const DefaultPositions_1 = __importDefault(require("./DefaultPositions"));
|
|
17
|
+
const ItemPositions_1 = __importDefault(require("./ItemPositions"));
|
|
18
|
+
const TextPositions_1 = __importDefault(require("./TextPositions"));
|
|
16
19
|
class Invoices extends BaseCrud_1.default {
|
|
17
20
|
constructor(apiToken) {
|
|
18
21
|
super(apiToken, "/2.0/kb_invoice");
|
|
@@ -88,6 +91,45 @@ class Invoices extends BaseCrud_1.default {
|
|
|
88
91
|
return this.request("DELETE", `${this.apiEndpoint}/${invoiceId.toString()}/payment/${paymentId.toString()}`);
|
|
89
92
|
});
|
|
90
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Create a default position for an invoice
|
|
96
|
+
*
|
|
97
|
+
* @param {number} invoiceId
|
|
98
|
+
* @param {PositionsStatic.DefaultPositionCreate} position
|
|
99
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
100
|
+
* @memberof Invoices
|
|
101
|
+
*/
|
|
102
|
+
createDefaultPosition(invoiceId, position) {
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
return new DefaultPositions_1.default(this.apiToken, "kb_invoice", invoiceId).create(position);
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create an item position for an invoice
|
|
109
|
+
*
|
|
110
|
+
* @param {number} invoiceId
|
|
111
|
+
* @param {PositionsStatic.ItemPositionCreate} position
|
|
112
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
113
|
+
* @memberof Invoices
|
|
114
|
+
*/
|
|
115
|
+
createItemPosition(invoiceId, position) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
return new ItemPositions_1.default(this.apiToken, "kb_invoice", invoiceId).create(position);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Create a text position for an invoice
|
|
122
|
+
*
|
|
123
|
+
* @param {number} invoiceId
|
|
124
|
+
* @param {PositionsStatic.TextPositionCreate} position
|
|
125
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
126
|
+
* @memberof Invoices
|
|
127
|
+
*/
|
|
128
|
+
createTextPosition(invoiceId, position) {
|
|
129
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
130
|
+
return new TextPositions_1.default(this.apiToken, "kb_invoice", invoiceId).create(position);
|
|
131
|
+
});
|
|
132
|
+
}
|
|
91
133
|
}
|
|
92
134
|
exports.default = Invoices;
|
|
93
135
|
//# sourceMappingURL=Invoices.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Invoices.js","sourceRoot":"","sources":["../../src/resources/Invoices.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA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A4C;;YAE5C,OAAO,IAAI,uBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,MAAM,CACrE,QAAQ,CACT,CAAC;QACJ,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,kBAAkB,CAC7B,SAAiB,EACjB,QAA4C;;YAE5C,OAAO,IAAI,uBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC,MAAM,CACrE,QAAQ,CACT,CAAC;QACJ,CAAC;KAAA;CACF;AAvKD,2BAuKC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseCrud from "./BaseCrud";
|
|
2
|
+
import { PositionsStatic } from "../interfaces/PositionsStatic";
|
|
3
|
+
import { BaseStatic } from "../interfaces/BaseStatic";
|
|
4
|
+
export default class ItemPositions extends BaseCrud<PositionsStatic.ItemPosition, PositionsStatic.ItemPosition, {}, {}, PositionsStatic.ItemPositionCreate, {}> {
|
|
5
|
+
constructor(apiToken: string, documentType: PositionsStatic.KbDocumentType, documentId: number);
|
|
6
|
+
/**
|
|
7
|
+
* Not implemented by Bexio yet
|
|
8
|
+
*
|
|
9
|
+
* @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
|
|
10
|
+
* @param {BaseStatic.BaseOptions} [options]
|
|
11
|
+
* @returns {Promise<Array<{}>>}
|
|
12
|
+
* @memberof ItemPositions
|
|
13
|
+
*/
|
|
14
|
+
search(searchOptions: Array<BaseStatic.SearchParameter<{}>>, options?: BaseStatic.BaseOptions): Promise<Array<{}>>;
|
|
15
|
+
/**
|
|
16
|
+
* Not implemented by Bexio yet
|
|
17
|
+
*
|
|
18
|
+
* @param {number} id
|
|
19
|
+
* @param {{}} ressource
|
|
20
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
21
|
+
* @memberof ItemPositions
|
|
22
|
+
*/
|
|
23
|
+
overwrite(id: number, ressource: {}): Promise<PositionsStatic.ItemPosition>;
|
|
24
|
+
/**
|
|
25
|
+
* Not implemented by Bexio yet
|
|
26
|
+
*
|
|
27
|
+
* @param {number} id
|
|
28
|
+
* @param {Partial<{}>} ressource
|
|
29
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
30
|
+
* @memberof ItemPositions
|
|
31
|
+
*/
|
|
32
|
+
edit(id: number, ressource: Partial<{}>): Promise<PositionsStatic.ItemPosition>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseCrud_1 = __importDefault(require("./BaseCrud"));
|
|
16
|
+
class ItemPositions extends BaseCrud_1.default {
|
|
17
|
+
constructor(apiToken, documentType, documentId) {
|
|
18
|
+
super(apiToken, `/2.0/${documentType}/${documentId}/kb_position_article`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Not implemented by Bexio yet
|
|
22
|
+
*
|
|
23
|
+
* @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
|
|
24
|
+
* @param {BaseStatic.BaseOptions} [options]
|
|
25
|
+
* @returns {Promise<Array<{}>>}
|
|
26
|
+
* @memberof ItemPositions
|
|
27
|
+
*/
|
|
28
|
+
search(searchOptions, options) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
throw new Error("not implemented by Bexio yet");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Not implemented by Bexio yet
|
|
35
|
+
*
|
|
36
|
+
* @param {number} id
|
|
37
|
+
* @param {{}} ressource
|
|
38
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
39
|
+
* @memberof ItemPositions
|
|
40
|
+
*/
|
|
41
|
+
overwrite(id, ressource) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
throw new Error("not implemented by Bexio yet");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Not implemented by Bexio yet
|
|
48
|
+
*
|
|
49
|
+
* @param {number} id
|
|
50
|
+
* @param {Partial<{}>} ressource
|
|
51
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
52
|
+
* @memberof ItemPositions
|
|
53
|
+
*/
|
|
54
|
+
edit(id, ressource) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
throw new Error("not implemented by Bexio yet");
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.default = ItemPositions;
|
|
61
|
+
//# sourceMappingURL=ItemPositions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemPositions.js","sourceRoot":"","sources":["../../src/resources/ItemPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0DAAkC;AAIlC,MAAqB,aAAc,SAAQ,kBAO1C;IACC,YACE,QAAgB,EAChB,YAA4C,EAC5C,UAAkB;QAElB,KAAK,CACH,QAAQ,EACR,QAAQ,YAAY,IAAI,UAAU,sBAAsB,CACzD,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACU,MAAM,CACjB,aAAoD,EACpD,OAAgC;;YAEhC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,SAAS,CACpB,EAAU,EACV,SAAa;;YAEb,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,IAAI,CACf,EAAU,EACV,SAAsB;;YAEtB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;CACF;AA/DD,gCA+DC"}
|
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
import { OrdersStatic } from "./../interfaces/OrdersStatic";
|
|
2
2
|
import BaseCrud from "./BaseCrud";
|
|
3
|
+
import { PositionsStatic } from "../interfaces/PositionsStatic";
|
|
3
4
|
export default class Orders extends BaseCrud<OrdersStatic.OrderSmall, OrdersStatic.OrderFull, OrdersStatic.OrderSmall, OrdersStatic.OrderSearchParameters, OrdersStatic.OrderCreate, OrdersStatic.OrderCreate> {
|
|
4
5
|
constructor(apiToken: string);
|
|
6
|
+
/**
|
|
7
|
+
* Create a default position for an order
|
|
8
|
+
*
|
|
9
|
+
* @param {number} orderId
|
|
10
|
+
* @param {PositionsStatic.DefaultPositionCreate} position
|
|
11
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
12
|
+
* @memberof Orders
|
|
13
|
+
*/
|
|
14
|
+
createDefaultPosition(orderId: number, position: PositionsStatic.DefaultPositionCreate): Promise<PositionsStatic.DefaultPosition>;
|
|
15
|
+
/**
|
|
16
|
+
* Create an item position for an order
|
|
17
|
+
*
|
|
18
|
+
* @param {number} orderId
|
|
19
|
+
* @param {PositionsStatic.ItemPositionCreate} position
|
|
20
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
21
|
+
* @memberof Orders
|
|
22
|
+
*/
|
|
23
|
+
createItemPosition(orderId: number, position: PositionsStatic.ItemPositionCreate): Promise<PositionsStatic.ItemPosition>;
|
|
24
|
+
/**
|
|
25
|
+
* Create a text position for an order
|
|
26
|
+
*
|
|
27
|
+
* @param {number} orderId
|
|
28
|
+
* @param {PositionsStatic.TextPositionCreate} position
|
|
29
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
30
|
+
* @memberof Orders
|
|
31
|
+
*/
|
|
32
|
+
createTextPosition(orderId: number, position: PositionsStatic.TextPositionCreate): Promise<PositionsStatic.TextPosition>;
|
|
5
33
|
}
|
package/lib/resources/Orders.js
CHANGED
|
@@ -1,13 +1,64 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
5
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
15
|
const BaseCrud_1 = __importDefault(require("./BaseCrud"));
|
|
16
|
+
const DefaultPositions_1 = __importDefault(require("./DefaultPositions"));
|
|
17
|
+
const ItemPositions_1 = __importDefault(require("./ItemPositions"));
|
|
18
|
+
const TextPositions_1 = __importDefault(require("./TextPositions"));
|
|
7
19
|
class Orders extends BaseCrud_1.default {
|
|
8
20
|
constructor(apiToken) {
|
|
9
21
|
super(apiToken, "/2.0/kb_order");
|
|
10
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Create a default position for an order
|
|
25
|
+
*
|
|
26
|
+
* @param {number} orderId
|
|
27
|
+
* @param {PositionsStatic.DefaultPositionCreate} position
|
|
28
|
+
* @returns {Promise<PositionsStatic.DefaultPosition>}
|
|
29
|
+
* @memberof Orders
|
|
30
|
+
*/
|
|
31
|
+
createDefaultPosition(orderId, position) {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
return new DefaultPositions_1.default(this.apiToken, "kb_order", orderId).create(position);
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create an item position for an order
|
|
38
|
+
*
|
|
39
|
+
* @param {number} orderId
|
|
40
|
+
* @param {PositionsStatic.ItemPositionCreate} position
|
|
41
|
+
* @returns {Promise<PositionsStatic.ItemPosition>}
|
|
42
|
+
* @memberof Orders
|
|
43
|
+
*/
|
|
44
|
+
createItemPosition(orderId, position) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return new ItemPositions_1.default(this.apiToken, "kb_order", orderId).create(position);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a text position for an order
|
|
51
|
+
*
|
|
52
|
+
* @param {number} orderId
|
|
53
|
+
* @param {PositionsStatic.TextPositionCreate} position
|
|
54
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
55
|
+
* @memberof Orders
|
|
56
|
+
*/
|
|
57
|
+
createTextPosition(orderId, position) {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
return new TextPositions_1.default(this.apiToken, "kb_order", orderId).create(position);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
11
62
|
}
|
|
12
63
|
exports.default = Orders;
|
|
13
64
|
//# sourceMappingURL=Orders.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Orders.js","sourceRoot":"","sources":["../../src/resources/Orders.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Orders.js","sourceRoot":"","sources":["../../src/resources/Orders.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,0DAAkC;AAElC,0EAAkD;AAClD,oEAA4C;AAC5C,oEAA4C;AAE5C,MAAqB,MAAO,SAAQ,kBAOnC;IACC,YAAY,QAAgB;QAC1B,KAAK,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;IACnC,CAAC;IAED;;;;;;;OAOG;IACU,qBAAqB,CAChC,OAAe,EACf,QAA+C;;YAE/C,OAAO,IAAI,0BAAgB,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,MAAM,CACpE,QAAQ,CACT,CAAC;QACJ,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,kBAAkB,CAC7B,OAAe,EACf,QAA4C;;YAE5C,OAAO,IAAI,uBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,MAAM,CACjE,QAAQ,CACT,CAAC;QACJ,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,kBAAkB,CAC7B,OAAe,EACf,QAA4C;;YAE5C,OAAO,IAAI,uBAAa,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC,MAAM,CACjE,QAAQ,CACT,CAAC;QACJ,CAAC;KAAA;CACF;AA9DD,yBA8DC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import BaseCrud from "./BaseCrud";
|
|
2
|
+
import { PositionsStatic } from "../interfaces/PositionsStatic";
|
|
3
|
+
import { BaseStatic } from "../interfaces/BaseStatic";
|
|
4
|
+
export default class TextPositions extends BaseCrud<PositionsStatic.TextPosition, PositionsStatic.TextPosition, {}, {}, PositionsStatic.TextPositionCreate, {}> {
|
|
5
|
+
constructor(apiToken: string, documentType: PositionsStatic.KbDocumentType, documentId: number);
|
|
6
|
+
/**
|
|
7
|
+
* Not implemented by Bexio yet
|
|
8
|
+
*
|
|
9
|
+
* @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
|
|
10
|
+
* @param {BaseStatic.BaseOptions} [options]
|
|
11
|
+
* @returns {Promise<Array<{}>>}
|
|
12
|
+
* @memberof TextPositions
|
|
13
|
+
*/
|
|
14
|
+
search(searchOptions: Array<BaseStatic.SearchParameter<{}>>, options?: BaseStatic.BaseOptions): Promise<Array<{}>>;
|
|
15
|
+
/**
|
|
16
|
+
* Not implemented by Bexio yet
|
|
17
|
+
*
|
|
18
|
+
* @param {number} id
|
|
19
|
+
* @param {{}} ressource
|
|
20
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
21
|
+
* @memberof TextPositions
|
|
22
|
+
*/
|
|
23
|
+
overwrite(id: number, ressource: {}): Promise<PositionsStatic.TextPosition>;
|
|
24
|
+
/**
|
|
25
|
+
* Not implemented by Bexio yet
|
|
26
|
+
*
|
|
27
|
+
* @param {number} id
|
|
28
|
+
* @param {Partial<{}>} ressource
|
|
29
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
30
|
+
* @memberof TextPositions
|
|
31
|
+
*/
|
|
32
|
+
edit(id: number, ressource: Partial<{}>): Promise<PositionsStatic.TextPosition>;
|
|
33
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const BaseCrud_1 = __importDefault(require("./BaseCrud"));
|
|
16
|
+
class TextPositions extends BaseCrud_1.default {
|
|
17
|
+
constructor(apiToken, documentType, documentId) {
|
|
18
|
+
super(apiToken, `/2.0/${documentType}/${documentId}/kb_position_text`);
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Not implemented by Bexio yet
|
|
22
|
+
*
|
|
23
|
+
* @param {Array<BaseStatic.SearchParameter<{}>>} searchOptions
|
|
24
|
+
* @param {BaseStatic.BaseOptions} [options]
|
|
25
|
+
* @returns {Promise<Array<{}>>}
|
|
26
|
+
* @memberof TextPositions
|
|
27
|
+
*/
|
|
28
|
+
search(searchOptions, options) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
throw new Error("not implemented by Bexio yet");
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Not implemented by Bexio yet
|
|
35
|
+
*
|
|
36
|
+
* @param {number} id
|
|
37
|
+
* @param {{}} ressource
|
|
38
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
39
|
+
* @memberof TextPositions
|
|
40
|
+
*/
|
|
41
|
+
overwrite(id, ressource) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
throw new Error("not implemented by Bexio yet");
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Not implemented by Bexio yet
|
|
48
|
+
*
|
|
49
|
+
* @param {number} id
|
|
50
|
+
* @param {Partial<{}>} ressource
|
|
51
|
+
* @returns {Promise<PositionsStatic.TextPosition>}
|
|
52
|
+
* @memberof TextPositions
|
|
53
|
+
*/
|
|
54
|
+
edit(id, ressource) {
|
|
55
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
throw new Error("not implemented by Bexio yet");
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.default = TextPositions;
|
|
61
|
+
//# sourceMappingURL=TextPositions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextPositions.js","sourceRoot":"","sources":["../../src/resources/TextPositions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,0DAAkC;AAIlC,MAAqB,aAAc,SAAQ,kBAO1C;IACC,YACE,QAAgB,EAChB,YAA4C,EAC5C,UAAkB;QAElB,KAAK,CACH,QAAQ,EACR,QAAQ,YAAY,IAAI,UAAU,mBAAmB,CACtD,CAAC;IACJ,CAAC;IAED;;;;;;;OAOG;IACU,MAAM,CACjB,aAAoD,EACpD,OAAgC;;YAEhC,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,SAAS,CACpB,EAAU,EACV,SAAa;;YAEb,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;IAED;;;;;;;OAOG;IACU,IAAI,CACf,EAAU,EACV,SAAsB;;YAEtB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;QAClD,CAAC;KAAA;CACF;AA/DD,gCA+DC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const DefaultPositions_1 = __importDefault(require("../resources/DefaultPositions"));
|
|
8
|
+
const chance_1 = __importDefault(require("chance"));
|
|
9
|
+
jest.mock("../resources/BaseCrud");
|
|
10
|
+
const seedgenerator = new chance_1.default();
|
|
11
|
+
const seed = seedgenerator.hash();
|
|
12
|
+
console.log(`using chance seed ${seed}`);
|
|
13
|
+
const chance = new chance_1.default(seed);
|
|
14
|
+
describe("DefaultPositions", () => {
|
|
15
|
+
it("Should use init the base correctly", () => {
|
|
16
|
+
const token = chance.string();
|
|
17
|
+
const documentId = chance.integer();
|
|
18
|
+
new DefaultPositions_1.default(token, "kb_invoice", documentId);
|
|
19
|
+
expect(BaseCrud_1.default).toHaveBeenCalledWith(token, `/2.0/kb_invoice/${documentId}/kb_position_custom`);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=DefaultPositions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DefaultPositions.test.js","sourceRoot":"","sources":["../../src/tests/DefaultPositions.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,qFAA6D;AAC7D,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAEnC,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,0BAAgB,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QACtD,MAAM,CAAC,kBAAQ,CAAC,CAAC,oBAAoB,CACnC,KAAK,EACL,mBAAmB,UAAU,qBAAqB,CACnD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -107,5 +107,60 @@ describe("Invoices", () => {
|
|
|
107
107
|
expect(requestSpy).toHaveBeenCalledWith("DELETE", `/2.0/kb_invoice/${invoiceId}/payment/${paymentId}`);
|
|
108
108
|
}));
|
|
109
109
|
});
|
|
110
|
+
describe("createDefaultPosition", () => {
|
|
111
|
+
it("Should call request with POST and correct path", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
112
|
+
const invoices = new Invoices_1.default(chance.string());
|
|
113
|
+
const invoiceId = chance.integer();
|
|
114
|
+
const position = {
|
|
115
|
+
amount: chance.string(),
|
|
116
|
+
amount_reserved: chance.string(),
|
|
117
|
+
amount_open: chance.string(),
|
|
118
|
+
amount_completed: chance.string(),
|
|
119
|
+
unit_id: chance.integer(),
|
|
120
|
+
account_id: chance.integer(),
|
|
121
|
+
tax_id: chance.integer(),
|
|
122
|
+
text: chance.string(),
|
|
123
|
+
unit_price: chance.string(),
|
|
124
|
+
discount_in_percent: chance.string(),
|
|
125
|
+
is_optional: chance.bool(),
|
|
126
|
+
};
|
|
127
|
+
yield invoices.createDefaultPosition(invoiceId, position);
|
|
128
|
+
expect(requestSpy).toHaveBeenCalledWith("POST", `/2.0/kb_invoice/${invoiceId}/kb_position_custom`, undefined, position);
|
|
129
|
+
}));
|
|
130
|
+
});
|
|
131
|
+
describe("createItemPosition", () => {
|
|
132
|
+
it("Should call request with POST and correct path", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
133
|
+
const invoices = new Invoices_1.default(chance.string());
|
|
134
|
+
const invoiceId = chance.integer();
|
|
135
|
+
const position = {
|
|
136
|
+
article_id: chance.integer(),
|
|
137
|
+
amount: chance.string(),
|
|
138
|
+
amount_reserved: chance.string(),
|
|
139
|
+
amount_open: chance.string(),
|
|
140
|
+
amount_completed: chance.string(),
|
|
141
|
+
unit_id: chance.integer(),
|
|
142
|
+
account_id: chance.integer(),
|
|
143
|
+
tax_id: chance.integer(),
|
|
144
|
+
text: chance.string(),
|
|
145
|
+
unit_price: chance.string(),
|
|
146
|
+
discount_in_percent: chance.string(),
|
|
147
|
+
is_optional: chance.bool(),
|
|
148
|
+
};
|
|
149
|
+
yield invoices.createItemPosition(invoiceId, position);
|
|
150
|
+
expect(requestSpy).toHaveBeenCalledWith("POST", `/2.0/kb_invoice/${invoiceId}/kb_position_article`, undefined, position);
|
|
151
|
+
}));
|
|
152
|
+
});
|
|
153
|
+
describe("createTextPosition", () => {
|
|
154
|
+
it("Should call request with POST and correct path", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
155
|
+
const invoices = new Invoices_1.default(chance.string());
|
|
156
|
+
const invoiceId = chance.integer();
|
|
157
|
+
const position = {
|
|
158
|
+
text: chance.string(),
|
|
159
|
+
show_pos_nr: chance.bool(),
|
|
160
|
+
};
|
|
161
|
+
yield invoices.createTextPosition(invoiceId, position);
|
|
162
|
+
expect(requestSpy).toHaveBeenCalledWith("POST", `/2.0/kb_invoice/${invoiceId}/kb_position_text`, undefined, position);
|
|
163
|
+
}));
|
|
164
|
+
});
|
|
110
165
|
});
|
|
111
166
|
//# sourceMappingURL=Invoices.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Invoices.test.js","sourceRoot":"","sources":["../../src/tests/Invoices.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qEAA6C;AAC7C,qEAA6C;AAC7C,oDAA4B;
|
|
1
|
+
{"version":3,"file":"Invoices.test.js","sourceRoot":"","sources":["../../src/tests/Invoices.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qEAA6C;AAC7C,qEAA6C;AAC7C,oDAA4B;AAI5B,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAA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,EAAE;aAC3B,CAAC;YAEF,MAAM,QAAQ,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAEvD,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CACrC,MAAM,EACN,mBAAmB,SAAS,sBAAsB,EAClD,SAAS,EACT,QAAQ,CACT,CAAC;QACJ,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAClC,EAAE,CAAC,gDAAgD,EAAE,GAAS,EAAE;YAC9D,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;YAC/C,MAAM,SAAS,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;YACnC,MAAM,QAAQ,GAAuC;gBACnD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;gBACrB,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE;aAC3B,CAAC;YAEF,MAAM,QAAQ,CAAC,kBAAkB,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YAEvD,MAAM,CAAC,UAAU,CAAC,CAAC,oBAAoB,CACrC,MAAM,EACN,mBAAmB,SAAS,mBAAmB,EAC/C,SAAS,EACT,QAAQ,CACT,CAAC;QACJ,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const ItemPositions_1 = __importDefault(require("../resources/ItemPositions"));
|
|
8
|
+
const chance_1 = __importDefault(require("chance"));
|
|
9
|
+
jest.mock("../resources/BaseCrud");
|
|
10
|
+
const seedgenerator = new chance_1.default();
|
|
11
|
+
const seed = seedgenerator.hash();
|
|
12
|
+
console.log(`using chance seed ${seed}`);
|
|
13
|
+
const chance = new chance_1.default(seed);
|
|
14
|
+
describe("ItemPositions", () => {
|
|
15
|
+
it("Should use init the base correctly", () => {
|
|
16
|
+
const token = chance.string();
|
|
17
|
+
const documentId = chance.integer();
|
|
18
|
+
new ItemPositions_1.default(token, "kb_order", documentId);
|
|
19
|
+
expect(BaseCrud_1.default).toHaveBeenCalledWith(token, `/2.0/kb_order/${documentId}/kb_position_article`);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=ItemPositions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemPositions.test.js","sourceRoot":"","sources":["../../src/tests/ItemPositions.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,+EAAuD;AACvD,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAEnC,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,uBAAa,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC;QACjD,MAAM,CAAC,kBAAQ,CAAC,CAAC,oBAAoB,CACnC,KAAK,EACL,iBAAiB,UAAU,sBAAsB,CAClD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/lib/tests/Orders.test.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
12
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
13
|
};
|
|
@@ -6,16 +15,123 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
15
|
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
16
|
const Orders_1 = __importDefault(require("../resources/Orders"));
|
|
8
17
|
const chance_1 = __importDefault(require("chance"));
|
|
18
|
+
const DefaultPositions_1 = __importDefault(require("../resources/DefaultPositions"));
|
|
19
|
+
const ItemPositions_1 = __importDefault(require("../resources/ItemPositions"));
|
|
20
|
+
const TextPositions_1 = __importDefault(require("../resources/TextPositions"));
|
|
9
21
|
jest.mock("../resources/BaseCrud");
|
|
22
|
+
jest.mock("../resources/DefaultPositions");
|
|
23
|
+
jest.mock("../resources/ItemPositions");
|
|
24
|
+
jest.mock("../resources/TextPositions");
|
|
10
25
|
const seedgenerator = new chance_1.default();
|
|
11
26
|
const seed = seedgenerator.hash();
|
|
12
27
|
console.log(`using chance seed ${seed}`);
|
|
13
28
|
const chance = new chance_1.default(seed);
|
|
14
29
|
describe("Orders", () => {
|
|
30
|
+
afterEach(() => {
|
|
31
|
+
jest.resetAllMocks();
|
|
32
|
+
});
|
|
15
33
|
it("Should use init the base correctly", () => {
|
|
16
34
|
const token = chance.string();
|
|
17
35
|
new Orders_1.default(token);
|
|
18
36
|
expect(BaseCrud_1.default).toHaveBeenCalledWith(token, "/2.0/kb_order");
|
|
19
37
|
});
|
|
38
|
+
describe("createDefaultPosition", () => {
|
|
39
|
+
it("Should create a new DefaultPosition object", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
40
|
+
const orderId = chance.integer({ min: 0 });
|
|
41
|
+
const position = {
|
|
42
|
+
amount: chance.string(),
|
|
43
|
+
amount_reserved: chance.string(),
|
|
44
|
+
amount_open: chance.string(),
|
|
45
|
+
amount_completed: chance.string(),
|
|
46
|
+
unit_id: chance.integer(),
|
|
47
|
+
account_id: chance.integer(),
|
|
48
|
+
tax_id: chance.integer(),
|
|
49
|
+
text: chance.string(),
|
|
50
|
+
unit_price: chance.string(),
|
|
51
|
+
discount_in_percent: chance.string(),
|
|
52
|
+
is_optional: chance.bool(),
|
|
53
|
+
};
|
|
54
|
+
new Orders_1.default(chance.string()).createDefaultPosition(orderId, position);
|
|
55
|
+
expect(DefaultPositions_1.default).toHaveBeenCalledWith(undefined, "kb_order", orderId);
|
|
56
|
+
}));
|
|
57
|
+
it("Should call create", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
58
|
+
const orderId = chance.integer({ min: 0 });
|
|
59
|
+
const position = {
|
|
60
|
+
amount: chance.string(),
|
|
61
|
+
amount_reserved: chance.string(),
|
|
62
|
+
amount_open: chance.string(),
|
|
63
|
+
amount_completed: chance.string(),
|
|
64
|
+
unit_id: chance.integer(),
|
|
65
|
+
account_id: chance.integer(),
|
|
66
|
+
tax_id: chance.integer(),
|
|
67
|
+
text: chance.string(),
|
|
68
|
+
unit_price: chance.string(),
|
|
69
|
+
discount_in_percent: chance.string(),
|
|
70
|
+
is_optional: chance.bool(),
|
|
71
|
+
};
|
|
72
|
+
new Orders_1.default(chance.string()).createDefaultPosition(orderId, position);
|
|
73
|
+
expect(DefaultPositions_1.default.prototype.create).toHaveBeenCalledWith(position);
|
|
74
|
+
}));
|
|
75
|
+
});
|
|
76
|
+
describe("createItemPosition", () => {
|
|
77
|
+
it("Should create a new ItemPosition object", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
78
|
+
const orderId = chance.integer({ min: 0 });
|
|
79
|
+
const position = {
|
|
80
|
+
article_id: chance.integer(),
|
|
81
|
+
amount: chance.string(),
|
|
82
|
+
amount_reserved: chance.string(),
|
|
83
|
+
amount_open: chance.string(),
|
|
84
|
+
amount_completed: chance.string(),
|
|
85
|
+
unit_id: chance.integer(),
|
|
86
|
+
account_id: chance.integer(),
|
|
87
|
+
tax_id: chance.integer(),
|
|
88
|
+
text: chance.string(),
|
|
89
|
+
unit_price: chance.string(),
|
|
90
|
+
discount_in_percent: chance.string(),
|
|
91
|
+
is_optional: chance.bool(),
|
|
92
|
+
};
|
|
93
|
+
new Orders_1.default(chance.string()).createItemPosition(orderId, position);
|
|
94
|
+
expect(ItemPositions_1.default).toHaveBeenCalledWith(undefined, "kb_order", orderId);
|
|
95
|
+
}));
|
|
96
|
+
it("Should call create", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
|
+
const orderId = chance.integer({ min: 0 });
|
|
98
|
+
const position = {
|
|
99
|
+
article_id: chance.integer(),
|
|
100
|
+
amount: chance.string(),
|
|
101
|
+
amount_reserved: chance.string(),
|
|
102
|
+
amount_open: chance.string(),
|
|
103
|
+
amount_completed: chance.string(),
|
|
104
|
+
unit_id: chance.integer(),
|
|
105
|
+
account_id: chance.integer(),
|
|
106
|
+
tax_id: chance.integer(),
|
|
107
|
+
text: chance.string(),
|
|
108
|
+
unit_price: chance.string(),
|
|
109
|
+
discount_in_percent: chance.string(),
|
|
110
|
+
is_optional: chance.bool(),
|
|
111
|
+
};
|
|
112
|
+
new Orders_1.default(chance.string()).createItemPosition(orderId, position);
|
|
113
|
+
expect(ItemPositions_1.default.prototype.create).toHaveBeenCalledWith(position);
|
|
114
|
+
}));
|
|
115
|
+
});
|
|
116
|
+
describe("createTextPosition", () => {
|
|
117
|
+
it("Should create a new TextPosition object", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
118
|
+
const orderId = chance.integer({ min: 0 });
|
|
119
|
+
const position = {
|
|
120
|
+
text: chance.string(),
|
|
121
|
+
show_pos_nr: chance.bool(),
|
|
122
|
+
};
|
|
123
|
+
new Orders_1.default(chance.string()).createTextPosition(orderId, position);
|
|
124
|
+
expect(TextPositions_1.default).toHaveBeenCalledWith(undefined, "kb_order", orderId);
|
|
125
|
+
}));
|
|
126
|
+
it("Should call create", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
127
|
+
const orderId = chance.integer({ min: 0 });
|
|
128
|
+
const position = {
|
|
129
|
+
text: chance.string(),
|
|
130
|
+
show_pos_nr: chance.bool(),
|
|
131
|
+
};
|
|
132
|
+
new Orders_1.default(chance.string()).createTextPosition(orderId, position);
|
|
133
|
+
expect(TextPositions_1.default.prototype.create).toHaveBeenCalledWith(position);
|
|
134
|
+
}));
|
|
135
|
+
});
|
|
20
136
|
});
|
|
21
137
|
//# sourceMappingURL=Orders.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Orders.test.js","sourceRoot":"","sources":["../../src/tests/Orders.test.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Orders.test.js","sourceRoot":"","sources":["../../src/tests/Orders.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,qEAA6C;AAC7C,iEAAyC;AACzC,oDAA4B;AAC5B,qFAA6D;AAC7D,+EAAuD;AACvD,+EAAuD;AAGvD,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AACnC,IAAI,CAAC,IAAI,CAAC,+BAA+B,CAAC,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E,MAAM,CAAC,uBAAa,CAAC,CAAC,oBAAoB,CACxC,SAAS,EACT,UAAU,EACV,OAAO,CACR,CAAC;QACJ,CAAC,CAAA,CAAC,CAAC;QAEH,EAAE,CAAC,oBAAoB,EAAE,GAAS,EAAE;YAClC,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YAC3C,MAAM,QAAQ,GAAuC;gBACnD,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE;gBACrB,WAAW,EAAE,MAAM,CAAC,IAAI,EAAE;aAC3B,CAAC;YACF,IAAI,gBAAM,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,kBAAkB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAElE,MAAM,CAAC,uBAAa,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC;QACxE,CAAC,CAAA,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
const BaseCrud_1 = __importDefault(require("../resources/BaseCrud"));
|
|
7
|
+
const TextPositions_1 = __importDefault(require("../resources/TextPositions"));
|
|
8
|
+
const chance_1 = __importDefault(require("chance"));
|
|
9
|
+
jest.mock("../resources/BaseCrud");
|
|
10
|
+
const seedgenerator = new chance_1.default();
|
|
11
|
+
const seed = seedgenerator.hash();
|
|
12
|
+
console.log(`using chance seed ${seed}`);
|
|
13
|
+
const chance = new chance_1.default(seed);
|
|
14
|
+
describe("TextPositions", () => {
|
|
15
|
+
it("Should use init the base correctly", () => {
|
|
16
|
+
const token = chance.string();
|
|
17
|
+
const documentId = chance.integer();
|
|
18
|
+
new TextPositions_1.default(token, "kb_invoice", documentId);
|
|
19
|
+
expect(BaseCrud_1.default).toHaveBeenCalledWith(token, `/2.0/kb_invoice/${documentId}/kb_position_text`);
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=TextPositions.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextPositions.test.js","sourceRoot":"","sources":["../../src/tests/TextPositions.test.ts"],"names":[],"mappings":";;;;;AAAA,qEAA6C;AAC7C,+EAAuD;AACvD,oDAA4B;AAE5B,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAEnC,MAAM,aAAa,GAAG,IAAI,gBAAM,EAAE,CAAC;AACnC,MAAM,IAAI,GAAG,aAAa,CAAC,IAAI,EAAE,CAAC;AAClC,OAAO,CAAC,GAAG,CAAC,qBAAqB,IAAI,EAAE,CAAC,CAAC;AACzC,MAAM,MAAM,GAAG,IAAI,gBAAM,CAAC,IAAI,CAAC,CAAC;AAEhC,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC;QAC9B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QACpC,IAAI,uBAAa,CAAC,KAAK,EAAE,YAAY,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,CAAC,kBAAQ,CAAC,CAAC,oBAAoB,CACnC,KAAK,EACL,mBAAmB,UAAU,mBAAmB,CACjD,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|