@lunora/server 1.0.0-alpha.280 → 1.0.0-alpha.282
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/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +1 -1
- package/dist/packem_shared/DEFAULT_LIMIT-z7HB19s7.mjs +1 -0
- package/package.json +2 -2
- package/dist/packem_shared/DEFAULT_LIMIT-pT_tV8R0.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/index.d.mts
CHANGED
|
@@ -5,7 +5,7 @@ export type { N as AuthState, P as CachePurge, U as DatabaseReader, D as Databas
|
|
|
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';
|
|
@@ -2564,7 +2564,7 @@ type ListFilterOperators<T> = WhereOperators<T>;
|
|
|
2564
2564
|
*/
|
|
2565
2565
|
type ListFilterShape<TDocument> = { [K in keyof TDocument & string]?: Validator<TDocument[K]>; };
|
|
2566
2566
|
/** The `where` argument: each declared filter column, optionally, as a bare value or an operator object. */
|
|
2567
|
-
type ListWhere<F> = { [K in keyof F]?:
|
|
2567
|
+
type ListWhere<F> = { [K in keyof F]?: ColumnWhere<Infer<NonNullable<F[K]>>>; };
|
|
2568
2568
|
/** One `orderBy` entry. `direction` defaults to `"asc"`. */
|
|
2569
2569
|
interface ListOrderByEntry<O extends string> {
|
|
2570
2570
|
direction?: "asc" | "desc";
|
|
@@ -3654,8 +3654,8 @@ type PlatformAdminCheck<Context> = (context: Context) => boolean | Promise<boole
|
|
|
3654
3654
|
*
|
|
3655
3655
|
* It is also the marker the advisor reads. A procedure whose chain carries
|
|
3656
3656
|
* `.use(platformAdmin(...))` is reachable only by an admin, so the ownership lint
|
|
3657
|
-
* treats the arguments it takes as the admin's choice rather than an IDOR
|
|
3658
|
-
* marker is the import, not the name of the variable that holds the chain. The
|
|
3657
|
+
* treats the arguments it takes as the admin's choice rather than an IDOR, and the
|
|
3658
|
+
* CAPTCHA lint does not ask for a bot check in front of it. The marker is the import, not the name of the variable that holds the chain. The
|
|
3659
3659
|
* advisor trusts the declaration, not the check: any `platformAdmin(...)` step marks
|
|
3660
3660
|
* the procedure, whatever `check` returns, so the check itself must be the admin test.
|
|
3661
3661
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { N as AuthState, P as CachePurge, U as DatabaseReader, D as Databas
|
|
|
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';
|
|
@@ -2564,7 +2564,7 @@ type ListFilterOperators<T> = WhereOperators<T>;
|
|
|
2564
2564
|
*/
|
|
2565
2565
|
type ListFilterShape<TDocument> = { [K in keyof TDocument & string]?: Validator<TDocument[K]>; };
|
|
2566
2566
|
/** The `where` argument: each declared filter column, optionally, as a bare value or an operator object. */
|
|
2567
|
-
type ListWhere<F> = { [K in keyof F]?:
|
|
2567
|
+
type ListWhere<F> = { [K in keyof F]?: ColumnWhere<Infer<NonNullable<F[K]>>>; };
|
|
2568
2568
|
/** One `orderBy` entry. `direction` defaults to `"asc"`. */
|
|
2569
2569
|
interface ListOrderByEntry<O extends string> {
|
|
2570
2570
|
direction?: "asc" | "desc";
|
|
@@ -3654,8 +3654,8 @@ type PlatformAdminCheck<Context> = (context: Context) => boolean | Promise<boole
|
|
|
3654
3654
|
*
|
|
3655
3655
|
* It is also the marker the advisor reads. A procedure whose chain carries
|
|
3656
3656
|
* `.use(platformAdmin(...))` is reachable only by an admin, so the ownership lint
|
|
3657
|
-
* treats the arguments it takes as the admin's choice rather than an IDOR
|
|
3658
|
-
* marker is the import, not the name of the variable that holds the chain. The
|
|
3657
|
+
* treats the arguments it takes as the admin's choice rather than an IDOR, and the
|
|
3658
|
+
* CAPTCHA lint does not ask for a bot check in front of it. The marker is the import, not the name of the variable that holds the chain. The
|
|
3659
3659
|
* advisor trusts the declaration, not the check: any `platformAdmin(...)` step marks
|
|
3660
3660
|
* the procedure, whatever `check` returns, so the check itself must be the admin test.
|
|
3661
3661
|
*/
|
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-BTwq-NUO.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-
|
|
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-BTwq-NUO.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};
|
|
@@ -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};
|
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.282",
|
|
4
4
|
"description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"backend",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"dependencies": {
|
|
75
75
|
"@lunora/errors": ">=1.0.0-alpha.77 <2.0.0-0",
|
|
76
76
|
"@lunora/scheduler": "^1.0.0-alpha.173",
|
|
77
|
-
"@lunora/shard-engine": "^1.0.0-alpha.
|
|
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};
|