@rws-framework/db 2.3.0 → 2.3.1

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.
@@ -8,7 +8,10 @@ function TrackType(type, opts = null, tags = []) {
8
8
  isArray: false
9
9
  };
10
10
  }
11
- else if (opts === null || opts === void 0 ? void 0 : opts.isArray) {
11
+ if (!(opts === null || opts === void 0 ? void 0 : opts.required)) {
12
+ opts.required = false;
13
+ }
14
+ if (!(opts === null || opts === void 0 ? void 0 : opts.isArray)) {
12
15
  opts.isArray = false;
13
16
  }
14
17
  const required = opts.required;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rws-framework/db",
3
3
  "private": false,
4
- "version": "2.3.0",
4
+ "version": "2.3.1",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -24,7 +24,13 @@ function TrackType(type: any, opts: ITrackerOpts | null = null, tags: string[] =
24
24
  required: false,
25
25
  isArray: false
26
26
  };
27
- }else if(opts?.isArray){
27
+ }
28
+
29
+ if(!opts?.required){
30
+ opts.required = false;
31
+ }
32
+
33
+ if(!opts?.isArray){
28
34
  opts.isArray = false;
29
35
  }
30
36
 
@@ -131,7 +131,8 @@ export class DbHelper {
131
131
  } else if (annotationType === 'InverseTimeSeries'){
132
132
  section += `\t${key} String[] @db.ObjectId\n`;
133
133
  } else if (annotationType === 'TrackType'){
134
- const tags: string[] = modelMetadata.tags.map((item: string) => '@' + item);
134
+ const tags: string[] = modelMetadata.tags.map((item: string) => '@' + item);
135
+
135
136
  if(modelMetadata.isArray || modelMetadata.type.name === 'Array'){
136
137
  requiredString = '';
137
138
  }
@@ -145,7 +146,8 @@ export class DbHelper {
145
146
 
146
147
  static toConfigCase(modelType: IMetaOpts): string {
147
148
  const type = modelType.type;
148
- let input = type.name;
149
+ let input = type.name;
150
+
149
151
 
150
152
  if(input == 'Number'){
151
153
  input = 'Int';