serverless-simple-middleware 0.0.65 → 0.0.66
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/middleware/base.js +4 -0
- package/dist/middleware/database/index.d.ts +2 -1
- package/dist/middleware/database/index.js +2 -1
- package/dist/middleware/database/sqlClient.d.ts +1 -1
- package/package.json +1 -1
- package/src/middleware/base.ts +5 -1
- package/src/middleware/database/index.ts +3 -13
- package/src/middleware/database/sqlClient.ts +8 -0
package/dist/middleware/base.js
CHANGED
|
@@ -59,10 +59,14 @@ class HandlerResponse {
|
|
|
59
59
|
}
|
|
60
60
|
ok(body = {}, code = 200) {
|
|
61
61
|
logger.stupid(`ok`, body);
|
|
62
|
+
const exposeHeaders = Object.keys(this.customHeaders).join(', ');
|
|
62
63
|
const headers = {
|
|
63
64
|
...CORS_HEADERS,
|
|
64
65
|
...this.customHeaders,
|
|
65
66
|
};
|
|
67
|
+
if (exposeHeaders) {
|
|
68
|
+
headers['Access-Control-Expose-Headers'] = exposeHeaders;
|
|
69
|
+
}
|
|
66
70
|
if (this.crossOrigin) {
|
|
67
71
|
headers['Access-Control-Allow-Origin'] = this.crossOrigin;
|
|
68
72
|
}
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { ConnectionProxy } from './connectionProxy';
|
|
2
|
-
export {
|
|
2
|
+
export { expressionBuilder, sql } from './sqlClient';
|
|
3
|
+
export type * from './sqlClient';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sql = exports.ConnectionProxy = void 0;
|
|
3
|
+
exports.sql = exports.expressionBuilder = exports.ConnectionProxy = void 0;
|
|
4
4
|
var connectionProxy_1 = require("./connectionProxy");
|
|
5
5
|
Object.defineProperty(exports, "ConnectionProxy", { enumerable: true, get: function () { return connectionProxy_1.ConnectionProxy; } });
|
|
6
6
|
var sqlClient_1 = require("./sqlClient");
|
|
7
|
+
Object.defineProperty(exports, "expressionBuilder", { enumerable: true, get: function () { return sqlClient_1.expressionBuilder; } });
|
|
7
8
|
Object.defineProperty(exports, "sql", { enumerable: true, get: function () { return sqlClient_1.sql; } });
|
|
@@ -5,4 +5,4 @@ export declare class SQLClient<T = unknown> extends Kysely<T> {
|
|
|
5
5
|
constructor(config: ConnectionOptions);
|
|
6
6
|
clearConnection: () => Promise<void>;
|
|
7
7
|
}
|
|
8
|
-
export { expressionBuilder, sql, type DeleteQueryBuilder, type Expression, type ExpressionBuilder, type InsertQueryBuilder, type NotNull, type RawBuilder, type SelectQueryBuilder, type SqlBool, type UpdateQueryBuilder, } from 'kysely';
|
|
8
|
+
export { expressionBuilder, sql, type DeleteQueryBuilder, type DeleteResult, type Expression, type ExpressionBuilder, type InferResult, type Insertable, type InsertQueryBuilder, type InsertResult, type NotNull, type RawBuilder, type Selectable, type SelectQueryBuilder, type SqlBool, type Transaction, type Updateable, type UpdateQueryBuilder, type UpdateResult, } from 'kysely';
|
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.
|
|
4
|
+
"version": "0.0.66",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
7
|
"author": "VoyagerX",
|
package/src/middleware/base.ts
CHANGED
|
@@ -77,10 +77,14 @@ export class HandlerResponse {
|
|
|
77
77
|
|
|
78
78
|
public ok(body = {}, code = 200) {
|
|
79
79
|
logger.stupid(`ok`, body);
|
|
80
|
-
const
|
|
80
|
+
const exposeHeaders = Object.keys(this.customHeaders).join(', ');
|
|
81
|
+
const headers: { [key: string]: any } = {
|
|
81
82
|
...CORS_HEADERS,
|
|
82
83
|
...this.customHeaders,
|
|
83
84
|
};
|
|
85
|
+
if (exposeHeaders) {
|
|
86
|
+
headers['Access-Control-Expose-Headers'] = exposeHeaders;
|
|
87
|
+
}
|
|
84
88
|
if (this.crossOrigin) {
|
|
85
89
|
headers['Access-Control-Allow-Origin'] = this.crossOrigin;
|
|
86
90
|
}
|
|
@@ -1,14 +1,4 @@
|
|
|
1
1
|
export { ConnectionProxy } from './connectionProxy';
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
type Expression,
|
|
6
|
-
type ExpressionBuilder,
|
|
7
|
-
type InsertQueryBuilder,
|
|
8
|
-
type NotNull,
|
|
9
|
-
type RawBuilder,
|
|
10
|
-
type SelectQueryBuilder,
|
|
11
|
-
type SqlBool,
|
|
12
|
-
type SQLClient,
|
|
13
|
-
type UpdateQueryBuilder,
|
|
14
|
-
} from './sqlClient';
|
|
2
|
+
export { expressionBuilder, sql } from './sqlClient';
|
|
3
|
+
|
|
4
|
+
export type * from './sqlClient';
|
|
@@ -84,12 +84,20 @@ export {
|
|
|
84
84
|
expressionBuilder,
|
|
85
85
|
sql,
|
|
86
86
|
type DeleteQueryBuilder,
|
|
87
|
+
type DeleteResult,
|
|
87
88
|
type Expression,
|
|
88
89
|
type ExpressionBuilder,
|
|
90
|
+
type InferResult,
|
|
91
|
+
type Insertable,
|
|
89
92
|
type InsertQueryBuilder,
|
|
93
|
+
type InsertResult,
|
|
90
94
|
type NotNull,
|
|
91
95
|
type RawBuilder,
|
|
96
|
+
type Selectable,
|
|
92
97
|
type SelectQueryBuilder,
|
|
93
98
|
type SqlBool,
|
|
99
|
+
type Transaction,
|
|
100
|
+
type Updateable,
|
|
94
101
|
type UpdateQueryBuilder,
|
|
102
|
+
type UpdateResult,
|
|
95
103
|
} from 'kysely';
|