ztechno_core 0.0.55 → 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.
package/lib/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export {
11
11
  MailOptionsHtml,
12
12
  MailOptionsText,
13
13
  MailServiceOptions,
14
+ MailResponse,
14
15
  } from './typings/mail_types';
15
16
  export { TranslateData, ZDom, ZNode, ZNodeText, dbTranslationRow } from './typings/translate_types';
16
17
  export { ZRequiredUserColumns, ZUser, ZUserCredentials, ZUserSession } from './typings/user_types';
@@ -1,7 +1,7 @@
1
- import SMTPTransport from 'nodemailer/lib/smtp-transport';
2
- import { MailOptionsHtml, MailOptionsText, MailServiceOptions } from './typings/mail_types';
1
+ import { MailOptionsHtml, MailOptionsText, MailResponse, MailServiceOptions } from './typings/mail_types';
3
2
  export declare class ZMailService {
4
3
  private opt;
4
+ protected get sql(): import('./sql_service').ZSqlService;
5
5
  constructor(opt: MailServiceOptions);
6
- send(mailOpts: MailOptionsText | MailOptionsHtml): Promise<SMTPTransport.SentMessageInfo>;
6
+ send(mailOpts: MailOptionsText | MailOptionsHtml): Promise<MailResponse>;
7
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,16 +1,48 @@
1
- import nodemailer from 'nodemailer';
1
+ import SMTPTransport from 'nodemailer/lib/smtp-transport';
2
+ import { ZSqlService } from '../sql_service';
3
+ interface OptionalOptions {
4
+ cacheDir?:
5
+ | string
6
+ | false
7
+ | undefined /** optional location for cached messages. If not set then caching is not used. */;
8
+ cacheTreshold?:
9
+ | number
10
+ | undefined /** optional size in bytes, if message is larger than this treshold it gets cached to disk (assuming cacheDir is set and writable). Defaults to 131072 (128 kB). */;
11
+ hashAlgo?: string | undefined /** optional algorithm for the body hash, defaults to ‘sha256’ */;
12
+ headerFieldNames?:
13
+ | string
14
+ | undefined /** an optional colon separated list of header keys to sign (eg. message-id:date:from:to...') */;
15
+ skipFields?:
16
+ | string
17
+ | undefined /** optional colon separated list of header keys not to sign. This is useful if you want to sign all the relevant keys but your provider changes some values, ie Message-ID and Date. In this case you should use 'message-id:date' to prevent signing these values. */;
18
+ }
19
+ interface SingleDKIMKeyOptions extends OptionalOptions {
20
+ domainName: string /** is the domain name to use in the signature */;
21
+ keySelector: string /** is the DKIM key selector */;
22
+ privateKey:
23
+ | string
24
+ | {
25
+ key: string;
26
+ passphrase: string;
27
+ } /** is the private key for the selector in PEM format */;
28
+ }
29
+ export type MailResponse = SMTPTransport.SentMessageInfo;
2
30
  export type MailServiceOptions = {
3
31
  auth: {
4
32
  user: string;
5
33
  pass: string;
6
34
  };
7
35
  mailSender: string;
8
- } & Partial<Pick<nodemailer.SendMailOptions, 'dkim'>>;
36
+ dkim?: SingleDKIMKeyOptions;
37
+ sqlService?: ZSqlService;
38
+ };
9
39
  export type MailOptionsBase = {
10
40
  recipient: string;
11
41
  subject: string;
12
42
  from?: string;
13
- } & Partial<Pick<nodemailer.SendMailOptions, 'dkim' | 'priority'>>;
43
+ priority?: 'high' | 'normal' | 'low';
44
+ dkim?: SingleDKIMKeyOptions;
45
+ };
14
46
  export type MailOptionsText = MailOptionsBase & {
15
47
  body: string;
16
48
  };
@@ -21,3 +53,4 @@ export type MailOptions = MailOptionsBase & {
21
53
  body?: string;
22
54
  html?: string;
23
55
  };
56
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ztechno_core",
3
- "version": "0.0.55",
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",