@pipedream/linear_app 0.6.0 → 0.7.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.
- package/actions/create-issue/create-issue.mjs +1 -1
- package/actions/get-issue/get-issue.mjs +1 -1
- package/actions/get-teams/get-teams.mjs +17 -2
- package/actions/search-issues/search-issues.mjs +51 -8
- package/actions/update-issue/update-issue.mjs +1 -1
- package/common/constants.mjs +3 -0
- package/common/fragments.mjs +29 -0
- package/common/queries.mjs +28 -0
- package/common/utils.mjs +15 -2
- package/linear_app.app.mjs +20 -1
- package/package.json +1 -1
- package/sources/comment-created-instant/comment-created-instant.mjs +1 -1
- package/sources/common/webhook.mjs +15 -0
- package/sources/issue-created-instant/issue-created-instant.mjs +1 -1
- package/sources/issue-updated-instant/issue-updated-instant.mjs +1 -1
- package/sources/new-issue-status-updated/new-issue-status-updated.mjs +5 -2
- package/sources/new-projectupdate-created/new-projectupdate-created.mjs +86 -0
- package/sources/project-updated-instant/project-updated-instant.mjs +2 -1
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
key: "linear_app-create-issue",
|
|
6
6
|
name: "Create Issue",
|
|
7
7
|
description: "Create an issue (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues)",
|
|
8
|
-
version: "0.4.
|
|
8
|
+
version: "0.4.8",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
11
11
|
teamId: {
|
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "linear_app-get-issue",
|
|
5
5
|
name: "Get Issue",
|
|
6
6
|
description: "Get an issue by ID (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
7
|
-
version: "0.1.
|
|
7
|
+
version: "0.1.8",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
@@ -1,16 +1,31 @@
|
|
|
1
1
|
import linearApp from "../../linear_app.app.mjs";
|
|
2
|
+
import constants from "../../common/constants.mjs";
|
|
2
3
|
|
|
3
4
|
export default {
|
|
4
5
|
key: "linear_app-get-teams",
|
|
5
6
|
name: "Get Teams",
|
|
6
7
|
description: "Get all the teams (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
7
|
-
version: "0.2.
|
|
8
|
+
version: "0.2.8",
|
|
8
9
|
type: "action",
|
|
9
10
|
props: {
|
|
10
11
|
linearApp,
|
|
12
|
+
limit: {
|
|
13
|
+
propDefinition: [
|
|
14
|
+
linearApp,
|
|
15
|
+
"limit",
|
|
16
|
+
],
|
|
17
|
+
description: "Maximum number of teams to return. Defaults to 20 if not specified.",
|
|
18
|
+
},
|
|
11
19
|
},
|
|
12
20
|
async run({ $ }) {
|
|
13
|
-
|
|
21
|
+
// Use the specified limit or default to a reasonable number
|
|
22
|
+
const limit = this.limit || constants.DEFAULT_NO_QUERY_LIMIT;
|
|
23
|
+
|
|
24
|
+
const variables = {
|
|
25
|
+
first: limit,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const { nodes: teams } = await this.linearApp.listTeams(variables);
|
|
14
29
|
|
|
15
30
|
$.export("$summary", `Found ${teams.length} teams(s)`);
|
|
16
31
|
|
|
@@ -1,32 +1,43 @@
|
|
|
1
1
|
import linearApp from "../../linear_app.app.mjs";
|
|
2
2
|
import utils from "../../common/utils.mjs";
|
|
3
|
+
import constants from "../../common/constants.mjs";
|
|
3
4
|
|
|
4
5
|
export default {
|
|
5
6
|
key: "linear_app-search-issues",
|
|
6
7
|
name: "Search Issues",
|
|
7
8
|
description: "Search issues (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api)",
|
|
8
9
|
type: "action",
|
|
9
|
-
version: "0.2.
|
|
10
|
+
version: "0.2.8",
|
|
10
11
|
props: {
|
|
11
12
|
linearApp,
|
|
12
|
-
|
|
13
|
+
teamId: {
|
|
13
14
|
propDefinition: [
|
|
14
15
|
linearApp,
|
|
15
|
-
"
|
|
16
|
+
"teamId",
|
|
16
17
|
],
|
|
17
18
|
},
|
|
18
|
-
|
|
19
|
+
projectId: {
|
|
19
20
|
propDefinition: [
|
|
20
21
|
linearApp,
|
|
21
|
-
"
|
|
22
|
+
"projectId",
|
|
23
|
+
],
|
|
24
|
+
},
|
|
25
|
+
query: {
|
|
26
|
+
propDefinition: [
|
|
27
|
+
linearApp,
|
|
28
|
+
"query",
|
|
22
29
|
],
|
|
23
30
|
optional: true,
|
|
24
31
|
},
|
|
25
|
-
|
|
32
|
+
stateId: {
|
|
26
33
|
propDefinition: [
|
|
27
34
|
linearApp,
|
|
28
|
-
"
|
|
35
|
+
"stateId",
|
|
36
|
+
({ teamId }) => ({
|
|
37
|
+
teamId,
|
|
38
|
+
}),
|
|
29
39
|
],
|
|
40
|
+
description: "Filter issues by their workflow state (status). States are scoped to the selected team.",
|
|
30
41
|
},
|
|
31
42
|
assigneeId: {
|
|
32
43
|
propDefinition: [
|
|
@@ -52,13 +63,36 @@ export default {
|
|
|
52
63
|
"includeArchived",
|
|
53
64
|
],
|
|
54
65
|
},
|
|
66
|
+
limit: {
|
|
67
|
+
propDefinition: [
|
|
68
|
+
linearApp,
|
|
69
|
+
"limit",
|
|
70
|
+
],
|
|
71
|
+
},
|
|
55
72
|
},
|
|
56
73
|
async run({ $ }) {
|
|
57
74
|
const issues = [];
|
|
58
75
|
let hasNextPage;
|
|
59
76
|
let after;
|
|
60
77
|
|
|
78
|
+
// Determine the overall max limit for all pages combined
|
|
79
|
+
const maxLimit = this.limit || (this.query
|
|
80
|
+
? constants.DEFAULT_MAX_RECORDS
|
|
81
|
+
: constants.DEFAULT_NO_QUERY_LIMIT);
|
|
82
|
+
|
|
83
|
+
// For pagination, we'll use a smaller page size
|
|
84
|
+
const pageSize = Math.min(maxLimit, constants.DEFAULT_LIMIT);
|
|
85
|
+
|
|
61
86
|
do {
|
|
87
|
+
// If we've already reached our limit, stop fetching more data
|
|
88
|
+
if (issues.length >= maxLimit) {
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Calculate how many more items we need for this page
|
|
93
|
+
const remainingNeeded = maxLimit - issues.length;
|
|
94
|
+
const thisPageLimit = Math.min(pageSize, remainingNeeded);
|
|
95
|
+
|
|
62
96
|
const variables = utils.buildVariables(after, {
|
|
63
97
|
filter: {
|
|
64
98
|
query: this.query,
|
|
@@ -66,10 +100,19 @@ export default {
|
|
|
66
100
|
projectId: this.projectId,
|
|
67
101
|
assigneeId: this.assigneeId,
|
|
68
102
|
issueLabels: this.issueLabels,
|
|
103
|
+
state: this.stateId
|
|
104
|
+
? {
|
|
105
|
+
id: {
|
|
106
|
+
eq: this.stateId,
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
: undefined,
|
|
69
110
|
},
|
|
70
111
|
orderBy: this.orderBy,
|
|
71
112
|
includeArchived: this.includeArchived,
|
|
113
|
+
limit: thisPageLimit, // Use calculated limit for this page
|
|
72
114
|
});
|
|
115
|
+
|
|
73
116
|
const {
|
|
74
117
|
nodes,
|
|
75
118
|
pageInfo,
|
|
@@ -78,7 +121,7 @@ export default {
|
|
|
78
121
|
issues.push(...nodes);
|
|
79
122
|
after = pageInfo.endCursor;
|
|
80
123
|
hasNextPage = pageInfo.hasNextPage;
|
|
81
|
-
} while (hasNextPage);
|
|
124
|
+
} while (hasNextPage && issues.length < maxLimit);
|
|
82
125
|
|
|
83
126
|
$.export("$summary", `Found ${issues.length} issues`);
|
|
84
127
|
|
|
@@ -5,7 +5,7 @@ export default {
|
|
|
5
5
|
name: "Update Issue",
|
|
6
6
|
description: "Update an issue (API Key). See the docs [here](https://developers.linear.app/docs/graphql/working-with-the-graphql-api#creating-and-editing-issues)",
|
|
7
7
|
type: "action",
|
|
8
|
-
version: "0.1.
|
|
8
|
+
version: "0.1.8",
|
|
9
9
|
props: {
|
|
10
10
|
linearApp,
|
|
11
11
|
teamId: {
|
package/common/constants.mjs
CHANGED
|
@@ -2,6 +2,7 @@ const WEBHOOK_ID = "webhookId";
|
|
|
2
2
|
const LINEAR_DELIVERY_HEADER = "linear-delivery";
|
|
3
3
|
const DEFAULT_LIMIT = 100;
|
|
4
4
|
const DEFAULT_MAX_RECORDS = 200;
|
|
5
|
+
const DEFAULT_NO_QUERY_LIMIT = 20;
|
|
5
6
|
|
|
6
7
|
const ACTION = {
|
|
7
8
|
CREATE: "create",
|
|
@@ -13,6 +14,7 @@ const RESOURCE_TYPE = {
|
|
|
13
14
|
ISSUE: "Issue",
|
|
14
15
|
ISSUE_LABEL: "IssueLabel",
|
|
15
16
|
PROJECT: "Project",
|
|
17
|
+
PROJECT_UPDATE: "ProjectUpdate",
|
|
16
18
|
CYCLE: "Cycle",
|
|
17
19
|
REACTION: "Reaction",
|
|
18
20
|
};
|
|
@@ -48,6 +50,7 @@ export default {
|
|
|
48
50
|
LINEAR_DELIVERY_HEADER,
|
|
49
51
|
DEFAULT_LIMIT,
|
|
50
52
|
DEFAULT_MAX_RECORDS,
|
|
53
|
+
DEFAULT_NO_QUERY_LIMIT,
|
|
51
54
|
ACTION,
|
|
52
55
|
RESOURCE_TYPE,
|
|
53
56
|
RESOURCE_TYPES,
|
package/common/fragments.mjs
CHANGED
|
@@ -136,4 +136,33 @@ export default {
|
|
|
136
136
|
url
|
|
137
137
|
}
|
|
138
138
|
`,
|
|
139
|
+
projectUpdate: `
|
|
140
|
+
fragment ProjectUpdate on ProjectUpdate {
|
|
141
|
+
id
|
|
142
|
+
body
|
|
143
|
+
health
|
|
144
|
+
project {
|
|
145
|
+
id
|
|
146
|
+
name
|
|
147
|
+
lead {
|
|
148
|
+
id
|
|
149
|
+
name
|
|
150
|
+
}
|
|
151
|
+
initiatives {
|
|
152
|
+
nodes {
|
|
153
|
+
name
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
user {
|
|
158
|
+
id
|
|
159
|
+
}
|
|
160
|
+
createdAt
|
|
161
|
+
updatedAt
|
|
162
|
+
bodyData
|
|
163
|
+
slugId
|
|
164
|
+
infoSnapshot
|
|
165
|
+
url
|
|
166
|
+
}
|
|
167
|
+
`,
|
|
139
168
|
};
|
package/common/queries.mjs
CHANGED
|
@@ -75,4 +75,32 @@ export default {
|
|
|
75
75
|
${fragments.project}
|
|
76
76
|
${fragments.pageInfo}
|
|
77
77
|
`,
|
|
78
|
+
listProjectUpdates: `
|
|
79
|
+
query ListProjectUpdates(
|
|
80
|
+
$filter: ProjectUpdateFilter,
|
|
81
|
+
$before: String,
|
|
82
|
+
$after: String,
|
|
83
|
+
$first: Int,
|
|
84
|
+
$last: Int,
|
|
85
|
+
$orderBy: PaginationOrderBy
|
|
86
|
+
) {
|
|
87
|
+
projectUpdates(
|
|
88
|
+
filter: $filter,
|
|
89
|
+
before: $before,
|
|
90
|
+
after: $after,
|
|
91
|
+
first: $first,
|
|
92
|
+
last: $last,
|
|
93
|
+
orderBy: $orderBy
|
|
94
|
+
) {
|
|
95
|
+
pageInfo {
|
|
96
|
+
...PageInfo
|
|
97
|
+
}
|
|
98
|
+
nodes {
|
|
99
|
+
...ProjectUpdate
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
${fragments.projectUpdate}
|
|
104
|
+
${fragments.pageInfo}
|
|
105
|
+
`,
|
|
78
106
|
};
|
package/common/utils.mjs
CHANGED
|
@@ -42,7 +42,10 @@ function buildVariables(endCursor, args) {
|
|
|
42
42
|
const issueLabels = args.filter.issueLabels
|
|
43
43
|
? `, labels: { name: { in: ${JSON.stringify(args.filter.issueLabels)} } }`
|
|
44
44
|
: "";
|
|
45
|
-
|
|
45
|
+
const createdAt = args.filter.createdAt
|
|
46
|
+
? `, createdAt: { gte: "${args.filter.createdAt.gte}" }`
|
|
47
|
+
: "";
|
|
48
|
+
let filter = `${title}${teamId}${projectId}${team}${project}${state}${assigneeId}${issueLabels}${createdAt}`;
|
|
46
49
|
if (filter[0] === ",") {
|
|
47
50
|
filter = filter.substring(2, filter.length);
|
|
48
51
|
}
|
|
@@ -56,7 +59,17 @@ function buildVariables(endCursor, args) {
|
|
|
56
59
|
const after = endCursor
|
|
57
60
|
? `, after: "${endCursor}"`
|
|
58
61
|
: "";
|
|
59
|
-
|
|
62
|
+
// Determine the appropriate limit:
|
|
63
|
+
// 1. Use custom limit if provided
|
|
64
|
+
// 2. Use a smaller default limit when no query is provided to avoid returning too many results
|
|
65
|
+
// 3. Otherwise use the standard default limit
|
|
66
|
+
const limit = args.limit
|
|
67
|
+
? args.limit
|
|
68
|
+
: (args.filter.query
|
|
69
|
+
? constants.DEFAULT_LIMIT
|
|
70
|
+
: constants.DEFAULT_NO_QUERY_LIMIT);
|
|
71
|
+
|
|
72
|
+
return strToObj(`{ filter: { ${filter} }, first: ${limit}${orderBy}${includeArchived}${after} }`);
|
|
60
73
|
}
|
|
61
74
|
|
|
62
75
|
export default {
|
package/linear_app.app.mjs
CHANGED
|
@@ -164,7 +164,8 @@ export default {
|
|
|
164
164
|
query: {
|
|
165
165
|
type: "string",
|
|
166
166
|
label: "Query",
|
|
167
|
-
description: "Search string to look for",
|
|
167
|
+
description: "Search string to look for in issue titles. The query is used to filter issues where the title contains the query text (case insensitive).",
|
|
168
|
+
optional: true,
|
|
168
169
|
},
|
|
169
170
|
orderBy: {
|
|
170
171
|
type: "string",
|
|
@@ -179,6 +180,12 @@ export default {
|
|
|
179
180
|
description: "Should archived resources be included? (default: `false`)",
|
|
180
181
|
optional: true,
|
|
181
182
|
},
|
|
183
|
+
limit: {
|
|
184
|
+
type: "integer",
|
|
185
|
+
label: "Limit",
|
|
186
|
+
description: "Maximum number of issues to return. If no query is provided, this defaults to 20 to avoid returning too many results.",
|
|
187
|
+
optional: true,
|
|
188
|
+
},
|
|
182
189
|
},
|
|
183
190
|
methods: {
|
|
184
191
|
getAxiosHeaders() {
|
|
@@ -248,6 +255,9 @@ export default {
|
|
|
248
255
|
async getProject(id) {
|
|
249
256
|
return this.client().project(id);
|
|
250
257
|
},
|
|
258
|
+
async getProjectUpdate(id) {
|
|
259
|
+
return this.client().projectUpdate(id);
|
|
260
|
+
},
|
|
251
261
|
async getState(id) {
|
|
252
262
|
return this.client().workflowState(id);
|
|
253
263
|
},
|
|
@@ -266,6 +276,15 @@ export default {
|
|
|
266
276
|
});
|
|
267
277
|
return projects;
|
|
268
278
|
},
|
|
279
|
+
async listProjectUpdates(variables) {
|
|
280
|
+
const { data: { projectUpdates } } = await this.post({
|
|
281
|
+
data: {
|
|
282
|
+
query: queries.listProjectUpdates,
|
|
283
|
+
variables,
|
|
284
|
+
},
|
|
285
|
+
});
|
|
286
|
+
return projectUpdates;
|
|
287
|
+
},
|
|
269
288
|
async listUsers(variables = {}) {
|
|
270
289
|
return this.client().users(variables);
|
|
271
290
|
},
|
package/package.json
CHANGED
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Created Comment (Instant)",
|
|
8
8
|
description: "Emit new event when a new comment is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.1.
|
|
10
|
+
version: "0.1.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -21,6 +21,13 @@ export default {
|
|
|
21
21
|
"projectId",
|
|
22
22
|
],
|
|
23
23
|
},
|
|
24
|
+
limit: {
|
|
25
|
+
propDefinition: [
|
|
26
|
+
linearApp,
|
|
27
|
+
"limit",
|
|
28
|
+
],
|
|
29
|
+
description: "Maximum number of items to return when polling. Defaults to 20 if not specified.",
|
|
30
|
+
},
|
|
24
31
|
db: "$.service.db",
|
|
25
32
|
},
|
|
26
33
|
async additionalProps() {
|
|
@@ -61,6 +68,9 @@ export default {
|
|
|
61
68
|
isRelevant() {
|
|
62
69
|
return true;
|
|
63
70
|
},
|
|
71
|
+
isRelevantPolling() {
|
|
72
|
+
return true;
|
|
73
|
+
},
|
|
64
74
|
useGraphQl() {
|
|
65
75
|
return true;
|
|
66
76
|
},
|
|
@@ -99,15 +109,20 @@ export default {
|
|
|
99
109
|
return data?.user?.admin;
|
|
100
110
|
},
|
|
101
111
|
async emitPolledResources() {
|
|
112
|
+
// Use the specified limit or default to a reasonable number
|
|
113
|
+
const maxLimit = this.limit || constants.DEFAULT_NO_QUERY_LIMIT;
|
|
114
|
+
|
|
102
115
|
const stream = this.linearApp.paginateResources({
|
|
103
116
|
resourcesFn: this.getResourcesFn(),
|
|
104
117
|
resourcesFnArgs: this.getResourcesFnArgs(),
|
|
105
118
|
useGraphQl: this.useGraphQl(),
|
|
119
|
+
max: maxLimit, // Apply the limit to pagination
|
|
106
120
|
});
|
|
107
121
|
const resources = await utils.streamIterator(stream);
|
|
108
122
|
|
|
109
123
|
resources
|
|
110
124
|
.reverse()
|
|
125
|
+
.filter((resource) => this.isRelevantPolling(resource))
|
|
111
126
|
.forEach((resource) => {
|
|
112
127
|
this.$emit(resource, this.getMetadata(resource));
|
|
113
128
|
});
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Created Issue (Instant)",
|
|
8
8
|
description: "Emit new event when a new issue is created. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.3.
|
|
10
|
+
version: "0.3.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -7,7 +7,7 @@ export default {
|
|
|
7
7
|
name: "New Updated Issue (Instant)",
|
|
8
8
|
description: "Emit new event when an issue is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
9
9
|
type: "source",
|
|
10
|
-
version: "0.3.
|
|
10
|
+
version: "0.3.10",
|
|
11
11
|
dedupe: "unique",
|
|
12
12
|
methods: {
|
|
13
13
|
...common.methods,
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Issue Status Updated (Instant)",
|
|
9
9
|
description: "Emit new event when the status of an issue is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
10
10
|
type: "source",
|
|
11
|
-
version: "0.1.
|
|
11
|
+
version: "0.1.10",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|
|
14
14
|
linearApp: common.props.linearApp,
|
|
@@ -108,11 +108,14 @@ export default {
|
|
|
108
108
|
const previousStatuses = this._getPreviousStatuses();
|
|
109
109
|
const newStatuses = {};
|
|
110
110
|
|
|
111
|
+
// Use the specified limit or default to a reasonable number
|
|
112
|
+
const maxLimit = this.limit || constants.DEFAULT_NO_QUERY_LIMIT;
|
|
113
|
+
|
|
111
114
|
const stream = this.linearApp.paginateResources({
|
|
112
115
|
resourcesFn: this.getResourcesFn(),
|
|
113
116
|
resourcesFnArgs: this.getResourcesFnArgs(),
|
|
114
117
|
useGraphQl: this.useGraphQl(),
|
|
115
|
-
max: 1000
|
|
118
|
+
max: maxLimit, // Use the configured limit instead of hardcoded 1000
|
|
116
119
|
});
|
|
117
120
|
const resources = await utils.streamIterator(stream);
|
|
118
121
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import common from "../common/webhook.mjs";
|
|
2
|
+
import constants from "../../common/constants.mjs";
|
|
3
|
+
import linearApp from "../../linear_app.app.mjs";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
...common,
|
|
7
|
+
key: "linear_app-new-projectupdate-created",
|
|
8
|
+
name: "New Project Update Written (Instant)",
|
|
9
|
+
description: "Project updates are short status reports on the health of your projects. Emit new event when a new Project Update is written. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
10
|
+
type: "source",
|
|
11
|
+
version: "0.0.2",
|
|
12
|
+
dedupe: "unique",
|
|
13
|
+
props: {
|
|
14
|
+
linearApp,
|
|
15
|
+
db: "$.service.db",
|
|
16
|
+
teamId: {
|
|
17
|
+
label: "Team ID",
|
|
18
|
+
type: "string",
|
|
19
|
+
propDefinition: [
|
|
20
|
+
common.props.linearApp,
|
|
21
|
+
"teamId",
|
|
22
|
+
],
|
|
23
|
+
description: "The identifier or key of the team associated with the project",
|
|
24
|
+
reloadProps: true,
|
|
25
|
+
},
|
|
26
|
+
projectId: {
|
|
27
|
+
propDefinition: [
|
|
28
|
+
common.props.linearApp,
|
|
29
|
+
"projectId",
|
|
30
|
+
(c) => ({
|
|
31
|
+
teamId: c.teamId,
|
|
32
|
+
}),
|
|
33
|
+
],
|
|
34
|
+
description: "Filter results by project",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
...common.methods,
|
|
39
|
+
getResourceTypes() {
|
|
40
|
+
return [
|
|
41
|
+
constants.RESOURCE_TYPE.PROJECT_UPDATE,
|
|
42
|
+
];
|
|
43
|
+
},
|
|
44
|
+
getWebhookLabel() {
|
|
45
|
+
return "Project Update created";
|
|
46
|
+
},
|
|
47
|
+
getResourcesFn() {
|
|
48
|
+
return this.linearApp.listProjectUpdates;
|
|
49
|
+
},
|
|
50
|
+
getResourcesFnArgs() {
|
|
51
|
+
return {
|
|
52
|
+
orderBy: "createdAt",
|
|
53
|
+
filter: {
|
|
54
|
+
createdAt: {
|
|
55
|
+
gte: "-P1W", // within the last week
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
},
|
|
60
|
+
getResource(projectUpdate) {
|
|
61
|
+
return this.linearApp.getProjectUpdate(projectUpdate.id);
|
|
62
|
+
},
|
|
63
|
+
isRelevant(body) {
|
|
64
|
+
const teamIds = body.data.infoSnapshot.teamsInfo.map(({ id }) => id);
|
|
65
|
+
return body?.action === "create" && teamIds.includes(this.teamId);
|
|
66
|
+
},
|
|
67
|
+
isRelevantPolling(resource) {
|
|
68
|
+
const teamIds = resource.infoSnapshot.teamsInfo.map(({ id }) => id);
|
|
69
|
+
const projectId = resource.project.id;
|
|
70
|
+
return (teamIds.includes(this.teamId)) && (!this.projectId || projectId === this.projectId);
|
|
71
|
+
},
|
|
72
|
+
getMetadata(resource) {
|
|
73
|
+
const {
|
|
74
|
+
data,
|
|
75
|
+
createdAt,
|
|
76
|
+
} = resource;
|
|
77
|
+
const ts = Date.parse(data?.createdAt || createdAt);
|
|
78
|
+
const id = data?.id || resource.id;
|
|
79
|
+
return {
|
|
80
|
+
id,
|
|
81
|
+
summary: `New Project Update: ${id}`,
|
|
82
|
+
ts,
|
|
83
|
+
};
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
};
|
|
@@ -8,7 +8,7 @@ export default {
|
|
|
8
8
|
name: "New Updated Project (Instant)",
|
|
9
9
|
description: "Emit new event when a project is updated. [See the documentation](https://developers.linear.app/docs/graphql/webhooks)",
|
|
10
10
|
type: "source",
|
|
11
|
-
version: "0.0.
|
|
11
|
+
version: "0.0.3",
|
|
12
12
|
dedupe: "unique",
|
|
13
13
|
props: {
|
|
14
14
|
linearApp,
|
|
@@ -19,6 +19,7 @@ export default {
|
|
|
19
19
|
linearApp,
|
|
20
20
|
"teamId",
|
|
21
21
|
],
|
|
22
|
+
description: "The identifier or key of the team associated with the project",
|
|
22
23
|
reloadProps: true,
|
|
23
24
|
},
|
|
24
25
|
db: "$.service.db",
|