@mavogel/awscdk-rootmail 0.1.11 → 0.1.12

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/.jsii CHANGED
@@ -14,11 +14,11 @@
14
14
  "@aws-sdk/client-ses": "^3.1146.0",
15
15
  "@aws-sdk/client-ssm": "^3.1146.0",
16
16
  "cdk-nag": "^3.0.1",
17
- "mailparser": "^3.9.35",
17
+ "mailparser": "^3.9.36",
18
18
  "uuid": "^14.0.2"
19
19
  },
20
20
  "dependencies": {
21
- "@mavogel/mvc-projen": "^0.0.50",
21
+ "@mavogel/mvc-projen": "^0.0.53",
22
22
  "aws-cdk-lib": "^2.263.0",
23
23
  "constructs": "^10.5.1"
24
24
  },
@@ -9167,7 +9167,7 @@
9167
9167
  "stability": "experimental"
9168
9168
  },
9169
9169
  "homepage": "https://github.com/mavogel/awscdk-rootmail",
9170
- "jsiiVersion": "5.9.54 (build 042bc62)",
9170
+ "jsiiVersion": "5.9.55 (build 485144e)",
9171
9171
  "keywords": [
9172
9172
  "aws",
9173
9173
  "cdk",
@@ -9620,6 +9620,6 @@
9620
9620
  "symbolId": "src/ses-receive:SESReceiveProps"
9621
9621
  }
9622
9622
  },
9623
- "version": "0.1.11",
9624
- "fingerprint": "A35Mzh9zc6iNnBMgqMgcmVc+ABej3IW3YJ+kDqnT30Y="
9623
+ "version": "0.1.12",
9624
+ "fingerprint": "Tg2De92SHEkGjI4X7Es/tezGRFhZ3mLs1DDHDLMhyDs="
9625
9625
  }
package/lib/rootmail.js CHANGED
@@ -11,7 +11,7 @@ const ses_receive_1 = require("./ses-receive");
11
11
  * Rootmail construct
12
12
  */
13
13
  class Rootmail extends constructs_1.Construct {
14
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/awscdk-rootmail.Rootmail", version: "0.1.11" };
14
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/awscdk-rootmail.Rootmail", version: "0.1.12" };
15
15
  /**
16
16
  * The name parameter in SSM to store the domain name server.
17
17
  */
@@ -11,7 +11,7 @@ const ses_receipt_ruleset_activation_1 = require("./ses-receipt-ruleset-activati
11
11
  * SES Receive construct
12
12
  */
13
13
  class SESReceive extends constructs_1.Construct {
14
- static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/awscdk-rootmail.SESReceive", version: "0.1.11" };
14
+ static [JSII_RTTI_SYMBOL_1] = { fqn: "@mavogel/awscdk-rootmail.SESReceive", version: "0.1.12" };
15
15
  constructor(scope, id, props) {
16
16
  super(scope, id);
17
17
  const filteredEmailSubjects = props.filteredEmailSubjects || [];
@@ -1,4 +1,4 @@
1
- # he [![Test status](https://github.com/mathiasbynens/he/actions/workflows/test.yml/badge.svg)](https://github.com/mathiasbynens/he/actions/workflows/test.yml) [![he on npm](https://img.shields.io/npm/v/he)](https://www.npmjs.com/package/he)
1
+ # he [![Build status](https://travis-ci.org/mathiasbynens/he.svg?branch=master)](https://travis-ci.org/mathiasbynens/he) [![Code coverage status](https://codecov.io/github/mathiasbynens/he/coverage.svg?branch=master)](https://codecov.io/github/mathiasbynens/he?branch=master) [![Dependency status](https://gemnasium.com/mathiasbynens/he.svg)](https://gemnasium.com/mathiasbynens/he)
2
2
 
3
3
  _he_ (for “HTML entities”) is a robust HTML entity encoder/decoder written in JavaScript. It supports [all standardized named character references as per HTML](https://html.spec.whatwg.org/multipage/syntax.html#named-character-references), handles [ambiguous ampersands](https://mathiasbynens.be/notes/ambiguous-ampersands) and other edge cases [just like a browser would](https://html.spec.whatwg.org/multipage/syntax.html#tokenizing-character-references), has an extensive test suite, and — contrary to many other JavaScript solutions — _he_ handles astral Unicode symbols just fine. [An online demo is available.](https://mothereff.in/html-entities)
4
4
 
@@ -10,26 +10,58 @@ Via [npm](https://www.npmjs.com/):
10
10
  npm install he
11
11
  ```
12
12
 
13
- _he_ is published as an ECMAScript module with named exports:
13
+ Via [Bower](http://bower.io/):
14
14
 
15
- ```js
16
- import { decode, encode, escape, unescape } from 'he';
17
- // Or, to use the `he.*` style shown in the examples below:
18
- import * as he from 'he';
15
+ ```bash
16
+ bower install he
17
+ ```
18
+
19
+ Via [Component](https://github.com/component/component):
20
+
21
+ ```bash
22
+ component install mathiasbynens/he
19
23
  ```
20
24
 
21
- In a browser, using a `<script type="module">` and a path to the package’s `src/he.mjs`:
25
+ In a browser:
22
26
 
23
27
  ```html
24
- <script type="module">
25
- import * as he from './node_modules/he/src/he.mjs';
26
- </script>
28
+ <script src="he.js"></script>
27
29
  ```
28
30
 
29
- In CommonJS code on Node.js versions that support [`require(esm)`](https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require), `require('he')` returns the module namespace object, so `require('he').encode(…)` works as well.
31
+ In [Node.js](https://nodejs.org/), [io.js](https://iojs.org/), [Narwhal](http://narwhaljs.org/), and [RingoJS](http://ringojs.org/):
32
+
33
+ ```js
34
+ var he = require('he');
35
+ ```
36
+
37
+ In [Rhino](http://www.mozilla.org/rhino/):
38
+
39
+ ```js
40
+ load('he.js');
41
+ ```
42
+
43
+ Using an AMD loader like [RequireJS](http://requirejs.org/):
44
+
45
+ ```js
46
+ require(
47
+ {
48
+ 'paths': {
49
+ 'he': 'path/to/he'
50
+ }
51
+ },
52
+ ['he'],
53
+ function(he) {
54
+ console.log(he);
55
+ }
56
+ );
57
+ ```
30
58
 
31
59
  ## API
32
60
 
61
+ ### `he.version`
62
+
63
+ A string representing the semantic version number.
64
+
33
65
  ### `he.encode(text, options)`
34
66
 
35
67
  This function takes a string of text and encodes (by default) any symbols that aren’t printable ASCII symbols and `&`, `<`, `>`, `"`, `'`, and `` ` ``, replacing them with character references.
@@ -63,13 +95,13 @@ he.encode('foo © bar ≠ baz 𝌆 qux');
63
95
 
64
96
  // Passing an `options` object to `encode`, to explicitly disallow named references:
65
97
  he.encode('foo © bar ≠ baz 𝌆 qux', {
66
- useNamedReferences: false,
98
+ 'useNamedReferences': false
67
99
  });
68
100
  // → 'foo &#xA9; bar &#x2260; baz &#x1D306; qux'
69
101
 
70
102
  // Passing an `options` object to `encode`, to explicitly allow named references:
71
103
  he.encode('foo © bar ≠ baz 𝌆 qux', {
72
- useNamedReferences: true,
104
+ 'useNamedReferences': true
73
105
  });
74
106
  // → 'foo &copy; bar &ne; baz &#x1D306; qux'
75
107
  ```
@@ -85,20 +117,20 @@ he.encode('foo © bar ≠ baz 𝌆 qux');
85
117
 
86
118
  // Passing an `options` object to `encode`, to explicitly disable decimal escapes:
87
119
  he.encode('foo © bar ≠ baz 𝌆 qux', {
88
- decimal: false,
120
+ 'decimal': false
89
121
  });
90
122
  // → 'foo &#xA9; bar &#x2260; baz &#x1D306; qux'
91
123
 
92
124
  // Passing an `options` object to `encode`, to explicitly enable decimal escapes:
93
125
  he.encode('foo © bar ≠ baz 𝌆 qux', {
94
- decimal: true,
126
+ 'decimal': true
95
127
  });
96
128
  // → 'foo &#169; bar &#8800; baz &#119558; qux'
97
129
 
98
130
  // Passing an `options` object to `encode`, to explicitly allow named references and decimal escapes:
99
131
  he.encode('foo © bar ≠ baz 𝌆 qux', {
100
- useNamedReferences: true,
101
- decimal: true,
132
+ 'useNamedReferences': true,
133
+ 'decimal': true
102
134
  });
103
135
  // → 'foo &copy; bar &ne; baz &#119558; qux'
104
136
  ```
@@ -114,14 +146,14 @@ he.encode('foo © bar ≠ baz 𝌆 qux');
114
146
 
115
147
  // Passing an `options` object to `encode`, to explicitly encode all symbols:
116
148
  he.encode('foo © bar ≠ baz 𝌆 qux', {
117
- encodeEverything: true,
149
+ 'encodeEverything': true
118
150
  });
119
151
  // → '&#x66;&#x6F;&#x6F;&#x20;&#xA9;&#x20;&#x62;&#x61;&#x72;&#x20;&#x2260;&#x20;&#x62;&#x61;&#x7A;&#x20;&#x1D306;&#x20;&#x71;&#x75;&#x78;'
120
152
 
121
153
  // This setting can be combined with the `useNamedReferences` option:
122
154
  he.encode('foo © bar ≠ baz 𝌆 qux', {
123
- encodeEverything: true,
124
- useNamedReferences: true,
155
+ 'encodeEverything': true,
156
+ 'useNamedReferences': true
125
157
  });
126
158
  // → '&#x66;&#x6F;&#x6F;&#x20;&copy;&#x20;&#x62;&#x61;&#x72;&#x20;&ne;&#x20;&#x62;&#x61;&#x7A;&#x20;&#x1D306;&#x20;&#x71;&#x75;&#x78;'
127
159
  ```
@@ -137,13 +169,13 @@ he.encode('\x01');
137
169
 
138
170
  // Passing an `options` object to `encode`, to explicitly enable error-tolerant mode:
139
171
  he.encode('\x01', {
140
- strict: false,
172
+ 'strict': false
141
173
  });
142
174
  // → '&#x1;'
143
175
 
144
176
  // Passing an `options` object to `encode`, to explicitly enable strict mode:
145
177
  he.encode('\x01', {
146
- strict: true,
178
+ 'strict': true
147
179
  });
148
180
  // → Parse error
149
181
  ```
@@ -154,7 +186,7 @@ The default value for the `allowUnsafeSymbols` option is `false`. This means tha
154
186
 
155
187
  ```js
156
188
  he.encode('foo © and & ampersand', {
157
- allowUnsafeSymbols: true,
189
+ 'allowUnsafeSymbols': true
158
190
  });
159
191
  // → 'foo &#xA9; and & ampersand'
160
192
  ```
@@ -198,13 +230,13 @@ he.decode('foo&ampbar');
198
230
 
199
231
  // Passing an `options` object to `decode`, to explicitly assume an HTML text context:
200
232
  he.decode('foo&ampbar', {
201
- isAttributeValue: false,
233
+ 'isAttributeValue': false
202
234
  });
203
235
  // → 'foo&bar'
204
236
 
205
237
  // Passing an `options` object to `decode`, to explicitly assume an HTML attribute value context:
206
238
  he.decode('foo&ampbar', {
207
- isAttributeValue: true,
239
+ 'isAttributeValue': true
208
240
  });
209
241
  // → 'foo&ampbar'
210
242
  ```
@@ -220,13 +252,13 @@ he.decode('foo&ampbar');
220
252
 
221
253
  // Passing an `options` object to `decode`, to explicitly enable error-tolerant mode:
222
254
  he.decode('foo&ampbar', {
223
- strict: false,
255
+ 'strict': false
224
256
  });
225
257
  // → 'foo&bar'
226
258
 
227
259
  // Passing an `options` object to `decode`, to explicitly enable strict mode:
228
260
  he.decode('foo&ampbar', {
229
- strict: true,
261
+ 'strict': true
230
262
  });
231
263
  // → Parse error
232
264
  ```
@@ -310,17 +342,27 @@ See `he --help` for the full list of options.
310
342
 
311
343
  ## Support
312
344
 
313
- _he_ is an ES2022 module. It works in all modern browsers and in Node.js v22+. The CLI requires Node.js v22+.
345
+ _he_ has been tested in at least:
346
+
347
+ * Chrome 27-50
348
+ * Firefox 3-45
349
+ * Safari 4-9
350
+ * Opera 10-12, 15–37
351
+ * IE 6–11
352
+ * Edge
353
+ * Narwhal 0.3.2
354
+ * Node.js v0.10, v0.12, v4, v5
355
+ * PhantomJS 1.9.0
356
+ * Rhino 1.7RC4
357
+ * RingoJS 0.8-0.11
358
+
359
+ ## Unit tests & code coverage
314
360
 
315
- ## Development
361
+ After cloning this repository, run `npm install` to install the dependencies needed for he development and testing. You may want to install Istanbul _globally_ using `npm install istanbul -g`.
316
362
 
317
- After cloning this repository, run `npm install` to install the development dependencies.
363
+ Once that’s done, you can run the unit tests in Node using `npm test` or `node tests/tests.js`. To run the tests in Rhino, Ringo, Narwhal, and web browsers as well, use `grunt test`.
318
364
 
319
- - `npm test` runs the test suite using the built-in Node.js test runner.
320
- - `npm run coverage` prints a code coverage report.
321
- - `npm run build` regenerates `data/*.json` from `data/entities.json` and writes the generated `src/data.mjs` module, which `src/he.mjs` imports.
322
- - `npm run fetch` downloads the latest `entities.json`, derives the invalid code points and character reference overrides from the HTML and Infra Standards, and rebuilds. If the relevant spec prose changes, `scripts/fetch-spec.mjs` fails with an explanation instead of writing data.
323
- - `npm run format` formats the code using [Oxfmt](https://oxc.rs/docs/guide/usage/formatter); `npm run format:check` verifies formatting.
365
+ To generate the code coverage report, use `grunt cover`.
324
366
 
325
367
  ## Acknowledgements
326
368
 
@@ -328,9 +370,9 @@ Thanks to [Simon Pieters](https://simon.html5.org/) ([@zcorpan](https://twitter.
328
370
 
329
371
  ## Author
330
372
 
331
- | [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias 'Follow @mathias on Twitter') |
332
- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
333
- | [Mathias Bynens](https://mathiasbynens.be/) |
373
+ | [![twitter/mathias](https://gravatar.com/avatar/24e08a9ea84deb17ae121074d0f17125?s=70)](https://twitter.com/mathias "Follow @mathias on Twitter") |
374
+ |---|
375
+ | [Mathias Bynens](https://mathiasbynens.be/) |
334
376
 
335
377
  ## License
336
378
 
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env node
2
+ (function() {
3
+
4
+ var fs = require('fs');
5
+ var he = require('../he.js');
6
+ var strings = process.argv.splice(2);
7
+ var stdin = process.stdin;
8
+ var data;
9
+ var timeout;
10
+ var action;
11
+ var options = {};
12
+ var log = console.log;
13
+
14
+ var main = function() {
15
+ var option = strings[0];
16
+ var count = 0;
17
+
18
+ if (/^(?:-h|--help|undefined)$/.test(option)) {
19
+ log(
20
+ 'he v%s - https://mths.be/he',
21
+ he.version
22
+ );
23
+ log([
24
+ '\nUsage:\n',
25
+ '\the [--escape] string',
26
+ '\the [--encode] [--use-named-refs] [--everything] [--allow-unsafe] [--decimal] string',
27
+ '\the [--decode] [--attribute] [--strict] string',
28
+ '\the [-v | --version]',
29
+ '\the [-h | --help]',
30
+ '\nExamples:\n',
31
+ '\the --escape \\<img\\ src\\=\\\'x\\\'\\ onerror\\=\\"prompt\\(1\\)\\"\\>',
32
+ '\techo \'&copy; &#x1D306;\' | he --decode'
33
+ ].join('\n'));
34
+ return process.exit(option ? 0 : 1);
35
+ }
36
+
37
+ if (/^(?:-v|--version)$/.test(option)) {
38
+ log('v%s', he.version);
39
+ return process.exit(0);
40
+ }
41
+
42
+ strings.forEach(function(string) {
43
+ // Process options
44
+ if (string == '--escape') {
45
+ action = 'escape';
46
+ return;
47
+ }
48
+ if (string == '--encode') {
49
+ action = 'encode';
50
+ return;
51
+ }
52
+ if (string == '--use-named-refs') {
53
+ action = 'encode';
54
+ options.useNamedReferences = true;
55
+ return;
56
+ }
57
+ if (string == '--everything') {
58
+ action = 'encode';
59
+ options.encodeEverything = true;
60
+ return;
61
+ }
62
+ if (string == '--allow-unsafe') {
63
+ action = 'encode';
64
+ options.allowUnsafeSymbols = true;
65
+ return;
66
+ }
67
+ if (string == '--decimal') {
68
+ action = 'encode';
69
+ options.decimal = true;
70
+ return;
71
+ }
72
+ if (string == '--decode') {
73
+ action = 'decode';
74
+ return;
75
+ }
76
+ if (string == '--attribute') {
77
+ action = 'decode';
78
+ options.isAttributeValue = true;
79
+ return;
80
+ }
81
+ if (string == '--strict') {
82
+ action = 'decode';
83
+ options.strict = true;
84
+ return;
85
+ }
86
+ // Process string(s)
87
+ var result;
88
+ if (!action) {
89
+ log('Error: he requires at least one option and a string argument.');
90
+ log('Try `he --help` for more information.');
91
+ return process.exit(1);
92
+ }
93
+ try {
94
+ result = he[action](string, options);
95
+ log(result);
96
+ count++;
97
+ } catch(error) {
98
+ log(error.message + '\n');
99
+ log('Error: failed to %s.', action);
100
+ log('If you think this is a bug in he, please report it:');
101
+ log('https://github.com/mathiasbynens/he/issues/new');
102
+ log(
103
+ '\nStack trace using he@%s:\n',
104
+ he.version
105
+ );
106
+ log(error.stack);
107
+ return process.exit(1);
108
+ }
109
+ });
110
+ if (!count) {
111
+ log('Error: he requires a string argument.');
112
+ log('Try `he --help` for more information.');
113
+ return process.exit(1);
114
+ }
115
+ // Return with exit status 0 outside of the `forEach` loop, in case
116
+ // multiple strings were passed in.
117
+ return process.exit(0);
118
+ };
119
+
120
+ if (stdin.isTTY) {
121
+ // handle shell arguments
122
+ main();
123
+ } else {
124
+ // Either the script is called from within a non-TTY context, or `stdin`
125
+ // content is being piped in.
126
+ if (!process.stdout.isTTY) {
127
+ // The script was called from a non-TTY context. This is a rather uncommon
128
+ // use case we don’t actively support. However, we don’t want the script
129
+ // to wait forever in such cases, so…
130
+ timeout = setTimeout(function() {
131
+ // …if no piped data arrived after a whole minute, handle shell
132
+ // arguments instead.
133
+ main();
134
+ }, 60000);
135
+ }
136
+ data = '';
137
+ stdin.on('data', function(chunk) {
138
+ clearTimeout(timeout);
139
+ data += chunk;
140
+ });
141
+ stdin.on('end', function() {
142
+ strings.push(data.trim());
143
+ main();
144
+ });
145
+ stdin.resume();
146
+ }
147
+
148
+ }());