revojs 0.1.14 → 0.1.16
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/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ declare function defineException<T extends Exception>(exception: T): T;
|
|
|
129
129
|
declare function useRouter(scope: Scope): RouterContext;
|
|
130
130
|
declare function useServer<T extends Context>(scope: Scope): ServerContext<T>;
|
|
131
131
|
declare function useUrl(scope: Scope, base?: string): URL;
|
|
132
|
+
declare function useHeaders(scope: Scope): Headers;
|
|
132
133
|
declare function useQuery(scope: Scope): Record<string, string>;
|
|
133
134
|
declare function useQuery<T extends Schema>(scope: Scope, schema: T): InferOutput<T>;
|
|
134
135
|
declare function withQuery(input: string, query: Record<string, string>): string;
|
|
@@ -194,4 +195,4 @@ declare const CLIENT = "client";
|
|
|
194
195
|
//#region src/client/index.d.ts
|
|
195
196
|
declare function $fetch<T>(scope: Scope, input: string | URL, options?: RequestInit): Promise<T>;
|
|
196
197
|
//#endregion
|
|
197
|
-
export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
|
198
|
+
export { $fetch, App, BuildConfig, CLIENT, Config, Context, CookieOptions, CookiePriority, CookieSameSite, Descriptor, DevelopmentConfig, Encoding, Environment, Exception, Failure, HttpMethod, InferInput, InferOutput, Issue, Mergeable, Middleware, MimeType, Module, Node, Output, PARAMETER, ParameterNode, PathNode, ROUTER_CONTEXT, Radix, ResponseConfig, Result, Route, Router, RouterContext, SERVER, SERVER_CONTEXT, STATES, Schema, Scope, Server, ServerContext, Source, States, StatusCode, StopEvent, Success, Virtual, WILDCARD, WildcardNode, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
package/dist/index.js
CHANGED
|
@@ -101,6 +101,10 @@ function useUrl(scope, base) {
|
|
|
101
101
|
const { request } = useServer(scope);
|
|
102
102
|
return new URL(request?.url ?? window?.location.href, base);
|
|
103
103
|
}
|
|
104
|
+
function useHeaders(scope) {
|
|
105
|
+
const { request } = useServer(scope);
|
|
106
|
+
return request?.headers;
|
|
107
|
+
}
|
|
104
108
|
function useQuery(scope, schema) {
|
|
105
109
|
const { searchParams } = useUrl(scope);
|
|
106
110
|
const entries = Object.fromEntries(searchParams);
|
|
@@ -416,4 +420,4 @@ async function $fetch(scope, input, options) {
|
|
|
416
420
|
}
|
|
417
421
|
|
|
418
422
|
//#endregion
|
|
419
|
-
export { $fetch, CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|
|
423
|
+
export { $fetch, CLIENT, PARAMETER, ROUTER_CONTEXT, Radix, Router, SERVER, SERVER_CONTEXT, STATES, Scope, StopEvent, WILDCARD, createApp, createServer, defineContext, defineException, defineMiddleware, defineRoute, getState, invoke, isFailure, mergeObjects, mimeType, mimeTypes, parseSchema, sendBadRequest, sendHtml, sendJson, sendRedirect, sendText, sendUnauthorized, setCookie, setState, toRoutePath, useCookies, useHeaders, useQuery, useRouter, useServer, useSetCookies, useUrl, withQuery };
|