@whook/gcp-functions 9.0.0 → 10.0.1

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.
Files changed (39) hide show
  1. package/README.md +14 -11
  2. package/dist/commands/testHTTPFunction.d.ts +1 -1
  3. package/dist/commands/testHTTPFunction.js +119 -150
  4. package/dist/commands/testHTTPFunction.js.map +1 -1
  5. package/dist/index.d.ts +2 -4
  6. package/dist/index.js +182 -269
  7. package/dist/index.js.map +1 -1
  8. package/dist/libs/utils.js +16 -35
  9. package/dist/libs/utils.js.map +1 -1
  10. package/dist/services/_autoload.d.ts +3 -3
  11. package/dist/services/_autoload.js +83 -109
  12. package/dist/services/_autoload.js.map +1 -1
  13. package/dist/services/log.js +2 -12
  14. package/dist/services/log.js.map +1 -1
  15. package/dist/services/log.test.js +4 -9
  16. package/dist/services/log.test.js.map +1 -1
  17. package/dist/wrappers/googleHTTPFunction.js +246 -294
  18. package/dist/wrappers/googleHTTPFunction.js.map +1 -1
  19. package/package.json +49 -90
  20. package/src/commands/testHTTPFunction.ts +6 -13
  21. package/src/index.ts +28 -48
  22. package/src/libs/utils.ts +3 -4
  23. package/src/services/_autoload.ts +4 -3
  24. package/src/services/log.test.ts +1 -1
  25. package/src/wrappers/googleHTTPFunction.ts +6 -6
  26. package/dist/commands/testHTTPFunction.mjs +0 -136
  27. package/dist/commands/testHTTPFunction.mjs.map +0 -1
  28. package/dist/index.mjs +0 -265
  29. package/dist/index.mjs.map +0 -1
  30. package/dist/libs/utils.mjs +0 -27
  31. package/dist/libs/utils.mjs.map +0 -1
  32. package/dist/services/_autoload.mjs +0 -113
  33. package/dist/services/_autoload.mjs.map +0 -1
  34. package/dist/services/log.mjs +0 -4
  35. package/dist/services/log.mjs.map +0 -1
  36. package/dist/services/log.test.mjs +0 -7
  37. package/dist/services/log.test.mjs.map +0 -1
  38. package/dist/wrappers/googleHTTPFunction.mjs +0 -290
  39. package/dist/wrappers/googleHTTPFunction.mjs.map +0 -1
package/package.json CHANGED
@@ -1,19 +1,17 @@
1
1
  {
2
2
  "name": "@whook/gcp-functions",
3
- "version": "9.0.0",
3
+ "version": "10.0.1",
4
4
  "description": "Build and deploy to GCP Cloud Functions with Whook.",
5
- "main": "dist/index",
6
- "module": "dist/index.mjs",
5
+ "main": "dist/index.js",
7
6
  "types": "dist/index.d.ts",
8
7
  "metapak": {
9
8
  "configs": [
10
9
  "main",
11
10
  "readme",
11
+ "tsesm",
12
12
  "eslint",
13
- "babel",
14
13
  "jest",
15
- "jsdocs",
16
- "typescript"
14
+ "jsdocs"
17
15
  ],
18
16
  "data": {
19
17
  "childPackage": true,
@@ -50,50 +48,42 @@
50
48
  },
51
49
  "homepage": "https://github.com/nfroidure/whook",
52
50
  "dependencies": {
53
- "@whook/cli": "^9.0.0",
54
- "@whook/cors": "^9.0.0",
55
- "@whook/http-router": "^9.0.0",
56
- "@whook/whook": "^9.0.0",
51
+ "@whook/cli": "^10.0.1",
52
+ "@whook/cors": "^10.0.1",
53
+ "@whook/http-router": "^10.0.1",
54
+ "@whook/whook": "^10.0.1",
57
55
  "ajv": "^8.11.0",
58
56
  "ajv-formats": "^2.1.1",
59
- "camelcase": "^6.3.0",
60
- "common-services": "^10.0.2",
57
+ "camelcase": "^7.0.0",
58
+ "common-services": "^11.0.1",
61
59
  "cpr": "3.0.1",
62
- "knifecycle": "^12.0.4",
60
+ "knifecycle": "^14.0.0",
63
61
  "mkdirp": "^1.0.4",
64
- "openapi-types": "^11.0.1",
62
+ "openapi-types": "^12.0.0",
65
63
  "qs": "^6.10.3",
66
- "strict-qs": "^6.1.5",
67
- "yerror": "^6.0.2"
64
+ "strict-qs": "^7.0.0",
65
+ "yerror": "^6.1.1"
68
66
  },
69
67
  "devDependencies": {
70
- "@babel/cli": "^7.17.10",
71
- "@babel/core": "^7.18.2",
72
- "@babel/eslint-parser": "^7.18.2",
73
- "@babel/plugin-proposal-class-properties": "^7.17.12",
74
- "@babel/plugin-proposal-object-rest-spread": "^7.18.0",
75
- "@babel/plugin-syntax-dynamic-import": "^7.8.3",
76
- "@babel/plugin-syntax-import-meta": "^7.10.4",
77
- "@babel/preset-env": "^7.18.2",
78
- "@babel/preset-typescript": "^7.17.12",
79
- "@babel/register": "^7.17.7",
80
- "@types/jest": "^27.0.2",
81
- "@typescript-eslint/eslint-plugin": "^5.26.0",
82
- "@typescript-eslint/parser": "^5.26.0",
83
- "babel-plugin-knifecycle": "^5.0.3",
84
- "eslint": "^8.16.0",
68
+ "@types/jest": "^28.1.1",
69
+ "@typescript-eslint/eslint-plugin": "^5.27.0",
70
+ "@typescript-eslint/parser": "^5.27.0",
71
+ "esbuild": "^0.14.46",
72
+ "esbuild-jest": "^0.5.0",
73
+ "eslint": "^8.17.0",
74
+ "eslint-config-prettier": "^8.5.0",
85
75
  "eslint-plugin-prettier": "^4.0.0",
86
76
  "jest": "^28.1.0",
87
77
  "jsdoc-to-markdown": "^7.1.1",
88
- "metapak": "^4.0.3",
89
- "metapak-nfroidure": "11.2.1",
78
+ "metapak": "^4.0.4",
79
+ "metapak-nfroidure": "12.1.0",
90
80
  "prettier": "^2.6.2",
91
81
  "rimraf": "^3.0.2",
92
- "typescript": "^4.7.2"
82
+ "typescript": "^4.7.3"
93
83
  },
94
84
  "contributors": [],
95
85
  "engines": {
96
- "node": ">=12.19.0"
86
+ "node": ">=16.15.0"
97
87
  },
98
88
  "files": [
99
89
  "dist",
@@ -105,12 +95,13 @@
105
95
  "eslintConfig": {
106
96
  "extends": [
107
97
  "eslint:recommended",
98
+ "plugin:prettier/recommended",
108
99
  "plugin:@typescript-eslint/eslint-recommended",
109
100
  "plugin:@typescript-eslint/recommended"
110
101
  ],
111
102
  "parserOptions": {
112
103
  "ecmaVersion": 2018,
113
- "sourceType": "module",
104
+ "sourceType": "script",
114
105
  "modules": true
115
106
  },
116
107
  "env": {
@@ -137,53 +128,6 @@
137
128
  "trailingComma": "all",
138
129
  "proseWrap": "always"
139
130
  },
140
- "babel": {
141
- "presets": [
142
- "@babel/typescript",
143
- [
144
- "@babel/env",
145
- {
146
- "targets": {
147
- "node": "12.19.0"
148
- }
149
- }
150
- ]
151
- ],
152
- "plugins": [
153
- "@babel/proposal-class-properties",
154
- "@babel/plugin-proposal-object-rest-spread",
155
- "babel-plugin-knifecycle"
156
- ],
157
- "env": {
158
- "cjs": {
159
- "presets": [
160
- [
161
- "@babel/env",
162
- {
163
- "targets": {
164
- "node": "10"
165
- },
166
- "modules": "commonjs"
167
- }
168
- ]
169
- ]
170
- },
171
- "mjs": {
172
- "presets": [
173
- [
174
- "@babel/env",
175
- {
176
- "targets": {
177
- "node": "12"
178
- },
179
- "modules": false
180
- }
181
- ]
182
- ]
183
- }
184
- },
185
- "sourceMaps": true
186
- },
187
131
  "jest": {
188
132
  "coverageReporters": [
189
133
  "lcov",
@@ -194,21 +138,36 @@
194
138
  ],
195
139
  "roots": [
196
140
  "<rootDir>/src"
141
+ ],
142
+ "testEnvironment": "node",
143
+ "transform": {
144
+ "^.+\\.tsx?$": [
145
+ "esbuild-jest",
146
+ {
147
+ "sourcemap": true,
148
+ "format": "esm"
149
+ }
150
+ ]
151
+ },
152
+ "moduleNameMapper": {
153
+ "(.+)\\.js": "$1"
154
+ },
155
+ "extensionsToTreatAsEsm": [
156
+ ".ts"
197
157
  ]
198
158
  },
199
159
  "scripts": {
160
+ "build": "rimraf -f 'dist' && tsc --outDir dist",
200
161
  "cli": "env NODE_ENV=${NODE_ENV:-cli}",
201
- "compile": "rimraf -f 'dist' && npm run compile:cjs && npm run compile:mjs",
202
- "compile:cjs": "babel --env-name=cjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
203
- "compile:mjs": "babel --env-name=mjs --out-file-extension=.mjs --out-dir=dist --extensions '.ts,.js' --source-maps=true src",
204
162
  "cover": "npm run jest -- --coverage",
205
163
  "doc": "echo \"# API\" > API.md; jsdoc2md 'dist/**/*.js' >> API.md && git add API.md",
206
164
  "genPackagelock": "npm i --package-lock-only",
207
- "jest": "NODE_ENV=test jest",
165
+ "jest": "NODE_OPTIONS=--experimental-vm-modules NODE_ENV=test jest",
208
166
  "lint": "eslint 'src/**/*.ts'",
209
167
  "metapak": "metapak",
210
168
  "prettier": "prettier --write 'src/**/*.ts'",
211
- "test": "npm run jest",
212
- "types": "rimraf -f 'dist/**/*.d.ts' && tsc --project . --declaration --emitDeclarationOnly --outDir dist"
213
- }
169
+ "test": "npm run jest"
170
+ },
171
+ "type": "module",
172
+ "gitHead": "4562e517c54f65e4469573019c8dea4744475099"
214
173
  }
@@ -1,18 +1,14 @@
1
- import { loadLambda } from '../libs/utils';
1
+ import { loadLambda } from '../libs/utils.js';
2
2
  import { extra, autoService } from 'knifecycle';
3
3
  import { readArgs } from '@whook/cli';
4
- import YError from 'yerror';
4
+ import { YError } from 'yerror';
5
5
  import {
6
6
  dereferenceOpenAPIOperations,
7
7
  getOpenAPIOperations,
8
8
  } from '@whook/http-router';
9
9
  import stream from 'stream';
10
10
  import camelCase from 'camelcase';
11
- import type {
12
- WhookCommandArgs,
13
- WhookCommandDefinition,
14
- WhookCommandNamedArgs,
15
- } from '@whook/cli';
11
+ import type { WhookCommandArgs, WhookCommandDefinition } from '@whook/cli';
16
12
  import type { LogService } from 'common-services';
17
13
  import type { OpenAPIV3 } from 'openapi-types';
18
14
 
@@ -68,16 +64,13 @@ async function initTestHTTPLambdaCommand({
68
64
  }) {
69
65
  return async () => {
70
66
  const {
71
- name,
72
- type,
73
- contentType,
74
- parameters: rawParameters,
75
- }: WhookCommandNamedArgs = readArgs(definition.arguments, args) as {
67
+ namedArguments: { name, type, contentType, parameters: rawParameters },
68
+ } = readArgs<{
76
69
  name: string;
77
70
  type: string;
78
71
  contentType: string;
79
72
  parameters: string;
80
- };
73
+ }>(definition.arguments, args);
81
74
  const handler = await loadLambda(
82
75
  { PROJECT_DIR, log },
83
76
  NODE_ENV,
package/src/index.ts CHANGED
@@ -4,14 +4,16 @@ import util from 'util';
4
4
  import path from 'path';
5
5
  import mkdirp from 'mkdirp';
6
6
  import cpr from 'cpr';
7
- import YError from 'yerror';
8
- import Knifecycle, {
7
+ import { YError } from 'yerror';
8
+ import { createRequire } from 'module';
9
+ import {
10
+ Knifecycle,
9
11
  SPECIAL_PROPS,
10
12
  constant,
11
13
  initInitializerBuilder,
12
14
  } from 'knifecycle';
13
- import { DEFAULT_BUILD_OPTIONS, initCompiler } from '@whook/whook';
14
- import initBuildAutoloader from './services/_autoload';
15
+ import { initCompiler } from '@whook/whook';
16
+ import initBuildAutoloader from './services/_autoload.js';
15
17
  import {
16
18
  dereferenceOpenAPIOperations,
17
19
  getOpenAPIOperations,
@@ -31,12 +33,10 @@ import type {
31
33
  import type { OpenAPIV3 } from 'openapi-types';
32
34
  import type { LogService } from 'common-services';
33
35
  import type { CprOptions } from 'cpr';
34
- import type { BuildOptions } from 'knifecycle/dist/build';
35
36
 
36
37
  export const DEFAULT_BUILD_PARALLELISM = 10;
37
38
 
38
- export type WhookBuildConfig = {
39
- BUILD_OPTIONS?: BuildOptions;
39
+ export type WhookGCPBuildConfig = {
40
40
  BUILD_PARALLELISM?: number;
41
41
  };
42
42
  export type WhookAPIOperationGCPFunctionConfig = {
@@ -62,6 +62,9 @@ const cprAsync = util.promisify(cpr) as (
62
62
  options: CprOptions,
63
63
  ) => Promise<string[]>;
64
64
 
65
+ // TODO: Use import.meta when Jest will support it
66
+ const require = createRequire(path.join(process.cwd(), 'src', 'index.ts'));
67
+
65
68
  const BUILD_DEFINITIONS: Record<
66
69
  NonNullable<WhookAPIOperationGCPFunctionConfig['type']>,
67
70
  {
@@ -74,7 +77,10 @@ const BUILD_DEFINITIONS: Record<
74
77
  type: 'HTTP',
75
78
  wrapper: {
76
79
  name: 'wrapHandlerForGoogleHTTPFunction',
77
- path: path.join(__dirname, 'wrappers', 'googleHTTPFunction'),
80
+ path: path.join(
81
+ path.dirname(require.resolve('@whook/gcp-function')),
82
+ 'wrappers/googleHTTPFunction.js',
83
+ ),
78
84
  },
79
85
  suffix: 'Wrapped',
80
86
  },
@@ -86,7 +92,7 @@ export async function prepareBuildEnvironment<T extends Knifecycle>(
86
92
  $.register(
87
93
  constant('INITIALIZER_PATH_MAP', {
88
94
  ENV: '@whook/whook/dist/services/ProxyedENV',
89
- log: __dirname + '/services/log',
95
+ log: '@whook/gcp-functions/dist/services/log',
90
96
  time: 'common-services/dist/time',
91
97
  delay: 'common-services/dist/delay',
92
98
  }),
@@ -109,14 +115,13 @@ export async function runBuild(
109
115
  const {
110
116
  NODE_ENV,
111
117
  BUILD_PARALLELISM,
112
- BUILD_OPTIONS,
113
118
  PROJECT_DIR,
114
119
  compiler,
115
120
  log,
116
121
  $autoload,
117
122
  API,
118
123
  buildInitializer,
119
- }: WhookBuildConfig & {
124
+ }: WhookGCPBuildConfig & {
120
125
  NODE_ENV: string;
121
126
  PROJECT_DIR: string;
122
127
  compiler: WhookCompilerService;
@@ -127,7 +132,6 @@ export async function runBuild(
127
132
  } = await $.run([
128
133
  'NODE_ENV',
129
134
  '?BUILD_PARALLELISM',
130
- '?BUILD_OPTIONS',
131
135
  'PROJECT_DIR',
132
136
  'process',
133
137
  'compiler',
@@ -161,7 +165,6 @@ export async function runBuild(
161
165
  await processOperations(
162
166
  {
163
167
  NODE_ENV,
164
- BUILD_OPTIONS: BUILD_OPTIONS || DEFAULT_BUILD_OPTIONS,
165
168
  BUILD_PARALLELISM: BUILD_PARALLELISM || DEFAULT_BUILD_PARALLELISM,
166
169
  PROJECT_DIR,
167
170
  compiler,
@@ -187,16 +190,13 @@ async function processOperations(
187
190
  {
188
191
  NODE_ENV,
189
192
  BUILD_PARALLELISM,
190
- BUILD_OPTIONS,
191
193
  PROJECT_DIR,
192
194
  compiler,
193
195
  log,
194
196
  $autoload,
195
197
  buildInitializer,
196
- }: {
198
+ }: WhookGCPBuildConfig & {
197
199
  NODE_ENV: string;
198
- BUILD_PARALLELISM: number;
199
- BUILD_OPTIONS: BuildOptions;
200
200
  PROJECT_DIR: string;
201
201
  compiler: WhookCompilerService;
202
202
  log: LogService;
@@ -213,7 +213,6 @@ async function processOperations(
213
213
  {
214
214
  NODE_ENV,
215
215
  PROJECT_DIR,
216
- BUILD_OPTIONS,
217
216
  compiler,
218
217
  log,
219
218
  $autoload,
@@ -230,7 +229,6 @@ async function processOperations(
230
229
  {
231
230
  NODE_ENV,
232
231
  BUILD_PARALLELISM,
233
- BUILD_OPTIONS,
234
232
  PROJECT_DIR,
235
233
  compiler,
236
234
  log,
@@ -247,7 +245,6 @@ async function buildAnyLambda(
247
245
  {
248
246
  NODE_ENV,
249
247
  PROJECT_DIR,
250
- BUILD_OPTIONS,
251
248
  compiler,
252
249
  log,
253
250
  $autoload,
@@ -255,7 +252,6 @@ async function buildAnyLambda(
255
252
  }: {
256
253
  NODE_ENV: string;
257
254
  PROJECT_DIR: string;
258
- BUILD_OPTIONS: BuildOptions;
259
255
  compiler: WhookCompilerService;
260
256
  log: LogService;
261
257
  $autoload: Autoloader<Initializer<Dependencies, Service>>;
@@ -266,8 +262,9 @@ async function buildAnyLambda(
266
262
  const { operationId } = operation;
267
263
 
268
264
  try {
269
- const whookConfig: WhookAPIOperationGCPFunctionConfig =
270
- operation['x-whook'] || {};
265
+ const whookConfig: WhookAPIOperationGCPFunctionConfig = operation[
266
+ 'x-whook'
267
+ ] || { type: 'http' };
271
268
  const operationType = whookConfig.type || 'http';
272
269
  const sourceOperationId = whookConfig.sourceOperationId;
273
270
  const entryPoint = operationId;
@@ -277,7 +274,7 @@ async function buildAnyLambda(
277
274
  log('warning', `Building ${operationType} "${finalEntryPoint}"...`);
278
275
  const buildDefinition = BUILD_DEFINITIONS[operationType];
279
276
  // eslint-disable-next-line
280
- const applyWrapper = require(buildDefinition.wrapper.path).default;
277
+ const applyWrapper = (await import(buildDefinition.wrapper.path)).default;
281
278
  const rootNode = await $autoload(
282
279
  entryPoint + (buildDefinition.suffix || ''),
283
280
  );
@@ -295,16 +292,11 @@ async function buildAnyLambda(
295
292
  ? `OPERATION_API>OPERATION_API_${finalEntryPoint}`
296
293
  : name,
297
294
  ),
298
- BUILD_OPTIONS,
299
- );
300
- const indexContent = await buildLambdaIndex(
301
- rootNode,
302
- {
303
- name: buildDefinition.wrapper.name,
304
- path: buildDefinition.wrapper.path,
305
- },
306
- BUILD_OPTIONS,
307
295
  );
296
+ const indexContent = await buildLambdaIndex(rootNode, {
297
+ name: buildDefinition.wrapper.name,
298
+ path: buildDefinition.wrapper.path,
299
+ });
308
300
 
309
301
  await mkdirp(lambdaPath);
310
302
  await Promise.all([
@@ -332,18 +324,10 @@ async function buildAnyLambda(
332
324
  async function buildLambdaIndex(
333
325
  rootNode: { path: string },
334
326
  buildWrapper: { name: string; path: string },
335
- options: BuildOptions,
336
327
  ): Promise<string> {
337
- return `${
338
- options.modules === 'commonjs'
339
- ? `const pickModule = (m) => { return m && m.default || m; }
340
- const initHandler = pickModule(require('${rootNode.path}'));
341
- const ${buildWrapper.name} = pickModule(require('${buildWrapper.path}'));
342
- const { initialize } = require('./initialize');`
343
- : `import initHandler from '${rootNode.path}';
328
+ return `import initHandler from '${rootNode.path}';
344
329
  import ${buildWrapper.name} from '${buildWrapper.path}';
345
- import { initialize } from './initialize';`
346
- }
330
+ import { initialize } from './initialize.js';
347
331
 
348
332
  const handlerInitializer = ${buildWrapper.name}(
349
333
  initHandler
@@ -352,11 +336,7 @@ const handlerInitializer = ${buildWrapper.name}(
352
336
  const handlerPromise = initialize()
353
337
  .then(handlerInitializer);
354
338
 
355
- ${
356
- options.modules === 'commonjs'
357
- ? 'module.exports = {}; module.exports.default = '
358
- : 'export default '
359
- }function handler (req, res) {
339
+ export default function handler (req, res) {
360
340
  return handlerPromise
361
341
  .then(handler => handler(req, res));
362
342
  };
package/src/libs/utils.ts CHANGED
@@ -1,4 +1,4 @@
1
- import YError from 'yerror';
1
+ import { YError } from 'yerror';
2
2
  import path from 'path';
3
3
  import type { LogService } from 'common-services';
4
4
 
@@ -19,14 +19,13 @@ export async function loadLambda(
19
19
  'builds',
20
20
  target,
21
21
  operationId,
22
- type,
22
+ type + '.js',
23
23
  );
24
24
 
25
25
  log('debug', `⛏️ - Loading lambda module at path "${modulePath}".`);
26
26
 
27
27
  try {
28
- // eslint-disable-next-line
29
- const module = require(modulePath);
28
+ const module = await import(modulePath);
30
29
 
31
30
  if (!module) {
32
31
  throw new YError('E_MODULE_NOT_FOUND', module);
@@ -1,11 +1,12 @@
1
1
  import { initAutoload, noop, cleanupOpenAPI } from '@whook/whook';
2
- import Knifecycle, {
2
+ import {
3
+ Knifecycle,
3
4
  SPECIAL_PROPS,
4
5
  wrapInitializer,
5
6
  constant,
6
7
  alsoInject,
7
8
  } from 'knifecycle';
8
- import YError from 'yerror';
9
+ import { YError } from 'yerror';
9
10
  import {
10
11
  dereferenceOpenAPIOperations,
11
12
  getOpenAPIOperations,
@@ -22,7 +23,7 @@ import type { WhookBuildConstantsService } from '@whook/whook';
22
23
  import type { WhookRawOperation } from '@whook/http-router';
23
24
  import type { LogService } from 'common-services';
24
25
  import type { OpenAPIV3 } from 'openapi-types';
25
- import type { WhookAPIOperationGCPFunctionConfig } from '..';
26
+ import type { WhookAPIOperationGCPFunctionConfig } from '../index.js';
26
27
 
27
28
  const initializerWrapper: ServiceInitializerWrapper<
28
29
  Autoloader<Initializer<Dependencies, Service>>,
@@ -1,4 +1,4 @@
1
- import initLogService from './log';
1
+ import initLogService from './log.js';
2
2
 
3
3
  describe('initLogService', () => {
4
4
  it('should work', async () => {
@@ -9,10 +9,10 @@ import {
9
9
  castParameters,
10
10
  } from '@whook/http-router';
11
11
  import { reuseSpecialProps, alsoInject } from 'knifecycle';
12
- import Ajv from 'ajv';
13
- import addAJVFormats from 'ajv-formats';
12
+ import { default as Ajv } from 'ajv';
13
+ import { default as addAJVFormats } from 'ajv-formats';
14
14
  import bytes from 'bytes';
15
- import HTTPError from 'yhttperror';
15
+ import { YHTTPError } from 'yhttperror';
16
16
  import {
17
17
  prepareParametersValidators,
18
18
  prepareBodyValidator,
@@ -328,7 +328,7 @@ async function handleForAWSHTTPFunction(
328
328
  ...('undefined' !== typeof body ? { body } : {}),
329
329
  };
330
330
  } catch (err) {
331
- throw HTTPError.cast(err as Error, 400);
331
+ throw YHTTPError.cast(err as Error, 400);
332
332
  }
333
333
 
334
334
  response = await executeHandler(operation, handler, parameters);
@@ -354,7 +354,7 @@ async function handleForAWSHTTPFunction(
354
354
  (responseSchema.type !== 'string' || responseSchema.format !== 'binary');
355
355
 
356
356
  if (responseHasSchema && !STRINGIFYERS[response.headers['content-type']]) {
357
- throw new HTTPError(
357
+ throw new YHTTPError(
358
358
  500,
359
359
  'E_STRINGIFYER_LACK',
360
360
  response.headers['content-type'],
@@ -370,7 +370,7 @@ async function handleForAWSHTTPFunction(
370
370
  };
371
371
  log?.('debug', JSON.stringify(responseLog));
372
372
  } catch (err) {
373
- const castedError = HTTPError.cast(err as Error);
373
+ const castedError = YHTTPError.cast(err as Error);
374
374
 
375
375
  responseLog = {
376
376
  type: 'error',