@lunora/server 1.0.0-alpha.281 → 1.0.0-alpha.283
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/data-model.d.mts +8 -3
- package/dist/data-model.d.ts +8 -3
- package/dist/in-process.d.mts +1 -1
- package/dist/in-process.d.ts +1 -1
- package/dist/in-process.mjs +1 -1
- package/dist/index.d.mts +8 -5
- package/dist/index.d.ts +8 -5
- package/dist/index.mjs +1 -1
- package/dist/otel.d.mts +1 -1
- package/dist/otel.d.ts +1 -1
- package/dist/packem_shared/DEFAULT_LIMIT-z7HB19s7.mjs +1 -0
- package/dist/packem_shared/beginDeferredSchedules-BOsY07vZ.mjs +1 -0
- package/dist/packem_shared/{types.d-CJnJltzy.d.mts → types.d--zaGh3rX.d.mts} +3 -3
- package/dist/packem_shared/{types.d-CJnJltzy.d.ts → types.d--zaGh3rX.d.ts} +3 -3
- package/dist/types.d.mts +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +3 -3
- package/dist/packem_shared/DEFAULT_LIMIT-pT_tV8R0.mjs +0 -1
- package/dist/packem_shared/beginDeferredSchedules-BTwq-NUO.mjs +0 -1
package/dist/data-model.d.mts
CHANGED
|
@@ -139,6 +139,11 @@ type OneRelationFields<RelT> = { [K in keyof RelT]: RelT[K] extends {
|
|
|
139
139
|
__field: infer Field extends string;
|
|
140
140
|
__relationKind: "one";
|
|
141
141
|
} ? Field : never; }[keyof RelT];
|
|
142
|
+
/**
|
|
143
|
+
* The `where` operand for one column. An optional column reads back absent, never `null`, yet it is stored as SQL NULL,
|
|
144
|
+
* so `null` is how a filter asks for "not set" (`IS NULL`, as `isNull: true` does).
|
|
145
|
+
*/
|
|
146
|
+
type ColumnWhere<TValue> = undefined extends TValue ? TValue | WhereOperators<TValue | null> | null : TValue | WhereOperators<TValue>;
|
|
142
147
|
/** A branded id for table `TName`. Structurally a `string` at runtime. */
|
|
143
148
|
type Id<TName extends string> = string & {
|
|
144
149
|
readonly __table: TName;
|
|
@@ -157,7 +162,7 @@ interface WhereOperators<T> {
|
|
|
157
162
|
notIn?: T[];
|
|
158
163
|
}
|
|
159
164
|
/** A typed `where` tree over a document's columns. */
|
|
160
|
-
type Where<TDocument> = PathWhere<TDocument> & { [K in keyof TDocument]?:
|
|
165
|
+
type Where<TDocument> = PathWhere<TDocument> & { [K in keyof TDocument]?: ColumnWhere<TDocument[K]>; } & {
|
|
161
166
|
AND?: Where<TDocument>[];
|
|
162
167
|
NOT?: Where<TDocument>;
|
|
163
168
|
OR?: Where<TDocument>[];
|
|
@@ -212,7 +217,7 @@ interface ManyRelationWhere<W> {
|
|
|
212
217
|
* `Where<DM[T]>` stays the column-only structural mirror for back-compat; the
|
|
213
218
|
* table facade threads `REL` through this richer form.
|
|
214
219
|
*/
|
|
215
|
-
type WhereOf<DM, REL extends Record<keyof DM, object>, T extends keyof DM> = PathWhere<DM[T]> & RelationWhere<DM, REL, T> & { [K in keyof DM[T]]?:
|
|
220
|
+
type WhereOf<DM, REL extends Record<keyof DM, object>, T extends keyof DM> = PathWhere<DM[T]> & RelationWhere<DM, REL, T> & { [K in keyof DM[T]]?: ColumnWhere<DM[T][K]>; } & {
|
|
216
221
|
AND?: WhereOf<DM, REL, T>[];
|
|
217
222
|
NOT?: WhereOf<DM, REL, T>;
|
|
218
223
|
OR?: WhereOf<DM, REL, T>[];
|
|
@@ -696,4 +701,4 @@ type InsertValues<DM, IM extends Record<keyof DM, object>, REL extends Record<ke
|
|
|
696
701
|
type DatabaseReaderFacade<DM, REL extends Record<keyof DM, object>, RANK extends Record<keyof DM, string>, SEARCH extends Record<keyof DM, string>, GEO extends Record<keyof DM, string> = Record<keyof DM, never>> = { readonly [T in keyof DM]: TableReaderFacade<DM, REL, RANK, SEARCH, T, GEO>; };
|
|
697
702
|
/** Per-table read-write facade — `ctx.db.<table>` on a `MutationCtx` / `ActionCtx`. */
|
|
698
703
|
type DatabaseWriterFacade<DM, IM extends Record<keyof DM, object>, REL extends Record<keyof DM, object>, RANK extends Record<keyof DM, string>, SEARCH extends Record<keyof DM, string>, GEO extends Record<keyof DM, string> = Record<keyof DM, never>> = { readonly [T in keyof DM]: TableWriterFacade<DM, IM, REL, RANK, SEARCH, T, GEO>; };
|
|
699
|
-
export { AggregateOp, DatabaseReaderFacade, DatabaseWriterFacade, GeoBoundingBox, GeoFilterBuilder, GeoPointInput, GeoReader, GroupByEntry, Id, InsertValues, LoadWith, ManyRelationWhere, OneRelationWhere, OrderBy, PatchValues, QueryArgs, QueryArgsOf, QueryPage, QueryPlan, RankPage, RankResult, RelationWrites, RestrictableQueryOptions, RestrictableQueryOptionsOf, SearchFilterBuilder, SearchReader, TableAggregateOptions, TableAggregateOptionsOf, TableGroupByOptions, TableGroupByOptionsOf, TableRankOptions, TableRankPageOptions, TableReaderFacade, TableWriterFacade, ToManyRelationWrite, ToOneRelationWrite, UpsertTargetOf, Where, WhereOf, WhereOperators, WithArg };
|
|
704
|
+
export { AggregateOp, ColumnWhere, DatabaseReaderFacade, DatabaseWriterFacade, GeoBoundingBox, GeoFilterBuilder, GeoPointInput, GeoReader, GroupByEntry, Id, InsertValues, LoadWith, ManyRelationWhere, OneRelationWhere, OrderBy, PatchValues, QueryArgs, QueryArgsOf, QueryPage, QueryPlan, RankPage, RankResult, RelationWrites, RestrictableQueryOptions, RestrictableQueryOptionsOf, SearchFilterBuilder, SearchReader, TableAggregateOptions, TableAggregateOptionsOf, TableGroupByOptions, TableGroupByOptionsOf, TableRankOptions, TableRankPageOptions, TableReaderFacade, TableWriterFacade, ToManyRelationWrite, ToOneRelationWrite, UpsertTargetOf, Where, WhereOf, WhereOperators, WithArg };
|
package/dist/data-model.d.ts
CHANGED
|
@@ -139,6 +139,11 @@ type OneRelationFields<RelT> = { [K in keyof RelT]: RelT[K] extends {
|
|
|
139
139
|
__field: infer Field extends string;
|
|
140
140
|
__relationKind: "one";
|
|
141
141
|
} ? Field : never; }[keyof RelT];
|
|
142
|
+
/**
|
|
143
|
+
* The `where` operand for one column. An optional column reads back absent, never `null`, yet it is stored as SQL NULL,
|
|
144
|
+
* so `null` is how a filter asks for "not set" (`IS NULL`, as `isNull: true` does).
|
|
145
|
+
*/
|
|
146
|
+
type ColumnWhere<TValue> = undefined extends TValue ? TValue | WhereOperators<TValue | null> | null : TValue | WhereOperators<TValue>;
|
|
142
147
|
/** A branded id for table `TName`. Structurally a `string` at runtime. */
|
|
143
148
|
type Id<TName extends string> = string & {
|
|
144
149
|
readonly __table: TName;
|
|
@@ -157,7 +162,7 @@ interface WhereOperators<T> {
|
|
|
157
162
|
notIn?: T[];
|
|
158
163
|
}
|
|
159
164
|
/** A typed `where` tree over a document's columns. */
|
|
160
|
-
type Where<TDocument> = PathWhere<TDocument> & { [K in keyof TDocument]?:
|
|
165
|
+
type Where<TDocument> = PathWhere<TDocument> & { [K in keyof TDocument]?: ColumnWhere<TDocument[K]>; } & {
|
|
161
166
|
AND?: Where<TDocument>[];
|
|
162
167
|
NOT?: Where<TDocument>;
|
|
163
168
|
OR?: Where<TDocument>[];
|
|
@@ -212,7 +217,7 @@ interface ManyRelationWhere<W> {
|
|
|
212
217
|
* `Where<DM[T]>` stays the column-only structural mirror for back-compat; the
|
|
213
218
|
* table facade threads `REL` through this richer form.
|
|
214
219
|
*/
|
|
215
|
-
type WhereOf<DM, REL extends Record<keyof DM, object>, T extends keyof DM> = PathWhere<DM[T]> & RelationWhere<DM, REL, T> & { [K in keyof DM[T]]?:
|
|
220
|
+
type WhereOf<DM, REL extends Record<keyof DM, object>, T extends keyof DM> = PathWhere<DM[T]> & RelationWhere<DM, REL, T> & { [K in keyof DM[T]]?: ColumnWhere<DM[T][K]>; } & {
|
|
216
221
|
AND?: WhereOf<DM, REL, T>[];
|
|
217
222
|
NOT?: WhereOf<DM, REL, T>;
|
|
218
223
|
OR?: WhereOf<DM, REL, T>[];
|
|
@@ -696,4 +701,4 @@ type InsertValues<DM, IM extends Record<keyof DM, object>, REL extends Record<ke
|
|
|
696
701
|
type DatabaseReaderFacade<DM, REL extends Record<keyof DM, object>, RANK extends Record<keyof DM, string>, SEARCH extends Record<keyof DM, string>, GEO extends Record<keyof DM, string> = Record<keyof DM, never>> = { readonly [T in keyof DM]: TableReaderFacade<DM, REL, RANK, SEARCH, T, GEO>; };
|
|
697
702
|
/** Per-table read-write facade — `ctx.db.<table>` on a `MutationCtx` / `ActionCtx`. */
|
|
698
703
|
type DatabaseWriterFacade<DM, IM extends Record<keyof DM, object>, REL extends Record<keyof DM, object>, RANK extends Record<keyof DM, string>, SEARCH extends Record<keyof DM, string>, GEO extends Record<keyof DM, string> = Record<keyof DM, never>> = { readonly [T in keyof DM]: TableWriterFacade<DM, IM, REL, RANK, SEARCH, T, GEO>; };
|
|
699
|
-
export { AggregateOp, DatabaseReaderFacade, DatabaseWriterFacade, GeoBoundingBox, GeoFilterBuilder, GeoPointInput, GeoReader, GroupByEntry, Id, InsertValues, LoadWith, ManyRelationWhere, OneRelationWhere, OrderBy, PatchValues, QueryArgs, QueryArgsOf, QueryPage, QueryPlan, RankPage, RankResult, RelationWrites, RestrictableQueryOptions, RestrictableQueryOptionsOf, SearchFilterBuilder, SearchReader, TableAggregateOptions, TableAggregateOptionsOf, TableGroupByOptions, TableGroupByOptionsOf, TableRankOptions, TableRankPageOptions, TableReaderFacade, TableWriterFacade, ToManyRelationWrite, ToOneRelationWrite, UpsertTargetOf, Where, WhereOf, WhereOperators, WithArg };
|
|
704
|
+
export { AggregateOp, ColumnWhere, DatabaseReaderFacade, DatabaseWriterFacade, GeoBoundingBox, GeoFilterBuilder, GeoPointInput, GeoReader, GroupByEntry, Id, InsertValues, LoadWith, ManyRelationWhere, OneRelationWhere, OrderBy, PatchValues, QueryArgs, QueryArgsOf, QueryPage, QueryPlan, RankPage, RankResult, RelationWrites, RestrictableQueryOptions, RestrictableQueryOptionsOf, SearchFilterBuilder, SearchReader, TableAggregateOptions, TableAggregateOptionsOf, TableGroupByOptions, TableGroupByOptionsOf, TableRankOptions, TableRankPageOptions, TableReaderFacade, TableWriterFacade, ToManyRelationWrite, ToOneRelationWrite, UpsertTargetOf, Where, WhereOf, WhereOperators, WithArg };
|
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--zaGh3rX.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--zaGh3rX.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/in-process.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{LunoraError as R}from"@lunora/errors";import{TransactionHeadroomTracker as l,runShardMigrations as p,createShardCtxDb as w,RLS_UNWRAP_SYMBOL as T}from"@lunora/shard-engine";import{beginDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-
|
|
1
|
+
import{LunoraError as R}from"@lunora/errors";import{TransactionHeadroomTracker as l,runShardMigrations as p,createShardCtxDb as w,RLS_UNWRAP_SYMBOL as T}from"@lunora/shard-engine";import{beginDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-BOsY07vZ.mjs";import{bindTableFacade as S}from"./packem_shared/bindOrm-D5mVDvbi.mjs";class y extends l{fallback=new l;scope;constructor(r){super(),this.scope=r}run(r){return this.scope===void 0?(this.fallback=new l,r()):this.scope.run(new l,r)}headroom(){return this.current().headroom()}recordRead(r){this.current().recordRead(r)}recordReadBytes(r){this.current().recordReadBytes(r)}recordDocumentRead(r,n){this.current().recordDocumentRead(r,n)}recordWrite(r){this.current().recordWrite(r)}current(){return this.scope?.getStore()??this.fallback}}const C=e=>{if(e===null||typeof e.userId!="string"||e.userId.length===0)return{claims:null,userId:null};const{userId:r,...n}=e;return{claims:Object.keys(n).length>0?n:null,userId:r}},O=(e,r)=>{const{scheduler:n,sql:a}=r,i=e;p(a,i);const c=new y(r.headroomScope),m=t=>{const o=t;for(const s of Object.keys(i.tables))o[s]=S(t,s);return t};let u=!1;const I=t=>{const o=w({auth:{identity:t.claims,userId:t.userId},enforceRls:r.enforceRls??!0,headroom:c,inTransaction:()=>u,schema:i,sql:a}),s=o[T]??o;return{database:m(o),rawDatabase:m(s)}},d=t=>{a.exec.call(a,t)};let f=Promise.resolve();return{createWriters:I,runWithBudget:t=>c.run(t),runInTransaction:t=>{const o=async()=>{const b=g({scheduler:n});d("BEGIN"),u=!0;try{const h=await t();return d("COMMIT"),u=!1,await b(!0),h}catch(h){u=!1;try{d("ROLLBACK")}catch{}throw await b(!1),h}},s=f.then(()=>c.run(o));return f=s.then(()=>{},()=>{}),s}}},k=e=>{if(typeof e!="object"||e===null)return;const{kind:r}=e;if(r==="query"||r==="mutation"||r==="action")return r},P=(e,r,n,a,i)=>{const c=k(r);if(c!==e)throw new R("INTERNAL",`expected a registered ${e}, received a ${c??"non-function"} reference`);if(!i&&r.visibility==="internal")throw new R("INTERNAL",`This ${e} is an internal function — it is unreachable from the external RPC boundary in production. Call it through ctx.run${e.charAt(0).toUpperCase()}${e.slice(1)} from another function instead.`);return Promise.resolve(r.handler(n,a??{}))};export{O as createInProcessRuntime,k as registeredFunctionKind,C as resolveInProcessIdentity,P as runRegisteredFunction};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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--zaGh3rX.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--zaGh3rX.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';
|
|
8
|
-
import {
|
|
8
|
+
import { ColumnWhere, QueryArgs as QueryArgs$2, WhereOperators, QueryPlan } from "./data-model.mjs";
|
|
9
9
|
import { W as WhereInput, a as Policy, b as RlsOptions, c as Permission, R as Role, T as TypedDefinePolicyInput, D as DefinePolicyInput } from "./packem_shared/types.d-B7FLdYUD.mjs";
|
|
10
10
|
export type { d as PolicyContext, e as PolicyDecision, f as PolicyDecisionOf, P as PolicyOperation } from "./packem_shared/types.d-B7FLdYUD.mjs";
|
|
11
11
|
export { type CronJob, type CronJobsBuilder, type CronScheduleKind, type DailySchedule, type IntervalSchedule, type MonthlySchedule, type WeeklySchedule, cronJobs } from '@lunora/scheduler';
|
|
@@ -1451,8 +1451,11 @@ interface SchedulerLike {
|
|
|
1451
1451
|
* that had to widen to `unknown` and cast back — the generated shard among them
|
|
1452
1452
|
* — could not be type-checked against the contract this docblock describes.
|
|
1453
1453
|
* @param scheduler the `ctx.scheduler` implementation to wrap
|
|
1454
|
+
* @param outbox durable custody for buffered calls; absent on a harness with no store
|
|
1455
|
+
* @param userId reads the user the call is scheduled for, at each call; the raw id is fixed in
|
|
1456
|
+
* the custody record, so a replay with no identity still lands in the same dedup scope
|
|
1454
1457
|
*/
|
|
1455
|
-
declare const withDeferredSchedules: <S extends SchedulerLike>(scheduler: S, outbox?: ScheduleOutbox) => S;
|
|
1458
|
+
declare const withDeferredSchedules: <S extends SchedulerLike>(scheduler: S, outbox?: ScheduleOutbox, userId?: () => string | undefined) => S;
|
|
1456
1459
|
/**
|
|
1457
1460
|
* Open a deferral window on `context.scheduler` and return its settle function.
|
|
1458
1461
|
*
|
|
@@ -2564,7 +2567,7 @@ type ListFilterOperators<T> = WhereOperators<T>;
|
|
|
2564
2567
|
*/
|
|
2565
2568
|
type ListFilterShape<TDocument> = { [K in keyof TDocument & string]?: Validator<TDocument[K]>; };
|
|
2566
2569
|
/** The `where` argument: each declared filter column, optionally, as a bare value or an operator object. */
|
|
2567
|
-
type ListWhere<F> = { [K in keyof F]?:
|
|
2570
|
+
type ListWhere<F> = { [K in keyof F]?: ColumnWhere<Infer<NonNullable<F[K]>>>; };
|
|
2568
2571
|
/** One `orderBy` entry. `direction` defaults to `"asc"`. */
|
|
2569
2572
|
interface ListOrderByEntry<O extends string> {
|
|
2570
2573
|
direction?: "asc" | "desc";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
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--zaGh3rX.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--zaGh3rX.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';
|
|
8
|
-
import {
|
|
8
|
+
import { ColumnWhere, QueryArgs as QueryArgs$2, WhereOperators, QueryPlan } from "./data-model.js";
|
|
9
9
|
import { W as WhereInput, a as Policy, b as RlsOptions, c as Permission, R as Role, T as TypedDefinePolicyInput, D as DefinePolicyInput } from "./packem_shared/types.d-BCtjbIzl.js";
|
|
10
10
|
export type { d as PolicyContext, e as PolicyDecision, f as PolicyDecisionOf, P as PolicyOperation } from "./packem_shared/types.d-BCtjbIzl.js";
|
|
11
11
|
export { type CronJob, type CronJobsBuilder, type CronScheduleKind, type DailySchedule, type IntervalSchedule, type MonthlySchedule, type WeeklySchedule, cronJobs } from '@lunora/scheduler';
|
|
@@ -1451,8 +1451,11 @@ interface SchedulerLike {
|
|
|
1451
1451
|
* that had to widen to `unknown` and cast back — the generated shard among them
|
|
1452
1452
|
* — could not be type-checked against the contract this docblock describes.
|
|
1453
1453
|
* @param scheduler the `ctx.scheduler` implementation to wrap
|
|
1454
|
+
* @param outbox durable custody for buffered calls; absent on a harness with no store
|
|
1455
|
+
* @param userId reads the user the call is scheduled for, at each call; the raw id is fixed in
|
|
1456
|
+
* the custody record, so a replay with no identity still lands in the same dedup scope
|
|
1454
1457
|
*/
|
|
1455
|
-
declare const withDeferredSchedules: <S extends SchedulerLike>(scheduler: S, outbox?: ScheduleOutbox) => S;
|
|
1458
|
+
declare const withDeferredSchedules: <S extends SchedulerLike>(scheduler: S, outbox?: ScheduleOutbox, userId?: () => string | undefined) => S;
|
|
1456
1459
|
/**
|
|
1457
1460
|
* Open a deferral window on `context.scheduler` and return its settle function.
|
|
1458
1461
|
*
|
|
@@ -2564,7 +2567,7 @@ type ListFilterOperators<T> = WhereOperators<T>;
|
|
|
2564
2567
|
*/
|
|
2565
2568
|
type ListFilterShape<TDocument> = { [K in keyof TDocument & string]?: Validator<TDocument[K]>; };
|
|
2566
2569
|
/** The `where` argument: each declared filter column, optionally, as a bare value or an operator object. */
|
|
2567
|
-
type ListWhere<F> = { [K in keyof F]?:
|
|
2570
|
+
type ListWhere<F> = { [K in keyof F]?: ColumnWhere<Infer<NonNullable<F[K]>>>; };
|
|
2568
2571
|
/** One `orderBy` entry. `direction` defaults to `"asc"`. */
|
|
2569
2572
|
interface ListOrderByEntry<O extends string> {
|
|
2570
2573
|
direction?: "asc" | "desc";
|
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-Dv4DKrj0.mjs";import{authorize as s}from"./packem_shared/authorize-CVLZJxf_.mjs";import{initLunora as p}from"./packem_shared/initLunora-DcvCGLL_.mjs";import{isPerDispatchMiddleware as c,tagPerDispatchMiddleware as l}from"./packem_shared/isPerDispatchMiddleware-DDQPatSm.mjs";import{createSecrets as u}from"./packem_shared/createSecrets-D6rLB42U.mjs";import{beginDeferredDeletes as h,flushDeferredDeletes as D,withDeferredDeletes as T}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as A,withDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-
|
|
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-Dv4DKrj0.mjs";import{authorize as s}from"./packem_shared/authorize-CVLZJxf_.mjs";import{initLunora as p}from"./packem_shared/initLunora-DcvCGLL_.mjs";import{isPerDispatchMiddleware as c,tagPerDispatchMiddleware as l}from"./packem_shared/isPerDispatchMiddleware-DDQPatSm.mjs";import{createSecrets as u}from"./packem_shared/createSecrets-D6rLB42U.mjs";import{beginDeferredDeletes as h,flushDeferredDeletes as D,withDeferredDeletes as T}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as A,withDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-BOsY07vZ.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as _,DOCUMENT_HISTORY_TABLE as I,defineDocumentHistory as C,documentHistoryExtension as M}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-BCa6sLSJ.mjs";import{LunoraEnvError as b,defineEnv as y}from"./packem_shared/LunoraEnvError-06_Zc4yc.mjs";import{bindOrm as F,bindTableFacade as v,defineLazyFacade as N}from"./packem_shared/bindOrm-D5mVDvbi.mjs";import{httpAction as H,httpRoute as k,httpRouter as w,lastEventId as B,sseEvent as V}from"./packem_shared/httpAction-Bfw3qwLG.mjs";import{serveStorageObject as j}from"./packem_shared/serveStorageObject-CLz3qhNI.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 $,DEFAULT_MAX_LIMIT as ee,clampLimit as re,defineListArgs as oe}from"./packem_shared/DEFAULT_LIMIT-z7HB19s7.mjs";import{defineLiveStream as ie,liveStreamRouter as ne}from"./packem_shared/defineLiveStream-q9yO3wl6.mjs";import{defineMigration as ae}from"./packem_shared/defineMigration-CXOS0Bvq.mjs";import{defineModule as se}from"./packem_shared/defineModule-OecXWM3U.mjs";import{defineMutator as pe}from"./packem_shared/defineMutator-DlLFSWbO.mjs";import{platformAdmin as ce}from"./packem_shared/platformAdmin-kczXQme8.mjs";import{c as Ee,d as ue,a as Se,b as he,e as De,f as Te,g as Re,h as Ae,i as ge,j as Le,k as _e,m as Ie}from"./packem_shared/plugin-CyLqvCB9.mjs";import{PRESENCE_DEFAULT_TTL_MS as Me,PRESENCE_TABLE as Pe,definePresence as be,presenceExtension as ye}from"./packem_shared/PRESENCE_DEFAULT_TTL_MS-aj9Ec70J.mjs";import{PROCEDURE_META as Fe,UNLOADED_META as ve,procedureMeta as Ne}from"./packem_shared/PROCEDURE_META-DVzrXpfa.mjs";import{protectPublic as He}from"./packem_shared/protectPublic-Bi5_95aP.mjs";import{onQueryChange as we}from"./packem_shared/onQueryChange-iuLzmyPs.mjs";import{defineRoom as Ve}from"./packem_shared/defineRoom-CoGi-xwm.mjs";import{createServices as je}from"./packem_shared/createServices-IJvoqi0e.mjs";import{defineShape as Ye}from"./packem_shared/defineShape-H-0IbZlb.mjs";import{defineWebSocket as Je}from"./packem_shared/defineWebSocket-BHoy6_ox.mjs";import{onWhisper as Qe}from"./packem_shared/onWhisper-CfDbFLQh.mjs";import{LunoraError as qe}from"@lunora/errors";import{cronJobs as $e}from"@lunora/scheduler";import{ValidationError as rr,v as or}from"@lunora/values";import{allowAll as ir,deny as nr,isDeny as fr,toWhereInput as ar}from"./packem_shared/allowAll-DkRAgItV.mjs";import{asBucketStorage as sr}from"./packem_shared/asBucketStorage-DoGYOjq3.mjs";import{assertShapesDeclareReadPolicies as pr,buildRlsReadRegistry as xr,composeShapeReadWhere as cr}from"./packem_shared/assertShapesDeclareReadPolicies-C09SMvM4.mjs";import{buildMaskRegistry as Er}from"./packem_shared/buildMaskRegistry-DpWMtalG.mjs";import{createPolicyDsl as Sr,definePermission as hr,definePolicies as Dr,definePolicy as Tr,defineRole as Rr}from"./packem_shared/createPolicyDsl-BZa6SqLJ.mjs";import{defineStorageRule as gr,defineStorageRules as Lr}from"./packem_shared/defineStorageRule-Dv4nJE0H.mjs";import{isSafeHeaderValue as Ir}from"./packem_shared/isSafeHeaderValue-DswDADFy.mjs";import{mask as Mr}from"./packem_shared/mask-DHJtsP7t.mjs";import{r as br}from"./packem_shared/redact-secrets-BpatNz48.mjs";import{r as Or}from"./packem_shared/middleware-CHYtnvZP.mjs";import{storageRules as vr}from"./packem_shared/storageRules-BVIXkoRg.mjs";const e="0.0.0";export{t as ACTION_CACHE_DEFAULT_TTL_MS,i as ACTION_CACHE_TABLE,$ as DEFAULT_LIMIT,ee as DEFAULT_MAX_LIMIT,_ as DOCUMENT_HISTORY_REDACTED_FIELDS,I as DOCUMENT_HISTORY_TABLE,b as LunoraEnvError,qe as LunoraError,Me as PRESENCE_DEFAULT_TTL_MS,Pe as PRESENCE_TABLE,Fe as PROCEDURE_META,ve as UNLOADED_META,e as VERSION,rr as ValidationError,n as actionCacheExtension,ir as allowAll,sr as asBucketStorage,pr as assertShapesDeclareReadPolicies,s as authorize,h as beginDeferredDeletes,A as beginDeferredSchedules,F as bindOrm,v as bindTableFacade,Er as buildMaskRegistry,xr as buildRlsReadRegistry,f as cacheKeyFor,re as clampLimit,Ee as composePluginMiddleware,cr as composeShapeReadWhere,Sr as createPolicyDsl,u as createSecrets,je as createServices,$e as cronJobs,a as defineActionCache,ue as defineAggregateIndex,Se as defineComponent,C as defineDocumentHistory,y as defineEnv,Y as defineIdentity,J as defineIdentityGuard,N as defineLazyFacade,oe as defineListArgs,ie as defineLiveStream,ae as defineMigration,se as defineModule,pe as defineMutator,hr as definePermission,he as definePlugin,Dr as definePolicies,Tr as definePolicy,be as definePresence,De as defineRankIndex,Rr as defineRole,Ve as defineRoom,Te as defineSchema,Re as defineSchemaExtension,Ye as defineShape,gr as defineStorageRule,Lr as defineStorageRules,Ae as defineTable,ge as defineVectorIndex,Je as defineWebSocket,nr as deny,M as documentHistoryExtension,D as flushDeferredDeletes,H as httpAction,k as httpRoute,w as httpRouter,Le as indexFieldsFromSchema,p as initLunora,_e as installPlugins,fr as isDeny,c as isPerDispatchMiddleware,Ir as isSafeHeaderValue,B as lastEventId,ne as liveStreamRouter,Mr as mask,Ie as mergeSchemaExtension,Q as onConnect,X as onDisconnect,we as onQueryChange,q as onShardInit,Qe as onWhisper,ce as platformAdmin,ye as presenceExtension,Ne as procedureMeta,He as protectPublic,br as redactSecrets,Or as rls,j as serveStorageObject,V as sseEvent,vr as storageRules,l as tagPerDispatchMiddleware,ar as toWhereInput,or as v,T as withDeferredDeletes,g 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--zaGh3rX.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--zaGh3rX.js";
|
|
45
45
|
import '@lunora/values';
|
|
46
46
|
/**
|
|
47
47
|
* @since 1.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as b}from"@lunora/errors";import{optionalInner as h,v as o}from"@lunora/values";const A=25,S=100,w=100,L=8,O=new Set(["id","storage","string"]),f=t=>{const n=h(t)??t;if(O.has(n.kind))return!0;const r=n._meta;if(n.kind==="literal")return typeof r?.value=="string";if(n.kind!=="union"||r?.members===void 0)return!1;const{members:s}=r;return s.some(e=>f(e))&&s.every(e=>e.kind==="null"||f(e))},_=(t,n)=>{const r=s=>o.optional(o.array(s).check(e=>e.length<=n,{message:`at most ${String(n)} values`}));return o.object({...f(t)?{contains:o.optional(o.string())}:{},eq:o.optional(t),gt:o.optional(t),gte:o.optional(t),in:r(t),isNull:o.optional(o.boolean()),lt:o.optional(t),lte:o.optional(t),ne:o.optional(t),notIn:r(t)})},B=(t,n,r)=>t===void 0||!Number.isFinite(t)?Math.min(n,r):Math.min(Math.max(1,Math.floor(t)),r),p=(t,n)=>t===void 0||!Number.isFinite(t)?n:Math.max(1,Math.floor(t)),E=new Set(["contains","eq","gt","gte","in","isNull","lt","lte","ne","notIn"]),M=(t,n,r)=>{if(typeof t!="object"||t===null||Array.isArray(t))return;const s=t,e={};let l=0;for(const a of E){if(!Object.hasOwn(s,a)||(l+=1,a==="contains"&&!r))continue;const c=s[a];if(Array.isArray(c)&&c.length>n)throw new b("BAD_REQUEST",`list filter: \`${a}\` accepts at most ${String(n)} values (got ${String(c.length)})`);e[a]=c}return l===0?void 0:e},I=(t,n,r,s)=>{const e={};for(const l of n){if(!Object.hasOwn(t,l))continue;const a=t[l],c=M(a,s,r.has(l));c!==void 0&&Object.keys(c).length===0||(e[l]=c??a)}return e},F=()=>t=>{const n=p(t.defaultLimit,A),r=p(t.maxLimit,S),s=p(t.maxInValues,w),e=p(t.maxOrderBy,L),l=new Set(Object.keys(t.filter)),a=new Set,c={};for(const[i,d]of Object.entries(t.filter)){f(d)&&a.add(i);const u=h(d)===void 0?d:o.union(d,o.null());c[i]=o.optional(o.union(u,_(u,s)))}const g=new Set(t.orderBy),y=t.orderBy.length===0?o.string().check(()=>!1,{message:"no sortable columns are declared for this endpoint"}):o.union(...t.orderBy.map(i=>o.literal(i)));return{args:{cursor:o.optional(o.union(o.string(),o.number(),o.null())),limit:o.optional(o.number()),orderBy:o.optional(o.array(o.object({direction:o.optional(o.union(o.literal("asc"),o.literal("desc"))),field:y}))),where:o.optional(o.object(c))},toQueryArgs:i=>{const d=i.orderBy?.filter(m=>g.has(m.field)).slice(0,e).map(m=>({[m.field]:m.direction??"asc"})),u=i.where===void 0?void 0:I(i.where,l,a,s);return{...i.cursor===void 0?{}:{cursor:typeof i.cursor=="number"?String(i.cursor):i.cursor},limit:B(i.limit,n,r),...d===void 0||d.length===0?{}:{orderBy:d},...u===void 0?{}:{where:u}}}}};export{A as DEFAULT_LIMIT,S as DEFAULT_MAX_LIMIT,B as clampLimit,F as defineListArgs};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{assertScheduleInstant as O,assertScheduleDelay as S,resolveScheduleId as j,assertDedupKey as I}from"@lunora/scheduler";import{encodeArgsOrThrow as U}from"@lunora/wire";const x=new WeakMap,v=r=>{if(typeof r=="string")return r;const n=r??{},e=n.__lunoraRef??n.binding;return typeof e=="string"?e:"<unknown>"},A=r=>{let n=r;for(;n!==void 0&&!n.open;)n=n.parent;return n},$=(r,n,e)=>r==="runAfter"?Math.max(n,e-Date.now()):Math.max(n,e),k=async(r,{id:n,run:e,token:t})=>{if(r?.handOff!==void 0){await r.handOff(n,e,t);return}await e(),r?.forget(n)},q=(r,n)=>{const e=n?.();return e!==void 0&&e.length>0?{...r,dedupUserId:e}:r===void 0||!("dedupUserId"in r)?r:Object.fromEntries(Object.entries(r).filter(([t])=>t!=="dedupUserId"))},P=(r,n,e)=>{const t=r,d={decisions:new Map,innermost:void 0,outbox:n},u=(o,i,s,c,w)=>t[o].call(t,i,s,c,w),a=(o,i,s,c,w)=>{const p=q(w,e),h=v(s);d.decisions.has(h)||d.decisions.set(h,d.outbox?.admit(h));const y=d.decisions.get(h),g=y===void 0?i:$(o,i,y),b=d.innermost;if(b===void 0)return u(o,g,s,c,p);const l=j(p?.id),m={...p,dedupKey:I(p?.dedupKey)??`${l}-${crypto.randomUUID().replaceAll("-","")}`},D=d.outbox?.record(l,{args:U(`ctx.scheduler.${o}`,v(s),c),options:m,target:s,when:Math.ceil(o==="runAfter"?Date.now()+g:g)});return b.pending.push({id:l,run:async()=>u(o,g,s,c,{...m,id:l}),token:D}),Promise.resolve(l)},f={...t,runAfter:(o,i,s,c)=>(S(o,"ctx.scheduler.runAfter"),a("runAfter",o,i,s,c)),runAt:(o,i,s,c)=>(O(o,Date.now(),"ctx.scheduler.runAt"),a("runAt",o,i,s,c))};return Object.setPrototypeOf(f,Object.getPrototypeOf(t)),x.set(f,d),f},W=r=>{const{scheduler:n}=r,e=typeof n=="object"&&n!==null?x.get(n):void 0;if(!e)return async()=>{};const t={open:!0,parent:e.innermost,pending:[]};return e.innermost=t,async d=>{if(!t.open)return;t.open=!1,e.innermost===t&&(e.innermost=A(t.parent));const u=t.pending.splice(0);if(u.length===0)return;if(!d){for(const{id:s}of u)e.outbox?.forget(s);return}const a=A(t.parent);if(a!==void 0){a.pending.push(...u);return}const f=[];for(const s of u)try{await k(e.outbox,s)}catch(c){f.push(c)}const[o,...i]=f;if(o!==void 0)throw e.outbox?.wake(),i.length===0?o:new AggregateError(f,`ctx.scheduler: ${String(f.length)} of ${String(u.length)} deferred jobs failed to reach the scheduler after the commit`)}};export{W as beginDeferredSchedules,P as withDeferredSchedules};
|
|
@@ -1968,9 +1968,9 @@ interface ScheduleRunOptions {
|
|
|
1968
1968
|
* The key the job's receiver dedups a re-delivery on. Defaults to one minted per scheduling;
|
|
1969
1969
|
* set it when the same logical job may be scheduled more than once and must run once. Must
|
|
1970
1970
|
* match `^[A-Za-z0-9_][A-Za-z0-9_-]{0,99}$`; inside a mutation a key that does not is refused
|
|
1971
|
-
* there and then, rolling the mutation back. A function target
|
|
1972
|
-
*
|
|
1973
|
-
*
|
|
1971
|
+
* there and then, rolling the mutation back. A function target dedups per scheduling user and
|
|
1972
|
+
* target function (jobs with no user share one scope per function) and remembers the key for
|
|
1973
|
+
* 24 hours; a workflow target uses the bare key as its instance id, for as long as it exists.
|
|
1974
1974
|
*/
|
|
1975
1975
|
dedupKey?: string;
|
|
1976
1976
|
/** Retry policy for this job; the scheduler's defaults apply when omitted. */
|
|
@@ -1968,9 +1968,9 @@ interface ScheduleRunOptions {
|
|
|
1968
1968
|
* The key the job's receiver dedups a re-delivery on. Defaults to one minted per scheduling;
|
|
1969
1969
|
* set it when the same logical job may be scheduled more than once and must run once. Must
|
|
1970
1970
|
* match `^[A-Za-z0-9_][A-Za-z0-9_-]{0,99}$`; inside a mutation a key that does not is refused
|
|
1971
|
-
* there and then, rolling the mutation back. A function target
|
|
1972
|
-
*
|
|
1973
|
-
*
|
|
1971
|
+
* there and then, rolling the mutation back. A function target dedups per scheduling user and
|
|
1972
|
+
* target function (jobs with no user share one scope per function) and remembers the key for
|
|
1973
|
+
* 24 hours; a workflow target uses the bare key as its instance id, for as long as it exists.
|
|
1974
1974
|
*/
|
|
1975
1975
|
dedupKey?: string;
|
|
1976
1976
|
/** Retry policy for this job; the scheduler's defaults apply when omitted. */
|
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--zaGh3rX.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--zaGh3rX.js";
|
|
2
2
|
import '@lunora/values';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/server",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.283",
|
|
4
4
|
"description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backend",
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
},
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@lunora/errors": ">=1.0.0-alpha.77 <2.0.0-0",
|
|
76
|
-
"@lunora/scheduler": "^1.0.0-alpha.
|
|
77
|
-
"@lunora/shard-engine": "^1.0.0-alpha.
|
|
76
|
+
"@lunora/scheduler": "^1.0.0-alpha.175",
|
|
77
|
+
"@lunora/shard-engine": "^1.0.0-alpha.210",
|
|
78
78
|
"@lunora/values": "^1.0.0-alpha.95",
|
|
79
79
|
"@lunora/wire": "1.0.0-alpha.6",
|
|
80
80
|
"drizzle-orm": "1.0.0-rc.5",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as y}from"@lunora/errors";import{v as o,optionalInner as b}from"@lunora/values";const A=25,S=100,w=100,L=8,O=new Set(["id","storage","string"]),u=t=>{const n=b(t)??t;if(O.has(n.kind))return!0;const r=n._meta;if(n.kind==="literal")return typeof r?.value=="string";if(n.kind!=="union"||r?.members===void 0)return!1;const{members:s}=r;return s.some(e=>u(e))&&s.every(e=>e.kind==="null"||u(e))},_=(t,n)=>{const r=s=>o.optional(o.array(s).check(e=>e.length<=n,{message:`at most ${String(n)} values`}));return o.object({...u(t)?{contains:o.optional(o.string())}:{},eq:o.optional(t),gt:o.optional(t),gte:o.optional(t),in:r(t),isNull:o.optional(o.boolean()),lt:o.optional(t),lte:o.optional(t),ne:o.optional(t),notIn:r(t)})},B=(t,n,r)=>t===void 0||!Number.isFinite(t)?Math.min(n,r):Math.min(Math.max(1,Math.floor(t)),r),p=(t,n)=>t===void 0||!Number.isFinite(t)?n:Math.max(1,Math.floor(t)),E=new Set(["contains","eq","gt","gte","in","isNull","lt","lte","ne","notIn"]),M=(t,n,r)=>{if(typeof t!="object"||t===null||Array.isArray(t))return;const s=t,e={};let l=0;for(const a of E){if(!Object.hasOwn(s,a)||(l+=1,a==="contains"&&!r))continue;const c=s[a];if(Array.isArray(c)&&c.length>n)throw new y("BAD_REQUEST",`list filter: \`${a}\` accepts at most ${String(n)} values (got ${String(c.length)})`);e[a]=c}return l===0?void 0:e},I=(t,n,r,s)=>{const e={};for(const l of n){if(!Object.hasOwn(t,l))continue;const a=t[l],c=M(a,s,r.has(l));c!==void 0&&Object.keys(c).length===0||(e[l]=c??a)}return e},F=()=>t=>{const n=p(t.defaultLimit,A),r=p(t.maxLimit,S),s=p(t.maxInValues,w),e=p(t.maxOrderBy,L),l=new Set(Object.keys(t.filter)),a=new Set,c={};for(const[i,d]of Object.entries(t.filter))u(d)&&a.add(i),c[i]=o.optional(o.union(d,_(d,s)));const h=new Set(t.orderBy),g=t.orderBy.length===0?o.string().check(()=>!1,{message:"no sortable columns are declared for this endpoint"}):o.union(...t.orderBy.map(i=>o.literal(i)));return{args:{cursor:o.optional(o.union(o.string(),o.number(),o.null())),limit:o.optional(o.number()),orderBy:o.optional(o.array(o.object({direction:o.optional(o.union(o.literal("asc"),o.literal("desc"))),field:g}))),where:o.optional(o.object(c))},toQueryArgs:i=>{const d=i.orderBy?.filter(m=>h.has(m.field)).slice(0,e).map(m=>({[m.field]:m.direction??"asc"})),f=i.where===void 0?void 0:I(i.where,l,a,s);return{...i.cursor===void 0?{}:{cursor:typeof i.cursor=="number"?String(i.cursor):i.cursor},limit:B(i.limit,n,r),...d===void 0||d.length===0?{}:{orderBy:d},...f===void 0?{}:{where:f}}}}};export{A as DEFAULT_LIMIT,S as DEFAULT_MAX_LIMIT,B as clampLimit,F as defineListArgs};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{assertScheduleInstant as x,assertScheduleDelay as D,resolveScheduleId as O,assertDedupKey as S}from"@lunora/scheduler";import{encodeArgsOrThrow as $}from"@lunora/wire";const A=new WeakMap,m=o=>{if(typeof o=="string")return o;const n=o??{},e=n.__lunoraRef??n.binding;return typeof e=="string"?e:"<unknown>"},b=o=>{let n=o;for(;n!==void 0&&!n.open;)n=n.parent;return n},j=(o,n,e)=>o==="runAfter"?Math.max(n,e-Date.now()):Math.max(n,e),k=async(o,{id:n,run:e,token:r})=>{if(o?.handOff!==void 0){await o.handOff(n,e,r);return}await e(),o?.forget(n)},K=(o,n)=>{const e=o,r={decisions:new Map,innermost:void 0,outbox:n},l=(t,i,s,c,u)=>e[t].call(e,i,s,c,u),d=(t,i,s,c,u)=>{const h=m(s);r.decisions.has(h)||r.decisions.set(h,r.outbox?.admit(h));const g=r.decisions.get(h),p=g===void 0?i:j(t,i,g),w=r.innermost;if(w===void 0)return l(t,p,s,c,u);const a=O(u?.id),y={...u,dedupKey:S(u?.dedupKey)??`${a}-${crypto.randomUUID().replaceAll("-","")}`},v=r.outbox?.record(a,{args:$(`ctx.scheduler.${t}`,m(s),c),options:y,target:s,when:Math.ceil(t==="runAfter"?Date.now()+p:p)});return w.pending.push({id:a,run:async()=>l(t,p,s,c,{...y,id:a}),token:v}),Promise.resolve(a)},f={...e,runAfter:(t,i,s,c)=>(D(t,"ctx.scheduler.runAfter"),d("runAfter",t,i,s,c)),runAt:(t,i,s,c)=>(x(t,Date.now(),"ctx.scheduler.runAt"),d("runAt",t,i,s,c))};return Object.setPrototypeOf(f,Object.getPrototypeOf(e)),A.set(f,r),f},M=o=>{const{scheduler:n}=o,e=typeof n=="object"&&n!==null?A.get(n):void 0;if(!e)return async()=>{};const r={open:!0,parent:e.innermost,pending:[]};return e.innermost=r,async l=>{if(!r.open)return;r.open=!1,e.innermost===r&&(e.innermost=b(r.parent));const d=r.pending.splice(0);if(d.length===0)return;if(!l){for(const{id:c}of d)e.outbox?.forget(c);return}const f=b(r.parent);if(f!==void 0){f.pending.push(...d);return}const t=[];for(const c of d)try{await k(e.outbox,c)}catch(u){t.push(u)}const[i,...s]=t;if(i!==void 0)throw e.outbox?.wake(),s.length===0?i:new AggregateError(t,`ctx.scheduler: ${String(t.length)} of ${String(d.length)} deferred jobs failed to reach the scheduler after the commit`)}};export{M as beginDeferredSchedules,K as withDeferredSchedules};
|