@whook/gcp-functions 18.0.3 → 19.0.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/README.md +19 -57
- package/dist/commands/testGCPFunctionRoute.d.ts +50 -0
- package/dist/commands/{testHTTPFunction.js → testGCPFunctionRoute.js} +44 -46
- package/dist/commands/testGCPFunctionRoute.js.map +1 -0
- package/dist/index.d.ts +8 -7
- package/dist/index.js +50 -54
- package/dist/index.js.map +1 -1
- package/dist/libs/utils.d.ts +1 -1
- package/dist/libs/utils.js +1 -1
- package/dist/libs/utils.js.map +1 -1
- package/dist/services/_autoload.d.ts +16 -12
- package/dist/services/_autoload.js +49 -63
- package/dist/services/_autoload.js.map +1 -1
- package/dist/wrappers/wrapRouteHandlerForGoogleHTTPFunction.d.ts +19 -0
- package/dist/wrappers/wrapRouteHandlerForGoogleHTTPFunction.js +307 -0
- package/dist/wrappers/wrapRouteHandlerForGoogleHTTPFunction.js.map +1 -0
- package/package.json +11 -10
- package/src/commands/{testHTTPFunction.ts → testGCPFunctionRoute.ts} +73 -75
- package/src/index.ts +100 -104
- package/src/libs/utils.ts +2 -2
- package/src/services/_autoload.ts +90 -117
- package/src/types.d.ts +8 -0
- package/src/wrappers/wrapRouteHandlerForGoogleHTTPFunction.ts +571 -0
- package/dist/commands/testHTTPFunction.d.ts +0 -13
- package/dist/commands/testHTTPFunction.js.map +0 -1
- package/dist/services/HANDLER.d.ts +0 -11
- package/dist/services/HANDLER.js +0 -21
- package/dist/services/HANDLER.js.map +0 -1
- package/dist/services/log.d.ts +0 -5
- package/dist/services/log.js +0 -4
- package/dist/services/log.js.map +0 -1
- package/dist/wrappers/wrapHandlerForGoogleHTTPFunction.d.ts +0 -23
- package/dist/wrappers/wrapHandlerForGoogleHTTPFunction.js +0 -272
- package/dist/wrappers/wrapHandlerForGoogleHTTPFunction.js.map +0 -1
- package/src/services/HANDLER.ts +0 -43
- package/src/services/log.ts +0 -7
- package/src/wrappers/wrapHandlerForGoogleHTTPFunction.ts +0 -482
|
@@ -0,0 +1,571 @@
|
|
|
1
|
+
import { YError, printStackTrace } from 'yerror';
|
|
2
|
+
import stream, { type Readable } from 'node:stream';
|
|
3
|
+
import { autoService } from 'knifecycle';
|
|
4
|
+
import bytes from 'bytes';
|
|
5
|
+
import { YHTTPError } from 'yhttperror';
|
|
6
|
+
import {
|
|
7
|
+
DEFAULT_COERCION_OPTIONS,
|
|
8
|
+
DEFAULT_BUFFER_LIMIT,
|
|
9
|
+
DEFAULT_PARSERS,
|
|
10
|
+
DEFAULT_STRINGIFYERS,
|
|
11
|
+
DEFAULT_DECODERS,
|
|
12
|
+
DEFAULT_ENCODERS,
|
|
13
|
+
SEARCH_SEPARATOR,
|
|
14
|
+
PATH_SEPARATOR,
|
|
15
|
+
extractOperationSecurityParameters,
|
|
16
|
+
prepareBodyValidator,
|
|
17
|
+
extractBodySpec,
|
|
18
|
+
extractResponseSpec,
|
|
19
|
+
checkResponseCharset,
|
|
20
|
+
checkResponseMediaType,
|
|
21
|
+
executeHandler,
|
|
22
|
+
extractProduceableMediaTypes,
|
|
23
|
+
extractConsumableMediaTypes,
|
|
24
|
+
getBody,
|
|
25
|
+
sendBody,
|
|
26
|
+
noop,
|
|
27
|
+
identity,
|
|
28
|
+
lowerCaseHeaders,
|
|
29
|
+
resolveParameters,
|
|
30
|
+
createParametersValidators,
|
|
31
|
+
pickFirstHeaderValue,
|
|
32
|
+
type WhookRequest,
|
|
33
|
+
type WhookResponse,
|
|
34
|
+
type WhookRouteHandler,
|
|
35
|
+
type WhookObfuscatorService,
|
|
36
|
+
type WhookRouteHandlerWrapper,
|
|
37
|
+
type WhookErrorHandler,
|
|
38
|
+
type WhookOpenAPI,
|
|
39
|
+
type WhookCoercionOptions,
|
|
40
|
+
type WhookRouteDefinition,
|
|
41
|
+
type WhookRequestBody,
|
|
42
|
+
type WhookHTTPRouterDescriptor,
|
|
43
|
+
type WhookSchemaValidatorsService,
|
|
44
|
+
type WhookRouteHandlerParameters,
|
|
45
|
+
type WhookQueryParserBuilderService,
|
|
46
|
+
} from '@whook/whook';
|
|
47
|
+
import { type LogService } from 'common-services';
|
|
48
|
+
import {
|
|
49
|
+
ensureResolvedObject,
|
|
50
|
+
type OpenAPIReference,
|
|
51
|
+
type OpenAPIExtension,
|
|
52
|
+
type OpenAPIResponse,
|
|
53
|
+
} from 'ya-open-api-types';
|
|
54
|
+
import { type ExpressiveJSONSchema } from 'ya-json-schema-types';
|
|
55
|
+
|
|
56
|
+
export type WhookGCPFunctionRouteWrapperDependencies = {
|
|
57
|
+
MAIN_DEFINITION: WhookRouteDefinition;
|
|
58
|
+
MAIN_API: WhookOpenAPI;
|
|
59
|
+
DECODERS?: typeof DEFAULT_DECODERS;
|
|
60
|
+
ENCODERS?: typeof DEFAULT_ENCODERS;
|
|
61
|
+
PARSERS?: typeof DEFAULT_PARSERS;
|
|
62
|
+
STRINGIFYERS?: typeof DEFAULT_STRINGIFYERS;
|
|
63
|
+
queryParserBuilder: WhookQueryParserBuilderService;
|
|
64
|
+
BUFFER_LIMIT?: string;
|
|
65
|
+
COERCION_OPTIONS: WhookCoercionOptions;
|
|
66
|
+
obfuscator: WhookObfuscatorService;
|
|
67
|
+
errorHandler: WhookErrorHandler;
|
|
68
|
+
schemaValidators: WhookSchemaValidatorsService;
|
|
69
|
+
log?: LogService;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Wrap an handler to make it work with GCP Functions.
|
|
74
|
+
* @param {Object} services
|
|
75
|
+
* The services the wrapper depends on
|
|
76
|
+
* @param {Object} services.MAIN_DEFINITION
|
|
77
|
+
* An OpenAPI definitition for that handler
|
|
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.queryParserBuilder
|
|
89
|
+
* A query parser builder from OpenAPI parameters
|
|
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 initWrapRouteHandlerForGoogleHTTPFunction({
|
|
101
|
+
MAIN_DEFINITION,
|
|
102
|
+
MAIN_API,
|
|
103
|
+
DECODERS = DEFAULT_DECODERS,
|
|
104
|
+
ENCODERS = DEFAULT_ENCODERS,
|
|
105
|
+
PARSERS = DEFAULT_PARSERS,
|
|
106
|
+
STRINGIFYERS = DEFAULT_STRINGIFYERS,
|
|
107
|
+
BUFFER_LIMIT = DEFAULT_BUFFER_LIMIT,
|
|
108
|
+
queryParserBuilder,
|
|
109
|
+
COERCION_OPTIONS = DEFAULT_COERCION_OPTIONS,
|
|
110
|
+
obfuscator,
|
|
111
|
+
errorHandler,
|
|
112
|
+
schemaValidators,
|
|
113
|
+
log = noop,
|
|
114
|
+
}: WhookGCPFunctionRouteWrapperDependencies): Promise<WhookRouteHandlerWrapper> {
|
|
115
|
+
log('debug', '📥 - Initializing the GCP Function wrapper.');
|
|
116
|
+
|
|
117
|
+
const path = MAIN_DEFINITION.path;
|
|
118
|
+
const pathItem = MAIN_API.paths?.[path];
|
|
119
|
+
|
|
120
|
+
if (typeof pathItem === 'undefined' || '$ref' in pathItem) {
|
|
121
|
+
throw new YError('E_BAD_OPERATION', 'pathItem', pathItem);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
const method = MAIN_DEFINITION.method;
|
|
125
|
+
const operation = pathItem[method];
|
|
126
|
+
|
|
127
|
+
if (typeof operation === 'undefined' || '$ref' in operation) {
|
|
128
|
+
throw new YError('E_BAD_OPERATION', 'operation', operation);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const pathItemParameters = await resolveParameters(
|
|
132
|
+
{ API: MAIN_API, log },
|
|
133
|
+
pathItem.parameters || [],
|
|
134
|
+
);
|
|
135
|
+
const pathItemValidators = await createParametersValidators(
|
|
136
|
+
{
|
|
137
|
+
API: MAIN_API,
|
|
138
|
+
COERCION_OPTIONS,
|
|
139
|
+
schemaValidators,
|
|
140
|
+
},
|
|
141
|
+
pathItemParameters,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
const operationParameters = await resolveParameters(
|
|
145
|
+
{ API: MAIN_API, log },
|
|
146
|
+
operation.parameters || [],
|
|
147
|
+
);
|
|
148
|
+
const ammendedParameters = await resolveParameters(
|
|
149
|
+
{ API: MAIN_API, log },
|
|
150
|
+
await extractOperationSecurityParameters({ API: MAIN_API }, operation),
|
|
151
|
+
);
|
|
152
|
+
const operationValidators = await createParametersValidators(
|
|
153
|
+
{
|
|
154
|
+
API: MAIN_API,
|
|
155
|
+
COERCION_OPTIONS,
|
|
156
|
+
schemaValidators,
|
|
157
|
+
},
|
|
158
|
+
operationParameters.concat(ammendedParameters),
|
|
159
|
+
);
|
|
160
|
+
const bodyValidator = await prepareBodyValidator(
|
|
161
|
+
{ API: MAIN_API, schemaValidators },
|
|
162
|
+
operation,
|
|
163
|
+
);
|
|
164
|
+
const consumableCharsets = Object.keys(DECODERS);
|
|
165
|
+
const produceableCharsets = Object.keys(ENCODERS);
|
|
166
|
+
const consumableMediaTypes = await extractConsumableMediaTypes(
|
|
167
|
+
MAIN_API,
|
|
168
|
+
operation,
|
|
169
|
+
);
|
|
170
|
+
const produceableMediaTypes = await extractProduceableMediaTypes(
|
|
171
|
+
MAIN_API,
|
|
172
|
+
operation,
|
|
173
|
+
);
|
|
174
|
+
const parameters = pathItemParameters
|
|
175
|
+
.concat(ammendedParameters)
|
|
176
|
+
.filter((parameter) =>
|
|
177
|
+
operationParameters.every(
|
|
178
|
+
(aParameter) =>
|
|
179
|
+
aParameter.in !== parameter.in || aParameter.name !== parameter.name,
|
|
180
|
+
),
|
|
181
|
+
)
|
|
182
|
+
.concat(operationParameters);
|
|
183
|
+
const queryParser = await queryParserBuilder(parameters);
|
|
184
|
+
const wrapper = async (
|
|
185
|
+
handler: WhookRouteHandler,
|
|
186
|
+
): Promise<WhookRouteHandler> => {
|
|
187
|
+
const wrappedHandler = handleForAWSHTTPFunction.bind(
|
|
188
|
+
null,
|
|
189
|
+
{
|
|
190
|
+
MAIN_DEFINITION,
|
|
191
|
+
MAIN_API,
|
|
192
|
+
DECODERS,
|
|
193
|
+
ENCODERS,
|
|
194
|
+
PARSERS,
|
|
195
|
+
STRINGIFYERS,
|
|
196
|
+
BUFFER_LIMIT,
|
|
197
|
+
obfuscator,
|
|
198
|
+
errorHandler,
|
|
199
|
+
log,
|
|
200
|
+
},
|
|
201
|
+
{
|
|
202
|
+
consumableCharsets,
|
|
203
|
+
produceableCharsets,
|
|
204
|
+
handler,
|
|
205
|
+
operation,
|
|
206
|
+
queryParser,
|
|
207
|
+
parametersValidators: {
|
|
208
|
+
path: {
|
|
209
|
+
...pathItemValidators.path,
|
|
210
|
+
...operationValidators.path,
|
|
211
|
+
},
|
|
212
|
+
query: {
|
|
213
|
+
...pathItemValidators.query,
|
|
214
|
+
...operationValidators.query,
|
|
215
|
+
},
|
|
216
|
+
header: {
|
|
217
|
+
...pathItemValidators.header,
|
|
218
|
+
...operationValidators.header,
|
|
219
|
+
},
|
|
220
|
+
cookie: {
|
|
221
|
+
...pathItemValidators.cookie,
|
|
222
|
+
...operationValidators.cookie,
|
|
223
|
+
},
|
|
224
|
+
},
|
|
225
|
+
consumableMediaTypes,
|
|
226
|
+
produceableMediaTypes,
|
|
227
|
+
bodyValidator,
|
|
228
|
+
},
|
|
229
|
+
MAIN_DEFINITION,
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
return wrappedHandler as unknown as WhookRouteHandler;
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
return wrapper;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
async function handleForAWSHTTPFunction(
|
|
239
|
+
{
|
|
240
|
+
MAIN_API,
|
|
241
|
+
DECODERS,
|
|
242
|
+
ENCODERS,
|
|
243
|
+
PARSERS,
|
|
244
|
+
STRINGIFYERS,
|
|
245
|
+
BUFFER_LIMIT,
|
|
246
|
+
obfuscator,
|
|
247
|
+
errorHandler,
|
|
248
|
+
log,
|
|
249
|
+
}: Omit<
|
|
250
|
+
Required<WhookGCPFunctionRouteWrapperDependencies>,
|
|
251
|
+
'COERCION_OPTIONS' | 'schemaValidators' | 'queryParserBuilder'
|
|
252
|
+
>,
|
|
253
|
+
{
|
|
254
|
+
handler,
|
|
255
|
+
operation,
|
|
256
|
+
parametersValidators,
|
|
257
|
+
consumableMediaTypes,
|
|
258
|
+
produceableMediaTypes,
|
|
259
|
+
consumableCharsets,
|
|
260
|
+
produceableCharsets,
|
|
261
|
+
queryParser,
|
|
262
|
+
bodyValidator,
|
|
263
|
+
}: WhookHTTPRouterDescriptor & {
|
|
264
|
+
consumableCharsets: string[];
|
|
265
|
+
produceableCharsets: string[];
|
|
266
|
+
},
|
|
267
|
+
definition: WhookRouteDefinition,
|
|
268
|
+
req,
|
|
269
|
+
res,
|
|
270
|
+
) {
|
|
271
|
+
const bufferLimit =
|
|
272
|
+
bytes.parse(BUFFER_LIMIT) || (bytes.parse(DEFAULT_BUFFER_LIMIT) as number);
|
|
273
|
+
|
|
274
|
+
log?.(
|
|
275
|
+
'info',
|
|
276
|
+
'GCP_FUNCTIONS_REQUEST',
|
|
277
|
+
JSON.stringify({
|
|
278
|
+
url: req.originalUrl,
|
|
279
|
+
method: req.method,
|
|
280
|
+
body: req.body,
|
|
281
|
+
// body: obfuscateEventBody(obfuscator, req.body),
|
|
282
|
+
headers: obfuscator.obfuscateSensibleHeaders(req.headers || {}),
|
|
283
|
+
}),
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const request = await gcpfReqToRequest(req);
|
|
287
|
+
let response;
|
|
288
|
+
let responseLog;
|
|
289
|
+
let responseSpec;
|
|
290
|
+
|
|
291
|
+
log?.(
|
|
292
|
+
'debug',
|
|
293
|
+
'REQUEST',
|
|
294
|
+
JSON.stringify({
|
|
295
|
+
...request,
|
|
296
|
+
body: request.body ? 'Stream' : undefined,
|
|
297
|
+
headers: obfuscator.obfuscateSensibleHeaders(request.headers),
|
|
298
|
+
}),
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
const parametersValues: WhookRouteHandlerParameters = {
|
|
302
|
+
query: {},
|
|
303
|
+
header: {},
|
|
304
|
+
path: {},
|
|
305
|
+
cookie: {},
|
|
306
|
+
body: undefined as unknown as WhookRequestBody,
|
|
307
|
+
options: {},
|
|
308
|
+
};
|
|
309
|
+
|
|
310
|
+
try {
|
|
311
|
+
try {
|
|
312
|
+
const path = request.url.split(SEARCH_SEPARATOR)[0];
|
|
313
|
+
const parts = path.split(PATH_SEPARATOR).filter(identity);
|
|
314
|
+
const search = request.url.substr(
|
|
315
|
+
request.url.split(SEARCH_SEPARATOR)[0].length,
|
|
316
|
+
);
|
|
317
|
+
const queryValues = queryParser(search);
|
|
318
|
+
const pathParameters = (
|
|
319
|
+
definition.path
|
|
320
|
+
.split(PATH_SEPARATOR)
|
|
321
|
+
.filter(identity)
|
|
322
|
+
.map((part, index) => {
|
|
323
|
+
const matches = /^\{([\d\w]+)\}$/i.exec(part);
|
|
324
|
+
|
|
325
|
+
if (matches) {
|
|
326
|
+
return {
|
|
327
|
+
name: matches[1],
|
|
328
|
+
value: parts[index],
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
}) as Array<{ name: string; value: string }>
|
|
332
|
+
)
|
|
333
|
+
.filter(identity)
|
|
334
|
+
.reduce(
|
|
335
|
+
(accParameters, { name, value }) => ({
|
|
336
|
+
...accParameters,
|
|
337
|
+
[name]: value,
|
|
338
|
+
}),
|
|
339
|
+
{},
|
|
340
|
+
);
|
|
341
|
+
|
|
342
|
+
for (const location of Object.keys(parametersValidators)) {
|
|
343
|
+
if (location === 'query') {
|
|
344
|
+
for (const [name, validator] of Object.entries(
|
|
345
|
+
parametersValidators.query,
|
|
346
|
+
)) {
|
|
347
|
+
parametersValues.query[name] = validator(
|
|
348
|
+
queryValues && typeof queryValues[name] !== 'undefined'
|
|
349
|
+
? queryValues[name]?.toString()
|
|
350
|
+
: undefined,
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
} else if (location === 'header') {
|
|
354
|
+
for (const [name, validator] of Object.entries(
|
|
355
|
+
parametersValidators.header,
|
|
356
|
+
)) {
|
|
357
|
+
// header names are case insensitive
|
|
358
|
+
const canonicalName = name.toLowerCase();
|
|
359
|
+
|
|
360
|
+
parametersValues.header[name] = validator(
|
|
361
|
+
typeof request.headers[canonicalName] !== 'undefined'
|
|
362
|
+
? request.headers[canonicalName].toString()
|
|
363
|
+
: undefined,
|
|
364
|
+
);
|
|
365
|
+
}
|
|
366
|
+
} else if (location === 'path') {
|
|
367
|
+
for (const [name, validator] of Object.entries(
|
|
368
|
+
parametersValidators.path,
|
|
369
|
+
)) {
|
|
370
|
+
parametersValues.path[name] = validator(
|
|
371
|
+
pathParameters && typeof pathParameters[name] !== 'undefined'
|
|
372
|
+
? pathParameters[name].toString()
|
|
373
|
+
: undefined,
|
|
374
|
+
);
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
const bodySpec = extractBodySpec(
|
|
380
|
+
request,
|
|
381
|
+
consumableMediaTypes || [],
|
|
382
|
+
consumableCharsets,
|
|
383
|
+
);
|
|
384
|
+
|
|
385
|
+
responseSpec = extractResponseSpec(
|
|
386
|
+
operation,
|
|
387
|
+
request,
|
|
388
|
+
produceableMediaTypes || [],
|
|
389
|
+
produceableCharsets,
|
|
390
|
+
);
|
|
391
|
+
|
|
392
|
+
const body = await getBody(
|
|
393
|
+
{
|
|
394
|
+
API: MAIN_API,
|
|
395
|
+
DECODERS,
|
|
396
|
+
PARSERS,
|
|
397
|
+
bufferLimit,
|
|
398
|
+
},
|
|
399
|
+
operation,
|
|
400
|
+
request.body as Readable,
|
|
401
|
+
bodySpec,
|
|
402
|
+
);
|
|
403
|
+
|
|
404
|
+
bodyValidator(operation, bodySpec.contentType, body);
|
|
405
|
+
|
|
406
|
+
if (typeof body !== 'undefined') {
|
|
407
|
+
parametersValues.body = body;
|
|
408
|
+
}
|
|
409
|
+
} catch (err) {
|
|
410
|
+
throw YHTTPError.cast(err as Error, 400);
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
response = await executeHandler(definition, handler, parametersValues);
|
|
414
|
+
|
|
415
|
+
response.headers = response.headers || {};
|
|
416
|
+
|
|
417
|
+
if (response.body) {
|
|
418
|
+
response.headers['content-type'] =
|
|
419
|
+
response.headers['content-type'] || responseSpec.contentTypes[0];
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
const responseContentType =
|
|
423
|
+
pickFirstHeaderValue('content-type', response.headers || {}) ||
|
|
424
|
+
'text/plain';
|
|
425
|
+
|
|
426
|
+
const responseObject =
|
|
427
|
+
operation.responses && operation.responses[response.status]
|
|
428
|
+
? await ensureResolvedObject(
|
|
429
|
+
MAIN_API,
|
|
430
|
+
operation.responses[response.status] as
|
|
431
|
+
| OpenAPIResponse<ExpressiveJSONSchema, OpenAPIExtension>
|
|
432
|
+
| OpenAPIReference<
|
|
433
|
+
OpenAPIResponse<ExpressiveJSONSchema, OpenAPIExtension>
|
|
434
|
+
>,
|
|
435
|
+
)
|
|
436
|
+
: undefined;
|
|
437
|
+
const responseSchema =
|
|
438
|
+
responseObject &&
|
|
439
|
+
responseObject.content &&
|
|
440
|
+
responseObject.content?.[responseContentType] &&
|
|
441
|
+
'schema' in responseObject.content[responseContentType] &&
|
|
442
|
+
((await ensureResolvedObject(
|
|
443
|
+
MAIN_API,
|
|
444
|
+
responseObject.content?.[responseContentType].schema,
|
|
445
|
+
)) as ExpressiveJSONSchema);
|
|
446
|
+
|
|
447
|
+
// Check the stringifyer only when a schema is
|
|
448
|
+
// specified and it is not a binary one
|
|
449
|
+
const responseHasSchema =
|
|
450
|
+
typeof responseSchema === 'boolean' ||
|
|
451
|
+
(typeof responseSchema === 'object' &&
|
|
452
|
+
responseSchema &&
|
|
453
|
+
!(
|
|
454
|
+
'type' in responseSchema &&
|
|
455
|
+
responseSchema.type === 'string' &&
|
|
456
|
+
responseSchema.format === 'binary'
|
|
457
|
+
));
|
|
458
|
+
|
|
459
|
+
if (responseHasSchema && !STRINGIFYERS[responseContentType]) {
|
|
460
|
+
throw new YHTTPError(
|
|
461
|
+
500,
|
|
462
|
+
'E_STRINGIFYER_LACK',
|
|
463
|
+
response.headers['content-type'],
|
|
464
|
+
response,
|
|
465
|
+
);
|
|
466
|
+
}
|
|
467
|
+
if (response.body) {
|
|
468
|
+
checkResponseMediaType(
|
|
469
|
+
request,
|
|
470
|
+
responseSpec,
|
|
471
|
+
produceableMediaTypes || [],
|
|
472
|
+
);
|
|
473
|
+
checkResponseCharset(request, responseSpec, produceableCharsets);
|
|
474
|
+
}
|
|
475
|
+
responseLog = {
|
|
476
|
+
type: 'success',
|
|
477
|
+
status: response.status,
|
|
478
|
+
};
|
|
479
|
+
log?.('debug', JSON.stringify(responseLog));
|
|
480
|
+
} catch (err) {
|
|
481
|
+
response = await errorHandler('none', responseSpec, err as Error);
|
|
482
|
+
responseLog = {
|
|
483
|
+
type: 'error',
|
|
484
|
+
code: (err as YError)?.code || 'E_UNEXPECTED',
|
|
485
|
+
statusCode: response.status,
|
|
486
|
+
params: (err as YError)?.params || [],
|
|
487
|
+
stack: printStackTrace(err as Error),
|
|
488
|
+
};
|
|
489
|
+
|
|
490
|
+
log?.('error', JSON.stringify(responseLog));
|
|
491
|
+
|
|
492
|
+
response = {
|
|
493
|
+
...response,
|
|
494
|
+
headers: {
|
|
495
|
+
...response.headers,
|
|
496
|
+
'content-type': 'application/json',
|
|
497
|
+
},
|
|
498
|
+
};
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
log?.(
|
|
502
|
+
'debug',
|
|
503
|
+
'RESPONSE',
|
|
504
|
+
JSON.stringify({
|
|
505
|
+
...response,
|
|
506
|
+
body: obfuscateEventBody(obfuscator, response.body),
|
|
507
|
+
headers: obfuscator.obfuscateSensibleHeaders(response.headers),
|
|
508
|
+
}),
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
await pipeResponseInGCPFResponse(
|
|
512
|
+
await sendBody(
|
|
513
|
+
{
|
|
514
|
+
ENCODERS,
|
|
515
|
+
STRINGIFYERS,
|
|
516
|
+
},
|
|
517
|
+
response,
|
|
518
|
+
),
|
|
519
|
+
res,
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
async function gcpfReqToRequest(req): Promise<WhookRequest> {
|
|
524
|
+
const request: WhookRequest = {
|
|
525
|
+
method: req.method.toLowerCase(),
|
|
526
|
+
headers: lowerCaseHeaders(req.headers || {}),
|
|
527
|
+
url: req.originalUrl,
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
if (req.rawBody) {
|
|
531
|
+
request.headers['content-length'] = req.rawBody.length.toString();
|
|
532
|
+
const bodyStream = new stream.PassThrough();
|
|
533
|
+
|
|
534
|
+
request.body = bodyStream;
|
|
535
|
+
bodyStream.write(req.rawBody);
|
|
536
|
+
bodyStream.end();
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
return request;
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
async function pipeResponseInGCPFResponse(
|
|
543
|
+
response: WhookResponse,
|
|
544
|
+
res,
|
|
545
|
+
): Promise<void> {
|
|
546
|
+
Object.keys(response.headers || {}).forEach((headerName) => {
|
|
547
|
+
res.set(headerName, response.headers?.[headerName]);
|
|
548
|
+
});
|
|
549
|
+
res.status(response.status);
|
|
550
|
+
|
|
551
|
+
if (response.body) {
|
|
552
|
+
(response.body as Readable).pipe(res);
|
|
553
|
+
return;
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
res.end();
|
|
557
|
+
}
|
|
558
|
+
|
|
559
|
+
function obfuscateEventBody(obfuscator, rawBody) {
|
|
560
|
+
if (typeof rawBody === 'string') {
|
|
561
|
+
try {
|
|
562
|
+
const jsonBody = JSON.parse(rawBody);
|
|
563
|
+
|
|
564
|
+
return JSON.stringify(obfuscator.obfuscateSensibleProps(jsonBody));
|
|
565
|
+
// eslint-disable-next-line
|
|
566
|
+
} catch (err) {}
|
|
567
|
+
}
|
|
568
|
+
return rawBody;
|
|
569
|
+
}
|
|
570
|
+
|
|
571
|
+
export default autoService(initWrapRouteHandlerForGoogleHTTPFunction);
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { WhookCommandArgs, WhookCommandDefinition, WhookCompilerOptions } from '@whook/whook';
|
|
2
|
-
import type { LogService } from 'common-services';
|
|
3
|
-
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
4
|
-
export declare const definition: WhookCommandDefinition;
|
|
5
|
-
declare const _default: import("knifecycle").ServiceInitializer<{
|
|
6
|
-
APP_ENV: string;
|
|
7
|
-
PROJECT_DIR: string;
|
|
8
|
-
COMPILER_OPTIONS?: WhookCompilerOptions;
|
|
9
|
-
API: OpenAPIV3_1.Document;
|
|
10
|
-
log: LogService;
|
|
11
|
-
args: WhookCommandArgs;
|
|
12
|
-
}, () => Promise<void>>;
|
|
13
|
-
export default _default;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"testHTTPFunction.js","sourceRoot":"","sources":["../../src/commands/testHTTPFunction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,EAAE,MAAM,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AAY,CAAC;gBACjB,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;oBACpC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACpB,CAAC;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QACH,GAAG,CAAC,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACpC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { type WhookWrapper } from '@whook/whook';
|
|
2
|
-
import { type WhookHandler } from '@whook/http-transaction';
|
|
3
|
-
import { type LogService } from 'common-services';
|
|
4
|
-
export type WhookHandlerDependencies<T extends WhookHandler> = {
|
|
5
|
-
WRAPPERS: WhookWrapper<T>[];
|
|
6
|
-
mainWrapper: WhookWrapper<T>;
|
|
7
|
-
baseHandler: T;
|
|
8
|
-
log?: LogService;
|
|
9
|
-
};
|
|
10
|
-
declare const _default: import("knifecycle").ServiceInitializer<WhookHandlerDependencies<WhookHandler<import("knifecycle").Parameters, import("@whook/http-transaction").WhookResponse<number, void | import("@whook/http-transaction").WhookHeaders, void | import("stream").Readable | import("type-fest").JsonValue>, import("@whook/http-transaction").WhookOperation<Record<string, unknown>>>>, WhookHandler<WhookHandler<import("knifecycle").Parameters, import("@whook/http-transaction").WhookResponse<number, void | import("@whook/http-transaction").WhookHeaders, void | import("stream").Readable | import("type-fest").JsonValue>, import("@whook/http-transaction").WhookOperation<Record<string, unknown>>>, import("@whook/http-transaction").WhookResponse<number, void | import("@whook/http-transaction").WhookHeaders, void | import("stream").Readable | import("type-fest").JsonValue>, import("@whook/http-transaction").WhookOperation<Record<string, unknown>>>>;
|
|
11
|
-
export default _default;
|
package/dist/services/HANDLER.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { autoService, name, location } from 'knifecycle';
|
|
2
|
-
import { noop, applyWrappers } from '@whook/whook';
|
|
3
|
-
export default location(name('HANDLER', autoService(initHandler)), import.meta.url);
|
|
4
|
-
/**
|
|
5
|
-
* Initialize one Whook handler
|
|
6
|
-
* @param {Object} services
|
|
7
|
-
* The services `$autoload` depends on
|
|
8
|
-
* @param {Array} services.WRAPPERS
|
|
9
|
-
* An optional list of wrappers to inject
|
|
10
|
-
* @param {Object} [services.log=noop]
|
|
11
|
-
* An optional logging service
|
|
12
|
-
* @param {Object} services.HANDLERS
|
|
13
|
-
* The rest is a hash of handlers mapped by their operation id
|
|
14
|
-
* @return {Promise<Function>}
|
|
15
|
-
* A promise of the `HANDLERS` hash.
|
|
16
|
-
*/
|
|
17
|
-
async function initHandler({ WRAPPERS, mainWrapper, baseHandler, log = noop, }) {
|
|
18
|
-
log('warning', `🏭 - Initializing the HANDLER service with wrapped by ${WRAPPERS.length} wrappers.`);
|
|
19
|
-
return await applyWrappers([...WRAPPERS, mainWrapper], baseHandler);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=HANDLER.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"HANDLER.js","sourceRoot":"","sources":["../../src/services/HANDLER.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,aAAa,EAAqB,MAAM,cAAc,CAAC;AAWtE,eAAe,QAAQ,CACrB,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,WAAW,CAAC,CAAC,EACzC,MAAM,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,KAAK,UAAU,WAAW,CAAyB,EACjD,QAAQ,EACR,WAAW,EACX,WAAW,EACX,GAAG,GAAG,IAAI,GACkB;IAC5B,GAAG,CACD,SAAS,EACT,yDAAyD,QAAQ,CAAC,MAAM,YAAY,CACrF,CAAC;IAEF,OAAO,MAAM,aAAa,CAAI,CAAC,GAAG,QAAQ,EAAE,WAAW,CAAC,EAAE,WAAW,CAAC,CAAC;AACzE,CAAC"}
|
package/dist/services/log.d.ts
DELETED
package/dist/services/log.js
DELETED
package/dist/services/log.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"log.js","sourceRoot":"","sources":["../../src/services/log.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,eAAe,QAAQ,CACrB,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAC/B,MAAM,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_PARSERS, DEFAULT_STRINGIFYERS, DEFAULT_DECODERS, DEFAULT_ENCODERS } from '@whook/http-router';
|
|
2
|
-
import stream from 'stream';
|
|
3
|
-
import type { WhookQueryStringParser } from '@whook/http-router';
|
|
4
|
-
import type { WhookResponse, WhookHandler, WhookObfuscatorService, WhookOperation, WhookWrapper, WhookErrorHandler } from '@whook/whook';
|
|
5
|
-
import type { LogService } from 'common-services';
|
|
6
|
-
import type { OpenAPIV3_1 } from 'openapi-types';
|
|
7
|
-
import type { AppEnvVars } from 'application-services';
|
|
8
|
-
export type WhookWrapHTTPFunctionDependencies = {
|
|
9
|
-
OPERATION_API: OpenAPIV3_1.Document;
|
|
10
|
-
ENV: AppEnvVars;
|
|
11
|
-
DEBUG_NODE_ENVS?: string[];
|
|
12
|
-
DECODERS?: typeof DEFAULT_DECODERS;
|
|
13
|
-
ENCODERS?: typeof DEFAULT_ENCODERS;
|
|
14
|
-
PARSERS?: typeof DEFAULT_PARSERS;
|
|
15
|
-
STRINGIFYERS?: typeof DEFAULT_STRINGIFYERS;
|
|
16
|
-
QUERY_PARSER: WhookQueryStringParser;
|
|
17
|
-
BUFFER_LIMIT?: string;
|
|
18
|
-
obfuscator: WhookObfuscatorService;
|
|
19
|
-
errorHandler: WhookErrorHandler;
|
|
20
|
-
log?: LogService;
|
|
21
|
-
};
|
|
22
|
-
declare const _default: import("knifecycle").ServiceInitializer<WhookWrapHTTPFunctionDependencies, WhookWrapper<WhookHandler<import("knifecycle").Parameters, WhookResponse<number, void | import("@whook/http-transaction").WhookHeaders, void | stream.Readable | import("type-fest").JsonValue>, WhookOperation<Record<string, unknown>>>>>;
|
|
23
|
-
export default _default;
|