ztechno_core 0.0.57 → 0.0.58

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,6 +1,7 @@
1
1
  import { MailOptionsHtml, MailOptionsText, MailResponse, MailServiceOptions } from './typings/mail_types';
2
2
  export declare class ZMailService {
3
3
  private opt;
4
+ protected get sql(): import('./sql_service').ZSqlService;
4
5
  constructor(opt: MailServiceOptions);
5
6
  send(mailOpts: MailOptionsText | MailOptionsHtml): Promise<MailResponse>;
6
7
  }
@@ -8,6 +8,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
8
8
  exports.ZMailService = void 0;
9
9
  const nodemailer_1 = __importDefault(require('nodemailer'));
10
10
  class ZMailService {
11
+ get sql() {
12
+ return this.opt.sqlService;
13
+ }
11
14
  constructor(opt) {
12
15
  this.opt = opt;
13
16
  }
@@ -36,6 +36,12 @@ export declare class ZSqlService {
36
36
  [key: string]: any;
37
37
  };
38
38
  }): Promise<T>;
39
+ fetch<T = any>(opt: {
40
+ Query: string;
41
+ Params: {
42
+ [key: string]: any;
43
+ };
44
+ }): Promise<T[]>;
39
45
  query(
40
46
  sql: string,
41
47
  params?:
@@ -100,6 +100,10 @@ class ZSqlService {
100
100
  return row;
101
101
  });
102
102
  }
103
+ async fetch(opt) {
104
+ const items = await this.query(opt.Query, opt.Params);
105
+ return items;
106
+ }
103
107
  async query(sql, params) {
104
108
  try {
105
109
  const con = await this.getPoolConnection();
@@ -1,4 +1,5 @@
1
1
  import SMTPTransport from 'nodemailer/lib/smtp-transport';
2
+ import { ZSqlService } from '../sql_service';
2
3
  interface OptionalOptions {
3
4
  cacheDir?:
4
5
  | string
@@ -33,6 +34,7 @@ export type MailServiceOptions = {
33
34
  };
34
35
  mailSender: string;
35
36
  dkim?: SingleDKIMKeyOptions;
37
+ sqlService?: ZSqlService;
36
38
  };
37
39
  export type MailOptionsBase = {
38
40
  recipient: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztechno_core",
3
- "version": "0.0.57",
3
+ "version": "0.0.58",
4
4
  "description": "Core files for ztechno framework",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",