@weft-framework/server 0.0.0-stage → 0.0.3
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/LICENSE +21 -0
- package/README.md +4 -2
- package/dist/account.d.ts +124 -0
- package/dist/account.js +344 -0
- package/dist/action.d.ts +43 -0
- package/dist/action.js +135 -0
- package/dist/admin.d.ts +99 -0
- package/dist/admin.js +431 -0
- package/dist/api.d.ts +21 -0
- package/dist/api.js +72 -0
- package/dist/app.d.ts +202 -0
- package/dist/app.js +3692 -0
- package/dist/assets.d.ts +4 -0
- package/dist/assets.js +91 -0
- package/dist/auth.d.ts +150 -0
- package/dist/auth.js +215 -0
- package/dist/backup.d.ts +46 -0
- package/dist/backup.js +345 -0
- package/dist/build.d.ts +33 -0
- package/dist/build.js +274 -0
- package/dist/bun.d.ts +30 -0
- package/dist/bun.js +53 -0
- package/dist/calendar.d.ts +161 -0
- package/dist/calendar.js +690 -0
- package/dist/compiler.d.ts +13 -0
- package/dist/compiler.js +58 -0
- package/dist/compress.d.ts +6 -0
- package/dist/compress.js +78 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.js +317 -0
- package/dist/context.d.ts +9 -0
- package/dist/context.js +1 -0
- package/dist/contract.d.ts +18 -0
- package/dist/contract.js +171 -0
- package/dist/datamap.d.ts +24 -0
- package/dist/datamap.js +365 -0
- package/dist/db-backup.d.ts +27 -0
- package/dist/db-backup.js +115 -0
- package/dist/dev-events.d.ts +14 -0
- package/dist/dev-events.js +135 -0
- package/dist/dev.d.ts +1 -0
- package/dist/dev.js +240 -0
- package/dist/devtools-client.d.ts +1 -0
- package/dist/devtools-client.js +362 -0
- package/dist/devtools.d.ts +87 -0
- package/dist/devtools.js +68 -0
- package/dist/edge.d.ts +3 -0
- package/dist/edge.js +7 -0
- package/dist/email-signin.d.ts +92 -0
- package/dist/email-signin.js +259 -0
- package/dist/env.d.ts +1 -0
- package/dist/env.js +15 -0
- package/dist/explain.d.ts +12 -0
- package/dist/explain.js +217 -0
- package/dist/files.d.ts +6 -0
- package/dist/files.js +170 -0
- package/dist/grants.d.ts +69 -0
- package/dist/grants.js +206 -0
- package/dist/image/bitmap.d.ts +11 -0
- package/dist/image/bitmap.js +172 -0
- package/dist/image/jpeg.d.ts +10 -0
- package/dist/image/jpeg.js +697 -0
- package/dist/image/png.d.ts +8 -0
- package/dist/image/png.js +282 -0
- package/dist/image/transform.d.ts +20 -0
- package/dist/image/transform.js +52 -0
- package/dist/image/worker.d.ts +1 -0
- package/dist/image/worker.js +11 -0
- package/dist/images.d.ts +39 -0
- package/dist/images.js +283 -0
- package/dist/index.d.ts +64 -0
- package/dist/index.js +31 -0
- package/dist/inspect-hub.d.ts +42 -0
- package/dist/inspect-hub.js +14 -0
- package/dist/inspector.d.ts +51 -0
- package/dist/inspector.js +193 -0
- package/dist/job-admin.d.ts +55 -0
- package/dist/job-admin.js +89 -0
- package/dist/jobs.d.ts +222 -0
- package/dist/jobs.js +789 -0
- package/dist/live.d.ts +72 -0
- package/dist/live.js +481 -0
- package/dist/load-config.d.ts +2 -0
- package/dist/load-config.js +41 -0
- package/dist/log.d.ts +20 -0
- package/dist/log.js +143 -0
- package/dist/mail.d.ts +189 -0
- package/dist/mail.js +999 -0
- package/dist/media.d.ts +129 -0
- package/dist/media.js +470 -0
- package/dist/meta.d.ts +54 -0
- package/dist/meta.js +146 -0
- package/dist/middleware.d.ts +20 -0
- package/dist/middleware.js +101 -0
- package/dist/migrate.d.ts +12 -0
- package/dist/migrate.js +88 -0
- package/dist/node.d.ts +26 -0
- package/dist/node.js +96 -0
- package/dist/notice.d.ts +21 -0
- package/dist/notice.js +48 -0
- package/dist/npm.d.ts +16 -0
- package/dist/npm.js +347 -0
- package/dist/oauth.d.ts +76 -0
- package/dist/oauth.js +408 -0
- package/dist/otel.d.ts +57 -0
- package/dist/otel.js +293 -0
- package/dist/passkey.d.ts +99 -0
- package/dist/passkey.js +572 -0
- package/dist/password.d.ts +8 -0
- package/dist/password.js +65 -0
- package/dist/pdf.d.ts +46 -0
- package/dist/pdf.js +332 -0
- package/dist/personal-data.d.ts +22 -0
- package/dist/personal-data.js +148 -0
- package/dist/pointers.d.ts +9 -0
- package/dist/pointers.js +148 -0
- package/dist/postcss.d.ts +3 -0
- package/dist/postcss.js +89 -0
- package/dist/presence.d.ts +27 -0
- package/dist/presence.js +161 -0
- package/dist/preview.d.ts +25 -0
- package/dist/preview.js +353 -0
- package/dist/production.d.ts +16 -0
- package/dist/production.js +119 -0
- package/dist/project.d.ts +23 -0
- package/dist/project.js +536 -0
- package/dist/regions.d.ts +47 -0
- package/dist/regions.js +511 -0
- package/dist/replay.d.ts +44 -0
- package/dist/replay.js +259 -0
- package/dist/router.d.ts +29 -0
- package/dist/router.js +146 -0
- package/dist/rules-diff.d.ts +18 -0
- package/dist/rules-diff.js +165 -0
- package/dist/rules-test.d.ts +17 -0
- package/dist/rules-test.js +108 -0
- package/dist/saml.d.ts +160 -0
- package/dist/saml.js +959 -0
- package/dist/seal.d.ts +35 -0
- package/dist/seal.js +107 -0
- package/dist/secret.d.ts +14 -0
- package/dist/secret.js +110 -0
- package/dist/security.d.ts +53 -0
- package/dist/security.js +250 -0
- package/dist/seed.d.ts +16 -0
- package/dist/seed.js +94 -0
- package/dist/seo.d.ts +42 -0
- package/dist/seo.js +175 -0
- package/dist/settings.d.ts +79 -0
- package/dist/settings.js +212 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.js +283 -0
- package/dist/shell.d.ts +12 -0
- package/dist/shell.js +118 -0
- package/dist/storage.d.ts +13 -0
- package/dist/storage.js +55 -0
- package/dist/support.d.ts +83 -0
- package/dist/support.js +236 -0
- package/dist/sync.d.ts +35 -0
- package/dist/sync.js +167 -0
- package/dist/tailwind.d.ts +14 -0
- package/dist/tailwind.js +117 -0
- package/dist/two-factor.d.ts +103 -0
- package/dist/two-factor.js +435 -0
- package/dist/uploads.d.ts +185 -0
- package/dist/uploads.js +991 -0
- package/dist/webhooks.d.ts +169 -0
- package/dist/webhooks.js +758 -0
- package/dist/webpush.d.ts +97 -0
- package/dist/webpush.js +372 -0
- package/dist/wizard.d.ts +141 -0
- package/dist/wizard.js +410 -0
- package/dist/workflows.d.ts +134 -0
- package/dist/workflows.js +511 -0
- package/package.json +186 -4
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { SqlDatabase } from "@weft-framework/data";
|
|
2
|
+
import { type Job, type Jobs } from "./jobs.js";
|
|
3
|
+
import { type Secret } from "./secret.js";
|
|
4
|
+
export interface WebhookEndpoint {
|
|
5
|
+
id: string;
|
|
6
|
+
owner: string;
|
|
7
|
+
url: string;
|
|
8
|
+
events: string[];
|
|
9
|
+
description: string;
|
|
10
|
+
enabled: boolean;
|
|
11
|
+
disabledReason: string | null;
|
|
12
|
+
created: number;
|
|
13
|
+
failures: number;
|
|
14
|
+
}
|
|
15
|
+
export interface WebhookMessage {
|
|
16
|
+
id: string;
|
|
17
|
+
owner: string;
|
|
18
|
+
event: string;
|
|
19
|
+
body: string;
|
|
20
|
+
created: number;
|
|
21
|
+
}
|
|
22
|
+
export interface WebhookAttempt {
|
|
23
|
+
at: number;
|
|
24
|
+
status: number | null;
|
|
25
|
+
durationMs: number;
|
|
26
|
+
error: string | null;
|
|
27
|
+
response: string;
|
|
28
|
+
}
|
|
29
|
+
export type DeliveryStatus = "pending" | "succeeded" | "failed";
|
|
30
|
+
export interface WebhookDelivery {
|
|
31
|
+
id: string;
|
|
32
|
+
owner: string;
|
|
33
|
+
message: string;
|
|
34
|
+
endpoint: string;
|
|
35
|
+
event: string;
|
|
36
|
+
status: DeliveryStatus;
|
|
37
|
+
attempts: WebhookAttempt[];
|
|
38
|
+
created: number;
|
|
39
|
+
updated: number;
|
|
40
|
+
}
|
|
41
|
+
export type WebhookKind = "endpoint" | "message" | "delivery";
|
|
42
|
+
export interface WebhookStore {
|
|
43
|
+
put(kind: WebhookKind, id: string, owner: string, ref: string | null, created: number, data: string): void | Promise<void>;
|
|
44
|
+
get(kind: WebhookKind, id: string): string | null | Promise<string | null>;
|
|
45
|
+
list(kind: WebhookKind, owner: string, o: {
|
|
46
|
+
ref?: string;
|
|
47
|
+
limit: number;
|
|
48
|
+
before?: number;
|
|
49
|
+
}): string[] | Promise<string[]>;
|
|
50
|
+
remove(kind: WebhookKind, id: string): void | Promise<void>;
|
|
51
|
+
sweep(kind: WebhookKind, before: number, owner?: string): number | Promise<number>;
|
|
52
|
+
}
|
|
53
|
+
export declare class MemoryWebhookStore implements WebhookStore {
|
|
54
|
+
#private;
|
|
55
|
+
put(kind: WebhookKind, id: string, owner: string, ref: string | null, created: number, data: string): void;
|
|
56
|
+
get(kind: WebhookKind, id: string): string | null;
|
|
57
|
+
list(kind: WebhookKind, owner: string, o: {
|
|
58
|
+
ref?: string;
|
|
59
|
+
limit: number;
|
|
60
|
+
before?: number;
|
|
61
|
+
}): string[];
|
|
62
|
+
remove(kind: WebhookKind, id: string): void;
|
|
63
|
+
sweep(kind: WebhookKind, before: number, owner?: string): number;
|
|
64
|
+
}
|
|
65
|
+
export declare class SqlWebhookStore implements WebhookStore {
|
|
66
|
+
#private;
|
|
67
|
+
constructor(db: SqlDatabase, table?: string);
|
|
68
|
+
put(kind: WebhookKind, id: string, owner: string, ref: string | null, created: number, data: string): void;
|
|
69
|
+
get(kind: WebhookKind, id: string): string | null;
|
|
70
|
+
list(kind: WebhookKind, owner: string, o: {
|
|
71
|
+
ref?: string;
|
|
72
|
+
limit: number;
|
|
73
|
+
before?: number;
|
|
74
|
+
}): string[];
|
|
75
|
+
remove(kind: WebhookKind, id: string): void;
|
|
76
|
+
sweep(kind: WebhookKind, before: number, owner?: string): number;
|
|
77
|
+
}
|
|
78
|
+
export declare function isPublicAddress(ip: string): boolean;
|
|
79
|
+
export declare class WebhookError extends Error {
|
|
80
|
+
readonly code: "invalid" | "not-found" | "limit" | "address";
|
|
81
|
+
constructor(code: WebhookError["code"], message: string);
|
|
82
|
+
}
|
|
83
|
+
export declare function signWebhook(secrets: readonly string[], id: string, timestamp: number, body: string): Promise<string>;
|
|
84
|
+
export declare function verifyWebhook(secret: string, headers: Headers | Record<string, string | undefined>, body: string, o?: {
|
|
85
|
+
toleranceSec?: number;
|
|
86
|
+
now?: number;
|
|
87
|
+
}): Promise<unknown>;
|
|
88
|
+
export interface WebhookRequest {
|
|
89
|
+
url: string;
|
|
90
|
+
headers: Record<string, string>;
|
|
91
|
+
body: string;
|
|
92
|
+
timeoutMs: number;
|
|
93
|
+
}
|
|
94
|
+
export interface WebhookResponse {
|
|
95
|
+
status: number;
|
|
96
|
+
body: string;
|
|
97
|
+
}
|
|
98
|
+
export type WebhookTransport = (req: WebhookRequest) => Promise<WebhookResponse>;
|
|
99
|
+
type Lookup = (host: string) => Promise<{
|
|
100
|
+
address: string;
|
|
101
|
+
family: number;
|
|
102
|
+
}[]>;
|
|
103
|
+
export declare function nodeTransport(o?: {
|
|
104
|
+
allowPrivateNetworks?: boolean;
|
|
105
|
+
lookup?: Lookup;
|
|
106
|
+
}): WebhookTransport;
|
|
107
|
+
export interface WebhooksOptions<E extends string> {
|
|
108
|
+
events: readonly E[];
|
|
109
|
+
key: string | Secret;
|
|
110
|
+
store?: WebhookStore;
|
|
111
|
+
jobs: () => Jobs;
|
|
112
|
+
transport?: WebhookTransport;
|
|
113
|
+
lookup?: Lookup;
|
|
114
|
+
retrySchedule?: readonly number[];
|
|
115
|
+
timeoutMs?: number;
|
|
116
|
+
disableAfter?: number;
|
|
117
|
+
maxEndpoints?: number;
|
|
118
|
+
maxBytes?: number;
|
|
119
|
+
keepMs?: number;
|
|
120
|
+
allowInsecure?: boolean;
|
|
121
|
+
allowPrivateNetworks?: boolean;
|
|
122
|
+
jobName?: string;
|
|
123
|
+
onError?(err: unknown): void;
|
|
124
|
+
now?(): number;
|
|
125
|
+
}
|
|
126
|
+
export interface EndpointInput<E extends string> {
|
|
127
|
+
url: string;
|
|
128
|
+
events: readonly (E | "*")[];
|
|
129
|
+
description?: string;
|
|
130
|
+
}
|
|
131
|
+
export declare class Webhooks<E extends string = string> {
|
|
132
|
+
#private;
|
|
133
|
+
readonly job: Job<[string]>;
|
|
134
|
+
readonly events: readonly E[];
|
|
135
|
+
constructor(o: WebhooksOptions<E>);
|
|
136
|
+
checkUrl(url: unknown): Promise<string>;
|
|
137
|
+
createEndpoint(owner: string, input: EndpointInput<E>): Promise<{
|
|
138
|
+
endpoint: WebhookEndpoint;
|
|
139
|
+
secret: string;
|
|
140
|
+
}>;
|
|
141
|
+
endpoints(owner: string): Promise<WebhookEndpoint[]>;
|
|
142
|
+
endpoint(owner: string, id: string): Promise<WebhookEndpoint | null>;
|
|
143
|
+
updateEndpoint(owner: string, id: string, patch: {
|
|
144
|
+
url?: string;
|
|
145
|
+
events?: readonly (E | "*")[];
|
|
146
|
+
description?: string;
|
|
147
|
+
enabled?: boolean;
|
|
148
|
+
}): Promise<WebhookEndpoint>;
|
|
149
|
+
revealSecret(owner: string, id: string): Promise<string>;
|
|
150
|
+
rotateSecret(owner: string, id: string, o?: {
|
|
151
|
+
keepOldMs?: number;
|
|
152
|
+
}): Promise<string>;
|
|
153
|
+
removeEndpoint(owner: string, id: string): Promise<boolean>;
|
|
154
|
+
emit(owner: string, event: E, data: unknown): Promise<string | null>;
|
|
155
|
+
deliveries(owner: string, f?: {
|
|
156
|
+
endpoint?: string;
|
|
157
|
+
status?: DeliveryStatus;
|
|
158
|
+
limit?: number;
|
|
159
|
+
before?: number;
|
|
160
|
+
}): Promise<WebhookDelivery[]>;
|
|
161
|
+
delivery(owner: string, id: string): Promise<(WebhookDelivery & {
|
|
162
|
+
body: string | null;
|
|
163
|
+
}) | null>;
|
|
164
|
+
replay(owner: string, id: string): Promise<boolean>;
|
|
165
|
+
prune(owner?: string): Promise<number>;
|
|
166
|
+
forget(owner: string): Promise<number>;
|
|
167
|
+
}
|
|
168
|
+
export declare function defineWebhooks<const E extends string>(o: WebhooksOptions<E>): Webhooks<E>;
|
|
169
|
+
export {};
|