void 0.7.5 → 0.7.7
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/{auth-DrfOTMmr.d.mts → auth-DmuALf16.d.mts} +4 -4
- package/dist/{better-auth-shared-CZsIpjey.d.mts → better-auth-shared-HXlHRw02.d.mts} +15 -15
- package/dist/cli/cli.mjs +14 -14
- package/dist/{config-BIa9HwVX.mjs → config-DqkeX_Fa.mjs} +5 -5
- package/dist/{db-RqxhOT2E.mjs → db-BnKZW1J7.mjs} +26 -22
- package/dist/{deploy-CRIz77mw.mjs → deploy-D3t53kng.mjs} +46 -16
- package/dist/{domain-CDQhvYNZ.mjs → domain-ClDdX9I1.mjs} +24 -1
- package/dist/{dotenv-DwO4ti0Z.mjs → dotenv-zdFCCgFU.mjs} +26 -26
- package/dist/{env-CnrQY2b6.mjs → env-CU97_4YK.mjs} +1 -1
- package/dist/{env-helpers-CbeM_7-k.d.mts → env-helpers-Dw95CU8e.d.mts} +4 -4
- package/dist/{env-validation-DJKjR_8q.mjs → env-validation-Bc_aiBUm.mjs} +1 -1
- package/dist/{fetch-error-DflegrF3.d.mts → fetch-error-DZ868Xq4.d.mts} +4 -4
- package/dist/{gen-C0EY2k27.mjs → gen-CpeKIqlM.mjs} +2 -2
- package/dist/{handler-dKQWyF-G.d.mts → handler-DJTuxB10.d.mts} +24 -27
- package/dist/{head-CZGAunBV.d.mts → head-C7QW7UY1.d.mts} +5 -6
- package/dist/{headers-YVkHjOyq.mjs → headers-C7Yf6_CN.mjs} +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +501 -63
- package/dist/{init-FMZ29UZW.mjs → init-CTtDfVVo.mjs} +4 -4
- package/dist/{node-DFqMcZR1.mjs → node-DHVCtkgt.mjs} +1 -1
- package/dist/pages/client.d.mts +35 -41
- package/dist/pages/head-client.d.mts +1 -1
- package/dist/pages/head.d.mts +1 -1
- package/dist/pages/head.mjs +4 -4
- package/dist/pages/index.d.mts +6 -6
- package/dist/pages/index.mjs +6 -6
- package/dist/pages/islands-plugin.d.mts +4 -13
- package/dist/pages/islands-plugin.mjs +2 -64
- package/dist/pages/prefetch.d.mts +5 -5
- package/dist/pages/protocol.d.mts +2 -2
- package/dist/pages/protocol.mjs +98 -14
- package/dist/plugin-inference-CXUuq0aC.mjs +577 -0
- package/dist/{prepare-PqAbhLte.mjs → prepare-CKzO06-Z.mjs} +4 -4
- package/dist/{preset-jKn1hQwP.mjs → preset-BhnZpb7t.mjs} +1 -1
- package/dist/{protocol-DxGzKEz2.d.mts → protocol-D7r_deVZ.d.mts} +7 -4
- package/dist/{route-types-DReF1gUY.mjs → route-types-Cnqj_8a7.mjs} +2 -2
- package/dist/runtime/ai.d.mts +33 -40
- package/dist/runtime/auth.d.mts +1 -1
- package/dist/runtime/better-auth-pg.d.mts +1 -1
- package/dist/runtime/better-auth.d.mts +1 -1
- package/dist/runtime/client.d.mts +2 -2
- package/dist/runtime/env-helpers.d.mts +1 -1
- package/dist/runtime/env-helpers.mjs +3 -3
- package/dist/runtime/env-public-client.d.mts +3 -3
- package/dist/runtime/env-public.d.mts +7 -7
- package/dist/runtime/fetch-stream.d.mts +1 -1
- package/dist/runtime/fetch.d.mts +1 -1
- package/dist/runtime/handler.d.mts +1 -1
- package/dist/runtime/handler.mjs +3 -3
- package/dist/runtime/isr.d.mts +2 -2
- package/dist/runtime/kv.d.mts +12 -12
- package/dist/runtime/live-server.d.mts +4 -4
- package/dist/runtime/live.d.mts +2 -2
- package/dist/runtime/migration-handler.d.mts +6 -6
- package/dist/runtime/seed.d.mts +4 -4
- package/dist/runtime/validator.d.mts +1 -1
- package/dist/runtime/ws-server.d.mts +8 -8
- package/dist/runtime/ws.d.mts +21 -21
- package/dist/{scan-QtRTdh94.mjs → scan-B8iEm8xn.mjs} +6 -6
- package/dist/{scan-Ba4hFwlH.mjs → scan-CWfLxtOe.mjs} +8 -8
- package/dist/{standard-schema-BfGDWXff.d.mts → standard-schema-D2qvCEYV.d.mts} +14 -14
- package/dist/sveltekit.d.mts +3 -5
- package/dist/types-DG_Ynnyd.d.mts +42 -0
- package/package.json +3 -3
- package/dist/plugin-inference-CCtRkt9O.mjs +0 -2476
- package/dist/types-AdKzPp2C.d.mts +0 -57
package/dist/runtime/ai.d.mts
CHANGED
|
@@ -11,11 +11,11 @@ type ChatContent = string | Array<{
|
|
|
11
11
|
detail?: "auto" | "low" | "high";
|
|
12
12
|
};
|
|
13
13
|
}>;
|
|
14
|
-
|
|
14
|
+
type ChatMessage = {
|
|
15
15
|
role: "system" | "user" | "assistant";
|
|
16
16
|
content: ChatContent;
|
|
17
|
-
}
|
|
18
|
-
|
|
17
|
+
};
|
|
18
|
+
type ChatCompletionInputs = {
|
|
19
19
|
messages: Array<ChatMessage>;
|
|
20
20
|
temperature?: number;
|
|
21
21
|
max_tokens?: number;
|
|
@@ -24,26 +24,26 @@ interface ChatCompletionInputs {
|
|
|
24
24
|
presence_penalty?: number;
|
|
25
25
|
stop?: string | Array<string>;
|
|
26
26
|
stream?: boolean;
|
|
27
|
-
}
|
|
28
|
-
|
|
27
|
+
};
|
|
28
|
+
type ChatCompletionResponse = {
|
|
29
29
|
id: string;
|
|
30
30
|
object: string;
|
|
31
31
|
created: number;
|
|
32
32
|
model: string;
|
|
33
33
|
choices: Array<ChatCompletionChoice>;
|
|
34
34
|
usage: ChatCompletionUsage;
|
|
35
|
-
}
|
|
36
|
-
|
|
35
|
+
};
|
|
36
|
+
type ChatCompletionChoice = {
|
|
37
37
|
index: number;
|
|
38
38
|
message: ChatMessage;
|
|
39
39
|
finish_reason: string;
|
|
40
|
-
}
|
|
41
|
-
|
|
40
|
+
};
|
|
41
|
+
type ChatCompletionUsage = {
|
|
42
42
|
prompt_tokens: number;
|
|
43
43
|
completion_tokens: number;
|
|
44
44
|
total_tokens: number;
|
|
45
|
-
}
|
|
46
|
-
|
|
45
|
+
};
|
|
46
|
+
type ChatCompletionChunk = {
|
|
47
47
|
id: string;
|
|
48
48
|
choices: Array<{
|
|
49
49
|
index: number;
|
|
@@ -53,14 +53,14 @@ interface ChatCompletionChunk {
|
|
|
53
53
|
};
|
|
54
54
|
finish_reason: string | null;
|
|
55
55
|
}>;
|
|
56
|
-
}
|
|
56
|
+
};
|
|
57
57
|
type ImageGatewayEndpoint = "images/generations" | "images/edits";
|
|
58
58
|
type ImageFileInput = Blob | ArrayBuffer | ArrayBufferView | {
|
|
59
59
|
data: string;
|
|
60
60
|
name?: string;
|
|
61
61
|
type?: string;
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
type ImageGenerationInputs = {
|
|
64
64
|
prompt: string;
|
|
65
65
|
n?: number;
|
|
66
66
|
size?: string;
|
|
@@ -68,27 +68,27 @@ interface ImageGenerationInputs {
|
|
|
68
68
|
response_format?: "url" | "b64_json";
|
|
69
69
|
user?: string;
|
|
70
70
|
[key: string]: unknown;
|
|
71
|
-
}
|
|
72
|
-
|
|
71
|
+
};
|
|
72
|
+
type ImageGenerationData = {
|
|
73
73
|
url?: string;
|
|
74
74
|
b64_json?: string;
|
|
75
75
|
revised_prompt?: string;
|
|
76
|
-
}
|
|
77
|
-
|
|
76
|
+
};
|
|
77
|
+
type ImageGenerationResponse = {
|
|
78
78
|
created?: number;
|
|
79
79
|
data: Array<ImageGenerationData>;
|
|
80
80
|
usage?: unknown;
|
|
81
81
|
[key: string]: unknown;
|
|
82
|
-
}
|
|
83
|
-
|
|
82
|
+
};
|
|
83
|
+
type ImageGenerationOptions = {
|
|
84
84
|
endpoint?: "images/generations";
|
|
85
85
|
[key: string]: unknown;
|
|
86
|
-
}
|
|
87
|
-
|
|
86
|
+
};
|
|
87
|
+
type ImageEditOptions = {
|
|
88
88
|
endpoint: "images/edits";
|
|
89
89
|
[key: string]: unknown;
|
|
90
|
-
}
|
|
91
|
-
|
|
90
|
+
};
|
|
91
|
+
type ImageEditInputs = {
|
|
92
92
|
prompt: string;
|
|
93
93
|
image: ImageFileInput | Array<ImageFileInput>;
|
|
94
94
|
mask?: ImageFileInput;
|
|
@@ -97,31 +97,24 @@ interface ImageEditInputs {
|
|
|
97
97
|
response_format?: "url" | "b64_json";
|
|
98
98
|
user?: string;
|
|
99
99
|
[key: string]: unknown;
|
|
100
|
-
}
|
|
100
|
+
};
|
|
101
101
|
//#endregion
|
|
102
102
|
//#region src/runtime/ai.d.ts
|
|
103
103
|
/**
|
|
104
|
-
* Extended AI
|
|
104
|
+
* Extended AI type with a convenience `stream()` method.
|
|
105
105
|
*
|
|
106
106
|
* `stream()` calls `ai.run()` with `stream: true` and wraps the result
|
|
107
107
|
* in a `Response` with SSE headers — ready to return from a route handler.
|
|
108
108
|
*/
|
|
109
|
-
|
|
110
|
-
/** Workers AI inference (existing) */
|
|
111
|
-
run
|
|
112
|
-
/** Third-party
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/** Third-party image generation or editing through AI Gateway. */
|
|
117
|
-
image(model: ThirdPartyModel, inputs: ImageEditInputs, options: ImageEditOptions): Promise<Response>;
|
|
118
|
-
/** Third-party image generation through AI Gateway. */
|
|
119
|
-
image(model: ThirdPartyModel, inputs: ImageGenerationInputs, options?: ImageGenerationOptions): Promise<Response>;
|
|
120
|
-
/** Stream Workers AI response as SSE */
|
|
121
|
-
stream<Name extends keyof AiModels>(model: Name, inputs: Omit<AiModels[Name]["inputs"], "stream">, options?: AiOptions): Promise<Response>;
|
|
122
|
-
/** Stream third-party chat completions as SSE */
|
|
109
|
+
type VoidAi = Omit<Ai, "run"> & {
|
|
110
|
+
/** Workers AI inference (existing) */run<Name extends keyof AiModels>(model: Name, inputs: AiModels[Name]["inputs"], options?: AiOptions): Promise<AiModels[Name]["postProcessedOutputs"]>; /** Third-party chat completions (OpenAI, Anthropic, etc.) */
|
|
111
|
+
run(model: ThirdPartyModel, inputs: ChatCompletionInputs, options?: AiOptions): Promise<ChatCompletionResponse>; /** Image generation. Returns the proxy response so callers can return or parse it. */
|
|
112
|
+
image<Name extends keyof AiModels>(model: Name, inputs: AiModels[Name]["inputs"], options?: ImageGenerationOptions): Promise<Response>; /** Third-party image generation or editing through AI Gateway. */
|
|
113
|
+
image(model: ThirdPartyModel, inputs: ImageEditInputs, options: ImageEditOptions): Promise<Response>; /** Third-party image generation through AI Gateway. */
|
|
114
|
+
image(model: ThirdPartyModel, inputs: ImageGenerationInputs, options?: ImageGenerationOptions): Promise<Response>; /** Stream Workers AI response as SSE */
|
|
115
|
+
stream<Name extends keyof AiModels>(model: Name, inputs: Omit<AiModels[Name]["inputs"], "stream">, options?: AiOptions): Promise<Response>; /** Stream third-party chat completions as SSE */
|
|
123
116
|
stream(model: ThirdPartyModel, inputs: Omit<ChatCompletionInputs, "stream">, options?: AiOptions): Promise<Response>;
|
|
124
|
-
}
|
|
117
|
+
};
|
|
125
118
|
declare const ai: VoidAi;
|
|
126
119
|
//#endregion
|
|
127
120
|
export { type ChatCompletionChoice, type ChatCompletionChunk, type ChatCompletionInputs, type ChatCompletionResponse, type ChatCompletionUsage, type ChatContent, type ChatMessage, type ImageEditInputs, type ImageEditOptions, type ImageFileInput, type ImageGatewayEndpoint, type ImageGenerationData, type ImageGenerationInputs, type ImageGenerationOptions, type ImageGenerationResponse, type ThirdPartyModel, type ThirdPartyProvider, VoidAi, ai };
|
package/dist/runtime/auth.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as VoidAuthConfigContext, c as getSession, i as VoidAuthConfig, l as getUser, n as AuthState, o as authContext, r as AuthUser, s as defineAuth, t as AuthSession, u as requireAuth } from "../auth-
|
|
1
|
+
import { a as VoidAuthConfigContext, c as getSession, i as VoidAuthConfig, l as getUser, n as AuthState, o as authContext, r as AuthUser, s as defineAuth, t as AuthSession, u as requireAuth } from "../auth-DmuALf16.mjs";
|
|
2
2
|
export { AuthSession, AuthState, AuthUser, VoidAuthConfig, VoidAuthConfigContext, authContext, defineAuth, getSession, getUser, requireAuth };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-
|
|
1
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-HXlHRw02.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/better-auth-pg.d.ts
|
|
4
4
|
declare const resolveVoidAuthOptions: VoidAuthRuntimeApi["resolveVoidAuthOptions"];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-
|
|
1
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv, r as VoidAuthRuntimeApi, t as VoidAuthDialect } from "../better-auth-shared-HXlHRw02.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/better-auth.d.ts
|
|
4
4
|
declare const resolveVoidAuthOptions: VoidAuthRuntimeApi["resolveVoidAuthOptions"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-
|
|
1
|
+
import { n as AuthState, r as AuthUser, t as AuthSession } from "../auth-DmuALf16.mjs";
|
|
2
2
|
import { auth, createAuthClient } from "./auth-client.mjs";
|
|
3
|
-
import { t as FetchError } from "../fetch-error-
|
|
3
|
+
import { t as FetchError } from "../fetch-error-DZ868Xq4.mjs";
|
|
4
4
|
import { fetch } from "./fetch.mjs";
|
|
5
5
|
import { fetchStream } from "./fetch-stream.mjs";
|
|
6
6
|
export { type AuthSession, type AuthState, type AuthUser, FetchError, FetchError as StreamError, auth, createAuthClient, fetch, fetchStream };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as getSecretOverride, c as oneOf, i as email, l as string, n as SECRET_OVERRIDE_SYMBOL, o as json, r as boolean, s as number, t as EnvSchema, u as url } from "../env-helpers-
|
|
1
|
+
import { a as getSecretOverride, c as oneOf, i as email, l as string, n as SECRET_OVERRIDE_SYMBOL, o as json, r as boolean, s as number, t as EnvSchema, u as url } from "../env-helpers-Dw95CU8e.mjs";
|
|
2
2
|
export { EnvSchema, SECRET_OVERRIDE_SYMBOL, boolean, email, getSecretOverride, json, number, oneOf, string, url };
|
|
@@ -94,12 +94,12 @@ function number() {
|
|
|
94
94
|
/** Boolean env value. Accepts "true"/"false"/"1"/"0" (case-insensitive). */
|
|
95
95
|
function boolean() {
|
|
96
96
|
return build((raw) => {
|
|
97
|
-
const
|
|
98
|
-
if (
|
|
97
|
+
const lowercased = raw.toLowerCase();
|
|
98
|
+
if (lowercased === "true" || lowercased === "1") return {
|
|
99
99
|
ok: true,
|
|
100
100
|
value: true
|
|
101
101
|
};
|
|
102
|
-
if (
|
|
102
|
+
if (lowercased === "false" || lowercased === "0") return {
|
|
103
103
|
ok: true,
|
|
104
104
|
value: false
|
|
105
105
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as oneOf, i as email, l as string, o as json, r as boolean, s as number, t as EnvSchema, u as url } from "../env-helpers-
|
|
1
|
+
import { c as oneOf, i as email, l as string, o as json, r as boolean, s as number, t as EnvSchema, u as url } from "../env-helpers-Dw95CU8e.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/runtime/env-public-client.d.ts
|
|
4
4
|
declare const env: Record<string, unknown>;
|
|
@@ -11,10 +11,10 @@ declare const env: Record<string, unknown>;
|
|
|
11
11
|
declare function defineEnv<S>(_schema: S): typeof env;
|
|
12
12
|
declare class EnvValidationError extends Error {
|
|
13
13
|
readonly key: string;
|
|
14
|
-
readonly issues:
|
|
14
|
+
readonly issues: Array<{
|
|
15
15
|
message: string;
|
|
16
16
|
}>;
|
|
17
|
-
constructor(key: string, issues:
|
|
17
|
+
constructor(key: string, issues: Array<{
|
|
18
18
|
message: string;
|
|
19
19
|
}>);
|
|
20
20
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { t as StandardSchemaV1 } from "../standard-schema-
|
|
3
|
-
import { c as oneOf, i as email, l as string, o as json, r as boolean, s as number, t as EnvSchema, u as url } from "../env-helpers-
|
|
2
|
+
import { t as StandardSchemaV1 } from "../standard-schema-D2qvCEYV.mjs";
|
|
3
|
+
import { c as oneOf, i as email, l as string, o as json, r as boolean, s as number, t as EnvSchema, u as url } from "../env-helpers-Dw95CU8e.mjs";
|
|
4
4
|
import * as _$_cloudflare_sandbox0 from "@cloudflare/sandbox";
|
|
5
5
|
|
|
6
6
|
//#region src/runtime/env-public.d.ts
|
|
7
|
-
|
|
7
|
+
type AnyValidator = StandardSchemaV1<unknown, unknown>;
|
|
8
8
|
type AnySchema = Record<string, AnyValidator>;
|
|
9
9
|
/**
|
|
10
10
|
* Type-only stub for the validated env shape. Augmented by the generated
|
|
@@ -74,8 +74,8 @@ declare function _hasRegisteredSchema(): boolean;
|
|
|
74
74
|
declare function _getSchemaDefaults(): Record<string, string>;
|
|
75
75
|
declare class EnvValidationError extends Error {
|
|
76
76
|
readonly key: string;
|
|
77
|
-
readonly issues:
|
|
78
|
-
constructor(key: string, issues:
|
|
77
|
+
readonly issues: Array<StandardSchemaV1.Issue>;
|
|
78
|
+
constructor(key: string, issues: Array<StandardSchemaV1.Issue>);
|
|
79
79
|
}
|
|
80
80
|
/**
|
|
81
81
|
* Typed env proxy. Reads from the runtime env, validating declared keys
|
|
@@ -90,7 +90,7 @@ declare class EnvValidationError extends Error {
|
|
|
90
90
|
*/
|
|
91
91
|
declare const env: ValidatedEnv;
|
|
92
92
|
/** Aggregate report from validating an entire env object against the schema. */
|
|
93
|
-
|
|
93
|
+
type EnvValidationReport = {
|
|
94
94
|
valid: boolean;
|
|
95
95
|
missing: Array<string>;
|
|
96
96
|
invalid: Array<{
|
|
@@ -103,7 +103,7 @@ interface EnvValidationReport {
|
|
|
103
103
|
* cache.
|
|
104
104
|
*/
|
|
105
105
|
values: Map<string, unknown>;
|
|
106
|
-
}
|
|
106
|
+
};
|
|
107
107
|
/**
|
|
108
108
|
* Validate an env record (e.g. merged `.env*` + remote secret list) against
|
|
109
109
|
* the registered schema. Used by the dev plugin (warnings), the deploy CLI
|
package/dist/runtime/fetch.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { C as HandlerInput, S as ValidationError, _ as defineScheduled, a as QueueBatch, b as InferProps, c as RenderAssetTags, d as VoidAssetRewriteError, f as defineHandler, g as defineRender, h as defineQueue, i as CloudEnv, l as TypedHandler, m as defineMiddleware, n as CloudContext, o as QueueMessage, p as defineHead, r as CloudContextVariables, s as QueueRetryOptions, t as CloudBindings, u as TypedQueueHandler, v as Deferred, w as ValidatorSlots, x as defer } from "../handler-
|
|
2
|
+
import { C as HandlerInput, S as ValidationError, _ as defineScheduled, a as QueueBatch, b as InferProps, c as RenderAssetTags, d as VoidAssetRewriteError, f as defineHandler, g as defineRender, h as defineQueue, i as CloudEnv, l as TypedHandler, m as defineMiddleware, n as CloudContext, o as QueueMessage, p as defineHead, r as CloudContextVariables, s as QueueRetryOptions, t as CloudBindings, u as TypedQueueHandler, v as Deferred, w as ValidatorSlots, x as defer } from "../handler-DJTuxB10.mjs";
|
|
3
3
|
export { CloudBindings, CloudContext, CloudContextVariables, CloudEnv, Deferred, HandlerInput, InferProps, QueueBatch, QueueMessage, QueueRetryOptions, RenderAssetTags, TypedHandler, TypedQueueHandler, ValidationError, ValidatorSlots, VoidAssetRewriteError, defer, defineHandler, defineHead, defineMiddleware, defineQueue, defineRender, defineScheduled };
|
package/dist/runtime/handler.mjs
CHANGED
|
@@ -25,9 +25,9 @@ function defineHandler(...args) {
|
|
|
25
25
|
let index = 0;
|
|
26
26
|
const dispatch = async () => {
|
|
27
27
|
if (index < middlewares.length) {
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
28
|
+
const middleware = middlewares[index++];
|
|
29
|
+
const middlewareResponse = await middleware(c, dispatch);
|
|
30
|
+
if (middlewareResponse instanceof Response) c.res = middlewareResponse;
|
|
31
31
|
} else c.res = convertReturnValue(await handler(c));
|
|
32
32
|
};
|
|
33
33
|
await dispatch();
|
package/dist/runtime/isr.d.mts
CHANGED
package/dist/runtime/kv.d.mts
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
//#region src/runtime/kv.d.ts
|
|
2
|
-
|
|
2
|
+
type PutOptions = {
|
|
3
3
|
ttl?: number;
|
|
4
4
|
expiration?: number;
|
|
5
5
|
metadata?: Record<string, unknown>;
|
|
6
|
-
}
|
|
7
|
-
|
|
6
|
+
};
|
|
7
|
+
type ListOptions = {
|
|
8
8
|
prefix?: string;
|
|
9
9
|
limit?: number;
|
|
10
10
|
cursor?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
11
|
+
};
|
|
12
|
+
type ListKey<M = unknown> = {
|
|
13
13
|
name: string;
|
|
14
14
|
expiration?: number;
|
|
15
15
|
metadata?: M;
|
|
16
|
-
}
|
|
17
|
-
|
|
16
|
+
};
|
|
17
|
+
type ListResult<M = unknown> = {
|
|
18
18
|
keys: Array<ListKey<M>>;
|
|
19
19
|
list_complete: boolean;
|
|
20
20
|
cursor?: string;
|
|
21
|
-
}
|
|
22
|
-
|
|
21
|
+
};
|
|
22
|
+
type KVMap<T> = {
|
|
23
23
|
get(key: string): Promise<T | null>;
|
|
24
24
|
put(key: string, value: T, options?: PutOptions): Promise<void>;
|
|
25
25
|
delete(key: string): Promise<void>;
|
|
@@ -28,8 +28,8 @@ interface KVMap<T> {
|
|
|
28
28
|
value: T | null;
|
|
29
29
|
metadata: M | null;
|
|
30
30
|
}>;
|
|
31
|
-
}
|
|
32
|
-
|
|
31
|
+
};
|
|
32
|
+
type KVClient = {
|
|
33
33
|
get<T = string>(key: string): Promise<T | null>;
|
|
34
34
|
put(key: string, value: unknown, options?: PutOptions): Promise<void>;
|
|
35
35
|
delete(key: string): Promise<void>;
|
|
@@ -39,7 +39,7 @@ interface KVClient {
|
|
|
39
39
|
metadata: M | null;
|
|
40
40
|
}>;
|
|
41
41
|
map<T = unknown>(prefix: string): KVMap<T>;
|
|
42
|
-
}
|
|
42
|
+
};
|
|
43
43
|
/** Create a KV client for a specific KVNamespace instance. */
|
|
44
44
|
declare function createKV(namespace: KVNamespace): KVClient;
|
|
45
45
|
/** Default KV client — resolves `KV` from the active runtime environment. */
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
2
|
//#region src/runtime/live-server.d.ts
|
|
3
3
|
type LiveDurableObjectEnv = Record<string, unknown>;
|
|
4
|
-
|
|
4
|
+
type LiveDurableObjectInstance = {
|
|
5
5
|
fetch(request: Request): Promise<Response>;
|
|
6
6
|
alarm?(): Promise<void>;
|
|
7
|
-
}
|
|
8
|
-
|
|
7
|
+
};
|
|
8
|
+
type LiveDurableObjectClass = {
|
|
9
9
|
new (state: DurableObjectState, env: LiveDurableObjectEnv): LiveDurableObjectInstance;
|
|
10
|
-
}
|
|
10
|
+
};
|
|
11
11
|
declare function createLiveDurableObject(): LiveDurableObjectClass;
|
|
12
12
|
//#endregion
|
|
13
13
|
export { LiveDurableObjectClass, LiveDurableObjectInstance, createLiveDurableObject };
|
package/dist/runtime/live.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="@cloudflare/workers-types" />
|
|
2
|
-
import { r as AuthUser } from "../auth-
|
|
3
|
-
import { i as CloudEnv, n as CloudContext } from "../handler-
|
|
2
|
+
import { r as AuthUser } from "../auth-DmuALf16.mjs";
|
|
3
|
+
import { i as CloudEnv, n as CloudContext } from "../handler-DJTuxB10.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/runtime/live.d.ts
|
|
6
6
|
type MaybePromise<T> = T | Promise<T>;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
//#region src/runtime/migration-handler.d.ts
|
|
2
|
-
|
|
2
|
+
type MigrationEntry = {
|
|
3
3
|
name: string;
|
|
4
4
|
sql: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
5
|
+
};
|
|
6
|
+
type MigrationResult = {
|
|
7
7
|
name: string;
|
|
8
8
|
applied: boolean;
|
|
9
9
|
durationMs: number;
|
|
10
10
|
error?: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
11
|
+
};
|
|
12
|
+
type MigrationResponse = {
|
|
13
13
|
ok: boolean;
|
|
14
14
|
migrations: Array<MigrationResult>;
|
|
15
15
|
error?: string;
|
|
16
|
-
}
|
|
16
|
+
};
|
|
17
17
|
declare function createMigrationHandler(env: Record<string, unknown>, migrations: Array<MigrationEntry> | undefined, _dialect: "sqlite" | "postgresql", runAuthMigrations?: () => Promise<void>): (request: Request) => Promise<Response>;
|
|
18
18
|
//#endregion
|
|
19
19
|
export { MigrationEntry, MigrationResponse, MigrationResult, createMigrationHandler };
|
package/dist/runtime/seed.d.mts
CHANGED
|
@@ -2,16 +2,16 @@ import { NodePgDatabase } from "drizzle-orm/node-postgres";
|
|
|
2
2
|
import { BetterSQLite3Database } from "drizzle-orm/better-sqlite3";
|
|
3
3
|
|
|
4
4
|
//#region src/runtime/seed.d.ts
|
|
5
|
-
|
|
5
|
+
type SqliteSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
6
6
|
dialect: "sqlite";
|
|
7
7
|
db: BetterSQLite3Database<TSchema>;
|
|
8
8
|
schema: TSchema;
|
|
9
|
-
}
|
|
10
|
-
|
|
9
|
+
};
|
|
10
|
+
type PostgresSeedContext<TSchema extends Record<string, unknown> = Record<string, never>> = {
|
|
11
11
|
dialect: "postgresql";
|
|
12
12
|
db: NodePgDatabase<TSchema>;
|
|
13
13
|
schema: TSchema;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
type DrizzleTableForDialect<TDialect extends string> = {
|
|
16
16
|
readonly _: {
|
|
17
17
|
readonly config: {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { C as HandlerInput, T as runValidation, w as ValidatorSlots } from "../handler-
|
|
1
|
+
import { C as HandlerInput, T as runValidation, w as ValidatorSlots } from "../handler-DJTuxB10.mjs";
|
|
2
2
|
export { HandlerInput, ValidatorSlots, runValidation };
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { n as AuthState } from "../auth-
|
|
2
|
-
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-
|
|
1
|
+
import { n as AuthState } from "../auth-DmuALf16.mjs";
|
|
2
|
+
import { i as VoidAuthRuntimeOptions, n as VoidAuthEnv } from "../better-auth-shared-HXlHRw02.mjs";
|
|
3
3
|
import { AnyWebSocketDefinition } from "./ws.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/runtime/ws-server.d.ts
|
|
6
|
-
|
|
6
|
+
type WebSocketRouteMeta = {
|
|
7
7
|
pattern: string;
|
|
8
8
|
params: Array<string>;
|
|
9
9
|
className: string;
|
|
10
10
|
bindingName: string;
|
|
11
|
-
}
|
|
12
|
-
|
|
11
|
+
};
|
|
12
|
+
type WebSocketDurableObjectInstance = {
|
|
13
13
|
fetch(request: Request): Promise<Response>;
|
|
14
14
|
webSocketMessage(webSocket: WebSocket, message: string | ArrayBuffer | ArrayBufferView): Promise<void>;
|
|
15
15
|
webSocketClose(webSocket: WebSocket, code: number, reason: string, wasClean: boolean): Promise<void>;
|
|
16
|
-
}
|
|
17
|
-
|
|
16
|
+
};
|
|
17
|
+
type WebSocketDurableObjectClass = {
|
|
18
18
|
new (state: DurableObjectState, env: Record<string, unknown>): WebSocketDurableObjectInstance;
|
|
19
|
-
}
|
|
19
|
+
};
|
|
20
20
|
type ResolveVoidAuthState = (request: Request, env: VoidAuthEnv, runtime: VoidAuthRuntimeOptions) => Promise<AuthState | null>;
|
|
21
21
|
declare function buildWebSocketInstanceId(route: Pick<WebSocketRouteMeta, "params">, params: Record<string, string>): string;
|
|
22
22
|
declare function createWebSocketDurableObject(definition: AnyWebSocketDefinition, route: WebSocketRouteMeta, authRuntime?: VoidAuthRuntimeOptions, resolveAuthState?: ResolveVoidAuthState): WebSocketDurableObjectClass;
|
package/dist/runtime/ws.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { r as AuthUser } from "../auth-
|
|
2
|
-
import { t as StandardSchemaV1 } from "../standard-schema-
|
|
3
|
-
import { i as CloudEnv } from "../handler-
|
|
1
|
+
import { r as AuthUser } from "../auth-DmuALf16.mjs";
|
|
2
|
+
import { t as StandardSchemaV1 } from "../standard-schema-D2qvCEYV.mjs";
|
|
3
|
+
import { i as CloudEnv } from "../handler-DJTuxB10.mjs";
|
|
4
4
|
import { WebSocketRouteMap } from "void/routes";
|
|
5
5
|
|
|
6
6
|
//#region src/runtime/ws.d.ts
|
|
@@ -17,34 +17,34 @@ type ServerEventOf<P extends keyof WebSocketRouteMap> = WsEntry<P> extends {
|
|
|
17
17
|
server: infer T;
|
|
18
18
|
} ? T : never;
|
|
19
19
|
type HasParams<P extends keyof WebSocketRouteMap> = ParamsOf<P> extends Record<string, never> ? false : [keyof ParamsOf<P>] extends [never] ? false : true;
|
|
20
|
-
|
|
20
|
+
type WebSocketConnection<ServerEvent = unknown> = {
|
|
21
21
|
readonly id: string;
|
|
22
22
|
readonly state: unknown;
|
|
23
23
|
send(event: ServerEvent): Promise<void>;
|
|
24
24
|
close(code?: number, reason?: string): void;
|
|
25
25
|
setState(data: unknown): void;
|
|
26
|
-
}
|
|
27
|
-
|
|
26
|
+
};
|
|
27
|
+
type RoomController<ServerEvent = unknown> = {
|
|
28
28
|
broadcast(event: ServerEvent, excludeIds?: Array<string>): Promise<void>;
|
|
29
29
|
getConnections(): Iterable<WebSocketConnection<ServerEvent>>;
|
|
30
30
|
getConnection(id: string): WebSocketConnection<ServerEvent> | undefined;
|
|
31
|
-
}
|
|
32
|
-
|
|
31
|
+
};
|
|
32
|
+
type WebSocketBaseContext = {
|
|
33
33
|
readonly id: string;
|
|
34
34
|
readonly params: ParamsRecord;
|
|
35
35
|
readonly user: AuthUser | null;
|
|
36
36
|
readonly request: Request;
|
|
37
37
|
readonly env: CloudEnv["Bindings"];
|
|
38
38
|
readonly storage: DurableObjectStorage;
|
|
39
|
-
}
|
|
40
|
-
|
|
39
|
+
};
|
|
40
|
+
type RoomContext<ServerEvent = unknown> = WebSocketBaseContext & {
|
|
41
41
|
readonly room: RoomController<ServerEvent>;
|
|
42
42
|
readonly connection: WebSocketConnection<ServerEvent>;
|
|
43
|
-
}
|
|
44
|
-
|
|
43
|
+
};
|
|
44
|
+
type SocketContext<ServerEvent = unknown> = WebSocketBaseContext & {
|
|
45
45
|
readonly socket: WebSocketConnection<ServerEvent>;
|
|
46
|
-
}
|
|
47
|
-
|
|
46
|
+
};
|
|
47
|
+
type RoomDefinition<ClientSchema extends StandardSchemaV1 = StandardSchemaV1, ServerSchema extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
48
48
|
readonly __kind: "room";
|
|
49
49
|
readonly messages: {
|
|
50
50
|
client: ClientSchema;
|
|
@@ -59,8 +59,8 @@ interface RoomDefinition<ClientSchema extends StandardSchemaV1 = StandardSchemaV
|
|
|
59
59
|
wasClean: boolean;
|
|
60
60
|
}) => MaybePromise<void>;
|
|
61
61
|
onRequest?: (ctx: RoomContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<Response>;
|
|
62
|
-
}
|
|
63
|
-
|
|
62
|
+
};
|
|
63
|
+
type SocketDefinition<ClientSchema extends StandardSchemaV1 = StandardSchemaV1, ServerSchema extends StandardSchemaV1 = StandardSchemaV1> = {
|
|
64
64
|
readonly __kind: "socket";
|
|
65
65
|
readonly messages: {
|
|
66
66
|
client: ClientSchema;
|
|
@@ -75,22 +75,22 @@ interface SocketDefinition<ClientSchema extends StandardSchemaV1 = StandardSchem
|
|
|
75
75
|
wasClean: boolean;
|
|
76
76
|
}) => MaybePromise<void>;
|
|
77
77
|
onRequest?: (ctx: SocketContext<StandardSchemaV1.InferInput<ServerSchema>>) => MaybePromise<Response>;
|
|
78
|
-
}
|
|
78
|
+
};
|
|
79
79
|
type AnyWebSocketDefinition = RoomDefinition | SocketDefinition;
|
|
80
80
|
declare function defineRoom<ClientSchema extends StandardSchemaV1, ServerSchema extends StandardSchemaV1>(definition: Omit<RoomDefinition<ClientSchema, ServerSchema>, "__kind">): RoomDefinition<ClientSchema, ServerSchema>;
|
|
81
81
|
declare function defineWebSocket<ClientSchema extends StandardSchemaV1, ServerSchema extends StandardSchemaV1>(definition: Omit<SocketDefinition<ClientSchema, ServerSchema>, "__kind">): SocketDefinition<ClientSchema, ServerSchema>;
|
|
82
|
-
|
|
82
|
+
type VoidSocketCloseEvent = {
|
|
83
83
|
code?: number;
|
|
84
84
|
reason?: string;
|
|
85
85
|
wasClean?: boolean;
|
|
86
|
-
}
|
|
87
|
-
|
|
86
|
+
};
|
|
87
|
+
type ConnectCommonOptions = {
|
|
88
88
|
baseURL?: string;
|
|
89
89
|
reconnect?: boolean;
|
|
90
90
|
reconnectDelayMs?: number;
|
|
91
91
|
maxReconnectAttempts?: number;
|
|
92
92
|
protocols?: string | Array<string>;
|
|
93
|
-
}
|
|
93
|
+
};
|
|
94
94
|
type ConnectOptions<P extends keyof WebSocketRouteMap> = ConnectCommonOptions & (HasParams<P> extends true ? {
|
|
95
95
|
params: ParamsOf<P>;
|
|
96
96
|
} : {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as join, t as basename } from "./pathe.M-eThtNZ-D-kmWkCS.mjs";
|
|
2
2
|
import { n as globSync, t as glob } from "./dist-DUyXJLkq.mjs";
|
|
3
|
-
import { d as isCallExpression, f as isIdentifier, h as isObjectExpression, p as isLiteral } from "./plugin-inference-
|
|
4
|
-
import { o as parseRouteFilename, s as parseWebSocketFilename, t as scanPages } from "./scan-
|
|
3
|
+
import { d as isCallExpression, f as isIdentifier, h as isObjectExpression, p as isLiteral } from "./plugin-inference-CXUuq0aC.mjs";
|
|
4
|
+
import { o as parseRouteFilename, s as parseWebSocketFilename, t as scanPages } from "./scan-CWfLxtOe.mjs";
|
|
5
5
|
import { readFileSync } from "node:fs";
|
|
6
6
|
import { parseSync } from "vite";
|
|
7
7
|
//#region src/crons/scan.ts
|
|
@@ -32,7 +32,7 @@ function extractCronExpressions(source, filePath) {
|
|
|
32
32
|
throw new Error(`cron: Invalid job file '${filePath}'. Add \`export const cron = "<schedule>"\`.`);
|
|
33
33
|
}
|
|
34
34
|
function parseJobFiles(root, jobsDir, files) {
|
|
35
|
-
return files.filter((
|
|
35
|
+
return files.filter((filePath) => !filePath.split("/").some((segment) => segment.startsWith("_"))).sort((leftFilePath, rightFilePath) => leftFilePath.localeCompare(rightFilePath)).map((filePath) => {
|
|
36
36
|
const source = readFileSync(join(root, jobsDir, filePath), "utf-8");
|
|
37
37
|
return {
|
|
38
38
|
filePath,
|
|
@@ -75,12 +75,12 @@ function deriveBindingName(name) {
|
|
|
75
75
|
return "QUEUE_" + name.toUpperCase().replace(/[^A-Z0-9]/g, "_");
|
|
76
76
|
}
|
|
77
77
|
function extractConsumerOption(source, name) {
|
|
78
|
-
const
|
|
79
|
-
const match = source.match(
|
|
78
|
+
const optionRe = new RegExp(`export\\s+const\\s+${name}\\s*=\\s*(\\d+)`);
|
|
79
|
+
const match = source.match(optionRe);
|
|
80
80
|
return match ? Number(match[1]) : void 0;
|
|
81
81
|
}
|
|
82
82
|
function parseQueueFiles(root, queuesDir, files) {
|
|
83
|
-
return files.filter((
|
|
83
|
+
return files.filter((filePath) => !filePath.split("/").some((segment) => segment.startsWith("_"))).sort((leftFilePath, rightFilePath) => leftFilePath.localeCompare(rightFilePath)).map((filePath) => {
|
|
84
84
|
const source = readFileSync(join(root, queuesDir, filePath), "utf-8");
|
|
85
85
|
const name = extractName(filePath);
|
|
86
86
|
return {
|