@rws-framework/db 2.1.2 → 2.1.5

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,10 +1,12 @@
1
+ import { OpModelType } from "src/models/_model";
1
2
  export interface IRWSCollectionOpts {
2
3
  relations?: {
3
4
  [key: string]: boolean;
4
5
  };
6
+ ignored_keys?: string[];
5
7
  }
6
8
  export interface IRWSCollectionMeta {
7
9
  collectionName: string;
8
10
  options?: IRWSCollectionOpts;
9
11
  }
10
- export declare function RWSCollection(collectionName: string, options?: IRWSCollectionOpts): (target: any) => void;
12
+ export declare function RWSCollection(collectionName: string, options?: IRWSCollectionOpts): (target: OpModelType<any>) => void;
@@ -6,7 +6,10 @@ function RWSCollection(collectionName, options) {
6
6
  return function (target) {
7
7
  target._collection = collectionName;
8
8
  if (options && options.relations) {
9
- target._collection = options.relations;
9
+ target._RELATIONS = options.relations;
10
+ }
11
+ if (options && options.ignored_keys) {
12
+ target._CUT_KEYS = options.ignored_keys;
10
13
  }
11
14
  Reflect.defineMetadata(`RWSCollection`, metaOpts, target);
12
15
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/db",
3
3
  "private": false,
4
- "version": "2.1.2",
4
+ "version": "2.1.5",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -1,7 +1,10 @@
1
+ import { OpModelType } from "../models/_model";
2
+
1
3
  export interface IRWSCollectionOpts {
2
4
  relations?: {
3
5
  [key: string]: boolean
4
- }
6
+ },
7
+ ignored_keys?: string[]
5
8
  }
6
9
 
7
10
  export interface IRWSCollectionMeta {
@@ -12,10 +15,13 @@ export interface IRWSCollectionMeta {
12
15
 
13
16
  export function RWSCollection(collectionName: string, options?: IRWSCollectionOpts) {
14
17
  const metaOpts: IRWSCollectionMeta = { collectionName, options };
15
- return function(target: any) {
18
+ return function(target: OpModelType<any>) {
16
19
  target._collection = collectionName;
17
20
  if(options && options.relations){
18
- target._collection = options.relations;
21
+ target._RELATIONS = options.relations;
22
+ }
23
+ if(options && options.ignored_keys){
24
+ target._CUT_KEYS = options.ignored_keys;
19
25
  }
20
26
  Reflect.defineMetadata(`RWSCollection`, metaOpts, target);
21
27
  };