@agnocon/piece-bokio 0.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/LICENSE.MIT-AP +24 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/add-line-item-to-invoice.d.ts +15 -0
- package/dist/lib/actions/add-line-item-to-invoice.d.ts.map +1 -0
- package/dist/lib/actions/add-line-item-to-invoice.js +67 -0
- package/dist/lib/actions/add-line-item-to-invoice.js.map +1 -0
- package/dist/lib/actions/create-a-journal-entry.d.ts +9 -0
- package/dist/lib/actions/create-a-journal-entry.d.ts.map +1 -0
- package/dist/lib/actions/create-a-journal-entry.js +70 -0
- package/dist/lib/actions/create-a-journal-entry.js.map +1 -0
- package/dist/lib/actions/create-an-item.d.ts +11 -0
- package/dist/lib/actions/create-an-item.d.ts.map +1 -0
- package/dist/lib/actions/create-an-item.js +60 -0
- package/dist/lib/actions/create-an-item.js.map +1 -0
- package/dist/lib/actions/create-customer.d.ts +19 -0
- package/dist/lib/actions/create-customer.d.ts.map +1 -0
- package/dist/lib/actions/create-customer.js +145 -0
- package/dist/lib/actions/create-customer.js.map +1 -0
- package/dist/lib/actions/create-invoice.d.ts +18 -0
- package/dist/lib/actions/create-invoice.d.ts.map +1 -0
- package/dist/lib/actions/create-invoice.js +125 -0
- package/dist/lib/actions/create-invoice.js.map +1 -0
- package/dist/lib/actions/find-customer.d.ts +10 -0
- package/dist/lib/actions/find-customer.d.ts.map +1 -0
- package/dist/lib/actions/find-customer.js +78 -0
- package/dist/lib/actions/find-customer.js.map +1 -0
- package/dist/lib/actions/get-a-journal-entry.d.ts +7 -0
- package/dist/lib/actions/get-a-journal-entry.d.ts.map +1 -0
- package/dist/lib/actions/get-a-journal-entry.js +34 -0
- package/dist/lib/actions/get-a-journal-entry.js.map +1 -0
- package/dist/lib/actions/get-an-invoice.d.ts +7 -0
- package/dist/lib/actions/get-an-invoice.d.ts.map +1 -0
- package/dist/lib/actions/get-an-invoice.js +34 -0
- package/dist/lib/actions/get-an-invoice.js.map +1 -0
- package/dist/lib/actions/get-draft-invoice-by-customer-name.d.ts +9 -0
- package/dist/lib/actions/get-draft-invoice-by-customer-name.d.ts.map +1 -0
- package/dist/lib/actions/get-draft-invoice-by-customer-name.js +75 -0
- package/dist/lib/actions/get-draft-invoice-by-customer-name.js.map +1 -0
- package/dist/lib/actions/update-an-invoice.d.ts +18 -0
- package/dist/lib/actions/update-an-invoice.d.ts.map +1 -0
- package/dist/lib/actions/update-an-invoice.js +109 -0
- package/dist/lib/actions/update-an-invoice.js.map +1 -0
- package/dist/lib/common/auth.d.ts +5 -0
- package/dist/lib/common/auth.d.ts.map +1 -0
- package/dist/lib/common/auth.js +47 -0
- package/dist/lib/common/auth.js.map +1 -0
- package/dist/lib/common/client.d.ts +4 -0
- package/dist/lib/common/client.d.ts.map +1 -0
- package/dist/lib/common/client.js +29 -0
- package/dist/lib/common/client.js.map +1 -0
- package/dist/lib/common/props.d.ts +10 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +128 -0
- package/dist/lib/common/props.js.map +1 -0
- package/package.json +47 -0
- package/src/index.ts +49 -0
- package/src/lib/actions/add-line-item-to-invoice.ts +74 -0
- package/src/lib/actions/create-a-journal-entry.ts +72 -0
- package/src/lib/actions/create-an-item.ts +68 -0
- package/src/lib/actions/create-customer.ts +163 -0
- package/src/lib/actions/create-invoice.ts +145 -0
- package/src/lib/actions/find-customer.ts +75 -0
- package/src/lib/actions/get-a-journal-entry.ts +32 -0
- package/src/lib/actions/get-an-invoice.ts +32 -0
- package/src/lib/actions/get-draft-invoice-by-customer-name.ts +78 -0
- package/src/lib/actions/update-an-invoice.ts +127 -0
- package/src/lib/common/auth.ts +44 -0
- package/src/lib/common/client.ts +25 -0
- package/src/lib/common/props.ts +136 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createInvoice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/actions/create-invoice.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
const props_1 = require("../common/props");
|
|
12
|
+
exports.createInvoice = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.bokioAuth,
|
|
14
|
+
name: 'createInvoice',
|
|
15
|
+
displayName: 'Create Invoice',
|
|
16
|
+
description: 'Creates a new draft invoice in Bokio',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: { description: 'Creates a new draft invoice in a Bokio company with a single line item. Use to start a new customer invoice; invoice date, due date, and item type are required, and the customer is linked by passing the customer UUID. Not idempotent — each call creates a separate draft invoice.', idempotent: false },
|
|
19
|
+
props: {
|
|
20
|
+
invoiceType: pieces_framework_1.Property.StaticDropdown({
|
|
21
|
+
displayName: 'Invoice Type',
|
|
22
|
+
description: 'Type of invoice',
|
|
23
|
+
required: false,
|
|
24
|
+
options: {
|
|
25
|
+
options: [
|
|
26
|
+
{ label: 'Invoice', value: 'invoice' },
|
|
27
|
+
{ label: 'Cash Invoice', value: 'cashInvoice' },
|
|
28
|
+
],
|
|
29
|
+
},
|
|
30
|
+
}),
|
|
31
|
+
customerRef: pieces_framework_1.Property.ShortText({
|
|
32
|
+
displayName: 'Customer ID',
|
|
33
|
+
description: 'UUID of the customer',
|
|
34
|
+
required: false,
|
|
35
|
+
}),
|
|
36
|
+
invoiceDate: pieces_framework_1.Property.ShortText({
|
|
37
|
+
displayName: 'Invoice Date',
|
|
38
|
+
description: 'Invoice date (YYYY-MM-DD)',
|
|
39
|
+
required: true,
|
|
40
|
+
}),
|
|
41
|
+
dueDate: pieces_framework_1.Property.ShortText({
|
|
42
|
+
displayName: 'Due Date',
|
|
43
|
+
description: 'Due date (YYYY-MM-DD)',
|
|
44
|
+
required: true,
|
|
45
|
+
}),
|
|
46
|
+
orderNumberReference: pieces_framework_1.Property.ShortText({
|
|
47
|
+
displayName: 'Order Number Reference',
|
|
48
|
+
description: 'The order number associated with the invoice',
|
|
49
|
+
required: false,
|
|
50
|
+
}),
|
|
51
|
+
currency: pieces_framework_1.Property.ShortText({
|
|
52
|
+
displayName: 'Currency',
|
|
53
|
+
description: 'ISO 4217 currency code (e.g., SEK, EUR, USD)',
|
|
54
|
+
required: false,
|
|
55
|
+
}),
|
|
56
|
+
currencyRate: pieces_framework_1.Property.Number({
|
|
57
|
+
displayName: 'Currency Rate',
|
|
58
|
+
description: 'Currency rate (defaults to 1)',
|
|
59
|
+
required: false,
|
|
60
|
+
}),
|
|
61
|
+
itemType: pieces_framework_1.Property.StaticDropdown({
|
|
62
|
+
displayName: 'Item Type',
|
|
63
|
+
description: 'Type of the line item',
|
|
64
|
+
required: true,
|
|
65
|
+
options: {
|
|
66
|
+
options: [
|
|
67
|
+
{ label: 'Sales Item', value: 'salesItem' },
|
|
68
|
+
{ label: 'Description Only Item', value: 'descriptionOnlyItem' },
|
|
69
|
+
],
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
dynamicProps: props_1.lineItemsProps,
|
|
73
|
+
},
|
|
74
|
+
run(context) {
|
|
75
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const { invoiceType, customerRef, invoiceDate, dueDate, orderNumberReference, currency, currencyRate, itemType, dynamicProps, } = context.propsValue;
|
|
77
|
+
const { api_key, companyId } = context.auth.props;
|
|
78
|
+
const body = {
|
|
79
|
+
type: invoiceType || 'invoice',
|
|
80
|
+
invoiceDate,
|
|
81
|
+
dueDate,
|
|
82
|
+
};
|
|
83
|
+
if (customerRef) {
|
|
84
|
+
body.customerRef = {
|
|
85
|
+
id: customerRef,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
if (orderNumberReference) {
|
|
89
|
+
body.orderNumberReference = orderNumberReference;
|
|
90
|
+
}
|
|
91
|
+
if (currency) {
|
|
92
|
+
body.currency = currency;
|
|
93
|
+
}
|
|
94
|
+
if (currencyRate !== undefined && currencyRate !== null) {
|
|
95
|
+
body.currencyRate = currencyRate;
|
|
96
|
+
}
|
|
97
|
+
const lineItems = {};
|
|
98
|
+
if (itemType === 'salesItem' && dynamicProps) {
|
|
99
|
+
lineItems.itemType = itemType;
|
|
100
|
+
body.description = dynamicProps === null || dynamicProps === void 0 ? void 0 : dynamicProps['description'];
|
|
101
|
+
lineItems.quantity = dynamicProps['quantity'];
|
|
102
|
+
lineItems.unitPrice = dynamicProps['unitPrice'];
|
|
103
|
+
if (dynamicProps['itemRefId']) {
|
|
104
|
+
lineItems.itemRef = {
|
|
105
|
+
id: dynamicProps['itemRefId'],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
if (dynamicProps['productType']) {
|
|
109
|
+
lineItems.productType = dynamicProps['productType'];
|
|
110
|
+
}
|
|
111
|
+
if (dynamicProps['unitType']) {
|
|
112
|
+
lineItems.unitType = dynamicProps['unitType'];
|
|
113
|
+
}
|
|
114
|
+
if (dynamicProps['taxRate'] !== undefined &&
|
|
115
|
+
dynamicProps['taxRate'] !== null) {
|
|
116
|
+
lineItems.taxRate = dynamicProps['taxRate'];
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
body.lineItems = [lineItems];
|
|
120
|
+
const response = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.POST, `/companies/${companyId}/invoices`, body);
|
|
121
|
+
return response;
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=create-invoice.js.map
|
|
@@ -0,0 +1 @@
|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,MAAM,IAAA,oBAAW,EAChC,OAAO,EACP,0BAAU,CAAC,IAAI,EACf,cAAc,SAAS,WAAW,EAClC,IAAI,CACL,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const findCustomer: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
filterType: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
6
|
+
filterValue: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
7
|
+
page: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
8
|
+
pageSize: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=find-customer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-customer.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/find-customer.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY;;;;;;;;EAqEvB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findCustomer = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/actions/find-customer.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
exports.findCustomer = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.bokioAuth,
|
|
13
|
+
name: 'findCustomer',
|
|
14
|
+
displayName: 'Find Customer',
|
|
15
|
+
description: 'Find customers in Bokio by filtering and pagination',
|
|
16
|
+
audience: 'both',
|
|
17
|
+
aiMetadata: { description: 'Lists customers in a Bokio company with pagination, optionally filtered by name, type, VAT number, or organization number. Leaving the filter empty returns all customers; supplying a filter type and value narrows to matching records. Use to look up a customer or their ID. Idempotent read-only lookup.', idempotent: true },
|
|
18
|
+
props: {
|
|
19
|
+
filterType: pieces_framework_1.Property.StaticDropdown({
|
|
20
|
+
displayName: 'Filter Type',
|
|
21
|
+
description: 'Type of filter to use',
|
|
22
|
+
required: false,
|
|
23
|
+
options: {
|
|
24
|
+
options: [
|
|
25
|
+
{ label: 'Name', value: 'name' },
|
|
26
|
+
{ label: 'Type', value: 'type' },
|
|
27
|
+
{ label: 'VAT Number', value: 'vatNumber' },
|
|
28
|
+
{ label: 'Organization Number', value: 'orgNumber' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
filterValue: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Filter Value',
|
|
34
|
+
description: 'Value to filter by',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
page: pieces_framework_1.Property.Number({
|
|
38
|
+
displayName: 'Page',
|
|
39
|
+
description: 'Page number (defaults to 1)',
|
|
40
|
+
required: false,
|
|
41
|
+
}),
|
|
42
|
+
pageSize: pieces_framework_1.Property.Number({
|
|
43
|
+
displayName: 'Page Size',
|
|
44
|
+
description: 'Number of items per page (max 100, defaults to 25)',
|
|
45
|
+
required: false,
|
|
46
|
+
}),
|
|
47
|
+
},
|
|
48
|
+
run(context) {
|
|
49
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
50
|
+
const { filterType, filterValue, page, pageSize } = context.propsValue;
|
|
51
|
+
const { api_key, companyId } = context.auth.props;
|
|
52
|
+
let query = '';
|
|
53
|
+
if (filterType && filterValue) {
|
|
54
|
+
query = `${filterType}=='${filterValue}'`;
|
|
55
|
+
}
|
|
56
|
+
const params = new URLSearchParams();
|
|
57
|
+
if (page !== undefined && page !== null) {
|
|
58
|
+
params.append('page', String(page));
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
params.append('page', '1');
|
|
62
|
+
}
|
|
63
|
+
if (pageSize !== undefined && pageSize !== null) {
|
|
64
|
+
params.append('pageSize', String(pageSize));
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
params.append('pageSize', '25');
|
|
68
|
+
}
|
|
69
|
+
if (query) {
|
|
70
|
+
params.append('query', query);
|
|
71
|
+
}
|
|
72
|
+
const url = `/companies/${companyId}/customers?${params.toString()}`;
|
|
73
|
+
const response = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, url);
|
|
74
|
+
return response;
|
|
75
|
+
});
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=find-customer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-customer.js","sourceRoot":"","sources":["../../../src/lib/actions/find-customer.ts"],"names":[],"mappings":";;;;AAAA,qGAAqG;AACrG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA2C;AAC3C,6CAA+C;AAC/C,0DAAoD;AAEvC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,qDAAqD;IAClE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,+SAA+S,EAAE,UAAU,EAAE,IAAI,EAAE;IAC9V,KAAK,EAAE;QACL,UAAU,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAClC,WAAW,EAAE,aAAa;YAC1B,WAAW,EAAE,uBAAuB;YACpC,QAAQ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AM,CAAC,IAAI,CAAC,CAAC,CAAC;YACtC,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YAC7B,CAAC;YAED,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAChD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YAC9C,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YAClC,CAAC;YAED,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;YAChC,CAAC;YAED,MAAM,GAAG,GAAG,cAAc,SAAS,cAAc,MAAM,CAAC,QAAQ,EAAE,EAAE,CAAC;YAErE,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAAC,OAAO,EAAE,0BAAU,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;YAEjE,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getAJournalEntry: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
journalEntryId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=get-a-journal-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-a-journal-entry.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-a-journal-entry.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,gBAAgB;;;;;EA0B3B,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAJournalEntry = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/actions/get-a-journal-entry.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
exports.getAJournalEntry = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.bokioAuth,
|
|
13
|
+
name: 'getAJournalEntry',
|
|
14
|
+
displayName: 'Get a journal entry',
|
|
15
|
+
description: 'Retrieve a specific journal entry by its ID',
|
|
16
|
+
audience: 'both',
|
|
17
|
+
aiMetadata: { description: 'Retrieves a single journal entry from a Bokio company by its UUID. Use when you already have the journal entry ID and need its full bookkeeping details. Idempotent read-only lookup.', idempotent: true },
|
|
18
|
+
props: {
|
|
19
|
+
journalEntryId: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Journal Entry ID',
|
|
21
|
+
description: 'UUID of the journal entry',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { journalEntryId } = context.propsValue;
|
|
28
|
+
const { api_key, companyId } = context.auth.props;
|
|
29
|
+
const response = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, `/companies/${companyId}/journal-entries/${journalEntryId}`);
|
|
30
|
+
return response;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=get-a-journal-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-a-journal-entry.js","sourceRoot":"","sources":["../../../src/lib/actions/get-a-journal-entry.ts"],"names":[],"mappings":";;;;AAAA,2GAA2G;AAC3G,qEAAqE;AACrE,gEAAmE;AACnE,yCAA2C;AAC3C,6CAA+C;AAC/C,0DAAoD;AAEvC,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC3C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,uLAAuL,EAAE,UAAU,EAAE,IAAI,EAAE;IACtO,KAAK,EAAE;QACL,cAAc,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,kBAAkB;YAC/B,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,cAAc,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAC9C,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAElD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,EACP,0BAAU,CAAC,GAAG,EACd,cAAc,SAAS,oBAAoB,cAAc,EAAE,CAC5D,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const getAnInvoice: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
invoiceId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=get-an-invoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-an-invoice.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-an-invoice.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,YAAY;;;;;EA0BvB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAnInvoice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/actions/get-an-invoice.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
exports.getAnInvoice = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.bokioAuth,
|
|
13
|
+
name: 'getAnInvoice',
|
|
14
|
+
displayName: 'Get an invoice',
|
|
15
|
+
description: 'Retrieve a specific invoice by its ID',
|
|
16
|
+
audience: 'both',
|
|
17
|
+
aiMetadata: { description: 'Retrieves a single invoice from a Bokio company by its invoice ID. Use when you already have the invoice ID and need its full details. Idempotent read-only lookup.', idempotent: true },
|
|
18
|
+
props: {
|
|
19
|
+
invoiceId: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Invoice ID',
|
|
21
|
+
description: 'The ID of the invoice to retrieve',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
},
|
|
25
|
+
run(context) {
|
|
26
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const { invoiceId } = context.propsValue;
|
|
28
|
+
const { api_key, companyId } = context.auth.props;
|
|
29
|
+
const response = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, `/companies/${companyId}/invoices/${invoiceId}`);
|
|
30
|
+
return response;
|
|
31
|
+
});
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
//# sourceMappingURL=get-an-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-an-invoice.js","sourceRoot":"","sources":["../../../src/lib/actions/get-an-invoice.ts"],"names":[],"mappings":";;;;AAAA,sGAAsG;AACtG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA2C;AAC3C,6CAA+C;AAC/C,0DAAoD;AAEvC,QAAA,YAAY,GAAG,IAAA,+BAAY,EAAC;IACvC,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,uCAAuC;IACpD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,qKAAqK,EAAE,UAAU,EAAE,IAAI,EAAE;IACpN,KAAK,EAAE;QACL,SAAS,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC5B,WAAW,EAAE,YAAY;YACzB,WAAW,EAAE,mCAAmC;YAChD,QAAQ,EAAE,IAAI;SACf,CAAC;KACH;IACK,GAAG,CAAC,OAAO;;YACf,MAAM,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YACzC,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAElD,MAAM,QAAQ,GAAG,MAAM,IAAA,oBAAW,EAChC,OAAO,EACP,0BAAU,CAAC,GAAG,EACd,cAAc,SAAS,aAAa,SAAS,EAAE,CAChD,CAAC;YAEF,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const getDraftInvoiceByCustomerName: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
customerName: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
6
|
+
page: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
7
|
+
pageSize: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=get-draft-invoice-by-customer-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-draft-invoice-by-customer-name.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/get-draft-invoice-by-customer-name.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,6BAA6B;;;;;;;EAwExC,CAAC"}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDraftInvoiceByCustomerName = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/actions/get-draft-invoice-by-customer-name.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
exports.getDraftInvoiceByCustomerName = (0, pieces_framework_1.createAction)({
|
|
12
|
+
auth: auth_1.bokioAuth,
|
|
13
|
+
name: 'getDraftInvoiceByCustomerName',
|
|
14
|
+
displayName: 'Get Draft Invoice by Customer Name',
|
|
15
|
+
description: 'Get all draft invoices for a customer by customer name',
|
|
16
|
+
audience: 'both',
|
|
17
|
+
aiMetadata: { description: 'Looks up a Bokio customer by exact name and returns their draft invoices with pagination. Use when you have a customer name (not an ID) and want their pending draft invoices; returns an empty result if no customer matches. Idempotent read-only lookup.', idempotent: true },
|
|
18
|
+
props: {
|
|
19
|
+
customerName: pieces_framework_1.Property.ShortText({
|
|
20
|
+
displayName: 'Customer Name',
|
|
21
|
+
description: 'Name of the customer to find draft invoices for',
|
|
22
|
+
required: true,
|
|
23
|
+
}),
|
|
24
|
+
page: pieces_framework_1.Property.Number({
|
|
25
|
+
displayName: 'Page',
|
|
26
|
+
description: 'Page number (defaults to 1)',
|
|
27
|
+
required: false,
|
|
28
|
+
}),
|
|
29
|
+
pageSize: pieces_framework_1.Property.Number({
|
|
30
|
+
displayName: 'Page Size',
|
|
31
|
+
description: 'Number of items per page (max 100, defaults to 25)',
|
|
32
|
+
required: false,
|
|
33
|
+
}),
|
|
34
|
+
},
|
|
35
|
+
run(context) {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const { customerName, page, pageSize } = context.propsValue;
|
|
38
|
+
const { api_key, companyId } = context.auth.props;
|
|
39
|
+
// First, find the customer by name
|
|
40
|
+
const customerSearchParams = new URLSearchParams();
|
|
41
|
+
customerSearchParams.append('page', '1');
|
|
42
|
+
customerSearchParams.append('pageSize', '100');
|
|
43
|
+
customerSearchParams.append('query', `name=='${customerName}'`);
|
|
44
|
+
const customerUrl = `/companies/${companyId}/customers?${customerSearchParams.toString()}`;
|
|
45
|
+
const customerResponse = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, customerUrl);
|
|
46
|
+
if (!customerResponse.items || customerResponse.items.length === 0) {
|
|
47
|
+
return {
|
|
48
|
+
message: `No customer found with name: ${customerName}`,
|
|
49
|
+
items: [],
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
const customerId = customerResponse.items[0].id;
|
|
53
|
+
// Now fetch draft invoices for this customer
|
|
54
|
+
const invoiceParams = new URLSearchParams();
|
|
55
|
+
if (page !== undefined && page !== null) {
|
|
56
|
+
invoiceParams.append('page', String(page));
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
invoiceParams.append('page', '1');
|
|
60
|
+
}
|
|
61
|
+
if (pageSize !== undefined && pageSize !== null) {
|
|
62
|
+
invoiceParams.append('pageSize', String(pageSize));
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
invoiceParams.append('pageSize', '25');
|
|
66
|
+
}
|
|
67
|
+
// Filter for draft invoices with matching customer
|
|
68
|
+
invoiceParams.append('query', `status==draft&&customerRef==${customerId}`);
|
|
69
|
+
const invoiceUrl = `/companies/${companyId}/invoices?${invoiceParams.toString()}`;
|
|
70
|
+
const invoiceResponse = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.GET, invoiceUrl);
|
|
71
|
+
return Object.assign({ customerName: customerResponse.items[0].name, customerId }, invoiceResponse);
|
|
72
|
+
});
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
//# sourceMappingURL=get-draft-invoice-by-customer-name.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-draft-invoice-by-customer-name.js","sourceRoot":"","sources":["../../../src/lib/actions/get-draft-invoice-by-customer-name.ts"],"names":[],"mappings":";;;;AAAA,0HAA0H;AAC1H,qEAAqE;AACrE,gEAAmE;AACnE,yCAA2C;AAC3C,6CAA+C;AAC/C,0DAAoD;AAEvC,QAAA,6BAA6B,GAAG,IAAA,+BAAY,EAAC;IACxD,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,+BAA+B;IACrC,WAAW,EAAE,oCAAoC;IACjD,WAAW,EAAE,wDAAwD;IACrE,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,6PAA6P,EAAE,UAAU,EAAE,IAAI,EAAE;IAC5S,KAAK,EAAE;QACL,YAAY,EAAE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J,CAAC;YAED,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAEhD,6CAA6C;YAC7C,MAAM,aAAa,GAAG,IAAI,eAAe,EAAE,CAAC;YAC5C,IAAI,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;gBACxC,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;YAC7C,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;YACpC,CAAC;YAED,IAAI,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;gBAChD,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC;YACrD,CAAC;iBAAM,CAAC;gBACN,aAAa,CAAC,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC;YACzC,CAAC;YAED,mDAAmD;YACnD,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,+BAA+B,UAAU,EAAE,CAAC,CAAC;YAE3E,MAAM,UAAU,GAAG,cAAc,SAAS,aAAa,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC;YAClF,MAAM,eAAe,GAAG,MAAM,IAAA,oBAAW,EAAC,OAAO,EAAE,0BAAU,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;YAE/E,uBACE,YAAY,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAC5C,UAAU,IACP,eAAe,EAClB;QACJ,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const updateAnInvoice: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>, {
|
|
5
|
+
invoiceId: import("@agnocon/pieces-framework").DropdownProperty<unknown, true, import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
6
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
7
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
8
|
+
}>>;
|
|
9
|
+
invoiceType: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
10
|
+
customerRef: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
11
|
+
invoiceDate: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
12
|
+
dueDate: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
13
|
+
orderNumberReference: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
14
|
+
currency: import("@agnocon/pieces-framework").ShortTextProperty<false>;
|
|
15
|
+
currencyRate: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
16
|
+
lineItemsJson: import("@agnocon/pieces-framework").LongTextProperty<false>;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=update-an-invoice.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-an-invoice.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/update-an-invoice.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;EAwH1B,CAAC"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateAnInvoice = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/actions/update-an-invoice.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const auth_1 = require("../common/auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
11
|
+
const props_1 = require("../common/props");
|
|
12
|
+
exports.updateAnInvoice = (0, pieces_framework_1.createAction)({
|
|
13
|
+
auth: auth_1.bokioAuth,
|
|
14
|
+
name: 'updateAnInvoice',
|
|
15
|
+
displayName: 'Update an invoice',
|
|
16
|
+
description: 'Updates an existing draft invoice in Bokio',
|
|
17
|
+
audience: 'both',
|
|
18
|
+
aiMetadata: { description: 'Updates an existing draft invoice in Bokio, identified by invoice ID, replacing fields such as type, customer, dates, currency, and the full line-items list (passed as a JSON array). Use to modify an invoice that already exists rather than create one. Idempotent — repeating the same update yields the same invoice state.', idempotent: true },
|
|
19
|
+
props: {
|
|
20
|
+
invoiceId: props_1.invoiceIdDropdown,
|
|
21
|
+
invoiceType: pieces_framework_1.Property.StaticDropdown({
|
|
22
|
+
displayName: 'Invoice Type',
|
|
23
|
+
description: 'Type of invoice',
|
|
24
|
+
required: false,
|
|
25
|
+
options: {
|
|
26
|
+
options: [
|
|
27
|
+
{ label: 'Invoice', value: 'invoice' },
|
|
28
|
+
{ label: 'Cash Invoice', value: 'cashInvoice' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
customerRef: pieces_framework_1.Property.ShortText({
|
|
33
|
+
displayName: 'Customer ID',
|
|
34
|
+
description: 'UUID of the customer',
|
|
35
|
+
required: false,
|
|
36
|
+
}),
|
|
37
|
+
invoiceDate: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Invoice Date',
|
|
39
|
+
description: 'Invoice date (YYYY-MM-DD)',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
dueDate: pieces_framework_1.Property.ShortText({
|
|
43
|
+
displayName: 'Due Date',
|
|
44
|
+
description: 'Due date (YYYY-MM-DD)',
|
|
45
|
+
required: true,
|
|
46
|
+
}),
|
|
47
|
+
orderNumberReference: pieces_framework_1.Property.ShortText({
|
|
48
|
+
displayName: 'Order Number Reference',
|
|
49
|
+
description: 'The order number associated with the invoice',
|
|
50
|
+
required: false,
|
|
51
|
+
}),
|
|
52
|
+
currency: pieces_framework_1.Property.ShortText({
|
|
53
|
+
displayName: 'Currency',
|
|
54
|
+
description: 'ISO 4217 currency code (e.g., SEK, EUR, USD)',
|
|
55
|
+
required: false,
|
|
56
|
+
}),
|
|
57
|
+
currencyRate: pieces_framework_1.Property.Number({
|
|
58
|
+
displayName: 'Currency Rate',
|
|
59
|
+
description: 'Currency rate',
|
|
60
|
+
required: false,
|
|
61
|
+
}),
|
|
62
|
+
lineItemsJson: pieces_framework_1.Property.LongText({
|
|
63
|
+
displayName: 'Line Items (JSON)',
|
|
64
|
+
description: 'Line items as JSON array. Each item should have: itemRef (object with id), description, quantity, unitPrice, unit, itemType (PRODUCT or SERVICE), vat',
|
|
65
|
+
required: false,
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
run(context) {
|
|
69
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const { invoiceId, invoiceType, customerRef, invoiceDate, dueDate, orderNumberReference, currency, currencyRate, lineItemsJson, } = context.propsValue;
|
|
71
|
+
const { api_key, companyId } = context.auth.props;
|
|
72
|
+
const body = {};
|
|
73
|
+
if (invoiceType) {
|
|
74
|
+
body.type = invoiceType;
|
|
75
|
+
}
|
|
76
|
+
if (customerRef) {
|
|
77
|
+
body.customerRef = {
|
|
78
|
+
id: customerRef,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
if (invoiceDate) {
|
|
82
|
+
body.invoiceDate = invoiceDate;
|
|
83
|
+
}
|
|
84
|
+
if (dueDate) {
|
|
85
|
+
body.dueDate = dueDate;
|
|
86
|
+
}
|
|
87
|
+
if (orderNumberReference) {
|
|
88
|
+
body.orderNumberReference = orderNumberReference;
|
|
89
|
+
}
|
|
90
|
+
if (currency) {
|
|
91
|
+
body.currency = currency;
|
|
92
|
+
}
|
|
93
|
+
if (currencyRate !== undefined && currencyRate !== null) {
|
|
94
|
+
body.currencyRate = currencyRate;
|
|
95
|
+
}
|
|
96
|
+
if (lineItemsJson) {
|
|
97
|
+
try {
|
|
98
|
+
body.lineItems = JSON.parse(lineItemsJson);
|
|
99
|
+
}
|
|
100
|
+
catch (_a) {
|
|
101
|
+
throw new Error('Invalid JSON format for line items');
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const response = yield (0, client_1.makeRequest)(api_key, pieces_common_1.HttpMethod.PUT, `/companies/${companyId}/invoices/${invoiceId}`, body);
|
|
105
|
+
return response;
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
});
|
|
109
|
+
//# sourceMappingURL=update-an-invoice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-an-invoice.js","sourceRoot":"","sources":["../../../src/lib/actions/update-an-invoice.ts"],"names":[],"mappings":";;;;AAAA,yGAAyG;AACzG,qEAAqE;AACrE,gEAAmE;AACnE,yCAA2C;AAC3C,6CAA+C;AAC/C,0DAAoD;AACpD,2CAAoD;AAEvC,QAAA,eAAe,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,mBAAmB;IAChC,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,mUAAmU,EAAE,UAAU,EAAE,IAAI,EAAE;IAClX,KAAK,EAAE;QACL,SAAS,EAAE,yBAAiB;QAC5B,WAAW,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACnC,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,iBAAiB;YAC9B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACP,OAAO,EAAE;oBACP,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,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declare const bokioAuth: import("@agnocon/pieces-framework").CustomAuthProperty<{
|
|
2
|
+
companyId: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
3
|
+
api_key: import("@agnocon/pieces-framework").ShortTextProperty<true>;
|
|
4
|
+
}>;
|
|
5
|
+
//# sourceMappingURL=auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/lib/common/auth.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,SAAS;;;EAuCpB,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.bokioAuth = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bokio/src/lib/common/auth.ts (MIT).
|
|
6
|
+
// Generated by packages/scripts/vendor-ap.mjs - do not edit by hand.
|
|
7
|
+
const pieces_framework_1 = require("@agnocon/pieces-framework");
|
|
8
|
+
const client_1 = require("./client");
|
|
9
|
+
const pieces_common_1 = require("@agnocon/pieces-common");
|
|
10
|
+
exports.bokioAuth = pieces_framework_1.PieceAuth.CustomAuth({
|
|
11
|
+
displayName: 'Bokio API Key',
|
|
12
|
+
description: 'Bokio API Key is required to authenticate requests to Bokio',
|
|
13
|
+
required: true,
|
|
14
|
+
props: {
|
|
15
|
+
companyId: pieces_framework_1.Property.ShortText({
|
|
16
|
+
displayName: 'Company ID',
|
|
17
|
+
description: 'Enter your Bokio Company ID ',
|
|
18
|
+
required: true,
|
|
19
|
+
}),
|
|
20
|
+
api_key: pieces_framework_1.Property.ShortText({
|
|
21
|
+
displayName: 'API Key',
|
|
22
|
+
description: 'Enter your Bokio API Key',
|
|
23
|
+
required: true,
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
validate: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
27
|
+
if (auth) {
|
|
28
|
+
try {
|
|
29
|
+
yield (0, client_1.makeRequest)(auth.api_key, pieces_common_1.HttpMethod.GET, `/companies/${auth.companyId}/journal-entries`);
|
|
30
|
+
return {
|
|
31
|
+
valid: true,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
catch (e) {
|
|
35
|
+
return {
|
|
36
|
+
valid: false,
|
|
37
|
+
error: 'Invalid Api Key',
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
valid: false,
|
|
43
|
+
error: 'Invalid Api Key',
|
|
44
|
+
};
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=auth.js.map
|