mailgun.js 3.5.9 → 3.7.1

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.
Files changed (75) hide show
  1. package/.eslintrc +27 -11
  2. package/CHANGELOG.md +30 -0
  3. package/commitlint.config.js +1 -2
  4. package/dist/index.d.ts +2 -2
  5. package/dist/lib/client.d.ts +2 -2
  6. package/dist/lib/events.d.ts +9 -25
  7. package/dist/lib/interfaces/APIErrorOptions.d.ts +2 -1
  8. package/dist/lib/interfaces/ApiResponse.d.ts +2 -1
  9. package/dist/lib/interfaces/Events.d.ts +24 -0
  10. package/dist/lib/interfaces/IFormData.d.ts +4 -12
  11. package/dist/lib/interfaces/IpPools.d.ts +12 -0
  12. package/dist/lib/interfaces/Options.d.ts +2 -1
  13. package/dist/lib/interfaces/RequestOptions.d.ts +2 -1
  14. package/dist/lib/interfaces/StatsOptions.d.ts +2 -1
  15. package/dist/lib/interfaces/mailListMembers.d.ts +6 -6
  16. package/dist/lib/ip-pools.d.ts +11 -14
  17. package/dist/lib/ips.d.ts +6 -6
  18. package/dist/lib/messages.d.ts +1 -1
  19. package/dist/lib/request.d.ts +4 -3
  20. package/dist/lib/suppressions.d.ts +1 -1
  21. package/dist/mailgun.node.js +3 -0
  22. package/dist/{mailgun.js.LICENSE.txt → mailgun.node.js.LICENSE.txt} +1 -1
  23. package/dist/mailgun.web.js +3 -0
  24. package/dist/mailgun.web.js.LICENSE.txt +7 -0
  25. package/examples/addresses.js +1 -0
  26. package/examples/list-domains.js +1 -0
  27. package/examples/send-email.js +1 -0
  28. package/index.ts +3 -3
  29. package/lib/client.ts +4 -3
  30. package/lib/events.ts +21 -19
  31. package/lib/interfaces/APIErrorOptions.ts +3 -1
  32. package/lib/interfaces/ApiResponse.ts +3 -1
  33. package/lib/interfaces/Events.ts +25 -0
  34. package/lib/interfaces/IFormData.ts +5 -14
  35. package/lib/interfaces/IpPools.ts +16 -1
  36. package/lib/interfaces/Ips.ts +1 -0
  37. package/lib/interfaces/Options.ts +5 -2
  38. package/lib/interfaces/RequestOptions.ts +4 -2
  39. package/lib/interfaces/StatsOptions.ts +4 -2
  40. package/lib/interfaces/Supressions.ts +1 -1
  41. package/lib/interfaces/lists.ts +1 -0
  42. package/lib/interfaces/mailListMembers.ts +18 -12
  43. package/lib/interfaces/routes.ts +1 -0
  44. package/lib/ip-pools.ts +8 -7
  45. package/lib/ips.ts +3 -3
  46. package/lib/lists.ts +1 -1
  47. package/lib/messages.ts +1 -1
  48. package/lib/parse.ts +4 -3
  49. package/lib/request.ts +18 -8
  50. package/lib/stats.ts +3 -2
  51. package/lib/suppressions.ts +16 -11
  52. package/lib/validate.ts +0 -1
  53. package/package.json +9 -9
  54. package/test/client.test.ts +9 -3
  55. package/test/domains.test.ts +2 -1
  56. package/test/events.test.ts +3 -3
  57. package/test/ips.test.ts +4 -2
  58. package/test/lists.test.ts +7 -8
  59. package/test/mailListMembers.test.ts +49 -44
  60. package/test/messageAttachment.test.ts +5 -5
  61. package/test/messages.test.ts +3 -2
  62. package/test/parse.test.ts +4 -3
  63. package/test/request.test.ts +6 -5
  64. package/test/routes.test.ts +3 -1
  65. package/test/stats.test.ts +3 -2
  66. package/test/suppressions.test.ts +14 -11
  67. package/test/validate.test.ts +3 -2
  68. package/test/webhooks.test.ts +3 -3
  69. package/tsconfig.webpack.json +1 -1
  70. package/webpack/webpack.common.config.js +47 -0
  71. package/webpack/webpack.dev.config.js +18 -0
  72. package/webpack/webpack.release.config.js +37 -0
  73. package/dist/mailgun.js +0 -3
  74. package/webpack.config.js +0 -49
  75. package/webpack.release.config.js +0 -29
@@ -0,0 +1,47 @@
1
+ const webpack = require('webpack');
2
+ const path = require('path');
3
+ const pkg = require('../package.json');
4
+
5
+ const SRC_DIR = path.join(__dirname, '../');
6
+
7
+ const outputDir = 'dist';
8
+ const commonConfig = {
9
+ mode: 'development',
10
+ context: SRC_DIR,
11
+ entry: {
12
+ mailgun: path.join(SRC_DIR, 'index.ts'),
13
+ 'mailgun.min': path.join(SRC_DIR, 'index.ts')
14
+ },
15
+ output: {
16
+ path: path.join(SRC_DIR, outputDir),
17
+ filename: 'mailgun.js',
18
+ library: 'mailgun',
19
+ libraryTarget: 'umd',
20
+ globalObject: 'this',
21
+ },
22
+ module: {
23
+ rules: [
24
+ {
25
+ test: /\.(ts|js)?/,
26
+ use: [
27
+ {
28
+ loader: 'babel-loader',
29
+ },
30
+ {
31
+ loader: `ts-loader?configFile=${path.join(SRC_DIR, 'tsconfig.webpack.json')}`
32
+ }
33
+ ],
34
+ exclude: /(node_modules|test)/
35
+ }
36
+ ]
37
+ },
38
+ plugins: [
39
+ new webpack.BannerPlugin(`${pkg.name} v${pkg.version}`)
40
+ ],
41
+ resolve: {
42
+ extensions: ['.ts', '.js', '.json']
43
+ },
44
+ devtool: 'inline-source-map'
45
+ };
46
+
47
+ module.exports = commonConfig;
@@ -0,0 +1,18 @@
1
+ const { merge } = require('webpack-merge');
2
+ const commonConfig = require('./webpack.common.config');
3
+
4
+ const nodeConf = merge(commonConfig, {
5
+ target: 'node',
6
+ output: {
7
+ filename: 'mailgun.node.js'
8
+ }
9
+ });
10
+
11
+ const webConf = merge(commonConfig, {
12
+ target: 'web',
13
+ output: {
14
+ filename: 'mailgun.web.js'
15
+ }
16
+ });
17
+
18
+ module.exports = [nodeConf, webConf];
@@ -0,0 +1,37 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ /* eslint-disable @typescript-eslint/no-var-requires */
3
+
4
+ const TerserPlugin = require('terser-webpack-plugin');
5
+ const { merge } = require('webpack-merge');
6
+ const baseConfig = require('./webpack.common.config');
7
+
8
+ const productionConfig = merge(baseConfig, {
9
+ mode: 'production',
10
+ devtool: undefined,
11
+ optimization: {
12
+ minimize: true,
13
+ minimizer: [
14
+ new TerserPlugin({
15
+ parallel: true,
16
+ terserOptions: {
17
+ keep_classnames: true,
18
+ }
19
+ }),
20
+ ],
21
+ },
22
+ });
23
+
24
+ const nodeConf = merge(productionConfig, {
25
+ target: 'node',
26
+ output: {
27
+ filename: 'mailgun.node.js'
28
+ }
29
+ });
30
+
31
+ const webConf = merge(productionConfig, {
32
+ target: 'web',
33
+ output: {
34
+ filename: 'mailgun.web.js'
35
+ }
36
+ });
37
+ module.exports = [nodeConf, webConf];