From 2f0353996bfed308b4781111018a79e924310f74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Poullain?= Date: Thu, 25 Apr 2024 13:25:42 +0200 Subject: [PATCH] [Internal] Upgrade to lerna v8 (2) --- .../src/additional/session.config.spec.ts | 2 +- .../src/additional/typestack.spec.ts | 2 +- .../controllers/returning-a-response.feature.ts | 4 ++-- .../controllers/using-signed-cookies.feature.ts | 2 +- ...-users-in-a-stateful-spa-using-cookies.feature.ts | 2 +- ...rs-in-a-stateful-ssr-app-using-cookies.feature.ts | 2 +- ...users-in-a-stateless-spa-using-cookies.feature.ts | 2 +- ...ding-authentication-and-access-control.feature.ts | 4 ++-- .../do-not-auto-create-the-session.feature.ts | 2 +- .../overriding-the-cookie-options.feature.ts | 12 ++++++------ .../session-tokens/using-cookies.feature.ts | 6 +++--- .../docs/common/validation-and-sanitization.spec.ts | 2 +- ...rning-custom-validation-error-messages.feature.ts | 3 +-- ...ng-csrf-protection-on-a-specific-route.feature.ts | 2 +- 14 files changed, 23 insertions(+), 24 deletions(-) diff --git a/packages/acceptance-tests/src/additional/session.config.spec.ts b/packages/acceptance-tests/src/additional/session.config.spec.ts index eb8392bc4e..c0124aaddc 100644 --- a/packages/acceptance-tests/src/additional/session.config.spec.ts +++ b/packages/acceptance-tests/src/additional/session.config.spec.ts @@ -21,7 +21,7 @@ describe('The session store', () => { beforeEach(() => { // Use ".." to remove the "build/" directory. - Config.set('settings.session.store', './../node_modules/@foal/redis'); + Config.set('settings.session.store', './../../../node_modules/@foal/redis'); Config.set('settings.session.secret', 'secret'); Config.set('settings.redis.uri', 'redis://localhost:6380'); serviceManager = new ServiceManager(); diff --git a/packages/acceptance-tests/src/additional/typestack.spec.ts b/packages/acceptance-tests/src/additional/typestack.spec.ts index 7c046a8c46..e3658ac813 100644 --- a/packages/acceptance-tests/src/additional/typestack.spec.ts +++ b/packages/acceptance-tests/src/additional/typestack.spec.ts @@ -5,7 +5,7 @@ import { BaseEntity, Column, Entity, DataSource, PrimaryGeneratedColumn } from ' // FoalTS import { Context, createApp, HttpResponseCreated, Post } from '@foal/core'; import { ValidateBody } from '@foal/typestack'; -import { IsNumber, IsString } from '@foal/typestack/node_modules/class-validator'; +import { IsNumber, IsString } from 'class-validator'; import { createAndInitializeDataSource } from '../common'; describe('ValidateBody hook', () => { diff --git a/packages/acceptance-tests/src/docs/architecture/controllers/returning-a-response.feature.ts b/packages/acceptance-tests/src/docs/architecture/controllers/returning-a-response.feature.ts index 6b1afde03c..1ea692860b 100644 --- a/packages/acceptance-tests/src/docs/architecture/controllers/returning-a-response.feature.ts +++ b/packages/acceptance-tests/src/docs/architecture/controllers/returning-a-response.feature.ts @@ -81,8 +81,8 @@ describe('Feature: Returning a response', () => { .get('/') .expect(200) .then(response => { - strictEqual(response.get('Set-Cookie')[0].startsWith('sessionID=xxxx; Max-Age=3600; Domain=example.com; Path=/; '), true); - strictEqual(response.get('Set-Cookie')[0].endsWith('; HttpOnly; Secure; SameSite=Lax'), true); + strictEqual(response.get('Set-Cookie')?.[0].startsWith('sessionID=xxxx; Max-Age=3600; Domain=example.com; Path=/; '), true); + strictEqual(response.get('Set-Cookie')?.[0].endsWith('; HttpOnly; Secure; SameSite=Lax'), true); }); }); diff --git a/packages/acceptance-tests/src/docs/architecture/controllers/using-signed-cookies.feature.ts b/packages/acceptance-tests/src/docs/architecture/controllers/using-signed-cookies.feature.ts index 480d1d2c4d..a8a54474bc 100644 --- a/packages/acceptance-tests/src/docs/architecture/controllers/using-signed-cookies.feature.ts +++ b/packages/acceptance-tests/src/docs/architecture/controllers/using-signed-cookies.feature.ts @@ -54,7 +54,7 @@ describe('Feature: Signing cookies', () => { .get('/set-cookie') .expect(200) .then(response => { - cookie1 = readCookie(response.get('Set-Cookie'), 'cookie1').value; + cookie1 = readCookie(response.get('Set-Cookie') || [], 'cookie1').value; }); // Check that the value is signed (see cookie-parser spec.) diff --git a/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-spa-using-cookies.feature.ts b/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-spa-using-cookies.feature.ts index c73cd375f2..dcfb069758 100644 --- a/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-spa-using-cookies.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-spa-using-cookies.feature.ts @@ -139,7 +139,7 @@ describe('Feature: Authenticating users in a stateful SPA using cookies', () => }); function setCookieInBrowser(response: request.Response): void { - token = readCookie(response.get('Set-Cookie'), cookieName).value; + token = readCookie(response.get('Set-Cookie') || [], cookieName).value; } beforeEach(() => response = undefined); diff --git a/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-ssr-app-using-cookies.feature.ts b/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-ssr-app-using-cookies.feature.ts index 85fcb96ad4..af777d4125 100644 --- a/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-ssr-app-using-cookies.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateful-ssr-app-using-cookies.feature.ts @@ -160,7 +160,7 @@ describe('Feature: Authenticating users in a statefull SSR application using coo }); function setCookieInBrowser(response: request.Response): void { - token = readCookie(response.get('Set-Cookie'), cookieName).value; + token = readCookie(response.get('Set-Cookie') || [], cookieName).value; } beforeEach(() => response = undefined); diff --git a/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateless-spa-using-cookies.feature.ts b/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateless-spa-using-cookies.feature.ts index c373d7deb3..2e4b8d2480 100644 --- a/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateless-spa-using-cookies.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/quick-start/authenticating-users-in-a-stateless-spa-using-cookies.feature.ts @@ -152,7 +152,7 @@ describe('Feature: Authenticating users in a stateless SPA using cookies', () => function setCookieInBrowser(response: request.Response): void { try { // There may not be a cookie in the response. - token = readCookie(response.get('Set-Cookie'), cookieName).value; + token = readCookie(response.get('Set-Cookie') || [], cookieName).value; } catch {} } diff --git a/packages/acceptance-tests/src/docs/authentication/session-tokens/adding-authentication-and-access-control.feature.ts b/packages/acceptance-tests/src/docs/authentication/session-tokens/adding-authentication-and-access-control.feature.ts index ea6dc757f1..5d88ee64e1 100644 --- a/packages/acceptance-tests/src/docs/authentication/session-tokens/adding-authentication-and-access-control.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/session-tokens/adding-authentication-and-access-control.feature.ts @@ -346,7 +346,7 @@ describe('Feature: Adding authentication and access control', () => { .set('Cookie', writeCookie('sessionID', session.getToken())) .expect(401) .then(response => { - const { value } = readCookie(response.get('Set-Cookie'), 'user'); + const { value } = readCookie(response.get('Set-Cookie') || [], 'user'); strictEqual(value, 'null'); }); @@ -358,7 +358,7 @@ describe('Feature: Adding authentication and access control', () => { { id: product2.id } ]) .then(response => { - const { value } = readCookie(response.get('Set-Cookie'), 'user'); + const { value } = readCookie(response.get('Set-Cookie') || [], 'user'); strictEqual( value, encodeURIComponent(JSON.stringify({ diff --git a/packages/acceptance-tests/src/docs/authentication/session-tokens/do-not-auto-create-the-session.feature.ts b/packages/acceptance-tests/src/docs/authentication/session-tokens/do-not-auto-create-the-session.feature.ts index 60a11558f3..84cd9450b5 100644 --- a/packages/acceptance-tests/src/docs/authentication/session-tokens/do-not-auto-create-the-session.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/session-tokens/do-not-auto-create-the-session.feature.ts @@ -83,7 +83,7 @@ describe('Feature: Do not Auto-Create the Session when using sessions with cooki .expect(200); strictEqual(alreadyExists, false); - strictEqual(response.get('Set-Cookie').length, 1); + strictEqual(response.get('Set-Cookie')?.length, 1); }); }); diff --git a/packages/acceptance-tests/src/docs/authentication/session-tokens/overriding-the-cookie-options.feature.ts b/packages/acceptance-tests/src/docs/authentication/session-tokens/overriding-the-cookie-options.feature.ts index c649576c1f..69c11301ef 100644 --- a/packages/acceptance-tests/src/docs/authentication/session-tokens/overriding-the-cookie-options.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/session-tokens/overriding-the-cookie-options.feature.ts @@ -58,12 +58,12 @@ describe('Feature: Overriding the cookie options', async () => { .get('/') .expect(200); - strictEqual(response.get('Set-Cookie')[0].startsWith('xxx='), true); - strictEqual(response.get('Set-Cookie')[0].includes('Domain=example.com'), true); - strictEqual(response.get('Set-Cookie')[0].includes('httpOnly'), false); - strictEqual(response.get('Set-Cookie')[0].includes('Path=/foo'), true); - strictEqual(response.get('Set-Cookie')[0].includes('SameSite=Lax'), true); - strictEqual(response.get('Set-Cookie')[0].includes('Secure;'), true); + strictEqual(response.get('Set-Cookie')?.[0].startsWith('xxx='), true); + strictEqual(response.get('Set-Cookie')?.[0].includes('Domain=example.com'), true); + strictEqual(response.get('Set-Cookie')?.[0].includes('httpOnly'), false); + strictEqual(response.get('Set-Cookie')?.[0].includes('Path=/foo'), true); + strictEqual(response.get('Set-Cookie')?.[0].includes('SameSite=Lax'), true); + strictEqual(response.get('Set-Cookie')?.[0].includes('Secure;'), true); }); }); diff --git a/packages/acceptance-tests/src/docs/authentication/session-tokens/using-cookies.feature.ts b/packages/acceptance-tests/src/docs/authentication/session-tokens/using-cookies.feature.ts index 6a3c9c9999..a13f323802 100644 --- a/packages/acceptance-tests/src/docs/authentication/session-tokens/using-cookies.feature.ts +++ b/packages/acceptance-tests/src/docs/authentication/session-tokens/using-cookies.feature.ts @@ -91,7 +91,7 @@ describe('Feature: Using cookies', () => { .get('/api/products') .expect(200); - const token = readCookie(response.get('Set-Cookie'), cookieName).value; + const token = readCookie(response.get('Set-Cookie') || [], cookieName).value; notStrictEqual(session, null); strictEqual((session as unknown as Session).getToken(), token); @@ -102,7 +102,7 @@ describe('Feature: Using cookies', () => { .send({}) .expect(200); - const token2 = readCookie(response2.get('Set-Cookie'), cookieName).value; + const token2 = readCookie(response2.get('Set-Cookie') || [], cookieName).value; strictEqual(token2, token); }); @@ -143,7 +143,7 @@ describe('Feature: Using cookies', () => { .get('/api/products') .expect(200); - const token = readCookie(response.get('Set-Cookie'), cookieName).value; + const token = readCookie(response.get('Set-Cookie') || [], cookieName).value; await request(app) .get('/api/products') diff --git a/packages/acceptance-tests/src/docs/common/validation-and-sanitization.spec.ts b/packages/acceptance-tests/src/docs/common/validation-and-sanitization.spec.ts index 5299b62f02..3098c4a195 100644 --- a/packages/acceptance-tests/src/docs/common/validation-and-sanitization.spec.ts +++ b/packages/acceptance-tests/src/docs/common/validation-and-sanitization.spec.ts @@ -1,6 +1,6 @@ // 3p -import { Contains, Length } from '@foal/typestack/node_modules/class-validator'; +import { Contains, Length } from 'class-validator'; import * as request from 'supertest'; // FoalTS diff --git a/packages/acceptance-tests/src/docs/common/validation-and-sanitization/returning-custom-validation-error-messages.feature.ts b/packages/acceptance-tests/src/docs/common/validation-and-sanitization/returning-custom-validation-error-messages.feature.ts index cb65dfd736..7f765bb88e 100644 --- a/packages/acceptance-tests/src/docs/common/validation-and-sanitization/returning-custom-validation-error-messages.feature.ts +++ b/packages/acceptance-tests/src/docs/common/validation-and-sanitization/returning-custom-validation-error-messages.feature.ts @@ -1,6 +1,5 @@ // 3p -// The "ajv" and "ajv-errors" dependencies must reside in the same "node_modules/" directory. -import ajvErrors from '@foal/core/node_modules/ajv-errors'; +import ajvErrors from 'ajv-errors'; import * as request from 'supertest'; // FoalTS diff --git a/packages/acceptance-tests/src/docs/security/csrf/disabling-csrf-protection-on-a-specific-route.feature.ts b/packages/acceptance-tests/src/docs/security/csrf/disabling-csrf-protection-on-a-specific-route.feature.ts index ba7674fb7f..f488fc4c32 100644 --- a/packages/acceptance-tests/src/docs/security/csrf/disabling-csrf-protection-on-a-specific-route.feature.ts +++ b/packages/acceptance-tests/src/docs/security/csrf/disabling-csrf-protection-on-a-specific-route.feature.ts @@ -71,7 +71,7 @@ describe('Feature: Disabling CSRF protection on a specific route.', () => { await request(app) .get('/') .then(response => { - const { value } = readCookie(response.get('Set-Cookie'), 'sessionID'); + const { value } = readCookie(response.get('Set-Cookie') || [], 'sessionID'); token = value; });