@lunora/server 1.0.0-alpha.175 → 1.0.0-alpha.177
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts
CHANGED
|
@@ -3112,7 +3112,17 @@ interface RegisteredMutator<Args extends ValidatorMap = ValidatorMap, ServerCont
|
|
|
3112
3112
|
*/
|
|
3113
3113
|
readonly kind: "mutation";
|
|
3114
3114
|
}
|
|
3115
|
-
/**
|
|
3115
|
+
/**
|
|
3116
|
+
* Declare a custom mutator. See the module docs for runtime semantics.
|
|
3117
|
+
*
|
|
3118
|
+
* The raw `server` impl is never exposed. The returned `server` is the same
|
|
3119
|
+
* validating, owner-scoping entry point as `handler`, so `createPost.server(ctx,
|
|
3120
|
+
* { userId: other })` cannot skip `applyOwnerScope`; and the raw impl runs with
|
|
3121
|
+
* the returned mutator as `this`, so `this.server(…)` inside a method-shorthand
|
|
3122
|
+
* impl re-enters through that same entry point. That `this` is a spread copy
|
|
3123
|
+
* of the definition, so prototype methods and getters of a class-instance
|
|
3124
|
+
* definition are not available (or not live) through it.
|
|
3125
|
+
*/
|
|
3116
3126
|
declare const defineMutator: <Args extends ValidatorMap = ValidatorMap, ServerContext = MutationCtx, ClientTx = unknown, R = unknown>(definition: MutatorDefinition<Args, ServerContext, ClientTx, R>) => RegisteredMutator<Args, ServerContext, ClientTx, R>;
|
|
3117
3127
|
/** Default time-to-live for a presence row: a heartbeat keeps a member "present" for this long. */
|
|
3118
3128
|
declare const DEFAULT_TTL_MS = 3e4;
|
package/dist/index.d.ts
CHANGED
|
@@ -3112,7 +3112,17 @@ interface RegisteredMutator<Args extends ValidatorMap = ValidatorMap, ServerCont
|
|
|
3112
3112
|
*/
|
|
3113
3113
|
readonly kind: "mutation";
|
|
3114
3114
|
}
|
|
3115
|
-
/**
|
|
3115
|
+
/**
|
|
3116
|
+
* Declare a custom mutator. See the module docs for runtime semantics.
|
|
3117
|
+
*
|
|
3118
|
+
* The raw `server` impl is never exposed. The returned `server` is the same
|
|
3119
|
+
* validating, owner-scoping entry point as `handler`, so `createPost.server(ctx,
|
|
3120
|
+
* { userId: other })` cannot skip `applyOwnerScope`; and the raw impl runs with
|
|
3121
|
+
* the returned mutator as `this`, so `this.server(…)` inside a method-shorthand
|
|
3122
|
+
* impl re-enters through that same entry point. That `this` is a spread copy
|
|
3123
|
+
* of the definition, so prototype methods and getters of a class-instance
|
|
3124
|
+
* definition are not available (or not live) through it.
|
|
3125
|
+
*/
|
|
3116
3126
|
declare const defineMutator: <Args extends ValidatorMap = ValidatorMap, ServerContext = MutationCtx, ClientTx = unknown, R = unknown>(definition: MutatorDefinition<Args, ServerContext, ClientTx, R>) => RegisteredMutator<Args, ServerContext, ClientTx, R>;
|
|
3117
3127
|
/** Default time-to-live for a presence row: a heartbeat keeps a member "present" for this long. */
|
|
3118
3128
|
declare const DEFAULT_TTL_MS = 3e4;
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ACTION_CACHE_DEFAULT_TTL_MS as t,ACTION_CACHE_TABLE as i,actionCacheExtension as n,cacheKeyFor as a,defineActionCache as f}from"./packem_shared/ACTION_CACHE_DEFAULT_TTL_MS-DHpfdhmu.mjs";import{initLunora as d}from"./packem_shared/initLunora-DAbEYdSo.mjs";import{isPerDispatchMiddleware as m,tagPerDispatchMiddleware as x}from"./packem_shared/isPerDispatchMiddleware-DDQPatSm.mjs";import{createSecrets as l}from"./packem_shared/createSecrets-D6rLB42U.mjs";import{beginDeferredDeletes as h,flushDeferredDeletes as S,withDeferredDeletes as u}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as T,withDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-DJ6U4iq5.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as R,DOCUMENT_HISTORY_TABLE as _,defineDocumentHistory as L,documentHistoryExtension as C}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-DAfomt5Q.mjs";import{LunoraEnvError as M,defineEnv as P,redactSecrets as b}from"./packem_shared/LunoraEnvError-A5I-PzMh.mjs";import{bindOrm as F,bindTableFacade as O}from"./packem_shared/bindOrm-D_hFUjmr.mjs";import{httpAction as N,httpRoute as w,httpRouter as U,isSafeHeaderValue as k}from"./packem_shared/httpAction-DFVhrm8u.mjs";import{serveStorageObject as B}from"./packem_shared/serveStorageObject-9mdw0nyU.mjs";import{defineIdentity as W}from"./packem_shared/defineIdentity-DwkNKwYa.mjs";import{onConnect as Y,onDisconnect as J,onShardInit as K}from"./packem_shared/onConnect-BLRoOpv2.mjs";import{DEFAULT_LIMIT as X,DEFAULT_MAX_LIMIT as q,clampLimit as z,defineListArgs as G}from"./packem_shared/DEFAULT_LIMIT-pT_tV8R0.mjs";import{defineMigration as $}from"./packem_shared/defineMigration-CXOS0Bvq.mjs";import{defineModule as re}from"./packem_shared/defineModule-OecXWM3U.mjs";import{defineMutator as te}from"./packem_shared/defineMutator-
|
|
1
|
+
import{ACTION_CACHE_DEFAULT_TTL_MS as t,ACTION_CACHE_TABLE as i,actionCacheExtension as n,cacheKeyFor as a,defineActionCache as f}from"./packem_shared/ACTION_CACHE_DEFAULT_TTL_MS-DHpfdhmu.mjs";import{initLunora as d}from"./packem_shared/initLunora-DAbEYdSo.mjs";import{isPerDispatchMiddleware as m,tagPerDispatchMiddleware as x}from"./packem_shared/isPerDispatchMiddleware-DDQPatSm.mjs";import{createSecrets as l}from"./packem_shared/createSecrets-D6rLB42U.mjs";import{beginDeferredDeletes as h,flushDeferredDeletes as S,withDeferredDeletes as u}from"./packem_shared/beginDeferredDeletes-DhwFBbvs.mjs";import{beginDeferredSchedules as T,withDeferredSchedules as g}from"./packem_shared/beginDeferredSchedules-DJ6U4iq5.mjs";import{DOCUMENT_HISTORY_REDACTED_FIELDS as R,DOCUMENT_HISTORY_TABLE as _,defineDocumentHistory as L,documentHistoryExtension as C}from"./packem_shared/DOCUMENT_HISTORY_REDACTED_FIELDS-DAfomt5Q.mjs";import{LunoraEnvError as M,defineEnv as P,redactSecrets as b}from"./packem_shared/LunoraEnvError-A5I-PzMh.mjs";import{bindOrm as F,bindTableFacade as O}from"./packem_shared/bindOrm-D_hFUjmr.mjs";import{httpAction as N,httpRoute as w,httpRouter as U,isSafeHeaderValue as k}from"./packem_shared/httpAction-DFVhrm8u.mjs";import{serveStorageObject as B}from"./packem_shared/serveStorageObject-9mdw0nyU.mjs";import{defineIdentity as W}from"./packem_shared/defineIdentity-DwkNKwYa.mjs";import{onConnect as Y,onDisconnect as J,onShardInit as K}from"./packem_shared/onConnect-BLRoOpv2.mjs";import{DEFAULT_LIMIT as X,DEFAULT_MAX_LIMIT as q,clampLimit as z,defineListArgs as G}from"./packem_shared/DEFAULT_LIMIT-pT_tV8R0.mjs";import{defineMigration as $}from"./packem_shared/defineMigration-CXOS0Bvq.mjs";import{defineModule as re}from"./packem_shared/defineModule-OecXWM3U.mjs";import{defineMutator as te}from"./packem_shared/defineMutator-B4ipDtDR.mjs";import{c as ne,d as ae,a as fe,b as se,e as de,f as pe,g as me,h as xe,i as ce,j as le,k as Ee,m as he}from"./packem_shared/plugin-DRIqze14.mjs";import{PRESENCE_DEFAULT_TTL_MS as ue,PRESENCE_TABLE as De,definePresence as Te,presenceExtension as ge}from"./packem_shared/PRESENCE_DEFAULT_TTL_MS-DObDBz6_.mjs";import{protectPublic as Re}from"./packem_shared/protectPublic-BUYCMZZB.mjs";import{onQueryChange as Le}from"./packem_shared/onQueryChange-CatdYnH5.mjs";import{createServices as Ie}from"./packem_shared/createServices-IJvoqi0e.mjs";import{defineShape as Pe}from"./packem_shared/defineShape-CbHQpfYD.mjs";import{anyApi as ye}from"./types.mjs";import{onWhisper as Oe}from"./packem_shared/onWhisper-CfDbFLQh.mjs";import{LunoraError as Ne}from"@lunora/errors";import{cronJobs as Ue}from"@lunora/scheduler";import{ValidationError as ve,v as Be}from"@lunora/values";import{allowAll as We,deny as je,isDeny as Ye,toWhereInput as Je}from"./packem_shared/allowAll-DkRAgItV.mjs";import{asBucketStorage as Qe}from"./packem_shared/asBucketStorage-DoGYOjq3.mjs";import{assertShapesDeclareReadPolicies as qe,buildRlsReadRegistry as ze,composeShapeReadWhere as Ge}from"./packem_shared/assertShapesDeclareReadPolicies-d9t7YZ7U.mjs";import{buildMaskRegistry as $e}from"./packem_shared/buildMaskRegistry-DpWMtalG.mjs";import{createPolicyDsl as rr,definePermission as or,definePolicies as tr,definePolicy as ir,defineRole as nr}from"./packem_shared/createPolicyDsl-BZa6SqLJ.mjs";import{defineStorageRule as fr,defineStorageRules as sr}from"./packem_shared/defineStorageRule-Dv4nJE0H.mjs";import{mask as pr}from"./packem_shared/mask-DrapWB_J.mjs";import{r as xr}from"./packem_shared/middleware-ChNz4wOv.mjs";import{storageRules as lr}from"./packem_shared/storageRules-1GWSFFnl.mjs";const e="0.0.0";export{t as ACTION_CACHE_DEFAULT_TTL_MS,i as ACTION_CACHE_TABLE,X as DEFAULT_LIMIT,q as DEFAULT_MAX_LIMIT,R as DOCUMENT_HISTORY_REDACTED_FIELDS,_ as DOCUMENT_HISTORY_TABLE,M as LunoraEnvError,Ne as LunoraError,ue as PRESENCE_DEFAULT_TTL_MS,De as PRESENCE_TABLE,e as VERSION,ve as ValidationError,n as actionCacheExtension,We as allowAll,ye as anyApi,Qe as asBucketStorage,qe as assertShapesDeclareReadPolicies,h as beginDeferredDeletes,T as beginDeferredSchedules,F as bindOrm,O as bindTableFacade,$e as buildMaskRegistry,ze as buildRlsReadRegistry,a as cacheKeyFor,z as clampLimit,ne as composePluginMiddleware,Ge as composeShapeReadWhere,rr as createPolicyDsl,l as createSecrets,Ie as createServices,Ue as cronJobs,f as defineActionCache,ae as defineAggregateIndex,fe as defineComponent,L as defineDocumentHistory,P as defineEnv,W as defineIdentity,G as defineListArgs,$ as defineMigration,re as defineModule,te as defineMutator,or as definePermission,se as definePlugin,tr as definePolicies,ir as definePolicy,Te as definePresence,de as defineRankIndex,nr as defineRole,pe as defineSchema,me as defineSchemaExtension,Pe as defineShape,fr as defineStorageRule,sr as defineStorageRules,xe as defineTable,ce as defineVectorIndex,je as deny,C as documentHistoryExtension,S as flushDeferredDeletes,N as httpAction,w as httpRoute,U as httpRouter,le as indexFieldsFromSchema,d as initLunora,Ee as installPlugins,Ye as isDeny,m as isPerDispatchMiddleware,k as isSafeHeaderValue,pr as mask,he as mergeSchemaExtension,Y as onConnect,J as onDisconnect,Le as onQueryChange,K as onShardInit,Oe as onWhisper,ge as presenceExtension,Re as protectPublic,b as redactSecrets,xr as rls,B as serveStorageObject,lr as storageRules,x as tagPerDispatchMiddleware,Je as toWhereInput,Be as v,u as withDeferredDeletes,g as withDeferredSchedules};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{LunoraError as s}from"@lunora/errors";import{c}from"./context-identity-B2XYGA0B.mjs";import{v as m}from"./functions-B2-H4PQT.mjs";const w=(r,o,a)=>{if(r.trim()==="")throw new s("INTERNAL",'defineMutator: `owner` must name the column carrying the row owner (e.g. `owner: "userId"`)');const t=c(o);if(t===void 0)throw new s("UNAUTHORIZED","defineMutator: an owner-scoped mutator requires a verified identity; none was resolved for this request");const e=a,n=e[r];if(n!==void 0&&n!==t)throw new s("FORBIDDEN",`defineMutator: \`${r}\` does not match the verified identity — a mutator may only write rows its caller owns`);return e[r]=t,a},h=r=>{const o={},a=async(t,e)=>{const n=m(r.args??{},e),u=r.owner===void 0?n:w(r.owner,t,n);return Reflect.apply(r.server,o.mutator,[t,u])};return o.mutator={__lunoraMutator:!0,...r,handler:a,kind:"mutation",server:async(t,e)=>a(t,e)},o.mutator};export{h as defineMutator};
|
package/dist/types.d.mts
CHANGED
|
@@ -2643,9 +2643,10 @@ interface MutationCtx {
|
|
|
2643
2643
|
* Compose a submutation in-process, reusing this mutation's `db` writer.
|
|
2644
2644
|
* Executes the referenced mutation's handler directly — no fresh DO RPC —
|
|
2645
2645
|
* so its writes apply through the same shard invocation as the enclosing
|
|
2646
|
-
* mutation.
|
|
2647
|
-
*
|
|
2648
|
-
*
|
|
2646
|
+
* mutation. The submutation joins the enclosing mutation's transaction
|
|
2647
|
+
* (SQLite in a Durable Object has no savepoints, so it rides the open span):
|
|
2648
|
+
* its writes commit or roll back together with the caller's, and a throw that
|
|
2649
|
+
* escapes the outer handler rolls back both. Mirrors Convex's `ctx.runMutation`.
|
|
2649
2650
|
*/
|
|
2650
2651
|
readonly runMutation: RunMutation;
|
|
2651
2652
|
/**
|
package/dist/types.d.ts
CHANGED
|
@@ -2643,9 +2643,10 @@ interface MutationCtx {
|
|
|
2643
2643
|
* Compose a submutation in-process, reusing this mutation's `db` writer.
|
|
2644
2644
|
* Executes the referenced mutation's handler directly — no fresh DO RPC —
|
|
2645
2645
|
* so its writes apply through the same shard invocation as the enclosing
|
|
2646
|
-
* mutation.
|
|
2647
|
-
*
|
|
2648
|
-
*
|
|
2646
|
+
* mutation. The submutation joins the enclosing mutation's transaction
|
|
2647
|
+
* (SQLite in a Durable Object has no savepoints, so it rides the open span):
|
|
2648
|
+
* its writes commit or roll back together with the caller's, and a throw that
|
|
2649
|
+
* escapes the outer handler rolls back both. Mirrors Convex's `ctx.runMutation`.
|
|
2649
2650
|
*/
|
|
2650
2651
|
readonly runMutation: RunMutation;
|
|
2651
2652
|
/**
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{LunoraError as a}from"@lunora/errors";import{c as u}from"./context-identity-B2XYGA0B.mjs";import{v as c}from"./functions-B2-H4PQT.mjs";const w=(r,s,t)=>{if(r.trim()==="")throw new a("INTERNAL",'defineMutator: `owner` must name the column carrying the row owner (e.g. `owner: "userId"`)');const e=u(s);if(e===void 0)throw new a("UNAUTHORIZED","defineMutator: an owner-scoped mutator requires a verified identity; none was resolved for this request");const o=t,n=o[r];if(n!==void 0&&n!==e)throw new a("FORBIDDEN",`defineMutator: \`${r}\` does not match the verified identity — a mutator may only write rows its caller owns`);return o[r]=e,t},h=r=>({__lunoraMutator:!0,...r,handler:async(t,e)=>{const o=c(r.args??{},e),n=r.owner===void 0?o:w(r.owner,t,o);return r.server(t,n)},kind:"mutation"});export{h as defineMutator};
|