@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,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").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
+ title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
17
+ }>;
@@ -0,0 +1,69 @@
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
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
+ exports.createDealAction = (0, pieces_framework_1.createAction)({
12
+ auth: index_1.pipedriveAuth,
13
+ name: 'create-deal',
14
+ displayName: 'Create Deal',
15
+ description: 'Creates a new deal.',
16
+ props: Object.assign({ title: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Title',
18
+ required: true,
19
+ }) }, props_1.dealCommonProps),
20
+ run(context) {
21
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
22
+ var _a, _b;
23
+ const { 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.join(',') : value;
50
+ });
51
+ const createdDealResponse = yield (0, common_1.pipedriveApiCall)({
52
+ accessToken: context.auth.access_token,
53
+ apiDomain: context.auth.data['api_domain'],
54
+ method: pieces_common_1.HttpMethod.POST,
55
+ resourceUri: '/deals',
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, createdDealResponse.data);
65
+ return Object.assign(Object.assign({}, createdDealResponse), { data: updatedLeadProperties });
66
+ });
67
+ },
68
+ });
69
+ //# 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;AAEzD,0DAA0B;AAEb,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;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AAC,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YACxE,CAAC,CAAC,CAAC;YAEH,MAAM,mBAAmB,GAAG,MAAM,IAAA,yBAAgB,EAA6B;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,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").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
+ title: import("@activepieces/pieces-framework").ShortTextProperty<true>;
13
+ }>;
@@ -0,0 +1,75 @@
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
+ const dayjs_1 = tslib_1.__importDefault(require("dayjs"));
11
+ exports.createLeadAction = (0, pieces_framework_1.createAction)({
12
+ auth: index_1.pipedriveAuth,
13
+ name: 'create-lead',
14
+ displayName: 'Create Lead',
15
+ description: 'Creates a new lead.',
16
+ props: Object.assign({ title: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Title',
18
+ required: true,
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, channel, organizationId, personId, expectedCloseDate, visibleTo, leadValue, leadValueCurrency, } = context.propsValue;
24
+ if (!personId && !organizationId) {
25
+ throw new Error('Neither an Organization nor a Person were provided. One of them must be provided in order to create a lead.');
26
+ }
27
+ const labelIds = (_a = context.propsValue.labelIds) !== null && _a !== void 0 ? _a : [];
28
+ const customFields = (_b = context.propsValue.customfields) !== null && _b !== void 0 ? _b : {};
29
+ const leadDefaultFields = {
30
+ title,
31
+ owner_id: ownerId,
32
+ organization_id: organizationId,
33
+ person_id: personId,
34
+ channel: channel,
35
+ visible_to: visibleTo,
36
+ };
37
+ if (labelIds.length > 0) {
38
+ leadDefaultFields.label_ids = labelIds;
39
+ }
40
+ if (expectedCloseDate) {
41
+ leadDefaultFields.expected_close_date = (0, dayjs_1.default)(expectedCloseDate).format('YYYY-MM-DD');
42
+ }
43
+ if (leadValue) {
44
+ if (!leadValueCurrency) {
45
+ throw new Error('lead Value Currency is required when lead Value is provided');
46
+ }
47
+ leadDefaultFields.value = {
48
+ amount: leadValue,
49
+ currency: leadValueCurrency,
50
+ };
51
+ }
52
+ const leadCustomFields = {};
53
+ Object.entries(customFields).forEach(([key, value]) => {
54
+ // Format values if they are arrays
55
+ leadCustomFields[key] = Array.isArray(value) ? value.join(',') : value;
56
+ });
57
+ const createdLeadResponse = yield (0, common_1.pipedriveApiCall)({
58
+ accessToken: context.auth.access_token,
59
+ apiDomain: context.auth.data['api_domain'],
60
+ method: pieces_common_1.HttpMethod.POST,
61
+ resourceUri: '/leads',
62
+ body: Object.assign(Object.assign({}, leadDefaultFields), leadCustomFields),
63
+ });
64
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
65
+ accessToken: context.auth.access_token,
66
+ apiDomain: context.auth.data['api_domain'],
67
+ method: pieces_common_1.HttpMethod.GET,
68
+ resourceUri: '/dealFields',
69
+ });
70
+ const updatedLeadProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, createdLeadResponse.data);
71
+ return Object.assign(Object.assign({}, createdLeadResponse), { data: updatedLeadProperties });
72
+ });
73
+ },
74
+ });
75
+ //# 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":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A8B,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,11 @@
1
+ export declare const createNoteAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ content: import("@activepieces/pieces-framework").LongTextProperty<true>;
3
+ dealId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
4
+ pinnedToDeal: import("@activepieces/pieces-framework").CheckboxProperty<false>;
5
+ personId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
6
+ pinnedToPerson: import("@activepieces/pieces-framework").CheckboxProperty<false>;
7
+ organizationId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
8
+ pinnedToOrganization: import("@activepieces/pieces-framework").CheckboxProperty<false>;
9
+ leadId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
10
+ pinnedToLead: import("@activepieces/pieces-framework").CheckboxProperty<false>;
11
+ }>;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createNoteAction = 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.createNoteAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'create-note',
13
+ displayName: 'Create Note',
14
+ description: 'Creates a new note.',
15
+ props: {
16
+ content: pieces_framework_1.Property.LongText({
17
+ displayName: 'Content',
18
+ required: true,
19
+ }),
20
+ dealId: (0, props_1.dealIdProp)(false),
21
+ pinnedToDeal: pieces_framework_1.Property.Checkbox({
22
+ displayName: 'Pin note to deal?',
23
+ required: false,
24
+ defaultValue: false,
25
+ }),
26
+ personId: (0, props_1.personIdProp)(false),
27
+ pinnedToPerson: pieces_framework_1.Property.Checkbox({
28
+ displayName: 'Pin note to person?',
29
+ required: false,
30
+ defaultValue: false,
31
+ }),
32
+ organizationId: (0, props_1.organizationIdProp)(false),
33
+ pinnedToOrganization: pieces_framework_1.Property.Checkbox({
34
+ displayName: 'Pin note to organization?',
35
+ required: false,
36
+ defaultValue: false,
37
+ }),
38
+ leadId: (0, props_1.leadIdProp)(false),
39
+ pinnedToLead: pieces_framework_1.Property.Checkbox({
40
+ displayName: 'Pin note to lead?',
41
+ required: false,
42
+ defaultValue: false,
43
+ }),
44
+ },
45
+ run(context) {
46
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
47
+ const { content, dealId, personId, organizationId, leadId, pinnedToDeal, pinnedToPerson, pinnedToOrganization, pinnedToLead, } = context.propsValue;
48
+ if (!dealId && !personId && !organizationId && !leadId) {
49
+ throw new Error("Note must be associated with at least one organization, person, deal, lead or project.");
50
+ }
51
+ const noteDefaultFields = {
52
+ content,
53
+ pinned_to_deal_flag: pinnedToDeal ? 1 : 0,
54
+ pinned_to_person_flag: pinnedToPerson ? 1 : 0,
55
+ pinned_to_organization_flag: pinnedToOrganization ? 1 : 0,
56
+ pinned_to_lead_flag: pinnedToLead ? 1 : 0,
57
+ lead_id: leadId,
58
+ person_id: personId,
59
+ org_id: organizationId,
60
+ deal_id: dealId,
61
+ };
62
+ const response = yield (0, common_1.pipedriveApiCall)({
63
+ accessToken: context.auth.access_token,
64
+ apiDomain: context.auth.data['api_domain'],
65
+ method: pieces_common_1.HttpMethod.POST,
66
+ resourceUri: '/notes',
67
+ body: noteDefaultFields,
68
+ });
69
+ return response;
70
+ });
71
+ },
72
+ });
73
+ //# sourceMappingURL=create-note.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-note.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/create-note.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAA2F;AAC3F,sCAA6C;AAC7C,+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,EAAE;QACN,OAAO,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC1B,WAAW,EAAE,SAAS;YACtB,QAAQ,EAAE,IAAI;SACd,CAAC;QACF,MAAM,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC;QACzB,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACnB,CAAC;QACF,QAAQ,EAAE,IAAA,oBAAY,EAAC,KAAK,CAAC;QAC7B,cAAc,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACjC,WAAW,EAAE,qBAAqB;YAClC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACnB,CAAC;QACF,cAAc,EAAE,IAAA,0BAAkB,EAAC,KAAK,CAAC;QACzC,oBAAoB,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YACvC,WAAW,EAAE,2BAA2B;YACxC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACnB,CAAC;QACF,MAAM,EAAE,IAAA,kBAAU,EAAC,KAAK,CAAC;QACzB,YAAY,EAAE,2BAAQ,CAAC,QAAQ,CAAC;YAC/B,WAAW,EAAE,mBAAmB;YAChC,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,KAAK;SACnB,CAAC;KACF;IACK,GAAG,CAAC,OAAO;;YAChB,MAAM,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,cAAc,EACd,MAAM,EACN,YAAY,EACZ,cAAc,EACd,oBAAoB,EACpB,YAAY,GACZ,GAAG,OAAO,CAAC,UAAU,CAAC;YAEjB,IAAG,CAAC,MAAM,IAAI,CAAC,QAAQ,IAAI,CAAC,cAAc,IAAI,CAAC,MAAM,EAAC,CAAC;gBACnD,MAAM,IAAI,KAAK,CAAC,wFAAwF,CAAC,CAAC;YAC9G,CAAC;YAEP,MAAM,iBAAiB,GAAwB;gBAC9C,OAAO;gBACP,mBAAmB,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,qBAAqB,EAAE,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC7C,2BAA2B,EAAE,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzD,mBAAmB,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;gBACzC,OAAO,EAAE,MAAM;gBACf,SAAS,EAAE,QAAQ;gBACnB,MAAM,EAAE,cAAc;gBACtB,OAAO,EAAE,MAAM;aACf,CAAC;YAEF,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,IAAI;gBACvB,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,iBAAiB;aACvB,CAAC,CAAC;YAEH,OAAO,QAAQ,CAAC;QACjB,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 organizationCustomFields = {};
35
+ Object.entries(customFields).forEach(([key, value]) => {
36
+ // Format values if they are arrays
37
+ organizationCustomFields[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), organizationCustomFields),
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,UAA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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
+ }>;
@@ -0,0 +1,68 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createPersonAction = 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.createPersonAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'create-person',
13
+ displayName: 'Create Person',
14
+ description: 'Creates a new person.',
15
+ props: Object.assign({ name: pieces_framework_1.Property.ShortText({
16
+ displayName: 'Name',
17
+ required: true,
18
+ }) }, props_1.personCommonProps),
19
+ run(context) {
20
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ var _a, _b, _c, _d;
22
+ const { name, ownerId, organizationId, marketing_status, visibleTo, firstName, lastName } = context.propsValue;
23
+ const phone = (_a = context.propsValue.phone) !== null && _a !== void 0 ? _a : [];
24
+ const email = (_b = context.propsValue.email) !== null && _b !== void 0 ? _b : [];
25
+ const labelIds = (_c = context.propsValue.labelIds) !== null && _c !== void 0 ? _c : [];
26
+ const customFields = (_d = context.propsValue.customfields) !== null && _d !== void 0 ? _d : {};
27
+ const personDefaultFields = {
28
+ name: name,
29
+ owner_id: ownerId,
30
+ org_id: organizationId,
31
+ marketing_status: marketing_status,
32
+ visible_to: visibleTo,
33
+ first_name: firstName,
34
+ last_name: lastName,
35
+ };
36
+ if (phone.length > 0) {
37
+ personDefaultFields.phone = phone;
38
+ }
39
+ if (email.length > 0) {
40
+ personDefaultFields.email = email;
41
+ }
42
+ if (labelIds.length > 0) {
43
+ personDefaultFields.label_ids = labelIds;
44
+ }
45
+ const personCustomFields = {};
46
+ Object.entries(customFields).forEach(([key, value]) => {
47
+ // Format values if they are arrays
48
+ personCustomFields[key] = Array.isArray(value) ? value.join(',') : value;
49
+ });
50
+ const createdPersonResponse = yield (0, common_1.pipedriveApiCall)({
51
+ accessToken: context.auth.access_token,
52
+ apiDomain: context.auth.data['api_domain'],
53
+ method: pieces_common_1.HttpMethod.POST,
54
+ resourceUri: '/persons',
55
+ body: Object.assign(Object.assign({}, personDefaultFields), personCustomFields),
56
+ });
57
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
58
+ accessToken: context.auth.access_token,
59
+ apiDomain: context.auth.data['api_domain'],
60
+ method: pieces_common_1.HttpMethod.GET,
61
+ resourceUri: '/personFields',
62
+ });
63
+ const updatedPersonProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, createdPersonResponse.data);
64
+ return Object.assign(Object.assign({}, createdPersonResponse), { data: updatedPersonProperties });
65
+ });
66
+ },
67
+ });
68
+ //# sourceMappingURL=create-person.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-person.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/create-person.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAAoD;AACpD,sCAImB;AAEnB,+DAAyD;AAE5C,QAAA,kBAAkB,GAAG,IAAA,+BAAY,EAAC;IAC9C,IAAI,EAAE,qBAAa;IACnB,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,uBAAuB;IACpC,KAAK,kBACJ,IAAI,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACxB,WAAW,EAAE,MAAM;YACnB,QAAQ,EAAE,IAAI;SACd,CAAC,IACC,yBAAiB,CACpB;IACK,GAAG,CAAC,OAAO;;;YAChB,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,GACxF,OAAO,CAAC,UAAU,CAAC;YACpB,MAAM,KAAK,GAAG,MAAC,OAAO,CAAC,UAAU,CAAC,KAAkB,mCAAI,EAAE,CAAC;YAC3D,MAAM,KAAK,GAAG,MAAC,OAAO,CAAC,UAAU,CAAC,KAAkB,mCAAI,EAAE,CAAC;YAC3D,MAAM,QAAQ,GAAG,MAAC,OAAO,CAAC,UAAU,CAAC,QAAqB,mCAAI,EAAE,CAAC;YACjE,MAAM,YAAY,GAAG,MAAA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BAAkB,CACrB;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,eAAe;aAC5B,CAAC,CAAC;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,15 @@
1
+ export declare const createProductAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ name: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ code: import("@activepieces/pieces-framework").ShortTextProperty<false>;
4
+ description: import("@activepieces/pieces-framework").LongTextProperty<false>;
5
+ unit: import("@activepieces/pieces-framework").ShortTextProperty<false>;
6
+ tax: import("@activepieces/pieces-framework").NumberProperty<false>;
7
+ isActive: import("@activepieces/pieces-framework").CheckboxProperty<false>;
8
+ ownerId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
9
+ currency: import("@activepieces/pieces-framework").ShortTextProperty<false>;
10
+ price: import("@activepieces/pieces-framework").NumberProperty<false>;
11
+ cost: import("@activepieces/pieces-framework").NumberProperty<false>;
12
+ overheadCost: import("@activepieces/pieces-framework").NumberProperty<false>;
13
+ visibleTo: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
14
+ customfields: import("@activepieces/pieces-framework").DynamicProperties<false>;
15
+ }>;
@@ -0,0 +1,109 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createProductAction = 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.createProductAction = (0, pieces_framework_1.createAction)({
11
+ auth: index_1.pipedriveAuth,
12
+ name: 'create-product',
13
+ displayName: 'Create Product',
14
+ description: 'Creates a new product.',
15
+ props: {
16
+ name: pieces_framework_1.Property.ShortText({
17
+ displayName: 'Name',
18
+ required: true,
19
+ }),
20
+ code: pieces_framework_1.Property.ShortText({
21
+ displayName: 'Code',
22
+ required: false,
23
+ }),
24
+ description: pieces_framework_1.Property.LongText({
25
+ displayName: 'Description',
26
+ required: false,
27
+ }),
28
+ unit: pieces_framework_1.Property.ShortText({
29
+ displayName: 'Unit',
30
+ required: false,
31
+ }),
32
+ tax: pieces_framework_1.Property.Number({
33
+ displayName: 'Tax percentage',
34
+ required: false,
35
+ }),
36
+ isActive: pieces_framework_1.Property.Checkbox({
37
+ displayName: 'Is Active ?',
38
+ required: false,
39
+ }),
40
+ ownerId: (0, props_1.ownerIdProp)('Owner', false),
41
+ currency: pieces_framework_1.Property.ShortText({
42
+ displayName: 'Currency',
43
+ required: false,
44
+ description: 'Please enter currency code.',
45
+ }),
46
+ price: pieces_framework_1.Property.Number({
47
+ displayName: 'Price',
48
+ required: false,
49
+ }),
50
+ cost: pieces_framework_1.Property.Number({
51
+ displayName: 'Cost',
52
+ required: false,
53
+ }),
54
+ overheadCost: pieces_framework_1.Property.Number({
55
+ displayName: 'Overhead Cost',
56
+ required: false,
57
+ }),
58
+ visibleTo: props_1.visibleToProp,
59
+ customfields: (0, props_1.customFieldsProp)('product'),
60
+ },
61
+ run(context) {
62
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
63
+ var _a;
64
+ const { name, code, description, unit, tax, isActive, ownerId, currency, price, cost, overheadCost, visibleTo, } = context.propsValue;
65
+ const customFields = (_a = context.propsValue.customfields) !== null && _a !== void 0 ? _a : {};
66
+ const productDefaultFields = {
67
+ name,
68
+ code,
69
+ description,
70
+ unit,
71
+ tax,
72
+ active_flag: isActive,
73
+ prices: [
74
+ {
75
+ price: price !== null && price !== void 0 ? price : 0,
76
+ currency: currency !== null && currency !== void 0 ? currency : 'USD',
77
+ cost: cost !== null && cost !== void 0 ? cost : 0,
78
+ overhead_cost: overheadCost !== null && overheadCost !== void 0 ? overheadCost : 0,
79
+ },
80
+ ],
81
+ visible_to: visibleTo,
82
+ };
83
+ if (ownerId) {
84
+ productDefaultFields.owner_id = ownerId;
85
+ }
86
+ const productCustomFields = {};
87
+ Object.entries(customFields).forEach(([key, value]) => {
88
+ // Format values if they are arrays
89
+ productCustomFields[key] = Array.isArray(value) ? value.join(',') : value;
90
+ });
91
+ const createdProductResponse = yield (0, common_1.pipedriveApiCall)({
92
+ accessToken: context.auth.access_token,
93
+ apiDomain: context.auth.data['api_domain'],
94
+ method: pieces_common_1.HttpMethod.POST,
95
+ resourceUri: '/products',
96
+ body: Object.assign(Object.assign({}, productDefaultFields), productCustomFields),
97
+ });
98
+ const customFieldsResponse = yield (0, common_1.pipedrivePaginatedApiCall)({
99
+ accessToken: context.auth.access_token,
100
+ apiDomain: context.auth.data['api_domain'],
101
+ method: pieces_common_1.HttpMethod.GET,
102
+ resourceUri: '/productFields',
103
+ });
104
+ const updatedProductProperties = (0, common_1.pipedriveTransformCustomFields)(customFieldsResponse, createdProductResponse.data);
105
+ return Object.assign(Object.assign({}, createdProductResponse), { data: updatedProductProperties });
106
+ });
107
+ },
108
+ });
109
+ //# sourceMappingURL=create-product.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-product.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/pipedrive/src/lib/actions/create-product.ts"],"names":[],"mappings":";;;;AAAA,uCAA4C;AAC5C,qEAAwE;AACxE,2CAA+E;AAC/E,sCAImB;AAEn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CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YAC3E,CAAC,CAAC,CAAC;YAEH,MAAM,sBAAsB,GAAG,MAAM,IAAA,yBAAgB,EAA6B;gBACjF,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,WAAW;gBACxB,IAAI,kCACA,oBAAoB,GACpB,mBAAmB,CACtB;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,gBAAgB;aAC7B,CAAC,CAAC;YAEH,MAAM,wBAAwB,GAAG,IAAA,uCAA8B,EAC9D,oBAAoB,EACpB,sBAAsB,CAAC,IAAI,CAC3B,CAAC;YAEF,uCACI,sBAAsB,KACzB,IAAI,EAAE,wBAAwB,IAC7B;QACH,CAAC;KAAA;CACD,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ export declare const findActivityAction: import("@activepieces/pieces-framework").IAction<import("@activepieces/pieces-framework").OAuth2Property<import("@activepieces/pieces-framework").OAuth2Props>, {
2
+ subject: import("@activepieces/pieces-framework").ShortTextProperty<true>;
3
+ exactMatch: import("@activepieces/pieces-framework").CheckboxProperty<false>;
4
+ assignTo: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
5
+ type: import("@activepieces/pieces-framework").DropdownProperty<string, false> | import("@activepieces/pieces-framework").DropdownProperty<string, true>;
6
+ filterId: import("@activepieces/pieces-framework").DropdownProperty<number, false> | import("@activepieces/pieces-framework").DropdownProperty<number, true>;
7
+ status: import("@activepieces/pieces-framework").StaticDropdownProperty<number, false>;
8
+ }>;