serverless-simple-middleware 0.0.48 → 0.0.50-beta.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "serverless-simple-middleware",
3
3
  "description": "Simple middleware to translate the interface of lambda's handler to request => response",
4
- "version": "0.0.48",
4
+ "version": "0.0.50-beta.0",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
7
  "author": "VoyagerX",
@@ -54,6 +54,7 @@ class HandlerProxy<A extends HandlerAuxBase> {
54
54
  middleware: HandlerMiddleware<A>,
55
55
  handler: Handler<A>,
56
56
  ) => {
57
+ logger.info('call!')
57
58
  try {
58
59
  this.aux = await middleware.auxPromise;
59
60
  } catch (error) {
@@ -103,6 +103,8 @@ export class Tracer {
103
103
  .promise();
104
104
  logger.stupid(`sendBatchResult`, sendBatchResult);
105
105
  }
106
+
107
+ this.buffer = [];
106
108
  } catch (error) {
107
109
  logger.warn(`Error in eventSource: ${error}`);
108
110
  }
@@ -1,15 +0,0 @@
1
- import { AWSComponent } from './define';
2
- export interface AWSConfig {
3
- [key: string]: string | boolean | number | undefined;
4
- }
5
- export interface AWSConfigs {
6
- [service: string]: AWSConfig;
7
- }
8
- export declare type AWSConfigResolver = (service: string) => AWSConfig;
9
- export declare type SimpleAWSConfigLoadParam = AWSConfigs | string;
10
- export declare class SimpleAWSConfig {
11
- private configs;
12
- constructor(configs?: AWSConfigs);
13
- get: (service: AWSComponent) => AWSConfig | undefined;
14
- }
15
- export declare const loadAWSConfig: (newConfigsOrUrl: SimpleAWSConfigLoadParam) => Promise<SimpleAWSConfig>;
@@ -1,29 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var cross_fetch_1 = require("cross-fetch");
4
- var fs = require("fs");
5
- var SimpleAWSConfig = /** @class */ (function () {
6
- function SimpleAWSConfig(configs) {
7
- var _this = this;
8
- this.get = function (service) {
9
- return _this.configs ? _this.configs[service] : undefined;
10
- };
11
- this.configs = configs;
12
- }
13
- return SimpleAWSConfig;
14
- }());
15
- exports.SimpleAWSConfig = SimpleAWSConfig;
16
- exports.loadAWSConfig = function (newConfigsOrUrl) {
17
- if (typeof newConfigsOrUrl === 'string') {
18
- if (/^http.*json$/.test(newConfigsOrUrl)) {
19
- return cross_fetch_1.default(newConfigsOrUrl)
20
- .then(function (r) { return r.json(); })
21
- .then(exports.loadAWSConfig);
22
- }
23
- else if (/json$/.test(newConfigsOrUrl)) {
24
- return exports.loadAWSConfig(JSON.parse(fs.readFileSync(newConfigsOrUrl, 'utf-8')));
25
- }
26
- return exports.loadAWSConfig(JSON.parse(newConfigsOrUrl));
27
- }
28
- return Promise.resolve(new SimpleAWSConfig(newConfigsOrUrl));
29
- };
@@ -1,21 +0,0 @@
1
- export declare enum AWSComponent {
2
- s3 = "s3",
3
- sqs = "sqs",
4
- dynamodb = "dynamodb"
5
- }
6
- export interface SQSMessageBody<T> {
7
- handle: string;
8
- body?: T;
9
- }
10
- export interface S3SignedUrlParams {
11
- Key?: string;
12
- Expires?: number;
13
- ContentType?: string;
14
- ACL?: 'private' | 'public-read' | 'public-read-write' | 'authenticated-read' | string;
15
- ResponseContentDisposition?: string;
16
- ResponseContentType?: string;
17
- }
18
- export interface S3SignedUrlResult {
19
- key: string;
20
- url: string;
21
- }
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- var AWSComponent;
4
- (function (AWSComponent) {
5
- AWSComponent["s3"] = "s3";
6
- AWSComponent["sqs"] = "sqs";
7
- AWSComponent["dynamodb"] = "dynamodb";
8
- })(AWSComponent = exports.AWSComponent || (exports.AWSComponent = {}));
@@ -1,3 +0,0 @@
1
- export * from './define';
2
- export * from './config';
3
- export * from './simple';
package/dist/aws/index.js DELETED
@@ -1,8 +0,0 @@
1
- "use strict";
2
- function __export(m) {
3
- for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
4
- }
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- __export(require("./define"));
7
- __export(require("./config"));
8
- __export(require("./simple"));
@@ -1,42 +0,0 @@
1
- import * as AWS from 'aws-sdk';
2
- import { SimpleAWSConfig } from './config';
3
- import { S3SignedUrlParams, S3SignedUrlResult, SQSMessageBody } from './define';
4
- export declare class SimpleAWS {
5
- private queueUrls;
6
- private config;
7
- private lazyS3;
8
- private lazySqs;
9
- private lazyDynamodb;
10
- private lazyDynamodbAdmin;
11
- constructor(config?: SimpleAWSConfig);
12
- readonly s3: AWS.S3;
13
- readonly sqs: AWS.SQS;
14
- readonly dynamodb: AWS.DynamoDB.DocumentClient;
15
- readonly dynamodbAdmin: AWS.DynamoDB;
16
- getQueueUrl: (queueName: string) => Promise<string>;
17
- enqueue: (queueName: string, data: any) => Promise<number>;
18
- dequeue: <T>(queueName: string, fetchSize?: number, waitSeconds?: number, visibilityTimeout?: number) => Promise<SQSMessageBody<T>[]>;
19
- dequeueAll: <T>(queueName: string, limitSize?: number, visibilityTimeout?: number) => Promise<SQSMessageBody<T>[]>;
20
- retainMessage: (queueName: string, handle: string, seconds: number) => Promise<string>;
21
- completeMessage: (queueName: string, handle: string) => Promise<string>;
22
- completeMessages: (queueName: string, handles: string[]) => Promise<string[]>;
23
- download: (bucketName: string, key: string, localPath: string) => Promise<string>;
24
- upload: (bucketName: string, localPath: string, key: string) => Promise<string>;
25
- getSignedUrl: (bucketName: string, key: string, operation?: "getObject" | "putObject", params?: S3SignedUrlParams | undefined) => S3SignedUrlResult;
26
- getSignedCookie: (keyPairId: string, privateKey: string, url: string, expires: number) => AWS.CloudFront.Signer.CustomPolicy;
27
- getAttachmentUrl: (bucketName: string, key: string, fileName: string, params?: S3SignedUrlParams | undefined) => S3SignedUrlResult;
28
- getDynamoDbItem: <T>(tableName: string, key: {
29
- [keyColumn: string]: string;
30
- }, defaultValue?: T | undefined) => Promise<T | undefined>;
31
- updateDynamoDbItem: (tableName: string, key: {
32
- [keyColumn: string]: string;
33
- }, columnValues: {
34
- [column: string]: any;
35
- }) => Promise<import("aws-sdk/lib/request").PromiseResult<AWS.DynamoDB.DocumentClient.UpdateItemOutput, AWS.AWSError>>;
36
- setupQueue: (queueName: string) => Promise<boolean>;
37
- setupStorage: (bucketName: string, cors: {
38
- methods: ("DELETE" | "GET" | "HEAD" | "POST" | "PUT")[];
39
- origins: string[];
40
- }) => Promise<boolean>;
41
- setupDynamoDb: (tableName: string, keyColumn: string) => Promise<boolean>;
42
- }