@activepieces/piece-pipedrive 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (66) hide show
  1. package/package.json +8 -6
  2. package/src/index.js +39 -5
  3. package/src/index.js.map +1 -1
  4. package/src/lib/actions/add-label-to-person.d.ts +4 -0
  5. package/src/lib/actions/add-label-to-person.js +46 -0
  6. package/src/lib/actions/add-label-to-person.js.map +1 -0
  7. package/src/lib/actions/add-product-to-deal.d.ts +12 -0
  8. package/src/lib/actions/add-product-to-deal.js +106 -0
  9. package/src/lib/actions/add-product-to-deal.js.map +1 -0
  10. package/src/lib/actions/create-deal.d.ts +17 -0
  11. package/src/lib/actions/create-deal.js +66 -0
  12. package/src/lib/actions/create-deal.js.map +1 -0
  13. package/src/lib/actions/create-lead.d.ts +13 -0
  14. package/src/lib/actions/create-lead.js +72 -0
  15. package/src/lib/actions/create-lead.js.map +1 -0
  16. package/src/lib/actions/create-organization.d.ts +8 -0
  17. package/src/lib/actions/create-organization.js +57 -0
  18. package/src/lib/actions/create-organization.js.map +1 -0
  19. package/src/lib/actions/create-person.d.ts +13 -0
  20. package/src/lib/actions/create-person.js +68 -0
  21. package/src/lib/actions/create-person.js.map +1 -0
  22. package/src/lib/actions/create-product.d.ts +15 -0
  23. package/src/lib/actions/create-product.js +109 -0
  24. package/src/lib/actions/create-product.js.map +1 -0
  25. package/src/lib/actions/update-deal.d.ts +18 -0
  26. package/src/lib/actions/update-deal.js +66 -0
  27. package/src/lib/actions/update-deal.js.map +1 -0
  28. package/src/lib/actions/update-lead.d.ts +14 -0
  29. package/src/lib/actions/update-lead.js +69 -0
  30. package/src/lib/actions/update-lead.js.map +1 -0
  31. package/src/lib/actions/update-organization.d.ts +9 -0
  32. package/src/lib/actions/update-organization.js +58 -0
  33. package/src/lib/actions/update-organization.js.map +1 -0
  34. package/src/lib/actions/update-person.d.ts +14 -0
  35. package/src/lib/actions/update-person.js +68 -0
  36. package/src/lib/actions/update-person.js.map +1 -0
  37. package/src/lib/common/index.d.ts +13 -0
  38. package/src/lib/common/index.js +92 -0
  39. package/src/lib/common/index.js.map +1 -1
  40. package/src/lib/common/props.d.ts +69 -0
  41. package/src/lib/common/props.js +738 -0
  42. package/src/lib/common/props.js.map +1 -0
  43. package/src/lib/common/types.d.ts +44 -3
  44. package/src/lib/trigger/new-deal.js +34 -18
  45. package/src/lib/trigger/new-deal.js.map +1 -1
  46. package/src/lib/trigger/new-lead.d.ts +2 -0
  47. package/src/lib/trigger/new-lead.js +124 -0
  48. package/src/lib/trigger/new-lead.js.map +1 -0
  49. package/src/lib/trigger/new-organization.d.ts +2 -0
  50. package/src/lib/trigger/new-organization.js +160 -0
  51. package/src/lib/trigger/new-organization.js.map +1 -0
  52. package/src/lib/trigger/new-person.js +35 -11
  53. package/src/lib/trigger/new-person.js.map +1 -1
  54. package/src/lib/trigger/updated-deal-stage.d.ts +8 -0
  55. package/src/lib/trigger/updated-deal-stage.js +288 -0
  56. package/src/lib/trigger/updated-deal-stage.js.map +1 -0
  57. package/src/lib/trigger/updated-deal.js +47 -20
  58. package/src/lib/trigger/updated-deal.js.map +1 -1
  59. package/src/lib/trigger/updated-organization.d.ts +2 -0
  60. package/src/lib/trigger/updated-organization.js +160 -0
  61. package/src/lib/trigger/updated-organization.js.map +1 -0
  62. package/src/lib/trigger/updated-person.js +35 -11
  63. package/src/lib/trigger/updated-person.js.map +1 -1
  64. package/src/lib/actions/add-person.action/add-person.action.d.ts +0 -8
  65. package/src/lib/actions/add-person.action/add-person.action.js +0 -179
  66. package/src/lib/actions/add-person.action/add-person.action.js.map +0 -1
package/package.json CHANGED
@@ -1,24 +1,26 @@
1
1
  {
2
2
  "name": "@activepieces/piece-pipedrive",
3
- "version": "0.3.5",
3
+ "version": "0.4.0",
4
4
  "dependencies": {
5
- "@anthropic-ai/sdk": "0.27.3",
5
+ "@anthropic-ai/sdk": "0.33.1",
6
6
  "@sinclair/typebox": "0.34.11",
7
7
  "axios": "1.7.8",
8
8
  "axios-retry": "4.4.1",
9
- "deepmerge": "4.3.1",
9
+ "dayjs": "1.11.9",
10
+ "deepmerge-ts": "7.1.0",
10
11
  "mime-types": "2.1.35",
11
- "nanoid": "3.3.6",
12
+ "nanoid": "3.3.8",
12
13
  "openai": "4.67.1",
13
14
  "replicate": "0.34.1",
14
15
  "semver": "7.6.0",
15
16
  "zod": "3.23.8",
16
- "@activepieces/pieces-common": "0.2.37",
17
+ "@activepieces/pieces-common": "0.3.0",
17
18
  "@activepieces/pieces-framework": "0.7.42",
18
- "@activepieces/shared": "0.10.133",
19
+ "@activepieces/shared": "0.10.139",
19
20
  "tslib": "1.14.1"
20
21
  },
21
22
  "overrides": {
23
+ "cross-spawn": "7.0.6",
22
24
  "@tryfabric/martian": {
23
25
  "@notionhq/client": "$@notionhq/client"
24
26
  },
package/src/index.js CHANGED
@@ -5,18 +5,32 @@ const tslib_1 = require("tslib");
5
5
  const pieces_common_1 = require("@activepieces/pieces-common");
6
6
  const pieces_framework_1 = require("@activepieces/pieces-framework");
7
7
  const shared_1 = require("@activepieces/shared");
8
- const add_person_action_1 = require("./lib/actions/add-person.action/add-person.action");
9
8
  const new_activity_1 = require("./lib/trigger/new-activity");
10
9
  const new_deal_1 = require("./lib/trigger/new-deal");
11
10
  const new_person_1 = require("./lib/trigger/new-person");
12
11
  const updated_deal_1 = require("./lib/trigger/updated-deal");
13
12
  const updated_person_1 = require("./lib/trigger/updated-person");
13
+ const new_lead_1 = require("./lib/trigger/new-lead");
14
+ const new_organization_1 = require("./lib/trigger/new-organization");
15
+ const updated_organization_1 = require("./lib/trigger/updated-organization");
16
+ const updated_deal_stage_1 = require("./lib/trigger/updated-deal-stage");
17
+ const create_person_1 = require("./lib/actions/create-person");
18
+ const update_person_1 = require("./lib/actions/update-person");
19
+ const create_organization_1 = require("./lib/actions/create-organization");
20
+ const update_organization_1 = require("./lib/actions/update-organization");
21
+ const create_lead_1 = require("./lib/actions/create-lead");
22
+ const update_lead_1 = require("./lib/actions/update-lead");
23
+ const create_deal_1 = require("./lib/actions/create-deal");
24
+ const update_deal_1 = require("./lib/actions/update-deal");
25
+ const create_product_1 = require("./lib/actions/create-product");
26
+ const add_product_to_deal_1 = require("./lib/actions/add-product-to-deal");
27
+ const add_label_to_person_1 = require("./lib/actions/add-label-to-person");
14
28
  exports.pipedriveAuth = pieces_framework_1.PieceAuth.OAuth2({
15
29
  description: '',
16
30
  authUrl: 'https://oauth.pipedrive.com/oauth/authorize',
17
31
  tokenUrl: 'https://oauth.pipedrive.com/oauth/token',
18
32
  required: true,
19
- scope: ['admin', 'contacts:full', 'users:read', 'deals:full', 'activities:full'],
33
+ scope: ['admin', 'contacts:full', 'users:read', 'deals:full', 'activities:full', 'leads:full', 'products:full'],
20
34
  });
21
35
  exports.pipedrive = (0, pieces_framework_1.createPiece)({
22
36
  displayName: 'Pipedrive',
@@ -26,7 +40,17 @@ exports.pipedrive = (0, pieces_framework_1.createPiece)({
26
40
  categories: [shared_1.PieceCategory.SALES_AND_CRM],
27
41
  auth: exports.pipedriveAuth,
28
42
  actions: [
29
- add_person_action_1.addPerson,
43
+ add_label_to_person_1.addLabelToPersonAction,
44
+ add_product_to_deal_1.addProductToDealAction,
45
+ create_deal_1.createDealAction,
46
+ update_deal_1.updateDealAction,
47
+ create_lead_1.createLeadAction,
48
+ update_lead_1.updateLeadAction,
49
+ create_organization_1.createOrganizationAction,
50
+ update_organization_1.updateOrganizationAction,
51
+ create_person_1.createPersonAction,
52
+ update_person_1.updatePersonAction,
53
+ create_product_1.createProductAction,
30
54
  (0, pieces_common_1.createCustomApiCallAction)({
31
55
  baseUrl: () => 'https://api.pipedrive.com/v1',
32
56
  auth: exports.pipedriveAuth,
@@ -37,7 +61,17 @@ exports.pipedrive = (0, pieces_framework_1.createPiece)({
37
61
  }),
38
62
  }),
39
63
  ],
40
- authors: ["ashrafsamhouri", "kishanprmr", "MoShizzle", "khaledmashaly", "abuaboud"],
41
- triggers: [new_person_1.newPerson, new_deal_1.newDeal, new_activity_1.newActivity, updated_person_1.updatedPerson, updated_deal_1.updatedDeal],
64
+ authors: ['ashrafsamhouri', 'kishanprmr', 'MoShizzle', 'khaledmashaly', 'abuaboud'],
65
+ triggers: [
66
+ new_person_1.newPerson,
67
+ new_deal_1.newDeal,
68
+ new_activity_1.newActivity,
69
+ updated_person_1.updatedPerson,
70
+ updated_deal_1.updatedDeal,
71
+ updated_deal_stage_1.updatedDealStageTrigger,
72
+ new_lead_1.newLeadTrigger,
73
+ new_organization_1.newOrganizationTrigger,
74
+ updated_organization_1.updatedOrganizationTrigger,
75
+ ],
42
76
  });
43
77
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/pipedrive/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAIwC;AACxC,iDAAqD;AACrD,yFAA8E;AAC9E,6DAAyD;AACzD,qDAAiD;AACjD,yDAAqD;AACrD,6DAAyD;AACzD,iEAA6D;AAEhD,QAAA,aAAa,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC5C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,6CAA6C;IACtD,QAAQ,EAAE,yCAAyC;IACnD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAC,YAAY,EAAC,iBAAiB,CAAC;CAC/E,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACnC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,4CAA4C;IAEzD,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,CAAC;IACzC,IAAI,EAAE,qBAAa;IACnB,OAAO,EAAE;QACP,6BAAS;QACT,IAAA,yCAAyB,EAAC;YACxB,OAAO,EAAE,GAAG,EAAE,CAAC,8BAA8B;YAC7C,IAAI,EAAE,qBAAa;YACnB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC5B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACtE,CAAC,CAAA;cAAA;SACH,CAAC;KACH;IACD,OAAO,EAAE,CAAC,gBAAgB,EAAC,YAAY,EAAC,WAAW,EAAC,eAAe,EAAC,UAAU,CAAC;IAC/E,QAAQ,EAAE,CAAC,sBAAS,EAAE,kBAAO,EAAE,0BAAW,EAAE,8BAAa,EAAE,0BAAW,CAAC;CACxE,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../packages/pieces/community/pipedrive/src/index.ts"],"names":[],"mappings":";;;;AAAA,+DAAwE;AACxE,qEAA6F;AAC7F,iDAAqD;AACrD,6DAAyD;AACzD,qDAAiD;AACjD,yDAAqD;AACrD,6DAAyD;AACzD,iEAA6D;AAC7D,qDAAwD;AACxD,qEAAwE;AACxE,6EAAgF;AAChF,yEAA2E;AAC3E,+DAAiE;AACjE,+DAAiE;AACjE,2EAA6E;AAC7E,2EAA6E;AAC7E,2DAA6D;AAC7D,2DAA6D;AAC7D,2DAA6D;AAC7D,2DAA6D;AAC7D,iEAAmE;AACnE,2EAA2E;AAC3E,2EAA2E;AAE9D,QAAA,aAAa,GAAG,4BAAS,CAAC,MAAM,CAAC;IAC7C,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,6CAA6C;IACtD,QAAQ,EAAE,yCAAyC;IACnD,QAAQ,EAAE,IAAI;IACd,KAAK,EAAE,CAAC,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAC,eAAe,CAAC;CAC9G,CAAC,CAAC;AAEU,QAAA,SAAS,GAAG,IAAA,8BAAW,EAAC;IACpC,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,4CAA4C;IAEzD,uBAAuB,EAAE,QAAQ;IACjC,OAAO,EAAE,mDAAmD;IAC5D,UAAU,EAAE,CAAC,sBAAa,CAAC,aAAa,CAAC;IACzC,IAAI,EAAE,qBAAa;IACnB,OAAO,EAAE;QACN,4CAAsB;QACxB,4CAAsB;QACtB,8BAAgB;QAChB,8BAAgB;QAChB,8BAAgB;QAChB,8BAAgB;QAChB,8CAAwB;QACxB,8CAAwB;QACxB,kCAAkB;QAClB,kCAAkB;QAClB,oCAAmB;QACnB,IAAA,yCAAyB,EAAC;YACzB,OAAO,EAAE,GAAG,EAAE,CAAC,8BAA8B;YAC7C,IAAI,EAAE,qBAAa;YACnB,WAAW,EAAE,CAAO,IAAI,EAAE,EAAE;gBAAC,OAAA,CAAC;oBAC7B,aAAa,EAAE,UAAW,IAA4B,CAAC,YAAY,EAAE;iBACrE,CAAC,CAAA;cAAA;SACF,CAAC;KACF;IACD,OAAO,EAAE,CAAC,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,UAAU,CAAC;IACnF,QAAQ,EAAE;QACT,sBAAS;QACT,kBAAO;QACP,0BAAW;QACX,8BAAa;QACb,0BAAW;QACX,4CAAuB;QACvB,yBAAc;QACd,yCAAsB;QACtB,iDAA0B;KAC1B;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const addLabelToPersonAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ personId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
3
+ labelIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, true>;
4
+ }>;
@@ -0,0 +1,46 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addLabelToPersonAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const index_1 = require("../../index");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const props_1 = require("../common/props");
8
+ const common_1 = require("../common");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.addLabelToPersonAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'add-labels-to-person',
13
+ displayName: 'Add Labels to Person',
14
+ description: 'Adds an existing labels to an existing person.',
15
+ props: {
16
+ personId: (0, props_1.personIdProp)(true),
17
+ labelIds: (0, props_1.labelIdsProp)('person', 'label_ids', true),
18
+ },
19
+ run(context) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ var _a;
22
+ const { personId } = context.propsValue;
23
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
24
+ const personDefaultFields = {};
25
+ if (labelIds.length > 0) {
26
+ personDefaultFields.label_ids = labelIds;
27
+ }
28
+ const updatedPersonResponse = yield (0, common_1.pipedriveApiCall)({
29
+ accessToken: context.auth.access_token,
30
+ apiDomain: context.auth.data['api_domain'],
31
+ method: pieces_common_1.HttpMethod.PUT,
32
+ resourceUri: `/persons/${personId}`,
33
+ body: Object.assign({}, personDefaultFields),
34
+ });
35
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
36
+ accessToken: context.auth.access_token,
37
+ apiDomain: context.auth.data['api_domain'],
38
+ method: pieces_common_1.HttpMethod.GET,
39
+ resourceUri: '/personFields',
40
+ });
41
+ const updatedPersonProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, updatedPersonResponse.data);
42
+ return Object.assign(Object.assign({}, updatedPersonResponse), { data: updatedPersonProperties });
43
+ });
44
+ },
45
+ });
46
+ //# sourceMappingURL=add-label-to-person.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-label-to-person.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/add-label-to-person.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qE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AC;YAEH,MAAM,uBAAuB,GAAG,IAAA,uCAA8B,EAC7D,oBAAoB,EACpB,qBAAqB,CAAC,IAAI,CAC1B,CAAC;YAEF,uCACI,qBAAqB,KACxB,IAAI,EAAE,uBAAuB,IAC5B;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ export declare const addProductToDealAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ dealId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
3
+ productId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
4
+ price: import("@activepieces/pieces-framework").NumberProperty<true>;
5
+ quantity: import("@activepieces/pieces-framework").NumberProperty<true>;
6
+ discount: import("@activepieces/pieces-framework").NumberProperty<false>;
7
+ discountType: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
8
+ comments: import("@activepieces/pieces-framework").LongTextProperty<false>;
9
+ enableProduct: import("@activepieces/pieces-framework").CheckboxProperty<false>;
10
+ taxMethod: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
11
+ taxPercentage: import("@activepieces/pieces-framework").NumberProperty<false>;
12
+ }>;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addProductToDealAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const index_1 = require("../../index");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const props_1 = require("../common/props");
8
+ const common_1 = require("../common");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.addProductToDealAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'add-product-to-deal',
13
+ displayName: 'Add Product to Deal',
14
+ description: 'Adds a product to a deal.',
15
+ props: {
16
+ dealId: (0, props_1.dealIdProp)(true),
17
+ productId: (0, props_1.productIdProp)(true),
18
+ price: pieces_framework_1.Property.Number({
19
+ displayName: 'Price',
20
+ required: true,
21
+ }),
22
+ quantity: pieces_framework_1.Property.Number({
23
+ displayName: 'Quantity',
24
+ required: true,
25
+ }),
26
+ discount: pieces_framework_1.Property.Number({
27
+ displayName: 'Discount',
28
+ required: false,
29
+ }),
30
+ discountType: pieces_framework_1.Property.StaticDropdown({
31
+ displayName: 'Discount Type',
32
+ required: false,
33
+ options: {
34
+ disabled: false,
35
+ options: [
36
+ {
37
+ label: 'Percentage',
38
+ value: 'percentage',
39
+ },
40
+ {
41
+ label: 'Amount',
42
+ value: 'amount',
43
+ },
44
+ ],
45
+ },
46
+ }),
47
+ comments: pieces_framework_1.Property.LongText({
48
+ displayName: 'Comments',
49
+ required: false,
50
+ }),
51
+ enableProduct: pieces_framework_1.Property.Checkbox({
52
+ displayName: 'Enable Product?',
53
+ required: false,
54
+ defaultValue: true,
55
+ }),
56
+ taxMethod: pieces_framework_1.Property.StaticDropdown({
57
+ displayName: 'Tax Method',
58
+ required: false,
59
+ options: {
60
+ disabled: false,
61
+ options: [
62
+ {
63
+ label: 'Exclusive',
64
+ value: 'exclusive',
65
+ },
66
+ {
67
+ label: 'Inclusive',
68
+ value: 'inclusive',
69
+ },
70
+ {
71
+ label: 'None',
72
+ value: 'none',
73
+ },
74
+ ],
75
+ },
76
+ }),
77
+ taxPercentage: pieces_framework_1.Property.Number({
78
+ displayName: 'Tax Percentage',
79
+ required: false,
80
+ }),
81
+ },
82
+ run(context) {
83
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
84
+ const { productId, dealId, price, quantity, discountType, discount, comments, enableProduct, taxPercentage, taxMethod, } = context.propsValue;
85
+ const response = yield (0, common_1.pipedriveApiCall)({
86
+ accessToken: context.auth.access_token,
87
+ apiDomain: context.auth.data['api_domain'],
88
+ method: pieces_common_1.HttpMethod.POST,
89
+ resourceUri: `/deals/${dealId}/products`,
90
+ body: {
91
+ product_id: productId,
92
+ item_price: price,
93
+ quantity,
94
+ discount_type: discountType,
95
+ discount,
96
+ comments,
97
+ enable_product: enableProduct,
98
+ tax: taxPercentage,
99
+ tax_method: taxMethod,
100
+ },
101
+ });
102
+ return response;
103
+ });
104
+ },
105
+ });
106
+ //# sourceMappingURL=add-product-to-deal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-product-to-deal.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/add-product-to-deal.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAA4D;AAC5D,sCAA6C;AAC7C,+DAAyD;AAE5C,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,2BAA2B;IACxC,KAAK,EAAE;QACN,MAAM,EAAE,IAAA,kBAAU,EAAC,IAAI,CAAC;QACxB,SAAS,EAAE,IAAA,qBAAa,EAAC,IAAI,CAAC;QAC9B,KAAK,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACtB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,QAAQ,EAAE,2BAAQ,CAAC,MAAM,CAAC;YACzB,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,YAAY,EAAE,2BAAQ,CAAC,cAAc,CAAC;YACrC,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,KAAK;YACf,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACR;wBACC,KAAK,EAAE,YAAY;wBACnB,KAAK,EAAE,YAAY;qBACnB;oBACD;wBACC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AE;oBACL,UAAU,EAAE,SAAS;oBACrB,UAAU,EAAE,KAAK;oBACjB,QAAQ;oBACR,aAAa,EAAE,YAAY;oBAC3B,QAAQ;oBACR,QAAQ;oBACR,cAAc,EAAE,aAAa;oBAC7B,GAAG,EAAE,aAAa;oBAClB,UAAU,EAAE,SAAS;iBACrB;aACD,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare const createDealAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ creationTime: import("@activepieces/pieces-framework").DateTimeProperty<false>;
3
+ status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
4
+ stageId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
5
+ pipelineId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
6
+ ownerId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
7
+ organizationId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
8
+ personId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
9
+ labelIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, true>;
10
+ probability: import("@activepieces/pieces-framework").NumberProperty<false>;
11
+ expectedCloseDate: import("@activepieces/pieces-framework").ShortTextProperty<false>;
12
+ dealValue: import("@activepieces/pieces-framework").NumberProperty<false>;
13
+ dealValueCurrency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ visibleTo: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
15
+ customfields: import("@activepieces/pieces-framework").DynamicProperties<false>;
16
+ title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
17
+ }>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createDealAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const index_1 = require("../../index");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const props_1 = require("../common/props");
8
+ const common_1 = require("../common");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.createDealAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'create-deal',
13
+ displayName: 'Create Deal',
14
+ description: 'Creates a new deal.',
15
+ props: Object.assign({ title: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Title',
17
+ required: true,
18
+ }) }, props_1.dealCommonProps),
19
+ run(context) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ var _a, _b;
22
+ const { title, dealValue, dealValueCurrency, expectedCloseDate, visibleTo, probability, stageId, status, pipelineId, ownerId, organizationId, personId, creationTime, } = context.propsValue;
23
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
24
+ const customFields = (_b = context.propsValue.customfields) !== null && _b !== void 0 ? _b : {};
25
+ const dealDefaultFields = {
26
+ title,
27
+ pipeline_id: pipelineId,
28
+ stage_id: stageId,
29
+ status,
30
+ add_time: creationTime,
31
+ probability,
32
+ expected_close_date: expectedCloseDate,
33
+ visible_to: visibleTo,
34
+ user_id: ownerId,
35
+ org_id: organizationId,
36
+ person_id: personId,
37
+ value: dealValue,
38
+ currency: dealValueCurrency,
39
+ };
40
+ if (labelIds.length > 0) {
41
+ dealDefaultFields.label = labelIds;
42
+ }
43
+ const dealCustomFields = {};
44
+ Object.entries(customFields).forEach(([key, value]) => {
45
+ // Format values if they are arrays
46
+ dealCustomFields[key] = Array.isArray(value) ? value.join(',') : value;
47
+ });
48
+ const createdDealResponse = yield (0, common_1.pipedriveApiCall)({
49
+ accessToken: context.auth.access_token,
50
+ apiDomain: context.auth.data['api_domain'],
51
+ method: pieces_common_1.HttpMethod.POST,
52
+ resourceUri: '/deals',
53
+ body: Object.assign(Object.assign({}, dealDefaultFields), dealCustomFields),
54
+ });
55
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
56
+ accessToken: context.auth.access_token,
57
+ apiDomain: context.auth.data['api_domain'],
58
+ method: pieces_common_1.HttpMethod.GET,
59
+ resourceUri: '/dealFields',
60
+ });
61
+ const updatedLeadProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, createdDealResponse.data);
62
+ return Object.assign(Object.assign({}, createdDealResponse), { data: updatedLeadProperties });
63
+ });
64
+ },
65
+ });
66
+ //# sourceMappingURL=create-deal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-deal.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/create-deal.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAAkD;AAClD,sCAImB;AACnB,+DAAyD;AAG5C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qBAAqB;IAClC,KAAK,kBACJ,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACd,CAAC,IACC,uBAAe,CAClB;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EACL,KAAK,EACL,SAAS,EACT,iBAAiB,EACjB,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,OAAO,EACP,MAAM,EACN,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,YAAY,GACZ,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,MAAM,QAAQ,GAAG,MAAC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C,CAAC;YAEH,MAAM,oBAAoB,GAAG,MAAM,IAAA,kCAAyB,EAAW;gBACtE,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;gBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,aAAa;aAC1B,CAAC,CAAC;YAEH,MAAM,qBAAqB,GAAG,IAAA,uCAA8B,EAC3D,oBAAoB,EACpB,mBAAmB,CAAC,IAAI,CACxB,CAAC;YAEF,uCACI,mBAAmB,KACtB,IAAI,EAAE,qBAAqB,IAC1B;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const createLeadAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ ownerId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
3
+ organizationId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
4
+ personId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
5
+ labelIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<string, true>;
6
+ expectedCloseDate: import("@activepieces/pieces-framework").ShortTextProperty<false>;
7
+ visibleTo: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
8
+ channel: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, false>;
9
+ leadValue: import("@activepieces/pieces-framework").NumberProperty<false>;
10
+ leadValueCurrency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ customfields: import("@activepieces/pieces-framework").DynamicProperties<false>;
12
+ title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ }>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createLeadAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const index_1 = require("../../index");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const props_1 = require("../common/props");
8
+ const common_1 = require("../common");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.createLeadAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'create-lead',
13
+ displayName: 'Create Lead',
14
+ description: 'Creates a new lead.',
15
+ props: Object.assign({ title: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Title',
17
+ required: true,
18
+ }) }, props_1.leadCommonProps),
19
+ run(context) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ var _a, _b;
22
+ const { title, ownerId, channel, organizationId, personId, expectedCloseDate, visibleTo, leadValue, leadValueCurrency, } = context.propsValue;
23
+ if (!personId && !organizationId) {
24
+ throw new Error('Neither an Organization nor a Person were provided. One of them must be provided in order to create a lead.');
25
+ }
26
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
27
+ const customFields = (_b = context.propsValue.customfields) !== null && _b !== void 0 ? _b : {};
28
+ const leadDefaultFields = {
29
+ title,
30
+ owner_id: ownerId,
31
+ organization_id: organizationId,
32
+ person_id: personId,
33
+ channel: channel,
34
+ expected_close_date: expectedCloseDate,
35
+ visible_to: visibleTo,
36
+ };
37
+ if (labelIds.length > 0) {
38
+ leadDefaultFields.label_ids = labelIds;
39
+ }
40
+ if (leadValue) {
41
+ if (!leadValueCurrency) {
42
+ throw new Error('lead Value Currency is required when lead Value is provided');
43
+ }
44
+ leadDefaultFields.value = {
45
+ amount: leadValue,
46
+ currency: leadValueCurrency,
47
+ };
48
+ }
49
+ const leadCustomFields = {};
50
+ Object.entries(customFields).forEach(([key, value]) => {
51
+ // Format values if they are arrays
52
+ leadCustomFields[key] = Array.isArray(value) ? value.join(',') : value;
53
+ });
54
+ const createdLeadResponse = yield (0, common_1.pipedriveApiCall)({
55
+ accessToken: context.auth.access_token,
56
+ apiDomain: context.auth.data['api_domain'],
57
+ method: pieces_common_1.HttpMethod.POST,
58
+ resourceUri: '/leads',
59
+ body: Object.assign(Object.assign({}, leadDefaultFields), leadCustomFields),
60
+ });
61
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
62
+ accessToken: context.auth.access_token,
63
+ apiDomain: context.auth.data['api_domain'],
64
+ method: pieces_common_1.HttpMethod.GET,
65
+ resourceUri: '/dealFields',
66
+ });
67
+ const updatedLeadProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, createdLeadResponse.data);
68
+ return Object.assign(Object.assign({}, createdLeadResponse), { data: updatedLeadProperties });
69
+ });
70
+ },
71
+ });
72
+ //# sourceMappingURL=create-lead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-lead.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/create-lead.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAAkD;AAClD,sCAImB;AAEnB,+DAAyD;AAE5C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,qBAAqB;IAClC,KAAK,kBACJ,KAAK,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACzB,WAAW,EAAE,OAAO;YACpB,QAAQ,EAAE,IAAI;SACd,CAAC,IACC,uBAAe,CAClB;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EACL,KAAK,EACL,OAAO,EACP,OAAO,EACP,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,SAAS,EACT,SAAS,EACT,iBAAiB,GACjB,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,IAAI,CAAC,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B;gBAC9E,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;gBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,WAAW,EAAE,QAAQ;gBACrB,IAAI,kCACA,iBAAiB,GACjB,gBAAgB,CACnB;aACD,CAAC,CAAC;YAEH,MAAM,oBAAoB,GAAG,MAAM,IAAA,kCAAyB,EAAW;gBACtE,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;gBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,aAAa;aAC1B,CAAC,CAAC;YAEH,MAAM,qBAAqB,GAAG,IAAA,uCAA8B,EAC3D,oBAAoB,EACpB,mBAAmB,CAAC,IAAI,CACxB,CAAC;YAEF,uCACI,mBAAmB,KACtB,IAAI,EAAE,qBAAqB,IAC1B;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const createOrganizationAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ ownerId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
3
+ visibleTo: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
4
+ labelIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, true>;
5
+ address: import("@activepieces/pieces-framework").LongTextProperty<false>;
6
+ customfields: import("@activepieces/pieces-framework").DynamicProperties<false>;
7
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
8
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createOrganizationAction = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const index_1 = require("../../index");
6
+ const pieces_framework_1 = require("@activepieces/pieces-framework");
7
+ const props_1 = require("../common/props");
8
+ const common_1 = require("../common");
9
+ const pieces_common_1 = require("@activepieces/pieces-common");
10
+ exports.createOrganizationAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'create-organization',
13
+ displayName: 'Create Organization',
14
+ description: 'Creates a new organization.',
15
+ props: Object.assign({ name: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Name',
17
+ required: true,
18
+ }) }, props_1.organizationCommonProps),
19
+ run(context) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ var _a, _b;
22
+ const { name, ownerId, address, visibleTo } = context.propsValue;
23
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
24
+ const customFields = (_b = context.propsValue.customfields) !== null && _b !== void 0 ? _b : {};
25
+ const organizationDefaultFields = {
26
+ name: name,
27
+ owner_id: ownerId,
28
+ visible_to: visibleTo,
29
+ address: address,
30
+ };
31
+ if (labelIds.length > 0) {
32
+ organizationDefaultFields.label_ids = labelIds;
33
+ }
34
+ const organizationCustomFiels = {};
35
+ Object.entries(customFields).forEach(([key, value]) => {
36
+ // Format values if they are arrays
37
+ organizationCustomFiels[key] = Array.isArray(value) ? value.join(',') : value;
38
+ });
39
+ const createdOrganizationResponse = yield (0, common_1.pipedriveApiCall)({
40
+ accessToken: context.auth.access_token,
41
+ apiDomain: context.auth.data['api_domain'],
42
+ method: pieces_common_1.HttpMethod.POST,
43
+ resourceUri: '/organizations',
44
+ body: Object.assign(Object.assign({}, organizationDefaultFields), organizationCustomFiels),
45
+ });
46
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
47
+ accessToken: context.auth.access_token,
48
+ apiDomain: context.auth.data['api_domain'],
49
+ method: pieces_common_1.HttpMethod.GET,
50
+ resourceUri: '/organizationFields',
51
+ });
52
+ const updatedOrganizationProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, createdOrganizationResponse.data);
53
+ return Object.assign(Object.assign({}, createdOrganizationResponse), { data: updatedOrganizationProperties });
54
+ });
55
+ },
56
+ });
57
+ //# sourceMappingURL=create-organization.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-organization.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/create-organization.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAA0D;AAC1D,sCAImB;AAEnB,+DAAyD;AAE5C,QAAA,wBAAwB,GAAG,IAAA,+BAAY,EAAC;IACpD,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,6BAA6B;IAC1C,KAAK,kBACJ,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACd,CAAC,IACC,+BAAuB,CAC1B;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjE,MAAM,QAAQ,GAAG,MAAC,OAAO,CAAC,UAAU,CAAC,QAAqB,mCAAI,EAAE,CAAC;YACjE,MAAM,YAAY,GAAG,MAAA,OAAO,CAAC,UAAU,CAAC,YAAY,mCAAI,EAAE,CAAC;YAE3D,MAAM,yBAAyB,GAAwB;gBACtD,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,OAAO;gBACjB,UAAU,EAAE,SAAS;gBACrB,OAAO,EAAE,OAAO;aAChB,CAAC;YAEF,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACzB,yBAAyB,CAAC,SAAS,GAAG,QAAQ,CAAC;YAChD,CAAC;YAED,MAAM,uBAAuB,GAA2B,EAAE,CAAC;YAE3D,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;gBACrD,mCAAmC;gBACnC,uBAAuB,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAC/E,CAAC,CAAC,CAAC;YAEH,MAAM,2BAA2B,GAAG,MAAM,IAAA,yBAAgB,EAA6B;gBACtF,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;gBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,IAAI;gBACvB,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,kCACA,yBAAyB,GACzB,uBAAuB,CAC1B;aACD,CAAC,CAAC;YAEH,MAAM,oBAAoB,GAAG,MAAM,IAAA,kCAAyB,EAAW;gBACtE,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;gBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;gBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;gBACtB,WAAW,EAAE,qBAAqB;aAClC,CAAC,CAAC;YAEH,MAAM,6BAA6B,GAAG,IAAA,uCAA8B,EACnE,oBAAoB,EACpB,2BAA2B,CAAC,IAAI,CAChC,CAAC;YAEF,uCACI,2BAA2B,KAC9B,IAAI,EAAE,6BAA6B,IAClC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ export declare const createPersonAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ ownerId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
3
+ organizationId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
4
+ email: import("@activepieces/pieces-framework").ArrayProperty<false>;
5
+ phone: import("@activepieces/pieces-framework").ArrayProperty<false>;
6
+ labelIds: import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, false> | import("@activepieces/pieces-framework").MultiSelectDropdownProperty<number, true>;
7
+ firstName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
8
+ lastName: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ visibleTo: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
10
+ marketing_status: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false> | import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
11
+ customfields: import("@activepieces/pieces-framework").DynamicProperties<false>;
12
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ }>;