Skip to content

Commit

Permalink
Merge pull request #194 from nfroidure/chore/dependencies
Browse files Browse the repository at this point in the history
chore(dependencies): update dependencies
  • Loading branch information
nfroidure authored Dec 4, 2024
2 parents cafc97f + 3fdd8ed commit b44541b
Show file tree
Hide file tree
Showing 109 changed files with 2,541 additions and 3,106 deletions.
3,475 changes: 1,388 additions & 2,087 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
},
"homepage": "https://github.com/nfroidure/whook",
"devDependencies": {
"commitizen": "^4.3.0",
"commitizen": "^4.3.1",
"conventional-changelog-cli": "^5.0.0",
"cz-conventional-changelog": "^3.3.0",
"lerna": "^8.1.6",
"metapak": "^6.0.1",
"metapak-nfroidure": "18.2.0"
"metapak-nfroidure": "19.0.1"
},
"contributors": [
{
Expand Down
10 changes: 8 additions & 2 deletions packages/whook-authorization/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginJest from 'eslint-plugin-jest';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts'],
ignores: ['**/*.d.ts'],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
],
},
{
files: ['*.test.ts'],
...eslintPluginJest.configs['flat/recommended'],
Expand Down
34 changes: 17 additions & 17 deletions packages/whook-authorization/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,30 @@
"homepage": "https://github.com/nfroidure/whook",
"dependencies": {
"@whook/whook": "^17.0.2",
"common-services": "^16.0.4",
"common-services": "^17.0.0",
"http-auth-utils": "^6.0.1",
"knifecycle": "^17.3.0",
"knifecycle": "^18.0.0",
"yerror": "^8.0.0",
"yhttperror": "^8.0.0"
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.13",
"@swc/helpers": "^0.5.12",
"@swc/jest": "^0.2.36",
"eslint": "^9.7.0",
"@eslint/js": "^9.16.0",
"@swc/cli": "^0.5.2",
"@swc/core": "^1.10.0",
"@swc/helpers": "^0.5.15",
"@swc/jest": "^0.2.37",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"jsdoc-to-markdown": "^8.0.0",
"jsdoc-to-markdown": "^9.1.1",
"metapak": "^6.0.1",
"metapak-nfroidure": "18.2.0",
"prettier": "^3.3.3",
"metapak-nfroidure": "19.0.1",
"prettier": "^3.4.2",
"rimraf": "^6.0.1",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.0"
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
},
"contributors": [],
"engines": {
Expand Down Expand Up @@ -139,6 +139,6 @@
"type-check": "tsc --pretty --noEmit"
},
"overrides": {
"eslint": "^9.7.0"
"eslint": "^9.16.0"
}
}
}
10 changes: 8 additions & 2 deletions packages/whook-aws-lambda/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginJest from 'eslint-plugin-jest';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts'],
ignores: ['**/*.d.ts'],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
],
},
{
files: ['*.test.ts'],
...eslintPluginJest.configs['flat/recommended'],
Expand Down
44 changes: 22 additions & 22 deletions packages/whook-aws-lambda/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,47 +43,47 @@
},
"homepage": "https://github.com/nfroidure/whook",
"dependencies": {
"@types/aws-lambda": "^8.10.145",
"@types/aws-lambda": "^8.10.146",
"@types/bytes": "^3.1.4",
"@whook/cors": "^17.0.2",
"@whook/http-router": "^17.0.2",
"@whook/http-transaction": "^17.0.2",
"@whook/whook": "^17.0.2",
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1",
"application-services": "^6.1.0",
"application-services": "^7.0.0",
"bytes": "^3.1.2",
"camelcase": "^8.0.0",
"common-services": "^16.0.4",
"common-services": "^17.0.0",
"cpr": "3.0.1",
"knifecycle": "^17.3.0",
"knifecycle": "^18.0.0",
"mkdirp": "^3.0.1",
"openapi-types": "^12.1.3",
"qs": "^6.13.0",
"qs": "^6.13.1",
"strict-qs": "^8.0.3",
"type-fest": "^4.26.1",
"uuid": "^10.0.0",
"type-fest": "^4.30.0",
"uuid": "^11.0.3",
"yerror": "^8.0.0",
"yhttperror": "^8.0.0"
},
"devDependencies": {
"@eslint/js": "^9.7.0",
"@swc/cli": "^0.4.0",
"@swc/core": "^1.6.13",
"@swc/helpers": "^0.5.12",
"@swc/jest": "^0.2.36",
"eslint": "^9.7.0",
"@eslint/js": "^9.16.0",
"@swc/cli": "^0.5.2",
"@swc/core": "^1.10.0",
"@swc/helpers": "^0.5.15",
"@swc/jest": "^0.2.37",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-jest": "^28.6.0",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-jest": "^28.9.0",
"eslint-plugin-prettier": "^5.2.1",
"jest": "^29.7.0",
"jsdoc-to-markdown": "^8.0.0",
"jsdoc-to-markdown": "^9.1.1",
"metapak": "^6.0.1",
"metapak-nfroidure": "18.2.0",
"prettier": "^3.3.3",
"metapak-nfroidure": "19.0.1",
"prettier": "^3.4.2",
"rimraf": "^6.0.1",
"typescript": "^5.5.3",
"typescript-eslint": "^7.16.0"
"typescript": "^5.7.2",
"typescript-eslint": "^8.17.0"
},
"contributors": [],
"engines": {
Expand Down Expand Up @@ -145,6 +145,6 @@
"type-check": "tsc --pretty --noEmit"
},
"overrides": {
"eslint": "^9.7.0"
"eslint": "^9.16.0"
}
}
}
6 changes: 5 additions & 1 deletion packages/whook-aws-lambda/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,11 @@ async function ensureFile(
return;
}
} catch (err) {
log('debug', `🗀 - Write new file: "${path}".`);
log(
'debug',
`🗀 - Write new file: "${path}".`,
printStackTrace(err as YError),
);
return await writeFile(path, content);
}
log('debug', `🗀 - Write changed file: "${path}".`);
Expand Down
14 changes: 8 additions & 6 deletions packages/whook-aws-lambda/src/services/HANDLER.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { autoService, name } from 'knifecycle';
import { noop, applyWrappers } from '@whook/whook';
import type { WhookWrapper } from '@whook/whook';
import type { WhookHandler } from '@whook/http-transaction';
import type { LogService } from 'common-services';
import { autoService, name, location } from 'knifecycle';
import { noop, applyWrappers, type WhookWrapper } from '@whook/whook';
import { type WhookHandler } from '@whook/http-transaction';
import { type LogService } from 'common-services';

export type WhookHandlerDependencies<T extends WhookHandler> = {
WRAPPERS: WhookWrapper<T>[];
Expand All @@ -13,7 +12,10 @@ export type WhookHandlerDependencies<T extends WhookHandler> = {

export const DEFAULT_WRAPPERS = [];

export default name('HANDLER', autoService(initHandler));
export default location(
name('HANDLER', autoService(initHandler)),
import.meta.url,
);

/**
* Initialize one Whook handler
Expand Down
48 changes: 15 additions & 33 deletions packages/whook-aws-lambda/src/services/_autoload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
wrapInitializer,
constant,
alsoInject,
location,
} from 'knifecycle';
import { printStackTrace, YError } from 'yerror';
import {
Expand Down Expand Up @@ -94,10 +95,7 @@ const initializerWrapper: ServiceInitializerWrapper<
}: WhookAWSLambdaAutoloadDependencies,
$autoload: Autoloader<Initializer<Dependencies, Service>>,
): Promise<
(serviceName: string) => Promise<{
initializer: Initializer<Dependencies, Service>;
path: string;
}>
(serviceName: string) => Promise<Initializer<Dependencies, Service>>
> => {
let API: OpenAPIV3_1.Document;
let OPERATION_APIS: WhookRawOperation<WhookAPIOperationAWSLambdaConfig>[];
Expand All @@ -108,10 +106,9 @@ const initializerWrapper: ServiceInitializerWrapper<
> = (() => {
return async (serviceName) => {
const cleanedName = serviceName.split('_').pop();
// eslint-disable-next-line

API = API || (await $injector(['API'])).API;

// eslint-disable-next-line
OPERATION_APIS =
OPERATION_APIS ||
getOpenAPIOperations<WhookAPIOperationAWSLambdaConfig>(API);
Expand All @@ -130,7 +127,6 @@ const initializerWrapper: ServiceInitializerWrapper<
throw new YError('E_OPERATION_NOT_FOUND', serviceName, cleanedName);
}

// eslint-disable-next-line
const OPERATION_API: OpenAPIV3_1.Document = cleanupOpenAPI({
...API,
paths: {
Expand Down Expand Up @@ -176,10 +172,7 @@ const initializerWrapper: ServiceInitializerWrapper<
', ',
)}) can give unpredictable results!`,
);
return {
initializer: constant(serviceName, undefined),
path: `constant://${serviceName}`,
};
return constant(serviceName, undefined);
}

try {
Expand All @@ -200,26 +193,20 @@ const initializerWrapper: ServiceInitializerWrapper<
'debug',
`🤖 - Reusing a constant initializer directly from the Knifecycle instance: "${serviceName}".`,
);
return {
initializer,
path: `instance://${serviceName}`,
};
return initializer;
}

if (serviceName.startsWith('OPERATION_API_')) {
const [, , OPERATION_API] = await getAPIOperation(serviceName);

return {
initializer: constant(serviceName, OPERATION_API),
path: `api://${serviceName}`,
};
return constant(serviceName, OPERATION_API);
}

if (serviceName.startsWith('OPERATION_WRAPPER_')) {
const [type] = await getAPIOperation(serviceName);

return {
initializer: alsoInject(
return location(
alsoInject(
[
`OPERATION_API>${serviceName.replace(
'OPERATION_WRAPPER_',
Expand All @@ -228,17 +215,15 @@ const initializerWrapper: ServiceInitializerWrapper<
],
AWS_WRAPPERS[type].initializer as any,
) as any,
path: `@whook/aws-lambda/dist/wrappers/${AWS_WRAPPERS[type].name}.js`,
};
`@whook/aws-lambda/dist/wrappers/${AWS_WRAPPERS[type].name}.js`,
);
}

if (serviceName.startsWith('OPERATION_HANDLER_')) {
const [type, operationId] = await getAPIOperation(serviceName);

return {
name: serviceName,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
initializer: alsoInject(
return location(
alsoInject(
[
`mainWrapper>OPERATION_WRAPPER_${serviceName.replace(
'OPERATION_HANDLER_',
Expand All @@ -253,15 +238,12 @@ const initializerWrapper: ServiceInitializerWrapper<
],
initHandler,
) as any,
path: '@whook/aws-lambda/dist/services/HANDLER.js',
};
'@whook/aws-lambda/dist/services/HANDLER.js',
);
}

if (BUILD_CONSTANTS[serviceName]) {
return {
initializer: constant(serviceName, BUILD_CONSTANTS[serviceName]),
path: `constant://${serviceName}`,
};
return constant(serviceName, BUILD_CONSTANTS[serviceName]);
}

return $autoload(serviceName);
Expand Down
7 changes: 5 additions & 2 deletions packages/whook-aws-lambda/src/services/log.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { service } from 'knifecycle';
import { service, location } from 'knifecycle';
import { log } from 'node:console';

export default service(async () => log, 'log');
export default location(
service(async () => log, 'log'),
import.meta.url,
);
3 changes: 2 additions & 1 deletion packages/whook-aws-lambda/src/wrappers/awsHTTPLambda.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,8 @@ async function handleForAWSHTTPLambda(
event: APIGatewayProxyEvent,
) {
const startTime = time();
const bufferLimit = bytes.parse(BUFFER_LIMIT);
const bufferLimit =
bytes.parse(BUFFER_LIMIT) || (bytes.parse(DEFAULT_BUFFER_LIMIT) as number);
const operationParameters = (operation.parameters || []).concat(
ammendedParameters,
);
Expand Down
10 changes: 8 additions & 2 deletions packages/whook-cors/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@ import eslintConfigPrettier from 'eslint-config-prettier';
import eslintPluginJest from 'eslint-plugin-jest';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.recommended,
{
files: ['**/*.ts'],
ignores: ['**/*.d.ts'],
extends: [
eslint.configs.recommended,
...tseslint.configs.recommended,
],
},
{
files: ['*.test.ts'],
...eslintPluginJest.configs['flat/recommended'],
Expand Down
Loading

0 comments on commit b44541b

Please sign in to comment.