@jclvsh/dropspace 2.2.0 → 2.3.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/dist/commands/keys.js +1 -1
- package/dist/commands/webhooks.js +12 -0
- package/dist/tools/webhooks.js +21 -0
- package/dist/types.d.ts +7 -0
- package/package.json +1 -1
package/dist/commands/keys.js
CHANGED
|
@@ -26,7 +26,7 @@ export function registerKeyCommands(program, client) {
|
|
|
26
26
|
keys.command("create")
|
|
27
27
|
.description("create a new API key (requires admin scope)")
|
|
28
28
|
.requiredOption("-n, --name <name>", "key name")
|
|
29
|
-
.option("--scopes <list>", "comma-separated scopes: read,write,
|
|
29
|
+
.option("--scopes <list>", "comma-separated scopes: read,write,generate,send,admin (legacy publish/delete still accepted)", parseList)
|
|
30
30
|
.action(async (opts) => {
|
|
31
31
|
try {
|
|
32
32
|
const body = { name: opts.name };
|
|
@@ -74,6 +74,18 @@ export function registerWebhookCommands(program, client) {
|
|
|
74
74
|
handleError(error);
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
|
+
webhooks
|
|
78
|
+
.command("test <id>")
|
|
79
|
+
.description("send a synthetic webhook.test event to a webhook URL — verifies end-to-end delivery and signing (requires admin scope)")
|
|
80
|
+
.action(async (id) => {
|
|
81
|
+
try {
|
|
82
|
+
const result = await client.post(`/webhooks/${id}/test`);
|
|
83
|
+
formatOutput(result, getFormat(program.opts()));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
handleError(error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
77
89
|
webhooks
|
|
78
90
|
.command("rotate-secret <id>")
|
|
79
91
|
.description("rotate a webhook's signing secret (requires admin scope)")
|
package/dist/tools/webhooks.js
CHANGED
|
@@ -152,6 +152,27 @@ export function registerWebhookTools(server, client) {
|
|
|
152
152
|
};
|
|
153
153
|
}
|
|
154
154
|
});
|
|
155
|
+
server.tool("test_webhook", "send a synthetic webhook.test event to a webhook URL and report the receiver's response status — useful for verifying setup before relying on real events (requires admin scope)", {
|
|
156
|
+
id: z.string().uuid().describe("webhook ID"),
|
|
157
|
+
}, async ({ id }) => {
|
|
158
|
+
try {
|
|
159
|
+
const result = await client.post(`/webhooks/${id}/test`);
|
|
160
|
+
return {
|
|
161
|
+
content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return {
|
|
166
|
+
content: [
|
|
167
|
+
{
|
|
168
|
+
type: "text",
|
|
169
|
+
text: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
170
|
+
},
|
|
171
|
+
],
|
|
172
|
+
isError: true,
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
});
|
|
155
176
|
server.tool("list_webhook_deliveries", "list delivery attempts for a webhook with pagination (requires admin scope)", {
|
|
156
177
|
id: z.string().uuid().describe("webhook ID"),
|
|
157
178
|
page: z.number().int().positive().optional().describe("page number (default: 1)"),
|
package/dist/types.d.ts
CHANGED
|
@@ -198,6 +198,13 @@ export interface RotateSecretResponse {
|
|
|
198
198
|
id: string;
|
|
199
199
|
secret: string;
|
|
200
200
|
}
|
|
201
|
+
/** Result of POST /webhooks/:id/test — outcome of a synthetic webhook delivery */
|
|
202
|
+
export interface TestWebhookResponse {
|
|
203
|
+
success: boolean;
|
|
204
|
+
delivery_id: string | null;
|
|
205
|
+
response_status: number | null;
|
|
206
|
+
response_body: string | null;
|
|
207
|
+
}
|
|
201
208
|
/** Webhook delivery log entry */
|
|
202
209
|
export interface WebhookDelivery {
|
|
203
210
|
id: string;
|