@pipedream/prodpad 0.0.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 (33) hide show
  1. package/LICENSE +41 -0
  2. package/README.md +33 -0
  3. package/actions/create-company/create-company.mjs +81 -0
  4. package/actions/create-contact/create-contact.mjs +115 -0
  5. package/actions/create-feedback/create-feedback.mjs +85 -0
  6. package/actions/create-idea/create-idea.mjs +151 -0
  7. package/actions/find-company/find-company.mjs +85 -0
  8. package/actions/find-contact/find-contact.mjs +90 -0
  9. package/actions/find-feedback/find-feedback.mjs +123 -0
  10. package/actions/find-idea/find-idea.mjs +66 -0
  11. package/actions/find-or-create-company/find-or-create-company.mjs +105 -0
  12. package/actions/find-or-create-contact/find-or-create-contact.mjs +114 -0
  13. package/actions/find-or-create-feedback/find-or-create-feedback.mjs +149 -0
  14. package/actions/update-company/update-company.mjs +101 -0
  15. package/actions/update-contact/update-contact.mjs +134 -0
  16. package/actions/update-feedback/update-feedback.mjs +87 -0
  17. package/actions/update-idea-stage/update-idea-stage.mjs +52 -0
  18. package/common/constants.mjs +11 -0
  19. package/common/utils.mjs +42 -0
  20. package/package.json +19 -0
  21. package/prodpad.app.mjs +427 -0
  22. package/sources/common/polling.mjs +65 -0
  23. package/sources/new-company-created/new-company-created.mjs +27 -0
  24. package/sources/new-contact-created/new-contact-created.mjs +27 -0
  25. package/sources/new-feedback-created/new-feedback-created.mjs +27 -0
  26. package/sources/new-idea-created/new-idea-created.mjs +27 -0
  27. package/sources/new-idea-feedback-created/new-idea-feedback-created.mjs +38 -0
  28. package/sources/new-persona-created/new-persona-created.mjs +24 -0
  29. package/sources/new-product-created/new-product-created.mjs +24 -0
  30. package/sources/new-tag-created/new-tag-created.mjs +24 -0
  31. package/sources/new-user-story-created/new-user-story-created.mjs +24 -0
  32. package/sources/pushed-idea/pushed-idea.mjs +24 -0
  33. package/sources/pushed-user-story/pushed-user-story.mjs +24 -0
@@ -0,0 +1,134 @@
1
+ import app from "../../prodpad.app.mjs";
2
+ import utils from "../../common/utils.mjs";
3
+
4
+ export default {
5
+ key: "prodpad-update-contact",
6
+ name: "Update Contact",
7
+ description: "Updates a contact. [See the docs](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PutContact).",
8
+ type: "action",
9
+ version: "0.0.1",
10
+ props: {
11
+ app,
12
+ contactId: {
13
+ propDefinition: [
14
+ app,
15
+ "contactId",
16
+ ],
17
+ },
18
+ name: {
19
+ description: "The name of the contact",
20
+ optional: true,
21
+ propDefinition: [
22
+ app,
23
+ "name",
24
+ ],
25
+ },
26
+ email: {
27
+ description: "The email of the contact",
28
+ optional: true,
29
+ propDefinition: [
30
+ app,
31
+ "email",
32
+ ],
33
+ },
34
+ about: {
35
+ type: "string",
36
+ label: "About",
37
+ description: "About the contact",
38
+ optional: true,
39
+ },
40
+ phone: {
41
+ type: "string",
42
+ label: "Phone",
43
+ description: "The phone number of the contact",
44
+ optional: true,
45
+ },
46
+ twitterUrl: {
47
+ type: "string",
48
+ label: "Twitter URL",
49
+ description: "The twitter URL of the contact",
50
+ optional: true,
51
+ },
52
+ tagIds: {
53
+ type: "string[]",
54
+ label: "Tags",
55
+ description: "The tags to associate with the contact.",
56
+ optional: true,
57
+ propDefinition: [
58
+ app,
59
+ "tagId",
60
+ ],
61
+ },
62
+ personaIds: {
63
+ type: "string[]",
64
+ label: "Persona IDs",
65
+ description: "The persona IDs to associate with the contact.",
66
+ optional: true,
67
+ propDefinition: [
68
+ app,
69
+ "personaId",
70
+ ],
71
+ },
72
+ company: {
73
+ optional: true,
74
+ propDefinition: [
75
+ app,
76
+ "companyId",
77
+ ],
78
+ },
79
+ jobrole: {
80
+ optional: true,
81
+ propDefinition: [
82
+ app,
83
+ "jobroleId",
84
+ ],
85
+ },
86
+ },
87
+ methods: {
88
+ updateContact({
89
+ contactId, ...args
90
+ } = {}) {
91
+ return this.app.update({
92
+ path: `/contacts/${contactId}`,
93
+ ...args,
94
+ });
95
+ },
96
+ },
97
+ async run({ $: step }) {
98
+ const {
99
+ contactId,
100
+ name,
101
+ email,
102
+ about,
103
+ phone,
104
+ twitterUrl,
105
+ tagIds,
106
+ personaIds,
107
+ company,
108
+ jobrole,
109
+ } = this;
110
+
111
+ const response = await this.updateContact({
112
+ contactId,
113
+ data: {
114
+ name,
115
+ email,
116
+ about,
117
+ phone,
118
+ twitter_url: twitterUrl,
119
+ tags: utils.mapOrParse(tagIds, (id) => ({
120
+ id,
121
+ })),
122
+ personas: utils.mapOrParse(personaIds, (id) => ({
123
+ id,
124
+ })),
125
+ company,
126
+ job_role: jobrole,
127
+ },
128
+ });
129
+
130
+ step.export("$summary", `Successfully updated contact with ID ${response.id}`);
131
+
132
+ return response;
133
+ },
134
+ };
@@ -0,0 +1,87 @@
1
+ import app from "../../prodpad.app.mjs";
2
+
3
+ export default {
4
+ key: "prodpad-update-feedback",
5
+ name: "Update Feedback",
6
+ description: "Updates a feedback. [See the docs](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Feedback/PutFeedback).",
7
+ type: "action",
8
+ version: "0.0.1",
9
+ props: {
10
+ app,
11
+ feedbackId: {
12
+ propDefinition: [
13
+ app,
14
+ "feedbackId",
15
+ ],
16
+ },
17
+ feedback: {
18
+ optional: true,
19
+ propDefinition: [
20
+ app,
21
+ "feedback",
22
+ ],
23
+ },
24
+ state: {
25
+ type: "string",
26
+ label: "State",
27
+ description: "The state of the feedback",
28
+ optional: true,
29
+ options: [
30
+ "unsorted",
31
+ "active",
32
+ "archived",
33
+ ],
34
+ },
35
+ externalId: {
36
+ optional: true,
37
+ propDefinition: [
38
+ app,
39
+ "externalId",
40
+ ],
41
+ },
42
+ externalUrl: {
43
+ optional: true,
44
+ propDefinition: [
45
+ app,
46
+ "externalUrl",
47
+ ],
48
+ },
49
+ },
50
+ methods: {
51
+ updateFeedback({
52
+ feedbackId, ...args
53
+ } = {}) {
54
+ return this.app.update({
55
+ path: `/feedbacks/${feedbackId}`,
56
+ ...args,
57
+ });
58
+ },
59
+ },
60
+ async run({ $: step }) {
61
+ const {
62
+ feedbackId,
63
+ feedback,
64
+ state,
65
+ externalId,
66
+ externalUrl,
67
+ } = this;
68
+
69
+ const response = await this.updateFeedback({
70
+ feedbackId,
71
+ data: {
72
+ feedback,
73
+ state,
74
+ external_links: (externalId || externalUrl) && [
75
+ {
76
+ external_id: externalId,
77
+ url: externalUrl,
78
+ },
79
+ ],
80
+ },
81
+ });
82
+
83
+ step.export("$summary", `Successfully updated feedback with ID ${response.id}`);
84
+
85
+ return response;
86
+ },
87
+ };
@@ -0,0 +1,52 @@
1
+ import app from "../../prodpad.app.mjs";
2
+
3
+ export default {
4
+ key: "prodpad-update-idea-stage",
5
+ name: "Update Idea Stage",
6
+ description: "Updates the stage of an idea. [See the docs](https://app.swaggerhub.com/apis-docs/ProdPad/prodpad/1.0#/Ideas/PostIdeaStatus).",
7
+ type: "action",
8
+ version: "0.0.1",
9
+ props: {
10
+ app,
11
+ ideaId: {
12
+ propDefinition: [
13
+ app,
14
+ "ideaId",
15
+ ],
16
+ },
17
+ statusId: {
18
+ label: "Workflow Stage",
19
+ propDefinition: [
20
+ app,
21
+ "statusId",
22
+ ],
23
+ },
24
+ },
25
+ methods: {
26
+ updateStatusIdea({
27
+ ideaId, ...args
28
+ } = {}) {
29
+ return this.app.create({
30
+ path: `/ideas/${ideaId}/statuses`,
31
+ ...args,
32
+ });
33
+ },
34
+ },
35
+ async run({ $: step }) {
36
+ const {
37
+ ideaId,
38
+ statusId,
39
+ } = this;
40
+
41
+ const response = await this.updateStatusIdea({
42
+ ideaId,
43
+ data: {
44
+ status_id: statusId,
45
+ },
46
+ });
47
+
48
+ step.export("$summary", `Successfully updated workflow stage idea with ID ${response.id}`);
49
+
50
+ return response;
51
+ },
52
+ };
@@ -0,0 +1,11 @@
1
+ const BASE_URL = "https://api.prodpad.com";
2
+ const VERSION_PATH = "/v1";
3
+ const DEFAULT_MAX = 1000;
4
+ const LAST_CREATED_AT = "lastCreatedAt";
5
+
6
+ export default {
7
+ BASE_URL,
8
+ VERSION_PATH,
9
+ LAST_CREATED_AT,
10
+ DEFAULT_MAX,
11
+ };
@@ -0,0 +1,42 @@
1
+ import { ConfigurationError } from "@pipedream/platform";
2
+
3
+ async function streamIterator(stream) {
4
+ const resources = [];
5
+ for await (const resource of stream) {
6
+ resources.push(resource);
7
+ }
8
+ return resources;
9
+ }
10
+
11
+ function summaryEnd(count, singular, plural) {
12
+ if (!plural) {
13
+ plural = singular + "s";
14
+ }
15
+ const noun = count === 1 && singular || plural;
16
+ return `${count} ${noun}`;
17
+ }
18
+
19
+ function mapOrParse(value, mapper = (item) => item) {
20
+ try {
21
+ if (!value) {
22
+ return [];
23
+ }
24
+
25
+ const array = Array.isArray(value) && value.map(mapper) || JSON.parse(value);
26
+
27
+ if (!Array.isArray(array)) {
28
+ throw new Error("Object is not an array");
29
+ }
30
+
31
+ return array;
32
+
33
+ } catch (e) {
34
+ throw new ConfigurationError("Make sure the custom expression contains a valid array object");
35
+ }
36
+ }
37
+
38
+ export default {
39
+ streamIterator,
40
+ summaryEnd,
41
+ mapOrParse,
42
+ };
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@pipedream/prodpad",
3
+ "version": "0.0.1",
4
+ "description": "Pipedream ProdPad Components",
5
+ "main": "prodpad.app.mjs",
6
+ "keywords": [
7
+ "pipedream",
8
+ "prodpad"
9
+ ],
10
+ "homepage": "https://pipedream.com/apps/prodpad",
11
+ "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
+ "license": "MIT",
13
+ "dependencies": {
14
+ "@pipedream/platform": "^1.2.1"
15
+ },
16
+ "publishConfig": {
17
+ "access": "public"
18
+ }
19
+ }