@agnocon/piece-bexio 0.1.7
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 +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +93 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/actions/create-company.d.ts +28 -0
- package/dist/lib/actions/create-company.d.ts.map +1 -0
- package/dist/lib/actions/create-company.js +461 -0
- package/dist/lib/actions/create-company.js.map +1 -0
- package/dist/lib/actions/create-file.d.ts +4 -0
- package/dist/lib/actions/create-file.d.ts.map +1 -0
- package/dist/lib/actions/create-file.js +48 -0
- package/dist/lib/actions/create-file.js.map +1 -0
- package/dist/lib/actions/create-manual-entry.d.ts +7 -0
- package/dist/lib/actions/create-manual-entry.d.ts.map +1 -0
- package/dist/lib/actions/create-manual-entry.js +426 -0
- package/dist/lib/actions/create-manual-entry.js.map +1 -0
- package/dist/lib/actions/create-person.d.ts +30 -0
- package/dist/lib/actions/create-person.d.ts.map +1 -0
- package/dist/lib/actions/create-person.js +477 -0
- package/dist/lib/actions/create-person.js.map +1 -0
- package/dist/lib/actions/create-product.d.ts +34 -0
- package/dist/lib/actions/create-product.d.ts.map +1 -0
- package/dist/lib/actions/create-product.js +527 -0
- package/dist/lib/actions/create-product.js.map +1 -0
- package/dist/lib/actions/create-project.d.ts +17 -0
- package/dist/lib/actions/create-project.d.ts.map +1 -0
- package/dist/lib/actions/create-project.js +316 -0
- package/dist/lib/actions/create-project.js.map +1 -0
- package/dist/lib/actions/create-sales-invoice.d.ts +25 -0
- package/dist/lib/actions/create-sales-invoice.d.ts.map +1 -0
- package/dist/lib/actions/create-sales-invoice.js +615 -0
- package/dist/lib/actions/create-sales-invoice.js.map +1 -0
- package/dist/lib/actions/create-sales-order.d.ts +25 -0
- package/dist/lib/actions/create-sales-order.d.ts.map +1 -0
- package/dist/lib/actions/create-sales-order.js +642 -0
- package/dist/lib/actions/create-sales-order.js.map +1 -0
- package/dist/lib/actions/create-sales-quote.d.ts +28 -0
- package/dist/lib/actions/create-sales-quote.d.ts.map +1 -0
- package/dist/lib/actions/create-sales-quote.js +666 -0
- package/dist/lib/actions/create-sales-quote.js.map +1 -0
- package/dist/lib/actions/create-time-tracking.d.ts +17 -0
- package/dist/lib/actions/create-time-tracking.d.ts.map +1 -0
- package/dist/lib/actions/create-time-tracking.js +380 -0
- package/dist/lib/actions/create-time-tracking.js.map +1 -0
- package/dist/lib/actions/export-invoice-pdf.d.ts +5 -0
- package/dist/lib/actions/export-invoice-pdf.d.ts.map +1 -0
- package/dist/lib/actions/export-invoice-pdf.js +94 -0
- package/dist/lib/actions/export-invoice-pdf.js.map +1 -0
- package/dist/lib/actions/find-account.d.ts +6 -0
- package/dist/lib/actions/find-account.d.ts.map +1 -0
- package/dist/lib/actions/find-account.js +107 -0
- package/dist/lib/actions/find-account.js.map +1 -0
- package/dist/lib/actions/find-company.d.ts +8 -0
- package/dist/lib/actions/find-company.d.ts.map +1 -0
- package/dist/lib/actions/find-company.js +160 -0
- package/dist/lib/actions/find-company.js.map +1 -0
- package/dist/lib/actions/find-country.d.ts +7 -0
- package/dist/lib/actions/find-country.d.ts.map +1 -0
- package/dist/lib/actions/find-country.js +125 -0
- package/dist/lib/actions/find-country.js.map +1 -0
- package/dist/lib/actions/find-person.d.ts +9 -0
- package/dist/lib/actions/find-person.d.ts.map +1 -0
- package/dist/lib/actions/find-person.js +175 -0
- package/dist/lib/actions/find-person.js.map +1 -0
- package/dist/lib/actions/find-product.d.ts +7 -0
- package/dist/lib/actions/find-product.d.ts.map +1 -0
- package/dist/lib/actions/find-product.js +124 -0
- package/dist/lib/actions/find-product.js.map +1 -0
- package/dist/lib/actions/search-invoice.d.ts +7 -0
- package/dist/lib/actions/search-invoice.d.ts.map +1 -0
- package/dist/lib/actions/search-invoice.js +140 -0
- package/dist/lib/actions/search-invoice.js.map +1 -0
- package/dist/lib/actions/search-order.d.ts +7 -0
- package/dist/lib/actions/search-order.d.ts.map +1 -0
- package/dist/lib/actions/search-order.js +139 -0
- package/dist/lib/actions/search-order.js.map +1 -0
- package/dist/lib/actions/search-quote.d.ts +7 -0
- package/dist/lib/actions/search-quote.d.ts.map +1 -0
- package/dist/lib/actions/search-quote.js +140 -0
- package/dist/lib/actions/search-quote.js.map +1 -0
- package/dist/lib/actions/send-sales-invoice.d.ts +9 -0
- package/dist/lib/actions/send-sales-invoice.d.ts.map +1 -0
- package/dist/lib/actions/send-sales-invoice.js +110 -0
- package/dist/lib/actions/send-sales-invoice.js.map +1 -0
- package/dist/lib/actions/update-company.d.ts +29 -0
- package/dist/lib/actions/update-company.d.ts.map +1 -0
- package/dist/lib/actions/update-company.js +506 -0
- package/dist/lib/actions/update-company.js.map +1 -0
- package/dist/lib/actions/update-person.d.ts +31 -0
- package/dist/lib/actions/update-person.d.ts.map +1 -0
- package/dist/lib/actions/update-person.js +524 -0
- package/dist/lib/actions/update-person.js.map +1 -0
- package/dist/lib/actions/update-product.d.ts +34 -0
- package/dist/lib/actions/update-product.d.ts.map +1 -0
- package/dist/lib/actions/update-product.js +556 -0
- package/dist/lib/actions/update-product.js.map +1 -0
- package/dist/lib/auth.d.ts +2 -0
- package/dist/lib/auth.d.ts.map +1 -0
- package/dist/lib/auth.js +51 -0
- package/dist/lib/auth.js.map +1 -0
- package/dist/lib/common/client.d.ts +13 -0
- package/dist/lib/common/client.d.ts.map +1 -0
- package/dist/lib/common/client.js +64 -0
- package/dist/lib/common/client.js.map +1 -0
- package/dist/lib/common/index.d.ts +5 -0
- package/dist/lib/common/index.d.ts.map +1 -0
- package/dist/lib/common/index.js +10 -0
- package/dist/lib/common/index.js.map +1 -0
- package/dist/lib/common/props.d.ts +14 -0
- package/dist/lib/common/props.d.ts.map +1 -0
- package/dist/lib/common/props.js +118 -0
- package/dist/lib/common/props.js.map +1 -0
- package/dist/lib/common/types.d.ts +89 -0
- package/dist/lib/common/types.d.ts.map +1 -0
- package/dist/lib/common/types.js +6 -0
- package/dist/lib/common/types.js.map +1 -0
- package/dist/lib/triggers/new-order.d.ts +11 -0
- package/dist/lib/triggers/new-order.d.ts.map +1 -0
- package/dist/lib/triggers/new-order.js +152 -0
- package/dist/lib/triggers/new-order.js.map +1 -0
- package/dist/lib/triggers/new-product.d.ts +3 -0
- package/dist/lib/triggers/new-product.d.ts.map +1 -0
- package/dist/lib/triggers/new-product.js +111 -0
- package/dist/lib/triggers/new-product.js.map +1 -0
- package/dist/lib/triggers/new-project.d.ts +11 -0
- package/dist/lib/triggers/new-project.d.ts.map +1 -0
- package/dist/lib/triggers/new-project.js +141 -0
- package/dist/lib/triggers/new-project.js.map +1 -0
- package/dist/lib/triggers/new-quote.d.ts +11 -0
- package/dist/lib/triggers/new-quote.d.ts.map +1 -0
- package/dist/lib/triggers/new-quote.js +153 -0
- package/dist/lib/triggers/new-quote.js.map +1 -0
- package/dist/lib/triggers/new-sales-invoice.d.ts +11 -0
- package/dist/lib/triggers/new-sales-invoice.d.ts.map +1 -0
- package/dist/lib/triggers/new-sales-invoice.js +153 -0
- package/dist/lib/triggers/new-sales-invoice.js.map +1 -0
- package/dist/lib/triggers/new-updated-company.d.ts +3 -0
- package/dist/lib/triggers/new-updated-company.d.ts.map +1 -0
- package/dist/lib/triggers/new-updated-company.js +122 -0
- package/dist/lib/triggers/new-updated-company.js.map +1 -0
- package/dist/lib/triggers/new-updated-person.d.ts +3 -0
- package/dist/lib/triggers/new-updated-person.d.ts.map +1 -0
- package/dist/lib/triggers/new-updated-person.js +122 -0
- package/dist/lib/triggers/new-updated-person.js.map +1 -0
- package/package.json +48 -0
- package/src/index.ts +89 -0
- package/src/lib/actions/create-company.ts +464 -0
- package/src/lib/actions/create-file.ts +62 -0
- package/src/lib/actions/create-manual-entry.ts +445 -0
- package/src/lib/actions/create-person.ts +481 -0
- package/src/lib/actions/create-product.ts +563 -0
- package/src/lib/actions/create-project.ts +344 -0
- package/src/lib/actions/create-sales-invoice.ts +656 -0
- package/src/lib/actions/create-sales-order.ts +689 -0
- package/src/lib/actions/create-sales-quote.ts +713 -0
- package/src/lib/actions/create-time-tracking.ts +418 -0
- package/src/lib/actions/export-invoice-pdf.ts +104 -0
- package/src/lib/actions/find-account.ts +114 -0
- package/src/lib/actions/find-company.ts +193 -0
- package/src/lib/actions/find-country.ts +127 -0
- package/src/lib/actions/find-person.ts +208 -0
- package/src/lib/actions/find-product.ts +161 -0
- package/src/lib/actions/search-invoice.ts +157 -0
- package/src/lib/actions/search-order.ts +155 -0
- package/src/lib/actions/search-quote.ts +157 -0
- package/src/lib/actions/send-sales-invoice.ts +118 -0
- package/src/lib/actions/update-company.ts +518 -0
- package/src/lib/actions/update-person.ts +536 -0
- package/src/lib/actions/update-product.ts +594 -0
- package/src/lib/auth.ts +44 -0
- package/src/lib/common/client.ts +65 -0
- package/src/lib/common/index.ts +5 -0
- package/src/lib/common/props.ts +127 -0
- package/src/lib/common/types.ts +99 -0
- package/src/lib/triggers/new-order.ts +184 -0
- package/src/lib/triggers/new-product.ts +154 -0
- package/src/lib/triggers/new-project.ts +165 -0
- package/src/lib/triggers/new-quote.ts +186 -0
- package/src/lib/triggers/new-sales-invoice.ts +186 -0
- package/src/lib/triggers/new-updated-company.ts +161 -0
- package/src/lib/triggers/new-updated-person.ts +161 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findAccountAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bexio/src/lib/actions/find-account.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("../auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
exports.findAccountAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bexioAuth,
|
|
12
|
+
name: 'find_account',
|
|
13
|
+
displayName: 'Find Account',
|
|
14
|
+
description: 'Search for accounts using various criteria',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Searches the Bexio chart of accounts by number, name, type, or account group with operators such as contains, equals, or comparison, with paging. Use to resolve an account to its id before booking a manual entry or assigning an account on a product/position. Read-only and idempotent.', idempotent: true },
|
|
17
|
+
props: {
|
|
18
|
+
search_criteria: pieces_framework_1.Property.Array({
|
|
19
|
+
displayName: 'Search Criteria',
|
|
20
|
+
description: 'Search criteria for finding accounts',
|
|
21
|
+
required: true,
|
|
22
|
+
properties: {
|
|
23
|
+
field: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Search Field',
|
|
25
|
+
description: 'Field to search in',
|
|
26
|
+
required: true,
|
|
27
|
+
options: {
|
|
28
|
+
disabled: false,
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'Account Number', value: 'account_no' },
|
|
31
|
+
{ label: 'Account Name', value: 'name' },
|
|
32
|
+
{ label: 'Account Type', value: 'account_type' },
|
|
33
|
+
{ label: 'Account Group ID', value: 'fibu_account_group_id' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
value: pieces_framework_1.Property.ShortText({
|
|
38
|
+
displayName: 'Search Value',
|
|
39
|
+
description: 'Value to search for',
|
|
40
|
+
required: true,
|
|
41
|
+
}),
|
|
42
|
+
criteria: pieces_framework_1.Property.StaticDropdown({
|
|
43
|
+
displayName: 'Criteria',
|
|
44
|
+
description: 'Search criteria type',
|
|
45
|
+
required: false,
|
|
46
|
+
defaultValue: 'like',
|
|
47
|
+
options: {
|
|
48
|
+
disabled: false,
|
|
49
|
+
options: [
|
|
50
|
+
{ label: 'Contains (like)', value: 'like' },
|
|
51
|
+
{ label: 'Exact match (=)', value: '=' },
|
|
52
|
+
{ label: 'Exact match (equal)', value: 'equal' },
|
|
53
|
+
{ label: 'Not equal (!=)', value: '!=' },
|
|
54
|
+
{ label: 'Not equal (not_equal)', value: 'not_equal' },
|
|
55
|
+
{ label: 'Greater than (>)', value: '>' },
|
|
56
|
+
{ label: 'Greater than (greater_than)', value: 'greater_than' },
|
|
57
|
+
{ label: 'Greater or equal (>=)', value: '>=' },
|
|
58
|
+
{ label: 'Greater or equal (greater_equal)', value: 'greater_equal' },
|
|
59
|
+
{ label: 'Less than (<)', value: '<' },
|
|
60
|
+
{ label: 'Less than (less_than)', value: 'less_than' },
|
|
61
|
+
{ label: 'Less or equal (<=)', value: '<=' },
|
|
62
|
+
{ label: 'Less or equal (less_equal)', value: 'less_equal' },
|
|
63
|
+
{ label: 'Does not contain (not_like)', value: 'not_like' },
|
|
64
|
+
{ label: 'Is NULL', value: 'is_null' },
|
|
65
|
+
{ label: 'Is not NULL', value: 'not_null' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
limit: pieces_framework_1.Property.Number({
|
|
72
|
+
displayName: 'Limit',
|
|
73
|
+
description: 'Maximum number of results to return (max 2000)',
|
|
74
|
+
required: false,
|
|
75
|
+
defaultValue: 500,
|
|
76
|
+
}),
|
|
77
|
+
offset: pieces_framework_1.Property.Number({
|
|
78
|
+
displayName: 'Offset',
|
|
79
|
+
description: 'Number of results to skip',
|
|
80
|
+
required: false,
|
|
81
|
+
defaultValue: 0,
|
|
82
|
+
}),
|
|
83
|
+
},
|
|
84
|
+
run(_a) {
|
|
85
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
86
|
+
const client = new client_1.BexioClient(auth);
|
|
87
|
+
const searchCriteria = propsValue['search_criteria'];
|
|
88
|
+
const limit = propsValue['limit'];
|
|
89
|
+
const offset = propsValue['offset'];
|
|
90
|
+
const searchBody = searchCriteria.map((criteria) => ({
|
|
91
|
+
field: criteria['field'],
|
|
92
|
+
value: criteria['value'],
|
|
93
|
+
criteria: criteria['criteria'] || 'like',
|
|
94
|
+
}));
|
|
95
|
+
const queryParams = {};
|
|
96
|
+
if (limit !== undefined) {
|
|
97
|
+
queryParams['limit'] = limit.toString();
|
|
98
|
+
}
|
|
99
|
+
if (offset !== undefined) {
|
|
100
|
+
queryParams['offset'] = offset.toString();
|
|
101
|
+
}
|
|
102
|
+
const response = yield client.post('/2.0/accounts/search', searchBody, queryParams);
|
|
103
|
+
return response;
|
|
104
|
+
});
|
|
105
|
+
},
|
|
106
|
+
});
|
|
107
|
+
//# sourceMappingURL=find-account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-account.js","sourceRoot":"","sources":["../../../src/lib/actions/find-account.ts"],"names":[],"mappings":";;;;AAAA,oGAAoG;AACpG,qEAAqE;AACrE,gEAAwF;AACxF,kCAAoC;AACpC,6CAA+C;AAElC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,4CAA4C;IACzD,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,8RAA8R,EAAE,UAAU,EAAE,IAAI,EAAE;IAC7U,KAAK,EAAE;QACL,eAAe,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC9B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,sCAAsC;YACnD,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;oBAC7B,WAAW,EAAE,cAAc;oBAC3B,WAAW,EAAE,oBAAoB;oBACjC,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE;wBACP,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE;4BACP,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE;4BAChD,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAA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YAC/C,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1C,CAAC;YACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,WAAW,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC5C,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAU9B,sBAAsB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;YAErD,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const findCompanyAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
+
search_criteria: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
3
|
+
order_by: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
+
limit: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
5
|
+
offset: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
6
|
+
show_archived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
7
|
+
}>;
|
|
8
|
+
//# sourceMappingURL=find-company.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-company.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/find-company.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;;;;;EA2L5B,CAAC"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findCompanyAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bexio/src/lib/actions/find-company.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("../auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
exports.findCompanyAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bexioAuth,
|
|
12
|
+
name: 'find_company',
|
|
13
|
+
displayName: 'Find Company',
|
|
14
|
+
description: 'Search for company contacts using various criteria',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Searches Bexio contacts for companies, matching one or more field criteria (name, number, email, city, country, etc.) with operators such as contains, equals, or comparison; results are automatically filtered to company-type contacts. Use to locate a company before referencing or updating it; pick Find Country/Find Product/Find Account for those object types. Read-only and idempotent.', idempotent: true },
|
|
17
|
+
props: {
|
|
18
|
+
search_criteria: pieces_framework_1.Property.Array({
|
|
19
|
+
displayName: 'Search Criteria',
|
|
20
|
+
description: 'Search criteria for finding companies',
|
|
21
|
+
required: true,
|
|
22
|
+
properties: {
|
|
23
|
+
field: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Search Field',
|
|
25
|
+
description: 'Field to search in',
|
|
26
|
+
required: true,
|
|
27
|
+
options: {
|
|
28
|
+
disabled: false,
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'ID', value: 'id' },
|
|
31
|
+
{ label: 'Company Name', value: 'name_1' },
|
|
32
|
+
{ label: 'Company Addition', value: 'name_2' },
|
|
33
|
+
{ label: 'Contact Number', value: 'nr' },
|
|
34
|
+
{ label: 'Address', value: 'address' },
|
|
35
|
+
{ label: 'Email', value: 'mail' },
|
|
36
|
+
{ label: 'Secondary Email', value: 'mail_second' },
|
|
37
|
+
{ label: 'Postcode', value: 'postcode' },
|
|
38
|
+
{ label: 'City', value: 'city' },
|
|
39
|
+
{ label: 'Country ID', value: 'country_id' },
|
|
40
|
+
{ label: 'Contact Group IDs', value: 'contact_group_ids' },
|
|
41
|
+
{ label: 'Contact Type ID', value: 'contact_type_id' },
|
|
42
|
+
{ label: 'Updated At', value: 'updated_at' },
|
|
43
|
+
{ label: 'User ID', value: 'user_id' },
|
|
44
|
+
{ label: 'Phone', value: 'phone_fixed' },
|
|
45
|
+
{ label: 'Mobile Phone', value: 'phone_mobile' },
|
|
46
|
+
{ label: 'Fax', value: 'fax' },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
value: pieces_framework_1.Property.ShortText({
|
|
51
|
+
displayName: 'Search Value',
|
|
52
|
+
description: 'Value to search for',
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
criteria: pieces_framework_1.Property.StaticDropdown({
|
|
56
|
+
displayName: 'Criteria',
|
|
57
|
+
description: 'Search criteria type',
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 'like',
|
|
60
|
+
options: {
|
|
61
|
+
disabled: false,
|
|
62
|
+
options: [
|
|
63
|
+
{ label: 'Contains (like)', value: 'like' },
|
|
64
|
+
{ label: 'Exact match (=)', value: '=' },
|
|
65
|
+
{ label: 'Exact match (equal)', value: 'equal' },
|
|
66
|
+
{ label: 'Not equal (!=)', value: '!=' },
|
|
67
|
+
{ label: 'Not equal (not_equal)', value: 'not_equal' },
|
|
68
|
+
{ label: 'Greater than (>)', value: '>' },
|
|
69
|
+
{ label: 'Greater than (greater_than)', value: 'greater_than' },
|
|
70
|
+
{ label: 'Greater or equal (>=)', value: '>=' },
|
|
71
|
+
{ label: 'Greater or equal (greater_equal)', value: 'greater_equal' },
|
|
72
|
+
{ label: 'Less than (<)', value: '<' },
|
|
73
|
+
{ label: 'Less than (less_than)', value: 'less_than' },
|
|
74
|
+
{ label: 'Less or equal (<=)', value: '<=' },
|
|
75
|
+
{ label: 'Less or equal (less_equal)', value: 'less_equal' },
|
|
76
|
+
{ label: 'Does not contain (not_like)', value: 'not_like' },
|
|
77
|
+
{ label: 'Is NULL', value: 'is_null' },
|
|
78
|
+
{ label: 'Is not NULL', value: 'not_null' },
|
|
79
|
+
{ label: 'In (array)', value: 'in' },
|
|
80
|
+
{ label: 'Not in (array)', value: 'not_in' },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
order_by: pieces_framework_1.Property.StaticDropdown({
|
|
87
|
+
displayName: 'Order By',
|
|
88
|
+
description: 'Field to order results by',
|
|
89
|
+
required: false,
|
|
90
|
+
defaultValue: 'id',
|
|
91
|
+
options: {
|
|
92
|
+
disabled: false,
|
|
93
|
+
options: [
|
|
94
|
+
{ label: 'ID', value: 'id' },
|
|
95
|
+
{ label: 'Contact Number', value: 'nr' },
|
|
96
|
+
{ label: 'Company Name', value: 'name_1' },
|
|
97
|
+
{ label: 'Updated At', value: 'updated_at' },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
limit: pieces_framework_1.Property.Number({
|
|
102
|
+
displayName: 'Limit',
|
|
103
|
+
description: 'Maximum number of results to return (max 2000)',
|
|
104
|
+
required: false,
|
|
105
|
+
defaultValue: 500,
|
|
106
|
+
}),
|
|
107
|
+
offset: pieces_framework_1.Property.Number({
|
|
108
|
+
displayName: 'Offset',
|
|
109
|
+
description: 'Number of results to skip',
|
|
110
|
+
required: false,
|
|
111
|
+
defaultValue: 0,
|
|
112
|
+
}),
|
|
113
|
+
show_archived: pieces_framework_1.Property.Checkbox({
|
|
114
|
+
displayName: 'Show Archived',
|
|
115
|
+
description: 'Show archived contacts only',
|
|
116
|
+
required: false,
|
|
117
|
+
defaultValue: false,
|
|
118
|
+
}),
|
|
119
|
+
},
|
|
120
|
+
run(_a) {
|
|
121
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
122
|
+
const client = new client_1.BexioClient(auth);
|
|
123
|
+
const searchCriteria = propsValue['search_criteria'];
|
|
124
|
+
const orderBy = propsValue['order_by'];
|
|
125
|
+
const limit = propsValue['limit'];
|
|
126
|
+
const offset = propsValue['offset'];
|
|
127
|
+
const showArchived = propsValue['show_archived'];
|
|
128
|
+
const searchBody = searchCriteria.map((criteria) => ({
|
|
129
|
+
field: criteria['field'],
|
|
130
|
+
value: criteria['value'],
|
|
131
|
+
criteria: criteria['criteria'] || 'like',
|
|
132
|
+
}));
|
|
133
|
+
// Add contact_type_id filter to only return companies if not already specified
|
|
134
|
+
const hasContactTypeFilter = searchCriteria.some((criteria) => criteria['field'] === 'contact_type_id');
|
|
135
|
+
if (!hasContactTypeFilter) {
|
|
136
|
+
searchBody.push({
|
|
137
|
+
field: 'contact_type_id',
|
|
138
|
+
value: '1',
|
|
139
|
+
criteria: '=',
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
const queryParams = {};
|
|
143
|
+
if (orderBy) {
|
|
144
|
+
queryParams['order_by'] = orderBy;
|
|
145
|
+
}
|
|
146
|
+
if (limit !== undefined) {
|
|
147
|
+
queryParams['limit'] = limit.toString();
|
|
148
|
+
}
|
|
149
|
+
if (offset !== undefined) {
|
|
150
|
+
queryParams['offset'] = offset.toString();
|
|
151
|
+
}
|
|
152
|
+
if (showArchived !== undefined) {
|
|
153
|
+
queryParams['show_archived'] = showArchived.toString();
|
|
154
|
+
}
|
|
155
|
+
const response = yield client.post('/2.0/contact/search', searchBody, queryParams);
|
|
156
|
+
return response;
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
});
|
|
160
|
+
//# sourceMappingURL=find-company.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-company.js","sourceRoot":"","sources":["../../../src/lib/actions/find-company.ts"],"names":[],"mappings":";;;;AAAA,oGAAoG;AACpG,qEAAqE;AACrE,gEAAwF;AACxF,kCAAoC;AACpC,6CAA+C;AAElC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,cAAc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1B,UAAU,CAAC,IAAI,CAAC;oBACd,KAAK,EAAE,iBAAiB;oBACxB,KAAK,EAAE,GAAG;oBACV,QAAQ,EAAE,GAAG;iBACd,CAAC,CAAC;YACL,CAAC;YAED,MAAM,WAAW,GAA2B,EAAE,CAAC;YAC/C,IAAI,OAAO,EAAE,CAAC;gBACZ,WAAW,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;YACpC,CAAC;YACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1C,CAAC;YACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,WAAW,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC5C,CAAC;YACD,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;gBAC/B,WAAW,CAAC,eAAe,CAAC,GAAG,YAAY,CAAC,QAAQ,EAAE,CAAC;YACzD,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAiC9B,qBAAqB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;YAEpD,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const findCountryAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
+
search_criteria: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
3
|
+
order_by: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
+
limit: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
5
|
+
offset: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
6
|
+
}>;
|
|
7
|
+
//# sourceMappingURL=find-country.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-country.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/find-country.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB;;;;;EAyH5B,CAAC"}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findCountryAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bexio/src/lib/actions/find-country.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("../auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
exports.findCountryAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bexioAuth,
|
|
12
|
+
name: 'find_country',
|
|
13
|
+
displayName: 'Find Country',
|
|
14
|
+
description: 'Search for countries using various criteria',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Searches the Bexio country list by name or short code with operators such as contains or equals. Use to resolve a country to its id before setting country_id on a contact or other record. Read-only and idempotent.', idempotent: true },
|
|
17
|
+
props: {
|
|
18
|
+
search_criteria: pieces_framework_1.Property.Array({
|
|
19
|
+
displayName: 'Search Criteria',
|
|
20
|
+
description: 'Search criteria for finding countries',
|
|
21
|
+
required: true,
|
|
22
|
+
properties: {
|
|
23
|
+
field: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Search Field',
|
|
25
|
+
description: 'Field to search in',
|
|
26
|
+
required: true,
|
|
27
|
+
options: {
|
|
28
|
+
disabled: false,
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'Country Name', value: 'name' },
|
|
31
|
+
{ label: 'Country Code (Short)', value: 'name_short' },
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
}),
|
|
35
|
+
value: pieces_framework_1.Property.ShortText({
|
|
36
|
+
displayName: 'Search Value',
|
|
37
|
+
description: 'Value to search for',
|
|
38
|
+
required: true,
|
|
39
|
+
}),
|
|
40
|
+
criteria: pieces_framework_1.Property.StaticDropdown({
|
|
41
|
+
displayName: 'Criteria',
|
|
42
|
+
description: 'Search criteria type',
|
|
43
|
+
required: false,
|
|
44
|
+
defaultValue: 'like',
|
|
45
|
+
options: {
|
|
46
|
+
disabled: false,
|
|
47
|
+
options: [
|
|
48
|
+
{ label: 'Contains (like)', value: 'like' },
|
|
49
|
+
{ label: 'Exact match (=)', value: '=' },
|
|
50
|
+
{ label: 'Exact match (equal)', value: 'equal' },
|
|
51
|
+
{ label: 'Not equal (!=)', value: '!=' },
|
|
52
|
+
{ label: 'Not equal (not_equal)', value: 'not_equal' },
|
|
53
|
+
{ label: 'Greater than (>)', value: '>' },
|
|
54
|
+
{ label: 'Greater than (greater_than)', value: 'greater_than' },
|
|
55
|
+
{ label: 'Greater or equal (>=)', value: '>=' },
|
|
56
|
+
{ label: 'Greater or equal (greater_equal)', value: 'greater_equal' },
|
|
57
|
+
{ label: 'Less than (<)', value: '<' },
|
|
58
|
+
{ label: 'Less than (less_than)', value: 'less_than' },
|
|
59
|
+
{ label: 'Less or equal (<=)', value: '<=' },
|
|
60
|
+
{ label: 'Less or equal (less_equal)', value: 'less_equal' },
|
|
61
|
+
{ label: 'Does not contain (not_like)', value: 'not_like' },
|
|
62
|
+
{ label: 'Is NULL', value: 'is_null' },
|
|
63
|
+
{ label: 'Is not NULL', value: 'not_null' },
|
|
64
|
+
{ label: 'In (array)', value: 'in' },
|
|
65
|
+
{ label: 'Not in (array)', value: 'not_in' },
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
order_by: pieces_framework_1.Property.StaticDropdown({
|
|
72
|
+
displayName: 'Order By',
|
|
73
|
+
description: 'Field to order results by',
|
|
74
|
+
required: false,
|
|
75
|
+
defaultValue: 'id',
|
|
76
|
+
options: {
|
|
77
|
+
disabled: false,
|
|
78
|
+
options: [
|
|
79
|
+
{ label: 'ID', value: 'id' },
|
|
80
|
+
{ label: 'Country Name', value: 'name' },
|
|
81
|
+
{ label: 'Country Code', value: 'name_short' },
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
}),
|
|
85
|
+
limit: pieces_framework_1.Property.Number({
|
|
86
|
+
displayName: 'Limit',
|
|
87
|
+
description: 'Maximum number of results to return (max 2000)',
|
|
88
|
+
required: false,
|
|
89
|
+
defaultValue: 500,
|
|
90
|
+
}),
|
|
91
|
+
offset: pieces_framework_1.Property.Number({
|
|
92
|
+
displayName: 'Offset',
|
|
93
|
+
description: 'Number of results to skip',
|
|
94
|
+
required: false,
|
|
95
|
+
defaultValue: 0,
|
|
96
|
+
}),
|
|
97
|
+
},
|
|
98
|
+
run(_a) {
|
|
99
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
100
|
+
const client = new client_1.BexioClient(auth);
|
|
101
|
+
const searchCriteria = propsValue['search_criteria'];
|
|
102
|
+
const orderBy = propsValue['order_by'];
|
|
103
|
+
const limit = propsValue['limit'];
|
|
104
|
+
const offset = propsValue['offset'];
|
|
105
|
+
const searchBody = searchCriteria.map((criteria) => ({
|
|
106
|
+
field: criteria['field'],
|
|
107
|
+
value: criteria['value'],
|
|
108
|
+
criteria: criteria['criteria'] || 'like',
|
|
109
|
+
}));
|
|
110
|
+
const queryParams = {};
|
|
111
|
+
if (orderBy) {
|
|
112
|
+
queryParams['order_by'] = orderBy;
|
|
113
|
+
}
|
|
114
|
+
if (limit !== undefined) {
|
|
115
|
+
queryParams['limit'] = limit.toString();
|
|
116
|
+
}
|
|
117
|
+
if (offset !== undefined) {
|
|
118
|
+
queryParams['offset'] = offset.toString();
|
|
119
|
+
}
|
|
120
|
+
const response = yield client.post('/2.0/country/search', searchBody, queryParams);
|
|
121
|
+
return response;
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
//# sourceMappingURL=find-country.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-country.js","sourceRoot":"","sources":["../../../src/lib/actions/find-country.ts"],"names":[],"mappings":";;;;AAAA,oGAAoG;AACpG,qEAAqE;AACrE,gEAAwF;AACxF,kCAAoC;AACpC,6CAA+C;AAElC,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,gBAAS;IACf,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,6CAA6C;IAC1D,QAAQ,EAAE,MAAM;IAChB,UAAU,EAAE,EAAE,WAAW,EAAE,uNAAuN,EAAE,UAAU,EAAE,IAAI,EAAE;IACtQ,KAAK,EAAE;QACL,eAAe,EAAE,2BAAQ,CAAC,KAAK,CAAC;YAC9B,WAAW,EAAE,iBAAiB;YAC9B,WAAW,EAAE,uCAAuC;YACpD,QAAQ,EAAE,IAAI;YACd,UAAU,EAAE;gBACV,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;oBAC7B,WAAW,EAAE,cAAc;oBAC3B,WAAW,EAAE,oBAAoB;oBACjC,QAAQ,EAAE,IAAI;oBACd,OAAO,EAAE;wBACP,QAAQ,EAAE,KAAK;wBACf,OAAO,EAAE;4BACP,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,MAAM,EAAE;4BACxC,EAAE,KAAK,EAAE,sBAAsB,EAAE,KAAK,EAAE,YAAY,EAAE;yBACvD;qBACF;iBACF,CAAC;gBACF,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;oBACxB,WAAW,EAAE,cAAc;oBAC3B,WAAW,EAAE,qBAAqB;oBAClC,QAAQ,EAAE,IAAI;iBACf,CAAC;gBACF,QAAQ,EAAE,2BAAQ,CAAC,cAAc,CAAC;oBAChC,WAAW,EAAE,UAAU;oBACvB,WAAW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AAC;gBACnD,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAW;gBAClC,KAAK,EAAE,QAAQ,CAAC,OAAO,CAAW;gBAClC,QAAQ,EAAG,QAAQ,CAAC,UAAU,CAAY,IAAI,MAAM;aACrD,CAAC,CAAC,CAAC;YAEJ,MAAM,WAAW,GAA2B,EAAE,CAAC;YAC/C,IAAI,OAAO,EAAE,CAAC;gBACZ,WAAW,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC;YACpC,CAAC;YACD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;gBACxB,WAAW,CAAC,OAAO,CAAC,GAAG,KAAK,CAAC,QAAQ,EAAE,CAAC;YAC1C,CAAC;YACD,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;gBACzB,WAAW,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;YAC5C,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAK9B,qBAAqB,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC;YAEpD,OAAO,QAAQ,CAAC;QAClB,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare const findPersonAction: import("@agnocon/pieces-framework").IAction<import("@agnocon/pieces-framework").OAuth2Property<import("@agnocon/pieces-framework").OAuth2Props>, {
|
|
2
|
+
search_criteria: import("@agnocon/pieces-framework").ArrayProperty<true> | import("@agnocon/pieces-framework").ArrayProperty<false>;
|
|
3
|
+
order_by: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
4
|
+
order_direction: import("@agnocon/pieces-framework").StaticDropdownProperty<string, false>;
|
|
5
|
+
limit: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
6
|
+
offset: import("@agnocon/pieces-framework").NumberProperty<false>;
|
|
7
|
+
show_archived: import("@agnocon/pieces-framework").CheckboxProperty<false>;
|
|
8
|
+
}>;
|
|
9
|
+
//# sourceMappingURL=find-person.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-person.d.ts","sourceRoot":"","sources":["../../../src/lib/actions/find-person.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,gBAAgB;;;;;;;EA0M3B,CAAC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findPersonAction = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
// Vendored from Activepieces packages/pieces/community/bexio/src/lib/actions/find-person.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("../auth");
|
|
9
|
+
const client_1 = require("../common/client");
|
|
10
|
+
exports.findPersonAction = (0, pieces_framework_1.createAction)({
|
|
11
|
+
auth: auth_1.bexioAuth,
|
|
12
|
+
name: 'find_person',
|
|
13
|
+
displayName: 'Find Person',
|
|
14
|
+
description: 'Search for person contacts using various criteria',
|
|
15
|
+
audience: 'both',
|
|
16
|
+
aiMetadata: { description: 'Search Bexio person contacts (contact_type 2; companies are excluded) by one or more field/operator/value criteria such as name, email, phone, or contact number. Read-only and repeatable; returns matching person records and supports ordering, limit, and offset paging. Use to look up a person before referencing them in another action; for company contacts use the company-oriented lookup instead.', idempotent: true },
|
|
17
|
+
props: {
|
|
18
|
+
search_criteria: pieces_framework_1.Property.Array({
|
|
19
|
+
displayName: 'Search Criteria',
|
|
20
|
+
description: 'Search criteria for finding persons',
|
|
21
|
+
required: true,
|
|
22
|
+
properties: {
|
|
23
|
+
field: pieces_framework_1.Property.StaticDropdown({
|
|
24
|
+
displayName: 'Search Field',
|
|
25
|
+
description: 'Field to search in',
|
|
26
|
+
required: true,
|
|
27
|
+
options: {
|
|
28
|
+
disabled: false,
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'ID', value: 'id' },
|
|
31
|
+
{ label: 'First Name (name_1)', value: 'name_1' },
|
|
32
|
+
{ label: 'Last Name (name_2)', value: 'name_2' },
|
|
33
|
+
{ label: 'Contact Number', value: 'nr' },
|
|
34
|
+
{ label: 'Address', value: 'address' },
|
|
35
|
+
{ label: 'Email', value: 'mail' },
|
|
36
|
+
{ label: 'Secondary Email', value: 'mail_second' },
|
|
37
|
+
{ label: 'Postcode', value: 'postcode' },
|
|
38
|
+
{ label: 'City', value: 'city' },
|
|
39
|
+
{ label: 'Country ID', value: 'country_id' },
|
|
40
|
+
{ label: 'Contact Group IDs', value: 'contact_group_ids' },
|
|
41
|
+
{ label: 'Contact Type ID', value: 'contact_type_id' },
|
|
42
|
+
{ label: 'Updated At', value: 'updated_at' },
|
|
43
|
+
{ label: 'User ID', value: 'user_id' },
|
|
44
|
+
{ label: 'Fixed Phone', value: 'phone_fixed' },
|
|
45
|
+
{ label: 'Mobile Phone', value: 'phone_mobile' },
|
|
46
|
+
{ label: 'Fax', value: 'fax' },
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
}),
|
|
50
|
+
value: pieces_framework_1.Property.ShortText({
|
|
51
|
+
displayName: 'Search Value',
|
|
52
|
+
description: 'Value to search for',
|
|
53
|
+
required: true,
|
|
54
|
+
}),
|
|
55
|
+
criteria: pieces_framework_1.Property.StaticDropdown({
|
|
56
|
+
displayName: 'Criteria',
|
|
57
|
+
description: 'Search criteria type',
|
|
58
|
+
required: false,
|
|
59
|
+
defaultValue: 'like',
|
|
60
|
+
options: {
|
|
61
|
+
disabled: false,
|
|
62
|
+
options: [
|
|
63
|
+
{ label: 'Contains (like)', value: 'like' },
|
|
64
|
+
{ label: 'Exact match (=)', value: '=' },
|
|
65
|
+
{ label: 'Exact match (equal)', value: 'equal' },
|
|
66
|
+
{ label: 'Not equal (!=)', value: '!=' },
|
|
67
|
+
{ label: 'Not equal (not_equal)', value: 'not_equal' },
|
|
68
|
+
{ label: 'Greater than (>)', value: '>' },
|
|
69
|
+
{ label: 'Greater than (greater_than)', value: 'greater_than' },
|
|
70
|
+
{ label: 'Greater or equal (>=)', value: '>=' },
|
|
71
|
+
{ label: 'Greater or equal (greater_equal)', value: 'greater_equal' },
|
|
72
|
+
{ label: 'Less than (<)', value: '<' },
|
|
73
|
+
{ label: 'Less than (less_than)', value: 'less_than' },
|
|
74
|
+
{ label: 'Less or equal (<=)', value: '<=' },
|
|
75
|
+
{ label: 'Less or equal (less_equal)', value: 'less_equal' },
|
|
76
|
+
{ label: 'Does not contain (not_like)', value: 'not_like' },
|
|
77
|
+
{ label: 'Is NULL', value: 'is_null' },
|
|
78
|
+
{ label: 'Is not NULL', value: 'not_null' },
|
|
79
|
+
{ label: 'In (array of values)', value: 'in' },
|
|
80
|
+
{ label: 'Not In (array of values)', value: 'not_in' },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
}),
|
|
84
|
+
},
|
|
85
|
+
}),
|
|
86
|
+
order_by: pieces_framework_1.Property.StaticDropdown({
|
|
87
|
+
displayName: 'Order By',
|
|
88
|
+
description: 'Field to sort the results by',
|
|
89
|
+
required: false,
|
|
90
|
+
defaultValue: 'id',
|
|
91
|
+
options: {
|
|
92
|
+
disabled: false,
|
|
93
|
+
options: [
|
|
94
|
+
{ label: 'ID', value: 'id' },
|
|
95
|
+
{ label: 'Contact Number', value: 'nr' },
|
|
96
|
+
{ label: 'First Name', value: 'name_1' },
|
|
97
|
+
{ label: 'Updated At', value: 'updated_at' },
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
}),
|
|
101
|
+
order_direction: pieces_framework_1.Property.StaticDropdown({
|
|
102
|
+
displayName: 'Order Direction',
|
|
103
|
+
description: 'Sort order',
|
|
104
|
+
required: false,
|
|
105
|
+
defaultValue: 'asc',
|
|
106
|
+
options: {
|
|
107
|
+
disabled: false,
|
|
108
|
+
options: [
|
|
109
|
+
{ label: 'Ascending', value: 'asc' },
|
|
110
|
+
{ label: 'Descending', value: 'desc' },
|
|
111
|
+
],
|
|
112
|
+
},
|
|
113
|
+
}),
|
|
114
|
+
limit: pieces_framework_1.Property.Number({
|
|
115
|
+
displayName: 'Limit',
|
|
116
|
+
description: 'Maximum number of results to return (max 2000)',
|
|
117
|
+
required: false,
|
|
118
|
+
defaultValue: 500,
|
|
119
|
+
}),
|
|
120
|
+
offset: pieces_framework_1.Property.Number({
|
|
121
|
+
displayName: 'Offset',
|
|
122
|
+
description: 'Number of results to skip',
|
|
123
|
+
required: false,
|
|
124
|
+
defaultValue: 0,
|
|
125
|
+
}),
|
|
126
|
+
show_archived: pieces_framework_1.Property.Checkbox({
|
|
127
|
+
displayName: 'Show Archived',
|
|
128
|
+
description: 'Include archived contacts in the search results',
|
|
129
|
+
required: false,
|
|
130
|
+
defaultValue: false,
|
|
131
|
+
}),
|
|
132
|
+
},
|
|
133
|
+
run(_a) {
|
|
134
|
+
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth, propsValue }) {
|
|
135
|
+
const client = new client_1.BexioClient(auth);
|
|
136
|
+
const searchCriteria = propsValue['search_criteria'];
|
|
137
|
+
const orderBy = propsValue['order_by'];
|
|
138
|
+
const orderDirection = propsValue['order_direction'];
|
|
139
|
+
const limit = propsValue['limit'];
|
|
140
|
+
const offset = propsValue['offset'];
|
|
141
|
+
const showArchived = propsValue['show_archived'];
|
|
142
|
+
const finalSearchBody = [...searchCriteria];
|
|
143
|
+
// Ensure contact_type_id is 2 (person) unless explicitly overridden by user
|
|
144
|
+
const contactTypeCriteriaIndex = finalSearchBody.findIndex((criteria) => criteria['field'] === 'contact_type_id');
|
|
145
|
+
if (contactTypeCriteriaIndex === -1) {
|
|
146
|
+
finalSearchBody.push({
|
|
147
|
+
field: 'contact_type_id',
|
|
148
|
+
value: '2',
|
|
149
|
+
criteria: '=',
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
else if (finalSearchBody[contactTypeCriteriaIndex]['value'] !== '2') {
|
|
153
|
+
// If user provided a different contact_type_id, ensure it's 2 for "Find Person"
|
|
154
|
+
finalSearchBody[contactTypeCriteriaIndex]['value'] = '2';
|
|
155
|
+
finalSearchBody[contactTypeCriteriaIndex]['criteria'] = '=';
|
|
156
|
+
}
|
|
157
|
+
const queryParams = {};
|
|
158
|
+
if (orderBy) {
|
|
159
|
+
queryParams['order_by'] = `${orderBy}${orderDirection === 'desc' ? '_desc' : ''}`;
|
|
160
|
+
}
|
|
161
|
+
if (limit !== undefined) {
|
|
162
|
+
queryParams['limit'] = limit.toString();
|
|
163
|
+
}
|
|
164
|
+
if (offset !== undefined) {
|
|
165
|
+
queryParams['offset'] = offset.toString();
|
|
166
|
+
}
|
|
167
|
+
if (showArchived !== undefined) {
|
|
168
|
+
queryParams['show_archived'] = showArchived.toString();
|
|
169
|
+
}
|
|
170
|
+
const response = yield client.post('/2.0/contact/search', finalSearchBody, queryParams);
|
|
171
|
+
return response;
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
//# sourceMappingURL=find-person.js.map
|