@bitblit/ratchet-aws-node-only 4.0.99-alpha → 4.0.103-alpha
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/{dist/types → lib}/athena/alb-athena-log-ratchet.d.ts +2 -2
- package/{dist/es → lib}/athena/alb-athena-log-ratchet.js +55 -52
- package/lib/athena/alb-athena-log-ratchet.spec.d.ts +1 -0
- package/lib/athena/alb-athena-log-ratchet.spec.js +25 -0
- package/{dist/es → lib}/athena/athena-ratchet.js +9 -6
- package/lib/athena/athena-ratchet.spec.d.ts +1 -0
- package/lib/athena/athena-ratchet.spec.js +27 -0
- package/{dist/types → lib}/build/ratchet-aws-node-only-info.d.ts +1 -1
- package/{dist/types → lib}/cli/dynamo-exporter.d.ts +2 -2
- package/{dist/es → lib}/cli/dynamo-exporter.js +4 -4
- package/{dist/types → lib}/cli/ratchet-cli-handler.d.ts +2 -2
- package/{dist/es → lib}/cli/ratchet-cli-handler.js +4 -4
- package/{dist/es → lib}/cli/site-uploader/site-uploader.js +5 -2
- package/{dist/es → lib}/cli/start-instance-and-ssh.js +8 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/mail/inbound/email-to-db-insert-processor.d.ts +10 -0
- package/lib/mail/inbound/email-to-db-insert-processor.js +89 -0
- package/lib/mail/inbound/inbound-email-ratchet.d.ts +10 -0
- package/{dist/es → lib}/mail/inbound/inbound-email-ratchet.js +16 -24
- package/lib/mail/inbound/inbound-email-ratchet.spec.d.ts +1 -0
- package/lib/mail/inbound/inbound-email-ratchet.spec.js +18 -0
- package/lib/mail/inbound/parsed-email-processor.d.ts +5 -0
- package/lib/mail/inbound/parsed-email-processor.js +1 -0
- package/lib/mail/inbound/sample-email-processor.d.ts +6 -0
- package/lib/mail/inbound/sample-email-processor.js +8 -0
- package/package.json +12 -14
- package/dist/cjs/athena/alb-athena-log-ratchet.js +0 -158
- package/dist/cjs/athena/athena-ratchet.js +0 -159
- package/dist/cjs/build/ratchet-aws-node-only-info.js +0 -18
- package/dist/cjs/cli/dynamo-exporter.js +0 -81
- package/dist/cjs/cli/ratchet-cli-handler.js +0 -19
- package/dist/cjs/cli/site-uploader/site-uploader.js +0 -117
- package/dist/cjs/cli/start-instance-and-ssh.js +0 -67
- package/dist/cjs/index.js +0 -11
- package/dist/cjs/mail/inbound/inbound-email-ratchet.js +0 -54
- package/dist/es/index.js +0 -8
- package/dist/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/tsconfig.es.tsbuildinfo +0 -1
- package/dist/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/index.d.ts +0 -11
- package/dist/types/mail/inbound/inbound-email-ratchet.d.ts +0 -18
- /package/{includes → bin}/cli.js +0 -0
- /package/{dist/types → lib}/athena/athena-ratchet.d.ts +0 -0
- /package/{dist/es → lib}/build/ratchet-aws-node-only-info.js +0 -0
- /package/{dist/types → lib}/cli/site-uploader/site-uploader.d.ts +0 -0
- /package/{dist/types → lib}/cli/start-instance-and-ssh.d.ts +0 -0
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MultiStream = exports.InboundEmailRatchet = void 0;
|
|
4
|
-
const mailparser_1 = require("mailparser");
|
|
5
|
-
const stream_1 = require("stream");
|
|
6
|
-
const ratchet_common_1 = require("@bitblit/ratchet-common");
|
|
7
|
-
class InboundEmailRatchet {
|
|
8
|
-
constructor(cache) {
|
|
9
|
-
this.cache = cache;
|
|
10
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(this.cache, 'cache');
|
|
11
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(this.cache.getDefaultBucket(), 'cache.defaultBucket');
|
|
12
|
-
}
|
|
13
|
-
async processEmailFromS3(key) {
|
|
14
|
-
const rval = false;
|
|
15
|
-
if (await this.cache.fileExists(key)) {
|
|
16
|
-
const data = await this.cache.fetchCacheFileAsString(key);
|
|
17
|
-
return this.processEmailFromBuffer(new Buffer(data));
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
ratchet_common_1.Logger.warn('Cannot process inbound email - no such key : %s', key);
|
|
21
|
-
}
|
|
22
|
-
return rval;
|
|
23
|
-
}
|
|
24
|
-
async processEmailFromBuffer(buf) {
|
|
25
|
-
const rval = false;
|
|
26
|
-
ratchet_common_1.RequireRatchet.notNullOrUndefined(buf, 'buf');
|
|
27
|
-
ratchet_common_1.Logger.info('Processing inbound email - size %d bytes', buf.length);
|
|
28
|
-
const message = await (0, mailparser_1.simpleParser)(buf);
|
|
29
|
-
ratchet_common_1.Logger.info('Found mail from "%s" subject "%s" with %d attachments', message.from.text, message.subject, message.attachments.length);
|
|
30
|
-
if (!!message &&
|
|
31
|
-
!!message.subject &&
|
|
32
|
-
message.subject.toLowerCase().startsWith('reach inventory') &&
|
|
33
|
-
!!message.attachments &&
|
|
34
|
-
message.attachments.length === 1 &&
|
|
35
|
-
message.attachments[0].contentType.toLowerCase() === 'application/zip') {
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
ratchet_common_1.Logger.info('Unrecognized email - not processing');
|
|
39
|
-
}
|
|
40
|
-
return rval;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
exports.InboundEmailRatchet = InboundEmailRatchet;
|
|
44
|
-
class MultiStream extends stream_1.Readable {
|
|
45
|
-
constructor(object, options = {}) {
|
|
46
|
-
super(object instanceof Buffer || typeof object === 'string' ? options : { objectMode: true });
|
|
47
|
-
this._object = object;
|
|
48
|
-
}
|
|
49
|
-
_read() {
|
|
50
|
-
this.push(this._object);
|
|
51
|
-
this._object = null;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
exports.MultiStream = MultiStream;
|
package/dist/es/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export * from './athena/alb-athena-log-ratchet';
|
|
2
|
-
export * from './athena/athena-ratchet';
|
|
3
|
-
export * from './build/ratchet-aws-node-only-info';
|
|
4
|
-
export * from './cli/dynamo-exporter';
|
|
5
|
-
export * from './cli/ratchet-cli-handler';
|
|
6
|
-
export * from './cli/start-instance-and-ssh';
|
|
7
|
-
export * from './cli/site-uploader/site-uploader';
|
|
8
|
-
export * from './mail/inbound/inbound-email-ratchet';
|