@lunora/server 1.0.0-alpha.271 → 1.0.0-alpha.272
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/in-process.d.mts +1 -1
- package/dist/in-process.d.ts +1 -1
- package/dist/index.d.mts +25 -4
- package/dist/index.d.ts +25 -4
- package/dist/index.mjs +1 -1
- package/dist/otel.d.mts +1 -1
- package/dist/otel.d.ts +1 -1
- package/dist/packem_shared/{defineLiveStream-B9_cpxrR.mjs → defineLiveStream-q9yO3wl6.mjs} +1 -1
- package/dist/packem_shared/httpAction-Bfw3qwLG.mjs +1 -0
- package/dist/packem_shared/{types.d-D0mb6QC3.d.mts → types.d-Dc9s10Ya.d.mts} +16 -9
- package/dist/packem_shared/{types.d-D0mb6QC3.d.ts → types.d-Dc9s10Ya.d.ts} +16 -9
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/packem_shared/httpAction-DKWIT1bN.mjs +0 -1
package/dist/in-process.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransactionHeadroomTracker, SqlExec } from '@lunora/shard-engine';
|
|
2
|
-
import { D as DatabaseWriter, S as Schema } from "./packem_shared/types.d-
|
|
2
|
+
import { D as DatabaseWriter, S as Schema } from "./packem_shared/types.d-Dc9s10Ya.mjs";
|
|
3
3
|
import '@lunora/values';
|
|
4
4
|
/** Where the current dispatch's tracker lives: an `AsyncLocalStorage` fits, and so does any stand-in. */
|
|
5
5
|
interface HeadroomScope {
|
package/dist/in-process.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TransactionHeadroomTracker, SqlExec } from '@lunora/shard-engine';
|
|
2
|
-
import { D as DatabaseWriter, S as Schema } from "./packem_shared/types.d-
|
|
2
|
+
import { D as DatabaseWriter, S as Schema } from "./packem_shared/types.d-Dc9s10Ya.js";
|
|
3
3
|
import '@lunora/values';
|
|
4
4
|
/** Where the current dispatch's tracker lives: an `AsyncLocalStorage` fits, and so does any stand-in. */
|
|
5
5
|
interface HeadroomScope {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Validator, Infer, ColumnValidator, Id, StringColumnValidator, ValidatorMap, InferValidatorMap } from '@lunora/values';
|
|
2
2
|
export { type ColumnValidator, type GeoPoint, type Id, type Infer, ValidationError, type Validator, type ValidatorKind, v } from '@lunora/values';
|
|
3
|
-
import { A as ArgsValidator, I as InferArgs, R as RegisteredAction, E as ExposeConfig, X as X402ProcedureConfig, b as ActionCtx, c as RegisteredInternalAction, M as MutationCtx, d as RegisteredInternalMutation, Q as QueryCtx, e as RegisteredInternalQuery, f as DurableStreamOptions, g as RegisteredInternalStream, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, F as FunctionKind, T as TableDefinition, k as RegisteredFunction, V as VectorIndexDefinition, S as Schema, l as AggregateOp, G as GlobalBackend, K as KeyedRelationDefinition, m as RelationThrough, n as ThroughRelationDefinition, O as OnDeleteAction, o as RelationDefinition, p as SearchLanguage, q as SearchStrategy, r as ExternalSourceDefinition, s as TriggerBuilder, t as TriggerDefinition, u as VectorEmbedder, v as VectorMetric, w as DurableObjectJurisdiction, x as AggregateIndexDefinition, y as RankIndexDefinition, z as Secrets, B as LiveTopicRef, C as LifecycleEvent, H as ShardInitEvent, J as RegisteredLifecycleHook, W as WhisperEvent } from "./packem_shared/types.d-
|
|
4
|
-
export type { N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, a1 as IndexDefinition, a2 as IndexRangeBuilder, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, a9 as MutationStorage, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, ad as RankSortKey, ae as ReadOnlyStorage, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, au as SearchFilterBuilder, av as SearchIndexDefinition, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, aU as TableReader, aV as TableVectorIndex, aW as TriggerAggregateOptions, aX as TriggerCtx, aY as TriggerDatabase, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, bd as VectorMatch, be as VectorMatches, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows } from "./packem_shared/types.d-
|
|
3
|
+
import { A as ArgsValidator, I as InferArgs, R as RegisteredAction, E as ExposeConfig, X as X402ProcedureConfig, b as ActionCtx, c as RegisteredInternalAction, M as MutationCtx, d as RegisteredInternalMutation, Q as QueryCtx, e as RegisteredInternalQuery, f as DurableStreamOptions, g as RegisteredInternalStream, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, F as FunctionKind, T as TableDefinition, k as RegisteredFunction, V as VectorIndexDefinition, S as Schema, l as AggregateOp, G as GlobalBackend, K as KeyedRelationDefinition, m as RelationThrough, n as ThroughRelationDefinition, O as OnDeleteAction, o as RelationDefinition, p as SearchLanguage, q as SearchStrategy, r as ExternalSourceDefinition, s as TriggerBuilder, t as TriggerDefinition, u as VectorEmbedder, v as VectorMetric, w as DurableObjectJurisdiction, x as AggregateIndexDefinition, y as RankIndexDefinition, z as Secrets, B as LiveTopicRef, C as LifecycleEvent, H as ShardInitEvent, J as RegisteredLifecycleHook, W as WhisperEvent } from "./packem_shared/types.d-Dc9s10Ya.mjs";
|
|
4
|
+
export type { N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, a1 as IndexDefinition, a2 as IndexRangeBuilder, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, a9 as MutationStorage, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, ad as RankSortKey, ae as ReadOnlyStorage, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, au as SearchFilterBuilder, av as SearchIndexDefinition, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, aU as TableReader, aV as TableVectorIndex, aW as TriggerAggregateOptions, aX as TriggerCtx, aY as TriggerDatabase, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, bd as VectorMatch, be as VectorMatches, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows } from "./packem_shared/types.d-Dc9s10Ya.mjs";
|
|
5
5
|
import { LunoraError } from '@lunora/errors';
|
|
6
6
|
export { LunoraError, type LunoraErrorCode } from '@lunora/errors';
|
|
7
7
|
import { Context, Hono, ExecutionContext } from 'hono';
|
|
@@ -2123,8 +2123,20 @@ interface HttpRouteBuilder<SearchParams extends ArgsValidator, Body extends Args
|
|
|
2123
2123
|
/**
|
|
2124
2124
|
* Attach a `Cache-Control` header to the response. Only meaningful when
|
|
2125
2125
|
* Workers Cache is enabled in `wrangler.jsonc` (`"cache": { "enabled": true }`).
|
|
2126
|
+
*
|
|
2127
|
+
* Sent as written to an anonymous caller. When the request carries a
|
|
2128
|
+
* credential (`Authorization`, `Cookie`, `Cf-Access-Jwt-Assertion`, an x402
|
|
2129
|
+
* payment header, a Cloudflare Access identity, or one of
|
|
2130
|
+
* `options.credentialHeaders`), a value without a bare `private` or
|
|
2131
|
+
* `no-store` is sent as `private`, with `public`, `s-maxage`,
|
|
2132
|
+
* `proxy-revalidate` and a field-qualified `private="…"` removed.
|
|
2133
|
+
*
|
|
2134
|
+
* Only those credentials are recognised. An app that authenticates on
|
|
2135
|
+
* another header (`x-api-key`, a tenant header) must list it in
|
|
2136
|
+
* `options.credentialHeaders`, or its callers read as anonymous and get the
|
|
2137
|
+
* declared value, `public` included.
|
|
2126
2138
|
*/
|
|
2127
|
-
cacheControl: (value: string) => HttpRouteBuilder<SearchParams, Body, Params, Output>;
|
|
2139
|
+
cacheControl: (value: string, options?: HttpRouteCacheOptions) => HttpRouteBuilder<SearchParams, Body, Params, Output>;
|
|
2128
2140
|
/**
|
|
2129
2141
|
* Attach a `Cache-Tag` header to the response for tag-based purging via
|
|
2130
2142
|
* `ctx.cache.purge({ tags: [...] })`.
|
|
@@ -2155,6 +2167,15 @@ interface HttpRouteBuilder<SearchParams extends ArgsValidator, Body extends Args
|
|
|
2155
2167
|
*/
|
|
2156
2168
|
vary: (value: string) => HttpRouteBuilder<SearchParams, Body, Params, Output>;
|
|
2157
2169
|
}
|
|
2170
|
+
/** Options for {@link HttpRouteBuilder.cacheControl}. */
|
|
2171
|
+
interface HttpRouteCacheOptions {
|
|
2172
|
+
/**
|
|
2173
|
+
* Request headers this app authenticates on beyond the built-in ones, as
|
|
2174
|
+
* `RestCachePolicy.credentialHeaders` declares them for a REST endpoint. A
|
|
2175
|
+
* request carrying one gets the `private` narrowing.
|
|
2176
|
+
*/
|
|
2177
|
+
readonly credentialHeaders?: ReadonlyArray<string>;
|
|
2178
|
+
}
|
|
2158
2179
|
/** Opens a fresh {@link HttpRouteBuilder}. The `path` documents intent; hono owns the actual routing at mount. */
|
|
2159
2180
|
type HttpRouteFactory = (path: string) => HttpRouteBuilder<EmptyArgs, EmptyArgs, EmptyArgs>;
|
|
2160
2181
|
/** The verb-keyed entry point: `httpRoute.get("/api/todos")…`. */
|
|
@@ -4485,7 +4506,7 @@ type RegisteredWhisperAuthorizer = RegisteredFunction<Record<string, never>, boo
|
|
|
4485
4506
|
*/
|
|
4486
4507
|
declare const onWhisper: (handler: WhisperAuthorizeHandler) => RegisteredWhisperAuthorizer;
|
|
4487
4508
|
declare const VERSION = "0.0.0";
|
|
4488
|
-
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 DefineRoomOptions, type DefineStorageRuleInput, type DefineWebSocketOptions, 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 LivePublishOptions, type LivePublisher, type LiveRouterApp, type LiveRouterFallback, type LiveStream, type LiveStreamConfig, type LiveStreamMount, type LiveSubscribeHandler, type LiveSubscribeOptions, type LiveTopicDeclaration, type LiveTopicKey, type LiveTopicPayload, type LiveTopicRef, type LiveTopics, 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 MigrationCovers, 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, PROCEDURE_META, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PolicyMiddleware, 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 RegisteredInternalAction, type RegisteredInternalMutation, type RegisteredInternalQuery, type RegisteredInternalStream, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredRoom, type RegisteredShape, type RegisteredStream, type RegisteredWebSocket, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsContextIn, type RlsOptions, type RlsReadRegistry, type Role, type RoomJoinHandler, type RoomLeaveHandler, type RoomMessageHandler, type RoomMessageOf, type RoomSocket, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardFetch, type ShardFetchInit, 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, UNLOADED_META, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WebSocketCloseHandler, type WebSocketHandle, type WebSocketMessageHandler, type WebSocketOpenHandler, 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, defineLazyFacade, defineListArgs, defineLiveStream, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineRoom, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, defineWebSocket, deny, documentHistoryExtension, flushDeferredDeletes,
|
|
4509
|
+
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 DefineRoomOptions, type DefineStorageRuleInput, type DefineWebSocketOptions, 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 HttpRouteCacheOptions, 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 LivePublishOptions, type LivePublisher, type LiveRouterApp, type LiveRouterFallback, type LiveStream, type LiveStreamConfig, type LiveStreamMount, type LiveSubscribeHandler, type LiveSubscribeOptions, type LiveTopicDeclaration, type LiveTopicKey, type LiveTopicPayload, type LiveTopicRef, type LiveTopics, 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 MigrationCovers, 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, PROCEDURE_META, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PolicyMiddleware, 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 RegisteredInternalAction, type RegisteredInternalMutation, type RegisteredInternalQuery, type RegisteredInternalStream, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredRoom, type RegisteredShape, type RegisteredStream, type RegisteredWebSocket, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsContextIn, type RlsOptions, type RlsReadRegistry, type Role, type RoomJoinHandler, type RoomLeaveHandler, type RoomMessageHandler, type RoomMessageOf, type RoomSocket, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardFetch, type ShardFetchInit, 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, UNLOADED_META, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WebSocketCloseHandler, type WebSocketHandle, type WebSocketMessageHandler, type WebSocketOpenHandler, 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, defineLazyFacade, defineListArgs, defineLiveStream, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineRoom, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, defineWebSocket, deny, documentHistoryExtension, flushDeferredDeletes,
|
|
4489
4510
|
/**
|
|
4490
4511
|
* True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
|
|
4491
4512
|
* NUL. Guards against response-header injection / `Headers`-construction throws
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Validator, Infer, ColumnValidator, Id, StringColumnValidator, ValidatorMap, InferValidatorMap } from '@lunora/values';
|
|
2
2
|
export { type ColumnValidator, type GeoPoint, type Id, type Infer, ValidationError, type Validator, type ValidatorKind, v } from '@lunora/values';
|
|
3
|
-
import { A as ArgsValidator, I as InferArgs, R as RegisteredAction, E as ExposeConfig, X as X402ProcedureConfig, b as ActionCtx, c as RegisteredInternalAction, M as MutationCtx, d as RegisteredInternalMutation, Q as QueryCtx, e as RegisteredInternalQuery, f as DurableStreamOptions, g as RegisteredInternalStream, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, F as FunctionKind, T as TableDefinition, k as RegisteredFunction, V as VectorIndexDefinition, S as Schema, l as AggregateOp, G as GlobalBackend, K as KeyedRelationDefinition, m as RelationThrough, n as ThroughRelationDefinition, O as OnDeleteAction, o as RelationDefinition, p as SearchLanguage, q as SearchStrategy, r as ExternalSourceDefinition, s as TriggerBuilder, t as TriggerDefinition, u as VectorEmbedder, v as VectorMetric, w as DurableObjectJurisdiction, x as AggregateIndexDefinition, y as RankIndexDefinition, z as Secrets, B as LiveTopicRef, C as LifecycleEvent, H as ShardInitEvent, J as RegisteredLifecycleHook, W as WhisperEvent } from "./packem_shared/types.d-
|
|
4
|
-
export type { N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, a1 as IndexDefinition, a2 as IndexRangeBuilder, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, a9 as MutationStorage, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, ad as RankSortKey, ae as ReadOnlyStorage, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, au as SearchFilterBuilder, av as SearchIndexDefinition, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, aU as TableReader, aV as TableVectorIndex, aW as TriggerAggregateOptions, aX as TriggerCtx, aY as TriggerDatabase, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, bd as VectorMatch, be as VectorMatches, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows } from "./packem_shared/types.d-
|
|
3
|
+
import { A as ArgsValidator, I as InferArgs, R as RegisteredAction, E as ExposeConfig, X as X402ProcedureConfig, b as ActionCtx, c as RegisteredInternalAction, M as MutationCtx, d as RegisteredInternalMutation, Q as QueryCtx, e as RegisteredInternalQuery, f as DurableStreamOptions, g as RegisteredInternalStream, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, F as FunctionKind, T as TableDefinition, k as RegisteredFunction, V as VectorIndexDefinition, S as Schema, l as AggregateOp, G as GlobalBackend, K as KeyedRelationDefinition, m as RelationThrough, n as ThroughRelationDefinition, O as OnDeleteAction, o as RelationDefinition, p as SearchLanguage, q as SearchStrategy, r as ExternalSourceDefinition, s as TriggerBuilder, t as TriggerDefinition, u as VectorEmbedder, v as VectorMetric, w as DurableObjectJurisdiction, x as AggregateIndexDefinition, y as RankIndexDefinition, z as Secrets, B as LiveTopicRef, C as LifecycleEvent, H as ShardInitEvent, J as RegisteredLifecycleHook, W as WhisperEvent } from "./packem_shared/types.d-Dc9s10Ya.js";
|
|
4
|
+
export type { N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, a1 as IndexDefinition, a2 as IndexRangeBuilder, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, a9 as MutationStorage, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, ad as RankSortKey, ae as ReadOnlyStorage, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, au as SearchFilterBuilder, av as SearchIndexDefinition, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, aU as TableReader, aV as TableVectorIndex, aW as TriggerAggregateOptions, aX as TriggerCtx, aY as TriggerDatabase, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, bd as VectorMatch, be as VectorMatches, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows } from "./packem_shared/types.d-Dc9s10Ya.js";
|
|
5
5
|
import { LunoraError } from '@lunora/errors';
|
|
6
6
|
export { LunoraError, type LunoraErrorCode } from '@lunora/errors';
|
|
7
7
|
import { Context, Hono, ExecutionContext } from 'hono';
|
|
@@ -2123,8 +2123,20 @@ interface HttpRouteBuilder<SearchParams extends ArgsValidator, Body extends Args
|
|
|
2123
2123
|
/**
|
|
2124
2124
|
* Attach a `Cache-Control` header to the response. Only meaningful when
|
|
2125
2125
|
* Workers Cache is enabled in `wrangler.jsonc` (`"cache": { "enabled": true }`).
|
|
2126
|
+
*
|
|
2127
|
+
* Sent as written to an anonymous caller. When the request carries a
|
|
2128
|
+
* credential (`Authorization`, `Cookie`, `Cf-Access-Jwt-Assertion`, an x402
|
|
2129
|
+
* payment header, a Cloudflare Access identity, or one of
|
|
2130
|
+
* `options.credentialHeaders`), a value without a bare `private` or
|
|
2131
|
+
* `no-store` is sent as `private`, with `public`, `s-maxage`,
|
|
2132
|
+
* `proxy-revalidate` and a field-qualified `private="…"` removed.
|
|
2133
|
+
*
|
|
2134
|
+
* Only those credentials are recognised. An app that authenticates on
|
|
2135
|
+
* another header (`x-api-key`, a tenant header) must list it in
|
|
2136
|
+
* `options.credentialHeaders`, or its callers read as anonymous and get the
|
|
2137
|
+
* declared value, `public` included.
|
|
2126
2138
|
*/
|
|
2127
|
-
cacheControl: (value: string) => HttpRouteBuilder<SearchParams, Body, Params, Output>;
|
|
2139
|
+
cacheControl: (value: string, options?: HttpRouteCacheOptions) => HttpRouteBuilder<SearchParams, Body, Params, Output>;
|
|
2128
2140
|
/**
|
|
2129
2141
|
* Attach a `Cache-Tag` header to the response for tag-based purging via
|
|
2130
2142
|
* `ctx.cache.purge({ tags: [...] })`.
|
|
@@ -2155,6 +2167,15 @@ interface HttpRouteBuilder<SearchParams extends ArgsValidator, Body extends Args
|
|
|
2155
2167
|
*/
|
|
2156
2168
|
vary: (value: string) => HttpRouteBuilder<SearchParams, Body, Params, Output>;
|
|
2157
2169
|
}
|
|
2170
|
+
/** Options for {@link HttpRouteBuilder.cacheControl}. */
|
|
2171
|
+
interface HttpRouteCacheOptions {
|
|
2172
|
+
/**
|
|
2173
|
+
* Request headers this app authenticates on beyond the built-in ones, as
|
|
2174
|
+
* `RestCachePolicy.credentialHeaders` declares them for a REST endpoint. A
|
|
2175
|
+
* request carrying one gets the `private` narrowing.
|
|
2176
|
+
*/
|
|
2177
|
+
readonly credentialHeaders?: ReadonlyArray<string>;
|
|
2178
|
+
}
|
|
2158
2179
|
/** Opens a fresh {@link HttpRouteBuilder}. The `path` documents intent; hono owns the actual routing at mount. */
|
|
2159
2180
|
type HttpRouteFactory = (path: string) => HttpRouteBuilder<EmptyArgs, EmptyArgs, EmptyArgs>;
|
|
2160
2181
|
/** The verb-keyed entry point: `httpRoute.get("/api/todos")…`. */
|
|
@@ -4485,7 +4506,7 @@ type RegisteredWhisperAuthorizer = RegisteredFunction<Record<string, never>, boo
|
|
|
4485
4506
|
*/
|
|
4486
4507
|
declare const onWhisper: (handler: WhisperAuthorizeHandler) => RegisteredWhisperAuthorizer;
|
|
4487
4508
|
declare const VERSION = "0.0.0";
|
|
4488
|
-
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 DefineRoomOptions, type DefineStorageRuleInput, type DefineWebSocketOptions, 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 LivePublishOptions, type LivePublisher, type LiveRouterApp, type LiveRouterFallback, type LiveStream, type LiveStreamConfig, type LiveStreamMount, type LiveSubscribeHandler, type LiveSubscribeOptions, type LiveTopicDeclaration, type LiveTopicKey, type LiveTopicPayload, type LiveTopicRef, type LiveTopics, 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 MigrationCovers, 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, PROCEDURE_META, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PolicyMiddleware, 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 RegisteredInternalAction, type RegisteredInternalMutation, type RegisteredInternalQuery, type RegisteredInternalStream, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredRoom, type RegisteredShape, type RegisteredStream, type RegisteredWebSocket, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsContextIn, type RlsOptions, type RlsReadRegistry, type Role, type RoomJoinHandler, type RoomLeaveHandler, type RoomMessageHandler, type RoomMessageOf, type RoomSocket, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardFetch, type ShardFetchInit, 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, UNLOADED_META, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WebSocketCloseHandler, type WebSocketHandle, type WebSocketMessageHandler, type WebSocketOpenHandler, 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, defineLazyFacade, defineListArgs, defineLiveStream, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineRoom, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, defineWebSocket, deny, documentHistoryExtension, flushDeferredDeletes,
|
|
4509
|
+
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 DefineRoomOptions, type DefineStorageRuleInput, type DefineWebSocketOptions, 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 HttpRouteCacheOptions, 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 LivePublishOptions, type LivePublisher, type LiveRouterApp, type LiveRouterFallback, type LiveStream, type LiveStreamConfig, type LiveStreamMount, type LiveSubscribeHandler, type LiveSubscribeOptions, type LiveTopicDeclaration, type LiveTopicKey, type LiveTopicPayload, type LiveTopicRef, type LiveTopics, 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 MigrationCovers, 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, PROCEDURE_META, type Permission, type PlatformAdminCheck, type Plugin, type Policy, type PolicyMiddleware, 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 RegisteredInternalAction, type RegisteredInternalMutation, type RegisteredInternalQuery, type RegisteredInternalStream, type RegisteredLifecycleHook, type RegisteredMigration, type RegisteredMutation, type RegisteredMutator, type RegisteredQuery, type RegisteredReactor, type RegisteredRoom, type RegisteredShape, type RegisteredStream, type RegisteredWebSocket, type RegisteredWhisperAuthorizer, type RelationBuilder, type RelationDefinition, type RelationThrough, type RlsContextIn, type RlsOptions, type RlsReadRegistry, type Role, type RoomJoinHandler, type RoomLeaveHandler, type RoomMessageHandler, type RoomMessageOf, type RoomSocket, type Schema, type SchemaExtension, type ServiceBindingSpec, type ServiceFetcher, type ServiceRpc, type ShapeDefinition, type ShapeGuardDeclaration, type ShapeReadWhereRequest, type ShardFetch, type ShardFetchInit, 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, UNLOADED_META, VERSION, type VectorEmbedder, type VectorIndexDefinition, type VectorIndexOptions, type VectorMetric, type VectorizeOptions, type WebSocketCloseHandler, type WebSocketHandle, type WebSocketMessageHandler, type WebSocketOpenHandler, 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, defineLazyFacade, defineListArgs, defineLiveStream, defineMigration, defineModule, defineMutator, definePermission, definePlugin, definePolicies, definePolicy, definePresence, defineRankIndex, defineRole, defineRoom, defineSchema, defineSchemaExtension, defineShape, defineStorageRule, defineStorageRules, defineTable, defineVectorIndex, defineWebSocket, deny, documentHistoryExtension, flushDeferredDeletes,
|
|
4489
4510
|
/**
|
|
4490
4511
|
* True when `value` is safe to use as an HTTP header field-value: no CR, LF, or
|
|
4491
4512
|
* NUL. Guards against response-header injection / `Headers`-construction throws
|
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 f,defineActionCache as a}from"./packem_shared/ACTION_CACHE_DEFAULT_TTL_MS-DMYtb827.mjs";import{initLunora as s}from"./packem_shared/initLunora-DcvCGLL_.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 S,withDeferredDeletes as D}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as T,withDeferredSchedules as R}from"./packem_shared/beginDeferredSchedules--FVDtp-M.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as g,DOCUMENT_HISTORY_TABLE as L,defineDocumentHistory as _,documentHistoryExtension as I}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-MUPXbAHR.mjs";import{LunoraEnvError as M,defineEnv as P,redactSecrets as b}from"./packem_shared/LunoraEnvError-bkdMu_-N.mjs";import{bindOrm as O,bindTableFacade as F,defineLazyFacade as v}from"./packem_shared/bindOrm-D5mVDvbi.mjs";import{httpAction as U,httpRoute as H,httpRouter as k,lastEventId as w,sseEvent as B}from"./packem_shared/httpAction-
|
|
1
|
+
import{ACTION_CACHE_DEFAULT_TTL_MS as t,ACTION_CACHE_TABLE as i,actionCacheExtension as n,cacheKeyFor as f,defineActionCache as a}from"./packem_shared/ACTION_CACHE_DEFAULT_TTL_MS-DMYtb827.mjs";import{initLunora as s}from"./packem_shared/initLunora-DcvCGLL_.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 S,withDeferredDeletes as D}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as T,withDeferredSchedules as R}from"./packem_shared/beginDeferredSchedules--FVDtp-M.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as g,DOCUMENT_HISTORY_TABLE as L,defineDocumentHistory as _,documentHistoryExtension as I}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-MUPXbAHR.mjs";import{LunoraEnvError as M,defineEnv as P,redactSecrets as b}from"./packem_shared/LunoraEnvError-bkdMu_-N.mjs";import{bindOrm as O,bindTableFacade as F,defineLazyFacade as v}from"./packem_shared/bindOrm-D5mVDvbi.mjs";import{httpAction as U,httpRoute as H,httpRouter as k,lastEventId as w,sseEvent as B}from"./packem_shared/httpAction-Bfw3qwLG.mjs";import{serveStorageObject as W}from"./packem_shared/serveStorageObject-CLz3qhNI.mjs";import{defineIdentity as Y}from"./packem_shared/defineIdentity-DwkNKwYa.mjs";import{default as G}from"./packem_shared/defineIdentityGuard-Bt8N65Zs.mjs";import{onConnect as K,onDisconnect as Q,onShardInit as X}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{defineLiveStream as te,liveStreamRouter as ie}from"./packem_shared/defineLiveStream-q9yO3wl6.mjs";import{defineMigration as fe}from"./packem_shared/defineMigration-CXOS0Bvq.mjs";import{defineModule as de}from"./packem_shared/defineModule-OecXWM3U.mjs";import{defineMutator as me}from"./packem_shared/defineMutator-DlLFSWbO.mjs";import{platformAdmin as xe}from"./packem_shared/platformAdmin-kczXQme8.mjs";import{c as le,d as Ee,a as ue,b as Se,e as De,f as he,g as Te,h as Re,i as Ae,j as ge,k as Le,m as _e}from"./packem_shared/plugin-D0ogWCbA.mjs";import{PRESENCE_DEFAULT_TTL_MS as Ce,PRESENCE_TABLE as Me,definePresence as Pe,presenceExtension as be}from"./packem_shared/PRESENCE_DEFAULT_TTL_MS-CKPKoWy_.mjs";import{PROCEDURE_META as Oe,UNLOADED_META as Fe,procedureMeta as ve}from"./packem_shared/PROCEDURE_META-DVzrXpfa.mjs";import{protectPublic as Ue}from"./packem_shared/protectPublic-Bi5_95aP.mjs";import{onQueryChange as ke}from"./packem_shared/onQueryChange-iuLzmyPs.mjs";import{defineRoom as Be}from"./packem_shared/defineRoom-CoGi-xwm.mjs";import{createServices as We}from"./packem_shared/createServices-IJvoqi0e.mjs";import{defineShape as Ye}from"./packem_shared/defineShape-CAIsX21I.mjs";import{defineWebSocket as Ge}from"./packem_shared/defineWebSocket-BHoy6_ox.mjs";import{onWhisper as Ke}from"./packem_shared/onWhisper-CfDbFLQh.mjs";import{LunoraError as Xe}from"@lunora/errors";import{cronJobs as Ze}from"@lunora/scheduler";import{ValidationError as er,v as rr}from"@lunora/values";import{allowAll as tr,deny as ir,isDeny as nr,toWhereInput as fr}from"./packem_shared/allowAll-DkRAgItV.mjs";import{asBucketStorage as dr}from"./packem_shared/asBucketStorage-DoGYOjq3.mjs";import{assertShapesDeclareReadPolicies as mr,buildRlsReadRegistry as pr,composeShapeReadWhere as xr}from"./packem_shared/assertShapesDeclareReadPolicies-CWrMYcqw.mjs";import{buildMaskRegistry as lr}from"./packem_shared/buildMaskRegistry-DpWMtalG.mjs";import{createPolicyDsl as ur,definePermission as Sr,definePolicies as Dr,definePolicy as hr,defineRole as Tr}from"./packem_shared/createPolicyDsl-BZa6SqLJ.mjs";import{defineStorageRule as Ar,defineStorageRules as gr}from"./packem_shared/defineStorageRule-Dv4nJE0H.mjs";import{isSafeHeaderValue as _r}from"./packem_shared/isSafeHeaderValue-DswDADFy.mjs";import{mask as Cr}from"./packem_shared/mask--ZXtzCj7.mjs";import{r as Pr}from"./packem_shared/middleware-CdoC33P7.mjs";import{storageRules as yr}from"./packem_shared/storageRules-BZgB67oS.mjs";const e="0.0.0";export{t as ACTION_CACHE_DEFAULT_TTL_MS,i as ACTION_CACHE_TABLE,Z as DEFAULT_LIMIT,$ as DEFAULT_MAX_LIMIT,g as DOCUMENT_HISTORY_REDACTED_FIELDS,L as DOCUMENT_HISTORY_TABLE,M as LunoraEnvError,Xe as LunoraError,Ce as PRESENCE_DEFAULT_TTL_MS,Me as PRESENCE_TABLE,Oe as PROCEDURE_META,Fe as UNLOADED_META,e as VERSION,er as ValidationError,n as actionCacheExtension,tr as allowAll,dr as asBucketStorage,mr as assertShapesDeclareReadPolicies,u as beginDeferredDeletes,T as beginDeferredSchedules,O as bindOrm,F as bindTableFacade,lr as buildMaskRegistry,pr as buildRlsReadRegistry,f as cacheKeyFor,ee as clampLimit,le as composePluginMiddleware,xr as composeShapeReadWhere,ur as createPolicyDsl,l as createSecrets,We as createServices,Ze as cronJobs,a as defineActionCache,Ee as defineAggregateIndex,ue as defineComponent,_ as defineDocumentHistory,P as defineEnv,Y as defineIdentity,G as defineIdentityGuard,v as defineLazyFacade,re as defineListArgs,te as defineLiveStream,fe as defineMigration,de as defineModule,me as defineMutator,Sr as definePermission,Se as definePlugin,Dr as definePolicies,hr as definePolicy,Pe as definePresence,De as defineRankIndex,Tr as defineRole,Be as defineRoom,he as defineSchema,Te as defineSchemaExtension,Ye as defineShape,Ar as defineStorageRule,gr as defineStorageRules,Re as defineTable,Ae as defineVectorIndex,Ge as defineWebSocket,ir as deny,I as documentHistoryExtension,S as flushDeferredDeletes,U as httpAction,H as httpRoute,k as httpRouter,ge as indexFieldsFromSchema,s as initLunora,Le as installPlugins,nr as isDeny,p as isPerDispatchMiddleware,_r as isSafeHeaderValue,w as lastEventId,ie as liveStreamRouter,Cr as mask,_e as mergeSchemaExtension,K as onConnect,Q as onDisconnect,ke as onQueryChange,X as onShardInit,Ke as onWhisper,xe as platformAdmin,be as presenceExtension,ve as procedureMeta,Ue as protectPublic,b as redactSecrets,Pr as rls,W as serveStorageObject,B as sseEvent,yr as storageRules,x as tagPerDispatchMiddleware,fr as toWhereInput,rr as v,D as withDeferredDeletes,R as withDeferredSchedules};
|
package/dist/otel.d.mts
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* `@opentelemetry/api` is a PEER dependency: it keeps a module-global registry,
|
|
42
42
|
* so a second copy in the tree would silently split it.
|
|
43
43
|
*/
|
|
44
|
-
import { a as SpanHandle, L as LunoraTracer } from "./packem_shared/types.d-
|
|
44
|
+
import { a as SpanHandle, L as LunoraTracer } from "./packem_shared/types.d-Dc9s10Ya.mjs";
|
|
45
45
|
import '@lunora/values';
|
|
46
46
|
/**
|
|
47
47
|
* @since 1.0.0
|
package/dist/otel.d.ts
CHANGED
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
* `@opentelemetry/api` is a PEER dependency: it keeps a module-global registry,
|
|
42
42
|
* so a second copy in the tree would silently split it.
|
|
43
43
|
*/
|
|
44
|
-
import { a as SpanHandle, L as LunoraTracer } from "./packem_shared/types.d-
|
|
44
|
+
import { a as SpanHandle, L as LunoraTracer } from "./packem_shared/types.d-Dc9s10Ya.js";
|
|
45
45
|
import '@lunora/values';
|
|
46
46
|
/**
|
|
47
47
|
* @since 1.0.0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraError as O,isLunoraError as I}from"@lunora/errors";import{isStringValidator as P,parseValidatorMap as b}from"@lunora/values";import{Hono as g}from"hono";import{isHttpRouter as j,httpRouter as C,httpAction as E}from"./httpAction-
|
|
1
|
+
import{LunoraError as O,isLunoraError as I}from"@lunora/errors";import{isStringValidator as P,parseValidatorMap as b}from"@lunora/values";import{Hono as g}from"hono";import{isHttpRouter as j,httpRouter as C,httpAction as E}from"./httpAction-Bfw3qwLG.mjs";const A="/_lunora/live/connect",N="/_lunora/live/control",D="room:",B="__lunora_socket__:",K=256,m=e=>`/live/${e}/connect`,v=e=>`/live/${e}/control`,U=/^[A-Za-z]\w*$/u,T=e=>U.test(e),H=e=>`${e}:`.startsWith(D)||`${e}:`.startsWith(B),V=(e,t,o)=>[e,...t.map(d=>{const i=o[d];if(typeof i!="string")throw new TypeError(`live topic "${e}" needs a string key.${d}`);return encodeURIComponent(i)})].join(":"),k=(e,t)=>{if(e.length>K)return;const[o,...d]=e.split(":");if(o===void 0||!Object.hasOwn(t,o))return;const i=t[o];if(d.length!==i.length)return;const r={};try{for(const[c,u]of i.entries())r[u]=decodeURIComponent(d[c]);return V(o,i,r)===e?{key:r,name:o}:void 0}catch{return}},F=async e=>{try{const t=await e.json();return typeof t=="object"&&t!==null&&!Array.isArray(t)?t:void 0}catch{return}},S=e=>Response.json({code:"FORBIDDEN_TOPIC",error:`subscribe to "${e}" was denied`},{status:403}),h=e=>Response.json({code:"BAD_REQUEST",error:e},{status:400}),M=(e,t)=>{for(const[o,d]of Object.entries(t)){if(!T(o))throw new TypeError(`defineLiveStream("${e}"): topic name "${o}" must be a plain identifier (letters, digits and "_", starting with a letter)`);if(H(o))throw new TypeError(`defineLiveStream("${e}"): topic name "${o}" would encode into a reserved topic prefix`);for(const[i,r]of Object.entries(d.key??{})){if(!T(i))throw new TypeError(`defineLiveStream("${e}"): key field "${o}.${i}" must be a plain identifier`);if(!P(r))throw new TypeError(`defineLiveStream("${e}"): key field "${o}.${i}" must be a string validator (v.string(), v.id(), v.literal(…))`)}}},z=(e,t)=>new O("BAD_REQUEST",`publish to "${e}" was refused: ${t instanceof Error?t.message:String(t)}`,{status:400}),q=e=>{M(e.id,e.topics);const t=m(e.id),o=v(e.id),d=Object.fromEntries(Object.entries(e.topics).map(([s,a])=>[s,Object.keys(a.key??{})])),i=s=>{const a=k(s,d),n=a===void 0?void 0:e.topics[a.name];if(!(a===void 0||n===void 0))try{return{declaration:n,key:b(n.key??{},a.key,"key"),name:a.name}}catch{return}},r=(s,a)=>{const n=i(s);if(n===void 0)throw new O("BAD_REQUEST",`"${s}" is not a topic declared by live stream "${e.id}"`,{status:400});const{declaration:p}=n;try{return b({payload:p.payload},{payload:a},"topic").payload}catch(f){throw z(s,f)}},c=async(s,a)=>{const n=i(a);if(n===void 0)return!1;if(!e.onSubscribe)return e.allowAnonymousControl===!0&&s.auth.userId===null;try{return await e.onSubscribe({ctx:s,key:n.key,raw:a,topic:n.name})===!0}catch(p){return console.error("[lunora] live subscribe authorization threw; denying:",p),!1}},u=E(async(s,a)=>{const n=new URL(a.url).searchParams.get("shard")??void 0;return s.fetchShard(n,A,{method:"GET"})}),R=E(async(s,a)=>{const n=await F(a);if(!n)return h("Expected a JSON object body");const{action:p}=n,f=typeof n.topic=="string"?n.topic:void 0;if(f===void 0||f.length===0)return h("topic is required");if(p!=="subscribe"&&p!=="unsubscribe")return h("action must be subscribe or unsubscribe");const y=typeof n.shardKey=="string"?n.shardKey:void 0,L=y===void 0?s:{...s,...s.forShard(y)};if(p==="subscribe"&&!await c(L,f))return S(f);const w=s.fetchShard(y,N,{body:JSON.stringify({...n,stream:e.id}),method:"POST"});if(p!=="subscribe")return w;try{return await w}catch(l){if(I(l)&&l.code==="FORBIDDEN_SHARD")return S(f);throw l}});return{connect:u,connectPath:t,control:R,controlPath:o,id:e.id,topics:e.topics,validatePublish:r}},G=e=>typeof e!="object"?{}:{...typeof e.email=="function"?{email:e.email}:{},...typeof e.queue=="function"?{queue:e.queue}:{},...typeof e.scheduled=="function"?{scheduled:e.scheduled}:{}},_=new WeakMap,$=(e,t)=>{for(const o of t){let d;const i=()=>(d??=o.load().catch(r=>{throw d=void 0,r}),d);e.get(m(o.id),async r=>{const{connect:c}=await i();return c(r)}),e.post(v(o.id),async r=>{const{control:c}=await i();return c(r)})}},Y=(e,t)=>{if(t instanceof g&&j(t)){const r=_.get(t)??new Set,c=e.filter(u=>!r.has(u.id));$(t,c),_.set(t,r);for(const u of c)r.add(u.id);return t}const o=C();if($(o,e),t===void 0)return o;const d=new Set(e.flatMap(r=>[`GET ${m(r.id)}`,`POST ${v(r.id)}`])),i=(r,c,u)=>typeof t=="function"?t(r,c,u):t.fetch(r,c,u);return{...G(t),fetch:(r,c,u)=>d.has(`${r.method} ${new URL(r.url).pathname}`)?o.fetch(r,c,u):i(r,c,u)}};export{q as defineLiveStream,Y as liveStreamRouter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as f,isLunoraError as I,toErrorBody as C}from"@lunora/errors";import{ValidationError as M,parseValidatorMap as v}from"@lunora/values";import{encodeWire as S}from"@lunora/wire";import{Hono as H}from"hono";import{SSE_HEADERS as A,sseFrame as w,isSafeHeaderValue as U}from"./isSafeHeaderValue-DswDADFy.mjs";import{a as R}from"./apply-output-C5wZ5EAL.mjs";import{isDevEnvironment as $}from"@lunora/shard-engine";const O=["authorization","cf-access-jwt-assertion","cookie","payment-signature","x-payment"],B=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u,T=e=>B.test(e),V=(e,r,t=[])=>r?.access!==void 0||O.some(n=>e.has(n))||t.some(n=>!T(n)||e.has(n)),W=e=>{const r=[];let t="",n=!1,o=!1;for(const a of e){if(o)o=!1;else if(n&&a==="\\")o=!0;else if(a==='"')n=!n;else if(a===","&&!n){r.push(t.trim()),t="";continue}t+=a}return r.push(t.trim()),r.filter(a=>a!=="")},J=new Set(["proxy-revalidate","public","s-maxage"]),Q=e=>{const r=W(e),t=r.map(o=>o.toLowerCase());return t.includes("private")||t.includes("no-store")?e:["private",...r.filter((o,a)=>{const s=(t[a]?.split("=",1)[0]??"").trim();return!J.has(s)&&s!=="private"})].join(", ")},N=new WeakSet,z=e=>{try{return e.executionCtx}catch{return}},G=(e,r)=>[...O,...r].find(t=>e.has(t))??"cloudflare access",K=(e,r,t)=>{const{headers:n}=t.req.raw,o=e.credentialHeaders??[];if(!V(n,z(t),o))return r;const a=Q(r);return a!==r&&!N.has(e)&&$(t.env)&&(N.add(e),console.warn(`[lunora] httpRoute ${e.method} ${e.path}: sent Cache-Control "${a}" instead of the declared "${r}" because the request carries a credential (${G(n,o)}). A shared cache must not store a per-caller response. Further downgrades on this route are not reported.`)),a},g=e=>{if(e instanceof M)return Response.json({code:"BAD_REQUEST",error:e.message},{status:400});if(I(e)){const{body:r,redacted:t,status:n}=C(e,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});return t&&console.error("[lunora] http action error (redacted on the wire):",e),Response.json({code:r.code,error:r.message,...r.why===void 0?{}:{why:r.why}},{status:n})}throw e},fe=e=>async r=>{try{return await e(r.get("lunora"),r.req.raw)}catch(t){return g(t)}},_=new WeakSet,k=new WeakSet,ye=e=>k.has(e),L=new WeakSet,Z=new Set(["*","/*"]),X="__COMPOSED_HANDLER",Y=e=>e[X]??e,ee=e=>{let r,t=-1;return async n=>{if(r===void 0||t!==e.routes.length){const a=new H;for(const s of e.routes)L.has(Y(s.handler))||a.on(s.method,s.path,()=>new Response(null,{status:204}));r=a,t=e.routes.length}return(await r.fetch(new Request(n.url,{method:n.method}))).status===204}},Ee=()=>{const e=new H,r=ee(e),t=e.use.bind(e);k.add(e),e.use=((...o)=>{const[a]=o;if(typeof a!="string"||Z.has(a))for(const s of o)typeof s=="function"&&L.add(s);return t(...o)}),e.use("*",async(o,a)=>{const s=o.env.__lunoraCtx;if(!s)throw new f("INTERNAL_SERVER_ERROR","HttpActionCtx was not injected — mount httpRouter() on createWorker(), which supplies it per request.");o.set("lunora",s);const{__lunoraShellFirst:i,__lunoraUnrouted:u}=o.env;if(i===!0&&!await r(o.req.raw))return u?.(),o.text("404 Not Found",404);const c=o.notFound;o.notFound=()=>(_.add(o),c()),await a()});const n=e.notFound;return e.notFound=o=>n(a=>{const{__lunoraUnrouted:s}=a.env;return _.has(a)||s?.(),o(a)}),e.notFound(o=>o.text("404 Not Found",404)),e},P=e=>e.kind==="optional"?e._meta?.inner??e:e,b=(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}},re=(e,r,t)=>{const n=P(e);if(n.kind==="array"){const a=r.req.queries(t);if(a===void 0)return;const s=n._meta?.inner;return a.map(i=>b(s?.kind??"string",i))}const o=r.req.query(t);return o===void 0?void 0:b(n.kind,o)},j=(e,r)=>{const t={};for(const n of Object.keys(e)){const o=e[n];o&&(t[n]=re(o,r,n))}return v(e,t,"searchParams")},D=(e,r)=>{const t=r.req.param(),n={};for(const o of Object.keys(e)){const a=e[o];if(!a)continue;const s=t[o];n[o]=s===void 0?void 0:b(P(a).kind,s)}return v(e,n,"params")},te=async(e,r)=>{let t;try{t=await r.req.json()}catch{throw new f("BAD_REQUEST","Invalid JSON body")}if(typeof t!="object"||t===null||Array.isArray(t))throw new f("BAD_REQUEST","Expected a JSON object body");return v(e,t,"body")},x=(e,r)=>{const{method:t}=r.req;if(!(t===e.method||e.method==="GET"&&t==="HEAD"))return Response.json({code:"METHOD_NOT_ALLOWED",error:`${t} is not allowed on this route (declared as ${e.method})`},{headers:{allow:e.method},status:405})},oe=(e,r)=>async t=>{const n=x(e,t);if(n)return n;try{const o=t.get("lunora"),a=Object.keys(e.searchParams).length>0?j(e.searchParams,t):{},s=Object.keys(e.params).length>0?D(e.params,t):{},i=Object.keys(e.body).length>0?await te(e.body,t):{},u=await r({body:i,ctx:o,params:s,searchParams:a}),c=e.output?R(e.output,u):u,d={};e.cacheControl&&(d["cache-control"]=K(e,e.cacheControl,t)),e.cacheTag&&(d["cache-tag"]=e.cacheTag),e.vary&&(d.vary=e.vary);const y=Object.keys(d).length>0;return c===void 0?new Response(null,{headers:y?d:void 0,status:204}):Response.json(c,{headers:y?d:void 0})}catch(o){return g(o)}},we=e=>{const r=e.headers.get("last-event-id");if(r!==null)return r===""?void 0:r;const t=new URL(e.url).searchParams.get("lastEventId");return t===null||t===""?void 0:t},q=Symbol.for("@lunora/server/sse-event"),Re=e=>({[q]:!0,data:e.data,id:e.id}),ne=e=>typeof e=="object"&&e!==null&&e[q]===!0,ae=(e,r)=>{if(ne(r)){if(!U(r.id))throw new f("INTERNAL","sseEvent id must not contain CR, LF or NUL");const t=e?R(e,r.data):r.data;return w(S(t),void 0,r.id)}return w(S(e?R(e,r):r))},se=(e,r)=>(async t=>{const n=x(e,t);if(n)return n;let o,a;try{o=Object.keys(e.searchParams).length>0?j(e.searchParams,t):{},a=Object.keys(e.params).length>0?D(e.params,t):{}}catch(p){return g(p)}const s=t.get("lunora"),i=t.req.raw,u=new TextEncoder,c=new AbortController;if(i.signal.aborted)return c.abort(),new Response("",{headers:A});const d=()=>{c.abort()};i.signal.addEventListener("abort",d,{once:!0});const y=new ReadableStream({cancel(){i.signal.removeEventListener("abort",d),c.abort()},async start(p){try{const E=r({ctx:s,params:a,request:i,searchParams:o,signal:c.signal});for await(const m of E){if(c.signal.aborted)break;p.enqueue(u.encode(ae(e.output,m)))}c.signal.aborted||p.enqueue(u.encode(w({},"complete")))}catch(E){const{body:m,redacted:F}=C(E,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});F&&console.error("[lunora] unhandled stream handler error:",E),c.signal.aborted||p.enqueue(u.encode(w({code:m.code,hint:m.hint,message:m.message,why:m.why},"error")))}finally{i.signal.removeEventListener("abort",d);try{p.close()}catch{}}}});return new Response(y,{headers:A})}),ce=e=>{const r=e?.find(t=>!T(t));if(r!==void 0)throw new f("INTERNAL",`httpRoute .cacheControl(): credentialHeaders entry ${JSON.stringify(r)} is not a header name`);return e},l=e=>({body:r=>l({...e,body:{...e.body,...r}}),cacheControl:(r,t)=>l({...e,cacheControl:r,credentialHeaders:ce(t?.credentialHeaders)}),cacheTag:r=>l({...e,cacheTag:r}),handler:r=>oe(e,r),output:r=>l({...e,output:r}),params:r=>l({...e,params:{...e.params,...r}}),searchParams:r=>l({...e,searchParams:{...e.searchParams,...r}}),stream:r=>se(e,r),vary:r=>l({...e,vary:r})}),h=e=>r=>l({body:{},method:e,params:{},path:r,searchParams:{}}),be={delete:h("DELETE"),get:h("GET"),head:h("HEAD"),options:h("OPTIONS"),patch:h("PATCH"),post:h("POST"),put:h("PUT")};export{fe as httpAction,be as httpRoute,Ee as httpRouter,ye as isHttpRouter,U as isSafeHeaderValue,we as lastEventId,Re as sseEvent};
|
|
@@ -915,19 +915,26 @@ interface X402ProcedureConfig {
|
|
|
915
915
|
* turns this into `Cache-Control` / `Cache-Tag` / `Vary` response headers, and a
|
|
916
916
|
* `cache.tag` is purgeable through `ctx.cache.purge({ tags: [...] })`.
|
|
917
917
|
*
|
|
918
|
-
*
|
|
919
|
-
* value
|
|
920
|
-
*
|
|
918
|
+
* `httpRoute(...).cacheControl()` applies the same credential downgrade to a
|
|
919
|
+
* free-form value, but is NOT equivalent: it does not fold credential headers
|
|
920
|
+
* into `Vary`, refuse a non-`GET` exchange, or keep a credentialed response out
|
|
921
|
+
* of the edge store. This is the guarded surface.
|
|
921
922
|
*
|
|
922
923
|
* Caching a procedure whose result depends on the caller is how a REST cache
|
|
923
924
|
* turns into a data leak, so `scope` is enforced at runtime rather than trusted:
|
|
924
|
-
* a request that carries credentials (
|
|
925
|
-
*
|
|
925
|
+
* a request that carries credentials (`Authorization`, any `Cookie`,
|
|
926
|
+
* `Cf-Access-Jwt-Assertion`, an x402 payment header, a Cloudflare Access
|
|
927
|
+
* identity, or a declared `credentialHeaders` name) is ALWAYS answered
|
|
928
|
+
* `private`, even under `scope: "public"` — see
|
|
926
929
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Headers/Cache-Control MDN}
|
|
927
|
-
* for what `private` forbids. So a per-user response
|
|
928
|
-
* shared
|
|
929
|
-
*
|
|
930
|
-
*
|
|
930
|
+
* for what `private` forbids. So a per-user response is never stored by a
|
|
931
|
+
* shared cache that honours `Cache-Control` (the runtime's own edge cache skips
|
|
932
|
+
* credentialed requests outright), and the worst a mis-declared `scope` costs
|
|
933
|
+
* there is a missed hit; a browser's private cache may still keep it, which is
|
|
934
|
+
* what `private` allows. `scope: "public"` additionally lists those credential
|
|
935
|
+
* headers in `Vary`, so an intermediary that honours `Vary` won't hand a stored
|
|
936
|
+
* anonymous variant to a signed-in caller. A cache that ignores `Vary` or
|
|
937
|
+
* `Cache-Control` is outside what response headers can govern.
|
|
931
938
|
*
|
|
932
939
|
* Only ever applied to a cacheable exchange: a `GET` (so `query` procedures — a
|
|
933
940
|
* `mutation` / `action` is `POST`-only) that produced a 2xx.
|
|
@@ -915,19 +915,26 @@ interface X402ProcedureConfig {
|
|
|
915
915
|
* turns this into `Cache-Control` / `Cache-Tag` / `Vary` response headers, and a
|
|
916
916
|
* `cache.tag` is purgeable through `ctx.cache.purge({ tags: [...] })`.
|
|
917
917
|
*
|
|
918
|
-
*
|
|
919
|
-
* value
|
|
920
|
-
*
|
|
918
|
+
* `httpRoute(...).cacheControl()` applies the same credential downgrade to a
|
|
919
|
+
* free-form value, but is NOT equivalent: it does not fold credential headers
|
|
920
|
+
* into `Vary`, refuse a non-`GET` exchange, or keep a credentialed response out
|
|
921
|
+
* of the edge store. This is the guarded surface.
|
|
921
922
|
*
|
|
922
923
|
* Caching a procedure whose result depends on the caller is how a REST cache
|
|
923
924
|
* turns into a data leak, so `scope` is enforced at runtime rather than trusted:
|
|
924
|
-
* a request that carries credentials (
|
|
925
|
-
*
|
|
925
|
+
* a request that carries credentials (`Authorization`, any `Cookie`,
|
|
926
|
+
* `Cf-Access-Jwt-Assertion`, an x402 payment header, a Cloudflare Access
|
|
927
|
+
* identity, or a declared `credentialHeaders` name) is ALWAYS answered
|
|
928
|
+
* `private`, even under `scope: "public"` — see
|
|
926
929
|
* {@link https://developer.mozilla.org/docs/Web/HTTP/Headers/Cache-Control MDN}
|
|
927
|
-
* for what `private` forbids. So a per-user response
|
|
928
|
-
* shared
|
|
929
|
-
*
|
|
930
|
-
*
|
|
930
|
+
* for what `private` forbids. So a per-user response is never stored by a
|
|
931
|
+
* shared cache that honours `Cache-Control` (the runtime's own edge cache skips
|
|
932
|
+
* credentialed requests outright), and the worst a mis-declared `scope` costs
|
|
933
|
+
* there is a missed hit; a browser's private cache may still keep it, which is
|
|
934
|
+
* what `private` allows. `scope: "public"` additionally lists those credential
|
|
935
|
+
* headers in `Vary`, so an intermediary that honours `Vary` won't hand a stored
|
|
936
|
+
* anonymous variant to a signed-in caller. A cache that ignores `Vary` or
|
|
937
|
+
* `Cache-Control` is outside what response headers can govern.
|
|
931
938
|
*
|
|
932
939
|
* Only ever applied to a cacheable exchange: a `GET` (so `query` procedures — a
|
|
933
940
|
* `mutation` / `action` is `POST`-only) that produced a 2xx.
|
package/dist/types.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { b as ActionCtx, x as AggregateIndexDefinition, l as AggregateOp, A as ArgsValidator, N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, w as DurableObjectJurisdiction, f as DurableStreamOptions, E as ExposeConfig, bs as ExternalSourceCursor, r as ExternalSourceDefinition, bt as ExternalSourceMode, bu as ExternalSourceRefresh, F as FunctionKind, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, G as GlobalBackend, a1 as IndexDefinition, a2 as IndexRangeBuilder, I as InferArgs, K as KeyedRelationDefinition, C as LifecycleEvent, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, M as MutationCtx, a9 as MutationStorage, O as OnDeleteAction, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, Q as QueryCtx, y as RankIndexDefinition, ad as RankSortKey, ae as ReadOnlyStorage, R as RegisteredAction, k as RegisteredFunction, c as RegisteredInternalAction, d as RegisteredInternalMutation, e as RegisteredInternalQuery, g as RegisteredInternalStream, J as RegisteredLifecycleHook, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, o as RelationDefinition, m as RelationThrough, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, S as Schema, au as SearchFilterBuilder, av as SearchIndexDefinition, p as SearchLanguage, q as SearchStrategy, z as Secrets, bv as SecretsStoreSecretLike, H as ShardInitEvent, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, T as TableDefinition, aU as TableReader, aV as TableVectorIndex, n as ThroughRelationDefinition, aW as TriggerAggregateOptions, s as TriggerBuilder, aX as TriggerCtx, aY as TriggerDatabase, t as TriggerDefinition, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, u as VectorEmbedder, V as VectorIndexDefinition, bd as VectorMatch, be as VectorMatches, v as VectorMetric, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, W as WhisperEvent, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows, X as X402ProcedureConfig } from "./packem_shared/types.d-
|
|
1
|
+
export type { b as ActionCtx, x as AggregateIndexDefinition, l as AggregateOp, A as ArgsValidator, N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, w as DurableObjectJurisdiction, f as DurableStreamOptions, E as ExposeConfig, bs as ExternalSourceCursor, r as ExternalSourceDefinition, bt as ExternalSourceMode, bu as ExternalSourceRefresh, F as FunctionKind, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, G as GlobalBackend, a1 as IndexDefinition, a2 as IndexRangeBuilder, I as InferArgs, K as KeyedRelationDefinition, C as LifecycleEvent, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, M as MutationCtx, a9 as MutationStorage, O as OnDeleteAction, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, Q as QueryCtx, y as RankIndexDefinition, ad as RankSortKey, ae as ReadOnlyStorage, R as RegisteredAction, k as RegisteredFunction, c as RegisteredInternalAction, d as RegisteredInternalMutation, e as RegisteredInternalQuery, g as RegisteredInternalStream, J as RegisteredLifecycleHook, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, o as RelationDefinition, m as RelationThrough, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, S as Schema, au as SearchFilterBuilder, av as SearchIndexDefinition, p as SearchLanguage, q as SearchStrategy, z as Secrets, bv as SecretsStoreSecretLike, H as ShardInitEvent, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, T as TableDefinition, aU as TableReader, aV as TableVectorIndex, n as ThroughRelationDefinition, aW as TriggerAggregateOptions, s as TriggerBuilder, aX as TriggerCtx, aY as TriggerDatabase, t as TriggerDefinition, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, u as VectorEmbedder, V as VectorIndexDefinition, bd as VectorMatch, be as VectorMatches, v as VectorMetric, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, W as WhisperEvent, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows, X as X402ProcedureConfig } from "./packem_shared/types.d-Dc9s10Ya.mjs";
|
|
2
2
|
import '@lunora/values';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type { b as ActionCtx, x as AggregateIndexDefinition, l as AggregateOp, A as ArgsValidator, N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, w as DurableObjectJurisdiction, f as DurableStreamOptions, E as ExposeConfig, bs as ExternalSourceCursor, r as ExternalSourceDefinition, bt as ExternalSourceMode, bu as ExternalSourceRefresh, F as FunctionKind, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, G as GlobalBackend, a1 as IndexDefinition, a2 as IndexRangeBuilder, I as InferArgs, K as KeyedRelationDefinition, C as LifecycleEvent, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, M as MutationCtx, a9 as MutationStorage, O as OnDeleteAction, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, Q as QueryCtx, y as RankIndexDefinition, ad as RankSortKey, ae as ReadOnlyStorage, R as RegisteredAction, k as RegisteredFunction, c as RegisteredInternalAction, d as RegisteredInternalMutation, e as RegisteredInternalQuery, g as RegisteredInternalStream, J as RegisteredLifecycleHook, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, o as RelationDefinition, m as RelationThrough, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, S as Schema, au as SearchFilterBuilder, av as SearchIndexDefinition, p as SearchLanguage, q as SearchStrategy, z as Secrets, bv as SecretsStoreSecretLike, H as ShardInitEvent, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, T as TableDefinition, aU as TableReader, aV as TableVectorIndex, n as ThroughRelationDefinition, aW as TriggerAggregateOptions, s as TriggerBuilder, aX as TriggerCtx, aY as TriggerDatabase, t as TriggerDefinition, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, u as VectorEmbedder, V as VectorIndexDefinition, bd as VectorMatch, be as VectorMatches, v as VectorMetric, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, W as WhisperEvent, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows, X as X402ProcedureConfig } from "./packem_shared/types.d-
|
|
1
|
+
export type { b as ActionCtx, x as AggregateIndexDefinition, l as AggregateOp, A as ArgsValidator, N as AuthState, P as CachePurge, U as DatabaseReader, D as DatabaseWriter, w as DurableObjectJurisdiction, f as DurableStreamOptions, E as ExposeConfig, bs as ExternalSourceCursor, r as ExternalSourceDefinition, bt as ExternalSourceMode, bu as ExternalSourceRefresh, F as FunctionKind, Y as FunctionVisibility, Z as GeoBoundingBox, _ as GeoFilterBuilder, $ as GeoIndexDefinition, a0 as GeoPointInput, G as GlobalBackend, a1 as IndexDefinition, a2 as IndexRangeBuilder, I as InferArgs, K as KeyedRelationDefinition, C as LifecycleEvent, a3 as LifecycleEventKind, a4 as LogFields, a5 as LunoraLogMethod, a6 as LunoraLogger, a7 as LunoraMetrics, L as LunoraTracer, a8 as LunoraWideEvent, M as MutationCtx, a9 as MutationStorage, O as OnDeleteAction, aa as PaginationOptions, ab as PaginationResult, ac as PatchIfResult, Q as QueryCtx, y as RankIndexDefinition, ad as RankSortKey, ae as ReadOnlyStorage, R as RegisteredAction, k as RegisteredFunction, c as RegisteredInternalAction, d as RegisteredInternalMutation, e as RegisteredInternalQuery, g as RegisteredInternalStream, J as RegisteredLifecycleHook, h as RegisteredMutation, i as RegisteredQuery, j as RegisteredStream, af as RelatedDirection, ag as RelatedNode, ah as RelatedOptions, ai as RelatedPage, aj as RelatedStart, ak as RelatedStartReference, o as RelationDefinition, m as RelationThrough, al as RestCacheConfig, am as RetryPolicy, an as RunQueryOptions, ao as ScheduleRunOptions, ap as ScheduledFunctionDoc, aq as ScheduledJob, ar as ScheduledJobState, as as ScheduledJobView, at as Scheduler, S as Schema, au as SearchFilterBuilder, av as SearchIndexDefinition, p as SearchLanguage, q as SearchStrategy, z as Secrets, bv as SecretsStoreSecretLike, H as ShardInitEvent, aw as ShardMode, ax as SpanContextIds, ay as SpanEvaluation, a as SpanHandle, az as SpanIdentity, aA as SpanKind, aB as SpanLink, aC as SpanOptions, aD as Storage, aE as StorageListOptions, aF as StorageListResult, aG as StorageMetadata, aH as StorageMultipartUpload, aI as StorageMultipartUploadOptions, aJ as StorageObjectBody, aK as StorageObjectHead, aL as StorageRange, aM as StorageUploadBody, aN as StorageUploadOptions, aO as StorageUploadResult, aP as StorageUploadedPart, aQ as SystemDatabaseReader, aR as SystemDoc, aS as SystemQuery, aT as SystemTableName, T as TableDefinition, aU as TableReader, aV as TableVectorIndex, n as ThroughRelationDefinition, aW as TriggerAggregateOptions, s as TriggerBuilder, aX as TriggerCtx, aY as TriggerDatabase, t as TriggerDefinition, aZ as TriggerDeleteEvent, a_ as TriggerEvent, a$ as TriggerGroupByEntry, b0 as TriggerGroupByOptions, b1 as TriggerHandler, b2 as TriggerInsertEvent, b3 as TriggerOp, b4 as TriggerQueryArgs, b5 as TriggerQueryPage, b6 as TriggerRankOptions, b7 as TriggerRankPageOptions, b8 as TriggerRankResult, b9 as TriggerRow, ba as TriggerTiming, bb as TriggerUpdateEvent, bc as TtlDefinition, u as VectorEmbedder, V as VectorIndexDefinition, bd as VectorMatch, be as VectorMatches, v as VectorMetric, bf as VectorQueryInput, bg as VectorRecord, bh as VectorSearch, bi as VectorSearchReader, bj as VectorUpsertInput, W as WhisperEvent, bk as WorkflowCreateOptions, bl as WorkflowEventDefinition, bm as WorkflowHandle, bn as WorkflowInstance, bo as WorkflowInstanceEvent, bp as WorkflowInstanceStatus, bq as WorkflowStatusResult, br as Workflows, X as X402ProcedureConfig } from "./packem_shared/types.d-Dc9s10Ya.js";
|
|
2
2
|
import '@lunora/values';
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as E,isLunoraError as D,toErrorBody as O}from"@lunora/errors";import{ValidationError as F,parseValidatorMap as g}from"@lunora/values";import{encodeWire as S}from"@lunora/wire";import{Hono as A}from"hono";import{SSE_HEADERS as N,sseFrame as b,isSafeHeaderValue as x}from"./isSafeHeaderValue-DswDADFy.mjs";import{a as R}from"./apply-output-C5wZ5EAL.mjs";const v=e=>{if(e instanceof F)return Response.json({code:"BAD_REQUEST",error:e.message},{status:400});if(D(e)){const{body:r,redacted:t,status:n}=O(e,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});return t&&console.error("[lunora] http action error (redacted on the wire):",e),Response.json({code:r.code,error:r.message,...r.why===void 0?{}:{why:r.why}},{status:n})}throw e},re=e=>async r=>{try{return await e(r.get("lunora"),r.req.raw)}catch(t){return v(t)}},_=new WeakSet,T=new WeakSet,te=e=>T.has(e),P=new WeakSet,I=new Set(["*","/*"]),U="__COMPOSED_HANDLER",B=e=>e[U]??e,M=e=>{let r,t=-1;return async n=>{if(r===void 0||t!==e.routes.length){const a=new A;for(const s of e.routes)P.has(B(s.handler))||a.on(s.method,s.path,()=>new Response(null,{status:204}));r=a,t=e.routes.length}return(await r.fetch(new Request(n.url,{method:n.method}))).status===204}},oe=()=>{const e=new A,r=M(e),t=e.use.bind(e);T.add(e),e.use=((...o)=>{const[a]=o;if(typeof a!="string"||I.has(a))for(const s of o)typeof s=="function"&&P.add(s);return t(...o)}),e.use("*",async(o,a)=>{const s=o.env.__lunoraCtx;if(!s)throw new E("INTERNAL_SERVER_ERROR","HttpActionCtx was not injected — mount httpRouter() on createWorker(), which supplies it per request.");o.set("lunora",s);const{__lunoraShellFirst:d,__lunoraUnrouted:i}=o.env;if(d===!0&&!await r(o.req.raw))return i?.(),o.text("404 Not Found",404);const c=o.notFound;o.notFound=()=>(_.add(o),c()),await a()});const n=e.notFound;return e.notFound=o=>n(a=>{const{__lunoraUnrouted:s}=a.env;return _.has(a)||s?.(),o(a)}),e.notFound(o=>o.text("404 Not Found",404)),e},k=e=>e.kind==="optional"?e._meta?.inner??e:e,w=(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}},V=(e,r,t)=>{const n=k(e);if(n.kind==="array"){const a=r.req.queries(t);if(a===void 0)return;const s=n._meta?.inner;return a.map(d=>w(s?.kind??"string",d))}const o=r.req.query(t);return o===void 0?void 0:w(n.kind,o)},j=(e,r)=>{const t={};for(const n of Object.keys(e)){const o=e[n];o&&(t[n]=V(o,r,n))}return g(e,t,"searchParams")},L=(e,r)=>{const t=r.req.param(),n={};for(const o of Object.keys(e)){const a=e[o];if(!a)continue;const s=t[o];n[o]=s===void 0?void 0:w(k(a).kind,s)}return g(e,n,"params")},W=async(e,r)=>{let t;try{t=await r.req.json()}catch{throw new E("BAD_REQUEST","Invalid JSON body")}if(typeof t!="object"||t===null||Array.isArray(t))throw new E("BAD_REQUEST","Expected a JSON object body");return g(e,t,"body")},H=(e,r)=>{const{method:t}=r.req;if(!(t===e.method||e.method==="GET"&&t==="HEAD"))return Response.json({code:"METHOD_NOT_ALLOWED",error:`${t} is not allowed on this route (declared as ${e.method})`},{headers:{allow:e.method},status:405})},Q=(e,r)=>async t=>{const n=H(e,t);if(n)return n;try{const o=t.get("lunora"),a=Object.keys(e.searchParams).length>0?j(e.searchParams,t):{},s=Object.keys(e.params).length>0?L(e.params,t):{},d=Object.keys(e.body).length>0?await W(e.body,t):{},i=await r({body:d,ctx:o,params:s,searchParams:a}),c=e.output?R(e.output,i):i,u={};e.cacheControl&&(u["cache-control"]=e.cacheControl),e.cacheTag&&(u["cache-tag"]=e.cacheTag),e.vary&&(u.vary=e.vary);const f=Object.keys(u).length>0;return c===void 0?new Response(null,{headers:f?u:void 0,status:204}):Response.json(c,{headers:f?u:void 0})}catch(o){return v(o)}},ne=e=>{const r=e.headers.get("last-event-id");if(r!==null)return r===""?void 0:r;const t=new URL(e.url).searchParams.get("lastEventId");return t===null||t===""?void 0:t},q=Symbol.for("@lunora/server/sse-event"),ae=e=>({[q]:!0,data:e.data,id:e.id}),G=e=>typeof e=="object"&&e!==null&&e[q]===!0,J=(e,r)=>{if(G(r)){if(!x(r.id))throw new E("INTERNAL","sseEvent id must not contain CR, LF or NUL");const t=e?R(e,r.data):r.data;return b(S(t),void 0,r.id)}return b(S(e?R(e,r):r))},$=(e,r)=>(async t=>{const n=H(e,t);if(n)return n;let o,a;try{o=Object.keys(e.searchParams).length>0?j(e.searchParams,t):{},a=Object.keys(e.params).length>0?L(e.params,t):{}}catch(m){return v(m)}const s=t.get("lunora"),d=t.req.raw,i=new TextEncoder,c=new AbortController;if(d.signal.aborted)return c.abort(),new Response("",{headers:N});const u=()=>{c.abort()};d.signal.addEventListener("abort",u,{once:!0});const f=new ReadableStream({cancel(){d.signal.removeEventListener("abort",u),c.abort()},async start(m){try{const y=r({ctx:s,params:a,request:d,searchParams:o,signal:c.signal});for await(const p of y){if(c.signal.aborted)break;m.enqueue(i.encode(J(e.output,p)))}c.signal.aborted||m.enqueue(i.encode(b({},"complete")))}catch(y){const{body:p,redacted:C}=O(y,{fallbackCode:"INTERNAL_SERVER_ERROR",redactedMessage:"Internal error"});C&&console.error("[lunora] unhandled stream handler error:",y),c.signal.aborted||m.enqueue(i.encode(b({code:p.code,hint:p.hint,message:p.message,why:p.why},"error")))}finally{d.signal.removeEventListener("abort",u);try{m.close()}catch{}}}});return new Response(f,{headers:N})}),l=e=>({body:r=>l({...e,body:{...e.body,...r}}),cacheControl:r=>l({...e,cacheControl:r}),cacheTag:r=>l({...e,cacheTag:r}),handler:r=>Q(e,r),output:r=>l({...e,output:r}),params:r=>l({...e,params:{...e.params,...r}}),searchParams:r=>l({...e,searchParams:{...e.searchParams,...r}}),stream:r=>$(e,r),vary:r=>l({...e,vary:r})}),h=e=>r=>l({body:{},method:e,params:{},path:r,searchParams:{}}),se={delete:h("DELETE"),get:h("GET"),head:h("HEAD"),options:h("OPTIONS"),patch:h("PATCH"),post:h("POST"),put:h("PUT")};export{re as httpAction,se as httpRoute,oe as httpRouter,te as isHttpRouter,x as isSafeHeaderValue,ne as lastEventId,ae as sseEvent};
|