chyz 2.0.0-rc.30 → 2.0.0-rc.32
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/BaseChyz.d.ts.map +1 -1
- package/BaseChyz.js +17 -14
- package/base/Model.js +1 -1
- package/package.json +1 -1
package/BaseChyz.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"BaseChyz.d.ts","sourceRoot":"","sources":["../src/BaseChyz.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,IAAI,EAAC,MAAM,aAAa,CAAC;AA8GjC,MAAM,CAAC,OAAO,OAAO,QAAQ;IACzB,OAAO,CAAC,MAAM,CAAuB;IACrC,MAAM,CAAC,UAAU,EAAE,GAAG,CAAC;IACvB,MAAM,CAAC,SAAS,EAAE,GAAG,CAAS;IAC9B,OAAO,CAAC,KAAK,CAAgB;IAC7B,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IACf,MAAM,CAAC,IAAI,EAAE,GAAG,CAAS;IACzB,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IACnB,MAAM,CAAC,IAAI,EAAE,IAAI,CAAc;IAC/B,OAAO,CAAC,MAAM,CAAC,SAAS,CAAiB;IACzC,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,MAAM,CAAC,WAAW,CAA4B;IACtD,OAAc,UAAU,EAAE,GAAG,CAAK;IAClC,OAAc,WAAW,EAAE,GAAG,CAAK;IACnC,OAAO,CAAC,MAAM,CAAC,aAAa,CAAU;IAGtC,MAAM,KAAK,YAAY,IAAI,GAAG,CAE7B;IAED,MAAM,KAAK,YAAY,CAAC,KAAK,EAAE,GAAG,EAEjC;IAED,IAAI,cAAc,IAAI,MAAM,CAE3B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
|
@@ -124,18 +124,6 @@ validate.validators.tokenString = (items, itemConstraints) => {
|
|
|
124
124
|
}, {});
|
|
125
125
|
return Utils_1.Utils.isEmpty(arrayItemErrors) ? null : { errors: arrayItemErrors };
|
|
126
126
|
};
|
|
127
|
-
validate.validators.extend(validate.validators.validators.datetime, {
|
|
128
|
-
parse: function (value, options) {
|
|
129
|
-
// console.log(value,parse(value, 'DD/MM/YYYY'),options)
|
|
130
|
-
// return +dayjs.utc(parse(value, 'DD/MM/YYYY'));
|
|
131
|
-
return +dayjs(value).utc();
|
|
132
|
-
},
|
|
133
|
-
// Input is a unix timestamp
|
|
134
|
-
format: function (value, options) {
|
|
135
|
-
var format = options.dateOnly ? "YYYY-MM-DD" : "YYYY-MM-DD hh:mm:ss";
|
|
136
|
-
return dayjs(value).utc().format(format);
|
|
137
|
-
}
|
|
138
|
-
});
|
|
139
127
|
validate.extend(validate.validators.datetime, {
|
|
140
128
|
// The value is guaranteed not to be null or undefined but otherwise it
|
|
141
129
|
// could be anything.
|
|
@@ -215,7 +203,7 @@ class BaseChyz {
|
|
|
215
203
|
this._validate = value;
|
|
216
204
|
}
|
|
217
205
|
app(config = {}) {
|
|
218
|
-
var _a;
|
|
206
|
+
var _a, _b;
|
|
219
207
|
BaseChyz.EventEmitter.emit(CEvents_1.CEvents.ON_INIT_BEFORE, this, config);
|
|
220
208
|
/**
|
|
221
209
|
* Config set
|
|
@@ -229,12 +217,27 @@ class BaseChyz {
|
|
|
229
217
|
}
|
|
230
218
|
let components = Utils_1.Utils.findKeyValue(config, "components");
|
|
231
219
|
if (components) {
|
|
220
|
+
/**
|
|
221
|
+
* first initial database component
|
|
222
|
+
*/
|
|
223
|
+
if (components.db) {
|
|
224
|
+
let comp = components['db'];
|
|
225
|
+
BaseChyz.debug("First initial database component ", "db");
|
|
226
|
+
try {
|
|
227
|
+
BaseChyz.components["db"] = Utils_1.Utils.createObject(new comp.class, comp);
|
|
228
|
+
(_a = BaseChyz.components["db"]) === null || _a === void 0 ? void 0 : _a.init();
|
|
229
|
+
delete components.db;
|
|
230
|
+
}
|
|
231
|
+
catch (e) {
|
|
232
|
+
BaseChyz.error("Create Component Error", e);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
232
235
|
for (const componentsKey in components) {
|
|
233
236
|
let comp = components[componentsKey];
|
|
234
237
|
BaseChyz.debug("Create Component ", componentsKey);
|
|
235
238
|
try {
|
|
236
239
|
BaseChyz.components[componentsKey] = Utils_1.Utils.createObject(new comp.class, comp);
|
|
237
|
-
(
|
|
240
|
+
(_b = BaseChyz.components[componentsKey]) === null || _b === void 0 ? void 0 : _b.init();
|
|
238
241
|
}
|
|
239
242
|
catch (e) {
|
|
240
243
|
BaseChyz.error("Create Component Error", e);
|
package/base/Model.js
CHANGED
|
@@ -113,7 +113,7 @@ class Model extends Component_1.Component {
|
|
|
113
113
|
* @return Connection the database connection used by this AR class.
|
|
114
114
|
*/
|
|
115
115
|
getDb() {
|
|
116
|
-
return BaseChyz_1.default.getComponent("db").db;
|
|
116
|
+
return BaseChyz_1.default.getComponent("db") ? BaseChyz_1.default.getComponent("db").db : null;
|
|
117
117
|
}
|
|
118
118
|
getDbConnection() {
|
|
119
119
|
return BaseChyz_1.default.getComponent("db");
|