@boon4681/giri 0.0.2 → 0.0.3-alpha-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/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { M as Middleware, C as Context, H as HandlerResponse, V as ValidatedInput, S as Services, c as StatusCode, R as ResponseFormat, T as TypedResponse, d as MiddlewareOptions, B as BodyContentType, a as GiriBodySchema, b as GiriInputSchema, i as inputSchemaBrand, e as RouteInput, f as HttpMethod, g as GiriConfig, h as GiriPaths, j as SecurityRequirement } from './types-DkrKD1S4.js';
2
- export { G as GiriAdapter, k as GiriFetchHandler, l as GiriRequest, m as GiriRouteRegistration, n as GiriServeOptions, o as GiriServer, p as GiriServerInfo, q as Handle, I as Infer, r as InferStackVars, s as InputValidationResult, J as JsonSchema, t as MergeStack, u as MiddlewareOpenApi, v as MiddlewareVarsOf, N as Next, w as RouteInputOf, x as RouteOpenApi, y as RouteOpenApiConfig, z as ValidBody, A as ValidQuery, D as VarsOf } from './types-DkrKD1S4.js';
1
+ import { M as Middleware, C as Context, H as HandlerResponse, V as ValidatedInput, S as Services, c as CookieJarFactory, d as StatusCode, R as ResponseFormat, T as TypedResponse, e as MiddlewareOptions, B as BodyContentType, a as GiriBodySchema, b as GiriInputSchema, i as inputSchemaBrand, f as RouteInput, g as HttpMethod, h as GiriConfig, j as GiriPaths, k as SecurityRequirement } from './types-BvRph0mx.js';
2
+ export { l as CookieJar, m as CookieOptions, n as CookieSink, G as GiriAdapter, o as GiriFetchHandler, p as GiriRequest, q as GiriRouteRegistration, r as GiriServeOptions, s as GiriServer, t as GiriServerInfo, u as Handle, I as Infer, v as InferStackVars, w as InputValidationResult, J as JsonSchema, x as MergeStack, y as MiddlewareOpenApi, z as MiddlewareVarsOf, N as Next, A as RouteInputOf, D as RouteOpenApi, E as RouteOpenApiConfig, F as ValidBody, K as ValidQuery, L as VarsOf } from './types-BvRph0mx.js';
3
3
 
4
4
  interface CreateContextOptions<Params extends Record<string, string> = Record<string, string>, Input extends ValidatedInput = ValidatedInput> {
5
5
  request: Request;
@@ -8,12 +8,21 @@ interface CreateContextOptions<Params extends Record<string, string> = Record<st
8
8
  app?: Services;
9
9
  /** The adapter's native per-request context, stashed for backend-specific bridges. */
10
10
  native?: unknown;
11
+ /** Secret for `c.signedCookie` / `c.req.signedCookie` (from `config.cookieSecret`). */
12
+ cookieSecret?: string;
13
+ /** The adapter's cookie jar, built from its runtime's native helpers. */
14
+ cookies?: CookieJarFactory;
11
15
  }
12
16
  declare function createTypedResponse<T, S extends StatusCode, F extends ResponseFormat>(data: T, status: S, format: F, headers?: HeadersInit): TypedResponse<T, S, F>;
13
17
  declare function isTypedResponse(value: unknown): value is TypedResponse<unknown>;
14
18
  declare function createContext<Params extends Record<string, string> = Record<string, string>, Input extends ValidatedInput = ValidatedInput>(options: CreateContextOptions<Params, Input>): Context<Params, Input>;
15
19
  declare function typedResponseToResponse(response: TypedResponse<unknown>): Response;
16
- declare function toResponse(response: HandlerResponse): Response;
20
+ /**
21
+ * Convert a handler's return value to a real `Response`, then merge any headers set imperatively via
22
+ * `c.header()` (the response's own headers win; pending ones fill the gaps). Pass the `context` so
23
+ * those imperative headers are applied; without it the response is returned unchanged.
24
+ */
25
+ declare function toResponse(response: HandlerResponse, context?: Context): Response;
17
26
  declare function composeMiddleware(middleware: Middleware[], handle: (c: Context) => HandlerResponse | Promise<HandlerResponse>, context: Context): Promise<HandlerResponse>;
18
27
  type AnyMiddleware<Vars extends Record<string, unknown>> = Middleware<Record<string, string>, ValidatedInput, Vars>;
19
28
  declare function defineMiddleware<Vars extends Record<string, unknown> = {}>(middleware: AnyMiddleware<Vars>): AnyMiddleware<Vars>;
@@ -71,6 +80,14 @@ declare function scanRoutes(routesDir: string): Promise<ScannedRoute[]>;
71
80
  interface BuildGiriAppOptions {
72
81
  cwd?: string;
73
82
  services?: Services;
83
+ /** Files that changed since last build — only these are purged from require.cache before loading. */
84
+ dirty?: Set<string>;
85
+ /** Defer route-module evaluation until the adapter first reads its runtime fields. */
86
+ lazy?: boolean;
87
+ /** The caller owns a persistent TypeScript loader for lazy route evaluation. */
88
+ loaderRegistered?: boolean;
89
+ /** The caller owns a persistent project-alias resolver for lazy route evaluation. */
90
+ aliasResolverRegistered?: boolean;
74
91
  }
75
92
  interface BuiltGiriApp<App> {
76
93
  app: App;
@@ -120,6 +137,14 @@ interface RouteSecurity {
120
137
  /** Scheme definitions to merge into `components.securitySchemes`. */
121
138
  securitySchemes: Record<string, unknown>;
122
139
  }
140
+ /** Resolved OpenAPI operation metadata (everything on `openapi` except `hidden`). */
141
+ interface RouteOpenApiMeta {
142
+ tags?: string[];
143
+ summary?: string;
144
+ description?: string;
145
+ deprecated?: boolean;
146
+ operationId?: string;
147
+ }
123
148
 
124
149
  /** The per-route metadata maps feeding `manifest.json` / `openapi.json`. */
125
150
  interface SyncData {
@@ -127,6 +152,7 @@ interface SyncData {
127
152
  inputsByFile: Map<string, RouteInputSchemas>;
128
153
  securityByFile: Map<string, RouteSecurity>;
129
154
  hiddenFiles: Set<string>;
155
+ openapiByFile: Map<string, RouteOpenApiMeta>;
130
156
  }
131
157
  interface SyncResult {
132
158
  paths: GiriPaths;
@@ -163,4 +189,4 @@ declare function runInit(lifecycle: GiriLifecycle): Promise<Services>;
163
189
 
164
190
  declare function defineConfig<App>(config: GiriConfig<App>): GiriConfig<App>;
165
191
 
166
- export { BodyContentType, Context, GiriBodySchema, GiriConfig, GiriInputSchema, type GiriLifecycle, GiriPaths, HandlerResponse, HttpMethod, Middleware, MiddlewareOptions, RouteInput, SecurityRequirement, Services, StatusCode, TypedResponse, ValidatedInput, buildGiriApp, composeMiddleware, createContext, createTypedResponse, defineBodySchema, defineConfig, defineInputSchema, defineMiddleware, isGiriBodySchema, isGiriInputSchema, isTypedResponse, loadLifecycle, prepareRequestInput, resolveGiriPaths, runInit, scanRoutes, stack, syncProject, toResponse, typedResponseToResponse };
192
+ export { BodyContentType, Context, CookieJarFactory, GiriBodySchema, GiriConfig, GiriInputSchema, type GiriLifecycle, GiriPaths, HandlerResponse, HttpMethod, Middleware, MiddlewareOptions, RouteInput, SecurityRequirement, Services, StatusCode, TypedResponse, ValidatedInput, buildGiriApp, composeMiddleware, createContext, createTypedResponse, defineBodySchema, defineConfig, defineInputSchema, defineMiddleware, isGiriBodySchema, isGiriInputSchema, isTypedResponse, loadLifecycle, prepareRequestInput, resolveGiriPaths, runInit, scanRoutes, stack, syncProject, toResponse, typedResponseToResponse };