@lunora/server 1.0.0-alpha.1 → 1.0.0-alpha.2

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.mjs CHANGED
@@ -1,22 +1,22 @@
1
1
  export { default as asBucketStorage } from './packem_shared/asBucketStorage-Cnxd9y2q.mjs';
2
2
  export { initLunora } from './packem_shared/initLunora-CATvPsVt.mjs';
3
- export { LunoraEnvError, defineEnv, redactSecrets } from './packem_shared/defineEnv-DjFkpkSP.mjs';
3
+ export { LunoraEnvError, defineEnv, redactSecrets } from './packem_shared/LunoraEnvError-DjFkpkSP.mjs';
4
4
  export { LunoraError } from './packem_shared/LunoraError-DhggBJZF.mjs';
5
- export { bindOrm, bindTableFacade } from './packem_shared/bindTableFacade-DCuyr46L.mjs';
5
+ export { bindOrm, bindTableFacade } from './packem_shared/bindOrm-DCuyr46L.mjs';
6
6
  export { httpAction, httpRoute, httpRouter, serveStorageObject } from './packem_shared/httpAction-B7FYUEgr.mjs';
7
7
  export { onConnect, onDisconnect } from './packem_shared/onConnect-CIPXKPyw.mjs';
8
8
  export { defineMigration } from './packem_shared/defineMigration-CAJLr6fx.mjs';
9
- export { composePluginMiddleware, defineComponent, definePlugin, defineSchemaExtension, installPlugins, mergeSchemaExtension } from './packem_shared/defineSchemaExtension-Ck5_TUO8.mjs';
10
- export { PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, definePresence, presenceExtension } from './packem_shared/definePresence-D5LtwGl0.mjs';
9
+ export { composePluginMiddleware, defineComponent, definePlugin, defineSchemaExtension, installPlugins, mergeSchemaExtension } from './packem_shared/composePluginMiddleware-Ck5_TUO8.mjs';
10
+ export { PRESENCE_DEFAULT_TTL_MS, PRESENCE_TABLE, definePresence, presenceExtension } from './packem_shared/PRESENCE_DEFAULT_TTL_MS-BZYd5-uo.mjs';
11
11
  export { protectPublic } from './packem_shared/protectPublic-BjFkQ_Or.mjs';
12
- export { defineAggregateIndex, defineRankIndex, defineSchema, defineTable, defineVectorIndex } from './packem_shared/defineAggregateIndex-DzqxtAyV.mjs';
12
+ export { defineAggregateIndex, defineRankIndex, defineSchema, defineTable, defineVectorIndex } from './packem_shared/defineAggregateIndex-DxSso0rH.mjs';
13
13
  export { anyApi } from './types.mjs';
14
14
  export { cronJobs } from '@lunora/scheduler';
15
15
  export { ValidationError, v } from '@lunora/values';
16
- export { createPolicyDsl, definePermission, definePolicies, definePolicy, defineRole } from './packem_shared/definePolicy-De67zPDS.mjs';
16
+ export { createPolicyDsl, definePermission, definePolicies, definePolicy, defineRole } from './packem_shared/createPolicyDsl-De67zPDS.mjs';
17
17
  export { defineStorageRule, defineStorageRules } from './packem_shared/defineStorageRule-qu0mpilX.mjs';
18
- export { mask } from './packem_shared/mask-CkZJHHMM.mjs';
19
- export { rls } from './packem_shared/rls-Zhf5wEeJ.mjs';
18
+ export { mask } from './packem_shared/mask-Jc84C_hK.mjs';
19
+ export { rls } from './packem_shared/rls-BDKRbMCA.mjs';
20
20
  export { storageRules } from './packem_shared/storageRules-4a30FSpI.mjs';
21
21
 
22
22
  const VERSION = "0.0.0";
@@ -2,8 +2,8 @@ import { v } from '@lunora/values';
2
2
  import { initLunora } from './initLunora-CATvPsVt.mjs';
3
3
  import { LunoraError } from './LunoraError-DhggBJZF.mjs';
4
4
  import { onDisconnect } from './onConnect-CIPXKPyw.mjs';
5
- import { defineSchemaExtension, defineComponent } from './defineSchemaExtension-Ck5_TUO8.mjs';
6
- import { defineTable } from './defineAggregateIndex-DzqxtAyV.mjs';
5
+ import { defineSchemaExtension, defineComponent } from './composePluginMiddleware-Ck5_TUO8.mjs';
6
+ import { defineTable } from './defineAggregateIndex-DxSso0rH.mjs';
7
7
 
8
8
  const DEFAULT_TTL_MS = 3e4;
9
9
  const MAX_DATA_BYTES = 4096;
@@ -1,5 +1,5 @@
1
1
  import { isOrWrapsFromValidator } from '@lunora/values';
2
- import { mergeSchemaExtension } from './defineSchemaExtension-Ck5_TUO8.mjs';
2
+ import { mergeSchemaExtension } from './composePluginMiddleware-Ck5_TUO8.mjs';
3
3
 
4
4
  const relationBuilder = {
5
5
  many: (table, options) => {
@@ -1,5 +1,5 @@
1
1
  import { LunoraError } from './LunoraError-DhggBJZF.mjs';
2
- import { bindTableFacade, bindOrm } from './bindTableFacade-DCuyr46L.mjs';
2
+ import { bindTableFacade, bindOrm } from './bindOrm-DCuyr46L.mjs';
3
3
 
4
4
  const permissionName = (permission) => typeof permission === "string" ? permission : permission.name;
5
5
  const indexRolePermissions = (roles) => {
@@ -1,5 +1,5 @@
1
1
  import { LunoraError } from './LunoraError-DhggBJZF.mjs';
2
- import { bindTableFacade, bindOrm } from './bindTableFacade-DCuyr46L.mjs';
2
+ import { bindTableFacade, bindOrm } from './bindOrm-DCuyr46L.mjs';
3
3
 
4
4
  const DEFAULT_BATCH_LIMIT = 500;
5
5
  const assertBatchLimit = (count, limit, op) => {
@@ -1,4 +1,4 @@
1
- import { indexRolePermissions, computeReadBaseWhere, matchesWhere, evaluateWrite, permissionName } from '../packem_shared/rls-Zhf5wEeJ.mjs';
1
+ import { indexRolePermissions, computeReadBaseWhere, matchesWhere, evaluateWrite, permissionName } from '../packem_shared/rls-BDKRbMCA.mjs';
2
2
 
3
3
  const expectPolicy = (policies, options = {}) => {
4
4
  const rolePermissions = indexRolePermissions(options.roles);
package/dist/types.d.mts CHANGED
@@ -953,6 +953,14 @@ interface QueryCtx {
953
953
  /** Structured, function-attributed logger; see {@link LunoraLogger}. */
954
954
  readonly log: LunoraLogger;
955
955
  /**
956
+ * Wall-clock time (epoch ms) the function began, captured once so the whole
957
+ * handler sees a single stable value. Query/mutation handlers must be
958
+ * deterministic — they may be re-run on OCC retry / subscription re-eval — so
959
+ * read time through `ctx.now` instead of `Date.now()` (the latter is flagged
960
+ * by the `nondeterministic_query_mutation` advisor). Actions may use `Date.now()`.
961
+ */
962
+ readonly now: number;
963
+ /**
956
964
  * Compose a read-only subquery in-process, reusing this query's read
957
965
  * context (same transaction, same `db`). Executes the referenced query's
958
966
  * handler directly — no fresh DO RPC round-trip — so it observes the exact
@@ -977,6 +985,14 @@ interface MutationCtx {
977
985
  /** Structured, function-attributed logger; see {@link LunoraLogger}. */
978
986
  readonly log: LunoraLogger;
979
987
  /**
988
+ * Wall-clock time (epoch ms) the function began, captured once so the whole
989
+ * handler sees a single stable value. Mutation handlers must be deterministic
990
+ * — they may be re-run on OCC retry — so read time through `ctx.now` instead
991
+ * of `Date.now()` (the latter is flagged by the `nondeterministic_query_mutation`
992
+ * advisor). Actions may use `Date.now()`.
993
+ */
994
+ readonly now: number;
995
+ /**
980
996
  * Compose a submutation in-process, reusing this mutation's `db` writer.
981
997
  * Executes the referenced mutation's handler directly — no fresh DO RPC —
982
998
  * so its writes apply through the same shard invocation as the enclosing
@@ -1011,6 +1027,12 @@ interface ActionCtx {
1011
1027
  readonly ip?: string;
1012
1028
  /** Structured, function-attributed logger; see {@link LunoraLogger}. */
1013
1029
  readonly log: LunoraLogger;
1030
+ /**
1031
+ * Wall-clock time (epoch ms) the action began, captured once for convenience
1032
+ * and parity with query/mutation `ctx.now`. Actions run exactly once, so they
1033
+ * may also use ambient `Date.now()` freely.
1034
+ */
1035
+ readonly now: number;
1014
1036
  readonly runAction: <A extends ArgsValidator, R>(reference: RegisteredAction<A, R>, args: InferArgs<A>) => Promise<R>;
1015
1037
  readonly runMutation: <A extends ArgsValidator, R>(reference: RegisteredMutation<A, R>, args: InferArgs<A>) => Promise<R>;
1016
1038
  readonly runQuery: <A extends ArgsValidator, R>(reference: RegisteredQuery<A, R>, args: InferArgs<A>) => Promise<R>;
package/dist/types.d.ts CHANGED
@@ -953,6 +953,14 @@ interface QueryCtx {
953
953
  /** Structured, function-attributed logger; see {@link LunoraLogger}. */
954
954
  readonly log: LunoraLogger;
955
955
  /**
956
+ * Wall-clock time (epoch ms) the function began, captured once so the whole
957
+ * handler sees a single stable value. Query/mutation handlers must be
958
+ * deterministic — they may be re-run on OCC retry / subscription re-eval — so
959
+ * read time through `ctx.now` instead of `Date.now()` (the latter is flagged
960
+ * by the `nondeterministic_query_mutation` advisor). Actions may use `Date.now()`.
961
+ */
962
+ readonly now: number;
963
+ /**
956
964
  * Compose a read-only subquery in-process, reusing this query's read
957
965
  * context (same transaction, same `db`). Executes the referenced query's
958
966
  * handler directly — no fresh DO RPC round-trip — so it observes the exact
@@ -977,6 +985,14 @@ interface MutationCtx {
977
985
  /** Structured, function-attributed logger; see {@link LunoraLogger}. */
978
986
  readonly log: LunoraLogger;
979
987
  /**
988
+ * Wall-clock time (epoch ms) the function began, captured once so the whole
989
+ * handler sees a single stable value. Mutation handlers must be deterministic
990
+ * — they may be re-run on OCC retry — so read time through `ctx.now` instead
991
+ * of `Date.now()` (the latter is flagged by the `nondeterministic_query_mutation`
992
+ * advisor). Actions may use `Date.now()`.
993
+ */
994
+ readonly now: number;
995
+ /**
980
996
  * Compose a submutation in-process, reusing this mutation's `db` writer.
981
997
  * Executes the referenced mutation's handler directly — no fresh DO RPC —
982
998
  * so its writes apply through the same shard invocation as the enclosing
@@ -1011,6 +1027,12 @@ interface ActionCtx {
1011
1027
  readonly ip?: string;
1012
1028
  /** Structured, function-attributed logger; see {@link LunoraLogger}. */
1013
1029
  readonly log: LunoraLogger;
1030
+ /**
1031
+ * Wall-clock time (epoch ms) the action began, captured once for convenience
1032
+ * and parity with query/mutation `ctx.now`. Actions run exactly once, so they
1033
+ * may also use ambient `Date.now()` freely.
1034
+ */
1035
+ readonly now: number;
1014
1036
  readonly runAction: <A extends ArgsValidator, R>(reference: RegisteredAction<A, R>, args: InferArgs<A>) => Promise<R>;
1015
1037
  readonly runMutation: <A extends ArgsValidator, R>(reference: RegisteredMutation<A, R>, args: InferArgs<A>) => Promise<R>;
1016
1038
  readonly runQuery: <A extends ArgsValidator, R>(reference: RegisteredQuery<A, R>, args: InferArgs<A>) => Promise<R>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/server",
3
- "version": "1.0.0-alpha.1",
3
+ "version": "1.0.0-alpha.2",
4
4
  "description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
5
5
  "keywords": [
6
6
  "backend",