@vite-hub/webhooks 0.5.0 → 0.5.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/{database-ih8X0nxf.d.ts → database-C5cwO1an.d.ts} +0 -4
- package/dist/database.d.ts +1 -1
- package/dist/database.js +2 -3
- package/dist/{errors-CIAKA8pC.js → errors-DT8uyCh7.js} +1 -2
- package/dist/index.d.ts +3 -9
- package/dist/index.js +5 -7
- package/dist/{members-CvRoM95o.d.ts → members-BjDcAAhY.d.ts} +1 -5
- package/dist/{members-B7Lr2AH0.js → members-Cr_Nlyg4.js} +4 -6
- package/dist/{object-Da1zyPCR.js → object-CAK6UYR5.js} +1 -2
- package/dist/{operations-VyyNZusz.d.ts → operations-8hqTi0DH.d.ts} +0 -2
- package/dist/operations.d.ts +4 -6
- package/dist/operations.js +14 -17
- package/dist/{queue-name-CGeTSHId.d.ts → queue-name-CLdaJFPZ.d.ts} +0 -2
- package/dist/{queue-name-RURp9SQf.js → queue-name-jmgeppja.js} +1 -2
- package/dist/{runtime-jKXp2Hh0.js → runtime-BFiCJOMB.js} +5 -9
- package/dist/{runtime-C-JYQJxn.d.ts → runtime-BdILDcW1.d.ts} +2 -8
- package/dist/runtime.d.ts +2 -2
- package/dist/runtime.js +2 -2
- package/dist/{table-names-C01h1z-T.js → table-names-DAUip4v2.js} +1 -2
- package/dist/vite.d.ts +2 -14
- package/dist/vite.js +10 -16
- package/package.json +9 -9
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { AnyRelations } from "drizzle-orm";
|
|
2
2
|
import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
|
|
3
|
-
//#region src/table-names.d.ts
|
|
4
3
|
/**
|
|
5
4
|
* The schema keys of `webhooksSchema` and their SQL names. Its own module, so the Vite plugin lists the table without
|
|
6
5
|
* loading Drizzle during config resolution.
|
|
@@ -8,8 +7,6 @@ import { SQLiteAsyncDatabase } from "drizzle-orm/sqlite-core";
|
|
|
8
7
|
declare const webhooksTableNames: Readonly<Record<string, string>>;
|
|
9
8
|
/** The schema keys of `webhookEndpointsSchema` and their SQL names. */
|
|
10
9
|
declare const webhookEndpointsTableNames: Readonly<Record<string, string>>;
|
|
11
|
-
//#endregion
|
|
12
|
-
//#region src/database.d.ts
|
|
13
10
|
/** Where a delivery is. `sending` holds a claim while one server posts it. */
|
|
14
11
|
type WebhookDeliveryState = "pending" | "sending" | "sent" | "dead" | "cancelled";
|
|
15
12
|
/**
|
|
@@ -1517,5 +1514,4 @@ interface WebhookEndpointStore {
|
|
|
1517
1514
|
type StoredMemberPairing = typeof webhookPairings.$inferSelect;
|
|
1518
1515
|
/** Member endpoints in a Drizzle SQLite Database. Pass a function when the Database connects per request. */
|
|
1519
1516
|
declare function createDrizzleWebhookEndpointStore(database: WebhooksDatabase | (() => WebhooksDatabase)): WebhookEndpointStore;
|
|
1520
|
-
//#endregion
|
|
1521
1517
|
export { webhooksSchema as C, webhooksTableNames as E, webhookPairings as S, webhookEndpointsTableNames as T, createDrizzleWebhookEndpointStore as _, MemberLastDelivery as a, webhookEndpoints as b, StoredMemberPairing as c, WebhookDeliveryState as d, WebhookDeliveryStore as f, WebhooksDatabase as g, WebhookSendRecord as h, MemberEndpointKind as i, WebhookAttemptResult as l, WebhookRecordOnceResult as m, ListWebhookDeliveriesOptions as n, MemberPairingState as o, WebhookEndpointStore as p, MemberEndpoint as r, StoredMemberEndpoint as s, ListMemberEndpointsOptions as t, WebhookDelivery as u, createDrizzleWebhookStore as v, webhooksTables as w, webhookEndpointsSchema as x, webhookDeliveries as y };
|
package/dist/database.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as webhooksSchema, E as webhooksTableNames, S as webhookPairings, T as webhookEndpointsTableNames, _ as createDrizzleWebhookEndpointStore, a as MemberLastDelivery, b as webhookEndpoints, c as StoredMemberPairing, d as WebhookDeliveryState, f as WebhookDeliveryStore, g as WebhooksDatabase, h as WebhookSendRecord, i as MemberEndpointKind, l as WebhookAttemptResult, m as WebhookRecordOnceResult, n as ListWebhookDeliveriesOptions, o as MemberPairingState, p as WebhookEndpointStore, r as MemberEndpoint, s as StoredMemberEndpoint, t as ListMemberEndpointsOptions, u as WebhookDelivery, v as createDrizzleWebhookStore, w as webhooksTables, x as webhookEndpointsSchema, y as webhookDeliveries } from "./database-
|
|
1
|
+
import { C as webhooksSchema, E as webhooksTableNames, S as webhookPairings, T as webhookEndpointsTableNames, _ as createDrizzleWebhookEndpointStore, a as MemberLastDelivery, b as webhookEndpoints, c as StoredMemberPairing, d as WebhookDeliveryState, f as WebhookDeliveryStore, g as WebhooksDatabase, h as WebhookSendRecord, i as MemberEndpointKind, l as WebhookAttemptResult, m as WebhookRecordOnceResult, n as ListWebhookDeliveriesOptions, o as MemberPairingState, p as WebhookEndpointStore, r as MemberEndpoint, s as StoredMemberEndpoint, t as ListMemberEndpointsOptions, u as WebhookDelivery, v as createDrizzleWebhookStore, w as webhooksTables, x as webhookEndpointsSchema, y as webhookDeliveries } from "./database-C5cwO1an.js";
|
|
2
2
|
export { ListMemberEndpointsOptions, ListWebhookDeliveriesOptions, MemberEndpoint, MemberEndpointKind, MemberLastDelivery, MemberPairingState, StoredMemberEndpoint, StoredMemberPairing, WebhookAttemptResult, WebhookDelivery, WebhookDeliveryState, WebhookDeliveryStore, WebhookEndpointStore, WebhookRecordOnceResult, WebhookSendRecord, WebhooksDatabase, createDrizzleWebhookEndpointStore, createDrizzleWebhookStore, webhookDeliveries, webhookEndpoints, webhookEndpointsSchema, webhookEndpointsTableNames, webhookPairings, webhooksSchema, webhooksTableNames, webhooksTables };
|
package/dist/database.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as webhooksErrors } from "./errors-
|
|
2
|
-
import { n as webhooksTableNames, t as webhookEndpointsTableNames } from "./table-names-
|
|
1
|
+
import { t as webhooksErrors } from "./errors-DT8uyCh7.js";
|
|
2
|
+
import { n as webhooksTableNames, t as webhookEndpointsTableNames } from "./table-names-DAUip4v2.js";
|
|
3
3
|
import { and, asc, desc, eq, gt, gte, inArray, lt, or, sql } from "drizzle-orm";
|
|
4
4
|
import { index, integer, sqliteTable, text, uniqueIndex } from "drizzle-orm/sqlite-core";
|
|
5
5
|
/**
|
|
@@ -350,5 +350,4 @@ function createDrizzleWebhookEndpointStore(database) {
|
|
|
350
350
|
})
|
|
351
351
|
};
|
|
352
352
|
}
|
|
353
|
-
//#endregion
|
|
354
353
|
export { createDrizzleWebhookEndpointStore, createDrizzleWebhookStore, webhookDeliveries, webhookEndpoints, webhookEndpointsSchema, webhookEndpointsTableNames, webhookPairings, webhooksSchema, webhooksTableNames, webhooksTables };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineErrors } from "@vite-hub/runtime";
|
|
2
|
-
|
|
2
|
+
// src/errors.ts
|
|
3
3
|
const webhooksErrors = /*#__PURE__*/ defineErrors({
|
|
4
4
|
docs: "https://vitehub.dev/docs/webhooks/diagnostics",
|
|
5
5
|
codes: {
|
|
@@ -113,5 +113,4 @@ const webhooksErrors = /*#__PURE__*/ defineErrors({
|
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
});
|
|
116
|
-
//#endregion
|
|
117
116
|
export { webhooksErrors as t };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { S as WebhookDeliveryErrorCode, _ as CreateMemberEndpointErrorCode, a as SendToMemberEndpointResult, b as SendToMemberEndpointErrorCode, c as enableMemberEndpoint, d as listMemberDeliveries, f as listMemberEndpoints, g as sendToMemberEndpoint, h as removeMemberEndpoints, i as SendToMemberEndpointOptions, l as getMemberDeliveryState, m as removeMemberEndpoint, n as MemberDeliveries, o as createMemberEndpoint, p as memberEndpointHosts, r as MemberEndpointWithLastDelivery, s as disableMemberEndpoint, t as CreateMemberEndpointOptions, u as getMemberEndpoint, v as MemberEndpointErrorCode, x as SendWebhookErrorCode, y as MemberPairingErrorCode } from "./members-BjDcAAhY.js";
|
|
2
|
+
import { B as WebhookSignature, F as sealWebhooksText, I as unsealWebhooksText, L as WebhookDefinition, R as WebhookEvent, V as defineWebhook, a as SendWebhookResult, s as WebhookEventBody, z as WebhookOptions } from "./runtime-BdILDcW1.js";
|
|
3
|
+
import { a as MemberLastDelivery, i as MemberEndpointKind, o as MemberPairingState, r as MemberEndpoint } from "./database-C5cwO1an.js";
|
|
4
4
|
import { Result } from "@vite-hub/runtime";
|
|
5
|
-
//#region src/pairing.d.ts
|
|
6
5
|
/** How long a pairing code works: 10 minutes. */
|
|
7
6
|
export declare const memberPairingLifetime: number;
|
|
8
7
|
/**
|
|
@@ -100,8 +99,6 @@ interface AllowMemberPairingOptions {
|
|
|
100
99
|
* ```
|
|
101
100
|
*/
|
|
102
101
|
export declare function allowMemberPairing(owner: string, code: string, options: AllowMemberPairingOptions): Promise<Result<MemberAllowResult, MemberPairingErrorCode | CreateMemberEndpointErrorCode>>;
|
|
103
|
-
//#endregion
|
|
104
|
-
//#region src/url-guard.d.ts
|
|
105
102
|
/** Options of `checkWebhookUrl()`. */
|
|
106
103
|
interface CheckWebhookUrlOptions {
|
|
107
104
|
/**
|
|
@@ -129,8 +126,6 @@ interface CheckWebhookUrlOptions {
|
|
|
129
126
|
* ```
|
|
130
127
|
*/
|
|
131
128
|
export declare function checkWebhookUrl(url: string, options?: CheckWebhookUrlOptions): Promise<Result<URL, "WEBHOOKS_URL_REFUSED">>;
|
|
132
|
-
//#endregion
|
|
133
|
-
//#region src/index.d.ts
|
|
134
129
|
/** The webhooks of `server/webhooks/`. The generated `.vitehub/webhooks.d.ts` adds one key for each file. */
|
|
135
130
|
export interface WebhookRegistry {}
|
|
136
131
|
/** The name of a webhook of `server/webhooks/`. */
|
|
@@ -161,5 +156,4 @@ export interface SendWebhookOptions {
|
|
|
161
156
|
* ```
|
|
162
157
|
*/
|
|
163
158
|
export declare function sendWebhook<TName extends WebhookName>(name: TName, body: unknown, options: SendWebhookOptions): Promise<Result<SendWebhookResult, SendWebhookErrorCode>>;
|
|
164
|
-
//#endregion
|
|
165
159
|
export { type AllowMemberPairingOptions, type CheckWebhookUrlOptions, type CreateMemberEndpointErrorCode, type CreateMemberEndpointOptions, type MemberAllowResult, type MemberDeliveries, type MemberEndpoint, type MemberEndpointErrorCode, type MemberEndpointKind, type MemberEndpointWithLastDelivery, type MemberLastDelivery, type MemberPairResult, type MemberPairing, type MemberPairingErrorCode, type MemberPairingState, type SendToMemberEndpointErrorCode, type SendToMemberEndpointOptions, type SendToMemberEndpointResult, type SendWebhookErrorCode, type SendWebhookResult, type WebhookDefinition, type WebhookDeliveryErrorCode, type WebhookEvent, type WebhookEventBody, type WebhookOptions, type WebhookSignature, createMemberEndpoint, defineWebhook, disableMemberEndpoint, enableMemberEndpoint, getMemberDeliveryState, getMemberEndpoint, listMemberDeliveries, listMemberEndpoints, memberEndpointHosts, removeMemberEndpoint, removeMemberEndpoints, sealWebhooksText, sendToMemberEndpoint, unsealWebhooksText };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { M as unsealWebhooksText, N as defineWebhook, T as checkWebhookUrl, _ as requireMemberEndpoints, k as sealWebhooksText, y as sendDynamicWebhook } from "./runtime-BFiCJOMB.js";
|
|
2
|
+
import { a as getMemberEndpoint, c as memberEndpointHosts, d as removeMemberEndpoints, f as sendToMemberEndpoint, i as getMemberDeliveryState, n as disableMemberEndpoint, o as listMemberDeliveries, r as enableMemberEndpoint, s as listMemberEndpoints, t as createMemberEndpoint, u as removeMemberEndpoint } from "./members-Cr_Nlyg4.js";
|
|
3
|
+
import { t as webhooksErrors } from "./errors-DT8uyCh7.js";
|
|
4
|
+
// src/pairing.ts
|
|
5
5
|
/** How long a pairing code works: 10 minutes. */
|
|
6
6
|
const memberPairingLifetime = 6e5;
|
|
7
7
|
const inboxes = /* @__PURE__ */ new Map([["Claude Code", "claude-code"], ["Codex", "codex"]]);
|
|
@@ -242,8 +242,7 @@ async function allowMemberPairing(owner, code, options) {
|
|
|
242
242
|
pairing
|
|
243
243
|
}];
|
|
244
244
|
}
|
|
245
|
-
|
|
246
|
-
//#region src/index.ts
|
|
245
|
+
// src/index.ts
|
|
247
246
|
/**
|
|
248
247
|
* Sends `body` as JSON to the webhook `name` of `server/webhooks/<name>.ts`, signed with its secret, and returns
|
|
249
248
|
* `[error, { id, status }]`. The delivery waits in the Database and goes out through the Queue, so it survives a restart
|
|
@@ -262,5 +261,4 @@ async function allowMemberPairing(owner, code, options) {
|
|
|
262
261
|
function sendWebhook(name, body, options) {
|
|
263
262
|
return sendDynamicWebhook(name, body, options);
|
|
264
263
|
}
|
|
265
|
-
//#endregion
|
|
266
264
|
export { allowMemberPairing, cancelMemberPairing, checkWebhookUrl, createMemberEndpoint, defineWebhook, disableMemberEndpoint, enableMemberEndpoint, getMemberDeliveryState, getMemberEndpoint, getMemberPairing, listMemberDeliveries, listMemberEndpoints, memberEndpointHosts, memberPairingAddress, memberPairingLifetime, pairMemberEndpoint, refuseMemberPairing, removeMemberEndpoint, removeMemberEndpoints, sealWebhooksText, sendToMemberEndpoint, sendWebhook, startMemberPairing, unsealWebhooksText };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { a as MemberLastDelivery, d as WebhookDeliveryState, n as ListWebhookDeliveriesOptions, r as MemberEndpoint, t as ListMemberEndpointsOptions, u as WebhookDelivery } from "./database-
|
|
1
|
+
import { a as MemberLastDelivery, d as WebhookDeliveryState, n as ListWebhookDeliveriesOptions, r as MemberEndpoint, t as ListMemberEndpointsOptions, u as WebhookDelivery } from "./database-C5cwO1an.js";
|
|
2
2
|
import { Result } from "@vite-hub/runtime";
|
|
3
|
-
//#region src/errors.d.ts
|
|
4
3
|
declare const webhooksErrors: import("@vite-hub/runtime").ErrorCatalog<{
|
|
5
4
|
readonly WEBHOOKS_CONTRIBUTION_INVALID: {
|
|
6
5
|
readonly why: ({ plugin }: {
|
|
@@ -178,8 +177,6 @@ type SendToMemberEndpointErrorCode = "WEBHOOKS_BODY_INVALID" | "WEBHOOKS_DATABAS
|
|
|
178
177
|
* delivery to a member endpoint.
|
|
179
178
|
*/
|
|
180
179
|
type WebhookDeliveryErrorCode = "WEBHOOKS_DATABASE_MISSING" | "WEBHOOKS_DELIVERY_ACTIVE" | "WEBHOOKS_DELIVERY_NOT_FOUND" | "WEBHOOKS_DELIVERY_NOT_OWNER" | "WEBHOOKS_DELIVERY_NOT_PENDING" | "WEBHOOKS_ENDPOINT_DISABLED" | "WEBHOOKS_ENDPOINT_NOT_FOUND" | "WEBHOOKS_KEY_INVALID" | "WEBHOOKS_KEY_UNSET" | "WEBHOOKS_STORE_FAILED" | "WEBHOOKS_WAKE_FAILED";
|
|
181
|
-
//#endregion
|
|
182
|
-
//#region src/members.d.ts
|
|
183
180
|
/** The hosts that a member endpoint URL may use when `createMemberEndpoint()` gets no `hosts`: the T3 Code relay. */
|
|
184
181
|
declare const memberEndpointHosts: readonly string[];
|
|
185
182
|
/** What `createMemberEndpoint()` accepts. */
|
|
@@ -343,5 +340,4 @@ declare function listMemberDeliveries(owner: string, options?: {
|
|
|
343
340
|
} & Pick<ListWebhookDeliveriesOptions, "limit" | "before">): Promise<Result<MemberDeliveries | null, MemberEndpointErrorCode>>;
|
|
344
341
|
/** Reads only the state of a known member delivery, never its body. */
|
|
345
342
|
declare function getMemberDeliveryState(id: string): Promise<WebhookDeliveryState | undefined>;
|
|
346
|
-
//#endregion
|
|
347
343
|
export { webhooksErrors as C, WebhookDeliveryErrorCode as S, CreateMemberEndpointErrorCode as _, SendToMemberEndpointResult as a, SendToMemberEndpointErrorCode as b, enableMemberEndpoint as c, listMemberDeliveries as d, listMemberEndpoints as f, sendToMemberEndpoint as g, removeMemberEndpoints as h, SendToMemberEndpointOptions as i, getMemberDeliveryState as l, removeMemberEndpoint as m, MemberDeliveries as n, createMemberEndpoint as o, memberEndpointHosts as p, MemberEndpointWithLastDelivery as r, disableMemberEndpoint as s, CreateMemberEndpointOptions as t, getMemberEndpoint as u, MemberEndpointErrorCode as v, SendWebhookErrorCode as x, MemberPairingErrorCode as y };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as webhooksErrors } from "./errors-
|
|
2
|
-
import { A as sealedMemberBodyPrefix, D as memberBodyLabel, E as outsideHosts, O as sealEndpoint, T as checkWebhookUrl, _ as requireMemberEndpoints, j as unsealEndpoint, k as sealWebhooksText, n as createDeliveryId, r as deliverMemberClaim, s as inspectDelivery } from "./runtime-
|
|
3
|
-
|
|
1
|
+
import { t as webhooksErrors } from "./errors-DT8uyCh7.js";
|
|
2
|
+
import { A as sealedMemberBodyPrefix, D as memberBodyLabel, E as outsideHosts, O as sealEndpoint, T as checkWebhookUrl, _ as requireMemberEndpoints, j as unsealEndpoint, k as sealWebhooksText, n as createDeliveryId, r as deliverMemberClaim, s as inspectDelivery } from "./runtime-BFiCJOMB.js";
|
|
3
|
+
// \0rolldown/runtime.js
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __exportAll = (all, no_symbols) => {
|
|
6
6
|
let target = {};
|
|
@@ -11,8 +11,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
11
11
|
if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
|
|
12
12
|
return target;
|
|
13
13
|
};
|
|
14
|
-
|
|
15
|
-
//#region src/members.ts
|
|
14
|
+
// src/members.ts
|
|
16
15
|
var members_exports = /* @__PURE__ */ __exportAll({
|
|
17
16
|
createMemberEndpoint: () => createMemberEndpoint,
|
|
18
17
|
disableMemberEndpoint: () => disableMemberEndpoint,
|
|
@@ -306,5 +305,4 @@ async function getMemberDeliveryState(id) {
|
|
|
306
305
|
const row = await requireMemberEndpoints().store.get(id);
|
|
307
306
|
return row?.webhook.startsWith("@") ? row.state : void 0;
|
|
308
307
|
}
|
|
309
|
-
//#endregion
|
|
310
308
|
export { getMemberEndpoint as a, memberEndpointHosts as c, removeMemberEndpoints as d, sendToMemberEndpoint as f, getMemberDeliveryState as i, members_exports as l, disableMemberEndpoint as n, listMemberDeliveries as o, enableMemberEndpoint as r, listMemberEndpoints as s, createMemberEndpoint as t, removeMemberEndpoint as u };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// ../internal/src/object.ts
|
|
2
2
|
/** A non-null object that is not an array. Functions do not pass. */
|
|
3
3
|
function isRecord(value) {
|
|
4
4
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
@@ -7,5 +7,4 @@ function isRecord(value) {
|
|
|
7
7
|
function isRecordOrFunction(value) {
|
|
8
8
|
return Object(value) === value && !Array.isArray(value);
|
|
9
9
|
}
|
|
10
|
-
//#endregion
|
|
11
10
|
export { isRecordOrFunction as n, isRecord as t };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { StandardSchemaV1 } from "@standard-schema/spec";
|
|
2
|
-
//#region ../internal/src/operation-definition.d.ts
|
|
3
2
|
/** `read` never changes state. `write` changes state. `destructive` deletes or publishes. */
|
|
4
3
|
type OperationKind = "read" | "write" | "destructive";
|
|
5
4
|
/** The signed-in user of a call. */
|
|
@@ -167,5 +166,4 @@ interface OperationContributionEntry {
|
|
|
167
166
|
}
|
|
168
167
|
/** The contribution of a plugin: a list, or a function that returns it, for a plugin that reads the project first. */
|
|
169
168
|
type OperationContributions = readonly OperationContributionEntry[] | (() => readonly OperationContributionEntry[] | Promise<readonly OperationContributionEntry[]>);
|
|
170
|
-
//#endregion
|
|
171
169
|
export { OperationContributions as n, AnyOperation as t };
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
3
|
-
import {
|
|
4
|
-
//#region src/operations.d.ts
|
|
1
|
+
import { t as AnyOperation } from "./operations-8hqTi0DH.js";
|
|
2
|
+
import { r as MemberEndpoint } from "./database-C5cwO1an.js";
|
|
3
|
+
import { r as MemberEndpointWithLastDelivery } from "./members-BjDcAAhY.js";
|
|
5
4
|
/**
|
|
6
5
|
* One member endpoint, as `webhooks.endpoints` lists it for admins: no URL, no secret, and no email. `mine` is true
|
|
7
6
|
* when the caller owns it, so the Console shows Redeliver only on the caller's own deliveries.
|
|
@@ -15,5 +14,4 @@ export type MemberEndpointChange = Pick<MemberEndpoint, "id" | "owner" | "disabl
|
|
|
15
14
|
* The `webhooks.*` operations. The Console, `vitehub webhooks`, and MCP run them on the app's operation RPC, `POST
|
|
16
15
|
* /_vitehub/rpc`.
|
|
17
16
|
*/
|
|
18
|
-
export declare const webhooksOperations: readonly AnyOperation[];
|
|
19
|
-
//#endregion
|
|
17
|
+
export declare const webhooksOperations: readonly AnyOperation[];
|
package/dist/operations.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { n as isRecordOrFunction } from "./object-CAK6UYR5.js";
|
|
2
|
+
import { t as webhooksErrors } from "./errors-DT8uyCh7.js";
|
|
3
3
|
import * as v from "valibot";
|
|
4
|
-
|
|
4
|
+
// ../../node_modules/.pnpm/nostics@1.4.0/node_modules/nostics/dist/index.mjs
|
|
5
5
|
/**
|
|
6
6
|
* Transforms a value or a function that returns a value to a value.
|
|
7
7
|
*
|
|
@@ -103,8 +103,7 @@ function defineDiagnostics(options) {
|
|
|
103
103
|
}
|
|
104
104
|
return result;
|
|
105
105
|
}
|
|
106
|
-
|
|
107
|
-
//#region ../internal/src/error-diagnostics.ts
|
|
106
|
+
// ../internal/src/error-diagnostics.ts
|
|
108
107
|
const dynamicError = { why: ({ message }) => message === void 0 ? "" : String(message) };
|
|
109
108
|
const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
110
109
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
@@ -361,6 +360,10 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
361
360
|
why: ({ minimum }) => `[vitehub] VITEHUB_SECRET must be at least ${minimum} characters. Generate one with \`openssl rand -base64 32\`.`,
|
|
362
361
|
fix: "Set `VITEHUB_SECRET` to the output of `openssl rand -base64 32`, which has 44 characters."
|
|
363
362
|
},
|
|
363
|
+
INTERNAL_SITE_TOKEN_TOO_LONG: {
|
|
364
|
+
why: ({ length, maximum }) => `The Site access token is ${length} characters, and an app accepts ${maximum}.`,
|
|
365
|
+
fix: "Open the app with a shorter path, or give the person and the project shorter names, so that the Site access token fits."
|
|
366
|
+
},
|
|
364
367
|
INTERNAL_SQLITE_ARGUMENT_INVALID: {
|
|
365
368
|
why: ({ value }) => value === "undefined" ? "undefined cannot be passed as argument to the database" : "Only finite numbers (not Infinity or NaN) can be passed as arguments",
|
|
366
369
|
fix: "Pass query arguments as finite numbers, strings, booleans, bigints, dates, byte arrays, or null. Replace undefined with null, and check numbers with `Number.isFinite()` before the query."
|
|
@@ -375,8 +378,7 @@ const internalErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
|
375
378
|
}
|
|
376
379
|
}
|
|
377
380
|
});
|
|
378
|
-
|
|
379
|
-
//#region ../internal/src/standard-schema.ts
|
|
381
|
+
// ../internal/src/standard-schema.ts
|
|
380
382
|
function readOwn(value, key) {
|
|
381
383
|
if (value === null || Object(value) !== value) return;
|
|
382
384
|
try {
|
|
@@ -405,8 +407,7 @@ function standardJsonSchema(schema, direction, target = "draft-2020-12", library
|
|
|
405
407
|
return;
|
|
406
408
|
}
|
|
407
409
|
}
|
|
408
|
-
|
|
409
|
-
//#region ../../node_modules/.pnpm/@valibot+to-json-schema@1.8.0_valibot@1.5.0_typescript@6.0.3_/node_modules/@valibot/to-json-schema/dist/index.mjs
|
|
410
|
+
// ../../node_modules/.pnpm/@valibot+to-json-schema@1.8.0_valibot@1.5.0_typescript@6.0.3_/node_modules/@valibot/to-json-schema/dist/index.mjs
|
|
410
411
|
/**
|
|
411
412
|
* Adds an error message to the errors array.
|
|
412
413
|
*
|
|
@@ -1088,8 +1089,7 @@ function toJsonSchema(schema, config) {
|
|
|
1088
1089
|
if (context.referenceMap.size) jsonSchema.$defs = context.definitions;
|
|
1089
1090
|
return jsonSchema;
|
|
1090
1091
|
}
|
|
1091
|
-
|
|
1092
|
-
//#region ../internal/src/valibot.ts
|
|
1092
|
+
// ../internal/src/valibot.ts
|
|
1093
1093
|
const valibotTargets = /* @__PURE__ */ new Set([
|
|
1094
1094
|
"draft-07",
|
|
1095
1095
|
"draft-2020-12",
|
|
@@ -1130,8 +1130,7 @@ function withValibotJsonSchema(schema, options = {}) {
|
|
|
1130
1130
|
}
|
|
1131
1131
|
};
|
|
1132
1132
|
}
|
|
1133
|
-
|
|
1134
|
-
//#region ../internal/src/operation-definition.ts
|
|
1133
|
+
// ../internal/src/operation-definition.ts
|
|
1135
1134
|
const nameFormat = /^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/;
|
|
1136
1135
|
const kinds = /* @__PURE__ */ new Set([
|
|
1137
1136
|
"read",
|
|
@@ -1191,10 +1190,9 @@ function isSectionId(section) {
|
|
|
1191
1190
|
function operationInputJsonSchema(operation) {
|
|
1192
1191
|
return standardJsonSchema(operation.input, "input") ?? { type: "object" };
|
|
1193
1192
|
}
|
|
1194
|
-
|
|
1195
|
-
//#region src/operations.ts
|
|
1193
|
+
// src/operations.ts
|
|
1196
1194
|
const runtime = () => import("./runtime.js");
|
|
1197
|
-
const members = () => import("./members-
|
|
1195
|
+
const members = () => import("./members-Cr_Nlyg4.js").then((n) => n.l);
|
|
1198
1196
|
const statuses = {
|
|
1199
1197
|
WEBHOOKS_BODY_INVALID: 400,
|
|
1200
1198
|
WEBHOOKS_DATABASE_MISSING: 409,
|
|
@@ -1422,5 +1420,4 @@ const webhooksOperations = [
|
|
|
1422
1420
|
run: async (input) => endpointChange(await unwrap(async () => (await members()).enableMemberEndpoint(input.id)))
|
|
1423
1421
|
})
|
|
1424
1422
|
];
|
|
1425
|
-
//#endregion
|
|
1426
1423
|
export { webhooksOperations };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/queue-name.ts
|
|
2
2
|
/** The internal Queue that delivers every webhook. Its own module, so the Vite plugin reads it without the runtime. */
|
|
3
3
|
const webhooksQueueName = "vitehub-webhooks";
|
|
4
|
-
//#endregion
|
|
5
4
|
export { webhooksQueueName as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { t as webhooksErrors } from "./errors-
|
|
1
|
+
import { t as webhooksErrors } from "./errors-DT8uyCh7.js";
|
|
2
2
|
import { signWebhook } from "@vite-hub/env";
|
|
3
3
|
import { onRunFailed, runFailedEventNames } from "@vite-hub/runtime/internal/run-failed";
|
|
4
4
|
import { parseDuration } from "@vite-hub/runtime";
|
|
5
5
|
import { importSealKey, sealWithKey, unsealWithKey } from "@vite-hub/env/seal";
|
|
6
6
|
import { getViteHubTestMode } from "@vite-hub/runtime/internal/test-mode";
|
|
7
|
-
|
|
7
|
+
// src/define.ts
|
|
8
8
|
const definitionBrand = Symbol.for("vitehub.webhooks.definition");
|
|
9
9
|
const variableName = /^[A-Z_][A-Z0-9_]*$/i;
|
|
10
10
|
function isWebhookEvent(value) {
|
|
@@ -56,8 +56,7 @@ function defineWebhook(options) {
|
|
|
56
56
|
function isWebhookDefinition(value) {
|
|
57
57
|
return typeof value === "object" && value !== null && Reflect.get(value, definitionBrand) === true;
|
|
58
58
|
}
|
|
59
|
-
|
|
60
|
-
//#region ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
59
|
+
// ../internal/src/runtime/cloudflare-env-lookup.ts
|
|
61
60
|
/** The key of the AsyncLocalStorage store on `globalThis`. Every bundled copy of this module shares the store. */
|
|
62
61
|
const activeEnvStorageKey = Symbol.for("vitehub.cloudflare.env-storage");
|
|
63
62
|
let activeEnv;
|
|
@@ -166,8 +165,7 @@ const sealedMemberBodyPrefix = "vitehub:sealed-member-body:";
|
|
|
166
165
|
function memberBodyLabel(webhook, event) {
|
|
167
166
|
return `delivery:${JSON.stringify([webhook, event])}`;
|
|
168
167
|
}
|
|
169
|
-
|
|
170
|
-
//#region src/url-guard.ts
|
|
168
|
+
// src/url-guard.ts
|
|
171
169
|
function refuse(reason) {
|
|
172
170
|
return [webhooksErrors.WEBHOOKS_URL_REFUSED({ reason }), void 0];
|
|
173
171
|
}
|
|
@@ -306,8 +304,7 @@ async function resolveWebhookUrl(url, options = {}) {
|
|
|
306
304
|
addresses
|
|
307
305
|
}];
|
|
308
306
|
}
|
|
309
|
-
|
|
310
|
-
//#region src/runtime.ts
|
|
307
|
+
// src/runtime.ts
|
|
311
308
|
/** Attempts of one delivery before it is `dead`: one delivery and three retries, as Cloudflare Queues does by default. */
|
|
312
309
|
const webhookMaxAttempts = 4;
|
|
313
310
|
/** How long a receiver has to answer. */
|
|
@@ -914,5 +911,4 @@ async function redeliverToMember(installed, source, endpoint) {
|
|
|
914
911
|
if (wakeError) throw wakeError;
|
|
915
912
|
return result;
|
|
916
913
|
}
|
|
917
|
-
//#endregion
|
|
918
914
|
export { sealedMemberBodyPrefix as A, webhookTestEvent as C, memberBodyLabel as D, outsideHosts as E, unsealWebhooksText as M, defineWebhook as N, sealEndpoint as O, webhookMaxAttempts as S, checkWebhookUrl as T, requireMemberEndpoints as _, flushWebhookDelivery as a, testWebhook as b, installWebhooks as c, listWebhookDeliveries as d, listWebhooks as f, redeliverWebhookDelivery as g, postDelivery as h, deliverWebhookWake as i, unsealEndpoint as j, sealWebhooksText as k, installedWebhooks as l, ownsMemberEndpoint as m, createDeliveryId as n, getWebhookDelivery as o, memberWebhookPrefix as p, deliverMemberClaim as r, inspectDelivery as s, cancelWebhookDelivery as t, listPendingWebhookDeliveries as u, selectDefaultDatabase as v, webhookTimeoutMs as w, wake as x, sendDynamicWebhook as y };
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { C as webhooksErrors, S as WebhookDeliveryErrorCode, a as SendToMemberEndpointResult, x as SendWebhookErrorCode } from "./members-BjDcAAhY.js";
|
|
2
|
+
import { f as WebhookDeliveryStore, g as WebhooksDatabase, n as ListWebhookDeliveriesOptions, p as WebhookEndpointStore, r as MemberEndpoint, u as WebhookDelivery } from "./database-C5cwO1an.js";
|
|
3
3
|
import { RunFailedEvent, RunFailedEventName } from "@vite-hub/runtime/internal/run-failed";
|
|
4
4
|
import { Duration, Result } from "@vite-hub/runtime";
|
|
5
|
-
//#region src/define.d.ts
|
|
6
5
|
/** How a delivery is signed. Both use HMAC-SHA256 of the raw body with the secret. */
|
|
7
6
|
type WebhookSignature = "github" | "stripe";
|
|
8
7
|
/**
|
|
@@ -62,8 +61,6 @@ interface WebhookDefinition {
|
|
|
62
61
|
* ```
|
|
63
62
|
*/
|
|
64
63
|
declare function defineWebhook(options: WebhookOptions): WebhookDefinition;
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/sealing.d.ts
|
|
67
64
|
/** The URL and secret of a member endpoint, as the sealed text holds them. */
|
|
68
65
|
interface EndpointTarget {
|
|
69
66
|
url: string;
|
|
@@ -77,8 +74,6 @@ type KeyError = ReturnType<typeof webhooksErrors.WEBHOOKS_KEY_UNSET | typeof web
|
|
|
77
74
|
declare function sealWebhooksText(label: string, text: string, developmentKey?: string): Promise<[KeyError, undefined] | [undefined, string]>;
|
|
78
75
|
/** Opens the text that `sealWebhooksText()` sealed with the same `label`. */
|
|
79
76
|
declare function unsealWebhooksText(label: string, sealed: string, developmentKey?: string): Promise<[KeyError, undefined] | [undefined, string]>;
|
|
80
|
-
//#endregion
|
|
81
|
-
//#region src/runtime.d.ts
|
|
82
77
|
/** Attempts of one delivery before it is `dead`: one delivery and three retries, as Cloudflare Queues does by default. */
|
|
83
78
|
declare const webhookMaxAttempts = 4;
|
|
84
79
|
/** How long a receiver has to answer. */
|
|
@@ -263,5 +258,4 @@ declare function cancelWebhookDelivery(id: string): Promise<Result<WebhookDelive
|
|
|
263
258
|
* `WEBHOOKS_DELIVERY_NOT_OWNER`. It posts in the request, as `sendToMemberEndpoint()` does, and returns its status.
|
|
264
259
|
*/
|
|
265
260
|
declare function redeliverWebhookDelivery(id: string, options?: WebhookDeliveryActionOptions): Promise<Result<SendWebhookResult | SendToMemberEndpointResult, WebhookDeliveryErrorCode>>;
|
|
266
|
-
//#endregion
|
|
267
261
|
export { testWebhook as A, WebhookSignature as B, memberWebhookPrefix as C, requireMemberEndpoints as D, redeliverWebhookDelivery as E, sealWebhooksText as F, unsealWebhooksText as I, WebhookDefinition as L, webhookMaxAttempts as M, webhookTestEvent as N, selectDefaultDatabase as O, webhookTimeoutMs as P, WebhookEvent as R, listWebhooks as S, postDelivery as T, defineWebhook as V, inspectDelivery as _, SendWebhookResult as a, listPendingWebhookDeliveries as b, WebhookInfo as c, cancelWebhookDelivery as d, createDeliveryId as f, getWebhookDelivery as g, flushWebhookDelivery as h, PostResult as i, wake as j, sendDynamicWebhook as k, WebhookWake as l, deliverWebhookWake as m, InstalledWebhooks as n, WebhookDeliveryActionOptions as o, deliverMemberClaim as p, MemberCaller as r, WebhookEventBody as s, InstallWebhooksOptions as t, WebhookWakeSender as u, installWebhooks as v, ownsMemberEndpoint as w, listWebhookDeliveries as x, installedWebhooks as y, WebhookOptions as z };
|
package/dist/runtime.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { A as testWebhook, C as memberWebhookPrefix, D as requireMemberEndpoints, E as redeliverWebhookDelivery, M as webhookMaxAttempts, N as webhookTestEvent, O as selectDefaultDatabase, P as webhookTimeoutMs, S as listWebhooks, T as postDelivery, _ as inspectDelivery, a as SendWebhookResult, b as listPendingWebhookDeliveries, c as WebhookInfo, d as cancelWebhookDelivery, f as createDeliveryId, g as getWebhookDelivery, h as flushWebhookDelivery, i as PostResult, j as wake, k as sendDynamicWebhook, l as WebhookWake, m as deliverWebhookWake, n as InstalledWebhooks, o as WebhookDeliveryActionOptions, p as deliverMemberClaim, r as MemberCaller, s as WebhookEventBody, t as InstallWebhooksOptions, u as WebhookWakeSender, v as installWebhooks, w as ownsMemberEndpoint, x as listWebhookDeliveries, y as installedWebhooks } from "./runtime-
|
|
2
|
-
import { t as webhooksQueueName } from "./queue-name-
|
|
1
|
+
import { A as testWebhook, C as memberWebhookPrefix, D as requireMemberEndpoints, E as redeliverWebhookDelivery, M as webhookMaxAttempts, N as webhookTestEvent, O as selectDefaultDatabase, P as webhookTimeoutMs, S as listWebhooks, T as postDelivery, _ as inspectDelivery, a as SendWebhookResult, b as listPendingWebhookDeliveries, c as WebhookInfo, d as cancelWebhookDelivery, f as createDeliveryId, g as getWebhookDelivery, h as flushWebhookDelivery, i as PostResult, j as wake, k as sendDynamicWebhook, l as WebhookWake, m as deliverWebhookWake, n as InstalledWebhooks, o as WebhookDeliveryActionOptions, p as deliverMemberClaim, r as MemberCaller, s as WebhookEventBody, t as InstallWebhooksOptions, u as WebhookWakeSender, v as installWebhooks, w as ownsMemberEndpoint, x as listWebhookDeliveries, y as installedWebhooks } from "./runtime-BdILDcW1.js";
|
|
2
|
+
import { t as webhooksQueueName } from "./queue-name-CLdaJFPZ.js";
|
|
3
3
|
export { InstallWebhooksOptions, InstalledWebhooks, MemberCaller, PostResult, SendWebhookResult, WebhookDeliveryActionOptions, WebhookEventBody, WebhookInfo, WebhookWake, WebhookWakeSender, cancelWebhookDelivery, createDeliveryId, deliverMemberClaim, deliverWebhookWake, flushWebhookDelivery, getWebhookDelivery, inspectDelivery, installWebhooks, installedWebhooks, listPendingWebhookDeliveries, listWebhookDeliveries, listWebhooks, memberWebhookPrefix, ownsMemberEndpoint, postDelivery, redeliverWebhookDelivery, requireMemberEndpoints, selectDefaultDatabase, sendDynamicWebhook, testWebhook, wake, webhookMaxAttempts, webhookTestEvent, webhookTimeoutMs, webhooksQueueName };
|
package/dist/runtime.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { C as webhookTestEvent, S as webhookMaxAttempts, _ as requireMemberEndpoints, a as flushWebhookDelivery, b as testWebhook, c as installWebhooks, d as listWebhookDeliveries, f as listWebhooks, g as redeliverWebhookDelivery, h as postDelivery, i as deliverWebhookWake, l as installedWebhooks, m as ownsMemberEndpoint, n as createDeliveryId, o as getWebhookDelivery, p as memberWebhookPrefix, r as deliverMemberClaim, s as inspectDelivery, t as cancelWebhookDelivery, u as listPendingWebhookDeliveries, v as selectDefaultDatabase, w as webhookTimeoutMs, x as wake, y as sendDynamicWebhook } from "./runtime-
|
|
2
|
-
import { t as webhooksQueueName } from "./queue-name-
|
|
1
|
+
import { C as webhookTestEvent, S as webhookMaxAttempts, _ as requireMemberEndpoints, a as flushWebhookDelivery, b as testWebhook, c as installWebhooks, d as listWebhookDeliveries, f as listWebhooks, g as redeliverWebhookDelivery, h as postDelivery, i as deliverWebhookWake, l as installedWebhooks, m as ownsMemberEndpoint, n as createDeliveryId, o as getWebhookDelivery, p as memberWebhookPrefix, r as deliverMemberClaim, s as inspectDelivery, t as cancelWebhookDelivery, u as listPendingWebhookDeliveries, v as selectDefaultDatabase, w as webhookTimeoutMs, x as wake, y as sendDynamicWebhook } from "./runtime-BFiCJOMB.js";
|
|
2
|
+
import { t as webhooksQueueName } from "./queue-name-jmgeppja.js";
|
|
3
3
|
export { cancelWebhookDelivery, createDeliveryId, deliverMemberClaim, deliverWebhookWake, flushWebhookDelivery, getWebhookDelivery, inspectDelivery, installWebhooks, installedWebhooks, listPendingWebhookDeliveries, listWebhookDeliveries, listWebhooks, memberWebhookPrefix, ownsMemberEndpoint, postDelivery, redeliverWebhookDelivery, requireMemberEndpoints, selectDefaultDatabase, sendDynamicWebhook, testWebhook, wake, webhookMaxAttempts, webhookTestEvent, webhookTimeoutMs, webhooksQueueName };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
// src/table-names.ts
|
|
2
2
|
/**
|
|
3
3
|
* The schema keys of `webhooksSchema` and their SQL names. Its own module, so the Vite plugin lists the table without
|
|
4
4
|
* loading Drizzle during config resolution.
|
|
@@ -9,5 +9,4 @@ const webhookEndpointsTableNames = {
|
|
|
9
9
|
webhookEndpoints: "vitehub_webhook_endpoints",
|
|
10
10
|
webhookPairings: "vitehub_webhook_pairings"
|
|
11
11
|
};
|
|
12
|
-
//#endregion
|
|
13
12
|
export { webhooksTableNames as n, webhookEndpointsTableNames as t };
|
package/dist/vite.d.ts
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import { t as webhooksQueueName } from "./queue-name-
|
|
2
|
-
import { n as OperationContributions } from "./operations-
|
|
1
|
+
import { t as webhooksQueueName } from "./queue-name-CLdaJFPZ.js";
|
|
2
|
+
import { n as OperationContributions } from "./operations-8hqTi0DH.js";
|
|
3
3
|
import { Plugin } from "vite";
|
|
4
|
-
//#region ../internal/src/deployment.d.ts
|
|
5
4
|
/** The host that ViteHub builds for: the `host` option of `vitehub()` and the value of `VITEHUB_HOST`. */
|
|
6
5
|
type ViteHubHost = "cloudflare" | "deno" | "netlify" | "node" | "vercel";
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region ../internal/src/build/deployment-plan-output.d.ts
|
|
9
6
|
/**
|
|
10
7
|
* One set of host variables that the deployed app reads, as `deployment.json` lists it: a Server Env declaration, or
|
|
11
8
|
* a variable that a primitive reads itself, such as `VITEHUB_SECRET` or `BLOB_READ_WRITE_TOKEN`.
|
|
@@ -35,8 +32,6 @@ interface DeploymentEnvContext {
|
|
|
35
32
|
* Return names only, never values.
|
|
36
33
|
*/
|
|
37
34
|
type DeploymentEnvContribution = (context: DeploymentEnvContext) => readonly DeploymentEnvEntry[];
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region ../internal/src/contributions.d.ts
|
|
40
35
|
/** Roots that ViteHub passes to every contribution factory. */
|
|
41
36
|
interface ContributionContext {
|
|
42
37
|
/** Vite root. */
|
|
@@ -48,8 +43,6 @@ interface ContributionContext {
|
|
|
48
43
|
/** The flat list of Vite plugins, so a factory can read what sibling plugins declare. */
|
|
49
44
|
plugins?: readonly unknown[];
|
|
50
45
|
}
|
|
51
|
-
//#endregion
|
|
52
|
-
//#region ../internal/src/console.d.ts
|
|
53
46
|
/** Lists discovered Definitions in a sidebar and shows the selected Definition's fields. */
|
|
54
47
|
interface ViteHubConsoleDefinitionCatalogView {
|
|
55
48
|
kind: "definition-catalog";
|
|
@@ -261,16 +254,12 @@ interface ViteHubConsoleSectionDescriptor<TView extends ViteHubConsoleSectionVie
|
|
|
261
254
|
/** Pages next to the main view, in sidebar order. Only document editor sections render pages today. */
|
|
262
255
|
pages?: readonly ViteHubConsoleSectionPage[];
|
|
263
256
|
}
|
|
264
|
-
//#endregion
|
|
265
|
-
//#region src/console.d.ts
|
|
266
257
|
/**
|
|
267
258
|
* Console section for the webhooks of `server/webhooks/` and the member endpoints: each endpoint, the pending debounce
|
|
268
259
|
* timers, and the delivery log, with Send test, Send now, Cancel, Redeliver, and Disable or Enable for a member
|
|
269
260
|
* endpoint. It calls the `webhooks.*` operations with the Console user.
|
|
270
261
|
*/
|
|
271
262
|
export declare const webhooksConsoleSection: ViteHubConsoleWebhooksSection;
|
|
272
|
-
//#endregion
|
|
273
|
-
//#region src/vite.d.ts
|
|
274
263
|
export declare const WEBHOOKS_VITE_PLUGIN_NAME = "@vite-hub/webhooks/vite";
|
|
275
264
|
/** One file of `server/webhooks/`. */
|
|
276
265
|
export interface DiscoveredWebhook {
|
|
@@ -382,5 +371,4 @@ export declare function hubWebhooks(options?: HubWebhooksOptions): Plugin & {
|
|
|
382
371
|
operations: OperationContributions;
|
|
383
372
|
};
|
|
384
373
|
};
|
|
385
|
-
//#endregion
|
|
386
374
|
export { webhooksQueueName };
|
package/dist/vite.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
import { t as
|
|
3
|
-
import {
|
|
4
|
-
import { n as
|
|
1
|
+
import { n as isRecordOrFunction, t as isRecord } from "./object-CAK6UYR5.js";
|
|
2
|
+
import { t as webhooksErrors } from "./errors-DT8uyCh7.js";
|
|
3
|
+
import { t as webhooksQueueName } from "./queue-name-jmgeppja.js";
|
|
4
|
+
import { n as webhooksTableNames, t as webhookEndpointsTableNames } from "./table-names-DAUip4v2.js";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
6
6
|
import { tmpdir } from "node:os";
|
|
7
7
|
import { basename, dirname, join, parse, relative, resolve } from "node:path";
|
|
8
8
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
9
|
-
|
|
9
|
+
// ../internal/src/build/vite.ts
|
|
10
10
|
const projectRootDirectoryMarkers = [
|
|
11
11
|
["server", "agents"],
|
|
12
12
|
["server", "channels"],
|
|
@@ -79,8 +79,7 @@ function isMissingProjectMarker(error) {
|
|
|
79
79
|
const code = error.code;
|
|
80
80
|
return code === "ENOENT" || code === "ENOTDIR";
|
|
81
81
|
}
|
|
82
|
-
|
|
83
|
-
//#region ../internal/src/vite-stage.ts
|
|
82
|
+
// ../internal/src/vite-stage.ts
|
|
84
83
|
/**
|
|
85
84
|
* Vite's `loadEnv(mode, envDir, "")`: every `.env` value of the mode and the whole shell. With `DEBUG=vite:env`, Vite
|
|
86
85
|
* logs that result to stderr, secrets included. loadEnv is synchronous, so this drops only the writes of this call.
|
|
@@ -94,8 +93,7 @@ function loadAllEnv(loadEnv, mode, envDir) {
|
|
|
94
93
|
process.stderr.write = write;
|
|
95
94
|
}
|
|
96
95
|
}
|
|
97
|
-
|
|
98
|
-
//#region ../internal/src/contributions.ts
|
|
96
|
+
// ../internal/src/contributions.ts
|
|
99
97
|
function isThenable(value) {
|
|
100
98
|
return typeof value.then === "function";
|
|
101
99
|
}
|
|
@@ -122,8 +120,7 @@ async function flattenPluginOptions(plugins) {
|
|
|
122
120
|
await flattenPlugins(plugins ?? [], flattened, /* @__PURE__ */ new Set());
|
|
123
121
|
return flattened;
|
|
124
122
|
}
|
|
125
|
-
|
|
126
|
-
//#region ../internal/src/definition-catalog.ts
|
|
123
|
+
// ../internal/src/definition-catalog.ts
|
|
127
124
|
const sourceFilePattern = /\.(?:c|m)?[jt]sx?$/i;
|
|
128
125
|
const declarationFilePattern = /\.d\.(?:c|m)?[jt]sx?$/i;
|
|
129
126
|
const testFilePattern = /\.(?:test|spec)\.(?:c|m)?[jt]sx?$/i;
|
|
@@ -160,8 +157,7 @@ function createNitroServerKit(value = {}) {
|
|
|
160
157
|
}
|
|
161
158
|
};
|
|
162
159
|
}
|
|
163
|
-
|
|
164
|
-
//#region src/console.ts
|
|
160
|
+
// src/console.ts
|
|
165
161
|
/**
|
|
166
162
|
* Console section for the webhooks of `server/webhooks/` and the member endpoints: each endpoint, the pending debounce
|
|
167
163
|
* timers, and the delivery log, with Send test, Send now, Cancel, Redeliver, and Disable or Enable for a member
|
|
@@ -177,8 +173,7 @@ const webhooksConsoleSection = {
|
|
|
177
173
|
notice: "The list comes from the webhooks.* operations. The Console shows the names of the URL and secret variables and the host of each URL, never the full URL or the secret. Admins see member endpoints read-only and can disable one. Only the member who owns an endpoint can redeliver to it. `vitehub webhooks` and the webhooks MCP tools do the same."
|
|
178
174
|
}
|
|
179
175
|
};
|
|
180
|
-
|
|
181
|
-
//#region src/vite.ts
|
|
176
|
+
// src/vite.ts
|
|
182
177
|
const WEBHOOKS_VITE_PLUGIN_NAME = "@vite-hub/webhooks/vite";
|
|
183
178
|
const extensions = [
|
|
184
179
|
".ts",
|
|
@@ -467,5 +462,4 @@ function hubWebhooks(options = {}) {
|
|
|
467
462
|
} }
|
|
468
463
|
};
|
|
469
464
|
}
|
|
470
|
-
//#endregion
|
|
471
465
|
export { WEBHOOKS_VITE_PLUGIN_NAME, collectWebhooksUses, discoverWebhooks, hubWebhooks, renderWebhooksQueue, renderWebhooksRegistry, renderWebhooksTypes, usesWebhooks, webhooksConsoleSection, webhooksDevelopmentKeyFile, webhooksGeneratedFiles, webhooksQueueName };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-hub/webhooks",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "Send ViteHub events to an outside URL: signed, retried, and debounced on every host.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"debounce",
|
|
@@ -55,24 +55,24 @@
|
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
57
|
"@standard-schema/spec": "^1.1.0",
|
|
58
|
-
"@vite-hub/env": "0.5.
|
|
59
|
-
"@vite-hub/runtime": "0.5.
|
|
58
|
+
"@vite-hub/env": "0.5.1",
|
|
59
|
+
"@vite-hub/runtime": "0.5.1",
|
|
60
60
|
"valibot": "^1.5.0"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@libsql/client": "^0.18.0",
|
|
64
|
-
"@types/node": "^24.19.
|
|
64
|
+
"@types/node": "^24.19.2",
|
|
65
65
|
"@vite-hub/internal": "0.0.1",
|
|
66
|
-
"drizzle-orm": "1.0.0-rc.
|
|
66
|
+
"drizzle-orm": "1.0.0-rc.6",
|
|
67
67
|
"nitro": "^3.0.261103-rc",
|
|
68
68
|
"publint": "^0.3.25",
|
|
69
69
|
"typescript": "^6.0.3",
|
|
70
|
-
"vite": "^8.
|
|
71
|
-
"vite-plus": "^
|
|
72
|
-
"vitest": "
|
|
70
|
+
"vite": "^8.3.8",
|
|
71
|
+
"vite-plus": "^1.7.0",
|
|
72
|
+
"vitest": "5.1.0"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"drizzle-orm": "1.0.0-rc.5 || ^1.0.0",
|
|
75
|
+
"drizzle-orm": "1.0.0-rc.5 || 1.0.0-rc.6 || ^1.0.0",
|
|
76
76
|
"vite": ">=8.0.0",
|
|
77
77
|
"nitro": "3.0.261102-rc || ^3.0.261103-rc"
|
|
78
78
|
},
|