elysia 2.0.0-exp.6 → 2.0.0-exp.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/adapter/utils.d.ts +2 -2
- package/dist/adapter/utils.js +77 -75
- package/dist/adapter/utils.mjs +77 -75
- package/dist/error.d.ts +1 -1
- package/dist/type/bridge.d.ts +7 -7
- package/dist/type/coerce.d.ts +1 -1
- package/dist/type/constants.d.ts +1 -1
- package/dist/type/types.d.ts +1 -1
- package/dist/type/validator/index.d.ts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
package/dist/adapter/utils.d.ts
CHANGED
|
@@ -12,13 +12,13 @@ declare function responseToSetHeaders(response: Response, set?: Context['set']):
|
|
|
12
12
|
cookie?: Record<string, BaseCookie>;
|
|
13
13
|
} | {
|
|
14
14
|
headers: any;
|
|
15
|
-
status: number | "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "
|
|
15
|
+
status: number | "Bad Request" | "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required";
|
|
16
16
|
};
|
|
17
17
|
interface CreateHandlerParameter {
|
|
18
18
|
mapResponse(response: unknown, set: Context['set'], request?: Request): Response;
|
|
19
19
|
mapCompactResponse(response: unknown, request?: Request): Response;
|
|
20
20
|
}
|
|
21
|
-
declare
|
|
21
|
+
declare function createStreamHandler(_: CreateHandlerParameter): (generator: Generator | AsyncGenerator | ReadableStream, set?: Context["set"], request?: Request, skipFormat?: boolean) => Promise<Response>;
|
|
22
22
|
declare function streamResponse(response: Response): AsyncGenerator<any, void, any>;
|
|
23
23
|
declare function handleSet(set: Context['set']): void;
|
|
24
24
|
declare function mergeHeaders(responseHeaders: Headers, setHeaders: Context['set']['headers']): Headers;
|
package/dist/adapter/utils.js
CHANGED
|
@@ -121,90 +121,92 @@ function enqueueBinaryChunk(controller, chunk) {
|
|
|
121
121
|
}
|
|
122
122
|
return false;
|
|
123
123
|
}
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
134
|
-
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
135
|
-
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
136
|
-
const headers = set?.headers;
|
|
137
|
-
if (headers) {
|
|
138
|
-
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
139
|
-
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
140
|
-
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
141
|
-
} else set = {
|
|
142
|
-
status: 200,
|
|
143
|
-
headers: {
|
|
144
|
-
"content-type": contentType,
|
|
145
|
-
"transfer-encoding": "chunked",
|
|
146
|
-
"cache-control": "no-cache",
|
|
147
|
-
connection: "keep-alive"
|
|
124
|
+
function createStreamHandler(_) {
|
|
125
|
+
return async (generator, set, request, skipFormat) => {
|
|
126
|
+
let init = generator.next?.();
|
|
127
|
+
if (set) handleSet(set);
|
|
128
|
+
if (init instanceof Promise) init = await init;
|
|
129
|
+
if (init?.value instanceof ReadableStream) generator = init.value;
|
|
130
|
+
else if (init && (typeof init?.done === "undefined" || init?.done)) {
|
|
131
|
+
if (set) return require_adapter_web_standard_handler.mapResponse(init.value, set, request);
|
|
132
|
+
return require_adapter_web_standard_handler.mapCompactResponse(init.value, request);
|
|
148
133
|
}
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
else if (typeof init.value === "object") try {
|
|
165
|
-
controller.enqueue(format(JSON.stringify(init.value)));
|
|
166
|
-
} catch {
|
|
167
|
-
controller.enqueue(format(init.value.toString()));
|
|
134
|
+
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
135
|
+
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
136
|
+
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
137
|
+
const headers = set?.headers;
|
|
138
|
+
if (headers) {
|
|
139
|
+
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
140
|
+
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
141
|
+
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
142
|
+
} else set = {
|
|
143
|
+
status: 200,
|
|
144
|
+
headers: {
|
|
145
|
+
"content-type": contentType,
|
|
146
|
+
"transfer-encoding": "chunked",
|
|
147
|
+
"cache-control": "no-cache",
|
|
148
|
+
connection: "keep-alive"
|
|
168
149
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
try {
|
|
179
|
-
const { value: chunk, done } = await iterator.next();
|
|
180
|
-
if (done || end) {
|
|
150
|
+
};
|
|
151
|
+
const iterator = typeof generator.next === "function" ? generator : generator[Symbol.asyncIterator]();
|
|
152
|
+
let end = false;
|
|
153
|
+
return new Response(new ReadableStream({
|
|
154
|
+
start(controller) {
|
|
155
|
+
request?.signal?.addEventListener("abort", () => {
|
|
156
|
+
end = true;
|
|
157
|
+
iterator.return?.();
|
|
181
158
|
try {
|
|
182
159
|
controller.close();
|
|
183
160
|
} catch {}
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
if (
|
|
187
|
-
if (
|
|
188
|
-
else if (
|
|
189
|
-
|
|
190
|
-
controller.enqueue(format(JSON.stringify(chunk)));
|
|
161
|
+
});
|
|
162
|
+
if (!init || init.value instanceof ReadableStream || init.value === void 0 || init.value === null) return;
|
|
163
|
+
if (init.value.toSSE) controller.enqueue(init.value.toSSE());
|
|
164
|
+
else if (enqueueBinaryChunk(controller, init.value)) return;
|
|
165
|
+
else if (typeof init.value === "object") try {
|
|
166
|
+
controller.enqueue(format(JSON.stringify(init.value)));
|
|
191
167
|
} catch {
|
|
192
|
-
controller.enqueue(format(
|
|
168
|
+
controller.enqueue(format(init.value.toString()));
|
|
169
|
+
}
|
|
170
|
+
else controller.enqueue(format(init.value.toString()));
|
|
171
|
+
},
|
|
172
|
+
async pull(controller) {
|
|
173
|
+
if (end) {
|
|
174
|
+
try {
|
|
175
|
+
controller.close();
|
|
176
|
+
} catch {}
|
|
177
|
+
return;
|
|
193
178
|
}
|
|
194
|
-
else controller.enqueue(format(chunk.toString()));
|
|
195
|
-
} catch (error) {
|
|
196
|
-
console.warn(error);
|
|
197
179
|
try {
|
|
198
|
-
|
|
199
|
-
|
|
180
|
+
const { value: chunk, done } = await iterator.next();
|
|
181
|
+
if (done || end) {
|
|
182
|
+
try {
|
|
183
|
+
controller.close();
|
|
184
|
+
} catch {}
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (chunk === void 0 || chunk === null) return;
|
|
188
|
+
if (chunk.toSSE) controller.enqueue(chunk.toSSE());
|
|
189
|
+
else if (enqueueBinaryChunk(controller, chunk)) return;
|
|
190
|
+
else if (typeof chunk === "object") try {
|
|
191
|
+
controller.enqueue(format(JSON.stringify(chunk)));
|
|
192
|
+
} catch {
|
|
193
|
+
controller.enqueue(format(chunk.toString()));
|
|
194
|
+
}
|
|
195
|
+
else controller.enqueue(format(chunk.toString()));
|
|
196
|
+
} catch (error) {
|
|
197
|
+
console.warn(error);
|
|
198
|
+
try {
|
|
199
|
+
controller.close();
|
|
200
|
+
} catch {}
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
cancel() {
|
|
204
|
+
end = true;
|
|
205
|
+
iterator.return?.();
|
|
200
206
|
}
|
|
201
|
-
},
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
iterator.return?.();
|
|
205
|
-
}
|
|
206
|
-
}), set);
|
|
207
|
-
};
|
|
207
|
+
}), set);
|
|
208
|
+
};
|
|
209
|
+
}
|
|
208
210
|
async function* streamResponse(response) {
|
|
209
211
|
const body = response.body;
|
|
210
212
|
if (body) yield* body;
|
package/dist/adapter/utils.mjs
CHANGED
|
@@ -120,90 +120,92 @@ function enqueueBinaryChunk(controller, chunk) {
|
|
|
120
120
|
}
|
|
121
121
|
return false;
|
|
122
122
|
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
if (
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
133
|
-
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
134
|
-
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
135
|
-
const headers = set?.headers;
|
|
136
|
-
if (headers) {
|
|
137
|
-
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
138
|
-
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
139
|
-
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
140
|
-
} else set = {
|
|
141
|
-
status: 200,
|
|
142
|
-
headers: {
|
|
143
|
-
"content-type": contentType,
|
|
144
|
-
"transfer-encoding": "chunked",
|
|
145
|
-
"cache-control": "no-cache",
|
|
146
|
-
connection: "keep-alive"
|
|
123
|
+
function createStreamHandler(_) {
|
|
124
|
+
return async (generator, set, request, skipFormat) => {
|
|
125
|
+
let init = generator.next?.();
|
|
126
|
+
if (set) handleSet(set);
|
|
127
|
+
if (init instanceof Promise) init = await init;
|
|
128
|
+
if (init?.value instanceof ReadableStream) generator = init.value;
|
|
129
|
+
else if (init && (typeof init?.done === "undefined" || init?.done)) {
|
|
130
|
+
if (set) return mapResponse(init.value, set, request);
|
|
131
|
+
return mapCompactResponse(init.value, request);
|
|
147
132
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
else if (typeof init.value === "object") try {
|
|
164
|
-
controller.enqueue(format(JSON.stringify(init.value)));
|
|
165
|
-
} catch {
|
|
166
|
-
controller.enqueue(format(init.value.toString()));
|
|
133
|
+
const isSSE = !skipFormat && (init?.value?.sse ?? generator?.sse ?? set?.headers["content-type"]?.startsWith("text/event-stream"));
|
|
134
|
+
const format = isSSE ? (data) => `data: ${data}\n\n` : (data) => data;
|
|
135
|
+
const contentType = isSSE ? "text/event-stream" : init?.value && typeof init?.value === "object" ? ArrayBuffer.isView(init.value) ? "application/octet-stream" : "application/json" : "text/plain";
|
|
136
|
+
const headers = set?.headers;
|
|
137
|
+
if (headers) {
|
|
138
|
+
if (!headers["transfer-encoding"]) headers["transfer-encoding"] = "chunked";
|
|
139
|
+
if (!headers["content-type"]) headers["content-type"] = contentType;
|
|
140
|
+
if (!headers["cache-control"]) headers["cache-control"] = "no-cache";
|
|
141
|
+
} else set = {
|
|
142
|
+
status: 200,
|
|
143
|
+
headers: {
|
|
144
|
+
"content-type": contentType,
|
|
145
|
+
"transfer-encoding": "chunked",
|
|
146
|
+
"cache-control": "no-cache",
|
|
147
|
+
connection: "keep-alive"
|
|
167
148
|
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
}
|
|
177
|
-
try {
|
|
178
|
-
const { value: chunk, done } = await iterator.next();
|
|
179
|
-
if (done || end) {
|
|
149
|
+
};
|
|
150
|
+
const iterator = typeof generator.next === "function" ? generator : generator[Symbol.asyncIterator]();
|
|
151
|
+
let end = false;
|
|
152
|
+
return new Response(new ReadableStream({
|
|
153
|
+
start(controller) {
|
|
154
|
+
request?.signal?.addEventListener("abort", () => {
|
|
155
|
+
end = true;
|
|
156
|
+
iterator.return?.();
|
|
180
157
|
try {
|
|
181
158
|
controller.close();
|
|
182
159
|
} catch {}
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
if (
|
|
186
|
-
if (
|
|
187
|
-
else if (
|
|
188
|
-
|
|
189
|
-
controller.enqueue(format(JSON.stringify(chunk)));
|
|
160
|
+
});
|
|
161
|
+
if (!init || init.value instanceof ReadableStream || init.value === void 0 || init.value === null) return;
|
|
162
|
+
if (init.value.toSSE) controller.enqueue(init.value.toSSE());
|
|
163
|
+
else if (enqueueBinaryChunk(controller, init.value)) return;
|
|
164
|
+
else if (typeof init.value === "object") try {
|
|
165
|
+
controller.enqueue(format(JSON.stringify(init.value)));
|
|
190
166
|
} catch {
|
|
191
|
-
controller.enqueue(format(
|
|
167
|
+
controller.enqueue(format(init.value.toString()));
|
|
168
|
+
}
|
|
169
|
+
else controller.enqueue(format(init.value.toString()));
|
|
170
|
+
},
|
|
171
|
+
async pull(controller) {
|
|
172
|
+
if (end) {
|
|
173
|
+
try {
|
|
174
|
+
controller.close();
|
|
175
|
+
} catch {}
|
|
176
|
+
return;
|
|
192
177
|
}
|
|
193
|
-
else controller.enqueue(format(chunk.toString()));
|
|
194
|
-
} catch (error) {
|
|
195
|
-
console.warn(error);
|
|
196
178
|
try {
|
|
197
|
-
|
|
198
|
-
|
|
179
|
+
const { value: chunk, done } = await iterator.next();
|
|
180
|
+
if (done || end) {
|
|
181
|
+
try {
|
|
182
|
+
controller.close();
|
|
183
|
+
} catch {}
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (chunk === void 0 || chunk === null) return;
|
|
187
|
+
if (chunk.toSSE) controller.enqueue(chunk.toSSE());
|
|
188
|
+
else if (enqueueBinaryChunk(controller, chunk)) return;
|
|
189
|
+
else if (typeof chunk === "object") try {
|
|
190
|
+
controller.enqueue(format(JSON.stringify(chunk)));
|
|
191
|
+
} catch {
|
|
192
|
+
controller.enqueue(format(chunk.toString()));
|
|
193
|
+
}
|
|
194
|
+
else controller.enqueue(format(chunk.toString()));
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.warn(error);
|
|
197
|
+
try {
|
|
198
|
+
controller.close();
|
|
199
|
+
} catch {}
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
cancel() {
|
|
203
|
+
end = true;
|
|
204
|
+
iterator.return?.();
|
|
199
205
|
}
|
|
200
|
-
},
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
iterator.return?.();
|
|
204
|
-
}
|
|
205
|
-
}), set);
|
|
206
|
-
};
|
|
206
|
+
}), set);
|
|
207
|
+
};
|
|
208
|
+
}
|
|
207
209
|
async function* streamResponse(response) {
|
|
208
210
|
const body = response.body;
|
|
209
211
|
if (body) yield* body;
|
package/dist/error.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ declare class ElysiaStatus<const in out Code extends number | keyof StatusMap, T
|
|
|
85
85
|
constructor(code: Code, res: T);
|
|
86
86
|
get status(): number;
|
|
87
87
|
}
|
|
88
|
-
declare const status: <const Code extends number | keyof StatusMap, const T = (Code extends keyof StatusMapBack ? StatusMapBack[Code] : Code)>(code: Code, response?: T) => ElysiaStatus<Code, T, Code extends "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "
|
|
88
|
+
declare const status: <const Code extends number | keyof StatusMap, const T = (Code extends keyof StatusMapBack ? StatusMapBack[Code] : Code)>(code: Code, response?: T) => ElysiaStatus<Code, T, Code extends "Bad Request" | "Continue" | "Switching Protocols" | "Processing" | "Early Hints" | "OK" | "Created" | "Accepted" | "Non-Authoritative Information" | "No Content" | "Reset Content" | "Partial Content" | "Multi-Status" | "Already Reported" | "Multiple Choices" | "Moved Permanently" | "Found" | "See Other" | "Not Modified" | "Temporary Redirect" | "Permanent Redirect" | "Unauthorized" | "Payment Required" | "Forbidden" | "Not Found" | "Method Not Allowed" | "Not Acceptable" | "Proxy Authentication Required" | "Request Timeout" | "Conflict" | "Gone" | "Length Required" | "Precondition Failed" | "Payload Too Large" | "URI Too Long" | "Unsupported Media Type" | "Range Not Satisfiable" | "Expectation Failed" | "I'm a teapot" | "Enhance Your Calm" | "Misdirected Request" | "Unprocessable Content" | "Locked" | "Failed Dependency" | "Too Early" | "Upgrade Required" | "Precondition Required" | "Too Many Requests" | "Request Header Fields Too Large" | "Unavailable For Legal Reasons" | "Internal Server Error" | "Not Implemented" | "Bad Gateway" | "Service Unavailable" | "Gateway Timeout" | "HTTP Version Not Supported" | "Variant Also Negotiates" | "Insufficient Storage" | "Loop Detected" | "Not Extended" | "Network Authentication Required" ? {
|
|
89
89
|
readonly Continue: 100;
|
|
90
90
|
readonly 'Switching Protocols': 101;
|
|
91
91
|
readonly Processing: 102;
|
package/dist/type/bridge.d.ts
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Intersect as Intersect$
|
|
1
|
+
import { Intersect as Intersect$1 } from "./elysia/intersect.js";
|
|
2
2
|
import { applyCoercions as applyCoercions$1, coerceBody as coerceBody$1, coerceFormData as coerceFormData$1, coerceQuery as coerceQuery$1, coerceRoot as coerceRoot$1, coerceStringToStructure as coerceStringToStructure$1 } from "./coerce.js";
|
|
3
3
|
import { TypeBoxValidatorCache as TypeBoxValidatorCache$1 } from "./validator/validator-cache.js";
|
|
4
4
|
import { TypeBoxValidator as TypeBoxValidator$1 } from "./validator/index.js";
|
|
5
5
|
import { hasTypes as hasTypes$1 } from "./utils.js";
|
|
6
|
-
import { Compile as Compile$1 } from "typebox/compile";
|
|
7
6
|
import { Ref as Ref$1, TAny, TSchema } from "typebox/type";
|
|
8
|
-
import {
|
|
7
|
+
import { Compile as Compile$1 } from "typebox/compile";
|
|
8
|
+
import { Decode as Decode$1, Default as Default$1, HasCodec as HasCodec$1 } from "typebox/value";
|
|
9
9
|
|
|
10
10
|
//#region src/type/bridge.d.ts
|
|
11
11
|
interface TypeboxModule {
|
|
12
12
|
Compile: typeof Compile$1;
|
|
13
|
-
Decode: typeof Decode$
|
|
13
|
+
Decode: typeof Decode$1;
|
|
14
14
|
applyCoercions: typeof applyCoercions$1;
|
|
15
15
|
TypeBoxValidator: TypeBoxValidator$1;
|
|
16
16
|
TypeBoxValidatorCache: TypeBoxValidatorCache$1;
|
|
@@ -21,12 +21,12 @@ interface TypeboxModule {
|
|
|
21
21
|
coerceBody: typeof coerceBody$1;
|
|
22
22
|
hasTypes: typeof hasTypes$1;
|
|
23
23
|
HasCodec: typeof HasCodec$1;
|
|
24
|
-
Intersect: typeof Intersect$
|
|
24
|
+
Intersect: typeof Intersect$1;
|
|
25
25
|
Default: typeof Default$1;
|
|
26
26
|
Ref: typeof Ref$1;
|
|
27
27
|
}
|
|
28
28
|
declare let Compile: typeof Compile$1;
|
|
29
|
-
declare let Decode: typeof Decode$
|
|
29
|
+
declare let Decode: typeof Decode$1;
|
|
30
30
|
declare let applyCoercions: typeof applyCoercions$1;
|
|
31
31
|
declare let TypeBoxValidator: TypeBoxValidator$1;
|
|
32
32
|
type TypeBoxValidator<T extends TSchema = TAny> = TypeBoxValidator$1<T>;
|
|
@@ -39,7 +39,7 @@ declare let coerceStringToStructure: typeof coerceStringToStructure$1;
|
|
|
39
39
|
declare let coerceBody: typeof coerceBody$1;
|
|
40
40
|
declare let hasTypes: typeof hasTypes$1;
|
|
41
41
|
declare let HasCodec: typeof HasCodec$1;
|
|
42
|
-
declare let Intersect: typeof Intersect$
|
|
42
|
+
declare let Intersect: typeof Intersect$1;
|
|
43
43
|
declare let Default: typeof Default$1;
|
|
44
44
|
declare let Ref: typeof Ref$1;
|
|
45
45
|
declare function useTypebox(mod: TypeboxModule): void;
|
package/dist/type/coerce.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ declare const coerceQuery: () => CoerceOption[];
|
|
|
36
36
|
declare const coerceBody: () => CoerceOption[];
|
|
37
37
|
declare const coerceFormData: () => CoerceOption[];
|
|
38
38
|
declare const coerceStringToStructure: () => CoerceOption[];
|
|
39
|
-
declare function applyCoercions(schema: BaseSchema | TSchema, coerces: CoerceOption[] | undefined):
|
|
39
|
+
declare function applyCoercions(schema: BaseSchema | TSchema, coerces: CoerceOption[] | undefined): TSchema | BaseSchema;
|
|
40
40
|
interface CoerceLeaf {
|
|
41
41
|
e: number;
|
|
42
42
|
c?: Record<string, unknown>;
|
package/dist/type/constants.d.ts
CHANGED
|
@@ -17,7 +17,7 @@ declare const ELYSIA_TYPES: {
|
|
|
17
17
|
readonly NoValidate: 15;
|
|
18
18
|
};
|
|
19
19
|
type ELYSIA_TYPES = typeof ELYSIA_TYPES;
|
|
20
|
-
declare const primitiveElysiaTypes: Set<
|
|
20
|
+
declare const primitiveElysiaTypes: Set<2 | 1 | 3 | 6 | 10 | 11 | 13 | 14>;
|
|
21
21
|
declare const noEnumerable: {
|
|
22
22
|
readonly enumerable: false;
|
|
23
23
|
};
|
package/dist/type/types.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ELYSIA_TYPES } from "./constants.js";
|
|
2
2
|
import { CookieOptions } from "../cookie/types.js";
|
|
3
3
|
import { MaybeArray } from "../types.js";
|
|
4
|
-
import { Validator } from "typebox/schema";
|
|
5
4
|
import { TObjectOptions, TSchemaOptions } from "typebox";
|
|
6
5
|
import { TLocalizedValidationError } from "typebox/error";
|
|
6
|
+
import { Validator } from "typebox/schema";
|
|
7
7
|
|
|
8
8
|
//#region src/type/types.d.ts
|
|
9
9
|
type FileUnit = number | `${number}${'k' | 'm'}`;
|
|
@@ -2,8 +2,8 @@ import { MaybePromise } from "../../types.js";
|
|
|
2
2
|
import { TypeBoxValidatorCache } from "./validator-cache.js";
|
|
3
3
|
import { Validator as Validator$1, ValidatorOptions } from "../../validator/index.js";
|
|
4
4
|
import { Static, StaticDecode, StaticEncode, TAny, TSchema } from "typebox/type";
|
|
5
|
-
import { Validator } from "typebox/schema";
|
|
6
5
|
import { TLocalizedValidationError } from "typebox/error";
|
|
6
|
+
import { Validator } from "typebox/schema";
|
|
7
7
|
|
|
8
8
|
//#region src/type/validator/index.d.ts
|
|
9
9
|
declare function shallowMergeObjects(members: any[]): TSchema | null;
|
package/dist/types.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ import { ChainNode } from "./utils.js";
|
|
|
10
10
|
import { Context, ErrorContext, LifecycleContext, PreContext } from "./context.js";
|
|
11
11
|
import { WebSocketHandler } from "./ws/types.js";
|
|
12
12
|
import { AnyElysia, Elysia } from "./base.js";
|
|
13
|
-
import { Instruction } from "exact-mirror";
|
|
14
13
|
import { Static, StaticDecode, StaticEncode, TIntersect, TObject, TSchema } from "typebox";
|
|
14
|
+
import { Instruction } from "exact-mirror";
|
|
15
15
|
import { OpenAPIV3 } from "openapi-types";
|
|
16
16
|
|
|
17
17
|
//#region src/types.d.ts
|