@sentry/junior-linear 0.265.0 → 0.267.0
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/dist/events/issue.d.ts +5 -1
- package/dist/index.js +28 -5
- package/package.json +4 -3
package/dist/events/issue.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { type SubscribableResource } from "@sentry/junior-plugin-api";
|
|
2
2
|
export declare const LINEAR_ISSUE_EVENTS: readonly ["issue.created"];
|
|
3
|
-
/**
|
|
3
|
+
/**
|
|
4
|
+
* Exact values that every Linear issue event sets. `issueIdentifier` and
|
|
5
|
+
* `teamKey` are uppercase, the same form as identifiers.
|
|
6
|
+
*/
|
|
4
7
|
export declare const LINEAR_ISSUE_MATCH_FIELDS: Record<string, {
|
|
5
8
|
kind: "boolean" | "number" | "string";
|
|
6
9
|
description: string;
|
|
7
10
|
enum?: string[] | undefined;
|
|
8
11
|
list?: true | undefined;
|
|
12
|
+
case?: "lower" | "upper" | undefined;
|
|
9
13
|
events?: string[] | undefined;
|
|
10
14
|
}>;
|
|
11
15
|
/** Build the stable Linear issue identity shared by tools and webhooks. */
|
package/dist/index.js
CHANGED
|
@@ -10,9 +10,17 @@ import {
|
|
|
10
10
|
} from "@sentry/junior-plugin-api";
|
|
11
11
|
var LINEAR_ISSUE_EVENTS = ["issue.created"];
|
|
12
12
|
var LINEAR_ISSUE_MATCH_FIELDS = eventMatchFieldsSchema.parse({
|
|
13
|
+
issueIdentifier: {
|
|
14
|
+
kind: "string",
|
|
15
|
+
case: "upper",
|
|
16
|
+
description: "uppercase Linear issue identifier, such as SRE-123",
|
|
17
|
+
events: [...LINEAR_ISSUE_EVENTS]
|
|
18
|
+
},
|
|
13
19
|
teamKey: {
|
|
14
20
|
kind: "string",
|
|
15
|
-
|
|
21
|
+
case: "upper",
|
|
22
|
+
description: "uppercase Linear team key for the issue, such as SRE",
|
|
23
|
+
events: [...LINEAR_ISSUE_EVENTS]
|
|
16
24
|
}
|
|
17
25
|
});
|
|
18
26
|
function linearIssueResource(input) {
|
|
@@ -72,6 +80,12 @@ function issueText(issue) {
|
|
|
72
80
|
].filter((part) => part !== void 0);
|
|
73
81
|
return parts.length > 0 ? parts.join("\n") : void 0;
|
|
74
82
|
}
|
|
83
|
+
var issueEventDataSchema = z.object({
|
|
84
|
+
issueId: z.string().min(1),
|
|
85
|
+
issueIdentifier: z.string().min(1).toUpperCase(),
|
|
86
|
+
teamKey: z.string().min(1).toUpperCase(),
|
|
87
|
+
url: z.url()
|
|
88
|
+
}).strict();
|
|
75
89
|
function occurredAtMs(input) {
|
|
76
90
|
const createdAt = input.createdAt ? Date.parse(input.createdAt) : Number.NaN;
|
|
77
91
|
if (Number.isFinite(createdAt)) return createdAt;
|
|
@@ -95,12 +109,12 @@ function normalizeLinearEvents(input) {
|
|
|
95
109
|
eventType,
|
|
96
110
|
occurredAtMs: occurredAtMs(parsed.data),
|
|
97
111
|
trustedSummary: `${issueResource.label} was created.`,
|
|
98
|
-
data: {
|
|
112
|
+
data: issueEventDataSchema.parse({
|
|
99
113
|
issueId: issue.id,
|
|
100
|
-
issueIdentifier:
|
|
101
|
-
teamKey
|
|
114
|
+
issueIdentifier: issue.identifier,
|
|
115
|
+
teamKey,
|
|
102
116
|
url: issue.url
|
|
103
|
-
},
|
|
117
|
+
}),
|
|
104
118
|
untrustedText: issueText(issue)
|
|
105
119
|
};
|
|
106
120
|
return [
|
|
@@ -297,6 +311,15 @@ function linearPlugin() {
|
|
|
297
311
|
matchFields: LINEAR_ISSUE_MATCH_FIELDS
|
|
298
312
|
}
|
|
299
313
|
],
|
|
314
|
+
// An issue carries its title and description, and a team can be
|
|
315
|
+
// private. So a trigger with no identifier must name its team or one
|
|
316
|
+
// issue.
|
|
317
|
+
events: Object.fromEntries(
|
|
318
|
+
LINEAR_ISSUE_EVENTS.map((eventType) => [
|
|
319
|
+
eventType,
|
|
320
|
+
{ reach: { anyOf: ["teamKey", "issueIdentifier"] } }
|
|
321
|
+
])
|
|
322
|
+
),
|
|
300
323
|
isEnabled: () => Boolean(linearWebhookSecret()),
|
|
301
324
|
normalizeIdentifier: (identifier) => identifier.toUpperCase()
|
|
302
325
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-linear",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.267.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"zod": "^4.5.4",
|
|
26
|
-
"@sentry/junior-plugin-api": "0.
|
|
26
|
+
"@sentry/junior-plugin-api": "0.267.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@oxlint/plugins": "1.79.0",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"oxlint": "^1.79.0",
|
|
32
32
|
"tsup": "^8.5.1",
|
|
33
33
|
"typescript": "^7.0.2",
|
|
34
|
-
"vitest": "^4.1.12"
|
|
34
|
+
"vitest": "^4.1.12",
|
|
35
|
+
"@sentry/junior-testing": "0.0.0"
|
|
35
36
|
},
|
|
36
37
|
"scripts": {
|
|
37
38
|
"build": "tsup && tsc -p tsconfig.build.json --emitDeclarationOnly",
|