@nattyjs/common 0.0.1-beta.46 → 0.0.1-beta.48

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.cjs CHANGED
@@ -603,9 +603,9 @@ function registerType(type) {
603
603
  }
604
604
 
605
605
  class AbstractRunner {
606
- stop() {
606
+ async stop() {
607
607
  if (this.childProcess)
608
- return this.childProcess.kill();
608
+ this.childProcess.kill();
609
609
  }
610
610
  async exec(command, args, cwd = process.cwd()) {
611
611
  const options = {
@@ -716,12 +716,16 @@ function overrideProp(instance, prop, modelName) {
716
716
  );
717
717
  let value = instance[prop.name];
718
718
  Object.defineProperty(instance, prop.name, {
719
+ enumerable: true,
720
+ configurable: true,
719
721
  get: () => {
720
722
  return descriptor ? descriptor.get.call(instance) : value;
721
723
  },
722
724
  set: (v) => {
725
+ if (prop.type == "boolean" && v !== null && v !== void 0)
726
+ v = v === 0 ? false : true;
723
727
  const type = typeof v;
724
- if (prop.type == type)
728
+ if (v === null || v === void 0 || prop.type == type)
725
729
  value = v;
726
730
  else
727
731
  throw new Error(`Incorrect value type of ${modelName} class property '${prop.name}' `);
package/dist/index.d.ts CHANGED
@@ -79,6 +79,15 @@ interface SecureConfig {
79
79
  sensitiveProps?: String[];
80
80
  }
81
81
 
82
+ interface PreInitEventConfig {
83
+ cors?: CorsConfig;
84
+ }
85
+
86
+ interface LifeCycleEvents {
87
+ preInit: () => PreInitEventConfig;
88
+ onStart: () => Promise<void>;
89
+ }
90
+
82
91
  interface NattyConfig {
83
92
  app: any;
84
93
  testModule?: NattyTestModule;
@@ -92,12 +101,17 @@ interface NattyConfig {
92
101
  cors?: CorsConfig;
93
102
  payload?: PayloadConfig;
94
103
  secure?: SecureConfig;
104
+ lifeCycle?: LifeCycleEvents;
105
+ webSchedule?: {
106
+ interval: number;
107
+ scheduleFunction: () => Promise<void>;
108
+ };
95
109
  }
96
110
 
97
111
  declare abstract class AbstractRunner {
98
112
  abstract run(): void;
99
113
  childProcess: ChildProcess;
100
- stop(): boolean;
114
+ stop(): Promise<void>;
101
115
  protected exec(command: string, args: any[], cwd?: string): Promise<null | string>;
102
116
  }
103
117
 
package/dist/index.mjs CHANGED
@@ -586,9 +586,9 @@ function registerType(type) {
586
586
  }
587
587
 
588
588
  class AbstractRunner {
589
- stop() {
589
+ async stop() {
590
590
  if (this.childProcess)
591
- return this.childProcess.kill();
591
+ this.childProcess.kill();
592
592
  }
593
593
  async exec(command, args, cwd = process.cwd()) {
594
594
  const options = {
@@ -699,12 +699,16 @@ function overrideProp(instance, prop, modelName) {
699
699
  );
700
700
  let value = instance[prop.name];
701
701
  Object.defineProperty(instance, prop.name, {
702
+ enumerable: true,
703
+ configurable: true,
702
704
  get: () => {
703
705
  return descriptor ? descriptor.get.call(instance) : value;
704
706
  },
705
707
  set: (v) => {
708
+ if (prop.type == "boolean" && v !== null && v !== void 0)
709
+ v = v === 0 ? false : true;
706
710
  const type = typeof v;
707
- if (prop.type == type)
711
+ if (v === null || v === void 0 || prop.type == type)
708
712
  value = v;
709
713
  else
710
714
  throw new Error(`Incorrect value type of ${modelName} class property '${prop.name}' `);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nattyjs/common",
3
- "version": "0.0.1-beta.46",
3
+ "version": "0.0.1-beta.48",
4
4
  "description": "Now I’m the model of a modern major general / The venerated Virginian veteran whose men are all / Lining up, to put me up on a pedestal / Writin’ letters to relatives / Embellishin’ my elegance and eloquence / But the elephant is in the room / The truth is in ya face when ya hear the British cannons go / BOOM",
5
5
  "keywords": [],
6
6
  "author": "ajayojha <ojhaajay@outlook.com>",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "devDependencies": {
23
23
  "@types/node": "20.3.1",
24
- "@nattyjs/types": "0.0.1-beta.46",
24
+ "@nattyjs/types": "0.0.1-beta.48",
25
25
  "unbuild": "1.2.1"
26
26
  }
27
27
  }