@lunora/server 1.0.0-alpha.26 → 1.0.0-alpha.27

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
@@ -20,7 +20,7 @@ export { ValidationError, v } from '@lunora/values';
20
20
  export { buildRlsReadRegistry, composeShapeReadWhere } from './packem_shared/buildRlsReadRegistry-D54vUQe4.mjs';
21
21
  export { createPolicyDsl, definePermission, definePolicies, definePolicy, defineRole } from './packem_shared/createPolicyDsl-By3QB4he.mjs';
22
22
  export { defineStorageRule, defineStorageRules } from './packem_shared/defineStorageRule-B5nL4Z1P.mjs';
23
- export { mask } from './packem_shared/mask-DSBtA3qp.mjs';
23
+ export { mask } from './packem_shared/mask-CZuu9WAF.mjs';
24
24
  export { rls } from './packem_shared/rls-B_ZWgslr.mjs';
25
25
  export { storageRules } from './packem_shared/storageRules-6QxzDOcx.mjs';
26
26
 
@@ -208,6 +208,20 @@ const wrapDatabase = (base, perTable, context) => {
208
208
  };
209
209
  const wrapped = {
210
210
  ...base,
211
+ async deleteWhere(tableName, where, options) {
212
+ assertWhereAllowed(tableName, where, "deleteMany({ where })");
213
+ if (base.deleteWhere === void 0) {
214
+ throw new LunoraError("INTERNAL", `ctx.db.${tableName}.deleteMany({ where }) is unavailable: this writer has no where-based delete`);
215
+ }
216
+ return base.deleteWhere(tableName, where, options);
217
+ },
218
+ async patchWhere(tableName, args, options) {
219
+ assertWhereAllowed(tableName, args.where, "patchMany({ where })");
220
+ if (base.patchWhere === void 0) {
221
+ throw new LunoraError("INTERNAL", `ctx.db.${tableName}.patchMany({ where }) is unavailable: this writer has no where-based patch`);
222
+ }
223
+ return base.patchWhere(tableName, args, options);
224
+ },
211
225
  aggregate(tableName, options) {
212
226
  assertReductionAllowed(tableName, [options.field], "aggregate");
213
227
  assertWhereAllowed(tableName, options.where, "aggregate");
@@ -224,6 +238,7 @@ const wrapDatabase = (base, perTable, context) => {
224
238
  },
225
239
  async findFirst(tableName, args) {
226
240
  assertWhereAllowed(tableName, args?.where, "findFirst");
241
+ assertWhereAllowed(tableName, args?.baseWhere, "findFirst");
227
242
  assertOrderByAllowed(tableName, args?.orderBy, "findFirst");
228
243
  const row = await base.findFirst(tableName, args);
229
244
  const columns = perTable.get(tableName);
@@ -231,6 +246,7 @@ const wrapDatabase = (base, perTable, context) => {
231
246
  },
232
247
  async findFirstOrThrow(tableName, args) {
233
248
  assertWhereAllowed(tableName, args?.where, "findFirstOrThrow");
249
+ assertWhereAllowed(tableName, args?.baseWhere, "findFirstOrThrow");
234
250
  assertOrderByAllowed(tableName, args?.orderBy, "findFirstOrThrow");
235
251
  const row = await base.findFirstOrThrow(tableName, args);
236
252
  const columns = perTable.get(tableName);
@@ -238,6 +254,7 @@ const wrapDatabase = (base, perTable, context) => {
238
254
  },
239
255
  async findMany(tableName, args) {
240
256
  assertWhereAllowed(tableName, args?.where, "findMany");
257
+ assertWhereAllowed(tableName, args?.baseWhere, "findMany");
241
258
  assertOrderByAllowed(tableName, args?.orderBy, "findMany");
242
259
  const page = await base.findMany(tableName, args);
243
260
  const columns = perTable.get(tableName);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/server",
3
- "version": "1.0.0-alpha.26",
3
+ "version": "1.0.0-alpha.27",
4
4
  "description": "Server primitives for Lunora: defineSchema, defineTable, query, mutation, and action",
5
5
  "keywords": [
6
6
  "backend",