@whook/gcp-functions 13.0.0 → 13.1.2
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/README.md +76 -28
- package/dist/commands/testHTTPFunction.d.ts +1 -1
- package/dist/commands/testHTTPFunction.js +2 -2
- package/dist/commands/testHTTPFunction.js.map +1 -1
- package/dist/index.d.ts +27 -0
- package/dist/index.js +33 -65
- package/dist/index.js.map +1 -1
- package/dist/index.test.js +10 -0
- package/dist/index.test.js.map +1 -0
- package/dist/libs/utils.d.ts +3 -2
- package/dist/libs/utils.js +2 -2
- package/dist/libs/utils.js.map +1 -1
- package/dist/services/HANDLER.d.ts +12 -0
- package/dist/services/HANDLER.js +21 -0
- package/dist/services/HANDLER.js.map +1 -0
- package/dist/services/_autoload.d.ts +27 -13
- package/dist/services/_autoload.js +79 -31
- package/dist/services/_autoload.js.map +1 -1
- package/dist/services/log.js +2 -2
- package/dist/services/log.js.map +1 -1
- package/dist/wrappers/wrapHandlerForGoogleHTTPFunction.d.ts +24 -0
- package/dist/wrappers/{googleHTTPFunction.js → wrapHandlerForGoogleHTTPFunction.js} +88 -77
- package/dist/wrappers/wrapHandlerForGoogleHTTPFunction.js.map +1 -0
- package/package.json +10 -9
- package/src/commands/testHTTPFunction.ts +3 -4
- package/src/index.test.ts +11 -0
- package/src/index.ts +43 -97
- package/src/libs/utils.ts +3 -2
- package/src/services/HANDLER.ts +41 -0
- package/src/services/_autoload.ts +136 -41
- package/src/services/log.ts +2 -2
- package/src/wrappers/{googleHTTPFunction.ts → wrapHandlerForGoogleHTTPFunction.ts} +153 -141
- package/dist/services/log.test.js +0 -8
- package/dist/services/log.test.js.map +0 -1
- package/dist/wrappers/googleHTTPFunction.d.ts +0 -22
- package/dist/wrappers/googleHTTPFunction.js.map +0 -1
- package/src/services/log.test.ts +0 -8
- /package/dist/{services/log.test.d.ts → index.test.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { printStackTrace } from 'yerror';
|
|
2
|
+
import { YError, printStackTrace } from 'yerror';
|
|
3
3
|
import {
|
|
4
4
|
DEFAULT_DEBUG_NODE_ENVS,
|
|
5
5
|
DEFAULT_BUFFER_LIMIT,
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
extractOperationSecurityParameters,
|
|
11
11
|
castParameters,
|
|
12
12
|
} from '@whook/http-router';
|
|
13
|
-
import {
|
|
13
|
+
import { autoService } from 'knifecycle';
|
|
14
14
|
import Ajv from 'ajv';
|
|
15
15
|
import addAJVFormats from 'ajv-formats';
|
|
16
16
|
import bytes from 'bytes';
|
|
@@ -30,106 +30,119 @@ import {
|
|
|
30
30
|
getBody,
|
|
31
31
|
sendBody,
|
|
32
32
|
} from '@whook/http-router';
|
|
33
|
-
import { noop,
|
|
33
|
+
import { noop, identity, lowerCaseHeaders } from '@whook/whook';
|
|
34
34
|
import stream from 'stream';
|
|
35
35
|
import type { WhookQueryStringParser } from '@whook/http-router';
|
|
36
|
-
import type { ServiceInitializer, Dependencies, Service } from 'knifecycle';
|
|
37
36
|
import type {
|
|
38
37
|
WhookRequest,
|
|
39
38
|
WhookResponse,
|
|
40
39
|
WhookHandler,
|
|
41
|
-
|
|
40
|
+
WhookObfuscatorService,
|
|
42
41
|
WhookOperation,
|
|
43
42
|
WhookWrapper,
|
|
43
|
+
WhookErrorHandler,
|
|
44
44
|
} from '@whook/whook';
|
|
45
|
-
import type {
|
|
45
|
+
import type { LogService } from 'common-services';
|
|
46
46
|
import type { OpenAPIV3 } from 'openapi-types';
|
|
47
47
|
import type { Readable } from 'stream';
|
|
48
|
-
import type {
|
|
48
|
+
import type { AppEnvVars } from 'application-services';
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
const SEARCH_SEPARATOR = '?';
|
|
51
|
+
const PATH_SEPARATOR = '/';
|
|
52
|
+
|
|
53
|
+
export type WhookWrapHTTPFunctionDependencies = {
|
|
54
|
+
OPERATION_API: OpenAPIV3.Document;
|
|
55
|
+
ENV: AppEnvVars;
|
|
52
56
|
DEBUG_NODE_ENVS?: string[];
|
|
53
|
-
OPERATION: WhookOperation;
|
|
54
57
|
DECODERS?: typeof DEFAULT_DECODERS;
|
|
55
58
|
ENCODERS?: typeof DEFAULT_ENCODERS;
|
|
56
59
|
PARSERS?: typeof DEFAULT_PARSERS;
|
|
57
60
|
STRINGIFYERS?: typeof DEFAULT_STRINGIFYERS;
|
|
58
61
|
QUERY_PARSER: WhookQueryStringParser;
|
|
59
62
|
BUFFER_LIMIT?: string;
|
|
60
|
-
obfuscator:
|
|
61
|
-
|
|
63
|
+
obfuscator: WhookObfuscatorService;
|
|
64
|
+
errorHandler: WhookErrorHandler;
|
|
62
65
|
log?: LogService;
|
|
63
|
-
WRAPPERS: WhookWrapper<Dependencies, Service>[];
|
|
64
66
|
};
|
|
65
67
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
68
|
+
/**
|
|
69
|
+
* Wrap an handler to make it work with GCP Functions.
|
|
70
|
+
* @param {Object} services
|
|
71
|
+
* The services the wrapper depends on
|
|
72
|
+
* @param {Object} services.OPERATION_API
|
|
73
|
+
* An OpenAPI definitition for that handler
|
|
74
|
+
* @param {Object} services.ENV
|
|
75
|
+
* The process environment
|
|
76
|
+
* @param {Object} services.DEBUG_NODE_ENVS
|
|
77
|
+
* The NODE_ENV values that trigger debugging
|
|
78
|
+
* @param {Object} services.DECODERS
|
|
79
|
+
* Request body decoders available
|
|
80
|
+
* @param {Object} services.ENCODERS
|
|
81
|
+
* Response body encoders available
|
|
82
|
+
* @param {Object} services.PARSERS
|
|
83
|
+
* Request body parsers available
|
|
84
|
+
* @param {Object} services.STRINGIFYERS
|
|
85
|
+
* Response body stringifyers available
|
|
86
|
+
* @param {Object} services.BUFFER_LIMIT
|
|
87
|
+
* The buffer size limit
|
|
88
|
+
* @param {Object} services.QUERY_PARSER
|
|
89
|
+
* The query parser to use
|
|
90
|
+
* @param {Object} services.obfuscator
|
|
91
|
+
* A service to hide sensible values
|
|
92
|
+
* @param {Object} services.errorHandler
|
|
93
|
+
* A service that changes any error to Whook response
|
|
94
|
+
* @param {Object} [services.log=noop]
|
|
95
|
+
* An optional logging service
|
|
96
|
+
* @return {Promise<Object>}
|
|
97
|
+
* A promise of an object containing the reshaped env vars.
|
|
98
|
+
*/
|
|
99
|
+
|
|
100
|
+
async function initWrapHandlerForGoogleHTTPFunction<S extends WhookHandler>({
|
|
101
|
+
OPERATION_API,
|
|
102
|
+
ENV,
|
|
103
|
+
DEBUG_NODE_ENVS = DEFAULT_DEBUG_NODE_ENVS,
|
|
104
|
+
DECODERS = DEFAULT_DECODERS,
|
|
105
|
+
ENCODERS = DEFAULT_ENCODERS,
|
|
106
|
+
PARSERS = DEFAULT_PARSERS,
|
|
107
|
+
STRINGIFYERS = DEFAULT_STRINGIFYERS,
|
|
108
|
+
BUFFER_LIMIT = DEFAULT_BUFFER_LIMIT,
|
|
109
|
+
QUERY_PARSER,
|
|
110
|
+
obfuscator,
|
|
111
|
+
errorHandler,
|
|
112
|
+
log = noop,
|
|
113
|
+
}: WhookWrapHTTPFunctionDependencies): Promise<WhookWrapper<S>> {
|
|
114
|
+
log('debug', '📥 - Initializing the AWS Lambda cron wrapper.');
|
|
100
115
|
|
|
101
|
-
async function initHandlerForAWSHTTPFunction(
|
|
102
|
-
initHandler: ServiceInitializer<Dependencies, WhookHandler>,
|
|
103
|
-
{
|
|
104
|
-
OPERATION_API,
|
|
105
|
-
WRAPPERS,
|
|
106
|
-
NODE_ENV,
|
|
107
|
-
DEBUG_NODE_ENVS = DEFAULT_DEBUG_NODE_ENVS,
|
|
108
|
-
DECODERS = DEFAULT_DECODERS,
|
|
109
|
-
ENCODERS = DEFAULT_ENCODERS,
|
|
110
|
-
log = noop,
|
|
111
|
-
time = Date.now.bind(Date),
|
|
112
|
-
...services
|
|
113
|
-
},
|
|
114
|
-
) {
|
|
115
116
|
const path = Object.keys(OPERATION_API.paths)[0];
|
|
116
|
-
const
|
|
117
|
-
|
|
117
|
+
const pathObject = OPERATION_API.paths[path];
|
|
118
|
+
|
|
119
|
+
if (typeof pathObject === 'undefined' || '$ref' in pathObject) {
|
|
120
|
+
throw new YError('E_BAD_OPERATION', 'pathObject', pathObject);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
const method = Object.keys(pathObject)[0];
|
|
124
|
+
const operationObject = pathObject[method];
|
|
125
|
+
|
|
126
|
+
if (typeof operationObject === 'undefined' || '$ref' in operationObject) {
|
|
127
|
+
throw new YError('E_BAD_OPERATION', 'operationObject', operationObject);
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const operation: WhookOperation = {
|
|
118
131
|
path,
|
|
119
132
|
method,
|
|
120
|
-
...
|
|
133
|
+
...operationObject,
|
|
121
134
|
};
|
|
122
135
|
const consumableCharsets = Object.keys(DECODERS);
|
|
123
136
|
const produceableCharsets = Object.keys(ENCODERS);
|
|
124
|
-
const consumableMediaTypes = extractConsumableMediaTypes(
|
|
125
|
-
const produceableMediaTypes = extractProduceableMediaTypes(
|
|
137
|
+
const consumableMediaTypes = extractConsumableMediaTypes(operation);
|
|
138
|
+
const produceableMediaTypes = extractProduceableMediaTypes(operation);
|
|
126
139
|
const ajv = new Ajv.default({
|
|
127
|
-
verbose: DEBUG_NODE_ENVS.includes(NODE_ENV),
|
|
140
|
+
verbose: DEBUG_NODE_ENVS.includes(ENV.NODE_ENV),
|
|
128
141
|
strict: true,
|
|
129
142
|
logger: {
|
|
130
|
-
log: (...args) => log?.('debug', ...args),
|
|
131
|
-
warn: (...args) => log?.('warning', ...args),
|
|
132
|
-
error: (...args) => log?.('error', ...args),
|
|
143
|
+
log: (...args: string[]) => log?.('debug', ...args),
|
|
144
|
+
warn: (...args: string[]) => log?.('warning', ...args),
|
|
145
|
+
error: (...args: string[]) => log?.('error', ...args),
|
|
133
146
|
},
|
|
134
147
|
useDefaults: true,
|
|
135
148
|
coerceTypes: true,
|
|
@@ -137,71 +150,63 @@ async function initHandlerForAWSHTTPFunction(
|
|
|
137
150
|
addAJVFormats.default(ajv);
|
|
138
151
|
const ammendedParameters = extractOperationSecurityParameters(
|
|
139
152
|
OPERATION_API,
|
|
140
|
-
|
|
153
|
+
operation,
|
|
141
154
|
);
|
|
142
155
|
const validators = prepareParametersValidators(
|
|
143
156
|
ajv,
|
|
144
|
-
|
|
145
|
-
((
|
|
157
|
+
operation.operationId,
|
|
158
|
+
((operation.parameters || []) as OpenAPIV3.ParameterObject[]).concat(
|
|
146
159
|
ammendedParameters,
|
|
147
160
|
),
|
|
148
161
|
);
|
|
149
|
-
const bodyValidator = prepareBodyValidator(ajv,
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
162
|
+
const bodyValidator = prepareBodyValidator(ajv, operation);
|
|
163
|
+
const wrapper = async (handler: S): Promise<S> => {
|
|
164
|
+
const wrappedHandler = handleForAWSHTTPFunction.bind(
|
|
165
|
+
null,
|
|
166
|
+
{
|
|
167
|
+
DECODERS,
|
|
168
|
+
ENCODERS,
|
|
169
|
+
PARSERS,
|
|
170
|
+
STRINGIFYERS,
|
|
171
|
+
BUFFER_LIMIT,
|
|
172
|
+
QUERY_PARSER,
|
|
173
|
+
obfuscator,
|
|
174
|
+
errorHandler,
|
|
175
|
+
log,
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
consumableMediaTypes,
|
|
179
|
+
produceableMediaTypes,
|
|
180
|
+
consumableCharsets,
|
|
181
|
+
produceableCharsets,
|
|
182
|
+
validators,
|
|
183
|
+
bodyValidator,
|
|
184
|
+
operation,
|
|
185
|
+
},
|
|
186
|
+
handler as any,
|
|
187
|
+
);
|
|
165
188
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
NODE_ENV,
|
|
171
|
-
DEBUG_NODE_ENVS,
|
|
172
|
-
DECODERS,
|
|
173
|
-
ENCODERS,
|
|
174
|
-
log,
|
|
175
|
-
time,
|
|
176
|
-
...services,
|
|
177
|
-
} as unknown as HTTPWrapperDependencies & { CORS: CORSConfig },
|
|
178
|
-
{
|
|
179
|
-
consumableMediaTypes,
|
|
180
|
-
produceableMediaTypes,
|
|
181
|
-
consumableCharsets,
|
|
182
|
-
produceableCharsets,
|
|
183
|
-
validators,
|
|
184
|
-
bodyValidator,
|
|
185
|
-
},
|
|
186
|
-
handler,
|
|
187
|
-
);
|
|
189
|
+
return wrappedHandler as unknown as S;
|
|
190
|
+
};
|
|
191
|
+
|
|
192
|
+
return wrapper;
|
|
188
193
|
}
|
|
189
194
|
|
|
190
195
|
async function handleForAWSHTTPFunction(
|
|
191
196
|
{
|
|
192
|
-
OPERATION,
|
|
193
|
-
DEBUG_NODE_ENVS,
|
|
194
|
-
NODE_ENV,
|
|
195
|
-
ENCODERS,
|
|
196
197
|
DECODERS,
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
ENCODERS,
|
|
199
|
+
PARSERS,
|
|
200
|
+
STRINGIFYERS,
|
|
201
|
+
BUFFER_LIMIT,
|
|
200
202
|
QUERY_PARSER,
|
|
201
|
-
CORS,
|
|
202
|
-
log,
|
|
203
203
|
obfuscator,
|
|
204
|
-
|
|
204
|
+
errorHandler,
|
|
205
|
+
log,
|
|
206
|
+
}: Omit<
|
|
207
|
+
Required<WhookWrapHTTPFunctionDependencies>,
|
|
208
|
+
'time' | 'OPERATION_API' | 'ENV' | 'DEBUG_NODE_ENVS'
|
|
209
|
+
>,
|
|
205
210
|
{
|
|
206
211
|
consumableMediaTypes,
|
|
207
212
|
produceableMediaTypes,
|
|
@@ -209,12 +214,26 @@ async function handleForAWSHTTPFunction(
|
|
|
209
214
|
produceableCharsets,
|
|
210
215
|
validators,
|
|
211
216
|
bodyValidator,
|
|
217
|
+
operation,
|
|
218
|
+
}: {
|
|
219
|
+
consumableMediaTypes: string[];
|
|
220
|
+
produceableMediaTypes: string[];
|
|
221
|
+
consumableCharsets: string[];
|
|
222
|
+
produceableCharsets: string[];
|
|
223
|
+
validators: {
|
|
224
|
+
[name: string]: Ajv.ValidateFunction<unknown>;
|
|
225
|
+
};
|
|
226
|
+
bodyValidator: (
|
|
227
|
+
operation: WhookOperation,
|
|
228
|
+
contentType: string,
|
|
229
|
+
value: unknown,
|
|
230
|
+
) => void;
|
|
231
|
+
operation: WhookOperation;
|
|
212
232
|
},
|
|
213
233
|
handler: WhookHandler,
|
|
214
234
|
req,
|
|
215
235
|
res,
|
|
216
236
|
) {
|
|
217
|
-
const debugging = (DEBUG_NODE_ENVS || []).includes(NODE_ENV);
|
|
218
237
|
const bufferLimit = bytes.parse(BUFFER_LIMIT);
|
|
219
238
|
|
|
220
239
|
log?.(
|
|
@@ -246,7 +265,6 @@ async function handleForAWSHTTPFunction(
|
|
|
246
265
|
);
|
|
247
266
|
|
|
248
267
|
try {
|
|
249
|
-
const operation = OPERATION;
|
|
250
268
|
const bodySpec = extractBodySpec(
|
|
251
269
|
request,
|
|
252
270
|
consumableMediaTypes,
|
|
@@ -278,7 +296,7 @@ async function handleForAWSHTTPFunction(
|
|
|
278
296
|
);
|
|
279
297
|
|
|
280
298
|
const pathParameters = (
|
|
281
|
-
|
|
299
|
+
operation.path
|
|
282
300
|
.split(PATH_SEPARATOR)
|
|
283
301
|
.filter(identity)
|
|
284
302
|
.map((part, index) => {
|
|
@@ -302,7 +320,7 @@ async function handleForAWSHTTPFunction(
|
|
|
302
320
|
);
|
|
303
321
|
|
|
304
322
|
// TODO: Update strictQS to handle OpenAPI 3
|
|
305
|
-
const retroCompatibleQueryParameters = (
|
|
323
|
+
const retroCompatibleQueryParameters = (operation.parameters || [])
|
|
306
324
|
.filter((p) => p.in === 'query')
|
|
307
325
|
.map((p) => ({ ...p, ...p.schema }));
|
|
308
326
|
|
|
@@ -371,31 +389,23 @@ async function handleForAWSHTTPFunction(
|
|
|
371
389
|
};
|
|
372
390
|
log?.('debug', JSON.stringify(responseLog));
|
|
373
391
|
} catch (err) {
|
|
374
|
-
|
|
375
|
-
|
|
392
|
+
response = await errorHandler('none', responseSpec, err as Error);
|
|
376
393
|
responseLog = {
|
|
377
394
|
type: 'error',
|
|
378
|
-
code:
|
|
379
|
-
statusCode:
|
|
380
|
-
params:
|
|
381
|
-
stack: printStackTrace(
|
|
395
|
+
code: (err as YError)?.code || 'E_UNEXPECTED',
|
|
396
|
+
statusCode: response.status,
|
|
397
|
+
params: (err as YError)?.params || [],
|
|
398
|
+
stack: printStackTrace(err as Error),
|
|
382
399
|
};
|
|
383
400
|
|
|
384
401
|
log?.('error', JSON.stringify(responseLog));
|
|
402
|
+
|
|
385
403
|
response = {
|
|
386
|
-
|
|
404
|
+
...response,
|
|
387
405
|
headers: {
|
|
388
|
-
...
|
|
389
|
-
...(castedError.headers ?? {}),
|
|
406
|
+
...response.headers,
|
|
390
407
|
'content-type': 'application/json',
|
|
391
408
|
},
|
|
392
|
-
body: {
|
|
393
|
-
error: {
|
|
394
|
-
code: castedError.code,
|
|
395
|
-
stack: debugging ? responseLog.stack : undefined,
|
|
396
|
-
params: debugging ? responseLog.params : undefined,
|
|
397
|
-
},
|
|
398
|
-
},
|
|
399
409
|
};
|
|
400
410
|
}
|
|
401
411
|
|
|
@@ -468,3 +478,5 @@ function obfuscateEventBody(obfuscator, rawBody) {
|
|
|
468
478
|
}
|
|
469
479
|
return rawBody;
|
|
470
480
|
}
|
|
481
|
+
|
|
482
|
+
export default autoService(initWrapHandlerForGoogleHTTPFunction);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.test.js","sourceRoot":"","sources":["../../src/services/log.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,cAAc,MAAM,UAAU,CAAC;AAEtC,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,EAAE,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;QAC3B,MAAM,cAAc,CAAC,EAAE,CAAC,CAAC;IAC3B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_PARSERS, DEFAULT_STRINGIFYERS, DEFAULT_DECODERS, DEFAULT_ENCODERS } from '@whook/http-router';
|
|
2
|
-
import type { WhookQueryStringParser } from '@whook/http-router';
|
|
3
|
-
import type { ServiceInitializer, Dependencies, Service } from 'knifecycle';
|
|
4
|
-
import type { WhookHandler, ObfuscatorService, WhookOperation, WhookWrapper } from '@whook/whook';
|
|
5
|
-
import type { TimeService, LogService } from 'common-services';
|
|
6
|
-
type HTTPWrapperDependencies = {
|
|
7
|
-
NODE_ENV: string;
|
|
8
|
-
DEBUG_NODE_ENVS?: string[];
|
|
9
|
-
OPERATION: WhookOperation;
|
|
10
|
-
DECODERS?: typeof DEFAULT_DECODERS;
|
|
11
|
-
ENCODERS?: typeof DEFAULT_ENCODERS;
|
|
12
|
-
PARSERS?: typeof DEFAULT_PARSERS;
|
|
13
|
-
STRINGIFYERS?: typeof DEFAULT_STRINGIFYERS;
|
|
14
|
-
QUERY_PARSER: WhookQueryStringParser;
|
|
15
|
-
BUFFER_LIMIT?: string;
|
|
16
|
-
obfuscator: ObfuscatorService;
|
|
17
|
-
time?: TimeService;
|
|
18
|
-
log?: LogService;
|
|
19
|
-
WRAPPERS: WhookWrapper<Dependencies, Service>[];
|
|
20
|
-
};
|
|
21
|
-
export default function wrapHandlerForAWSHTTPFunction<D extends Dependencies, S extends WhookHandler>(initHandler: ServiceInitializer<D, S>): ServiceInitializer<D & HTTPWrapperDependencies, S>;
|
|
22
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"googleHTTPFunction.js","sourceRoot":"","sources":["../../src/wrappers/googleHTTPFunction.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AACzC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,eAAe,EACf,oBAAoB,EACpB,gBAAgB,EAChB,gBAAgB,EAChB,kCAAkC,EAClC,cAAc,GACf,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC3D,OAAO,GAAG,MAAM,KAAK,CAAC;AACtB,OAAO,aAAa,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,cAAc,EACd,4BAA4B,EAC5B,2BAA2B,EAC3B,OAAO,EACP,QAAQ,GACT,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAgC5B,MAAM,gBAAgB,GAAG,GAAG,CAAC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