@activepieces/piece-pipedrive 0.3.6 → 0.4.1

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 (124) hide show
  1. package/package.json +6 -4
  2. package/src/index.js +89 -5
  3. package/src/index.js.map +1 -1
  4. package/src/lib/actions/add-follower.d.ts +5 -0
  5. package/src/lib/actions/add-follower.js +119 -0
  6. package/src/lib/actions/add-follower.js.map +1 -0
  7. package/src/lib/actions/add-label-to-person.d.ts +4 -0
  8. package/src/lib/actions/add-label-to-person.js +46 -0
  9. package/src/lib/actions/add-label-to-person.js.map +1 -0
  10. package/src/lib/actions/add-product-to-deal.d.ts +12 -0
  11. package/src/lib/actions/add-product-to-deal.js +106 -0
  12. package/src/lib/actions/add-product-to-deal.js.map +1 -0
  13. package/src/lib/actions/attach-file.d.ts +9 -0
  14. package/src/lib/actions/attach-file.js +62 -0
  15. package/src/lib/actions/attach-file.js.map +1 -0
  16. package/src/lib/actions/create-activity.d.ts +16 -0
  17. package/src/lib/actions/create-activity.js +54 -0
  18. package/src/lib/actions/create-activity.js.map +1 -0
  19. package/src/lib/actions/create-deal.d.ts +17 -0
  20. package/src/lib/actions/create-deal.js +69 -0
  21. package/src/lib/actions/create-deal.js.map +1 -0
  22. package/src/lib/actions/create-lead.d.ts +13 -0
  23. package/src/lib/actions/create-lead.js +75 -0
  24. package/src/lib/actions/create-lead.js.map +1 -0
  25. package/src/lib/actions/create-note.d.ts +11 -0
  26. package/src/lib/actions/create-note.js +73 -0
  27. package/src/lib/actions/create-note.js.map +1 -0
  28. package/src/lib/actions/create-organization.d.ts +8 -0
  29. package/src/lib/actions/create-organization.js +57 -0
  30. package/src/lib/actions/create-organization.js.map +1 -0
  31. package/src/lib/actions/create-person.d.ts +13 -0
  32. package/src/lib/actions/create-person.js +68 -0
  33. package/src/lib/actions/create-person.js.map +1 -0
  34. package/src/lib/actions/create-product.d.ts +15 -0
  35. package/src/lib/actions/create-product.js +109 -0
  36. package/src/lib/actions/create-product.js.map +1 -0
  37. package/src/lib/actions/find-activity.d.ts +8 -0
  38. package/src/lib/actions/find-activity.js +85 -0
  39. package/src/lib/actions/find-activity.js.map +1 -0
  40. package/src/lib/actions/find-deal.d.ts +4 -0
  41. package/src/lib/actions/find-deal.js +104 -0
  42. package/src/lib/actions/find-deal.js.map +1 -0
  43. package/src/lib/actions/find-deals-associated-with-person.d.ts +3 -0
  44. package/src/lib/actions/find-deals-associated-with-person.js +53 -0
  45. package/src/lib/actions/find-deals-associated-with-person.js.map +1 -0
  46. package/src/lib/actions/find-notes.d.ts +4 -0
  47. package/src/lib/actions/find-notes.js +70 -0
  48. package/src/lib/actions/find-notes.js.map +1 -0
  49. package/src/lib/actions/find-organization.d.ts +4 -0
  50. package/src/lib/actions/find-organization.js +104 -0
  51. package/src/lib/actions/find-organization.js.map +1 -0
  52. package/src/lib/actions/find-person.d.ts +4 -0
  53. package/src/lib/actions/find-person.js +104 -0
  54. package/src/lib/actions/find-person.js.map +1 -0
  55. package/src/lib/actions/find-product.d.ts +3 -0
  56. package/src/lib/actions/find-product.js +59 -0
  57. package/src/lib/actions/find-product.js.map +1 -0
  58. package/src/lib/actions/find-products.d.ts +4 -0
  59. package/src/lib/actions/find-products.js +73 -0
  60. package/src/lib/actions/find-products.js.map +1 -0
  61. package/src/lib/actions/find-user.d.ts +4 -0
  62. package/src/lib/actions/find-user.js +57 -0
  63. package/src/lib/actions/find-user.js.map +1 -0
  64. package/src/lib/actions/get-note.d.ts +3 -0
  65. package/src/lib/actions/get-note.js +39 -0
  66. package/src/lib/actions/get-note.js.map +1 -0
  67. package/src/lib/actions/get-product.d.ts +3 -0
  68. package/src/lib/actions/get-product.js +50 -0
  69. package/src/lib/actions/get-product.js.map +1 -0
  70. package/src/lib/actions/update-activity.d.ts +17 -0
  71. package/src/lib/actions/update-activity.js +57 -0
  72. package/src/lib/actions/update-activity.js.map +1 -0
  73. package/src/lib/actions/update-deal.d.ts +18 -0
  74. package/src/lib/actions/update-deal.js +69 -0
  75. package/src/lib/actions/update-deal.js.map +1 -0
  76. package/src/lib/actions/update-lead.d.ts +14 -0
  77. package/src/lib/actions/update-lead.js +72 -0
  78. package/src/lib/actions/update-lead.js.map +1 -0
  79. package/src/lib/actions/update-organization.d.ts +9 -0
  80. package/src/lib/actions/update-organization.js +58 -0
  81. package/src/lib/actions/update-organization.js.map +1 -0
  82. package/src/lib/actions/update-person.d.ts +14 -0
  83. package/src/lib/actions/update-person.js +68 -0
  84. package/src/lib/actions/update-person.js.map +1 -0
  85. package/src/lib/common/index.js +26 -3
  86. package/src/lib/common/index.js.map +1 -1
  87. package/src/lib/common/props.d.ts +92 -0
  88. package/src/lib/common/props.js +988 -0
  89. package/src/lib/common/props.js.map +1 -0
  90. package/src/lib/common/types.d.ts +24 -2
  91. package/src/lib/trigger/activity-matching-filter.d.ts +8 -0
  92. package/src/lib/trigger/activity-matching-filter.js +178 -0
  93. package/src/lib/trigger/activity-matching-filter.js.map +1 -0
  94. package/src/lib/trigger/deal-matching-filter.d.ts +11 -0
  95. package/src/lib/trigger/deal-matching-filter.js +287 -0
  96. package/src/lib/trigger/deal-matching-filter.js.map +1 -0
  97. package/src/lib/trigger/new-deal.js +1 -1
  98. package/src/lib/trigger/new-deal.js.map +1 -1
  99. package/src/lib/trigger/new-lead.d.ts +2 -0
  100. package/src/lib/trigger/new-lead.js +124 -0
  101. package/src/lib/trigger/new-lead.js.map +1 -0
  102. package/src/lib/trigger/new-note.d.ts +2 -0
  103. package/src/lib/trigger/new-note.js +113 -0
  104. package/src/lib/trigger/new-note.js.map +1 -0
  105. package/src/lib/trigger/new-organization.d.ts +2 -0
  106. package/src/lib/trigger/new-organization.js +160 -0
  107. package/src/lib/trigger/new-organization.js.map +1 -0
  108. package/src/lib/trigger/new-person.js.map +1 -1
  109. package/src/lib/trigger/organization-matching-filter.d.ts +8 -0
  110. package/src/lib/trigger/organization-matching-filter.js +174 -0
  111. package/src/lib/trigger/organization-matching-filter.js.map +1 -0
  112. package/src/lib/trigger/person-matching-filter.d.ts +8 -0
  113. package/src/lib/trigger/person-matching-filter.js +203 -0
  114. package/src/lib/trigger/person-matching-filter.js.map +1 -0
  115. package/src/lib/trigger/updated-deal-stage.d.ts +8 -0
  116. package/src/lib/trigger/updated-deal-stage.js +288 -0
  117. package/src/lib/trigger/updated-deal-stage.js.map +1 -0
  118. package/src/lib/trigger/updated-organization.d.ts +2 -0
  119. package/src/lib/trigger/updated-organization.js +160 -0
  120. package/src/lib/trigger/updated-organization.js.map +1 -0
  121. package/src/lib/trigger/updated-person.js.map +1 -1
  122. package/src/lib/actions/add-person.action/add-person.action.d.ts +0 -8
  123. package/src/lib/actions/add-person.action/add-person.action.js +0 -179
  124. package/src/lib/actions/add-person.action/add-person.action.js.map +0 -1
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findProductAction = 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 common_1 = require("../common");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.findProductAction = (0, pieces_framework_1.createAction)({
10
+ auth: index_1.pipedriveAuth,
11
+ name: 'find-product',
12
+ displayName: 'Find Product',
13
+ description: 'Find a product by name.',
14
+ props: {
15
+ searchTerm: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Search Term',
17
+ required: true,
18
+ }),
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ const response = yield (0, common_1.pipedriveApiCall)({
23
+ accessToken: context.auth.access_token,
24
+ apiDomain: context.auth.data['api_domain'],
25
+ method: pieces_common_1.HttpMethod.GET,
26
+ resourceUri: '/products/search',
27
+ query: {
28
+ term: context.propsValue.searchTerm,
29
+ fields: 'name',
30
+ limit: 1,
31
+ },
32
+ });
33
+ if (response.data.items.length === 0) {
34
+ return {
35
+ found: false,
36
+ data: [],
37
+ };
38
+ }
39
+ const productResponse = yield (0, common_1.pipedriveApiCall)({
40
+ accessToken: context.auth.access_token,
41
+ apiDomain: context.auth.data['api_domain'],
42
+ method: pieces_common_1.HttpMethod.GET,
43
+ resourceUri: `/products/${response.data.items[0].item.id}`,
44
+ });
45
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
46
+ accessToken: context.auth.access_token,
47
+ apiDomain: context.auth.data['api_domain'],
48
+ method: pieces_common_1.HttpMethod.GET,
49
+ resourceUri: '/productFields',
50
+ });
51
+ const updatedProductProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, productResponse.data);
52
+ return {
53
+ found: true,
54
+ data: [updatedProductProperties],
55
+ };
56
+ });
57
+ },
58
+ });
59
+ //# sourceMappingURL=find-product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-product.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/find-product.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,sCAImB;AACnB,+DAAyD;AAG5C,QAAA,iBAAiB,GAAG,IAAA,+BAAY,EAAC;IAC7C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,cAAc;IACpB,WAAW,EAAE,cAAc;IAC3B,WAAW,EAAE,yBAAyB;IACtC,KAAK,EAAE;QACN,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAGpC;gBACF,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,kBAAkB;gBAC/B,KAAK,EAAE;oBACN,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU;oBACnC,MAAM,EAAE,MAAM;oBACd,KAAK,EAAE,CAAC;iBACR;aACD,CAAC,CAAC;YAEH,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBACtC,OAAO;oBACN,KAAK,EAAE,KAAK;oBACZ,IAAI,EAAE,EAAE;iBACR,CAAC;YACH,CAAC;YAED,MAAM,eAAe,GAAG,MAAM,IAAA,yBAAgB,EAAkB;gBAC/D,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,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE;aAC1D,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,gBAAgB;aAC7B,CAAC,CAAC;YAEH,MAAM,wBAAwB,GAAG,IAAA,uCAA8B,EAC9D,oBAAoB,EACpB,eAAe,CAAC,IAAI,CACpB,CAAC;YAEF,OAAO;gBACN,KAAK,EAAE,IAAI;gBACX,IAAI,EAAE,CAAC,wBAAwB,CAAC;aAChC,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const findProductsAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ field: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ fieldValue: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findProductsAction = 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 common_1 = require("../common");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ const shared_1 = require("@activepieces/shared");
10
+ exports.findProductsAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'find-products',
13
+ displayName: 'Find Products',
14
+ description: 'Finds a product or products by name or product code.',
15
+ props: {
16
+ field: pieces_framework_1.Property.StaticDropdown({
17
+ displayName: 'Field to search by',
18
+ required: true,
19
+ defaultValue: 'name',
20
+ options: {
21
+ disabled: false,
22
+ options: [
23
+ {
24
+ label: 'Name',
25
+ value: 'name',
26
+ },
27
+ {
28
+ label: 'Product Code',
29
+ value: 'code',
30
+ },
31
+ ],
32
+ },
33
+ }),
34
+ fieldValue: pieces_framework_1.Property.ShortText({
35
+ displayName: 'Field Value',
36
+ required: true,
37
+ }),
38
+ },
39
+ run(context) {
40
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
41
+ const products = [];
42
+ let hasMoreItems = true;
43
+ do {
44
+ const qs = {
45
+ term: context.propsValue.fieldValue,
46
+ fields: context.propsValue.field,
47
+ limit: 100,
48
+ start: 0,
49
+ exact_match: 'true',
50
+ };
51
+ const response = yield (0, common_1.pipedriveApiCall)({
52
+ accessToken: context.auth.access_token,
53
+ apiDomain: context.auth.data['api_domain'],
54
+ method: pieces_common_1.HttpMethod.GET,
55
+ resourceUri: '/products/search',
56
+ query: qs,
57
+ });
58
+ if ((0, shared_1.isNil)(response.data.items))
59
+ break;
60
+ for (const product of response.data.items) {
61
+ products.push(product.item);
62
+ }
63
+ hasMoreItems = response.additional_data.pagination.more_items_in_collection;
64
+ qs.start = response.additional_data.pagination.next_start;
65
+ } while (hasMoreItems);
66
+ return {
67
+ found: products.length > 0,
68
+ data: products,
69
+ };
70
+ });
71
+ },
72
+ });
73
+ //# sourceMappingURL=find-products.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-products.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/find-products.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,sCAImB;AACnB,+DAAyD;AAEzD,iDAA6C;AAEhC,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,sDAAsD;IACnE,KAAK,EAAE;QACN,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;YACd,YAAY,EAAE,MAAM;YACpB,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACR;wBACC,KAAK,EAAE,MAAM;wBACb,KAAK,EAAE,MAAM;qBACb;oBACD;wBACC,KAAK,EAAE,cAAc;wBACrB,KAAK,EAAE,MAAM;qBACb;iBACD;aACD;SACD,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,QAAQ,GAAG,EAAE,CAAC;YACpB,IAAI,YAAY,GAAG,IAAI,CAAC;YAExB,GAAG,CAAC;gBACH,MAAM,EAAE,GAAG;oBACV,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,UAAU;oBACnC,MAAM,EAAE,OAAO,CAAC,UAAU,CAAC,KAAK;oBAChC,KAAK,EAAE,GAAG;oBACV,KAAK,EAAE,CAAC;oBACR,WAAW,EAAE,MAAM;iBACnB,CAAC;gBACF,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAWpC;oBACF,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;oBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;oBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,WAAW,EAAE,kBAAkB;oBAC/B,KAAK,EAAE,EAAE;iBACT,CAAC,CAAC;gBAEH,IAAI,IAAA,cAAK,EAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC;oBAAE,MAAM;gBAEtC,KAAI,MAAM,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,EACxC,CAAC;oBACA,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBAC7B,CAAC;gBAED,YAAY,GAAG,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,wBAAwB,CAAC;gBAC5E,EAAE,CAAC,KAAK,GAAG,QAAQ,CAAC,eAAe,CAAC,UAAU,CAAC,UAAU,CAAC;YAC3D,CAAC,QAAQ,YAAY,EAAE;YAEvB,OAAO;gBACN,KAAK,EAAE,QAAQ,CAAC,MAAM,GAAG,CAAC;gBAC1B,IAAI,EAAE,QAAQ;aACd,CAAC;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare const findUserAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ field: import("@activepieces/pieces-framework").StaticDropdownProperty<string, true>;
3
+ fieldValue: import("@activepieces/pieces-framework").ShortTextProperty<true>;
4
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.findUserAction = 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 common_1 = require("../common");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.findUserAction = (0, pieces_framework_1.createAction)({
10
+ auth: index_1.pipedriveAuth,
11
+ name: 'find-user',
12
+ displayName: 'Find User',
13
+ description: 'Find a user by name or email.',
14
+ props: {
15
+ field: pieces_framework_1.Property.StaticDropdown({
16
+ displayName: 'Field to search by',
17
+ required: true,
18
+ options: {
19
+ disabled: false,
20
+ options: [
21
+ {
22
+ label: 'Name',
23
+ value: 'name',
24
+ },
25
+ {
26
+ label: 'Email',
27
+ value: 'email',
28
+ },
29
+ ],
30
+ },
31
+ }),
32
+ fieldValue: pieces_framework_1.Property.ShortText({
33
+ displayName: 'Field Value',
34
+ required: true,
35
+ }),
36
+ },
37
+ run(context) {
38
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
39
+ const { field, fieldValue } = context.propsValue;
40
+ const response = yield (0, common_1.pipedriveApiCall)({
41
+ accessToken: context.auth.access_token,
42
+ apiDomain: context.auth.data['api_domain'],
43
+ method: pieces_common_1.HttpMethod.GET,
44
+ resourceUri: '/users/find',
45
+ query: {
46
+ term: fieldValue,
47
+ search_by_email: field == 'email' ? 1 : 0,
48
+ },
49
+ });
50
+ return {
51
+ found: response.data.length === 0 ? false : true,
52
+ data: response.data
53
+ };
54
+ });
55
+ },
56
+ });
57
+ //# sourceMappingURL=find-user.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"find-user.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/find-user.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,sCAA6C;AAC7C,+DAAyD;AAE5C,QAAA,cAAc,GAAG,IAAA,+BAAY,EAAC;IAC1C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,WAAW;IACxB,WAAW,EAAE,+BAA+B;IAC5C,KAAK,EAAE;QACN,KAAK,EAAE,2BAAQ,CAAC,cAAc,CAAC;YAC9B,WAAW,EAAE,oBAAoB;YACjC,QAAQ,EAAE,IAAI;YACd,OAAO,EAAE;gBACR,QAAQ,EAAE,KAAK;gBACf,OAAO,EAAE;oBACR;wBACC,KAAK,EAAE,MAAM;wBACb,KAAK,EAAE,MAAM;qBACb;oBACD;wBACC,KAAK,EAAE,OAAO;wBACd,KAAK,EAAE,OAAO;qBACd;iBACD;aACD;SACD,CAAC;QACF,UAAU,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC9B,WAAW,EAAE,aAAa;YAC1B,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjD,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EACtC;gBACC,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;gBAC1B,KAAK,EAAE;oBACN,IAAI,EAAE,UAAU;oBAChB,eAAe,EAAE,KAAK,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;iBACzC;aACD,CACD,CAAC;YAEF,OAAO;gBACG,KAAK,EAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,KAAK,CAAC,CAAA,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,IAAI;gBAC9C,IAAI,EAAE,QAAQ,CAAC,IAAI;aACtB,CAAC;QACT,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const getNoteAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ noteId: import("@activepieces/pieces-framework").NumberProperty<true>;
3
+ }>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getNoteAction = 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 common_1 = require("../common");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.getNoteAction = (0, pieces_framework_1.createAction)({
10
+ auth: index_1.pipedriveAuth,
11
+ name: 'get-note',
12
+ displayName: 'Retrieve a Note',
13
+ description: ' Finds a note by ID.',
14
+ props: {
15
+ noteId: pieces_framework_1.Property.Number({
16
+ displayName: 'Note ID',
17
+ required: true
18
+ })
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ try {
23
+ const response = yield (0, common_1.pipedriveApiCall)({
24
+ accessToken: context.auth.access_token,
25
+ apiDomain: context.auth.data['api_domain'],
26
+ method: pieces_common_1.HttpMethod.GET,
27
+ resourceUri: `/notes/${context.propsValue.noteId}`,
28
+ });
29
+ return response;
30
+ }
31
+ catch (error) {
32
+ return {
33
+ success: false,
34
+ };
35
+ }
36
+ });
37
+ }
38
+ });
39
+ //# sourceMappingURL=get-note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-note.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/get-note.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,sCAA6C;AAC7C,+DAAyD;AAE5C,QAAA,aAAa,GAAG,IAAA,+BAAY,EAAC;IACtC,IAAI,EAAC,qBAAa;IAClB,IAAI,EAAC,UAAU;IACf,WAAW,EAAC,iBAAiB;IAC7B,WAAW,EAAC,sBAAsB;IAClC,KAAK,EAAC;QACF,MAAM,EAAC,2BAAQ,CAAC,MAAM,CAAC;YACnB,WAAW,EAAC,SAAS;YACrB,QAAQ,EAAC,IAAI;SAChB,CAAC;KACL;IACK,GAAG,CAAC,OAAO;;YACb,IACA,CAAC;gBACG,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC;oBACpC,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;oBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;oBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,WAAW,EAAC,UAAU,OAAO,CAAC,UAAU,CAAC,MAAM,EAAE;iBACpD,CAAC,CAAC;gBACH,OAAO,QAAQ,CAAC;YACpB,CAAC;YACD,OAAM,KAAK,EACX,CAAC;gBACG,OAAO;oBACH,OAAO,EAAC,KAAK;iBAChB,CAAA;YACL,CAAC;QACL,CAAC;KAAA;CACJ,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export declare const getProductAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ productId: import("@activepieces/pieces-framework").NumberProperty<true>;
3
+ }>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getProductAction = 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 common_1 = require("../common");
8
+ const pieces_common_1 = require("@activepieces/pieces-common");
9
+ exports.getProductAction = (0, pieces_framework_1.createAction)({
10
+ auth: index_1.pipedriveAuth,
11
+ name: 'get-product',
12
+ displayName: 'Retrieve a Product',
13
+ description: ' Finds a product by ID.',
14
+ props: {
15
+ productId: pieces_framework_1.Property.Number({
16
+ displayName: 'Product ID',
17
+ required: true,
18
+ }),
19
+ },
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ try {
23
+ const response = yield (0, common_1.pipedriveApiCall)({
24
+ accessToken: context.auth.access_token,
25
+ apiDomain: context.auth.data['api_domain'],
26
+ method: pieces_common_1.HttpMethod.GET,
27
+ resourceUri: `/products/${context.propsValue.productId}`,
28
+ });
29
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
30
+ accessToken: context.auth.access_token,
31
+ apiDomain: context.auth.data['api_domain'],
32
+ method: pieces_common_1.HttpMethod.GET,
33
+ resourceUri: '/productFields',
34
+ });
35
+ const updatedProductProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, response.data);
36
+ return {
37
+ found: true,
38
+ data: [updatedProductProperties],
39
+ };
40
+ }
41
+ catch (error) {
42
+ return {
43
+ found: false,
44
+ data: []
45
+ };
46
+ }
47
+ });
48
+ },
49
+ });
50
+ //# sourceMappingURL=get-product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-product.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/get-product.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,sCAImB;AACnB,+DAAyD;AAG5C,QAAA,gBAAgB,GAAG,IAAA,+BAAY,EAAC;IAC5C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,aAAa;IACnB,WAAW,EAAE,oBAAoB;IACjC,WAAW,EAAE,yBAAyB;IACtC,KAAK,EAAE;QACN,SAAS,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,YAAY;YACzB,QAAQ,EAAE,IAAI;SACd,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,IAAI,CAAC;gBACJ,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAkB;oBACxD,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;oBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;oBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,WAAW,EAAE,aAAa,OAAO,CAAC,UAAU,CAAC,SAAS,EAAE;iBACxD,CAAC,CAAC;gBAEH,MAAM,oBAAoB,GAAG,MAAM,IAAA,kCAAyB,EAAW;oBACtE,WAAW,EAAE,OAAO,CAAC,IAAI,CAAC,YAAY;oBACtC,SAAS,EAAE,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC;oBAC1C,MAAM,EAAE,0BAAU,CAAC,GAAG;oBACtB,WAAW,EAAE,gBAAgB;iBAC7B,CAAC,CAAC;gBAEH,MAAM,wBAAwB,GAAG,IAAA,uCAA8B,EAC9D,oBAAoB,EACpB,QAAQ,CAAC,IAAI,CACb,CAAC;gBAEF,OAAO;oBACN,KAAK,EAAE,IAAI;oBACX,IAAI,EAAE,CAAC,wBAAwB,CAAC;iBAChC,CAAC;YACH,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,OAAO;oBACN,KAAK,EAAE,KAAK;oBACA,IAAI,EAAC,EAAE;iBACnB,CAAC;YACH,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export declare const updateActivityAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ organizationId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
3
+ personId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
4
+ dealId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
5
+ leadId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
6
+ assignTo: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
7
+ type: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
8
+ dueDate: import("@activepieces/pieces-framework").DateTimeProperty<false>;
9
+ dueTime: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
+ duration: import("@activepieces/pieces-framework").ShortTextProperty<false>;
11
+ idDone: import("@activepieces/pieces-framework").CheckboxProperty<false>;
12
+ isBusy: import("@activepieces/pieces-framework").StaticDropdownProperty<string, false>;
13
+ note: import("@activepieces/pieces-framework").LongTextProperty<false>;
14
+ publicDescription: import("@activepieces/pieces-framework").LongTextProperty<false>;
15
+ activityId: import("@activepieces/pieces-framework").NumberProperty<true>;
16
+ subject: import("@activepieces/pieces-framework").ShortTextProperty<false>;
17
+ }>;
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateActivityAction = 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
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
+ exports.updateActivityAction = (0, pieces_framework_1.createAction)({
12
+ auth: index_1.pipedriveAuth,
13
+ name: 'update-activity',
14
+ displayName: 'Update Activity',
15
+ description: 'Updates an existing activity.',
16
+ props: Object.assign({ activityId: pieces_framework_1.Property.Number({
17
+ displayName: 'Activity',
18
+ required: true,
19
+ }), subject: pieces_framework_1.Property.ShortText({
20
+ displayName: 'Subject',
21
+ required: false,
22
+ }) }, props_1.activityCommonProps),
23
+ run(context) {
24
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
25
+ const { activityId, subject, organizationId, personId, dealId, leadId, assignTo, type, dueDate, dueTime, duration, idDone, isBusy, note, publicDescription, } = context.propsValue;
26
+ const activityDefaultFields = {
27
+ subject,
28
+ org_id: organizationId,
29
+ person_id: personId,
30
+ deal_id: dealId,
31
+ lead_id: leadId,
32
+ note,
33
+ public_description: publicDescription,
34
+ type,
35
+ user_id: assignTo,
36
+ due_time: dueTime,
37
+ duration,
38
+ done: idDone ? 1 : 0,
39
+ };
40
+ if (isBusy) {
41
+ activityDefaultFields.busy_flag = isBusy === 'busy' ? true : false;
42
+ }
43
+ if (dueDate) {
44
+ activityDefaultFields.due_date = (0, dayjs_1.default)(dueDate).format('YYYY-MM-DD');
45
+ }
46
+ const response = yield (0, common_1.pipedriveApiCall)({
47
+ accessToken: context.auth.access_token,
48
+ apiDomain: context.auth.data['api_domain'],
49
+ method: pieces_common_1.HttpMethod.PUT,
50
+ resourceUri: `/activities/${activityId}`,
51
+ body: activityDefaultFields,
52
+ });
53
+ return response;
54
+ });
55
+ },
56
+ });
57
+ //# sourceMappingURL=update-activity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-activity.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/update-activity.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAAsD;AACtD,sCAA6C;AAC7C,+DAAyD;AACzD,0DAA0B;AAEb,QAAA,oBAAoB,GAAG,IAAA,+BAAY,EAAC;IAChD,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,iBAAiB;IAC9B,WAAW,EAAE,+BAA+B;IAC5C,KAAK,kBACJ,UAAU,EAAE,2BAAQ,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,UAAU;YACvB,QAAQ,EAAE,IAAI;SACd,CAAC,EACF,OAAO,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC3B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,KAAK;SACf,CAAC,IACC,2BAAmB,CACtB;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EACL,UAAU,EACV,OAAO,EACP,cAAc,EACd,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,IAAI,EACJ,iBAAiB,GACjB,GAAG,OAAO,CAAC,UAAU,CAAC;YAEvB,MAAM,qBAAqB,GAAwB;gBAClD,OAAO;gBACP,MAAM,EAAE,cAAc;gBACtB,SAAS,EAAE,QAAQ;gBACnB,OAAO,EAAE,MAAM;gBACf,OAAO,EAAE,MAAM;gBACf,IAAI;gBACJ,kBAAkB,EAAE,iBAAiB;gBACrC,IAAI;gBACJ,OAAO,EAAE,QAAQ;gBACjB,QAAQ,EAAE,OAAO;gBACjB,QAAQ;gBACR,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACpB,CAAC;YAEF,IAAI,MAAM,EAAE,CAAC;gBACZ,qBAAqB,CAAC,SAAS,GAAG,MAAM,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;YACpE,CAAC;YAED,IAAI,OAAO,EAAE,CAAC;gBACb,qBAAqB,CAAC,QAAQ,GAAG,IAAA,eAAK,EAAC,OAAO,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YACtE,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,IAAA,yBAAgB,EAAC;gBACvC,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,eAAe,UAAU,EAAE;gBACxC,IAAI,EAAE,qBAAqB;aAC3B,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,18 @@
1
+ export declare const updateDealAction: 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").DateTimeProperty<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
+ dealId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
17
+ title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
18
+ }>;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateDealAction = 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
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
+ exports.updateDealAction = (0, pieces_framework_1.createAction)({
12
+ auth: index_1.pipedriveAuth,
13
+ name: 'update-deal',
14
+ displayName: 'Update Deal',
15
+ description: 'Updates an existing deal.',
16
+ props: Object.assign({ dealId: (0, props_1.dealIdProp)(true), title: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Title',
18
+ required: false,
19
+ }) }, props_1.dealCommonProps),
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ var _a, _b;
23
+ const { dealId, title, dealValue, dealValueCurrency, expectedCloseDate, visibleTo, probability, stageId, status, pipelineId, ownerId, organizationId, personId, creationTime, } = context.propsValue;
24
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
25
+ const customFields = (_b = context.propsValue.customfields) !== null && _b !== void 0 ? _b : {};
26
+ const dealDefaultFields = {
27
+ title,
28
+ pipeline_id: pipelineId,
29
+ stage_id: stageId,
30
+ status,
31
+ add_time: creationTime,
32
+ probability,
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
+ if (expectedCloseDate) {
44
+ dealDefaultFields.expected_close_date = (0, dayjs_1.default)(expectedCloseDate).format('YYYY-MM-DD');
45
+ }
46
+ const dealCustomFields = {};
47
+ Object.entries(customFields).forEach(([key, value]) => {
48
+ // Format values if they are arrays
49
+ dealCustomFields[key] = Array.isArray(value) && value.length > 0 ? value.join(',') : value;
50
+ });
51
+ const updatedDealResponse = yield (0, common_1.pipedriveApiCall)({
52
+ accessToken: context.auth.access_token,
53
+ apiDomain: context.auth.data['api_domain'],
54
+ method: pieces_common_1.HttpMethod.PUT,
55
+ resourceUri: `/deals/${dealId}`,
56
+ body: Object.assign(Object.assign({}, dealDefaultFields), dealCustomFields),
57
+ });
58
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
59
+ accessToken: context.auth.access_token,
60
+ apiDomain: context.auth.data['api_domain'],
61
+ method: pieces_common_1.HttpMethod.GET,
62
+ resourceUri: '/dealFields',
63
+ });
64
+ const updatedLeadProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, updatedDealResponse.data);
65
+ return Object.assign(Object.assign({}, updatedDealResponse), { data: updatedLeadProperties });
66
+ });
67
+ },
68
+ });
69
+ //# sourceMappingURL=update-deal.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-deal.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/update-deal.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,14 @@
1
+ export declare const updateLeadAction: 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").DateTimeProperty<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
+ leadId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
13
+ title: import("@activepieces/pieces-framework").ShortTextProperty<false>;
14
+ }>;
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateLeadAction = 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
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
+ exports.updateLeadAction = (0, pieces_framework_1.createAction)({
12
+ auth: index_1.pipedriveAuth,
13
+ name: 'update-lead',
14
+ displayName: 'Update Lead',
15
+ description: 'Updates an existing lead.',
16
+ props: Object.assign({ leadId: (0, props_1.leadIdProp)(true), title: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Title',
18
+ required: false,
19
+ }) }, props_1.leadCommonProps),
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ var _a, _b;
23
+ const { title, ownerId, leadId, channel, organizationId, personId, expectedCloseDate, visibleTo, leadValue, leadValueCurrency, } = context.propsValue;
24
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
25
+ const customFields = (_b = context.propsValue.customfields) !== null && _b !== void 0 ? _b : {};
26
+ const leadDefaultFields = {
27
+ title,
28
+ owner_id: ownerId,
29
+ organization_id: organizationId,
30
+ person_id: personId,
31
+ channel: channel,
32
+ visible_to: visibleTo,
33
+ };
34
+ if (labelIds.length > 0) {
35
+ leadDefaultFields.label_ids = labelIds;
36
+ }
37
+ if (expectedCloseDate) {
38
+ leadDefaultFields.expected_close_date = (0, dayjs_1.default)(expectedCloseDate).format('YYYY-MM-DD');
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.length > 0 ? value.join(',') : value;
53
+ });
54
+ const updatedLeadResponse = yield (0, common_1.pipedriveApiCall)({
55
+ accessToken: context.auth.access_token,
56
+ apiDomain: context.auth.data['api_domain'],
57
+ method: pieces_common_1.HttpMethod.PATCH,
58
+ resourceUri: `/leads/${leadId}`,
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, updatedLeadResponse.data);
68
+ return Object.assign(Object.assign({}, updatedLeadResponse), { data: updatedLeadProperties });
69
+ });
70
+ },
71
+ });
72
+ //# sourceMappingURL=update-lead.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-lead.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/update-lead.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,9 @@
1
+ export declare const updateOrganizationAction: 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
+ organizationId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
8
+ name: import("@activepieces/pieces-framework").ShortTextProperty<false>;
9
+ }>;