@aeriajs/core 0.0.146 → 0.0.148

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.
@@ -1,2 +1,2 @@
1
1
  import type { Context } from '@aeriajs/types';
2
- export declare const cascadingRemove: (target: Record<string, any>, context: Context) => Promise<void>;
2
+ export declare const cascadingRemove: (target: Record<string, unknown>, context: Context) => Promise<void>;
@@ -1,8 +1,8 @@
1
1
  export * from './cascadingRemove.js';
2
2
  export * from './define.js';
3
3
  export * from './description.js';
4
+ export * from './makePagination.js';
4
5
  export * from './normalizeProjection.js';
5
- export * from './pagination.js';
6
6
  export * from './preload.js';
7
7
  export * from './prepareInsert.js';
8
8
  export * from './reference.js';
@@ -17,8 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./cascadingRemove.js"), exports);
18
18
  __exportStar(require("./define.js"), exports);
19
19
  __exportStar(require("./description.js"), exports);
20
+ __exportStar(require("./makePagination.js"), exports);
20
21
  __exportStar(require("./normalizeProjection.js"), exports);
21
- __exportStar(require("./pagination.js"), exports);
22
22
  __exportStar(require("./preload.js"), exports);
23
23
  __exportStar(require("./prepareInsert.js"), exports);
24
24
  __exportStar(require("./reference.js"), exports);
@@ -2,8 +2,8 @@
2
2
  export * from "./cascadingRemove.mjs";
3
3
  export * from "./define.mjs";
4
4
  export * from "./description.mjs";
5
+ export * from "./makePagination.mjs";
5
6
  export * from "./normalizeProjection.mjs";
6
- export * from "./pagination.mjs";
7
7
  export * from "./preload.mjs";
8
8
  export * from "./prepareInsert.mjs";
9
9
  export * from "./reference.mjs";
@@ -1,4 +1,4 @@
1
1
  import type { Context, Description, Pagination, GetAllPayload } from '@aeriajs/types';
2
- export declare const makePagination: (payload: GetAllPayload<any>, documents: any[], context: Context<Description, {
2
+ export declare const makePagination: (payload: GetAllPayload<any>, documents: unknown[], context: Context<Description, {
3
3
  count?: (...args: unknown[]) => unknown;
4
4
  }>) => Promise<Pagination>;
@@ -1,2 +1,2 @@
1
1
  import type { Description } from '@aeriajs/types';
2
- export declare const prepareInsert: <TPayload extends Record<string, any>>(payload: TPayload, description: Description) => Record<string, any>;
2
+ export declare const prepareInsert: <TPayload extends Record<string, unknown>>(payload: TPayload, description: Description) => Record<string, any>;
@@ -28,11 +28,7 @@ const prepareUpdate = (doc) => {
28
28
  return result;
29
29
  };
30
30
  const prepareInsert = (payload, description) => {
31
- const doc = Object.assign({}, payload);
32
- const docId = payload._id;
33
- delete doc._id;
34
- delete doc.created_at;
35
- delete doc.updated_at;
31
+ const { _id: docId, ...doc } = Object.assign({}, payload);
36
32
  return docId
37
33
  ? prepareUpdate(doc)
38
34
  : prepareCreate(doc, description);
@@ -26,10 +26,6 @@ const prepareUpdate = (doc) => {
26
26
  return result;
27
27
  };
28
28
  export const prepareInsert = (payload, description) => {
29
- const doc = Object.assign({}, payload);
30
- const docId = payload._id;
31
- delete doc._id;
32
- delete doc.created_at;
33
- delete doc.updated_at;
29
+ const { _id: docId, ...doc } = Object.assign({}, payload);
34
30
  return docId ? prepareUpdate(doc) : prepareCreate(doc, description);
35
31
  };
@@ -7,4 +7,4 @@ export declare const getDatabase: () => Promise<{
7
7
  }>;
8
8
  export declare const getDatabaseSync: () => import("mongodb").Db;
9
9
  export declare const prepareCollectionName: (collectionName: string) => string;
10
- export declare const getDatabaseCollection: <TDocument extends Record<string, any>>(collectionName: string) => import("mongodb").Collection<PackReferences<TDocument>>;
10
+ export declare const getDatabaseCollection: <TDocument extends Record<string, unknown>>(collectionName: string) => import("mongodb").Collection<PackReferences<TDocument>>;
@@ -7,7 +7,9 @@ const common_1 = require("@aeriajs/common");
7
7
  const index_js_1 = require("../collection/index.js");
8
8
  const internalGetAll = async (payload, context) => {
9
9
  const { limit = context.config.paginationLimit, sort, project, offset = 0, } = payload;
10
- const filters = payload.filters || {};
10
+ const filters = payload.filters
11
+ ? Object.assign({}, payload.filters)
12
+ : {};
11
13
  const $text = payload.filters && '$text' in payload.filters
12
14
  ? payload.filters.$text
13
15
  : undefined;
@@ -15,7 +15,7 @@ const internalGetAll = async (payload, context) => {
15
15
  project,
16
16
  offset = 0
17
17
  } = payload;
18
- const filters = payload.filters || {};
18
+ const filters = payload.filters ? Object.assign({}, payload.filters) : {};
19
19
  const $text = payload.filters && "$text" in payload.filters ? payload.filters.$text : void 0;
20
20
  if ("$text" in filters) {
21
21
  delete filters.$text;
package/dist/token.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { SignOptions } from 'jsonwebtoken';
2
2
  export declare const EXPIRES_IN = 36000;
3
- export declare const signToken: (_payload: Record<string, any>, secret?: string | null, options?: SignOptions) => Promise<string>;
3
+ export declare const signToken: (_payload: Record<string, unknown>, secret?: string | null, options?: SignOptions) => Promise<string>;
4
4
  export declare const verifyToken: <TToken>(token: string, secret?: string) => Promise<TToken>;
5
5
  export declare const decodeToken: <TToken>(token: string, secret?: string) => Promise<TToken>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aeriajs/core",
3
- "version": "0.0.146",
3
+ "version": "0.0.148",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "aeriaMain": "tests/fixtures/aeriaMain.js",
@@ -42,11 +42,11 @@
42
42
  "mongodb-memory-server": "^9.2.0"
43
43
  },
44
44
  "peerDependencies": {
45
- "@aeriajs/builtins": "^0.0.146",
45
+ "@aeriajs/builtins": "^0.0.148",
46
46
  "@aeriajs/common": "^0.0.90",
47
47
  "@aeriajs/entrypoint": "^0.0.92",
48
48
  "@aeriajs/http": "^0.0.102",
49
- "@aeriajs/security": "^0.0.146",
49
+ "@aeriajs/security": "^0.0.148",
50
50
  "@aeriajs/types": "^0.0.78",
51
51
  "@aeriajs/validation": "^0.0.93"
52
52
  },