@activepieces/piece-mautic 0.5.4 → 0.5.6
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/package.json +7 -23
- package/src/index.js +14 -66
- package/README.md +0 -33
- package/src/index.d.ts +0 -10
- package/src/index.js.map +0 -1
- package/src/lib/actions/create-company.d.ts +0 -11
- package/src/lib/actions/create-company.js +0 -34
- package/src/lib/actions/create-company.js.map +0 -1
- package/src/lib/actions/create-contact.d.ts +0 -27
- package/src/lib/actions/create-contact.js +0 -34
- package/src/lib/actions/create-contact.js.map +0 -1
- package/src/lib/actions/index.d.ts +0 -6
- package/src/lib/actions/index.js +0 -16
- package/src/lib/actions/index.js.map +0 -1
- package/src/lib/actions/search-company.d.ts +0 -11
- package/src/lib/actions/search-company.js +0 -33
- package/src/lib/actions/search-company.js.map +0 -1
- package/src/lib/actions/search-contact.d.ts +0 -27
- package/src/lib/actions/search-contact.js +0 -35
- package/src/lib/actions/search-contact.js.map +0 -1
- package/src/lib/actions/update-company.d.ts +0 -12
- package/src/lib/actions/update-company.js +0 -43
- package/src/lib/actions/update-company.js.map +0 -1
- package/src/lib/actions/update-contact.d.ts +0 -28
- package/src/lib/actions/update-contact.js +0 -34
- package/src/lib/actions/update-contact.js.map +0 -1
- package/src/lib/common/helper.d.ts +0 -11
- package/src/lib/common/helper.js +0 -90
- package/src/lib/common/helper.js.map +0 -1
- package/src/lib/common/index.d.ts +0 -30
- package/src/lib/common/index.js +0 -32
- package/src/lib/common/index.js.map +0 -1
- package/src/lib/triggers/index.d.ts +0 -30
- package/src/lib/triggers/index.js +0 -414
- package/src/lib/triggers/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/actions/create-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAIqC;AACrC,sCAAyC;AACzC,6BAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,qCAAqC,EAAE,gEAAgE;IACpH,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE;QACL,MAAM,EAAE,qBAAY,CAAC,aAAa;KACnC;IACD,GAAG,EAAE,UAAgB,OAAO;;YAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5D,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,GAAG,EACD,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC;oBACpD,kBAAkB;gBACpB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;gBAC/C,OAAO,EAAE;oBACP,aAAa,EACX,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBACtE,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { createContact } from './create-contact';
|
|
2
|
-
export { searchContact } from './search-contact';
|
|
3
|
-
export { updateContact } from './update-contact';
|
|
4
|
-
export { createCompany } from './create-company';
|
|
5
|
-
export { searchCompany } from './search-company';
|
|
6
|
-
export { updateCompany } from './update-company';
|
package/src/lib/actions/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateCompany = exports.searchCompany = exports.createCompany = exports.updateContact = exports.searchContact = exports.createContact = void 0;
|
|
4
|
-
var create_contact_1 = require("./create-contact");
|
|
5
|
-
Object.defineProperty(exports, "createContact", { enumerable: true, get: function () { return create_contact_1.createContact; } });
|
|
6
|
-
var search_contact_1 = require("./search-contact");
|
|
7
|
-
Object.defineProperty(exports, "searchContact", { enumerable: true, get: function () { return search_contact_1.searchContact; } });
|
|
8
|
-
var update_contact_1 = require("./update-contact");
|
|
9
|
-
Object.defineProperty(exports, "updateContact", { enumerable: true, get: function () { return update_contact_1.updateContact; } });
|
|
10
|
-
var create_company_1 = require("./create-company");
|
|
11
|
-
Object.defineProperty(exports, "createCompany", { enumerable: true, get: function () { return create_company_1.createCompany; } });
|
|
12
|
-
var search_company_1 = require("./search-company");
|
|
13
|
-
Object.defineProperty(exports, "searchCompany", { enumerable: true, get: function () { return search_company_1.searchCompany; } });
|
|
14
|
-
var update_company_1 = require("./update-company");
|
|
15
|
-
Object.defineProperty(exports, "updateCompany", { enumerable: true, get: function () { return update_company_1.updateCompany; } });
|
|
16
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/actions/index.ts"],"names":[],"mappings":";;;AAAA,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA;AACtB,mDAAiD;AAAxC,+GAAA,aAAa,OAAA"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export declare const searchCompany: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {
|
|
6
|
-
fields: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
7
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
10
|
-
}>>;
|
|
11
|
-
}>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchCompany = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
exports.searchCompany = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: __1.mauticAuth,
|
|
10
|
-
description: 'Search for a company in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.
|
|
11
|
-
displayName: 'Search Company',
|
|
12
|
-
name: 'search_mautic_company',
|
|
13
|
-
props: {
|
|
14
|
-
fields: common_1.mauticCommon.companyFields,
|
|
15
|
-
},
|
|
16
|
-
run: function (context) {
|
|
17
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const { base_url, username, password } = context.auth.props;
|
|
19
|
-
const url = (base_url.endsWith('/') ? base_url : base_url + '/') + 'api/companies';
|
|
20
|
-
const fields = context.propsValue.fields;
|
|
21
|
-
const keys = Object.keys(fields);
|
|
22
|
-
let searchParams = '?';
|
|
23
|
-
for (const key of keys) {
|
|
24
|
-
if (fields[key]) {
|
|
25
|
-
searchParams += `search=${key}:${fields[key]}&`;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
const response = yield (0, common_1.searchEntity)(url, searchParams, username, password);
|
|
29
|
-
return Object.values(response.body.companies)[0];
|
|
30
|
-
});
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
//# sourceMappingURL=search-company.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-company.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/actions/search-company.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,sCAAuD;AACvD,6BAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,oCAAoC,EAAE,gEAAgE;IACnH,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE;QACL,MAAM,EAAE,qBAAY,CAAC,aAAa;KACnC;IACD,GAAG,EAAE,UAAgB,OAAO;;YAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5D,MAAM,GAAG,GACP,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,eAAe,CAAC;YACzE,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,IAAI,YAAY,GAAG,GAAG,CAAC;YACvB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChB,YAAY,IAAI,UAAU,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;gBAClD,CAAC;YACH,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAY,EAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
export declare const searchContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {
|
|
6
|
-
fields: {
|
|
7
|
-
description?: string | undefined;
|
|
8
|
-
displayName: string;
|
|
9
|
-
auth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>;
|
|
14
|
-
props: (propsValue: Record<string, unknown> & {
|
|
15
|
-
auth?: import("dist/packages/shared/src").CustomAuthConnectionValue<import("@activepieces/pieces-framework").StaticPropsValue<{
|
|
16
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
17
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
18
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
19
|
-
}>> | undefined;
|
|
20
|
-
}, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").InputPropertyMap>;
|
|
21
|
-
refreshers: string[];
|
|
22
|
-
valueSchema: import("@activepieces/pieces-framework").DynamicPropsValue;
|
|
23
|
-
type: import("@activepieces/pieces-framework").PropertyType.DYNAMIC;
|
|
24
|
-
required: true;
|
|
25
|
-
defaultValue?: unknown;
|
|
26
|
-
};
|
|
27
|
-
}>;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchContact = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const common_1 = require("../common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
exports.searchContact = (0, pieces_framework_1.createAction)({
|
|
9
|
-
auth: __1.mauticAuth,
|
|
10
|
-
description: 'Search for a contact in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.
|
|
11
|
-
displayName: 'Search Contact',
|
|
12
|
-
name: 'search_mautic_contact',
|
|
13
|
-
props: {
|
|
14
|
-
fields: common_1.mauticCommon.contactFields,
|
|
15
|
-
},
|
|
16
|
-
run: function (context) {
|
|
17
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
18
|
-
const { base_url, username, password } = context.auth.props;
|
|
19
|
-
const url = (base_url.endsWith('/') ? base_url : base_url + '/') + 'api/contacts';
|
|
20
|
-
const fields = context.propsValue.fields;
|
|
21
|
-
const keys = Object.keys(fields);
|
|
22
|
-
let count = 0;
|
|
23
|
-
let searchParams = '?';
|
|
24
|
-
for (const key of keys) {
|
|
25
|
-
if (fields[key]) {
|
|
26
|
-
searchParams += `where[${count}][col]=${key}&where[${count}][expr]=eq&where[${count}][val]=${fields[key]}&`;
|
|
27
|
-
++count;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const response = yield (0, common_1.searchEntity)(url, searchParams, username, password);
|
|
31
|
-
return Object.values(response.body.contacts)[0];
|
|
32
|
-
});
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=search-contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"search-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/actions/search-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,sCAAuD;AACvD,6BAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,oCAAoC,EAAE,gEAAgE;IACnH,WAAW,EAAE,gBAAgB;IAC7B,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE;QACL,MAAM,EAAE,qBAAY,CAAC,aAAa;KACnC;IACD,GAAG,EAAE,UAAgB,OAAO;;YAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5D,MAAM,GAAG,GACP,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,CAAC,GAAG,cAAc,CAAC;YACxE,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,IAAI,KAAK,GAAG,CAAC,CAAC;YACd,IAAI,YAAY,GAAG,GAAG,CAAC;YACvB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;oBAChB,YAAY,IAAI,SAAS,KAAK,UAAU,GAAG,UAAU,KAAK,oBAAoB,KAAK,UAAU,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC;oBAC5G,EAAE,KAAK,CAAC;gBACV,CAAC;YACH,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAY,EAAC,GAAG,EAAE,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;YAC3E,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAClD,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export declare const updateCompany: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {
|
|
6
|
-
id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
fields: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>>;
|
|
12
|
-
}>;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateCompany = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const __1 = require("../..");
|
|
9
|
-
exports.updateCompany = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: __1.mauticAuth,
|
|
11
|
-
description: 'Update a company in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.
|
|
12
|
-
displayName: 'Update Company With Contact Id',
|
|
13
|
-
name: 'update_mautic_company',
|
|
14
|
-
props: {
|
|
15
|
-
id: common_1.mauticCommon.id,
|
|
16
|
-
fields: common_1.mauticCommon.companyFields,
|
|
17
|
-
},
|
|
18
|
-
run: function (context) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const { base_url, username, password } = context.auth.props;
|
|
21
|
-
// This is intentionally done because for `null` data Mautic doesn't change data for contacts but
|
|
22
|
-
// for the same it changes data for companies. This step is taken to ensure both behave the same.
|
|
23
|
-
const fields = context.propsValue.fields;
|
|
24
|
-
const keys = Object.keys(fields);
|
|
25
|
-
for (const key of keys) {
|
|
26
|
-
if (!fields[key]) {
|
|
27
|
-
delete fields[key];
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
const request = {
|
|
31
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
32
|
-
url: `${base_url.endsWith('/') ? base_url : base_url + '/'}api/companies/${context.propsValue.id}/edit`,
|
|
33
|
-
body: JSON.stringify(fields),
|
|
34
|
-
headers: {
|
|
35
|
-
Authorization: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),
|
|
36
|
-
'Content-Type': 'application/json',
|
|
37
|
-
},
|
|
38
|
-
};
|
|
39
|
-
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
40
|
-
});
|
|
41
|
-
},
|
|
42
|
-
});
|
|
43
|
-
//# sourceMappingURL=update-company.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-company.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/actions/update-company.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAIqC;AACrC,sCAAyC;AACzC,6BAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,gCAAgC,EAAE,gEAAgE;IAC/G,WAAW,EAAE,gCAAgC;IAC7C,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE;QACL,EAAE,EAAE,qBAAY,CAAC,EAAE;QACnB,MAAM,EAAE,qBAAY,CAAC,aAAa;KACnC;IACD,GAAG,EAAE,UAAgB,OAAO;;YAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5D,iGAAiG;YACjG,iGAAiG;YACjG,MAAM,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;YACzC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACjC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;gBACvB,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;oBACjB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;gBACrB,CAAC;YACH,CAAC;YACD,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,GACH,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,GACjD,iBAAiB,OAAO,CAAC,UAAU,CAAC,EAAE,OAAO;gBAC7C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;gBAC5B,OAAO,EAAE;oBACP,aAAa,EACX,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBACtE,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
export declare const updateContact: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
2
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
3
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
5
|
-
}>, {
|
|
6
|
-
id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
fields: {
|
|
8
|
-
description?: string | undefined;
|
|
9
|
-
displayName: string;
|
|
10
|
-
auth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
11
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
14
|
-
}>;
|
|
15
|
-
props: (propsValue: Record<string, unknown> & {
|
|
16
|
-
auth?: import("dist/packages/shared/src").CustomAuthConnectionValue<import("@activepieces/pieces-framework").StaticPropsValue<{
|
|
17
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
18
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
20
|
-
}>> | undefined;
|
|
21
|
-
}, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").InputPropertyMap>;
|
|
22
|
-
refreshers: string[];
|
|
23
|
-
valueSchema: import("@activepieces/pieces-framework").DynamicPropsValue;
|
|
24
|
-
type: import("@activepieces/pieces-framework").PropertyType.DYNAMIC;
|
|
25
|
-
required: true;
|
|
26
|
-
defaultValue?: unknown;
|
|
27
|
-
};
|
|
28
|
-
}>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateContact = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const common_1 = require("../common");
|
|
8
|
-
const __1 = require("../..");
|
|
9
|
-
exports.updateContact = (0, pieces_framework_1.createAction)({
|
|
10
|
-
auth: __1.mauticAuth,
|
|
11
|
-
description: 'Update a contact in Mautic CRM', // Must be a unique across the piece, this shouldn't be changed.
|
|
12
|
-
displayName: 'Update Contact With Contact Id',
|
|
13
|
-
name: 'update_mautic_contact',
|
|
14
|
-
props: {
|
|
15
|
-
id: common_1.mauticCommon.id,
|
|
16
|
-
fields: common_1.mauticCommon.contactFields,
|
|
17
|
-
},
|
|
18
|
-
run: function (context) {
|
|
19
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
20
|
-
const { base_url, username, password } = context.auth.props;
|
|
21
|
-
const request = {
|
|
22
|
-
method: pieces_common_1.HttpMethod.PATCH,
|
|
23
|
-
url: `${base_url.endsWith('/') ? base_url : base_url + '/'}api/contacts/${context.propsValue.id}/edit`,
|
|
24
|
-
body: JSON.stringify(context.propsValue.fields),
|
|
25
|
-
headers: {
|
|
26
|
-
Authorization: 'Basic ' + Buffer.from(`${username}:${password}`).toString('base64'),
|
|
27
|
-
'Content-Type': 'application/json',
|
|
28
|
-
},
|
|
29
|
-
};
|
|
30
|
-
return yield pieces_common_1.httpClient.sendRequest(request);
|
|
31
|
-
});
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
//# sourceMappingURL=update-contact.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-contact.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/actions/update-contact.ts"],"names":[],"mappings":";;;;AAAA,qEAA8D;AAC9D,+DAIqC;AACrC,sCAAyC;AACzC,6BAAmC;AAEtB,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACxC,IAAI,EAAE,cAAU;IAChB,WAAW,EAAE,gCAAgC,EAAE,gEAAgE;IAC/G,WAAW,EAAE,gCAAgC;IAC7C,IAAI,EAAE,uBAAuB;IAC7B,KAAK,EAAE;QACL,EAAE,EAAE,qBAAY,CAAC,EAAE;QACnB,MAAM,EAAE,qBAAY,CAAC,aAAa;KACnC;IACD,GAAG,EAAE,UAAgB,OAAO;;YAC1B,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC;YAC5D,MAAM,OAAO,GAAgB;gBAC3B,MAAM,EAAE,0BAAU,CAAC,KAAK;gBACxB,GAAG,EAAE,GAAG,QAAQ,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,GAAG,GAAG,gBACxD,OAAO,CAAC,UAAU,CAAC,EACrB,OAAO;gBACP,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,MAAM,CAAC;gBAC/C,OAAO,EAAE;oBACP,aAAa,EACX,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC;oBACtE,cAAc,EAAE,kBAAkB;iBACnC;aACF,CAAC;YACF,OAAO,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;QAC/C,CAAC;KAAA;CACF,CAAC,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { DynamicPropsValue } from '@activepieces/pieces-framework';
|
|
2
|
-
export declare const mapMauticToActivepiecesProperty: (type: string, fieldMetadata: {
|
|
3
|
-
displayName: string;
|
|
4
|
-
required: boolean;
|
|
5
|
-
}, properties: object) => import("@activepieces/pieces-framework").ShortTextProperty<false> | import("@activepieces/pieces-framework").ShortTextProperty<true> | import("@activepieces/pieces-framework").DateTimeProperty<false> | import("@activepieces/pieces-framework").DateTimeProperty<true> | import("@activepieces/pieces-framework").NumberProperty<false> | import("@activepieces/pieces-framework").NumberProperty<true> | import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<unknown, false> | import("@activepieces/pieces-framework").StaticMultiSelectDropdownProperty<unknown, true> | import("@activepieces/pieces-framework").StaticDropdownProperty<unknown, false> | import("@activepieces/pieces-framework").StaticDropdownProperty<unknown, true> | null;
|
|
6
|
-
export declare const fetchDynamicFieldsFromMetadata: (baseUrl: string, username: string, password: string, type: "contact" | "company" | "lead") => Promise<DynamicPropsValue>;
|
|
7
|
-
export declare const getFields: (type: "contact" | "company" | "lead") => import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
8
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
9
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
10
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
11
|
-
}>>;
|
package/src/lib/common/helper.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFields = exports.fetchDynamicFieldsFromMetadata = exports.mapMauticToActivepiecesProperty = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
|
-
const __1 = require("../..");
|
|
8
|
-
// Function Section
|
|
9
|
-
const mapMauticToActivepiecesProperty = (type, fieldMetadata, properties) => {
|
|
10
|
-
switch (type) {
|
|
11
|
-
case 'lookup':
|
|
12
|
-
case 'text':
|
|
13
|
-
case 'email':
|
|
14
|
-
case 'tel':
|
|
15
|
-
case 'region':
|
|
16
|
-
case 'country':
|
|
17
|
-
case 'locale':
|
|
18
|
-
case 'timezone':
|
|
19
|
-
case 'url':
|
|
20
|
-
return pieces_framework_1.Property.ShortText(fieldMetadata);
|
|
21
|
-
case 'date':
|
|
22
|
-
case 'datetime':
|
|
23
|
-
return pieces_framework_1.Property.DateTime(fieldMetadata);
|
|
24
|
-
case 'number':
|
|
25
|
-
return pieces_framework_1.Property.Number(fieldMetadata);
|
|
26
|
-
case 'boolean':
|
|
27
|
-
return pieces_framework_1.Property.StaticDropdown(Object.assign(Object.assign({}, fieldMetadata), { options: {
|
|
28
|
-
options: [
|
|
29
|
-
{ value: 'no', label: 'No' },
|
|
30
|
-
{ value: 'yes', label: 'Yes' },
|
|
31
|
-
],
|
|
32
|
-
} }));
|
|
33
|
-
case 'multiselect':
|
|
34
|
-
return pieces_framework_1.Property.StaticMultiSelectDropdown(Object.assign(Object.assign({}, fieldMetadata), { options: {
|
|
35
|
-
options: Object.values(properties)[0],
|
|
36
|
-
} }));
|
|
37
|
-
case 'select':
|
|
38
|
-
return pieces_framework_1.Property.StaticDropdown(Object.assign(Object.assign({}, fieldMetadata), { options: {
|
|
39
|
-
options: Object.values(properties)[0],
|
|
40
|
-
} }));
|
|
41
|
-
default:
|
|
42
|
-
console.error(`No support of type ${type}`);
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
exports.mapMauticToActivepiecesProperty = mapMauticToActivepiecesProperty;
|
|
47
|
-
const fetchDynamicFieldsFromMetadata = (baseUrl, username, password, type) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
48
|
-
const request = {
|
|
49
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
50
|
-
url: `${baseUrl.endsWith('/') ? baseUrl : baseUrl + '/'}api/fields/${type}?limit=1000`,
|
|
51
|
-
headers: {
|
|
52
|
-
Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
|
|
53
|
-
'Content-Type': 'application/json',
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
const result = yield pieces_common_1.httpClient.sendRequest(request);
|
|
57
|
-
if (result.status == 200) {
|
|
58
|
-
return Object.values(result.body.fields).reduce((fields, field) => {
|
|
59
|
-
const { label: displayName, alias, type, properties, } = field;
|
|
60
|
-
const fieldMetadata = {
|
|
61
|
-
displayName,
|
|
62
|
-
required: false,
|
|
63
|
-
};
|
|
64
|
-
if (!type)
|
|
65
|
-
return {};
|
|
66
|
-
const f = (0, exports.mapMauticToActivepiecesProperty)(type, fieldMetadata, properties);
|
|
67
|
-
if (f) {
|
|
68
|
-
fields[alias] = f;
|
|
69
|
-
}
|
|
70
|
-
return fields;
|
|
71
|
-
}, {});
|
|
72
|
-
}
|
|
73
|
-
throw Error(`Unable to fetch ${type} metadata`);
|
|
74
|
-
});
|
|
75
|
-
exports.fetchDynamicFieldsFromMetadata = fetchDynamicFieldsFromMetadata;
|
|
76
|
-
const getFields = (type) => pieces_framework_1.Property.DynamicProperties({
|
|
77
|
-
auth: __1.mauticAuth,
|
|
78
|
-
displayName: 'All Fields',
|
|
79
|
-
description: 'List of all possible fields present',
|
|
80
|
-
required: true,
|
|
81
|
-
refreshers: [],
|
|
82
|
-
props: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth }) {
|
|
83
|
-
if (!auth)
|
|
84
|
-
return {};
|
|
85
|
-
const { base_url, username, password } = auth.props;
|
|
86
|
-
return (0, exports.fetchDynamicFieldsFromMetadata)(base_url, username, password, type);
|
|
87
|
-
}),
|
|
88
|
-
});
|
|
89
|
-
exports.getFields = getFields;
|
|
90
|
-
//# sourceMappingURL=helper.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helper.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/common/helper.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export declare const mauticCommon: {
|
|
2
|
-
contactFields: {
|
|
3
|
-
description?: string | undefined;
|
|
4
|
-
displayName: string;
|
|
5
|
-
auth: import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
6
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
7
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
9
|
-
}>;
|
|
10
|
-
props: (propsValue: Record<string, unknown> & {
|
|
11
|
-
auth?: import("dist/packages/shared/src").CustomAuthConnectionValue<import("@activepieces/pieces-framework").StaticPropsValue<{
|
|
12
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
13
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
14
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
15
|
-
}>> | undefined;
|
|
16
|
-
}, ctx: import("@activepieces/pieces-framework").PropertyContext) => Promise<import("@activepieces/pieces-framework").InputPropertyMap>;
|
|
17
|
-
refreshers: string[];
|
|
18
|
-
valueSchema: import("@activepieces/pieces-framework").DynamicPropsValue;
|
|
19
|
-
type: import("@activepieces/pieces-framework").PropertyType.DYNAMIC;
|
|
20
|
-
required: true;
|
|
21
|
-
defaultValue?: unknown;
|
|
22
|
-
};
|
|
23
|
-
companyFields: import("@activepieces/pieces-framework").DynamicProperties<true, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
24
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
26
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
-
}>>;
|
|
28
|
-
id: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
-
};
|
|
30
|
-
export declare const searchEntity: (url: string, searchParams: string, username: string, password: string) => Promise<Record<string, any>>;
|
package/src/lib/common/index.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.searchEntity = exports.mauticCommon = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
6
|
-
const helper_1 = require("./helper");
|
|
7
|
-
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
8
|
-
exports.mauticCommon = {
|
|
9
|
-
contactFields: Object.assign(Object.assign({}, (0, helper_1.getFields)('contact')), (0, helper_1.getFields)('lead')),
|
|
10
|
-
companyFields: (0, helper_1.getFields)('company'),
|
|
11
|
-
id: pieces_framework_1.Property.ShortText({
|
|
12
|
-
displayName: 'Id of the entity',
|
|
13
|
-
required: true,
|
|
14
|
-
}),
|
|
15
|
-
};
|
|
16
|
-
const searchEntity = (url, searchParams, username, password) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
|
|
17
|
-
const request = {
|
|
18
|
-
method: pieces_common_1.HttpMethod.GET,
|
|
19
|
-
url: `${url}${searchParams}`,
|
|
20
|
-
headers: {
|
|
21
|
-
Authorization: `Basic ${Buffer.from(`${username}:${password}`).toString('base64')}`,
|
|
22
|
-
'Content-Type': 'application/json',
|
|
23
|
-
},
|
|
24
|
-
};
|
|
25
|
-
const response = yield pieces_common_1.httpClient.sendRequest(request);
|
|
26
|
-
const length = response.body.total;
|
|
27
|
-
if (!length || length != 1)
|
|
28
|
-
throw Error('The query is not perfect enough to get single result. Please refine');
|
|
29
|
-
return response;
|
|
30
|
-
});
|
|
31
|
-
exports.searchEntity = searchEntity;
|
|
32
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/mautic/src/lib/common/index.ts"],"names":[],"mappings":";;;;AAAA,qEAA0D;AAC1D,qCAAqC;AACrC,+DAIqC;AAExB,QAAA,YAAY,GAAG;IAC1B,aAAa,kCAAO,IAAA,kBAAS,EAAC,SAAS,CAAC,GAAK,IAAA,kBAAS,EAAC,MAAM,CAAC,CAAE;IAChE,aAAa,EAAE,IAAA,kBAAS,EAAC,SAAS,CAAC;IACnC,EAAE,EAAE,2BAAQ,CAAC,SAAS,CAAC;QACrB,WAAW,EAAE,kBAAkB;QAC/B,QAAQ,EAAE,IAAI;KACf,CAAC;CACH,CAAC;AAEK,MAAM,YAAY,GAAG,CAC1B,GAAW,EACX,YAAoB,EACpB,QAAgB,EAChB,QAAgB,EAChB,EAAE;IACF,MAAM,OAAO,GAAgB;QAC3B,MAAM,EAAE,0BAAU,CAAC,GAAG;QACtB,GAAG,EAAE,GAAG,GAAG,GAAG,YAAY,EAAE;QAC5B,OAAO,EAAE;YACP,aAAa,EAAE,SAAS,MAAM,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,QAAQ,EAAE,CAAC,CAAC,QAAQ,CACrE,QAAQ,CACT,EAAE;YACH,cAAc,EAAE,kBAAkB;SACnC;KACF,CAAC;IACF,MAAM,QAAQ,GAAwB,MAAM,0BAAU,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;IACnC,IAAI,CAAC,MAAM,IAAI,MAAM,IAAI,CAAC;QACxB,MAAM,KAAK,CACT,qEAAqE,CACtE,CAAC;IACJ,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAA,CAAC;AAvBW,QAAA,YAAY,gBAuBvB"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { TriggerStrategy } from "@activepieces/pieces-framework";
|
|
2
|
-
export declare const triggers: (import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
3
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
4
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
5
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
6
|
-
}>, {
|
|
7
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
8
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
9
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.POLLING, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
10
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
11
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
12
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
13
|
-
}>, {
|
|
14
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
15
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
16
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.MANUAL, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
17
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
18
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
19
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
20
|
-
}>, {
|
|
21
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
22
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
23
|
-
}> | import("@activepieces/pieces-framework").ITrigger<TriggerStrategy.APP_WEBHOOK, import("@activepieces/pieces-framework").CustomAuthProperty<{
|
|
24
|
-
base_url: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
25
|
-
username: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
26
|
-
password: import("@activepieces/pieces-framework").SecretTextProperty<true>;
|
|
27
|
-
}>, {
|
|
28
|
-
name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
|
|
29
|
-
description: import("@activepieces/pieces-framework").LongTextProperty<true>;
|
|
30
|
-
}>)[];
|