@storecraft/mailer-providers-http 1.0.0 → 1.0.2

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/README.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # `storecraft` Official serverless http email providers
2
2
 
3
+ <div style="text-align:center">
4
+ <img src='https://storecraft.app/storecraft-color.svg'
5
+ width='90%' />
6
+ </div><hr/><br/>
7
+
3
8
  Supports wellknown http-based `serverless` friendly `email` providers,
4
9
 
5
10
  - [Sendgrid](https://docs.sendgrid.com/api-reference/mail-send/mail-send)
@@ -9,14 +14,18 @@ Supports wellknown http-based `serverless` friendly `email` providers,
9
14
 
10
15
  > TODO: confirm tests
11
16
 
17
+ ```bash
18
+ npm i @storecraft/mailer-providers-http
19
+ ```
20
+
12
21
  ## Howto
13
22
 
14
23
  ### Sendgrid
15
24
 
16
25
  ```js
17
- import { MailerSendGrid } from '@storecraft/mailer-providers-http/sendgrid';
26
+ import { SendGrid } from '@storecraft/mailer-providers-http/sendgrid';
18
27
 
19
- const mailer = new MailerSendGrid(
28
+ const mailer = new SendGrid(
20
29
  {
21
30
  apikey: process.env.SEND_GRID_SECRET
22
31
  }
@@ -35,9 +44,9 @@ let { success, native_response } = await mailer.email({
35
44
 
36
45
  ### Resend
37
46
  ```js
38
- import { MailerResend } from '@storecraft/mailer-providers-http/resend';
47
+ import { Resend } from '@storecraft/mailer-providers-http/resend';
39
48
 
40
- const mailer = new MailerResend(
49
+ const mailer = new Resend(
41
50
  {
42
51
  apikey: process.env.RESEND_API_KEY
43
52
  }
@@ -57,9 +66,9 @@ let { success, native_response } = await mailer.email({
57
66
  ### Mailchimp
58
67
 
59
68
  ```js
60
- import { MailerMailChimp } from '@storecraft/mailer-providers-http/mailchimp';
69
+ import { MailChimp } from '@storecraft/mailer-providers-http/mailchimp';
61
70
 
62
- const mailer = new MailerMailChimp(
71
+ const mailer = new MailChimp(
63
72
  {
64
73
  apikey: process.env.MAILCHIMP_API_KEY
65
74
  }
@@ -79,9 +88,9 @@ let { success, native_response } = await mailer.email({
79
88
  ### Mailgun
80
89
 
81
90
  ```js
82
- import { MailerMailgun } from '@storecraft/mailer-providers-http/mailgun';
91
+ import { Mailgun } from '@storecraft/mailer-providers-http/mailgun';
83
92
 
84
- const mailer = new MailerMailgun(
93
+ const mailer = new Mailgun(
85
94
  {
86
95
  apikey: process.env.MAILGUN_API_KEY
87
96
  }
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export * as mailchimp from './mailchimp/index.js'
2
- export * as mailgun from './mailgun/index.js'
3
- export * as resend from './resend/index.js'
4
- export * as sendgrid from './sendgrid/index.js'
1
+ export * as mailchimp from './mailchimp/adapter.js'
2
+ export * as mailgun from './mailgun/adapter.js'
3
+ export * as resend from './resend/adapter.js'
4
+ export * as sendgrid from './sendgrid/adapter.js'
@@ -4,9 +4,9 @@
4
4
  ## Howto
5
5
 
6
6
  ```js
7
- import { MailerMailChimp } from '@storecraft/mailer-mailchimp-http';
7
+ import { MailChimp } from '@storecraft/mailer-mailchimp-http';
8
8
 
9
- const mailer = new MailerMailChimp(
9
+ const mailer = new MailChimp(
10
10
  {
11
11
  apikey: process.env.MAILCHIMP_API_KEY
12
12
  }
@@ -1,13 +1,13 @@
1
1
  import { convert_to_base64 } from "./adapter.utils.js";
2
2
 
3
3
  /**
4
- * @typedef {import("./types.public.js").Config} Config
5
- * @typedef {import('@storecraft/core/v-mailer').mailer<Config>} mailer
4
+ * @typedef {import("./types.public.d.ts").Config} Config
5
+ * @typedef {import('@storecraft/core/mailer').mailer<Config>} mailer
6
6
  * @implements {mailer}
7
7
  *
8
8
  * mailer with mail-chimp / mandrill http api
9
9
  */
10
- export class MailerMailChimp {
10
+ export class MailChimp {
11
11
 
12
12
  /** @type {Config} */ #_config;
13
13
 
@@ -1,7 +1,7 @@
1
- import { base64 } from '@storecraft/core/v-crypto'
1
+ import { base64 } from '@storecraft/core/crypto'
2
2
 
3
3
  /**
4
- * @param {import('@storecraft/core/v-mailer').MailObject["attachments"][0]["content"]} c
4
+ * @param {import('@storecraft/core/mailer').MailObject["attachments"][0]["content"]} c
5
5
  */
6
6
  export const convert_to_base64 = async (c) => {
7
7
  if(c instanceof ArrayBuffer)
@@ -1,11 +1,8 @@
1
1
  {
2
- "compileOnSave": false,
3
2
  "compilerOptions": {
4
- "noEmit": true,
5
- "allowJs": true,
6
3
  "checkJs": true,
4
+ "maxNodeModuleJsDepth": 10,
7
5
  "target": "ESNext",
8
- "resolveJsonModule": true,
9
6
  "moduleResolution": "NodeNext",
10
7
  "module": "NodeNext",
11
8
  "composite": true,
@@ -1,9 +1,9 @@
1
1
  import 'dotenv/config';
2
2
  import { test } from 'uvu';
3
3
  import * as assert from 'uvu/assert';
4
- import { MailerMailChimp } from '../index.js';
4
+ import { MailChimp } from '../adapter.js';
5
5
 
6
- const mailer = new MailerMailChimp(
6
+ const mailer = new MailChimp(
7
7
  {
8
8
  apikey: process.env.MAILCHIMP_API_KEY
9
9
  }
@@ -1,9 +1,13 @@
1
- export * from './index.js';
1
+ export { MailChimp } from './adapter.js';
2
2
 
3
3
  /**
4
- * config
4
+ * @description `Mailchimp` config
5
5
  */
6
6
  export type Config = {
7
+
8
+ /**
9
+ * @description Your API Key
10
+ */
7
11
  apikey: string,
8
12
 
9
13
  };
package/mailgun/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
  ## Howto
5
5
 
6
6
  ```js
7
- import { MailerMailChimp } from '@storecraft/mailer-mailgun-http';
7
+ import { Mailgun } from '@storecraft/mailer-mailgun-http';
8
8
 
9
- const mailer = new MailerMailgun(
9
+ const mailer = new Mailgun(
10
10
  {
11
11
  apikey: process.env.MAILGUN_API_KEY
12
12
  }
@@ -1,14 +1,14 @@
1
- import { base64 } from "@storecraft/core/v-crypto";
1
+ import { base64 } from "@storecraft/core/crypto";
2
2
  import { address_to_friendly_name, convert_attachment_to_blob } from "./adapter.utils.js";
3
3
 
4
4
  /**
5
- * @typedef {import("./types.public.js").Config} Config
6
- * @typedef {import('@storecraft/core/v-mailer').mailer<Config>} mailer
5
+ * @typedef {import("./types.public.d.ts").Config} Config
6
+ * @typedef {import('@storecraft/core/mailer').mailer<Config>} mailer
7
7
  * @implements {mailer}
8
8
  *
9
- * mailer with mailgun http api
9
+ * @description mailer with mailgun http api
10
10
  */
11
- export class MailerMailgun {
11
+ export class Mailgun {
12
12
 
13
13
  /** @type {Config} */ #_config;
14
14
 
@@ -1,7 +1,7 @@
1
1
 
2
2
  /**
3
3
  *
4
- * @param {import('@storecraft/core/v-mailer').MailObject["attachments"][0]["content"]} c
4
+ * @param {import('@storecraft/core/mailer').MailObject["attachments"][0]["content"]} c
5
5
  */
6
6
  export const convert_attachment_to_blob = async c => {
7
7
  if(c instanceof ArrayBuffer)
@@ -27,7 +27,7 @@ export const convert_attachment_to_blob = async c => {
27
27
 
28
28
  /**
29
29
  *
30
- * @param {import('@storecraft/core/v-mailer').MailAddress} a
30
+ * @param {import('@storecraft/core/mailer').MailAddress} a
31
31
  */
32
32
  export const address_to_friendly_name = a => {
33
33
  return a.name ? `${a.name} <${a.address}>` : a.address;
@@ -1,11 +1,8 @@
1
1
  {
2
- "compileOnSave": false,
3
2
  "compilerOptions": {
4
- "noEmit": true,
5
- "allowJs": true,
6
3
  "checkJs": true,
4
+ "maxNodeModuleJsDepth": 10,
7
5
  "target": "ESNext",
8
- "resolveJsonModule": true,
9
6
  "moduleResolution": "NodeNext",
10
7
  "module": "NodeNext",
11
8
  "composite": true,
@@ -1,9 +1,9 @@
1
1
  import 'dotenv/config';
2
2
  import { test } from 'uvu';
3
3
  import * as assert from 'uvu/assert';
4
- import { MailerMailgun } from '../index.js';
4
+ import { Mailgun } from '../adapter.js';
5
5
 
6
- const mailer = new MailerMailgun(
6
+ const mailer = new Mailgun(
7
7
  {
8
8
  apikey: process.env.MAILGUN_API_KEY,
9
9
  domain_name: process.env.YOUR_DOMAIN_NAME
@@ -1,12 +1,17 @@
1
- export * from './index.js';
1
+ export { Mailgun } from './adapter.js';
2
2
 
3
3
  /**
4
- * config
4
+ * @description `mailgun` config
5
5
  */
6
6
  export type Config = {
7
- /** your mailgun api key */
7
+ /**
8
+ * @description your mailgun api key
9
+ */
8
10
  apikey: string,
9
- /** your registered domain name at mailgun */
11
+
12
+ /**
13
+ * @description your registered domain name at `mailgun`
14
+ */
10
15
  domain_name: string;
11
16
  };
12
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storecraft/mailer-providers-http",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Official Serverless Friendly e-mail adapters for storecraft",
5
5
  "license": "MIT",
6
6
  "author": "Tomer Shalev (https://github.com/store-craft)",
@@ -8,7 +8,7 @@
8
8
  "repository": {
9
9
  "type": "git",
10
10
  "url": "https://github.com/store-craft/storecraft.git",
11
- "directory": "packages/mailer-providers-http"
11
+ "directory": "packages/mailers/mailer-providers-http"
12
12
  },
13
13
  "keywords": [
14
14
  "commerce",
@@ -29,19 +29,19 @@
29
29
  },
30
30
  "./package.json": "./package.json",
31
31
  "./mailchimp": {
32
- "import": "./mailchimp/index.js",
32
+ "import": "./mailchimp/adapter.js",
33
33
  "types": "./mailchimp/types.public.d.ts"
34
34
  },
35
35
  "./mailgun": {
36
- "import": "./mailgun/index.js",
36
+ "import": "./mailgun/adapter.js",
37
37
  "types": "./mailgun/types.public.d.ts"
38
38
  },
39
39
  "./resend": {
40
- "import": "./resend/index.js",
40
+ "import": "./resend/adapter.js",
41
41
  "types": "./resend/types.public.d.ts"
42
42
  },
43
43
  "./sendgrid": {
44
- "import": "./sendgrid/index.js",
44
+ "import": "./sendgrid/adapter.js",
45
45
  "types": "./sendgrid/types.public.d.ts"
46
46
  }
47
47
  },
package/resend/README.md CHANGED
@@ -4,9 +4,9 @@
4
4
  ## Howto
5
5
 
6
6
  ```js
7
- import { MailerResend } from '@storecraft/mailer-resend-http';
7
+ import { Resend } from '@storecraft/mailer-resend-http';
8
8
 
9
- const mailer = new MailerResend(
9
+ const mailer = new Resend(
10
10
  {
11
11
  apikey: process.env.RESEND_API_KEY
12
12
  }
package/resend/adapter.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import { address_to_friendly_name, convert_to_base64 } from "./adapter.utils.js";
2
2
 
3
3
  /**
4
- * @typedef {import("./types.public.js").Config} Config
5
- * @typedef {import('@storecraft/core/v-mailer').mailer<Config>} mailer
4
+ * @typedef {import("./types.public.d.ts").Config} Config
5
+ * @typedef {import('@storecraft/core/mailer').mailer<Config>} mailer
6
6
  * @implements {mailer}
7
7
  *
8
- * mailer with Resend rest api
8
+ * @description mailer with Resend rest api
9
9
  */
10
- export class MailerResend {
10
+ export class Resend {
11
11
 
12
12
  /** @type {Config} */ #_config;
13
13
 
@@ -1,8 +1,8 @@
1
- import { base64 } from '@storecraft/core/v-crypto'
1
+ import { base64 } from '@storecraft/core/crypto'
2
2
 
3
3
  /**
4
4
  *
5
- * @param {import('@storecraft/core/v-mailer').MailObject["attachments"][0]["content"]} c
5
+ * @param {import('@storecraft/core/mailer').MailObject["attachments"][0]["content"]} c
6
6
  */
7
7
  export const convert_to_base64 = async (c) => {
8
8
  if(c instanceof ArrayBuffer)
@@ -28,7 +28,7 @@ export const convert_to_base64 = async (c) => {
28
28
 
29
29
  /**
30
30
  *
31
- * @param {import('@storecraft/core/v-mailer').MailAddress} a
31
+ * @param {import('@storecraft/core/mailer').MailAddress} a
32
32
  */
33
33
  export const address_to_friendly_name = a => {
34
34
  return a.name ? `${a.name} <${a.address}>` : a.address;
@@ -1,11 +1,8 @@
1
1
  {
2
- "compileOnSave": false,
3
2
  "compilerOptions": {
4
- "noEmit": true,
5
- "allowJs": true,
6
3
  "checkJs": true,
4
+ "maxNodeModuleJsDepth": 10,
7
5
  "target": "ESNext",
8
- "resolveJsonModule": true,
9
6
  "moduleResolution": "NodeNext",
10
7
  "module": "NodeNext",
11
8
  "composite": true,
@@ -1,9 +1,9 @@
1
1
  import 'dotenv/config';
2
2
  import { test } from 'uvu';
3
3
  import * as assert from 'uvu/assert';
4
- import { MailerResend } from '../index.js';
4
+ import { Resend } from '../adapter.js';
5
5
 
6
- const mailer = new MailerResend(
6
+ const mailer = new Resend(
7
7
  {
8
8
  apikey: process.env.RESEND_API_KEY
9
9
  }
@@ -1,9 +1,12 @@
1
- export * from './index.js';
1
+ export { Resend } from './adapter.js';
2
2
 
3
3
  /**
4
- * config
4
+ * @description `Resend` config
5
5
  */
6
6
  export type Config = {
7
+ /**
8
+ * @description Your API Key
9
+ */
7
10
  apikey: string,
8
11
  };
9
12
 
@@ -4,9 +4,9 @@
4
4
  ## Howto
5
5
 
6
6
  ```js
7
- import { MailerSendGrid } from '@storecraft/mailer-sendgrid-http';
7
+ import { SendGrid } from '@storecraft/mailer-sendgrid-http';
8
8
 
9
- const mailer = new MailerSendGrid(
9
+ const mailer = new SendGrid(
10
10
  {
11
11
  apikey: process.env.SEND_GRID_SECRET
12
12
  }
@@ -1,13 +1,13 @@
1
1
  import { convert_to_base64 } from "./adapter.utils.js";
2
2
 
3
3
  /**
4
- * @typedef {import("./types.public.js").Config} Config
5
- * @typedef {import('@storecraft/core/v-mailer').mailer<Config>} mailer
4
+ * @typedef {import("./types.public.d.ts").Config} Config
5
+ * @typedef {import('@storecraft/core/mailer').mailer<Config>} mailer
6
6
  * @implements {mailer}
7
7
  *
8
- * mailer with sendgrid http api
8
+ * @description mailer with sendgrid http api
9
9
  */
10
- export class MailerSendGrid {
10
+ export class SendGrid {
11
11
 
12
12
  /** @type {Config} */ #_config;
13
13
 
@@ -1,8 +1,8 @@
1
- import { base64 } from '@storecraft/core/v-crypto'
1
+ import { base64 } from '@storecraft/core/crypto'
2
2
 
3
3
  /**
4
4
  *
5
- * @param {import('@storecraft/core/v-mailer').MailObject["attachments"][0]["content"]} c
5
+ * @param {import('@storecraft/core/mailer').MailObject["attachments"][0]["content"]} c
6
6
  */
7
7
  export const convert_to_base64 = async (c) => {
8
8
  if(c instanceof ArrayBuffer)
@@ -1,11 +1,8 @@
1
1
  {
2
- "compileOnSave": false,
3
2
  "compilerOptions": {
4
- "noEmit": true,
5
- "allowJs": true,
6
3
  "checkJs": true,
4
+ "maxNodeModuleJsDepth": 10,
7
5
  "target": "ESNext",
8
- "resolveJsonModule": true,
9
6
  "moduleResolution": "NodeNext",
10
7
  "module": "NodeNext",
11
8
  "composite": true,
@@ -1,9 +1,9 @@
1
1
  import 'dotenv/config';
2
2
  import { test } from 'uvu';
3
3
  import * as assert from 'uvu/assert';
4
- import { MailerSendGrid } from '../index.js';
4
+ import { SendGrid } from '../adapter.js';
5
5
 
6
- const mailer = new MailerSendGrid(
6
+ const mailer = new SendGrid(
7
7
  {
8
8
  apikey: process.env.SEND_GRID_SECRET
9
9
  }
@@ -1,9 +1,13 @@
1
- export * from './index.js';
1
+ export { SendGrid } from './adapter.js';
2
2
 
3
3
  /**
4
- * config
4
+ * @description `sendgrid` config
5
5
  */
6
6
  export type Config = {
7
+
8
+ /**
9
+ * @description Your API Key
10
+ */
7
11
  apikey: string,
8
12
 
9
13
  };
package/tsconfig.json CHANGED
@@ -3,6 +3,7 @@
3
3
  "compilerOptions": {
4
4
  "noEmit": true,
5
5
  "allowJs": true,
6
+ "maxNodeModuleJsDepth": 10,
6
7
  "checkJs": true,
7
8
  "target": "ESNext",
8
9
  "resolveJsonModule": true,
@@ -1 +0,0 @@
1
- export * from './adapter.js'
package/mailgun/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './adapter.js'
package/resend/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './adapter.js'
package/sendgrid/index.js DELETED
@@ -1 +0,0 @@
1
- export * from './adapter.js'