@pipedream/streak 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE CHANGED
@@ -1,7 +1,41 @@
1
- Copyright 2020 Pipedream, Inc.
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Pipedream Source Available License Version 1.0
2
+
3
+ This Pipedream Source Available License Agreement Version 1.0 (this “Agreement”) sets forth the terms on which Pipedream, Inc., a Delaware corporation (“Pipedream”) makes available certain software (the Software). By installing, downloading, accessing, using or distributing the Software, you agree to the terms of this Agreement. If you do not agree to such terms, you must not use the Software. If you are receiving the Software on behalf of a legal entity, you represent and warrant that you have the actual authority to agree to the terms and conditions of this Agreement on behalf of such entity. “Licensee” means you, an individual, or the entity on whose behalf you are receiving the Software.
4
+
5
+ LICENSE GRANT AND CONDITIONS.
6
+
7
+ 1.1 License. Subject to the terms and conditions of this Agreement, Pipedream hereby grants to Licensee a non-exclusive, royalty-free, worldwide, non-transferable, non-sublicenseable license during the term of this Agreement to use, prepare modifications and derivative works, distribute (including without limitation in source code or object code form) and reproduce copies of the Software (the “License”). Licensee is not granted the right to, and Licensee shall not, exercise the License for an Excluded Purpose. For purposes of this Agreement, “Excluded Purpose” means any commercial use of the software including, but not limited to, making available any software-as-a-service, platform-as-a-service, infrastructure-as-a-service or other online service that competes with the Software or any other Pipedream products or services.
8
+
9
+ 1.2 Conditions. In consideration of the License, Licensee’s distribution of the Software is subject to the following conditions:
10
+
11
+ a. Licensee must cause any Software modified by Licensee to carry prominent notices stating that Licensee modified the Software.
12
+
13
+ b. On each Software copy, Licensee shall reproduce and not remove or alter all Pipedream or third party copyright or other proprietary notices contained in the Software, and Licensee must provide this with each copy: “This software is made available by Pipedream, Inc., under the terms of the Pipedream Source Available License, Version 1.0 located at https://github.com/PipedreamHQ/pipedream/blob/master/LICENSE. By installing, downloading, accessing, using or distributing the Software, you agree to the terms of such License Agreement.”
14
+
15
+ 1.3 Modifications. Licensee may add its own copyright notices to modifications made by Licensee and may provide additional or different license terms and conditions for use, reproduction, or distribution of Licensee’s modifications. While redistributing the Software or modifications thereof, Licensee may choose to offer, for a fee or free of charge, support, warranty, indemnity, or other obligations. Licensee, and not Pipedream, will be responsible for any such obligations.
16
+
17
+ 1.4 No Sublicensing. The License does not include the right to sublicense the Software; provided, however, that any recipient to which Licensee provides the Software may exercise the License so long as such recipient agrees to the terms and conditions of this Agreement.
18
+
19
+ TERM AND TERMINATION.
20
+
21
+ This Agreement will continue unless and until earlier terminated as set forth herein. If Licensee breaches any of its conditions or obligations under this Agreement, this Agreement will terminate automatically and the License will terminate automatically and permanently.
22
+
23
+ INTELLECTUAL PROPERTY.
24
+
25
+ As between the parties, Pipedream retains all right, title, and interest in the Software, and all intellectual property rights therein. Pipedream hereby reserves all rights not expressly granted to Licensee in this Agreement. Pipedream reserves all rights in its trademarks and service marks, and no licenses thereto are granted by this Agreement.
26
+
27
+ DISCLAIMER.
28
+
29
+ PIPEDREAM HEREBY DISCLAIMS ANY AND ALL WARRANTIES AND CONDITIONS, EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, AND SPECIFICALLY DISCLAIMS ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE SOFTWARE.
30
+
31
+ LIMITATION OF LIABILITY.
32
+
33
+ PIPEDREAM WILL NOT BE LIABLE FOR ANY DAMAGES OF ANY KIND, INCLUDING BUT NOT LIMITED TO, LOST PROFITS OR ANY CONSEQUENTIAL, SPECIAL, INCIDENTAL, INDIRECT, OR DIRECT DAMAGES, HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ARISING OUT OF THIS AGREEMENT. THE FOREGOING SHALL APPLY TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW.
34
+
35
+ GENERAL.
36
+
37
+ 6.1 Governing Law. This Agreement will be governed by and interpreted in accordance with the laws of the state of California, without reference to its conflict of laws principles. If Licensee is located outside of the United States, any dispute, controversy or claim arising out of or relating to this Agreement will be referred to and finally determined by arbitration in accordance with the JAMS International Arbitration Rules. The tribunal will consist of one arbitrator. Judgment upon the award rendered by the arbitrator may be entered in any court having jurisdiction thereof. All disputes including arbitrations shall take place in Santa Clara County, California. The language to be used in any such proceedings shall be English.
38
+
39
+ 6.2. Assignment. Licensee is not authorized to assign its rights under this Agreement to any third party. Pipedream may freely assign its rights under this Agreement to any third party.
40
+
41
+ 6.3. Other. This Agreement is the entire agreement between the parties regarding the subject matter hereof. No amendment or modification of this Agreement will be valid or binding upon the parties unless made in writing and signed by the duly authorized representatives of both parties. In the event that any provision, including without limitation any condition, of this Agreement is held to be unenforceable, this Agreement and all licenses and rights granted hereunder will immediately terminate. Waiver by Pipedream of a breach of any provision of this Agreement or the failure by Pipedream to exercise any right hereunder will not be construed as a waiver of any subsequent breach of that right or as a waiver of any other right.
package/README.md ADDED
@@ -0,0 +1,21 @@
1
+ # Overview
2
+
3
+ With Streak's API, you can build powerful and custom applications to extend and
4
+ integrate with Streak. Here are some of the things you can build with the
5
+ Streak API:
6
+
7
+ - Create custom objects within Streak, such as customer profiles or tasks
8
+ - Automate customer onboarding processes by automatically sending emails and
9
+ creating customer profiles within Streak
10
+ - Update customer profiles in Streak based on customer activity
11
+ - Keep customer records up-to-date by automatically syncing data from
12
+ third-party applications
13
+ - Automatically sync customer contact information from third-parties
14
+ - Build an integration with a CRM to keep contact information up-to-date in
15
+ Streak
16
+ - Create custom triggers to automatically take actions within Streak based on
17
+ customer actions
18
+ - Create custom reports to analyze customer behavior or trends in their data
19
+ - Store customer notes and other records for easy retrieval and review
20
+ - Create custom views and filters to quickly analyze and report on customer
21
+ data
@@ -0,0 +1,96 @@
1
+ import streak from "../../streak.app.mjs";
2
+
3
+ const docLink = "https://streak.readme.io/reference/create-a-box";
4
+
5
+ export default {
6
+ key: "streak-create-box",
7
+ name: "Create Box",
8
+ description: `Create a new box in Streak. [See the docs](${docLink})`,
9
+ version: "0.0.1",
10
+ type: "action",
11
+ props: {
12
+ streak,
13
+ pipelineId: {
14
+ propDefinition: [
15
+ streak,
16
+ "pipelineId",
17
+ ],
18
+ reloadProps: true,
19
+ },
20
+ name: {
21
+ type: "string",
22
+ label: "Name",
23
+ description: "Name of the box",
24
+ },
25
+ stage: {
26
+ propDefinition: [
27
+ streak,
28
+ "stage",
29
+ (c) => ({
30
+ pipelineId: c.pipelineId,
31
+ }),
32
+ ],
33
+ optional: true,
34
+ },
35
+ notes: {
36
+ type: "string",
37
+ label: "Notes",
38
+ description: "The notes on the box",
39
+ optional: true,
40
+ },
41
+ teamId: {
42
+ propDefinition: [
43
+ streak,
44
+ "teamId",
45
+ ],
46
+ optional: true,
47
+ },
48
+ assignees: {
49
+ propDefinition: [
50
+ streak,
51
+ "teamMembers",
52
+ (c) => ({
53
+ teamId: c.teamId,
54
+ }),
55
+ ],
56
+ description: "The member(s) of your team this box will be assigned to",
57
+ optional: true,
58
+ },
59
+ },
60
+ async additionalProps() {
61
+ const props = {};
62
+ const fields = await this.streak.listPipelineFields({
63
+ pipelineId: this.pipelineId,
64
+ });
65
+ for (const field of fields) {
66
+ props[`${this.pipelineId}_${field.key}`] = this.streak.customFieldToProp(field);
67
+ }
68
+ return props;
69
+ },
70
+ async run({ $ }) {
71
+ const response = await this.streak.createBox({
72
+ $,
73
+ pipelineId: this.pipelineId,
74
+ data: {
75
+ name: this.name,
76
+ stageKey: this.stage,
77
+ notes: this.notes,
78
+ assignedToSharingEntries: this.assignees?.map((assignee) => ({
79
+ email: assignee,
80
+ })),
81
+ },
82
+ });
83
+
84
+ const updateCustomFields = Object.keys(this)
85
+ .filter((k) => k.includes(`${this.pipelineId}_`))
86
+ .map((k) => this.streak.updateFieldValue({
87
+ boxId: response.boxKey,
88
+ fieldId: k.split(`${this.pipelineId}_`)[1],
89
+ value: this[k],
90
+ }));
91
+ await Promise.all(updateCustomFields);
92
+
93
+ $.export("$summary", "Successfully created box");
94
+ return response;
95
+ },
96
+ };
@@ -0,0 +1,66 @@
1
+ import streak from "../../streak.app.mjs";
2
+
3
+ const docLink = "https://streak.readme.io/reference/create-a-task";
4
+
5
+ export default {
6
+ key: "streak-create-task",
7
+ name: "Create Task",
8
+ description: `Create a new task in a box. [See the docs](${docLink})`,
9
+ version: "0.0.1",
10
+ type: "action",
11
+ props: {
12
+ streak,
13
+ pipelineId: {
14
+ propDefinition: [
15
+ streak,
16
+ "pipelineId",
17
+ ],
18
+ },
19
+ boxId: {
20
+ propDefinition: [
21
+ streak,
22
+ "boxId",
23
+ (c) => ({
24
+ pipelineId: c.pipelineId,
25
+ }),
26
+ ],
27
+ },
28
+ text: {
29
+ type: "string",
30
+ label: "Text",
31
+ description: "Task description",
32
+ },
33
+ dueDate: {
34
+ type: "integer",
35
+ label: "Due Date",
36
+ description: "Due date in Unix milliseconds timestamp",
37
+ optional: true,
38
+ },
39
+ assignees: {
40
+ propDefinition: [
41
+ streak,
42
+ "teamMembers",
43
+ (c) => ({
44
+ teamId: c.teamId,
45
+ }),
46
+ ],
47
+ description: "The member(s) of your team this box will be assigned to",
48
+ optional: true,
49
+ },
50
+ },
51
+ async run({ $ }) {
52
+ const response = await this.streak.createTask({
53
+ $,
54
+ boxId: this.boxId,
55
+ data: {
56
+ text: this.text,
57
+ dueDate: this.dueDate,
58
+ assignedToSharingEntries: this.assignees?.map((assignee) => ({
59
+ email: assignee,
60
+ })),
61
+ },
62
+ });
63
+ $.export("$summary", "Successfully created task");
64
+ return response;
65
+ },
66
+ };
@@ -0,0 +1,52 @@
1
+ import streak from "../../streak.app.mjs";
2
+
3
+ const docLink = "https://streak.readme.io/reference/edit-a-box";
4
+
5
+ export default {
6
+ key: "streak-link-boxes",
7
+ name: "Link Boxes",
8
+ description: `Link boxes to a specific box. [See the docs](${docLink})`,
9
+ version: "0.0.1",
10
+ type: "action",
11
+ props: {
12
+ streak,
13
+ pipelineId: {
14
+ propDefinition: [
15
+ streak,
16
+ "pipelineId",
17
+ ],
18
+ },
19
+ boxId: {
20
+ propDefinition: [
21
+ streak,
22
+ "boxId",
23
+ (c) => ({
24
+ pipelineId: c.pipelineId,
25
+ }),
26
+ ],
27
+ },
28
+ boxes: {
29
+ propDefinition: [
30
+ streak,
31
+ "boxId",
32
+ (c) => ({
33
+ pipelineId: c.pipelineId,
34
+ previousBoxId: c.boxId,
35
+ }),
36
+ ],
37
+ type: "string[]",
38
+ description: "The list of boxes you would like to link to the selected box",
39
+ },
40
+ },
41
+ async run({ $ }) {
42
+ const response = await this.streak.updateBox({
43
+ $,
44
+ boxId: this.boxId,
45
+ data: {
46
+ linkedBoxKeys: this.boxes,
47
+ },
48
+ });
49
+ $.export("$summary", "Successfully linked boxes");
50
+ return response;
51
+ },
52
+ };
@@ -0,0 +1,85 @@
1
+ import streak from "../../streak.app.mjs";
2
+
3
+ const docLink = "https://streak.readme.io/reference/edit-a-box";
4
+
5
+ export default {
6
+ key: "streak-update-box",
7
+ name: "Update Box",
8
+ description: `Update the properties for a box. To update field values use **Update Box Field Value**. [See the docs](${docLink})`,
9
+ version: "0.0.1",
10
+ type: "action",
11
+ props: {
12
+ streak,
13
+ pipelineId: {
14
+ propDefinition: [
15
+ streak,
16
+ "pipelineId",
17
+ ],
18
+ },
19
+ boxId: {
20
+ propDefinition: [
21
+ streak,
22
+ "boxId",
23
+ (c) => ({
24
+ pipelineId: c.pipelineId,
25
+ }),
26
+ ],
27
+ },
28
+ name: {
29
+ type: "string",
30
+ label: "Name",
31
+ description: "Name of the box",
32
+ optional: true,
33
+ },
34
+ stage: {
35
+ propDefinition: [
36
+ streak,
37
+ "stage",
38
+ (c) => ({
39
+ pipelineId: c.pipelineId,
40
+ }),
41
+ ],
42
+ optional: true,
43
+ },
44
+ notes: {
45
+ type: "string",
46
+ label: "Notes",
47
+ description: "The notes on the box",
48
+ optional: true,
49
+ },
50
+ teamId: {
51
+ propDefinition: [
52
+ streak,
53
+ "teamId",
54
+ ],
55
+ optional: true,
56
+ },
57
+ assignees: {
58
+ propDefinition: [
59
+ streak,
60
+ "teamMembers",
61
+ (c) => ({
62
+ teamId: c.teamId,
63
+ }),
64
+ ],
65
+ description: "The member(s) of your team this box will be assigned to",
66
+ optional: true,
67
+ },
68
+ },
69
+ async run({ $ }) {
70
+ const response = await this.streak.updateBox({
71
+ $,
72
+ boxId: this.boxId,
73
+ data: {
74
+ name: this.name,
75
+ stageKey: this.stage,
76
+ notes: this.notes,
77
+ assignedToSharingEntries: this.assignees?.map((assignee) => ({
78
+ email: assignee,
79
+ })),
80
+ },
81
+ });
82
+ $.export("$summary", "Successfully updated box");
83
+ return response;
84
+ },
85
+ };
@@ -0,0 +1,64 @@
1
+ import streak from "../../streak.app.mjs";
2
+
3
+ const docLink = "https://streak.readme.io/reference/update-field-value-for-a-box";
4
+
5
+ export default {
6
+ key: "streak-update-box-field-value",
7
+ name: "Update Box Field Value",
8
+ description: `Update the values of the fields for a box. [See the docs](${docLink})`,
9
+ version: "0.0.1",
10
+ type: "action",
11
+ props: {
12
+ streak,
13
+ pipelineId: {
14
+ propDefinition: [
15
+ streak,
16
+ "pipelineId",
17
+ ],
18
+ },
19
+ boxId: {
20
+ propDefinition: [
21
+ streak,
22
+ "boxId",
23
+ (c) => ({
24
+ pipelineId: c.pipelineId,
25
+ }),
26
+ ],
27
+ reloadProps: true,
28
+ },
29
+ },
30
+ async additionalProps() {
31
+ const props = {};
32
+ const fields = await this.streak.listPipelineFields({
33
+ pipelineId: this.pipelineId,
34
+ });
35
+
36
+ const fieldValues = (await this.streak.listBoxFields({
37
+ boxId: this.boxId,
38
+ })).reduce((fields, x) => ({
39
+ ...fields,
40
+ [x.key]: x.value,
41
+ }), {});
42
+
43
+ for (const field of fields) {
44
+ const prop = this.streak.customFieldToProp(field, fieldValues[field.key]);
45
+ props[`${this.boxId}_${field.key}`] = prop;
46
+ }
47
+ return props;
48
+ },
49
+ async run({ $ }) {
50
+ const updateCustomFields = Object.keys(this)
51
+ .filter((k) => k.includes(`${this.boxId}_`))
52
+ .map((k) => this.streak.updateFieldValue({
53
+ boxId: this.boxId,
54
+ fieldId: k.split(`${this.boxId}_`)[1],
55
+ value: this[k],
56
+ }));
57
+ await Promise.all(updateCustomFields);
58
+
59
+ $.export("$summary", "Successfully updated box fields");
60
+ return this.streak.getBox({
61
+ boxId: this.boxId,
62
+ });
63
+ },
64
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/streak",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "Pipedream Streak Components",
5
5
  "main": "streak.app.mjs",
6
6
  "keywords": [
@@ -9,7 +9,6 @@
9
9
  ],
10
10
  "homepage": "https://pipedream.com/apps/streak",
11
11
  "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
12
- "license": "MIT",
13
12
  "dependencies": {
14
13
  "@pipedream/platform": "^1.1.1"
15
14
  },
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-box-changed-pipeline",
6
6
  name: "Box Changed Pipeline (Instant)",
7
7
  description: "Emit new event when a box changes pipelines.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-box-changed-stage",
6
6
  name: "Box Changed Stage (Instant)",
7
7
  description: "Emit new event when a box's stage is updated in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-new-box",
6
6
  name: "New Box (Instant)",
7
7
  description: "Emit new event when a new box is created in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-new-comment",
6
6
  name: "New Comment (Instant)",
7
7
  description: "Emit new event when a new comment is created within a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-new-contact",
6
6
  name: "New Contact (Instant)",
7
7
  description: "Emit new event when a new contact is created within a team.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-new-email-on-box",
6
6
  name: "New Email on Box (Instant)",
7
7
  description: "Emit new event when an email is added to a box in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-new-task",
6
6
  name: "New Task (Instant)",
7
7
  description: "Emit new event when a new task is created in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-new-task-due",
6
6
  name: "New Task Due (Instant)",
7
7
  description: "Emit new event when a new task is created in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-task-completed",
6
6
  name: "Task Completed (Instant)",
7
7
  description: "Emit new event when a task is completed in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-updated-box",
6
6
  name: "Updated Box (Instant)",
7
7
  description: "Emit new event when a box is updated in a pipeline.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
@@ -5,7 +5,7 @@ export default {
5
5
  key: "streak-updated-contact",
6
6
  name: "Updated Contact (Instant)",
7
7
  description: "Emit new event when a contact is updated within a team.",
8
- version: "0.0.1",
8
+ version: "0.0.2",
9
9
  type: "source",
10
10
  dedupe: "unique",
11
11
  methods: {
package/streak.app.mjs CHANGED
@@ -1,4 +1,7 @@
1
- import { axios } from "@pipedream/platform";
1
+ import {
2
+ axios,
3
+ ConfigurationError,
4
+ } from "@pipedream/platform";
2
5
 
3
6
  export default {
4
7
  type: "app",
@@ -16,6 +19,20 @@ export default {
16
19
  }));
17
20
  },
18
21
  },
22
+ pipelineFields: {
23
+ type: "string[]",
24
+ label: "Pipeline Custom Fields",
25
+ description: "Pipeline Custom Fields",
26
+ async options({ pipelineId }) {
27
+ const results = await this.listPipelineFields({
28
+ pipelineId,
29
+ });
30
+ return results.map((field) => ({
31
+ label: field.name,
32
+ value: field.key,
33
+ }));
34
+ },
35
+ },
19
36
  teamId: {
20
37
  type: "string",
21
38
  label: "Team",
@@ -28,8 +45,111 @@ export default {
28
45
  }));
29
46
  },
30
47
  },
48
+ boxId: {
49
+ type: "string",
50
+ label: "Box",
51
+ description: "Select a box",
52
+ async options({
53
+ pipelineId, previousBoxId,
54
+ }) {
55
+ const results = await this.listBoxes({
56
+ pipelineId,
57
+ });
58
+ return results
59
+ .filter((box) => box.key !== previousBoxId)
60
+ .map((box) => ({
61
+ label: box.name,
62
+ value: box.key,
63
+ }));
64
+ },
65
+ },
66
+ teamMembers: {
67
+ type: "string[]",
68
+ label: "Team Members",
69
+ description: "Team members",
70
+ async options({ teamId }) {
71
+ if (!teamId) {
72
+ throw new ConfigurationError("**Team** prop configuration required");
73
+ }
74
+ const { members } = await this.listTeamMembers({
75
+ teamId,
76
+ });
77
+ return members.map((member) => ({
78
+ label: member.fullName,
79
+ value: member.email,
80
+ }));
81
+ },
82
+ },
83
+ stage: {
84
+ type: "string",
85
+ label: "Stage",
86
+ description: "Stage of the box",
87
+ async options({ pipelineId }) {
88
+ const results = await this.listStages({
89
+ pipelineId,
90
+ });
91
+ return Object.entries(results).map(([
92
+ key,
93
+ value,
94
+ ]) => ({
95
+ label: value.name,
96
+ value: key,
97
+ }));
98
+ },
99
+ },
31
100
  },
32
101
  methods: {
102
+ customFieldToProp(field, value) {
103
+ if (field.type === "TEXT_INPUT") {
104
+ return {
105
+ type: "string",
106
+ label: field.name,
107
+ default: value,
108
+ optional: true,
109
+ };
110
+ }
111
+ if (field.type === "DATE") {
112
+ return {
113
+ type: "integer",
114
+ label: field.name,
115
+ description: "Date in Unix milliseconds timestamp",
116
+ default: value,
117
+ optional: true,
118
+ };
119
+ }
120
+ if (field.type === "TAG") {
121
+ return {
122
+ type: "string[]",
123
+ label: field.name,
124
+ options: field.tagSettings.tags.map((x) => ({
125
+ label: x.tag,
126
+ value: x.key,
127
+ })),
128
+ default: value,
129
+ optional: true,
130
+ };
131
+ }
132
+ if (field.type === "DROPDOWN") {
133
+ return {
134
+ type: "string",
135
+ label: field.name,
136
+ options: field.dropdownSettings.items.map((x) => ({
137
+ label: x.name,
138
+ value: x.key,
139
+ })),
140
+ default: value,
141
+ optional: true,
142
+ };
143
+ }
144
+ if (field.type === "CHECKBOX") {
145
+ return {
146
+ type: "boolean",
147
+ label: field.name,
148
+ default: value,
149
+ optional: true,
150
+ };
151
+ }
152
+ },
33
153
  _getBaseUrl() {
34
154
  return "https://www.streak.com/api/";
35
155
  },
@@ -77,18 +197,58 @@ export default {
77
197
  ...args,
78
198
  });
79
199
  },
200
+ async getBox({
201
+ boxId, ...args
202
+ }) {
203
+ return this._makeRequest({
204
+ path: `v1/boxes/${boxId}`,
205
+ ...args,
206
+ });
207
+ },
80
208
  async listPipelines(args = {}) {
81
209
  return this._makeRequest({
82
210
  path: "v1/pipelines",
83
211
  ...args,
84
212
  });
85
213
  },
214
+ async listPipelineFields({
215
+ pipelineId, ...args
216
+ }) {
217
+ return this._makeRequest({
218
+ path: `v1/pipelines/${pipelineId}/fields`,
219
+ ...args,
220
+ });
221
+ },
222
+ async listBoxFields({
223
+ boxId, ...args
224
+ }) {
225
+ return this._makeRequest({
226
+ path: `v1/boxes/${boxId}/fields`,
227
+ ...args,
228
+ });
229
+ },
230
+ async listStages({
231
+ pipelineId, ...args
232
+ }) {
233
+ return this._makeRequest({
234
+ path: `v1/pipelines/${pipelineId}/stages`,
235
+ ...args,
236
+ });
237
+ },
86
238
  async listTeams(args = {}) {
87
239
  return this._makeRequest({
88
240
  path: "v2/users/me/teams",
89
241
  ...args,
90
242
  });
91
243
  },
244
+ async listTeamMembers({
245
+ teamId, ...args
246
+ }) {
247
+ return this._makeRequest({
248
+ path: `v2/teams/${teamId}`,
249
+ ...args,
250
+ });
251
+ },
92
252
  async listBoxes({
93
253
  pipelineId, ...args
94
254
  }) {
@@ -121,5 +281,44 @@ export default {
121
281
  ...args,
122
282
  });
123
283
  },
284
+ async createBox({
285
+ pipelineId, ...args
286
+ }) {
287
+ return this._makeRequest({
288
+ path: `v2/pipelines/${pipelineId}/boxes`,
289
+ method: "post",
290
+ ...args,
291
+ });
292
+ },
293
+ async updateBox({
294
+ boxId, ...args
295
+ }) {
296
+ return this._makeRequest({
297
+ path: `v1/boxes/${boxId}`,
298
+ method: "post",
299
+ ...args,
300
+ });
301
+ },
302
+ async updateFieldValue({
303
+ boxId, fieldId, value, ...args
304
+ }) {
305
+ return this._makeRequest({
306
+ ...args,
307
+ path: `v1/boxes/${boxId}/fields/${fieldId}`,
308
+ method: "post",
309
+ data: {
310
+ value,
311
+ },
312
+ });
313
+ },
314
+ async createTask({
315
+ boxId, ...args
316
+ }) {
317
+ return this._makeRequest({
318
+ path: `v2/boxes/${boxId}/tasks`,
319
+ method: "post",
320
+ ...args,
321
+ });
322
+ },
124
323
  },
125
324
  };