@sentry/junior-vercel 0.126.1 → 0.128.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/{chunk-6UEKM742.js → chunk-5ZQCPWW4.js} +18 -26
- package/dist/index.js +12 -1
- package/dist/resource-events/deployment-source.d.ts +1 -1
- package/dist/testing.js +1 -1
- package/dist/tools/deployment-source.d.ts +4 -44
- package/dist/webhooks/resource-events.d.ts +3 -3
- package/package.json +2 -2
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
// src/webhooks/secret.ts
|
|
2
|
-
function vercelWebhookSecret() {
|
|
3
|
-
return process.env.VERCEL_WEBHOOK_SECRET?.trim() || void 0;
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
// src/tools/deployment-source.ts
|
|
7
|
-
import {
|
|
8
|
-
definePluginTool,
|
|
9
|
-
pluginToolResultSchema,
|
|
10
|
-
subscribableResourceSchema
|
|
11
|
-
} from "@sentry/junior-plugin-api";
|
|
12
|
-
import { z } from "zod";
|
|
13
|
-
|
|
14
1
|
// src/resource-events/deployment-source.ts
|
|
15
2
|
var VERCEL_DEPLOYMENT_EVENTS = [
|
|
16
3
|
"deployment.succeeded",
|
|
@@ -21,8 +8,8 @@ function vercelDeploymentSourceResource(input) {
|
|
|
21
8
|
const commitSha2 = input.commitSha.toLowerCase();
|
|
22
9
|
return {
|
|
23
10
|
label: `Vercel ${input.target} deployment for ${input.projectId} at ${commitSha2.slice(0, 12)}`,
|
|
24
|
-
|
|
25
|
-
|
|
11
|
+
namespace: "vercel",
|
|
12
|
+
identifier: `deployment-source:${input.projectId}:${input.target}:${commitSha2}`
|
|
26
13
|
};
|
|
27
14
|
}
|
|
28
15
|
function vercelDeploymentSourceSubscribable(input) {
|
|
@@ -35,7 +22,18 @@ function vercelDeploymentSourceSubscribable(input) {
|
|
|
35
22
|
};
|
|
36
23
|
}
|
|
37
24
|
|
|
25
|
+
// src/webhooks/secret.ts
|
|
26
|
+
function vercelWebhookSecret() {
|
|
27
|
+
return process.env.VERCEL_WEBHOOK_SECRET?.trim() || void 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
38
30
|
// src/tools/deployment-source.ts
|
|
31
|
+
import {
|
|
32
|
+
definePluginTool,
|
|
33
|
+
pluginToolOutputSchema,
|
|
34
|
+
subscribableResourceSchema
|
|
35
|
+
} from "@sentry/junior-plugin-api";
|
|
36
|
+
import { z } from "zod";
|
|
39
37
|
var projectIdSchema = z.string().regex(/^prj_[A-Za-z0-9]+$/);
|
|
40
38
|
var commitShaSchema = z.string().regex(/^[0-9a-f]{40}$/i);
|
|
41
39
|
var targetSchema = z.enum(["preview", "production", "staging"]);
|
|
@@ -52,10 +50,7 @@ var deploymentSourceSchema = z.object({
|
|
|
52
50
|
projectId: projectIdSchema,
|
|
53
51
|
subscribable: subscribableResourceSchema.optional()
|
|
54
52
|
});
|
|
55
|
-
var outputSchema =
|
|
56
|
-
data: deploymentSourceSchema,
|
|
57
|
-
ok: z.literal(true),
|
|
58
|
-
status: z.literal("success"),
|
|
53
|
+
var outputSchema = pluginToolOutputSchema.extend({
|
|
59
54
|
target: z.literal("deploymentSource"),
|
|
60
55
|
...deploymentSourceSchema.shape
|
|
61
56
|
});
|
|
@@ -102,12 +97,12 @@ function createVercelDeploymentSourceTool(ctx) {
|
|
|
102
97
|
}
|
|
103
98
|
const projectId = z.object({ id: projectIdSchema }).parse(parsed).id;
|
|
104
99
|
const commitSha2 = input.commitSha.toLowerCase();
|
|
105
|
-
const subscribable = vercelDeploymentSourceSubscribable({
|
|
100
|
+
const subscribable = ctx.resourceEvents.canSubscribe ? vercelDeploymentSourceSubscribable({
|
|
106
101
|
commitSha: commitSha2,
|
|
107
102
|
projectId,
|
|
108
103
|
target: input.target,
|
|
109
104
|
webhookSecret: vercelWebhookSecret()
|
|
110
|
-
});
|
|
105
|
+
}) : void 0;
|
|
111
106
|
const data = {
|
|
112
107
|
commitSha: commitSha2,
|
|
113
108
|
deploymentTarget: input.target,
|
|
@@ -115,9 +110,6 @@ function createVercelDeploymentSourceTool(ctx) {
|
|
|
115
110
|
...subscribable ? { subscribable } : {}
|
|
116
111
|
};
|
|
117
112
|
return {
|
|
118
|
-
data,
|
|
119
|
-
ok: true,
|
|
120
|
-
status: "success",
|
|
121
113
|
target: "deploymentSource",
|
|
122
114
|
...data
|
|
123
115
|
};
|
|
@@ -204,8 +196,7 @@ function normalizeVercelResourceEvents(args) {
|
|
|
204
196
|
eventKey: `vercel:${envelope.data.id}:${eventType}`,
|
|
205
197
|
eventType,
|
|
206
198
|
occurredAtMs: envelope.data.createdAt,
|
|
207
|
-
|
|
208
|
-
resourceRef: resource.resourceRef,
|
|
199
|
+
identifier: resource.identifier,
|
|
209
200
|
terminal: true,
|
|
210
201
|
trustedSummary: `${resource.label} (${deploymentId}) ${outcome}.`
|
|
211
202
|
}
|
|
@@ -255,6 +246,7 @@ function createVercelWebhookRoute(args) {
|
|
|
255
246
|
}
|
|
256
247
|
|
|
257
248
|
export {
|
|
249
|
+
VERCEL_DEPLOYMENT_EVENTS,
|
|
258
250
|
vercelWebhookSecret,
|
|
259
251
|
createVercelDeploymentSourceTool,
|
|
260
252
|
normalizeVercelResourceEvents,
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
|
+
VERCEL_DEPLOYMENT_EVENTS,
|
|
2
3
|
createVercelDeploymentSourceTool,
|
|
3
4
|
createVercelWebhookRoute,
|
|
4
5
|
vercelWebhookSecret
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5ZQCPWW4.js";
|
|
6
7
|
|
|
7
8
|
// src/index.ts
|
|
8
9
|
import {
|
|
@@ -11,6 +12,16 @@ import {
|
|
|
11
12
|
function vercelPlugin() {
|
|
12
13
|
return defineJuniorPlugin({
|
|
13
14
|
packageName: "@sentry/junior-vercel",
|
|
15
|
+
resourceEvents: {
|
|
16
|
+
resourceTypes: [
|
|
17
|
+
{
|
|
18
|
+
type: "deployment_source",
|
|
19
|
+
supportedEvents: [...VERCEL_DEPLOYMENT_EVENTS],
|
|
20
|
+
suggestedEvents: [...VERCEL_DEPLOYMENT_EVENTS]
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
isEnabled: () => Boolean(vercelWebhookSecret())
|
|
24
|
+
},
|
|
14
25
|
manifest: {
|
|
15
26
|
apiHeaders: {
|
|
16
27
|
Authorization: "Bearer ${JUNIOR_VERCEL_TOKEN}"
|
|
@@ -6,7 +6,7 @@ export declare function vercelDeploymentSourceResource(input: {
|
|
|
6
6
|
commitSha: string;
|
|
7
7
|
projectId: string;
|
|
8
8
|
target: VercelDeploymentTarget;
|
|
9
|
-
}): Pick<SubscribableResource, "label" | "
|
|
9
|
+
}): Pick<SubscribableResource, "label" | "namespace" | "identifier">;
|
|
10
10
|
/** Describe a deployment source when signed Vercel webhooks are enabled. */
|
|
11
11
|
export declare function vercelDeploymentSourceSubscribable(input: {
|
|
12
12
|
commitSha: string;
|
package/dist/testing.js
CHANGED
|
@@ -10,36 +10,16 @@ export declare function createVercelDeploymentSourceTool(ctx: ToolRegistrationHo
|
|
|
10
10
|
commitSha: string;
|
|
11
11
|
deploymentTarget: "preview" | "production" | "staging";
|
|
12
12
|
projectId: string;
|
|
13
|
-
data: {
|
|
14
|
-
commitSha: string;
|
|
15
|
-
deploymentTarget: "preview" | "production" | "staging";
|
|
16
|
-
projectId: string;
|
|
17
|
-
subscribable?: {
|
|
18
|
-
label: string;
|
|
19
|
-
provider: string;
|
|
20
|
-
resourceRef: string;
|
|
21
|
-
supportedEvents: string[];
|
|
22
|
-
type: string;
|
|
23
|
-
suggestedEvents?: string[] | undefined;
|
|
24
|
-
} | undefined;
|
|
25
|
-
};
|
|
26
|
-
ok: true;
|
|
27
|
-
status: "success";
|
|
28
13
|
target: "deploymentSource";
|
|
29
14
|
truncated?: boolean | undefined;
|
|
30
15
|
continuation?: {
|
|
31
16
|
arguments: Record<string, unknown>;
|
|
32
17
|
reason?: string | undefined;
|
|
33
18
|
} | undefined;
|
|
34
|
-
error?: string | {
|
|
35
|
-
kind: string;
|
|
36
|
-
message: string;
|
|
37
|
-
retryable?: boolean | undefined;
|
|
38
|
-
} | undefined;
|
|
39
19
|
subscribable?: {
|
|
20
|
+
identifier: string;
|
|
40
21
|
label: string;
|
|
41
|
-
|
|
42
|
-
resourceRef: string;
|
|
22
|
+
namespace: string;
|
|
43
23
|
supportedEvents: string[];
|
|
44
24
|
type: string;
|
|
45
25
|
suggestedEvents?: string[] | undefined;
|
|
@@ -49,36 +29,16 @@ export declare function createVercelDeploymentSourceTool(ctx: ToolRegistrationHo
|
|
|
49
29
|
commitSha: string;
|
|
50
30
|
deploymentTarget: "preview" | "production" | "staging";
|
|
51
31
|
projectId: string;
|
|
52
|
-
data: {
|
|
53
|
-
commitSha: string;
|
|
54
|
-
deploymentTarget: "preview" | "production" | "staging";
|
|
55
|
-
projectId: string;
|
|
56
|
-
subscribable?: {
|
|
57
|
-
label: string;
|
|
58
|
-
provider: string;
|
|
59
|
-
resourceRef: string;
|
|
60
|
-
supportedEvents: string[];
|
|
61
|
-
type: string;
|
|
62
|
-
suggestedEvents?: string[] | undefined;
|
|
63
|
-
} | undefined;
|
|
64
|
-
};
|
|
65
|
-
ok: true;
|
|
66
|
-
status: "success";
|
|
67
32
|
target: "deploymentSource";
|
|
68
33
|
truncated?: boolean | undefined;
|
|
69
34
|
continuation?: {
|
|
70
35
|
arguments: Record<string, unknown>;
|
|
71
36
|
reason?: string | undefined;
|
|
72
37
|
} | undefined;
|
|
73
|
-
error?: string | {
|
|
74
|
-
kind: string;
|
|
75
|
-
message: string;
|
|
76
|
-
retryable?: boolean | undefined;
|
|
77
|
-
} | undefined;
|
|
78
38
|
subscribable?: {
|
|
39
|
+
identifier: string;
|
|
79
40
|
label: string;
|
|
80
|
-
|
|
81
|
-
resourceRef: string;
|
|
41
|
+
namespace: string;
|
|
82
42
|
supportedEvents: string[];
|
|
83
43
|
type: string;
|
|
84
44
|
suggestedEvents?: string[] | undefined;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Owns Vercel's deployment webhook wire-format boundary.
|
|
3
3
|
*
|
|
4
|
-
* It validates
|
|
4
|
+
* It validates webhook payloads, ignores unsupported or incomplete deliveries,
|
|
5
5
|
* and emits only canonical terminal resource events.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { ResourceEventInput } from "@sentry/junior-plugin-api";
|
|
8
8
|
/** Normalize one verified Vercel delivery into a terminal deployment event. */
|
|
9
9
|
export declare function normalizeVercelResourceEvents(args: {
|
|
10
10
|
body: unknown;
|
|
11
|
-
}):
|
|
11
|
+
}): ResourceEventInput[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/junior-vercel",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.128.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"zod": "^4.4.3",
|
|
30
|
-
"@sentry/junior-plugin-api": "0.
|
|
30
|
+
"@sentry/junior-plugin-api": "0.128.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^25.9.1",
|