@aeriajs/core 0.0.114 → 0.0.116

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.
@@ -269,41 +269,48 @@ const recurse = async (target, ctx) => {
269
269
  ]);
270
270
  continue;
271
271
  }
272
- if (!property && value && (value.constructor === Object || value.constructor === Array)) {
273
- // if first propName is preceded by '$' we assume
274
- // it contains MongoDB query operators
275
- if (Object.keys(value)[0]?.startsWith('$')) {
276
- if (!ctx.options.allowOperators) {
277
- return types_1.Result.error(types_1.ACError.InsecureOperator);
272
+ if (!property) {
273
+ if (value && (value.constructor === Object || value.constructor === Array)) {
274
+ // if first propName is preceded by '$' we assume
275
+ // it contains MongoDB query operators
276
+ if (Object.keys(value)[0]?.startsWith('$')) {
277
+ if (!ctx.options.allowOperators) {
278
+ return types_1.Result.error(types_1.ACError.InsecureOperator);
279
+ }
280
+ entries.push([
281
+ propName,
282
+ value,
283
+ ]);
284
+ continue;
278
285
  }
279
- entries.push([
280
- propName,
281
- value,
282
- ]);
283
- continue;
284
- }
285
- if (Array.isArray(value)) {
286
- const operations = [];
287
- for (const operation of value) {
288
- const { error, result } = await recurse(operation, ctx);
289
- if (error) {
290
- return types_1.Result.error(error);
286
+ if (Array.isArray(value)) {
287
+ const operations = [];
288
+ for (const operation of value) {
289
+ const { error, result } = await recurse(operation, ctx);
290
+ if (error) {
291
+ return types_1.Result.error(error);
292
+ }
293
+ operations.push(result);
291
294
  }
292
- operations.push(result);
295
+ entries.push([
296
+ propName,
297
+ operations,
298
+ ]);
299
+ continue;
300
+ }
301
+ const { error, result: operator } = await recurse(value, ctx);
302
+ if (error) {
303
+ return types_1.Result.error(error);
293
304
  }
294
305
  entries.push([
295
306
  propName,
296
- operations,
307
+ operator,
297
308
  ]);
298
309
  continue;
299
310
  }
300
- const { error, result: operator } = await recurse(value, ctx);
301
- if (error) {
302
- return types_1.Result.error(error);
303
- }
304
311
  entries.push([
305
312
  propName,
306
- operator,
313
+ value,
307
314
  ]);
308
315
  }
309
316
  if (property) {
@@ -233,39 +233,46 @@ const recurse = async (target, ctx) => {
233
233
  ]);
234
234
  continue;
235
235
  }
236
- if (!property && value && (value.constructor === Object || value.constructor === Array)) {
237
- if (Object.keys(value)[0]?.startsWith("$")) {
238
- if (!ctx.options.allowOperators) {
239
- return Result.error(ACError.InsecureOperator);
236
+ if (!property) {
237
+ if (value && (value.constructor === Object || value.constructor === Array)) {
238
+ if (Object.keys(value)[0]?.startsWith("$")) {
239
+ if (!ctx.options.allowOperators) {
240
+ return Result.error(ACError.InsecureOperator);
241
+ }
242
+ entries.push([
243
+ propName,
244
+ value
245
+ ]);
246
+ continue;
240
247
  }
241
- entries.push([
242
- propName,
243
- value
244
- ]);
245
- continue;
246
- }
247
- if (Array.isArray(value)) {
248
- const operations = [];
249
- for (const operation of value) {
250
- const { error: error2, result } = await recurse(operation, ctx);
251
- if (error2) {
252
- return Result.error(error2);
248
+ if (Array.isArray(value)) {
249
+ const operations = [];
250
+ for (const operation of value) {
251
+ const { error: error2, result } = await recurse(operation, ctx);
252
+ if (error2) {
253
+ return Result.error(error2);
254
+ }
255
+ operations.push(result);
253
256
  }
254
- operations.push(result);
257
+ entries.push([
258
+ propName,
259
+ operations
260
+ ]);
261
+ continue;
262
+ }
263
+ const { error, result: operator } = await recurse(value, ctx);
264
+ if (error) {
265
+ return Result.error(error);
255
266
  }
256
267
  entries.push([
257
268
  propName,
258
- operations
269
+ operator
259
270
  ]);
260
271
  continue;
261
272
  }
262
- const { error, result: operator } = await recurse(value, ctx);
263
- if (error) {
264
- return Result.error(error);
265
- }
266
273
  entries.push([
267
274
  propName,
268
- operator
275
+ value
269
276
  ]);
270
277
  }
271
278
  if (property) {
@@ -1,5 +1,5 @@
1
1
  import type { Context, SchemaWithId, CountPayload } from '@aeriajs/types';
2
- export declare const count: <TContext extends Context>(payload: CountPayload<SchemaWithId<Context['description']>>, context: TContext extends Context<any> ? TContext : never) => Promise<{
2
+ export declare const count: <TContext extends Context>(payload: CountPayload<SchemaWithId<TContext['description']>>, context: TContext extends Context<any> ? TContext : never) => Promise<{
3
3
  readonly _tag: "Result";
4
4
  readonly error: undefined;
5
5
  readonly result: any;
@@ -2,7 +2,7 @@ import type { Context, SchemaWithId, GetAllPayload } from '@aeriajs/types';
2
2
  export type GetAllOptions = {
3
3
  bypassSecurity?: boolean;
4
4
  };
5
- export declare const getAll: <TContext extends Context>(_payload: GetAllPayload<SchemaWithId<Context['description']>> | undefined, context: TContext, options?: GetAllOptions) => Promise<{
5
+ export declare const getAll: <TContext extends Context>(_payload: GetAllPayload<SchemaWithId<TContext['description']>> | undefined, context: TContext, options?: GetAllOptions) => Promise<{
6
6
  readonly _tag: "Result";
7
7
  readonly error: undefined;
8
8
  readonly result: SchemaWithId<TContext["description"]>[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/core",
3
- "version": "0.0.114",
3
+ "version": "0.0.116",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -41,13 +41,13 @@
41
41
  "mongodb-memory-server": "^9.2.0"
42
42
  },
43
43
  "peerDependencies": {
44
- "@aeriajs/builtins": "^0.0.114",
45
- "@aeriajs/common": "^0.0.73",
46
- "@aeriajs/entrypoint": "^0.0.75",
47
- "@aeriajs/http": "^0.0.84",
48
- "@aeriajs/security": "^0.0.114",
44
+ "@aeriajs/builtins": "^0.0.116",
45
+ "@aeriajs/common": "^0.0.74",
46
+ "@aeriajs/entrypoint": "^0.0.76",
47
+ "@aeriajs/http": "^0.0.85",
48
+ "@aeriajs/security": "^0.0.116",
49
49
  "@aeriajs/types": "^0.0.64",
50
- "@aeriajs/validation": "^0.0.76"
50
+ "@aeriajs/validation": "^0.0.77"
51
51
  },
52
52
  "dependencies": {
53
53
  "mongodb": "^6.5.0",