ztechno_core 0.0.4 → 0.0.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.
- package/lib/sql_service.d.ts +3 -2
- package/lib/sql_service.js +7 -8
- package/lib/translate_service.js +10 -10
- package/package.json +1 -1
package/lib/sql_service.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as mysql from 'mysql';
|
|
2
2
|
export declare class ZSqlService {
|
|
3
|
-
|
|
3
|
+
private credentials;
|
|
4
|
+
constructor(credentials: mysql.ConnectionConfig);
|
|
4
5
|
connect(): Promise<mysql.Connection>;
|
|
5
6
|
query(sql: string, escaped?: any[]): Promise<any>;
|
|
6
|
-
static get(): ZSqlService;
|
|
7
|
+
static get(credentials?: mysql.ConnectionConfig): ZSqlService;
|
|
7
8
|
}
|
package/lib/sql_service.js
CHANGED
|
@@ -169,15 +169,14 @@ var instance = null;
|
|
|
169
169
|
var logError = function (err) {
|
|
170
170
|
if (err) throw err;
|
|
171
171
|
};
|
|
172
|
-
var creds;
|
|
173
172
|
var ZSqlService = /** @class */ (function () {
|
|
174
|
-
function ZSqlService() {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
};
|
|
173
|
+
function ZSqlService(credentials) {
|
|
174
|
+
this.credentials = credentials;
|
|
175
|
+
}
|
|
178
176
|
ZSqlService.prototype.connect = function () {
|
|
177
|
+
var _this = this;
|
|
179
178
|
return new Promise(function (resolve, reject) {
|
|
180
|
-
var con = mysql.createConnection(
|
|
179
|
+
var con = mysql.createConnection(_this.credentials);
|
|
181
180
|
con.connect(function (err) {
|
|
182
181
|
if (err) return reject(err);
|
|
183
182
|
resolve(con);
|
|
@@ -213,9 +212,9 @@ var ZSqlService = /** @class */ (function () {
|
|
|
213
212
|
});
|
|
214
213
|
});
|
|
215
214
|
};
|
|
216
|
-
ZSqlService.get = function () {
|
|
215
|
+
ZSqlService.get = function (credentials) {
|
|
217
216
|
if (instance == null) {
|
|
218
|
-
instance = new ZSqlService();
|
|
217
|
+
instance = new ZSqlService(credentials);
|
|
219
218
|
}
|
|
220
219
|
return instance;
|
|
221
220
|
};
|
package/lib/translate_service.js
CHANGED
|
@@ -138,15 +138,15 @@ var ZTranslateService = /** @class */ (function () {
|
|
|
138
138
|
this.surpressErrors = true;
|
|
139
139
|
this.codes =
|
|
140
140
|
((_a = {}),
|
|
141
|
-
(_a[''
|
|
142
|
-
(_a['"
|
|
143
|
-
(_a['“
|
|
144
|
-
(_a['”
|
|
145
|
-
(_a['©
|
|
146
|
-
(_a['®
|
|
147
|
-
(_a['€
|
|
148
|
-
(_a['£
|
|
149
|
-
(_a['™
|
|
141
|
+
(_a['''] = "'"),
|
|
142
|
+
(_a['"'] = '"'),
|
|
143
|
+
(_a['“'] = '\u201C'),
|
|
144
|
+
(_a['”'] = '\u201D'),
|
|
145
|
+
(_a['©'] = '\u00A9'),
|
|
146
|
+
(_a['®'] = '\u00AE'),
|
|
147
|
+
(_a['€'] = '\u20AC'),
|
|
148
|
+
(_a['£'] = '\u00A3'),
|
|
149
|
+
(_a['™'] = '\u2122'),
|
|
150
150
|
_a);
|
|
151
151
|
this.getLanguages().map(function (lang) {
|
|
152
152
|
return (_this.localCache[lang] = {});
|
|
@@ -191,7 +191,7 @@ var ZTranslateService = /** @class */ (function () {
|
|
|
191
191
|
while (text.includes('&#')) {
|
|
192
192
|
codeIndexStart = text.indexOf('&#');
|
|
193
193
|
first = text.substring(codeIndexStart);
|
|
194
|
-
codeLength = first.indexOf('
|
|
194
|
+
codeLength = first.indexOf('') + 1;
|
|
195
195
|
code = first.substring(0, codeLength);
|
|
196
196
|
if (this.codes[code] === undefined) {
|
|
197
197
|
throw new Error('Cant recognize character code="'.concat(code, '"\n for text=').concat(text, '\n\n'));
|