@lunora/server 1.0.0-alpha.207 → 1.0.0-alpha.209

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.mts CHANGED
@@ -2026,8 +2026,11 @@ interface HttpRouteBuilder<SearchParams extends ArgsValidator, Body extends Args
2026
2026
  * handler's yielded type — unless `.output()` was declared, in which case each
2027
2027
  * chunk must be that type and is parsed through the validator before the frame
2028
2028
  * is written (a violation ends the stream with an `event: error` frame).
2029
+ *
2030
+ * A handler may yield a plain `R` (unchanged) or {@link sseEvent}, which
2031
+ * wraps one chunk so the pump emits an `id:` line ahead of its `data:`.
2029
2032
  */
2030
- stream: [Output] extends [undefined] ? <R>(handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<R, void, void> | AsyncIterable<R>) => LunoraRouteHandler : (handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<Output, void, void> | AsyncIterable<Output>) => LunoraRouteHandler;
2033
+ stream: [Output] extends [undefined] ? <R>(handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<R | SseEvent<R>, void, void> | AsyncIterable<R | SseEvent<R>>) => LunoraRouteHandler : (handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<Output | SseEvent<Output>, void, void> | AsyncIterable<Output | SseEvent<Output>>) => LunoraRouteHandler;
2031
2034
  /**
2032
2035
  * Attach a `Vary` header to the response so Cloudflare stores separate
2033
2036
  * cached variants per distinct value of the listed request headers.
@@ -2046,6 +2049,49 @@ interface HttpRoute {
2046
2049
  post: HttpRouteFactory;
2047
2050
  put: HttpRouteFactory;
2048
2051
  }
2052
+ /**
2053
+ * Read the SSE resume position off a request: the `Last-Event-ID` header a
2054
+ * browser `EventSource` replays automatically on reconnect, falling back to a
2055
+ * `lastEventId` query parameter for clients that cannot set that header.
2056
+ * The query fallback applies only when the header is absent. A present but empty
2057
+ * header is a cleared position (the server emitted an empty `id:`), so it returns
2058
+ * `undefined` rather than resurrecting a stale query value. Returns `undefined`
2059
+ * when there is no resume position, so a handler can treat it the same as
2060
+ * "resume from the beginning".
2061
+ *
2062
+ * The handler decides what to replay — the framework only surfaces the value.
2063
+ */
2064
+ declare const lastEventId: (request: Request) => string | undefined;
2065
+ /**
2066
+ * The public shape {@link sseEvent} returns and a `.stream()` handler yields to
2067
+ * attach an SSE `id:` to one chunk. Structural on purpose: the runtime brand
2068
+ * that makes it unambiguous stays internal.
2069
+ */
2070
+ interface SseEvent<R> {
2071
+ readonly data: R;
2072
+ readonly id: string;
2073
+ }
2074
+ /**
2075
+ * Wrap a chunk so the SSE pump emits `id: <id>` immediately before its `data:`
2076
+ * line:
2077
+ *
2078
+ * ```ts
2079
+ * httpRoute.get("/api/logs").stream(async function* logs() {
2080
+ * for await (const entry of tail()) {
2081
+ * yield sseEvent({ data: entry, id: entry.seq });
2082
+ * }
2083
+ * });
2084
+ * ```
2085
+ *
2086
+ * `data` goes through the same wire codec and per-chunk `.output()` enforcement
2087
+ * as a plain yield; the wrapper is transport, not part of the user's contract.
2088
+ */
2089
+ declare const sseEvent: <R>(frame: {
2090
+ data: R;
2091
+ id: string;
2092
+ }) => SseEvent<R>;
2093
+ /** A header or SSE field value that cannot break out of its line. */
2094
+ declare const isSafeHeaderValue: (value: string) => boolean;
2049
2095
  /**
2050
2096
  * Typed REST route builder. Compiles down to a {@link LunoraRouteHandler}, so a
2051
2097
  * typed route and a hand-written {@link httpAction} are interchangeable when
@@ -2069,15 +2115,6 @@ interface HttpRoute {
2069
2115
  * ```
2070
2116
  */
2071
2117
  declare const httpRoute: HttpRoute;
2072
- /**
2073
- * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
2074
- * NUL. Guards against response-header injection / `Headers`-construction throws
2075
- * when reflecting attacker-influenced object metadata (e.g. a stored
2076
- * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
2077
- * handler can guard a request-derived header value before writing it — the fix the
2078
- * `http_action_response_header_injection` advisor lint points to.
2079
- */
2080
- declare const isSafeHeaderValue: (value: string) => boolean;
2081
2118
  /**
2082
2119
  * Structural view of an R2 object body, as returned by `@lunora/storage`'s
2083
2120
  * `download()`. Re-declared here (not imported) so `@lunora/server` takes no
@@ -3979,4 +4016,58 @@ type RegisteredWhisperAuthorizer = RegisteredFunction<Record<string, never>, boo
3979
4016
  */
3980
4017
  declare const onWhisper: (handler: WhisperAuthorizeHandler) => RegisteredWhisperAuthorizer;
3981
4018
  declare const VERSION = "0.0.0";
3982
- export { DEFAULT_ACTION_CACHE_TTL_MS as ACTION_CACHE_DEFAULT_TTL_MS, ACTION_CACHE_TABLE, type ActionBuilder, type ActionCacheComponent, type ActionCacheContext, type ActionCacheDatabase, type ActionCacheFunctions, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_REDACTED_FIELDS as DOCUMENT_HISTORY_REDACTED_FIELDS, DOCUMENT_HISTORY_TABLE, type DataModelInit, type DeferredDeleteFlushResult, type DefineActionCacheOptions, type DefineComponentOptions, type DefineDocumentHistoryOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DocumentHistoryComponent, type DocumentHistoryEntry, type DocumentHistoryFunctions, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpRunners, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareContext, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type ModuleConfig, type ModuleDefinition, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type StorageServeAuthorizer, type StorageServeAuthzContext, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, type WhisperAuthorizeHandler, type WhisperEvent, actionCacheExtension, allowAll, asBucketStorage, assertShapesDeclareReadPolicies, beginDeferredDeletes, beginDeferredSchedules, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, cacheKeyFor, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, createServices, defineActionCache, defineAggregateIndex, defineComponent, defineDocumentHistory, defineEnv, defineIdentity, defineIdentityGuard, defineListArgs, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, documentHistoryExtension, flushDeferredDeletes, httpAction, httpRoute, httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isPerDispatchMiddleware, isSafeHeaderValue, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, onWhisper, platformAdmin, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject, storageRules, tagPerDispatchMiddleware, toWhereInput, withDeferredDeletes, withDeferredSchedules };
4019
+ export { DEFAULT_ACTION_CACHE_TTL_MS as ACTION_CACHE_DEFAULT_TTL_MS, ACTION_CACHE_TABLE, type ActionBuilder, type ActionCacheComponent, type ActionCacheContext, type ActionCacheDatabase, type ActionCacheFunctions, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_REDACTED_FIELDS as DOCUMENT_HISTORY_REDACTED_FIELDS, DOCUMENT_HISTORY_TABLE, type DataModelInit, type DeferredDeleteFlushResult, type DefineActionCacheOptions, type DefineComponentOptions, type DefineDocumentHistoryOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DocumentHistoryComponent, type DocumentHistoryEntry, type DocumentHistoryFunctions, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpRunners, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareContext, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type ModuleConfig, type ModuleDefinition, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type SseEvent, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type StorageServeAuthorizer, type StorageServeAuthzContext, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, type WhisperAuthorizeHandler, type WhisperEvent, actionCacheExtension, allowAll, asBucketStorage, assertShapesDeclareReadPolicies, beginDeferredDeletes, beginDeferredSchedules, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, cacheKeyFor, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, createServices, defineActionCache, defineAggregateIndex, defineComponent, defineDocumentHistory, defineEnv, defineIdentity, defineIdentityGuard, defineListArgs, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, documentHistoryExtension, flushDeferredDeletes,
4020
+ /**
4021
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4022
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4023
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4024
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4025
+ * handler can guard a request-derived header value before writing it — the fix the
4026
+ * `http_action_response_header_injection` advisor lint points to.
4027
+ */
4028
+ httpAction,
4029
+ /**
4030
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4031
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4032
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4033
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4034
+ * handler can guard a request-derived header value before writing it — the fix the
4035
+ * `http_action_response_header_injection` advisor lint points to.
4036
+ */
4037
+ httpRoute,
4038
+ /**
4039
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4040
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4041
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4042
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4043
+ * handler can guard a request-derived header value before writing it — the fix the
4044
+ * `http_action_response_header_injection` advisor lint points to.
4045
+ */
4046
+ httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isPerDispatchMiddleware,
4047
+ /**
4048
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4049
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4050
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4051
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4052
+ * handler can guard a request-derived header value before writing it — the fix the
4053
+ * `http_action_response_header_injection` advisor lint points to.
4054
+ */
4055
+ isSafeHeaderValue,
4056
+ /**
4057
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4058
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4059
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4060
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4061
+ * handler can guard a request-derived header value before writing it — the fix the
4062
+ * `http_action_response_header_injection` advisor lint points to.
4063
+ */
4064
+ lastEventId, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, onWhisper, platformAdmin, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject,
4065
+ /**
4066
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4067
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4068
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4069
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4070
+ * handler can guard a request-derived header value before writing it — the fix the
4071
+ * `http_action_response_header_injection` advisor lint points to.
4072
+ */
4073
+ sseEvent, storageRules, tagPerDispatchMiddleware, toWhereInput, withDeferredDeletes, withDeferredSchedules };
package/dist/index.d.ts CHANGED
@@ -2026,8 +2026,11 @@ interface HttpRouteBuilder<SearchParams extends ArgsValidator, Body extends Args
2026
2026
  * handler's yielded type — unless `.output()` was declared, in which case each
2027
2027
  * chunk must be that type and is parsed through the validator before the frame
2028
2028
  * is written (a violation ends the stream with an `event: error` frame).
2029
+ *
2030
+ * A handler may yield a plain `R` (unchanged) or {@link sseEvent}, which
2031
+ * wraps one chunk so the pump emits an `id:` line ahead of its `data:`.
2029
2032
  */
2030
- stream: [Output] extends [undefined] ? <R>(handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<R, void, void> | AsyncIterable<R>) => LunoraRouteHandler : (handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<Output, void, void> | AsyncIterable<Output>) => LunoraRouteHandler;
2033
+ stream: [Output] extends [undefined] ? <R>(handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<R | SseEvent<R>, void, void> | AsyncIterable<R | SseEvent<R>>) => LunoraRouteHandler : (handler: (options: HttpStreamHandlerOptions<SearchParams, Params>) => AsyncGenerator<Output | SseEvent<Output>, void, void> | AsyncIterable<Output | SseEvent<Output>>) => LunoraRouteHandler;
2031
2034
  /**
2032
2035
  * Attach a `Vary` header to the response so Cloudflare stores separate
2033
2036
  * cached variants per distinct value of the listed request headers.
@@ -2046,6 +2049,49 @@ interface HttpRoute {
2046
2049
  post: HttpRouteFactory;
2047
2050
  put: HttpRouteFactory;
2048
2051
  }
2052
+ /**
2053
+ * Read the SSE resume position off a request: the `Last-Event-ID` header a
2054
+ * browser `EventSource` replays automatically on reconnect, falling back to a
2055
+ * `lastEventId` query parameter for clients that cannot set that header.
2056
+ * The query fallback applies only when the header is absent. A present but empty
2057
+ * header is a cleared position (the server emitted an empty `id:`), so it returns
2058
+ * `undefined` rather than resurrecting a stale query value. Returns `undefined`
2059
+ * when there is no resume position, so a handler can treat it the same as
2060
+ * "resume from the beginning".
2061
+ *
2062
+ * The handler decides what to replay — the framework only surfaces the value.
2063
+ */
2064
+ declare const lastEventId: (request: Request) => string | undefined;
2065
+ /**
2066
+ * The public shape {@link sseEvent} returns and a `.stream()` handler yields to
2067
+ * attach an SSE `id:` to one chunk. Structural on purpose: the runtime brand
2068
+ * that makes it unambiguous stays internal.
2069
+ */
2070
+ interface SseEvent<R> {
2071
+ readonly data: R;
2072
+ readonly id: string;
2073
+ }
2074
+ /**
2075
+ * Wrap a chunk so the SSE pump emits `id: <id>` immediately before its `data:`
2076
+ * line:
2077
+ *
2078
+ * ```ts
2079
+ * httpRoute.get("/api/logs").stream(async function* logs() {
2080
+ * for await (const entry of tail()) {
2081
+ * yield sseEvent({ data: entry, id: entry.seq });
2082
+ * }
2083
+ * });
2084
+ * ```
2085
+ *
2086
+ * `data` goes through the same wire codec and per-chunk `.output()` enforcement
2087
+ * as a plain yield; the wrapper is transport, not part of the user's contract.
2088
+ */
2089
+ declare const sseEvent: <R>(frame: {
2090
+ data: R;
2091
+ id: string;
2092
+ }) => SseEvent<R>;
2093
+ /** A header or SSE field value that cannot break out of its line. */
2094
+ declare const isSafeHeaderValue: (value: string) => boolean;
2049
2095
  /**
2050
2096
  * Typed REST route builder. Compiles down to a {@link LunoraRouteHandler}, so a
2051
2097
  * typed route and a hand-written {@link httpAction} are interchangeable when
@@ -2069,15 +2115,6 @@ interface HttpRoute {
2069
2115
  * ```
2070
2116
  */
2071
2117
  declare const httpRoute: HttpRoute;
2072
- /**
2073
- * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
2074
- * NUL. Guards against response-header injection / `Headers`-construction throws
2075
- * when reflecting attacker-influenced object metadata (e.g. a stored
2076
- * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
2077
- * handler can guard a request-derived header value before writing it — the fix the
2078
- * `http_action_response_header_injection` advisor lint points to.
2079
- */
2080
- declare const isSafeHeaderValue: (value: string) => boolean;
2081
2118
  /**
2082
2119
  * Structural view of an R2 object body, as returned by `@lunora/storage`'s
2083
2120
  * `download()`. Re-declared here (not imported) so `@lunora/server` takes no
@@ -3979,4 +4016,58 @@ type RegisteredWhisperAuthorizer = RegisteredFunction<Record<string, never>, boo
3979
4016
  */
3980
4017
  declare const onWhisper: (handler: WhisperAuthorizeHandler) => RegisteredWhisperAuthorizer;
3981
4018
  declare const VERSION = "0.0.0";
3982
- export { DEFAULT_ACTION_CACHE_TTL_MS as ACTION_CACHE_DEFAULT_TTL_MS, ACTION_CACHE_TABLE, type ActionBuilder, type ActionCacheComponent, type ActionCacheContext, type ActionCacheDatabase, type ActionCacheFunctions, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_REDACTED_FIELDS as DOCUMENT_HISTORY_REDACTED_FIELDS, DOCUMENT_HISTORY_TABLE, type DataModelInit, type DeferredDeleteFlushResult, type DefineActionCacheOptions, type DefineComponentOptions, type DefineDocumentHistoryOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DocumentHistoryComponent, type DocumentHistoryEntry, type DocumentHistoryFunctions, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpRunners, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareContext, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type ModuleConfig, type ModuleDefinition, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type StorageServeAuthorizer, type StorageServeAuthzContext, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, type WhisperAuthorizeHandler, type WhisperEvent, actionCacheExtension, allowAll, asBucketStorage, assertShapesDeclareReadPolicies, beginDeferredDeletes, beginDeferredSchedules, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, cacheKeyFor, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, createServices, defineActionCache, defineAggregateIndex, defineComponent, defineDocumentHistory, defineEnv, defineIdentity, defineIdentityGuard, defineListArgs, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, documentHistoryExtension, flushDeferredDeletes, httpAction, httpRoute, httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isPerDispatchMiddleware, isSafeHeaderValue, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, onWhisper, platformAdmin, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject, storageRules, tagPerDispatchMiddleware, toWhereInput, withDeferredDeletes, withDeferredSchedules };
4019
+ export { DEFAULT_ACTION_CACHE_TTL_MS as ACTION_CACHE_DEFAULT_TTL_MS, ACTION_CACHE_TABLE, type ActionBuilder, type ActionCacheComponent, type ActionCacheContext, type ActionCacheDatabase, type ActionCacheFunctions, type ActionCtx, type AggregateIndexDefinition, type AggregateIndexOptions, type AggregateOp, type ArgsValidator, type Component, type ComponentFunctions, type CreateOptions, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_REDACTED_FIELDS as DOCUMENT_HISTORY_REDACTED_FIELDS, DOCUMENT_HISTORY_TABLE, type DataModelInit, type DeferredDeleteFlushResult, type DefineActionCacheOptions, type DefineComponentOptions, type DefineDocumentHistoryOptions, type DefineIdentityOptions, type DefineListArgsConfig, type DefinePluginOptions, type DefinePolicyInput, type DefinePresenceOptions, type DefineStorageRuleInput, type DocumentHistoryComponent, type DocumentHistoryEntry, type DocumentHistoryFunctions, type DurableObjectJurisdiction, type DurableStreamOptions, type EmptyArgs, type EnvAccessor, type EnvKeyFailure, type EnvShape, type ExposeConfig, type ExtendableSchema, type FacadeEntry, type FacadeWriterLike, type FunctionKind, type HttpActionCtx, type HttpActionHandler, type HttpMethod, type HttpRoute, type HttpRouteBuilder, type HttpRouteFactory, type HttpRouteHandlerOptions, type HttpRunners, type HttpStreamHandlerOptions, type IdentityContract, type IdentityRejectMode, type IdentityValidation, type IndexFieldsByTable, type InferArgs, type InferEnv, type InferIdentity, type InlineAggregateIndexOptions, type InlineRankIndexOptions, type InternalActionBuilder, type InternalMutationBuilder, type InternalQueryBuilder, type LifecycleEvent, type LifecycleHandler, type ListArgsSpec, type ListArgsValidators, type ListArgsValue, type ListFilterOperators, type ListOrderByEntry, type ListWhere, type LunoraBuilders, LunoraEnvError, type LunoraHttpApp, type LunoraHttpEnv, type LunoraRouteHandler, type ManyRelation, type MaskColumns, type MaskContext, type MaskFn, type MaskOptions, type MaskPolicies, type MaskRegistry, type MaskStrategy, type Middleware, type MiddlewareContext, type MiddlewareNext, type MigrationCtx, type MigrationDefinition, type MigrationDocument, type MigrationReader, type MigrationTransform, type ModuleConfig, type ModuleDefinition, type MutationBuilder, type MutationCtx, type MutatorDefinition, type OnDeleteAction, type OneRelation, type OrmLike, DEFAULT_TTL_MS as PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PrefixedTables, type PresenceComponent, type PresenceFunctions, type PresenceMember, type ProtectPublicOptions, type QueryBuilder, type QueryCtx, type RankIndexDefinition, type RankIndexOptions, type ReactorHandler, type ReactorOutcome, type ReactorSelect, type RegisteredAction, type RegisteredFunction, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredShape, type RegisteredStream, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsOptions, type RlsReadRegistry, type Role, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardInitEvent, type ShardInitHandler, type SseEvent, type StorageOperation, type StorageRule, type StorageRuleContext, type StorageRuleDecision, type StorageRulesOptions, type StorageServeAuthorizer, type StorageServeAuthzContext, type TableBuilder, type TableDefinition, type TerminalKind, type TriggerBuilder, type TriggerDefinition, type TypedDefinePolicyInput, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WhereInput, type WhisperAuthorizeHandler, type WhisperEvent, actionCacheExtension, allowAll, asBucketStorage, assertShapesDeclareReadPolicies, beginDeferredDeletes, beginDeferredSchedules, bindOrm, bindTableFacade, buildMaskRegistry, buildRlsReadRegistry, cacheKeyFor, clampLimit, composePluginMiddleware, composeShapeReadWhere, createPolicyDsl, createSecrets, createServices, defineActionCache, defineAggregateIndex, defineComponent, defineDocumentHistory, defineEnv, defineIdentity, defineIdentityGuard, defineListArgs, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, deny, documentHistoryExtension, flushDeferredDeletes,
4020
+ /**
4021
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4022
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4023
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4024
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4025
+ * handler can guard a request-derived header value before writing it — the fix the
4026
+ * `http_action_response_header_injection` advisor lint points to.
4027
+ */
4028
+ httpAction,
4029
+ /**
4030
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4031
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4032
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4033
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4034
+ * handler can guard a request-derived header value before writing it — the fix the
4035
+ * `http_action_response_header_injection` advisor lint points to.
4036
+ */
4037
+ httpRoute,
4038
+ /**
4039
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4040
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4041
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4042
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4043
+ * handler can guard a request-derived header value before writing it — the fix the
4044
+ * `http_action_response_header_injection` advisor lint points to.
4045
+ */
4046
+ httpRouter, indexFieldsFromSchema, initLunora, installPlugins, isDeny, isPerDispatchMiddleware,
4047
+ /**
4048
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4049
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4050
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4051
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4052
+ * handler can guard a request-derived header value before writing it — the fix the
4053
+ * `http_action_response_header_injection` advisor lint points to.
4054
+ */
4055
+ isSafeHeaderValue,
4056
+ /**
4057
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4058
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4059
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4060
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4061
+ * handler can guard a request-derived header value before writing it — the fix the
4062
+ * `http_action_response_header_injection` advisor lint points to.
4063
+ */
4064
+ lastEventId, mask, mergeSchemaExtension, onConnect, onDisconnect, onQueryChange, onShardInit, onWhisper, platformAdmin, presenceExtension, protectPublic, redactSecrets, rls, serveStorageObject,
4065
+ /**
4066
+ * True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
4067
+ * NUL. Guards against response-header injection / `Headers`-construction throws
4068
+ * when reflecting attacker-influenced object metadata (e.g. a stored
4069
+ * `Content-Type`). Exported (see the `export {}` at the file end) so an `httpAction`
4070
+ * handler can guard a request-derived header value before writing it — the fix the
4071
+ * `http_action_response_header_injection` advisor lint points to.
4072
+ */
4073
+ sseEvent, storageRules, tagPerDispatchMiddleware, toWhereInput, withDeferredDeletes, withDeferredSchedules };
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{ACTION_CACHE_DEFAULT_TTL_MS as t,ACTION_CACHE_TABLE as i,actionCacheExtension as n,cacheKeyFor as a,defineActionCache as f}from"./packem_shared/ACTION_CACHE_DEFAULT_TTL_MS-mmP-6BcT.mjs";import{initLunora as d}from"./packem_shared/initLunora-B-7Xs3Qq.mjs";import{isPerDispatchMiddleware as p,tagPerDispatchMiddleware as x}from"./packem_shared/isPerDispatchMiddleware-DDQPatSm.mjs";import{createSecrets as l}from"./packem_shared/createSecrets-D6rLB42U.mjs";import{beginDeferredDeletes as u,flushDeferredDeletes as h,withDeferredDeletes as S}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as T,withDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-C7QLYr6C.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as R,DOCUMENT_HISTORY_TABLE as _,defineDocumentHistory as I,documentHistoryExtension as L}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-B5Zp-7SI.mjs";import{LunoraEnvError as M,defineEnv as P,redactSecrets as b}from"./packem_shared/LunoraEnvError-bkdMu_-N.mjs";import{bindOrm as F,bindTableFacade as O}from"./packem_shared/bindOrm-9fbLRbOb.mjs";import{httpAction as N,httpRoute as w,httpRouter as U,isSafeHeaderValue as k}from"./packem_shared/httpAction-8vJ8HTqX.mjs";import{serveStorageObject as B}from"./packem_shared/serveStorageObject-uoExuirp.mjs";import{defineIdentity as W}from"./packem_shared/defineIdentity-DwkNKwYa.mjs";import{default as Y}from"./packem_shared/defineIdentityGuard-Bt8N65Zs.mjs";import{onConnect as J,onDisconnect as K,onShardInit as Q}from"./packem_shared/onConnect-BLRoOpv2.mjs";import{DEFAULT_LIMIT as q,DEFAULT_MAX_LIMIT as z,clampLimit as Z,defineListArgs as $}from"./packem_shared/DEFAULT_LIMIT-pT_tV8R0.mjs";import{defineMigration as re}from"./packem_shared/defineMigration-CXOS0Bvq.mjs";import{defineModule as te}from"./packem_shared/defineModule-OecXWM3U.mjs";import{defineMutator as ne}from"./packem_shared/defineMutator-B4ipDtDR.mjs";import{platformAdmin as fe}from"./packem_shared/platformAdmin-kczXQme8.mjs";import{c as de,d as me,a as pe,b as xe,e as ce,f as le,g as Ee,h as ue,i as he,j as Se,k as De,m as Te}from"./packem_shared/plugin-Bm9wIpiI.mjs";import{PRESENCE_DEFAULT_TTL_MS as Ae,PRESENCE_TABLE as Re,definePresence as _e,presenceExtension as Ie}from"./packem_shared/PRESENCE_DEFAULT_TTL_MS-DFpy5J8G.mjs";import{protectPublic as Ce}from"./packem_shared/protectPublic-Bi5_95aP.mjs";import{onQueryChange as Pe}from"./packem_shared/onQueryChange-iuLzmyPs.mjs";import{createServices as ye}from"./packem_shared/createServices-IJvoqi0e.mjs";import{defineShape as Oe}from"./packem_shared/defineShape-CwKm5KLp.mjs";import{onWhisper as Ne}from"./packem_shared/onWhisper-CfDbFLQh.mjs";import{LunoraError as Ue}from"@lunora/errors";import{cronJobs as ve}from"@lunora/scheduler";import{ValidationError as Ve,v as We}from"@lunora/values";import{allowAll as Ye,deny as Ge,isDeny as Je,toWhereInput as Ke}from"./packem_shared/allowAll-DkRAgItV.mjs";import{asBucketStorage as Xe}from"./packem_shared/asBucketStorage-DoGYOjq3.mjs";import{assertShapesDeclareReadPolicies as ze,buildRlsReadRegistry as Ze,composeShapeReadWhere as $e}from"./packem_shared/assertShapesDeclareReadPolicies-Bg4Ter7Q.mjs";import{buildMaskRegistry as rr}from"./packem_shared/buildMaskRegistry-DpWMtalG.mjs";import{createPolicyDsl as tr,definePermission as ir,definePolicies as nr,definePolicy as ar,defineRole as fr}from"./packem_shared/createPolicyDsl-BZa6SqLJ.mjs";import{defineStorageRule as dr,defineStorageRules as mr}from"./packem_shared/defineStorageRule-Dv4nJE0H.mjs";import{mask as xr}from"./packem_shared/mask-D-jRCAhy.mjs";import{r as lr}from"./packem_shared/middleware-3ySZVrpt.mjs";import{storageRules as ur}from"./packem_shared/storageRules-CBLioxF7.mjs";const e="0.0.0";export{t as ACTION_CACHE_DEFAULT_TTL_MS,i as ACTION_CACHE_TABLE,q as DEFAULT_LIMIT,z as DEFAULT_MAX_LIMIT,R as DOCUMENT_HISTORY_REDACTED_FIELDS,_ as DOCUMENT_HISTORY_TABLE,M as LunoraEnvError,Ue as LunoraError,Ae as PRESENCE_DEFAULT_TTL_MS,Re as PRESENCE_TABLE,e as VERSION,Ve as ValidationError,n as actionCacheExtension,Ye as allowAll,Xe as asBucketStorage,ze as assertShapesDeclareReadPolicies,u as beginDeferredDeletes,T as beginDeferredSchedules,F as bindOrm,O as bindTableFacade,rr as buildMaskRegistry,Ze as buildRlsReadRegistry,a as cacheKeyFor,Z as clampLimit,de as composePluginMiddleware,$e as composeShapeReadWhere,tr as createPolicyDsl,l as createSecrets,ye as createServices,ve as cronJobs,f as defineActionCache,me as defineAggregateIndex,pe as defineComponent,I as defineDocumentHistory,P as defineEnv,W as defineIdentity,Y as defineIdentityGuard,$ as defineListArgs,re as defineMigration,te as defineModule,ne as defineMutator,ir as definePermission,xe as definePlugin,nr as definePolicies,ar as definePolicy,_e as definePresence,ce as defineRankIndex,fr as defineRole,le as defineSchema,Ee as defineSchemaExtension,Oe as defineShape,dr as defineStorageRule,mr as defineStorageRules,ue as defineTable,he as defineVectorIndex,Ge as deny,L as documentHistoryExtension,h as flushDeferredDeletes,N as httpAction,w as httpRoute,U as httpRouter,Se as indexFieldsFromSchema,d as initLunora,De as installPlugins,Je as isDeny,p as isPerDispatchMiddleware,k as isSafeHeaderValue,xr as mask,Te as mergeSchemaExtension,J as onConnect,K as onDisconnect,Pe as onQueryChange,Q as onShardInit,Ne as onWhisper,fe as platformAdmin,Ie as presenceExtension,Ce as protectPublic,b as redactSecrets,lr as rls,B as serveStorageObject,ur as storageRules,x as tagPerDispatchMiddleware,Ke as toWhereInput,We as v,S as withDeferredDeletes,g as withDeferredSchedules};
1
+ import{ACTION_CACHE_DEFAULT_TTL_MS as t,ACTION_CACHE_TABLE as n,actionCacheExtension as i,cacheKeyFor as a,defineActionCache as f}from"./packem_shared/ACTION_CACHE_DEFAULT_TTL_MS-mmP-6BcT.mjs";import{initLunora as d}from"./packem_shared/initLunora-B-7Xs3Qq.mjs";import{isPerDispatchMiddleware as p,tagPerDispatchMiddleware as x}from"./packem_shared/isPerDispatchMiddleware-DDQPatSm.mjs";import{createSecrets as l}from"./packem_shared/createSecrets-D6rLB42U.mjs";import{beginDeferredDeletes as u,flushDeferredDeletes as h,withDeferredDeletes as S}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as T,withDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-C7QLYr6C.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as R,DOCUMENT_HISTORY_TABLE as I,defineDocumentHistory as _,documentHistoryExtension as L}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-B5Zp-7SI.mjs";import{LunoraEnvError as M,defineEnv as P,redactSecrets as b}from"./packem_shared/LunoraEnvError-bkdMu_-N.mjs";import{bindOrm as F,bindTableFacade as O}from"./packem_shared/bindOrm-9fbLRbOb.mjs";import{httpAction as H,httpRoute as N,httpRouter as w,isSafeHeaderValue as U,lastEventId as k,sseEvent as B}from"./packem_shared/httpAction-D2S7bQzl.mjs";import{serveStorageObject as W}from"./packem_shared/serveStorageObject-aqBFrLyo.mjs";import{defineIdentity as Y}from"./packem_shared/defineIdentity-DwkNKwYa.mjs";import{default as J}from"./packem_shared/defineIdentityGuard-Bt8N65Zs.mjs";import{onConnect as Q,onDisconnect as X,onShardInit as q}from"./packem_shared/onConnect-BLRoOpv2.mjs";import{DEFAULT_LIMIT as Z,DEFAULT_MAX_LIMIT as $,clampLimit as ee,defineListArgs as re}from"./packem_shared/DEFAULT_LIMIT-pT_tV8R0.mjs";import{defineMigration as te}from"./packem_shared/defineMigration-CXOS0Bvq.mjs";import{defineModule as ie}from"./packem_shared/defineModule-OecXWM3U.mjs";import{defineMutator as fe}from"./packem_shared/defineMutator-B4ipDtDR.mjs";import{platformAdmin as de}from"./packem_shared/platformAdmin-kczXQme8.mjs";import{c as pe,d as xe,a as ce,b as le,e as Ee,f as ue,g as he,h as Se,i as De,j as Te,k as ge,m as Ae}from"./packem_shared/plugin-Bm9wIpiI.mjs";import{PRESENCE_DEFAULT_TTL_MS as Ie,PRESENCE_TABLE as _e,definePresence as Le,presenceExtension as Ce}from"./packem_shared/PRESENCE_DEFAULT_TTL_MS-DFpy5J8G.mjs";import{protectPublic as Pe}from"./packem_shared/protectPublic-Bi5_95aP.mjs";import{onQueryChange as ye}from"./packem_shared/onQueryChange-iuLzmyPs.mjs";import{createServices as Oe}from"./packem_shared/createServices-IJvoqi0e.mjs";import{defineShape as He}from"./packem_shared/defineShape-CwKm5KLp.mjs";import{onWhisper as we}from"./packem_shared/onWhisper-CfDbFLQh.mjs";import{LunoraError as ke}from"@lunora/errors";import{cronJobs as Ve}from"@lunora/scheduler";import{ValidationError as je,v as Ye}from"@lunora/values";import{allowAll as Je,deny as Ke,isDeny as Qe,toWhereInput as Xe}from"./packem_shared/allowAll-DkRAgItV.mjs";import{asBucketStorage as ze}from"./packem_shared/asBucketStorage-DoGYOjq3.mjs";import{assertShapesDeclareReadPolicies as $e,buildRlsReadRegistry as er,composeShapeReadWhere as rr}from"./packem_shared/assertShapesDeclareReadPolicies-Bg4Ter7Q.mjs";import{buildMaskRegistry as tr}from"./packem_shared/buildMaskRegistry-DpWMtalG.mjs";import{createPolicyDsl as ir,definePermission as ar,definePolicies as fr,definePolicy as sr,defineRole as dr}from"./packem_shared/createPolicyDsl-BZa6SqLJ.mjs";import{defineStorageRule as pr,defineStorageRules as xr}from"./packem_shared/defineStorageRule-Dv4nJE0H.mjs";import{mask as lr}from"./packem_shared/mask-D-jRCAhy.mjs";import{r as ur}from"./packem_shared/middleware-3ySZVrpt.mjs";import{storageRules as Sr}from"./packem_shared/storageRules-CBLioxF7.mjs";const e="0.0.0";export{t as ACTION_CACHE_DEFAULT_TTL_MS,n as ACTION_CACHE_TABLE,Z as DEFAULT_LIMIT,$ as DEFAULT_MAX_LIMIT,R as DOCUMENT_HISTORY_REDACTED_FIELDS,I as DOCUMENT_HISTORY_TABLE,M as LunoraEnvError,ke as LunoraError,Ie as PRESENCE_DEFAULT_TTL_MS,_e as PRESENCE_TABLE,e as VERSION,je as ValidationError,i as actionCacheExtension,Je as allowAll,ze as asBucketStorage,$e as assertShapesDeclareReadPolicies,u as beginDeferredDeletes,T as beginDeferredSchedules,F as bindOrm,O as bindTableFacade,tr as buildMaskRegistry,er as buildRlsReadRegistry,a as cacheKeyFor,ee as clampLimit,pe as composePluginMiddleware,rr as composeShapeReadWhere,ir as createPolicyDsl,l as createSecrets,Oe as createServices,Ve as cronJobs,f as defineActionCache,xe as defineAggregateIndex,ce as defineComponent,_ as defineDocumentHistory,P as defineEnv,Y as defineIdentity,J as defineIdentityGuard,re as defineListArgs,te as defineMigration,ie as defineModule,fe as defineMutator,ar as definePermission,le as definePlugin,fr as definePolicies,sr as definePolicy,Le as definePresence,Ee as defineRankIndex,dr as defineRole,ue as defineSchema,he as defineSchemaExtension,He as defineShape,pr as defineStorageRule,xr as defineStorageRules,Se as defineTable,De as defineVectorIndex,Ke as deny,L as documentHistoryExtension,h as flushDeferredDeletes,H as httpAction,N as httpRoute,w as httpRouter,Te as indexFieldsFromSchema,d as initLunora,ge as installPlugins,Qe as isDeny,p as isPerDispatchMiddleware,U as isSafeHeaderValue,k as lastEventId,lr as mask,Ae as mergeSchemaExtension,Q as onConnect,X as onDisconnect,ye as onQueryChange,q as onShardInit,we as onWhisper,de as platformAdmin,Ce as presenceExtension,Pe as protectPublic,b as redactSecrets,ur as rls,W as serveStorageObject,B as sseEvent,Sr as storageRules,x as tagPerDispatchMiddleware,Xe as toWhereInput,Ye as v,S as withDeferredDeletes,g as withDeferredSchedules};
@@ -0,0 +1,6 @@
1
+ import{LunoraError as b,toErrorBody as S,isLunoraError as k}from"@lunora/errors";import{parseValidatorMap as v,ValidationError as L}from"@lunora/values";import{encodeWire as q}from"@lunora/wire";import{Hono as C}from"hono";import{a as R}from"./apply-output-C5wZ5EAL.mjs";const W=e=>async r=>e(r.get("lunora"),r.req.raw),G=()=>{const e=new C;return e.use("*",async(r,o)=>{const n=r.env.__lunoraCtx;if(!n)throw new b("INTERNAL_SERVER_ERROR","HttpActionCtx was not injected — mount httpRouter() on createWorker(), which supplies it per request.");r.set("lunora",n),await o()}),e},O=e=>e.kind==="optional"?e._meta?.inner??e:e,g=(e,r)=>{switch(e){case"bigint":try{return BigInt(r)}catch{return r}case"boolean":return r==="true"||r==="1"?!0:r==="false"||r==="0"?!1:r;case"number":return r===""?Number.NaN:Number(r);default:return r}},x=(e,r,o)=>{const n=O(e);if(n.kind==="array"){const a=r.req.queries(o);if(a===void 0)return;const i=n._meta?.inner;return a.map(d=>g(i?.kind??"string",d))}const t=r.req.query(o);return t===void 0?void 0:g(n.kind,t)},T=(e,r)=>{const o={};for(const n of Object.keys(e)){const t=e[n];t&&(o[n]=x(t,r,n))}return v(e,o,"searchParams")},N=(e,r)=>{const o=r.req.param(),n={};for(const t of Object.keys(e)){const a=e[t];if(!a)continue;const i=o[t];n[t]=i===void 0?void 0:g(O(a).kind,i)}return v(e,n,"params")},H=async(e,r)=>{let o;try{o=await r.req.json()}catch{throw new b("BAD_REQUEST","Invalid JSON body")}if(typeof o!="object"||o===null||Array.isArray(o))throw new b("BAD_REQUEST","Expected a JSON object body");return v(e,o,"body")},A=e=>{if(e instanceof L)return Response.json({code:"BAD_REQUEST",error:e.message},{status:400});if(k(e)){const{body:r,redacted:o,status:n}=S(e,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});return o&&console.error("[lunora] http action error (redacted on the wire):",e),Response.json({code:r.code,error:r.message},{status:n})}throw e},j=(e,r)=>{const{method:o}=r.req;if(!(o===e.method||e.method==="GET"&&o==="HEAD"))return Response.json({code:"METHOD_NOT_ALLOWED",error:`${o} is not allowed on this route (declared as ${e.method})`},{headers:{allow:e.method},status:405})},I=(e,r)=>async o=>{const n=j(e,o);if(n)return n;try{const t=o.get("lunora"),a=Object.keys(e.searchParams).length>0?T(e.searchParams,o):{},i=Object.keys(e.params).length>0?N(e.params,o):{},d=Object.keys(e.body).length>0?await H(e.body,o):{},h=await r({body:d,ctx:t,params:i,searchParams:a}),s=e.output?R(e.output,h):h,c={};e.cacheControl&&(c["cache-control"]=e.cacheControl),e.cacheTag&&(c["cache-tag"]=e.cacheTag),e.vary&&(c.vary=e.vary);const p=Object.keys(c).length>0;return s===void 0?new Response(null,{headers:p?c:void 0,status:204}):Response.json(s,{headers:p?c:void 0})}catch(t){return A(t)}},w={"cache-control":"no-cache, no-transform","content-type":"text/event-stream; charset=utf-8","x-accel-buffering":"no"},z=e=>{const r=e.headers.get("last-event-id");if(r!==null)return r===""?void 0:r;const o=new URL(e.url).searchParams.get("lastEventId");return o===null||o===""?void 0:o},P=Symbol.for("@lunora/server/sse-event"),K=e=>({[P]:!0,data:e.data,id:e.id}),D=e=>typeof e=="object"&&e!==null&&e[P]===!0,B=e=>!(e.includes("\r")||e.includes(`
2
+ `)||e.includes("\0")),E=(e,r,o)=>{const n=JSON.stringify(r===void 0?q(e):e);if(o!==void 0&&!B(o))throw new b("INTERNAL","sseEvent id must not contain CR, LF or NUL");const t=o===void 0?"":`id: ${o}
3
+ `,a=r?`event: ${r}
4
+ `:"";return`${t}${a}data: ${n}
5
+
6
+ `},V=(e,r)=>{if(D(r)){const o=e?R(e,r.data):r.data;return E(o,void 0,r.id)}return E(e?R(e,r):r)},$=(e,r)=>(async o=>{const n=j(e,o);if(n)return n;let t,a;try{t=Object.keys(e.searchParams).length>0?T(e.searchParams,o):{},a=Object.keys(e.params).length>0?N(e.params,o):{}}catch(m){return A(m)}const i=o.get("lunora"),d=o.req.raw,h=new TextEncoder,s=new AbortController;if(d.signal.aborted)return s.abort(),new Response("",{headers:w});const c=()=>{s.abort()};d.signal.addEventListener("abort",c,{once:!0});const p=new ReadableStream({cancel(){d.signal.removeEventListener("abort",c),s.abort()},async start(m){try{const f=r({ctx:i,params:a,request:d,searchParams:t,signal:s.signal});for await(const y of f){if(s.signal.aborted)break;m.enqueue(h.encode(V(e.output,y)))}s.signal.aborted||m.enqueue(h.encode(E({},"complete")))}catch(f){const{body:y,redacted:_}=S(f,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});_&&console.error("[lunora] unhandled stream handler error:",f),s.signal.aborted||m.enqueue(h.encode(E({code:y.code,message:y.message},"error")))}finally{d.signal.removeEventListener("abort",c);try{m.close()}catch{}}}});return new Response(p,{headers:w})}),u=e=>({body:r=>u({...e,body:{...e.body,...r}}),cacheControl:r=>u({...e,cacheControl:r}),cacheTag:r=>u({...e,cacheTag:r}),handler:r=>I(e,r),output:r=>u({...e,output:r}),params:r=>u({...e,params:{...e.params,...r}}),searchParams:r=>u({...e,searchParams:{...e.searchParams,...r}}),stream:r=>$(e,r),vary:r=>u({...e,vary:r})}),l=e=>r=>u({body:{},method:e,params:{},path:r,searchParams:{}}),X={delete:l("DELETE"),get:l("GET"),head:l("HEAD"),options:l("OPTIONS"),patch:l("PATCH"),post:l("POST"),put:l("PUT")};export{W as httpAction,X as httpRoute,G as httpRouter,B as isSafeHeaderValue,z as lastEventId,K as sseEvent};
@@ -1 +1 @@
1
- import{isSafeHeaderValue as b}from"./httpAction-8vJ8HTqX.mjs";const N=/^bytes=(\d*)-(\d*)$/,g=t=>t.startsWith('"')||t.startsWith('W/"')?t:`"${t}"`,R=/(?:W\/)?"[^"]*"/g,p=t=>t.startsWith("W/")?t.slice(2):t,S=(t,e)=>{if(t.trim()==="*")return!0;const n=p(g(e));return(t.match(R)??[]).some(s=>p(s)===n)},m=(t,e)=>{if(t===null)return{kind:"full"};const n=N.exec(t.trim());if(!n)return{kind:"full"};const s=n[1]??"",a=n[2]??"";if(s===""&&a==="")return{kind:"full"};let r,o;if(s===""){const u=Number(a);if(u===0)return{kind:"unsatisfiable"};r=Math.max(0,e-u),o=e-1}else r=Number(s),o=a===""?e-1:Math.min(Number(a),e-1);return r>o||r>=e?{kind:"unsatisfiable"}:{end:o,kind:"partial",start:r}},v=new Set(["audio/mpeg","audio/ogg","audio/wav","image/apng","image/avif","image/gif","image/jpeg","image/png","image/webp","video/mp4","video/webm"]),w=(t,e)=>{const n=t.httpMetadata?.contentType,s=n!==void 0&&b(n)?n:"application/octet-stream",a={"accept-ranges":"bytes","cache-control":e,"content-type":s,etag:g(t.etag),"x-content-type-options":"nosniff"};return v.has(s.split(";")[0]?.trim().toLowerCase()??"")||(a["content-disposition"]="attachment"),t.sha256Base64!==void 0&&(a["repr-digest"]=`sha-256=:${t.sha256Base64}:`),a},y=t=>m(t,0).kind==="full",h=async(t,e,n)=>{const s=await t.storage.download(e);return s?new Response(s.body,{headers:{...w(s,n),"content-length":String(s.size)},status:200}):new Response("Not Found",{status:404})},T=async(t,e,n)=>{try{return await t({key:e,request:n})===!0}catch{return!1}},W=async(t,e,n,s,a="no-store")=>{if(!await T(s,e,n))return new Response("Forbidden",{status:403});const r=n.headers.get("if-none-match");let o;if(r!==null){const d=await t.storage.head(e);if(!d)return new Response("Not Found",{status:404});if(S(r,d.etag))return new Response(void 0,{headers:{"cache-control":a,etag:g(d.etag)},status:304});o=d}const u=n.headers.get("range");if(y(u))return h(t,e,a);const c=o??await t.storage.head(e);if(!c)return new Response("Not Found",{status:404});const i=m(u,c.size);if(i.kind==="unsatisfiable")return new Response("Range Not Satisfiable",{headers:{"accept-ranges":"bytes","content-range":`bytes */${String(c.size)}`,"content-type":"text/plain; charset=utf-8",etag:g(c.etag)},status:416});if(i.kind==="full")return h(t,e,a);const f=i.end-i.start+1,l=await t.storage.download(e,{range:{length:f,offset:i.start}});return l?new Response(l.body,{headers:{...w(c,a),"content-length":String(f),"content-range":`bytes ${String(i.start)}-${String(i.end)}/${String(c.size)}`},status:206}):new Response("Not Found",{status:404})};export{W as serveStorageObject};
1
+ import{isSafeHeaderValue as b}from"./httpAction-D2S7bQzl.mjs";const N=/^bytes=(\d*)-(\d*)$/,g=t=>t.startsWith('"')||t.startsWith('W/"')?t:`"${t}"`,R=/(?:W\/)?"[^"]*"/g,p=t=>t.startsWith("W/")?t.slice(2):t,S=(t,e)=>{if(t.trim()==="*")return!0;const n=p(g(e));return(t.match(R)??[]).some(s=>p(s)===n)},m=(t,e)=>{if(t===null)return{kind:"full"};const n=N.exec(t.trim());if(!n)return{kind:"full"};const s=n[1]??"",a=n[2]??"";if(s===""&&a==="")return{kind:"full"};let r,o;if(s===""){const u=Number(a);if(u===0)return{kind:"unsatisfiable"};r=Math.max(0,e-u),o=e-1}else r=Number(s),o=a===""?e-1:Math.min(Number(a),e-1);return r>o||r>=e?{kind:"unsatisfiable"}:{end:o,kind:"partial",start:r}},v=new Set(["audio/mpeg","audio/ogg","audio/wav","image/apng","image/avif","image/gif","image/jpeg","image/png","image/webp","video/mp4","video/webm"]),w=(t,e)=>{const n=t.httpMetadata?.contentType,s=n!==void 0&&b(n)?n:"application/octet-stream",a={"accept-ranges":"bytes","cache-control":e,"content-type":s,etag:g(t.etag),"x-content-type-options":"nosniff"};return v.has(s.split(";")[0]?.trim().toLowerCase()??"")||(a["content-disposition"]="attachment"),t.sha256Base64!==void 0&&(a["repr-digest"]=`sha-256=:${t.sha256Base64}:`),a},y=t=>m(t,0).kind==="full",h=async(t,e,n)=>{const s=await t.storage.download(e);return s?new Response(s.body,{headers:{...w(s,n),"content-length":String(s.size)},status:200}):new Response("Not Found",{status:404})},T=async(t,e,n)=>{try{return await t({key:e,request:n})===!0}catch{return!1}},W=async(t,e,n,s,a="no-store")=>{if(!await T(s,e,n))return new Response("Forbidden",{status:403});const r=n.headers.get("if-none-match");let o;if(r!==null){const d=await t.storage.head(e);if(!d)return new Response("Not Found",{status:404});if(S(r,d.etag))return new Response(void 0,{headers:{"cache-control":a,etag:g(d.etag)},status:304});o=d}const u=n.headers.get("range");if(y(u))return h(t,e,a);const c=o??await t.storage.head(e);if(!c)return new Response("Not Found",{status:404});const i=m(u,c.size);if(i.kind==="unsatisfiable")return new Response("Range Not Satisfiable",{headers:{"accept-ranges":"bytes","content-range":`bytes */${String(c.size)}`,"content-type":"text/plain; charset=utf-8",etag:g(c.etag)},status:416});if(i.kind==="full")return h(t,e,a);const f=i.end-i.start+1,l=await t.storage.download(e,{range:{length:f,offset:i.start}});return l?new Response(l.body,{headers:{...w(c,a),"content-length":String(f),"content-range":`bytes ${String(i.start)}-${String(i.end)}/${String(c.size)}`},status:206}):new Response("Not Found",{status:404})};export{W as serveStorageObject};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/server",
3
- "version": "1.0.0-alpha.207",
3
+ "version": "1.0.0-alpha.209",
4
4
  "description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
5
5
  "keywords": [
6
6
  "backend",
@@ -71,9 +71,9 @@
71
71
  },
72
72
  "dependencies": {
73
73
  "@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
74
- "@lunora/scheduler": "1.0.0-alpha.129",
75
- "@lunora/shard-engine": "1.0.0-alpha.131",
76
- "@lunora/values": "1.0.0-alpha.66",
74
+ "@lunora/scheduler": "1.0.0-alpha.130",
75
+ "@lunora/shard-engine": "1.0.0-alpha.132",
76
+ "@lunora/values": "1.0.0-alpha.67",
77
77
  "@lunora/wire": "1.0.0-alpha.1",
78
78
  "drizzle-orm": "^0.45.3",
79
79
  "hono": "^4.13.13"
@@ -1,5 +0,0 @@
1
- import{LunoraError as E,toErrorBody as O,isLunoraError as N}from"@lunora/errors";import{parseValidatorMap as R,ValidationError as _}from"@lunora/values";import{encodeWire as q}from"@lunora/wire";import{Hono as x}from"hono";import{a as k}from"./apply-output-C5wZ5EAL.mjs";const U=e=>async r=>e(r.get("lunora"),r.req.raw),J=()=>{const e=new x;return e.use("*",async(r,o)=>{const n=r.env.__lunoraCtx;if(!n)throw new E("INTERNAL_SERVER_ERROR","HttpActionCtx was not injected — mount httpRouter() on createWorker(), which supplies it per request.");r.set("lunora",n),await o()}),e},v=e=>e.kind==="optional"?e._meta?.inner??e:e,g=(e,r)=>{switch(e){case"bigint":try{return BigInt(r)}catch{return r}case"boolean":return r==="true"||r==="1"?!0:r==="false"||r==="0"?!1:r;case"number":return r===""?Number.NaN:Number(r);default:return r}},C=(e,r,o)=>{const n=v(e);if(n.kind==="array"){const a=r.req.queries(o);if(a===void 0)return;const d=n._meta?.inner;return a.map(i=>g(d?.kind??"string",i))}const t=r.req.query(o);return t===void 0?void 0:g(n.kind,t)},S=(e,r)=>{const o={};for(const n of Object.keys(e)){const t=e[n];t&&(o[n]=C(t,r,n))}return R(e,o,"searchParams")},T=(e,r)=>{const o=r.req.param(),n={};for(const t of Object.keys(e)){const a=e[t];if(!a)continue;const d=o[t];n[t]=d===void 0?void 0:g(v(a).kind,d)}return R(e,n,"params")},H=async(e,r)=>{let o;try{o=await r.req.json()}catch{throw new E("BAD_REQUEST","Invalid JSON body")}if(typeof o!="object"||o===null||Array.isArray(o))throw new E("BAD_REQUEST","Expected a JSON object body");return R(e,o,"body")},j=e=>{if(e instanceof _)return Response.json({code:"BAD_REQUEST",error:e.message},{status:400});if(N(e)){const{body:r,redacted:o,status:n}=O(e,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});return o&&console.error("[lunora] http action error (redacted on the wire):",e),Response.json({code:r.code,error:r.message},{status:n})}throw e},A=(e,r)=>{const{method:o}=r.req;if(!(o===e.method||e.method==="GET"&&o==="HEAD"))return Response.json({code:"METHOD_NOT_ALLOWED",error:`${o} is not allowed on this route (declared as ${e.method})`},{headers:{allow:e.method},status:405})},L=(e,r)=>async o=>{const n=A(e,o);if(n)return n;try{const t=o.get("lunora"),a=Object.keys(e.searchParams).length>0?S(e.searchParams,o):{},d=Object.keys(e.params).length>0?T(e.params,o):{},i=Object.keys(e.body).length>0?await H(e.body,o):{},h=await r({body:i,ctx:t,params:d,searchParams:a}),s=e.output?k(e.output,h):h,c={};e.cacheControl&&(c["cache-control"]=e.cacheControl),e.cacheTag&&(c["cache-tag"]=e.cacheTag),e.vary&&(c.vary=e.vary);const f=Object.keys(c).length>0;return s===void 0?new Response(null,{headers:f?c:void 0,status:204}):Response.json(s,{headers:f?c:void 0})}catch(t){return j(t)}},w={"cache-control":"no-cache, no-transform","content-type":"text/event-stream; charset=utf-8","x-accel-buffering":"no"},b=(e,r)=>{const o=JSON.stringify(r===void 0?q(e):e);return`${r?`event: ${r}
2
- `:""}data: ${o}
3
-
4
- `},D=(e,r)=>(async o=>{const n=A(e,o);if(n)return n;let t,a;try{t=Object.keys(e.searchParams).length>0?S(e.searchParams,o):{},a=Object.keys(e.params).length>0?T(e.params,o):{}}catch(m){return j(m)}const d=o.get("lunora"),i=o.req.raw,h=new TextEncoder,s=new AbortController;if(i.signal.aborted)return s.abort(),new Response("",{headers:w});const c=()=>{s.abort()};i.signal.addEventListener("abort",c,{once:!0});const f=new ReadableStream({cancel(){i.signal.removeEventListener("abort",c),s.abort()},async start(m){try{const y=r({ctx:d,params:a,request:i,searchParams:t,signal:s.signal});for await(const p of y){if(s.signal.aborted)break;m.enqueue(h.encode(b(e.output?k(e.output,p):p)))}s.signal.aborted||m.enqueue(h.encode(b({},"complete")))}catch(y){const{body:p,redacted:P}=O(y,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});P&&console.error("[lunora] unhandled stream handler error:",y),s.signal.aborted||m.enqueue(h.encode(b({code:p.code,message:p.message},"error")))}finally{i.signal.removeEventListener("abort",c);try{m.close()}catch{}}}});return new Response(f,{headers:w})}),u=e=>({body:r=>u({...e,body:{...e.body,...r}}),cacheControl:r=>u({...e,cacheControl:r}),cacheTag:r=>u({...e,cacheTag:r}),handler:r=>L(e,r),output:r=>u({...e,output:r}),params:r=>u({...e,params:{...e.params,...r}}),searchParams:r=>u({...e,searchParams:{...e.searchParams,...r}}),stream:r=>D(e,r),vary:r=>u({...e,vary:r})}),l=e=>r=>u({body:{},method:e,params:{},path:r,searchParams:{}}),Q={delete:l("DELETE"),get:l("GET"),head:l("HEAD"),options:l("OPTIONS"),patch:l("PATCH"),post:l("POST"),put:l("PUT")},W=e=>!(e.includes("\r")||e.includes(`
5
- `)||e.includes("\0"));export{U as httpAction,Q as httpRoute,J as httpRouter,W as isSafeHeaderValue};