@lunora/server 1.0.0-alpha.15 → 1.0.0-alpha.17

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/LICENSE.md CHANGED
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
103
103
  under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
104
104
  CONDITIONS OF ANY KIND, either express or implied. See the License for the
105
105
  specific language governing permissions and limitations under the License.
106
+
107
+ <!-- DEPENDENCIES -->
108
+ <!-- /DEPENDENCIES -->
109
+
110
+ <!-- TYPE_DEPENDENCIES -->
111
+ <!-- /TYPE_DEPENDENCIES -->
package/dist/index.mjs CHANGED
@@ -4,7 +4,7 @@ export { createSecrets } from './packem_shared/createSecrets-DwaR2rNG.mjs';
4
4
  export { LunoraEnvError, defineEnv, redactSecrets } from './packem_shared/LunoraEnvError-BGmd1Qs0.mjs';
5
5
  export { LunoraError } from './packem_shared/LunoraError-WbxmrpxR.mjs';
6
6
  export { bindOrm, bindTableFacade } from './packem_shared/bindOrm-CNXKgfUa.mjs';
7
- export { httpAction, httpRoute, httpRouter, isSafeHeaderValue, serveStorageObject } from './packem_shared/httpAction-B_16WzMO.mjs';
7
+ export { httpAction, httpRoute, httpRouter, isSafeHeaderValue, serveStorageObject } from './packem_shared/httpAction-C_L82dxR.mjs';
8
8
  export { defineIdentity } from './packem_shared/defineIdentity-DiX4zM9x.mjs';
9
9
  export { onConnect, onDisconnect } from './packem_shared/onConnect-CIPXKPyw.mjs';
10
10
  export { defineMigration } from './packem_shared/defineMigration-Hx01yIht.mjs';
@@ -110,7 +110,11 @@ const errorResponse = (error) => {
110
110
  return Response.json({ code: "BAD_REQUEST", error: error.message }, { status: 400 });
111
111
  }
112
112
  if (error instanceof LunoraError) {
113
- return Response.json({ code: error.code, error: error.message }, { status: error.status });
113
+ const { body, redacted, status } = toErrorBody(error, { fallbackCode: "INTERNAL_SERVER_ERROR", redactedMessage: "Internal error" });
114
+ if (redacted) {
115
+ console.error("[lunora] http action error (redacted on the wire):", error);
116
+ }
117
+ return Response.json({ code: body.code, error: body.message }, { status });
114
118
  }
115
119
  throw error;
116
120
  };
package/dist/types.d.mts CHANGED
@@ -1044,6 +1044,14 @@ interface QueryCtx {
1044
1044
  readonly auth: AuthState;
1045
1045
  readonly db: DatabaseReader;
1046
1046
  /**
1047
+ * The validated, typed environment. Populated only when the project declares
1048
+ * a `defineEnv(...)` contract in `lunora/env.ts`; codegen then narrows this to
1049
+ * the validated `InferEnv` shape so `ctx.env.STRIPE_KEY` is parsed and
1050
+ * coercion-aware. Absent (optional) without a contract — declare
1051
+ * `lunora/env.ts` to populate and type it.
1052
+ */
1053
+ readonly env?: Record<string, unknown>;
1054
+ /**
1047
1055
  * The caller's IP for this request — Cloudflare's trusted `CF-Connecting-IP`,
1048
1056
  * forwarded server-side (never read from a client header). `undefined` when
1049
1057
  * unknown: a live-subscription re-run, a server-initiated dispatch, or
@@ -1078,6 +1086,14 @@ interface MutationCtx {
1078
1086
  readonly auth: AuthState;
1079
1087
  readonly db: DatabaseWriter;
1080
1088
  /**
1089
+ * The validated, typed environment. Populated only when the project declares
1090
+ * a `defineEnv(...)` contract in `lunora/env.ts`; codegen then narrows this to
1091
+ * the validated `InferEnv` shape so `ctx.env.STRIPE_KEY` is parsed and
1092
+ * coercion-aware. Absent (optional) without a contract — declare
1093
+ * `lunora/env.ts` to populate and type it.
1094
+ */
1095
+ readonly env?: Record<string, unknown>;
1096
+ /**
1081
1097
  * The caller's IP for this request — Cloudflare's trusted `CF-Connecting-IP`,
1082
1098
  * forwarded server-side (never read from a client header). `undefined` when
1083
1099
  * unknown: a live-subscription re-run, a server-initiated dispatch, or
@@ -1121,6 +1137,14 @@ interface MutationCtx {
1121
1137
  interface ActionCtx {
1122
1138
  readonly auth: AuthState;
1123
1139
  readonly db: DatabaseWriter;
1140
+ /**
1141
+ * The validated, typed environment. Populated only when the project declares
1142
+ * a `defineEnv(...)` contract in `lunora/env.ts`; codegen then narrows this to
1143
+ * the validated `InferEnv` shape so `ctx.env.STRIPE_KEY` is parsed and
1144
+ * coercion-aware. Absent (optional) without a contract — declare
1145
+ * `lunora/env.ts` to populate and type it.
1146
+ */
1147
+ readonly env?: Record<string, unknown>;
1124
1148
  readonly fetch: typeof globalThis.fetch;
1125
1149
  /**
1126
1150
  * The caller's IP for this request — Cloudflare's trusted `CF-Connecting-IP`,
package/dist/types.d.ts CHANGED
@@ -1044,6 +1044,14 @@ interface QueryCtx {
1044
1044
  readonly auth: AuthState;
1045
1045
  readonly db: DatabaseReader;
1046
1046
  /**
1047
+ * The validated, typed environment. Populated only when the project declares
1048
+ * a `defineEnv(...)` contract in `lunora/env.ts`; codegen then narrows this to
1049
+ * the validated `InferEnv` shape so `ctx.env.STRIPE_KEY` is parsed and
1050
+ * coercion-aware. Absent (optional) without a contract — declare
1051
+ * `lunora/env.ts` to populate and type it.
1052
+ */
1053
+ readonly env?: Record<string, unknown>;
1054
+ /**
1047
1055
  * The caller's IP for this request — Cloudflare's trusted `CF-Connecting-IP`,
1048
1056
  * forwarded server-side (never read from a client header). `undefined` when
1049
1057
  * unknown: a live-subscription re-run, a server-initiated dispatch, or
@@ -1078,6 +1086,14 @@ interface MutationCtx {
1078
1086
  readonly auth: AuthState;
1079
1087
  readonly db: DatabaseWriter;
1080
1088
  /**
1089
+ * The validated, typed environment. Populated only when the project declares
1090
+ * a `defineEnv(...)` contract in `lunora/env.ts`; codegen then narrows this to
1091
+ * the validated `InferEnv` shape so `ctx.env.STRIPE_KEY` is parsed and
1092
+ * coercion-aware. Absent (optional) without a contract — declare
1093
+ * `lunora/env.ts` to populate and type it.
1094
+ */
1095
+ readonly env?: Record<string, unknown>;
1096
+ /**
1081
1097
  * The caller's IP for this request — Cloudflare's trusted `CF-Connecting-IP`,
1082
1098
  * forwarded server-side (never read from a client header). `undefined` when
1083
1099
  * unknown: a live-subscription re-run, a server-initiated dispatch, or
@@ -1121,6 +1137,14 @@ interface MutationCtx {
1121
1137
  interface ActionCtx {
1122
1138
  readonly auth: AuthState;
1123
1139
  readonly db: DatabaseWriter;
1140
+ /**
1141
+ * The validated, typed environment. Populated only when the project declares
1142
+ * a `defineEnv(...)` contract in `lunora/env.ts`; codegen then narrows this to
1143
+ * the validated `InferEnv` shape so `ctx.env.STRIPE_KEY` is parsed and
1144
+ * coercion-aware. Absent (optional) without a contract — declare
1145
+ * `lunora/env.ts` to populate and type it.
1146
+ */
1147
+ readonly env?: Record<string, unknown>;
1124
1148
  readonly fetch: typeof globalThis.fetch;
1125
1149
  /**
1126
1150
  * The caller's IP for this request — Cloudflare's trusted `CF-Connecting-IP`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/server",
3
- "version": "1.0.0-alpha.15",
3
+ "version": "1.0.0-alpha.17",
4
4
  "description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
5
5
  "keywords": [
6
6
  "backend",
@@ -62,9 +62,9 @@
62
62
  "access": "public"
63
63
  },
64
64
  "dependencies": {
65
- "@lunora/errors": "1.0.0-alpha.1",
66
- "@lunora/scheduler": "1.0.0-alpha.5",
67
- "@lunora/values": "1.0.0-alpha.4",
65
+ "@lunora/errors": "1.0.0-alpha.2",
66
+ "@lunora/scheduler": "1.0.0-alpha.6",
67
+ "@lunora/values": "1.0.0-alpha.5",
68
68
  "drizzle-orm": "^0.45.2",
69
69
  "hono": "^4.12.27"
70
70
  },