diff --git a/.eslintignore b/.eslintignore index 15a6880b89..2a7f257ddd 100644 --- a/.eslintignore +++ b/.eslintignore @@ -4,3 +4,4 @@ /apps/web/src/server/static/scripts/* /apps/web/src/server/static/styles/* /apps/functions/migration/database/db-client/* +/apps/api/src/database/client/* diff --git a/.gitignore b/.gitignore index f3b80be9cb..20544d6b25 100644 --- a/.gitignore +++ b/.gitignore @@ -78,3 +78,6 @@ build **/.terraform/* **/.terraform **/.terragrunt-cache + +# Prisma +apps/api/src/database/client diff --git a/.prettierignore b/.prettierignore index 9927755f9a..8a72f44932 100644 --- a/.prettierignore +++ b/.prettierignore @@ -9,3 +9,4 @@ coverage apps/e2e/cypress/fixtures/* .vscode .build +apps/api/src/database/client diff --git a/apps/api/jsconfig.json b/apps/api/jsconfig.json index 3146022d2b..0f0f32b043 100644 --- a/apps/api/jsconfig.json +++ b/apps/api/jsconfig.json @@ -6,6 +6,7 @@ "paths": { "#app-test": ["./src/server/app-test.js"], "#api-constants": ["./src/server/applications/constants.js"], + "#database-client": ["./src/database/client/client.js"], "#config/*": ["./src/server/config/*"], "#infrastructure/*": ["./src/server/infrastructure/*"], "#middleware/*": ["./src/server/middleware/*"], diff --git a/apps/api/package.json b/apps/api/package.json index 7c9904e3d2..ca888f883d 100644 --- a/apps/api/package.json +++ b/apps/api/package.json @@ -6,10 +6,6 @@ "engines": { "node": ">=20.0.0 <21.0.0" }, - "prisma": { - "schema": "src/database/schema.prisma", - "seed": "node src/database/seed/seed-development.js" - }, "type": "module", "scripts": { "test": "npm run prisma-generate && cross-env NODE_ENV=test NODE_OPTIONS=\"--experimental-vm-modules --max-old-space-size=8192\" npx jest --forceExit --coverage", @@ -32,7 +28,7 @@ "db:seed:prod": "npm run prisma-generate && cross-env NODE_ENV=production node src/database/seed/seed-production.js", "db:create:gs51": "npm run prisma-generate && node src/database/seed/seed-gs51.js", "prisma:format": "npx prisma format", - "prisma-generate": "npx prisma generate", + "prisma-generate": "npx prisma generate && tsc --project src/database/client-tsconfig.json", "tscheck": "npx tsc -p jsconfig.json --maxNodeModuleJsDepth 0" }, "dependencies": { @@ -49,6 +45,7 @@ "@pins/examination-timetable-utils": "*", "@pins/platform": "*", "@prisma/instrumentation": "*", + "@prisma/adapter-mssql": "*", "@prisma/client": "*", "@supercharge/promise-pool": "*", "ajv": "*", @@ -89,12 +86,14 @@ "rimraf": "*", "supertest": "*", "swagger-autogen": "*", - "swagger-typescript-api": "*" + "swagger-typescript-api": "*", + "typescript": "*" }, "imports": { "#app-test": "./src/server/app-test.js", "#api-constants": "./src/server/applications/constants.js", - "#config/*": "./src/server/config/*", + "#database-client": "./src/database/client/client.js", + "#config/*": "./src/server/config/*", "#infrastructure/*": "./src/server/infrastructure/*", "#middleware/*": "./src/server/middleware/*", "#repositories/*": "./src/server/repositories/*", diff --git a/apps/api/prisma.config.js b/apps/api/prisma.config.js new file mode 100644 index 0000000000..af199f4cd2 --- /dev/null +++ b/apps/api/prisma.config.js @@ -0,0 +1,17 @@ +import { defineConfig } from 'prisma/config'; +import path from 'node:path'; +import dotenv from 'dotenv'; + +// load configuration from .env file into process.env +dotenv.config(); + +export default defineConfig({ + schema: path.join('src', 'database', 'schema.prisma'), + migrations: { + path: path.join('src', 'database', 'migrations'), + seed: 'node src/database/seed/seed-development.js' + }, + datasource: { + url: process.env.DATABASE_URL || '' + } +}); diff --git a/apps/api/setup-tests.js b/apps/api/setup-tests.js index 732e8b7c19..d3a5605622 100644 --- a/apps/api/setup-tests.js +++ b/apps/api/setup-tests.js @@ -397,6 +397,10 @@ class MockPrismaClient { return Array.isArray(results) ? results : []; } }); + + // see https://www.prisma.io/docs/orm/reference/prisma-client-reference#extends + // return the prisma client instance + $extends = jest.fn().mockImplementation(() => this); } const mockPrismaUse = jest.fn().mockResolvedValue(); @@ -404,15 +408,20 @@ const mockPrismaUse = jest.fn().mockResolvedValue(); MockPrismaClient.prototype.$executeRawUnsafe = mockExecuteRawUnsafe; MockPrismaClient.prototype.$use = mockPrismaUse; -class MockPrisma {} +class MockPrisma { + // see https://www.prisma.io/docs/orm/prisma-client/client-extensions + static defineExtension(func) { + func(new MockPrismaClient()); + } +} -jest.unstable_mockModule('@prisma/client', () => ({ +jest.unstable_mockModule('#database-client', () => ({ PrismaClient: MockPrismaClient, - Prisma: MockPrisma, - default: { - // PrismaClient: MockPrismaClient, - // Prisma: MockPrisma - } + Prisma: MockPrisma +})); + +jest.unstable_mockModule('@prisma/adapter-mssql', () => ({ + PrismaMssql: jest.fn() })); const mockSendEvents = jest.fn().mockImplementation(sendEvents); diff --git a/apps/api/src/database/client-tsconfig.json b/apps/api/src/database/client-tsconfig.json new file mode 100644 index 0000000000..890e489411 --- /dev/null +++ b/apps/api/src/database/client-tsconfig.json @@ -0,0 +1,12 @@ +{ + "include": ["./client/client.ts"], + "compilerOptions": { + "baseUrl": "./client", + "esModuleInterop": true, + "moduleResolution": "nodenext", + "checkJs": false, + "target": "esnext", + "module": "NodeNext", + "skipLibCheck": true + } +} diff --git a/apps/api/src/database/schema.prisma b/apps/api/src/database/schema.prisma index c539f56f84..60e881e9a4 100644 --- a/apps/api/src/database/schema.prisma +++ b/apps/api/src/database/schema.prisma @@ -1,10 +1,11 @@ generator client { - provider = "prisma-client-js" + provider = "prisma-client" + output = "./client" + importFileExtension = "js" } datasource db { provider = "sqlserver" - url = env("DATABASE_URL") } /// Case model diff --git a/apps/api/src/database/seed/data-gs51.js b/apps/api/src/database/seed/data-gs51.js index 812382e59c..11701caa73 100644 --- a/apps/api/src/database/seed/data-gs51.js +++ b/apps/api/src/database/seed/data-gs51.js @@ -3,7 +3,7 @@ import { createRepresentation } from './data-test.js'; /** * - * @param {import('@prisma/client').PrismaClient} databaseConnector + * @param {import('#database-client').PrismaClient} databaseConnector */ export const createGeneralS51Application = async (databaseConnector) => { try { diff --git a/apps/api/src/database/seed/data-static.js b/apps/api/src/database/seed/data-static.js index 94b8b84533..e7bdd496ca 100644 --- a/apps/api/src/database/seed/data-static.js +++ b/apps/api/src/database/seed/data-static.js @@ -4,10 +4,10 @@ /** * - * @typedef {import('@prisma/client').Prisma.SectorCreateInput} SectorCreateInput - * @typedef {import('@prisma/client').Prisma.RegionCreateInput} RegionCreateInput - * @typedef {import('@prisma/client').Prisma.ZoomLevelCreateInput} ZoomLevelCreateInput - * @typedef {import('@prisma/client').Prisma.ExaminationTimetableTypeCreateInput} ExaminationTimetableTypeCreateInput + * @typedef {import('#database-client').Prisma.SectorCreateInput} SectorCreateInput + * @typedef {import('#database-client').Prisma.RegionCreateInput} RegionCreateInput + * @typedef {import('#database-client').Prisma.ZoomLevelCreateInput} ZoomLevelCreateInput + * @typedef {import('#database-client').Prisma.ExaminationTimetableTypeCreateInput} ExaminationTimetableTypeCreateInput * * @typedef {{ abbreviation: string, name: string, displayNameEn: string, displayNameCy: string}} SubSectorPartial * @typedef {{ sectorName: string, subSector: SubSectorPartial}} SubSectorPartialWithSectorName @@ -490,7 +490,7 @@ export const examinationTimetableTypes = [ /** * seed static data into the database. Does not disconnect from the database or handle errors. * - * @param {import('@prisma/client').PrismaClient} databaseConnector + * @param {import('#database-client').PrismaClient} databaseConnector */ export async function seedStaticData(databaseConnector) { for (const sector of sectors) { diff --git a/apps/api/src/database/seed/data-test.js b/apps/api/src/database/seed/data-test.js index f3d314294c..cfc2638910 100644 --- a/apps/api/src/database/seed/data-test.js +++ b/apps/api/src/database/seed/data-test.js @@ -85,7 +85,7 @@ export function createRepresentation(caseReference, index, isValidStatus = false /** * * @param {number} caseId - * @returns {import('@prisma/client').Prisma.ProjectUpdateCreateManyInput} + * @returns {import('#database-client').Prisma.ProjectUpdateCreateManyInput} */ function generateProjectUpdate(caseId) { const statuses = ['draft', 'published', 'unpublished', 'archived']; @@ -98,7 +98,7 @@ function generateProjectUpdate(caseId) { ]; const dates = oneDatePerMonth(); /** - * @type {import('@prisma/client').Prisma.ProjectUpdateCreateManyInput} + * @type {import('#database-client').Prisma.ProjectUpdateCreateManyInput} */ const projectUpdate = { caseId, @@ -114,9 +114,9 @@ function generateProjectUpdate(caseId) { } /** - * @param {import('@prisma/client').PrismaClient} databaseConnector + * @param {import('#database-client').PrismaClient} databaseConnector * @param {number} caseId - * @returns {Promise} + * @returns {Promise} */ function createProjectUpdates(databaseConnector, caseId) { const numUpdates = pseudoRandomInt(0, 28); @@ -131,7 +131,7 @@ function createProjectUpdates(databaseConnector, caseId) { /** * - * @param {import('@prisma/client').PrismaClient} databaseConnector + * @param {import('#database-client').PrismaClient} databaseConnector * @param {{name: string, abbreviation: string, displayNameEn: string}} subSector * @param {number} index */ @@ -214,7 +214,7 @@ const createApplication = async (databaseConnector, subSector, index) => { }; /** - * @param {import('@prisma/client').PrismaClient} databaseConnector + * @param {import('#database-client').PrismaClient} databaseConnector */ export async function seedTestData(databaseConnector) { // now create some sample applications diff --git a/apps/api/src/database/seed/seed-clear.js b/apps/api/src/database/seed/seed-clear.js index 2e092cd1a0..1e2c3fffd3 100644 --- a/apps/api/src/database/seed/seed-clear.js +++ b/apps/api/src/database/seed/seed-clear.js @@ -3,7 +3,7 @@ import { truncateTable } from '../prisma.truncate.js'; /** * Seeding function to clear down a database, deletes all cases, documents, records, reference tables, etc * - * @param {import('@prisma/client').PrismaClient} databaseConnector + * @param {import('#database-client').PrismaClient} databaseConnector */ export async function deleteAllRecords(databaseConnector) { const deleteCases = databaseConnector.case.deleteMany(); diff --git a/apps/api/src/database/seed/seed-development.js b/apps/api/src/database/seed/seed-development.js index d2aaec7bf3..2a3ddeee17 100644 --- a/apps/api/src/database/seed/seed-development.js +++ b/apps/api/src/database/seed/seed-development.js @@ -1,3 +1,6 @@ +// Set NODE_ENV before importing any modules that depend on it +process.env.NODE_ENV = 'seeding'; + import { databaseConnector } from '#utils/database-connector.js'; import { seedStaticData } from './data-static.js'; import { seedTestData } from './data-test.js'; @@ -11,14 +14,19 @@ import { deleteAllRecords } from './seed-clear.js'; * @returns {Promise} */ const seedDevelopment = async () => { - process.env.NODE_ENV = 'seeding'; try { - await deleteAllRecords(databaseConnector); + // Check if database is empty first + const caseCount = await databaseConnector.case.count(); + + if (caseCount > 0) { + await deleteAllRecords(databaseConnector); + } + await seedStaticData(databaseConnector); await seedTestData(databaseConnector); await createGeneralS51Application(databaseConnector); } catch (error) { - console.error(error); + console.error('Error during seeding:', error); throw error; } finally { await databaseConnector.$disconnect(); diff --git a/apps/api/src/server/applications/application/documents/document.controller.js b/apps/api/src/server/applications/application/documents/document.controller.js index 16e799f1cf..59a893b1f8 100644 --- a/apps/api/src/server/applications/application/documents/document.controller.js +++ b/apps/api/src/server/applications/application/documents/document.controller.js @@ -35,8 +35,8 @@ import { import { validateDocumentVersionMetadataBody } from './document.validators.js'; /** - * @typedef {import('@prisma/client').Document} Document - * @typedef {import('@prisma/client').DocumentVersion} DocumentVersion + * @typedef {import('#database-client').Document} Document + * @typedef {import('#database-client').DocumentVersion} DocumentVersion * @typedef {import('@pins/applications.api').Schema.DocumentDetails} DocumentDetails * @typedef {import('@pins/applications.api').Schema.DocumentVersionWithDocument} DocumentVersionWithDocument * @typedef {import('@pins/applications.api').Api.DocumentToSave} DocumentToSave diff --git a/apps/api/src/server/applications/application/documents/document.service.js b/apps/api/src/server/applications/application/documents/document.service.js index bae5fcca58..0e90566279 100644 --- a/apps/api/src/server/applications/application/documents/document.service.js +++ b/apps/api/src/server/applications/application/documents/document.service.js @@ -29,10 +29,10 @@ import { getApplicationDocumentsFolderName } from '#utils/mapping/map-document-f import { handleCreationOfDocumentActivityLogs } from '../../../migration/migrators/nsip-document-migrator.js'; /** - * @typedef {import('@prisma/client').DocumentVersion} DocumentVersion - * @typedef {import('@prisma/client').Document} Document - * @typedef {import('@prisma/client').Document & {documentName: string}} DocumentWithDocumentName - * @typedef {import('@prisma/client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder + * @typedef {import('#database-client').DocumentVersion} DocumentVersion + * @typedef {import('#database-client').Document} Document + * @typedef {import('#database-client').Document & {documentName: string}} DocumentWithDocumentName + * @typedef {import('#database-client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder * @typedef {import('@pins/applications.api').Schema.DocumentDetails} DocumentDetails * @typedef {import('@pins/applications.api').Schema.DocumentVersionWithDocument} DocumentVersionWithDocument * @typedef {import('@pins/applications.api').Api.DocumentAndBlobInfoManyResponse} DocumentAndBlobInfoManyResponse @@ -359,7 +359,7 @@ export const createDocuments = async (documentsToUpload, caseId, isS51, tx) => { tx ); - /** @type {Promise[]} */ + /** @type {Promise[]} */ // TODO: refactor to use createMany instead? const documentActivityLogs = requestToGetDocumentStorageProperties.map((document) => documentActivityLogRepository.create( diff --git a/apps/api/src/server/applications/application/documents/document.validators.js b/apps/api/src/server/applications/application/documents/document.validators.js index 0b529cfc3f..283bd81e19 100644 --- a/apps/api/src/server/applications/application/documents/document.validators.js +++ b/apps/api/src/server/applications/application/documents/document.validators.js @@ -18,8 +18,8 @@ import { featureFlagClient } from '#utils/feature-flags.js'; /** @typedef {{ guid: string}} documentGuid */ /** - * @typedef {import('@prisma/client').DocumentVersion} DocumentVersion - * @typedef {import('@prisma/client').Document} Document + * @typedef {import('#database-client').DocumentVersion} DocumentVersion + * @typedef {import('#database-client').Document} Document * @typedef {import('@pins/applications.api').Api.DocumentVersionUpsertRequestBody} DocumentVersionUpsertRequestBody * @typedef {import('@pins/applications.api').Schema.DocumentVersionUpsertInput} DocumentVersionUpsertInput */ diff --git a/apps/api/src/server/applications/application/project-updates/__tests__/project-updates.test.js b/apps/api/src/server/applications/application/project-updates/__tests__/project-updates.test.js index 7665d0a93b..b6a081b181 100644 --- a/apps/api/src/server/applications/application/project-updates/__tests__/project-updates.test.js +++ b/apps/api/src/server/applications/application/project-updates/__tests__/project-updates.test.js @@ -20,7 +20,7 @@ import { mockApplicationGet } from '#utils/application-factory-for-tests.js'; /** * @param {Date} now - * @returns {(caseId: number) => import('@prisma/client').ProjectUpdate} + * @returns {(caseId: number) => import('#database-client').ProjectUpdate} */ const makeDummyProjectUpdate = (now) => (caseId) => ({ id: 1, diff --git a/apps/api/src/server/applications/application/project-updates/notification-logs/__tests__/notification-logs.test.js b/apps/api/src/server/applications/application/project-updates/notification-logs/__tests__/notification-logs.test.js index 25fa8c1698..e585ce478b 100644 --- a/apps/api/src/server/applications/application/project-updates/notification-logs/__tests__/notification-logs.test.js +++ b/apps/api/src/server/applications/application/project-updates/notification-logs/__tests__/notification-logs.test.js @@ -9,7 +9,7 @@ describe('notification-logs', () => { describe('get', () => { /** * @param {number} projectUpdateId - * @returns {import('@prisma/client').ProjectUpdateNotificationLog} + * @returns {import('#database-client').ProjectUpdateNotificationLog} */ const dummyLog = (projectUpdateId) => { return { diff --git a/apps/api/src/server/applications/application/representations/attachment/attachment.controller.js b/apps/api/src/server/applications/application/representations/attachment/attachment.controller.js index af062c0f12..8250031e55 100644 --- a/apps/api/src/server/applications/application/representations/attachment/attachment.controller.js +++ b/apps/api/src/server/applications/application/representations/attachment/attachment.controller.js @@ -2,7 +2,7 @@ import { addAttachmentRepresentation, deleteAttachmentRepresentation } from './attachment.service.js'; -import { Prisma } from '@prisma/client'; +import { Prisma } from '#database-client'; const prismaUniqueConstraintFailedCode = 'P2002'; /** diff --git a/apps/api/src/server/applications/examination-timetable-items/examination-timetable-items.service.js b/apps/api/src/server/applications/examination-timetable-items/examination-timetable-items.service.js index 6af875d7a4..59ade2613b 100644 --- a/apps/api/src/server/applications/examination-timetable-items/examination-timetable-items.service.js +++ b/apps/api/src/server/applications/examination-timetable-items/examination-timetable-items.service.js @@ -16,14 +16,14 @@ import { verifyNotTraining } from '../application/application.validators.js'; * @typedef {import('@planning-inspectorate/data-model').Schemas.Event} NSIPExamTimetableItem * @typedef {import('@planning-inspectorate/data-model').Schemas.ExaminationTimetable} NSIPExamTimetable * @typedef {import('@pins/applications.api').Schema.Folder} Folder - * @typedef {import('@prisma/client').Prisma.ExaminationTimetableItemGetPayload<{include: {ExaminationTimetableType: true} }>} ExaminationTimetableItemWithType + * @typedef {import('#database-client').Prisma.ExaminationTimetableItemGetPayload<{include: {ExaminationTimetableType: true} }>} ExaminationTimetableItemWithType */ /** * Grabs the description and event line items from the examinationTimetableItem and parses them into a description string and * NSIPExamTimetableItemDescriptionLineItem array when the categoryType is Deadline * - * @param {import('@prisma/client').ExaminationTimetableItem} examinationTimetableItem + * @param {import('#database-client').ExaminationTimetableItem} examinationTimetableItem * @returns { { description: string, descriptionWelsh: string, eventLineItems: { description: string, descriptionWelsh: string }[] | string } } */ function extractDescriptionAndLineItems(examinationTimetableItem) { @@ -315,7 +315,7 @@ export const deleteDeadlineSubFolders = async (caseId, parentFolderId) => { /** * - * @param {import('@prisma/client').ExaminationTimetableItem} timetableItem + * @param {import('#database-client').ExaminationTimetableItem} timetableItem * @param {number} caseId * @returns {Promise} */ diff --git a/apps/api/src/server/applications/s51advice/s51-advice.service.js b/apps/api/src/server/applications/s51advice/s51-advice.service.js index 0bc6642d5c..daa06cfc33 100644 --- a/apps/api/src/server/applications/s51advice/s51-advice.service.js +++ b/apps/api/src/server/applications/s51advice/s51-advice.service.js @@ -20,7 +20,7 @@ import { * @typedef {import('@pins/applications').S51AdviceDetails} S51AdviceDetails * @typedef {import('@pins/applications.api').Schema.S51Advice} S51Advice * @typedef {import('@pins/applications.api').Schema.S51AdviceDocument} S51AdviceDocument - * @typedef {import('@prisma/client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments + * @typedef {import('#database-client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments * @typedef {import('@pins/applications.api').Api.DocumentAndBlobInfoManyResponse} DocumentAndBlobInfoManyResponse * @typedef {{ page: number, pageDefaultSize: number, pageCount: number, itemCount: number, items: S51AdviceDetails[]}} S51AdvicePaginatedDetails */ diff --git a/apps/api/src/server/applications/subscriptions/__tests__/subscriptions.test.js b/apps/api/src/server/applications/subscriptions/__tests__/subscriptions.test.js index 1bae71d7c7..f8dfea281f 100644 --- a/apps/api/src/server/applications/subscriptions/__tests__/subscriptions.test.js +++ b/apps/api/src/server/applications/subscriptions/__tests__/subscriptions.test.js @@ -85,7 +85,7 @@ describe('subscriptions', () => { describe('get (list)', () => { /** * - * @returns {import('@prisma/client').Subscription} + * @returns {import('#database-client').Subscription} */ const dummySubscription = () => { return { @@ -665,7 +665,7 @@ describe('subscriptions', () => { * @typedef {Object} Test * @property {string} name * @property {*} request - * @property {import('@prisma/client').Prisma.SubscriptionCreateInput} want + * @property {import('#database-client').Prisma.SubscriptionCreateInput} want */ /** @type {Test[]} */ const tests = [ diff --git a/apps/api/src/server/applications/subscriptions/subscriptions.controller.js b/apps/api/src/server/applications/subscriptions/subscriptions.controller.js index 2b09524a94..f5a2ab0c88 100644 --- a/apps/api/src/server/applications/subscriptions/subscriptions.controller.js +++ b/apps/api/src/server/applications/subscriptions/subscriptions.controller.js @@ -113,7 +113,7 @@ export async function updateSubscription(request, response) { const endDate = new Date(body.endDate); - /** @type {import('@prisma/client').Prisma.SubscriptionUpdateInput} */ + /** @type {import('#database-client').Prisma.SubscriptionUpdateInput} */ const subscription = { endDate }; diff --git a/apps/api/src/server/applications/subscriptions/subscriptions.service.js b/apps/api/src/server/applications/subscriptions/subscriptions.service.js index 1d81c09500..49a5ec93a2 100644 --- a/apps/api/src/server/applications/subscriptions/subscriptions.service.js +++ b/apps/api/src/server/applications/subscriptions/subscriptions.service.js @@ -90,13 +90,13 @@ export async function createOrUpdateSubscription(request) { /** * @param {any} request - * @returns {Promise<{isExistingUser: boolean, subscription: import('@prisma/client').Prisma.SubscriptionCreateInput}>} + * @returns {Promise<{isExistingUser: boolean, subscription: import('#database-client').Prisma.SubscriptionCreateInput}>} */ export async function prepareInput(request) { const emailAddress = request.emailAddress; const existingServiceUser = await serviceUserRepository.findByEmail(request.emailAddress); - /** @type {import('@prisma/client').Prisma.SubscriptionCreateInput} */ + /** @type {import('#database-client').Prisma.SubscriptionCreateInput} */ let subscription = { caseReference: request.caseReference, serviceUser: existingServiceUser diff --git a/apps/api/src/server/infrastructure/event-broadcasters.js b/apps/api/src/server/infrastructure/event-broadcasters.js index f926b567a9..73e6bf2db3 100644 --- a/apps/api/src/server/infrastructure/event-broadcasters.js +++ b/apps/api/src/server/infrastructure/event-broadcasters.js @@ -35,9 +35,9 @@ const applicant = 'Applicant'; /** * @typedef {import('@pins/applications.api').Schema.S51Advice} S51Advice - * @typedef {import('@prisma/client').Prisma.RepresentationGetPayload<{include: {case: true, user: true, represented: true, representative: true, attachments: true, representationActions: true} }>} RepresentationWithFullDetails - * @typedef {import('@prisma/client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder - * @typedef {import('@prisma/client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments + * @typedef {import('#database-client').Prisma.RepresentationGetPayload<{include: {case: true, user: true, represented: true, representative: true, attachments: true, representationActions: true} }>} RepresentationWithFullDetails + * @typedef {import('#database-client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder + * @typedef {import('#database-client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments */ /** diff --git a/apps/api/src/server/infrastructure/payload-builders/nsip-document.js b/apps/api/src/server/infrastructure/payload-builders/nsip-document.js index 8fdd16d937..6bd67a1f78 100644 --- a/apps/api/src/server/infrastructure/payload-builders/nsip-document.js +++ b/apps/api/src/server/infrastructure/payload-builders/nsip-document.js @@ -9,7 +9,7 @@ const NSIP_CASETYPE = 'nsip'; /** * @typedef {import('@planning-inspectorate/data-model').Schemas.NSIPDocument} NSIPDocumentSchema - * @typedef {import('@prisma/client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder + * @typedef {import('#database-client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder */ /** diff --git a/apps/api/src/server/infrastructure/payload-builders/nsip-project-update.js b/apps/api/src/server/infrastructure/payload-builders/nsip-project-update.js index 1b931d4bb4..87b1b0e940 100644 --- a/apps/api/src/server/infrastructure/payload-builders/nsip-project-update.js +++ b/apps/api/src/server/infrastructure/payload-builders/nsip-project-update.js @@ -5,7 +5,7 @@ import BackOfficeAppError from '#utils/app-error.js'; /** * Map a project update from the database to the type returned by the API * - * @param {import('@prisma/client').ProjectUpdate} projectUpdate + * @param {import('#database-client').ProjectUpdate} projectUpdate * @returns {import('@pins/applications').ProjectUpdate} */ export function mapProjectUpdate(projectUpdate) { @@ -40,7 +40,7 @@ export function mapProjectUpdate(projectUpdate) { /** * Create a payload (event) for the given update * - * @param {import('@prisma/client').ProjectUpdate} update + * @param {import('#database-client').ProjectUpdate} update * @param {string} caseReference * @returns {NSIPProjectUpdate} * @throws {Error} if the HTML content isn't safe @@ -82,10 +82,10 @@ export function buildProjectUpdatePayload(update, caseReference) { * * @param {*} body * @param {number} caseId - * @returns {import('@prisma/client').Prisma.ProjectUpdateCreateInput} + * @returns {import('#database-client').Prisma.ProjectUpdateCreateInput} */ export function projectUpdateCreateReq(body, caseId) { - /** @type {import('@prisma/client').Prisma.ProjectUpdateCreateInput} */ + /** @type {import('#database-client').Prisma.ProjectUpdateCreateInput} */ const createReq = { emailSubscribers: body.emailSubscribers, status: body.status, @@ -117,10 +117,10 @@ export function projectUpdateCreateReq(body, caseId) { * Map a request body to a update request object, and sanitise the HTML * * @param {*} body - * @returns {import('@prisma/client').Prisma.ProjectUpdateUpdateInput} + * @returns {import('#database-client').Prisma.ProjectUpdateUpdateInput} */ export function projectUpdateUpdateReq(body) { - /** @type {import('@prisma/client').Prisma.ProjectUpdateUpdateInput} */ + /** @type {import('#database-client').Prisma.ProjectUpdateUpdateInput} */ const updateReq = {}; if (Object.prototype.hasOwnProperty.call(body, 'emailSubscribers')) { updateReq.emailSubscribers = body.emailSubscribers; diff --git a/apps/api/src/server/infrastructure/payload-builders/nsip-representation.js b/apps/api/src/server/infrastructure/payload-builders/nsip-representation.js index 9d7611de64..271e2186e2 100644 --- a/apps/api/src/server/infrastructure/payload-builders/nsip-representation.js +++ b/apps/api/src/server/infrastructure/payload-builders/nsip-representation.js @@ -2,7 +2,7 @@ * @typedef {import('@planning-inspectorate/data-model').Schemas.Representation} NSIPRepresentationSchema * @typedef {import('@planning-inspectorate/data-model').Schemas.ServiceUser} ServiceUserSchema * - * @typedef {import('@prisma/client').Prisma.RepresentationGetPayload<{include: {case: true, user: true, represented: true, representative: true, attachments: true, representationActions: true} }>} RepresentationWithFullDetails + * @typedef {import('#database-client').Prisma.RepresentationGetPayload<{include: {case: true, user: true, represented: true, representative: true, attachments: true, representationActions: true} }>} RepresentationWithFullDetails * @typedef {import('@pins/applications.api').Schema.ServiceUser} ServiceUser */ diff --git a/apps/api/src/server/infrastructure/payload-builders/nsip-s51-advice.js b/apps/api/src/server/infrastructure/payload-builders/nsip-s51-advice.js index b714a1ea44..f19a730275 100644 --- a/apps/api/src/server/infrastructure/payload-builders/nsip-s51-advice.js +++ b/apps/api/src/server/infrastructure/payload-builders/nsip-s51-advice.js @@ -7,7 +7,7 @@ import { getById as getCaseById } from '#repositories/case.repository.js'; /** * @typedef {import('@planning-inspectorate/data-model').Schemas.S51Advice} NSIPS51AdviceSchema - * @typedef {import('@prisma/client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments + * @typedef {import('#database-client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments * @typedef {'phone' | 'email' | 'meeting' | 'post'} Method * @typedef {'checked' | 'unchecked' | 'readytopublish' | 'published' | 'donotpublish'} Status * @typedef {'unredacted' | 'redacted'} RedactionStatus diff --git a/apps/api/src/server/infrastructure/payload-builders/nsip-subscription.js b/apps/api/src/server/infrastructure/payload-builders/nsip-subscription.js index c6eabbb01f..76f95d3ddb 100644 --- a/apps/api/src/server/infrastructure/payload-builders/nsip-subscription.js +++ b/apps/api/src/server/infrastructure/payload-builders/nsip-subscription.js @@ -10,7 +10,7 @@ import { EventType } from '@pins/event-client'; /** * Convert from the subscription database type to the subscription response type * - * @param {import('@prisma/client').Subscription} subscription + * @param {import('#database-client').Subscription} subscription * @returns {import('@pins/applications').Subscription} */ export function subscriptionToResponse(subscription) { @@ -27,7 +27,7 @@ export function subscriptionToResponse(subscription) { * Create a payload (event) for each subscription type for this subscription. * Each subscription type is it's own message/event. * - * @param {import('@prisma/client').Subscription} subscription + * @param {import('#database-client').Subscription} subscription * @returns {NSIPSubscription[]} */ export function buildSubscriptionPayloads(subscription) { @@ -71,7 +71,7 @@ export function buildSubscriptionBasePayload(subscription) { } /** - * @param {import('@prisma/client').Subscription} subscription + * @param {import('#database-client').Subscription} subscription * @returns {SubscriptionType[]} */ export function subscriptionToTypes(subscription) { @@ -100,7 +100,7 @@ export function subscriptionToTypes(subscription) { * @param {SubscriptionType[]} types * @param {T} subscription * @returns {T} - * @template {import('@prisma/client').Prisma.SubscriptionCreateInput|import('@prisma/client').Prisma.SubscriptionUncheckedCreateInput} T + * @template {import('#database-client').Prisma.SubscriptionCreateInput|import('#database-client').Prisma.SubscriptionUncheckedCreateInput} T */ export function typesToSubscription(types, subscription) { const _subscription = { @@ -144,8 +144,8 @@ export function typesToSubscription(types, subscription) { * For example, if a subscription is updated to add an "applicationDecided" subscription, * a Create event will be sent for that, and an Update event for any existing subscriptions. * - * @param {import('@prisma/client').Subscription} existingSub - * @param {import('@prisma/client').Subscription} newSub + * @param {import('#database-client').Subscription} existingSub + * @param {import('#database-client').Subscription} newSub * @returns {EventsByType} */ export function subscriptionTypeChanges(existingSub, newSub) { diff --git a/apps/api/src/server/migration/migrators/nsip-document-migrator.js b/apps/api/src/server/migration/migrators/nsip-document-migrator.js index f818d06f82..3b65fb1939 100644 --- a/apps/api/src/server/migration/migrators/nsip-document-migrator.js +++ b/apps/api/src/server/migration/migrators/nsip-document-migrator.js @@ -168,7 +168,7 @@ export const handleCreationOfDocumentActivityLogs = async (documentVersion) => { const createDocumentActivityLog = async ({ documentGuid, version, status, activityDate }) => { /** - * @type {import("@prisma/client").Prisma.DocumentActivityLogCreateInput} + * @type {import("#database-client").Prisma.DocumentActivityLogCreateInput} */ const activityLog = { documentGuid, diff --git a/apps/api/src/server/migration/migrators/nsip-exam-timetable-migrator.js b/apps/api/src/server/migration/migrators/nsip-exam-timetable-migrator.js index 409033096d..efad1d7c66 100644 --- a/apps/api/src/server/migration/migrators/nsip-exam-timetable-migrator.js +++ b/apps/api/src/server/migration/migrators/nsip-exam-timetable-migrator.js @@ -91,7 +91,7 @@ const getExamTimetableFolderId = async (caseId) => { /** * * @param {import("@planning-inspectorate/data-model").Schemas.ExaminationTimetable} model - * @returns {Promise} + * @returns {Promise} */ const mapModelToTimetableEntity = async ({ caseReference }) => { const caseId = await getCaseIdFromRef(caseReference); @@ -109,7 +109,7 @@ const mapModelToTimetableEntity = async ({ caseReference }) => { * @param {number} examinationTimetableId * @param {number} examTimetableFolderId * @param {import("@planning-inspectorate/data-model").Schemas.Event} model - * @returns {Promise} + * @returns {Promise} */ const mapModelToEventEntity = async ( examinationTimetableId, diff --git a/apps/api/src/server/migration/migrators/nsip-project-update-migrator.js b/apps/api/src/server/migration/migrators/nsip-project-update-migrator.js index e5709b7e06..e115418b1f 100644 --- a/apps/api/src/server/migration/migrators/nsip-project-update-migrator.js +++ b/apps/api/src/server/migration/migrators/nsip-project-update-migrator.js @@ -93,7 +93,7 @@ const buildEventPayloads = async (projectUpdateIds) => { * * @param {NSIPProjectUpdateMigrateModel} m * - * @returns {Promise} projectUpdate + * @returns {Promise} projectUpdate */ const mapModelToEntity = async (m) => { const caseId = await getCaseIdFromRef(m.caseReference); diff --git a/apps/api/src/server/migration/migrators/nsip-subscription-migrator.js b/apps/api/src/server/migration/migrators/nsip-subscription-migrator.js index 663508c7fb..987f23f445 100644 --- a/apps/api/src/server/migration/migrators/nsip-subscription-migrator.js +++ b/apps/api/src/server/migration/migrators/nsip-subscription-migrator.js @@ -125,7 +125,7 @@ const mapSubscriptionsToSubscribers = (subscriptions) => { /** * * @param {NSIPSubscriber} m - * @returns {Promise} + * @returns {Promise} */ const mapModelToEntity = async (m) => { const caseId = await getCaseIdFromRef(m.caseReference); diff --git a/apps/api/src/server/repositories/__tests__/subscription.repository.test.js b/apps/api/src/server/repositories/__tests__/subscription.repository.test.js index 5763dd8cba..a7637045fb 100644 --- a/apps/api/src/server/repositories/__tests__/subscription.repository.test.js +++ b/apps/api/src/server/repositories/__tests__/subscription.repository.test.js @@ -7,8 +7,8 @@ describe('subscription-repository', () => { * @typedef {Object} SubTest * @property {string} name * @property {string} type - * @property {import('@prisma/client').Prisma.SubscriptionWhereInput} where - * @property {import('@prisma/client').Prisma.SubscriptionWhereInput} want + * @property {import('#database-client').Prisma.SubscriptionWhereInput} where + * @property {import('#database-client').Prisma.SubscriptionWhereInput} want */ /** * @type {SubTest[]} diff --git a/apps/api/src/server/repositories/case.repository.js b/apps/api/src/server/repositories/case.repository.js index 03400347bb..f9c7910e15 100644 --- a/apps/api/src/server/repositories/case.repository.js +++ b/apps/api/src/server/repositories/case.repository.js @@ -80,7 +80,7 @@ export const buildTrainingCasesWhereClause = () => { /** * @param {string[]} statusArray - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getByStatus = (statusArray) => { return databaseConnector.case.findMany({ @@ -125,7 +125,7 @@ export const getByStatus = (statusArray) => { * @param {string} query * @param {number} skipValue * @param {number} pageSize - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getBySearchCriteria = (query, skipValue, pageSize) => { const terms = getSearchTermArrayExcludingStopWords(query); @@ -183,7 +183,7 @@ export const getBySearchCriteria = (query, skipValue, pageSize) => { /** * @param {string} query - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getApplicationsCountBySearchCriteria = (query) => { const terms = getSearchTermArrayExcludingStopWords(query); @@ -218,7 +218,7 @@ export const getApplicationsCountBySearchCriteria = (query) => { /** * @param {CreateApplicationParams} caseInfo - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const createApplication = ({ caseDetails, @@ -271,7 +271,7 @@ export const createApplication = ({ * The applicationDetailsId is passed in - which may not necessarily be the caseId * * @param {number} applicationDetailsId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ const removeRegions = (applicationDetailsId) => { return databaseConnector.regionsOnApplicationDetails.deleteMany({ @@ -454,7 +454,7 @@ export const updateApplication = async ({ /** * @param {{ caseId: number }} _ - * @returns {Promise>} + * @returns {Promise>} */ export const publishCase = async ({ caseId }) => { await databaseConnector.case.update({ @@ -487,7 +487,7 @@ export const publishCase = async ({ caseId }) => { /** * @param {{ caseId: number }} _ - * @returns {Promise>} + * @returns {Promise>} */ export const unpublishCase = async ({ caseId }) => { await databaseConnector.case.update({ @@ -521,7 +521,7 @@ export const unpublishCase = async ({ caseId }) => { * * @param {number} id * @param {{subSector?: boolean, sector?: boolean, applicationDetails?: boolean, zoomLevel?: boolean, regions?: boolean, caseStatus?: boolean, casePublishedState?: boolean, applicant?: boolean, gridReference?: boolean, projectTeam?: boolean}} inclusions - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getById = ( id, @@ -581,7 +581,7 @@ export const getById = ( /** * @param {string} reference - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} * */ export const getByRef = (reference) => { return databaseConnector.case.findFirst({ @@ -592,7 +592,7 @@ export const getByRef = (reference) => { /** * * @param {number[]} ids - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ const invalidateCaseStatuses = (ids) => { return databaseConnector.caseStatus.updateMany({ @@ -605,7 +605,7 @@ const invalidateCaseStatuses = (ids) => { * * @param {number} id * @param {string} status - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ const createNewStatuses = (id, status) => { return isString(status) @@ -618,7 +618,7 @@ const createNewStatuses = (id, status) => { * @param {number} id * @param {number |undefined} applicationDetailsId * @param {{status: string | object, data: {regionNames?: string[]}, currentStatuses: object[], setReference: boolean}} updateData - * @param {import('@prisma/client').PrismaPromise[]} additionalTransactions + * @param {import('#database-client').PrismaPromise[]} additionalTransactions * @returns {Promise} */ export const updateApplicationStatusAndDataById = async ( @@ -632,7 +632,7 @@ export const updateApplicationStatusAndDataById = async ( currentStatuses ); - /** @type {import('@prisma/client').PrismaPromise[]} */ const transactions = [ + /** @type {import('#database-client').PrismaPromise[]} */ const transactions = [ invalidateCaseStatuses(caseStatesToInvalidate), createNewStatuses(id, caseStatesToCreate) ]; @@ -705,7 +705,7 @@ const replaceValueInString = (inputString, keysToReplace) => { /** * * @param {number} id - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ const assignApplicationReference = (id) => { const sqlQueryAbsolutePath = getSqlQuery('update-application-reference'); diff --git a/apps/api/src/server/repositories/document-activity-log.repository.js b/apps/api/src/server/repositories/document-activity-log.repository.js index 10666f83c5..e1d7f997e3 100644 --- a/apps/api/src/server/repositories/document-activity-log.repository.js +++ b/apps/api/src/server/repositories/document-activity-log.repository.js @@ -3,9 +3,9 @@ import { databaseConnector } from '#utils/database-connector.js'; /** * - * @param {import('@prisma/client').Prisma.DocumentActivityLogUncheckedCreateInput} documentLog - * @param {import('@prisma/client').Prisma.TransactionClient} [tx] - Optional transaction client - * @returns {Promise} + * @param {import('#database-client').Prisma.DocumentActivityLogUncheckedCreateInput} documentLog + * @param {import('#database-client').Prisma.TransactionClient} [tx] - Optional transaction client + * @returns {Promise} */ export const create = (documentLog, tx = databaseConnector) => { return tx.documentActivityLog.create({ diff --git a/apps/api/src/server/repositories/document-metadata.repository.js b/apps/api/src/server/repositories/document-metadata.repository.js index 32a2a185bd..a351d929ee 100644 --- a/apps/api/src/server/repositories/document-metadata.repository.js +++ b/apps/api/src/server/repositories/document-metadata.repository.js @@ -3,11 +3,11 @@ import config from '#config/config.js'; import { isTrainingCase } from '#utils/is-training-case.js'; /** - * @typedef {import('@prisma/client').Document} Document - * @typedef {import('@prisma/client').DocumentVersion} DocumentVersion + * @typedef {import('#database-client').Document} Document + * @typedef {import('#database-client').DocumentVersion} DocumentVersion * @typedef {import('@pins/applications.api').Schema.DocumentVersionWithDocument} DocumentVersionWithDocument * @typedef {import('@pins/applications.api').Schema.DocumentUpdateInput} DocumentUpdateInput - * @typedef {import('@prisma/client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder + * @typedef {import('#database-client').Prisma.DocumentVersionGetPayload<{include: {Document: {include: {folder: {include: {case: {include: {CaseStatus: true}}}}}}}}> } DocumentVersionWithDocumentAndFolder * */ @@ -61,8 +61,8 @@ const includeClauseDocVersionFullWithSector = { /** * @param {DocumentVersion} metadata - * @param {import('@prisma/client').Prisma.TransactionClient} [tx] - Optional transaction client - * @returns {import('@prisma/client').PrismaPromise} + * @param {import('#database-client').Prisma.TransactionClient} [tx] - Optional transaction client + * @returns {import('#database-client').PrismaPromise} */ export const upsert = ( { documentGuid, version = 1, transcriptGuid, ...metadata }, @@ -92,7 +92,7 @@ export const upsert = ( * @param {string} documentGuid * @param {int} version * @param {DocumentVersion} metadata - * @returns {import('@prisma/client').PrismaPromise} */ + * @returns {import('#database-client').PrismaPromise} */ export const updateDocumentVersion = async (documentGuid, version, metadata) => { return databaseConnector.documentVersion.update({ where: { documentGuid_version: { documentGuid, version } }, @@ -103,7 +103,7 @@ export const updateDocumentVersion = async (documentGuid, version, metadata) => /** * * @param {{guid: string, status: string, version?: number }} documentStatusUpdate - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const updateDocumentStatus = ({ guid, status, version = 1 }) => { return databaseConnector.documentVersion.update({ @@ -116,7 +116,7 @@ export const updateDocumentStatus = ({ guid, status, version = 1 }) => { /** * @param {{guid: string, status: string, version?: number, datePublished?: Date }} documentStatusUpdate - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const updateDocumentPublishedStatus = ({ guid, status, version = 1, datePublished }) => { return databaseConnector.documentVersion.update({ @@ -132,7 +132,7 @@ export const updateDocumentPublishedStatus = ({ guid, status, version = 1, dateP * * @param {string} documentGuid * @param {number} version - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getById = (documentGuid, version = 1) => { return databaseConnector.documentVersion.findUnique({ @@ -160,7 +160,7 @@ export const getById = (documentGuid, version = 1) => { * * @param {string[]} documentGuids * @param {string} [publishedStatus] - * @returns {import('@prisma/client').PrismaPromise>} + * @returns {import('#database-client').PrismaPromise>} */ export const getManyByIdAndStatus = (documentGuids, publishedStatus) => { return databaseConnector.documentVersion.findMany({ @@ -177,7 +177,7 @@ export const getManyByIdAndStatus = (documentGuids, publishedStatus) => { /** * Get all document metadata * - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getAll = () => { return databaseConnector.documentVersion.findMany(); @@ -187,7 +187,7 @@ export const getAll = () => { * Get 'all' published versions of a document (there should only be one) * * @param {string} documentGuid - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} * */ export const getPublished = (documentGuid) => { return databaseConnector.documentVersion.findMany({ @@ -199,7 +199,7 @@ export const getPublished = (documentGuid) => { * Get all document metadata * * @param {string} guid - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getAllByDocumentGuid = (guid) => { return databaseConnector.documentVersion.findMany({ @@ -214,7 +214,7 @@ export const getAllByDocumentGuid = (guid) => { * * @param {string} documentGuid * @param {import('@pins/applications.api').Schema.DocumentVersionUpdateInput} documentDetails - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const update = (documentGuid, { version = 1, ...documentDetails }) => { return databaseConnector.documentVersion.update({ diff --git a/apps/api/src/server/repositories/document.repository.js b/apps/api/src/server/repositories/document.repository.js index f73dc8b1f5..ad81312163 100644 --- a/apps/api/src/server/repositories/document.repository.js +++ b/apps/api/src/server/repositories/document.repository.js @@ -3,8 +3,8 @@ import { getFileNameWithoutSuffix } from '../applications/application/documents/ import { withRetry } from '#utils/query-with-retry.js'; /** - * @typedef {import('@prisma/client').Document} Document - * @typedef {import('@prisma/client').Prisma.DocumentGetPayload<{include: {documentVersion: true }}>} DocumentWithDocumentVersion + * @typedef {import('#database-client').Document} Document + * @typedef {import('#database-client').Prisma.DocumentGetPayload<{include: {documentVersion: true }}>} DocumentWithDocumentVersion */ /** @typedef {Object} LatestDocumentVersion @@ -18,9 +18,9 @@ import { withRetry } from '#utils/query-with-retry.js'; * Create a new Document record * - * @param {import('@prisma/client').Prisma.DocumentUncheckedCreateInput} document - * @param {import('@prisma/client').Prisma.TransactionClient} [tx] - Optional transaction client or default to databaseConnector - * @returns {import('@prisma/client').PrismaPromise} + * @param {import('#database-client').Prisma.DocumentUncheckedCreateInput} document + * @param {import('#database-client').Prisma.TransactionClient} [tx] - Optional transaction client or default to databaseConnector + * @returns {import('#database-client').PrismaPromise} */ export const create = (document, tx = databaseConnector) => { return tx.document.create({ @@ -32,7 +32,7 @@ export const create = (document, tx = databaseConnector) => { * Get a document by documentGuid * * @param {string} documentGuid - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getById = (documentGuid) => { return databaseConnector.document.findUnique({ @@ -46,7 +46,7 @@ export const getById = (documentGuid) => { * Get a paginated array of documents by caseid * * @param {{ caseId: number, skipValue?: number, pageSize?: number }} _ - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getByCaseId = ({ caseId, skipValue, pageSize }) => { return databaseConnector.document.findMany({ @@ -141,7 +141,7 @@ export const executeInTransaction = async (cb) => { * Get a document by documentGuid * * @param {string} documentGuid - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getByIdWithVersion = (documentGuid) => { return databaseConnector.document.findUnique({ @@ -157,7 +157,7 @@ export const getByIdWithVersion = (documentGuid) => { * * @param {string} documentGuid * @param {number} caseId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getByIdRelatedToCaseId = (documentGuid, caseId) => { return databaseConnector.document.findFirst({ @@ -177,7 +177,7 @@ export const getByIdRelatedToCaseId = (documentGuid, caseId) => { * * @param {string} documentReference * @param {number} caseId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getByReferenceRelatedToCaseId = (documentReference, caseId) => { return databaseConnector.document.findFirst({ @@ -377,7 +377,7 @@ export const updateDocumentsFolderId = ({ * * @async * @param {string} documentGuid - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const deleteDocument = (documentGuid) => { return databaseConnector.document.delete({ @@ -390,8 +390,8 @@ export const deleteDocument = (documentGuid) => { /** * * @param {number} folderId - * @param {import('@prisma/client').Prisma.DocumentFindManyArgs} [options={}] - * @returns {import('@prisma/client').PrismaPromise} + * @param {import('#database-client').Prisma.DocumentFindManyArgs} [options={}] + * @returns {import('#database-client').PrismaPromise} */ export const getDocumentsInFolder = (folderId, options = {}) => { const orderBy = options.orderBy || { @@ -491,7 +491,7 @@ const buildWhereClause_AllDocsOnCaseWithoutS51Advice = ( * @param {number} skipValue * @param {number} pageSize * @param {boolean} includeDeletedDocuments - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getDocumentsInCase = ( caseId, @@ -528,7 +528,7 @@ export const getDocumentsInCase = ( /** * * @param {number} folderId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const countDocumentsInFolder = (folderId) => { return databaseConnector.document.count({ @@ -542,7 +542,7 @@ export const countDocumentsInFolder = (folderId) => { /** * * @param {string} documentGUID - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getByDocumentGUID = (documentGUID) => { return databaseConnector.document.findUnique({ @@ -558,7 +558,7 @@ export const getByDocumentGUID = (documentGUID) => { /** * * @param {string[]} guids - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} * */ export const getDocumentsByGUID = (guids) => databaseConnector.document.findMany({ @@ -576,7 +576,7 @@ export const getDocumentsByGUID = (guids) => /** * TODO: I dont think this fn is used anymore * @param {{guid: string, status: import('xstate').StateValue }} documentStatusUpdate - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const updateDocumentStatus = ({ guid, status }) => { return databaseConnector.document.update({ @@ -594,7 +594,7 @@ export const updateDocumentStatus = ({ guid, status }) => { * * @param {number} folderId * @param {boolean} getAllDocuments - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getDocumentsCountInFolder = (folderId, getAllDocuments = false) => { /** @type {{folderId: number, isDeleted?:boolean}} */ @@ -616,7 +616,7 @@ export const getDocumentsCountInFolder = (folderId, getAllDocuments = false) => * @param {string} criteria * @param {number |undefined} s51AdviceFolderId * @param {boolean} includeDeletedDocuments - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getDocumentsCountInCase = ( caseId, @@ -641,7 +641,7 @@ export const getDocumentsCountInCase = ( * Filter document table to retrieve documents by 'ready-to-publish' status * * @param {{skipValue: number, pageSize: number, caseId: number, documentVersion?: number}} params - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getDocumentsReadyPublishStatus = ({ skipValue, pageSize, caseId }) => { return databaseConnector.document.findMany({ @@ -670,7 +670,7 @@ export const getDocumentsReadyPublishStatus = ({ skipValue, pageSize, caseId }) * Returns total number of documents by published status (ready-to-publish) * * @param {number} caseId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getDocumentsCountInByPublishStatus = (caseId) => { console.info('getDocumentsCountInByPublishStatus for case ' + caseId); @@ -691,7 +691,7 @@ export const getDocumentsCountInByPublishStatus = (caseId) => { * @param {number} folderId * @param {string} fileName * @param {boolean} [includeDeleted] - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getInFolderByName = (folderId, fileName, includeDeleted) => { const fileNameWithoutSuffix = getFileNameWithoutSuffix(fileName); diff --git a/apps/api/src/server/repositories/examination-timetable.repository.js b/apps/api/src/server/repositories/examination-timetable.repository.js index d7c5338a9f..33cde7f93d 100644 --- a/apps/api/src/server/repositories/examination-timetable.repository.js +++ b/apps/api/src/server/repositories/examination-timetable.repository.js @@ -1,7 +1,7 @@ import { databaseConnector } from '#utils/database-connector.js'; /** - * @typedef {import('@prisma/client').Prisma.ExaminationTimetableGetPayload<{include: {ExaminationTimetableItem: {include: {ExaminationTimetableType: true}}, case: true } }>} ExaminationTimetableWithCaseAndItemsAndType + * @typedef {import('#database-client').Prisma.ExaminationTimetableGetPayload<{include: {ExaminationTimetableItem: {include: {ExaminationTimetableType: true}}, case: true } }>} ExaminationTimetableWithCaseAndItemsAndType */ /** @@ -16,7 +16,7 @@ export const getById = (id) => * Returns a whole Examination Timetable inc case, with associated Examination Timetable Item records inc Exam Type records * * @param {number} id - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} * */ export const getWithItems = (id) => { return databaseConnector.examinationTimetable.findUnique({ @@ -55,7 +55,7 @@ export const create = (examinationTimetable) => { /** * * @param {Number} caseId - * @param {import('@prisma/client').Prisma.ExaminationTimetableUpdateInput} examinationTimetable + * @param {import('#database-client').Prisma.ExaminationTimetableUpdateInput} examinationTimetable * @returns {Promise} */ export const updateByCaseId = (caseId, examinationTimetable) => { @@ -68,7 +68,7 @@ export const updateByCaseId = (caseId, examinationTimetable) => { /** * * @param {Number} id - * @param {import('@prisma/client').Prisma.ExaminationTimetableUpdateInput} examinationTimetable + * @param {import('#database-client').Prisma.ExaminationTimetableUpdateInput} examinationTimetable * @returns {Promise} */ export const update = (id, examinationTimetable) => { diff --git a/apps/api/src/server/repositories/project-update.respository.js b/apps/api/src/server/repositories/project-update.respository.js index 799d530f3e..7d26159ab9 100644 --- a/apps/api/src/server/repositories/project-update.respository.js +++ b/apps/api/src/server/repositories/project-update.respository.js @@ -4,7 +4,7 @@ import { getSkipValue } from '../utils/database-pagination.js'; import BackOfficeAppError from '#utils/app-error.js'; /** - * @typedef {import('@prisma/client').Prisma.ProjectUpdateGetPayload<{include: {case: true}}>} ProjectUpdateWithCase + * @typedef {import('#database-client').Prisma.ProjectUpdateGetPayload<{include: {case: true}}>} ProjectUpdateWithCase */ /** @@ -17,7 +17,7 @@ import BackOfficeAppError from '#utils/app-error.js'; * @typedef {Object} ListProjectUpdatesOptions * @property {number} page * @property {number} pageSize - * @property {import('@prisma/client').Prisma.ProjectUpdateOrderByWithRelationInput} [orderBy] + * @property {import('#database-client').Prisma.ProjectUpdateOrderByWithRelationInput} [orderBy] * @property {number} [caseId] - filter option * @property {string} [status] - filter option * @property {Date} [publishedBefore] - filter option (datePublished < publishedBefore) @@ -28,7 +28,7 @@ import BackOfficeAppError from '#utils/app-error.js'; * List project updates for a particular case, with filter options such as by case * * @param {ListProjectUpdatesOptions} opts - * @returns {Promise<{count: number, items: import('@prisma/client').ProjectUpdate[]}>} + * @returns {Promise<{count: number, items: import('#database-client').ProjectUpdate[]}>} */ export async function listProjectUpdates({ caseId, @@ -39,7 +39,7 @@ export async function listProjectUpdates({ publishedBefore, sentToSubscribers }) { - /** @type {import('@prisma/client').Prisma.ProjectUpdateWhereInput} */ + /** @type {import('#database-client').Prisma.ProjectUpdateWhereInput} */ const where = {}; if (caseId) { where.caseId = caseId; @@ -75,7 +75,7 @@ export async function listProjectUpdates({ /** * Create a new project update * - * @param {import('@prisma/client').Prisma.ProjectUpdateCreateInput} req + * @param {import('#database-client').Prisma.ProjectUpdateCreateInput} req * @returns {Promise} */ export async function createProjectUpdate(req) { @@ -93,7 +93,7 @@ export async function createProjectUpdate(req) { * * @param {number} id * @param {*} include - * @returns {Promise} + * @returns {Promise} */ export async function getProjectUpdate(id, include = {}) { return databaseConnector.projectUpdate.findUnique({ @@ -108,7 +108,7 @@ export async function getProjectUpdate(id, include = {}) { * Update a project update. Verifies the status change is allowed in a transaction. * * @param {number} id - * @param {import('@prisma/client').Prisma.ProjectUpdateUpdateInput} req + * @param {import('#database-client').Prisma.ProjectUpdateUpdateInput} req * @returns {Promise} * @throws {BackOfficeAppError} */ @@ -184,10 +184,10 @@ export async function deleteProjectUpdate(id) { * List notification logs * * @param {PaginationOptions & {projectUpdateId:number}} opts - * @returns {Promise<{count: number, items: import('@prisma/client').ProjectUpdateNotificationLog[]}>} + * @returns {Promise<{count: number, items: import('#database-client').ProjectUpdateNotificationLog[]}>} */ export async function listNotificationLogs({ projectUpdateId, page, pageSize }) { - /** @type {import('@prisma/client').Prisma.ProjectUpdateNotificationLogWhereInput} */ + /** @type {import('#database-client').Prisma.ProjectUpdateNotificationLogWhereInput} */ const where = { projectUpdateId }; @@ -212,8 +212,8 @@ export async function listNotificationLogs({ projectUpdateId, page, pageSize }) /** * Create notification logs * - * @param {import('@prisma/client').Prisma.ProjectUpdateNotificationLogCreateManyInput} logs - * @returns {Promise} + * @param {import('#database-client').Prisma.ProjectUpdateNotificationLogCreateManyInput} logs + * @returns {Promise} */ export async function createNotificationLogs(logs) { return databaseConnector.projectUpdateNotificationLog.createMany({ diff --git a/apps/api/src/server/repositories/s51-advice-document.repository.js b/apps/api/src/server/repositories/s51-advice-document.repository.js index 11422ab4bf..057bae4c49 100644 --- a/apps/api/src/server/repositories/s51-advice-document.repository.js +++ b/apps/api/src/server/repositories/s51-advice-document.repository.js @@ -2,7 +2,7 @@ import { databaseConnector } from '../utils/database-connector.js'; import { getFileNameWithoutSuffix } from '../applications/application/documents/document.service.js'; /** - * @typedef {import('@prisma/client').Prisma.S51AdviceDocumentGetPayload<{include: {Document: {include: {latestDocumentVersion: true }} }}>} S51AdviceDocumentWithLatestVersion + * @typedef {import('#database-client').Prisma.S51AdviceDocumentGetPayload<{include: {Document: {include: {latestDocumentVersion: true }} }}>} S51AdviceDocumentWithLatestVersion */ /** @@ -18,7 +18,7 @@ export const create = (s51AdviceDocument) => { * get the advice documents attached to an S51 Advice * * @param {number} adviceId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} * */ export const getForAdvice = (adviceId) => databaseConnector.s51AdviceDocument.findMany({ @@ -41,7 +41,7 @@ export const getForAdvice = (adviceId) => * * @param {number} adviceId * @param {string} documentName - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} * */ export const getDocumentInAdviceByName = (adviceId, documentName) => { const fileNameWithoutSuffix = getFileNameWithoutSuffix(documentName); diff --git a/apps/api/src/server/repositories/s51-advice.repository.js b/apps/api/src/server/repositories/s51-advice.repository.js index ea08e6a2e9..cdc2bf2212 100644 --- a/apps/api/src/server/repositories/s51-advice.repository.js +++ b/apps/api/src/server/repositories/s51-advice.repository.js @@ -1,8 +1,8 @@ import { databaseConnector } from '#utils/database-connector.js'; /** - * @typedef {import('@prisma/client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: {include: {Document: {include: {latestDocumentVersion: true}}}} }}>} S51AdviceWithS51AdviceDocumentsWithLatestVersion - * @typedef {import('@prisma/client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments + * @typedef {import('#database-client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: {include: {Document: {include: {latestDocumentVersion: true}}}} }}>} S51AdviceWithS51AdviceDocumentsWithLatestVersion + * @typedef {import('#database-client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51AdviceDocuments */ /** @@ -31,7 +31,7 @@ export const get = (id) => { * * @param {number} caseId * @param {boolean} includeDeleted - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getS51AdviceCountOnCase = (caseId, includeDeleted = true) => { /** @type {{caseId: number, isDeleted?:boolean}} */ @@ -50,7 +50,7 @@ export const getS51AdviceCountOnCase = (caseId, includeDeleted = true) => { * returns and array of all undeleted S51 Advice on a case * * @param {{caseId: number, skipValue: number, pageSize: number }} caseId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getManyS51AdviceOnCase = ({ caseId, skipValue, pageSize }) => { return databaseConnector.s51Advice.findMany({ @@ -103,7 +103,7 @@ export const update = (id, s51AdviceDetails) => { * * @param {number} caseId * @param {*} s51AdviceDetails - * @returns {import('@prisma/client').PrismaPromise>} + * @returns {import('#database-client').PrismaPromise>} * */ export const updateForCase = (caseId, s51AdviceDetails) => { return databaseConnector.s51Advice.updateMany({ @@ -194,7 +194,7 @@ export const getPublishedAdvicesByIds = (s51AdviceIds) => { * and not including any deleted attachments * * @param {{skipValue: number, pageSize: number, caseId: number}} params - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getReadyToPublishAdvices = ({ skipValue, pageSize, caseId }) => { // in order to ensure only non-deleted attachments are included, have to use a select instead of an include, to be able to add a where clause @@ -264,7 +264,7 @@ export const getReadyToPublishAdvices = ({ skipValue, pageSize, caseId }) => { * Returns total number of S51 advice by published status (ready-to-publish), ignoring deleted advice * * @param {number} caseId - * @returns {import('@prisma/client').PrismaPromise} + * @returns {import('#database-client').PrismaPromise} */ export const getS51AdviceCountInByPublishStatus = (caseId) => { return databaseConnector.s51Advice.count({ diff --git a/apps/api/src/server/repositories/service-user.repository.js b/apps/api/src/server/repositories/service-user.repository.js index 0c1e350890..9740afbd6b 100644 --- a/apps/api/src/server/repositories/service-user.repository.js +++ b/apps/api/src/server/repositories/service-user.repository.js @@ -6,7 +6,7 @@ import { databaseConnector } from '#utils/database-connector.js'; * In practice, service user emails are unique - but they're also nullable. * * @param {string} email - * @returns {Promise} + * @returns {Promise} */ export function findByEmail(email) { return databaseConnector.serviceUser.findFirst({ diff --git a/apps/api/src/server/repositories/subscription.respository.js b/apps/api/src/server/repositories/subscription.respository.js index c965b6974c..95967377fa 100644 --- a/apps/api/src/server/repositories/subscription.respository.js +++ b/apps/api/src/server/repositories/subscription.respository.js @@ -17,10 +17,10 @@ const include = { serviceUser: true }; * List subscriptions * * @param {ListSubscriptionOptions} options - * @returns {Promise<{count: number, items: import('@prisma/client').Subscription[]}>} + * @returns {Promise<{count: number, items: import('#database-client').Subscription[]}>} */ export async function list({ page, pageSize, caseReference, type, endAfter }) { - /** @type {import('@prisma/client').Prisma.SubscriptionWhereInput} */ + /** @type {import('#database-client').Prisma.SubscriptionWhereInput} */ const where = {}; if (caseReference) { where.caseReference = caseReference; @@ -60,7 +60,7 @@ export async function list({ page, pageSize, caseReference, type, endAfter }) { * Any given type should include allUpdates. * * @param {string} type - * @param {import('@prisma/client').Prisma.SubscriptionWhereInput} where + * @param {import('#database-client').Prisma.SubscriptionWhereInput} where */ export function subscriptionTypeToWhere(type, where) { switch (type) { @@ -83,7 +83,7 @@ export function subscriptionTypeToWhere(type, where) { * Get an existing subscription entry * * @param {number} id - * @returns {Promise} + * @returns {Promise} */ export function get(id) { return databaseConnector.subscription.findUnique({ @@ -99,7 +99,7 @@ export function get(id) { * * @param {string} caseReference * @param {string} email - * @returns {Promise} + * @returns {Promise} */ export function findUnique(caseReference, email) { return databaseConnector.subscription.findFirst({ @@ -122,7 +122,7 @@ export function findUnique(caseReference, email) { /** * Create a new subscription entry * - * @param {import('@prisma/client').Prisma.SubscriptionUncheckedCreateInput} payload + * @param {import('#database-client').Prisma.SubscriptionUncheckedCreateInput} payload * @returns {Promise} */ export function create(payload) { @@ -136,7 +136,7 @@ export function create(payload) { * Update an existing subscription entry * * @param {number} id - * @param {import('@prisma/client').Prisma.SubscriptionUncheckedUpdateInput} payload + * @param {import('#database-client').Prisma.SubscriptionUncheckedUpdateInput} payload * @returns {Promise} */ export function update(id, payload) { diff --git a/apps/api/src/server/utils/database-connector.js b/apps/api/src/server/utils/database-connector.js index 322cf8b693..f71807774d 100644 --- a/apps/api/src/server/utils/database-connector.js +++ b/apps/api/src/server/utils/database-connector.js @@ -1,5 +1,7 @@ -import { PrismaClient } from '@prisma/client'; -import { modifyPrismaDocumentQueryMiddleware } from './prisma-middleware.js'; +import { PrismaClient } from '#database-client'; +import { softDeleteExtension } from '#utils/prisma-extension.js'; +import { PrismaMssql } from '@prisma/adapter-mssql'; +import { loadEnvironment } from '@pins/platform'; /** @type {PrismaClient} */ let prismaClient; @@ -9,12 +11,26 @@ let prismaClient; */ function createPrismaClient() { if (!prismaClient) { - prismaClient = new PrismaClient(); - } + // For tests, especially those using dynamic imports, use direct env var + // For production, load environment properly + let databaseUrl = process.env.DATABASE_URL; + + // Only attempt loadEnvironment if not in test mode or if DATABASE_URL is not set + if (process.env.NODE_ENV !== 'test' && !databaseUrl) { + try { + const environment = loadEnvironment(process.env.NODE_ENV); + databaseUrl = environment.DATABASE_URL; + } catch (error) { + console.warn('Failed to load environment, using process.env.DATABASE_URL'); + } + } - prismaClient.$use(modifyPrismaDocumentQueryMiddleware); + prismaClient = new PrismaClient({ + adapter: new PrismaMssql(databaseUrl) + }); + } - return prismaClient; + return prismaClient.$extends(softDeleteExtension); } export const databaseConnector = createPrismaClient(); diff --git a/apps/api/src/server/utils/mapping/map-document-details.js b/apps/api/src/server/utils/mapping/map-document-details.js index 13105c763f..cb419cf1b6 100644 --- a/apps/api/src/server/utils/mapping/map-document-details.js +++ b/apps/api/src/server/utils/mapping/map-document-details.js @@ -2,7 +2,7 @@ import { mapDateStringToUnixTimestamp } from './map-date-string-to-unix-timestam import { mapDateToUnixTimestamp } from './map-date-to-unix-timestamp.js'; /** - * @typedef {import('@prisma/client').Document} Document + * @typedef {import('#database-client').Document} Document * @typedef {import('@pins/applications.api').Schema.DocumentDetails} DocumentDetails * @typedef {import('@pins/applications.api').Schema.DocumentVersionWithDocumentAndActivityLog} DocumentVersionWithDocumentAndActivityLog */ diff --git a/apps/api/src/server/utils/mapping/map-s51-advice-details.js b/apps/api/src/server/utils/mapping/map-s51-advice-details.js index f94f8147b8..a07919543b 100644 --- a/apps/api/src/server/utils/mapping/map-s51-advice-details.js +++ b/apps/api/src/server/utils/mapping/map-s51-advice-details.js @@ -3,9 +3,9 @@ import { mapDateStringToUnixTimestamp } from './map-date-string-to-unix-timestam /** * @typedef {import('@pins/applications.api').Schema.S51Advice} S51Advice * @typedef {import('@pins/applications').S51AdviceDetails} S51AdviceDetails - * @typedef {import('@prisma/client').Prisma.DocumentGetPayload<{include: {latestDocumentVersion: true}}>} DocumentWithLatestVersion + * @typedef {import('#database-client').Prisma.DocumentGetPayload<{include: {latestDocumentVersion: true}}>} DocumentWithLatestVersion * @typedef { {Document: DocumentWithLatestVersion}} DocumentWithLatestVersionObj - * @typedef {import('@prisma/client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51Documents + * @typedef {import('#database-client').Prisma.S51AdviceGetPayload<{include: {S51AdviceDocument: true}}>} S51AdviceWithS51Documents * @typedef {import('@pins/applications.api').Api.S51AdviceDocumentDetails} S51AdviceDocumentDetails */ diff --git a/apps/api/src/server/utils/prisma-extension.js b/apps/api/src/server/utils/prisma-extension.js new file mode 100644 index 0000000000..a97286a82d --- /dev/null +++ b/apps/api/src/server/utils/prisma-extension.js @@ -0,0 +1,77 @@ +import { Prisma } from '#database-client'; + +const isSeeding = process.env.NODE_ENV === 'seeding'; + +/** + * An extension that modifies Prisma Client queries for the Document and Folders models. + * When deleting a Document, it updates the `isDeleted` property instead of actually deleting the record + * unless the `hardDelete` arg is included. + * + * When deleting a folder, it updates `deletedAt` instead of deleting the record. + */ +export const softDeleteExtension = Prisma.defineExtension((prisma) => + prisma.$extends({ + name: 'softDelete', // appears in logs + query: { + document: { + async delete({ args, query }) { + const { hardDelete = false } = args || {}; + if (hardDelete) { + delete args.hardDelete; + return query(args); + } else { + // mark document as deleted + args.data = { isDeleted: true }; + return prisma.document.update(args); + } + }, + async deleteMany({ args, query }) { + const { hardDelete = false } = args || {}; + if (hardDelete) { + delete args.hardDelete; + return query(args); + } else { + // mark documents as deleted + args.data = { isDeleted: true }; + return prisma.document.updateMany(args); + } + } + }, + folder: { + async delete({ args, query }) { + const { hardDelete = false } = args || {}; + if (hardDelete || isSeeding) { + delete args.hardDelete; + return query(args); + } else { + // mark folder as deleted + args.data = { deletedAt: new Date() }; + return prisma.folder.update(args); + } + }, + async deleteMany({ args, query }) { + const { hardDelete = false } = args || {}; + if (hardDelete || isSeeding) { + delete args.hardDelete; + return query(args); + } else { + // mark folders as deleted + args.data = { deletedAt: new Date() }; + return prisma.folder.updateMany(args); + } + }, + async $allOperations({ operation, args, query }) { + const findOrCount = operation.startsWith('find') || operation === 'count'; + if (!isSeeding && findOrCount && !args.includeDeleted) { + // only include folders which aren't deleted + args.where = { + ...args.where, + deletedAt: { equals: null } + }; + } + return query(args); + } + } + } + }) +); diff --git a/apps/api/src/server/utils/prisma-middleware.js b/apps/api/src/server/utils/prisma-middleware.js deleted file mode 100644 index d0d9418d8c..0000000000 --- a/apps/api/src/server/utils/prisma-middleware.js +++ /dev/null @@ -1,43 +0,0 @@ -/** - * A middleware function that modifies Prisma Client parameters for Document model. - * When deleting a Document, it updates the `isDeleted` property instead of actually deleting the record - * unless the `hardDelete` arg is included. - * - * @param {import('@prisma/client').Prisma.MiddlewareParams} parameters - The Prisma Client parameters object. - * @param {(arg0: any) => any} next - The next middleware in the chain. - * @returns {Promise<(arg0: any) => any>} The result of the next middleware in the chain. - */ -export async function modifyPrismaDocumentQueryMiddleware(parameters, next) { - const { hardDelete = false } = parameters?.args || {}; - if (hardDelete) { - delete parameters.args.hardDelete; - } - if (parameters.model === 'Document' && parameters.action === 'delete' && !hardDelete) { - parameters.action = 'update'; - parameters.args.data = { isDeleted: true }; - } - if (process.env.NODE_ENV !== 'seeding' && parameters.model === 'Folder') { - if (parameters.action === 'delete' && !hardDelete) { - parameters.action = 'update'; - parameters.args = parameters.args || {}; - parameters.args.data = { deletedAt: new Date() }; - } - if (parameters.action === 'deleteMany' && !hardDelete) { - parameters.action = 'updateMany'; - parameters.args = parameters.args || {}; - parameters.args.data = { deletedAt: new Date() }; - } - if ( - (parameters.action.startsWith('find') || parameters.action === 'count') && - !parameters.args.includeDeleted - ) { - parameters.args = parameters.args || {}; - parameters.args.where = { - ...parameters.args.where, - deletedAt: { equals: null } - }; - } - } - - return next(parameters); -} diff --git a/apps/web/setup-tests.js b/apps/web/setup-tests.js index f989dd4428..6ef0744476 100644 --- a/apps/web/setup-tests.js +++ b/apps/web/setup-tests.js @@ -19,8 +19,8 @@ jest.unstable_mockModule('./src/server/lib/azure-ai-language.js', () => ({ jest.unstable_mockModule('./src/server/lib/ai-redaction-client', () => ({ aiRedactionClientPost: { + // @ts-ignore post: jest.fn().mockResolvedValue({ - // @ts-ignore body: { pollEndpoint: 'abc', id: '123' } }) } diff --git a/apps/web/src/server/app/auth/__tests__/auth.test.js b/apps/web/src/server/app/auth/__tests__/auth.test.js index 712b76e33a..7b11d46e52 100644 --- a/apps/web/src/server/app/auth/__tests__/auth.test.js +++ b/apps/web/src/server/app/auth/__tests__/auth.test.js @@ -29,6 +29,7 @@ describe('auth', () => { // Assert azure msal client's `getAuthCodeUrl` was invoked correctly + // @ts-expect-error const [authOptions] = /** @type {import('@azure/msal-node').AuthorizationUrlRequest[]} */ ( client.getAuthCodeUrl.mock.lastCall ); diff --git a/apps/web/src/server/applications/case/applications-case.controller.js b/apps/web/src/server/applications/case/applications-case.controller.js index f3e1584f4b..4184203886 100644 --- a/apps/web/src/server/applications/case/applications-case.controller.js +++ b/apps/web/src/server/applications/case/applications-case.controller.js @@ -21,7 +21,7 @@ import { hasRealErrors } from '../../lib/has-real-errors.js'; /** * View the overview for a single case (legacy) * - * @type {import('@pins/express').RenderHandler<{}>} + * @type {import('@pins/express').RenderHandlerNoNext<{}>} */ export async function viewApplicationsCaseOverviewLegacy({ session }, response) { const { @@ -70,7 +70,7 @@ export async function viewApplicationsCaseOverviewLegacy({ session }, response) /** * View the overview for a single case * - * @type {import('@pins/express').RenderHandler<{}>} + * @type {import('@pins/express').RenderHandlerNoNext<{}>} */ export async function viewApplicationsCaseOverview(request, response) { const { @@ -88,7 +88,7 @@ export async function viewApplicationsCaseOverview(request, response) { response.locals.case?.geographicalInformation?.regions ); const caseIsGeneratingStation = - response.locals.case?.subSector?.name === SUB_SECTORS.GENERATING_STATIONS ?? false; + response.locals.case?.subSector?.name === SUB_SECTORS.GENERATING_STATIONS || false; const rawErrors = { ...(request.errors || {}), diff --git a/apps/web/src/server/applications/case/applications-case.router.js b/apps/web/src/server/applications/case/applications-case.router.js index 38df3107cf..09e7b4037e 100644 --- a/apps/web/src/server/applications/case/applications-case.router.js +++ b/apps/web/src/server/applications/case/applications-case.router.js @@ -60,7 +60,7 @@ applicationsCaseSummaryRouter .route('/overview') .get( asyncHandler( - /** @type {import('@pins/express').RenderHandler<{}>} */ (req, res) => + /** @type {import('@pins/express').RenderHandlerNoNext<{}>} */ (req, res) => featureFlagClient.isFeatureActive('applic-55-welsh-translation') ? controller.viewApplicationsCaseOverview(req, res) : controller.viewApplicationsCaseOverviewLegacy(req, res) diff --git a/apps/web/src/server/applications/case/documentation-metadata/documentation-metadata.validators.js b/apps/web/src/server/applications/case/documentation-metadata/documentation-metadata.validators.js index bc87ea2049..f7637fa197 100644 --- a/apps/web/src/server/applications/case/documentation-metadata/documentation-metadata.validators.js +++ b/apps/web/src/server/applications/case/documentation-metadata/documentation-metadata.validators.js @@ -6,12 +6,13 @@ import { validationDateValid } from '../../common/validators/dates.validators.js'; +/** @typedef {import('@pins/express/types/express.d.ts').AsyncRequestHandler} AsyncRequestHandler */ /** @typedef {import('express').RequestHandler} RequestHandler */ /** * Dispatch the POST route to the right validator * - * @type {RequestHandler} + * @type {AsyncRequestHandler} */ export const validatorsDispatcher = async (request, response, next) => { const { metaDataName } = request.params; diff --git a/apps/web/src/server/applications/case/documentation/applications-documentation.controller.js b/apps/web/src/server/applications/case/documentation/applications-documentation.controller.js index e1d8b45254..fddb28b077 100644 --- a/apps/web/src/server/applications/case/documentation/applications-documentation.controller.js +++ b/apps/web/src/server/applications/case/documentation/applications-documentation.controller.js @@ -746,7 +746,7 @@ export async function viewFolderDeletionPage(request, response) { } /** - * @type {import('@pins/express').RenderHandler<*, *, {folderName: string}>} + * @type {import('@pins/express').AsyncRequestHandler<*, *, {folderName: string}>} */ export async function updateFolderCreate(request, response) { if (!featureFlagClient.isFeatureActive('applic-625-custom-folders')) { @@ -778,6 +778,7 @@ export async function updateFolderCreate(request, response) { url('document-category', { caseId }); return response.render('applications/components/folder/folder-create', { backLink, + // @ts-expect-error - TODO remove unnecessary OR case errors: [errors] || [{ msg: 'Something went wrong. Please, try again later.' }] }); } @@ -854,6 +855,7 @@ export async function updateFolderDelete(request, response) { url('document-category', { caseId }); return response.render('applications/components/folder/folder-delete', { backLink, + // @ts-expect-error - TODO remove unnecessary OR case errors: [errors] || [{ msg: 'Something went wrong. Please, try again later.' }] }); } diff --git a/apps/web/src/server/applications/case/examination-timetable/applications-timetable.validators.js b/apps/web/src/server/applications/case/examination-timetable/applications-timetable.validators.js index ef17386d21..ee8e2dc441 100644 --- a/apps/web/src/server/applications/case/examination-timetable/applications-timetable.validators.js +++ b/apps/web/src/server/applications/case/examination-timetable/applications-timetable.validators.js @@ -12,7 +12,7 @@ import { } from '../../common/validators/times.validators.js'; import { timetableTemplatesSchema } from './applications-timetable.controller.js'; -/** @typedef {import('express').RequestHandler} RequestHandler */ +/** @typedef {import('@pins/express/types/express.d.ts').AsyncRequestHandler} AsyncRequestHandler */ /** @typedef {import("express-validator").ValidationChain} ValidationChain */ /** @@ -99,7 +99,7 @@ const fieldValidationsCreators = { /** * Dispatch the POST route to the right validator * - * @type {RequestHandler} + * @type {AsyncRequestHandler} */ export const validatorsDispatcher = async (request, response, next) => { const templateValidations = []; diff --git a/apps/web/src/server/applications/case/key-dates/applications-key-dates.controller.js b/apps/web/src/server/applications/case/key-dates/applications-key-dates.controller.js index d6d337afce..75d53187d6 100644 --- a/apps/web/src/server/applications/case/key-dates/applications-key-dates.controller.js +++ b/apps/web/src/server/applications/case/key-dates/applications-key-dates.controller.js @@ -177,6 +177,7 @@ export async function viewKeyDatesIndex(request, response) { } }); + // @ts-expect-error - TODO fix this type const { preExamination: { dateOfReOpenRelevantRepresentationClose = undefined } = {} } = sections; return response.render(`applications/case-key-dates/key-dates-index.njk`, { diff --git a/apps/web/src/server/applications/case/key-dates/applications-key-dates.validators.js b/apps/web/src/server/applications/case/key-dates/applications-key-dates.validators.js index 114aca09ec..0570b90c49 100644 --- a/apps/web/src/server/applications/case/key-dates/applications-key-dates.validators.js +++ b/apps/web/src/server/applications/case/key-dates/applications-key-dates.validators.js @@ -2,12 +2,12 @@ import { createValidator } from '@pins/express'; import { validationDateValid } from '../../common/validators/dates.validators.js'; import { keyDatesProperty } from '../../../lib/nunjucks-filters/key-dates-property.js'; -/** @typedef {import('express').RequestHandler} RequestHandler */ +/** @typedef {import('@pins/express/types/express.d.ts').AsyncRequestHandler} AsyncRequestHandler */ /** * Validate key dates are in the MM/DD/YYYY format * - * @type {RequestHandler} + * @type {AsyncRequestHandler} */ export const validateKeyDates = async (request, response, next) => { const { body } = request; diff --git a/apps/web/src/server/applications/case/s51/applications-s51.validators.js b/apps/web/src/server/applications/case/s51/applications-s51.validators.js index 2f288d2e4e..9be5fd5489 100644 --- a/apps/web/src/server/applications/case/s51/applications-s51.validators.js +++ b/apps/web/src/server/applications/case/s51/applications-s51.validators.js @@ -8,11 +8,12 @@ import { import { getS51Advice } from './applications-s51.service.js'; /** @typedef {import('express').RequestHandler} RequestHandler */ +/** @typedef {import('@pins/express/types/express.d.ts').AsyncRequestHandler} AsyncRequestHandler */ /** * Dispatch the POST route to the right validator * - * @type {RequestHandler} + * @type {AsyncRequestHandler} */ export const s51ValidatorsDispatcher = async (request, response, next) => { const { step } = request.params; diff --git a/apps/web/testing/applications/factory/util.js b/apps/web/testing/applications/factory/util.js index 84479d8d5a..2de0f28b6a 100644 --- a/apps/web/testing/applications/factory/util.js +++ b/apps/web/testing/applications/factory/util.js @@ -5,7 +5,7 @@ import { random } from 'lodash-es'; * @param {{prefix: string}} [options={prefix: 'APP'}] * @returns {string} */ -export const createCaseReference = ({ prefix = 'APP' }) => +export const createCaseReference = ({ prefix } = { prefix: 'APP' }) => [ prefix, `${fake.randomLetter()}${random(1000, 9999)}`, @@ -61,7 +61,9 @@ export const createUniqueRandomDateFromSeed = (seed, minYear, maxYear) => { * @param {{wordsNumber: number, startOffset: number}} [options={}] * @returns {string} */ -export const createRandomDescription = ({ wordsNumber = 40, startOffset = 0 }) => { +export const createRandomDescription = ( + { wordsNumber = 40, startOffset = 0 } = { wordsNumber: 40, startOffset: 0 } +) => { const loremIpsumString = 'Lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor incididunt ut labore et dolore magna aliqua Ut enim ad minim veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat'; const loremIpsumWords = loremIpsumString.split(' '); diff --git a/package-lock.json b/package-lock.json index d2acef80ea..bdb2bc52a3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -40,8 +40,9 @@ "@pins/redis": "^0.0.0", "@planning-inspectorate/address-lookup": "^1.0.6", "@planning-inspectorate/data-model": "~2.27.0", - "@prisma/client": "^5.13.0", - "@prisma/instrumentation": "^5.6.0", + "@prisma/adapter-mssql": "^7.0.1", + "@prisma/client": "^7.0.1", + "@prisma/instrumentation": "^7.0.1", "@supercharge/promise-pool": "^2.4.0", "@toast-ui/editor": "^3.2.2", "accessible-autocomplete": "2.0.4", @@ -170,7 +171,7 @@ "postcss": "^8.4.31", "prettier": "^2.6.2", "prettier-plugin-prisma": "^4.13.0", - "prisma": "^5.13.0", + "prisma": "^7.0.1", "puppeteer": "^23.5.0", "rimraf": "^3.0.2", "rollup": "^4.22.4", @@ -184,7 +185,7 @@ "terser": "^5.13.1", "turbo": "^1.2.14", "type-fest": "^2.12.2", - "typescript": "4.7.4" + "typescript": "^5.9.3" }, "engines": { "node": ">=20.0.0 <21.0.0" @@ -207,6 +208,7 @@ "@pins/key-vault-secrets-client": "*", "@pins/platform": "*", "@planning-inspectorate/data-model": "*", + "@prisma/adapter-mssql": "*", "@prisma/client": "*", "@prisma/instrumentation": "*", "@supercharge/promise-pool": "*", @@ -247,7 +249,8 @@ "rimraf": "*", "supertest": "*", "swagger-autogen": "*", - "swagger-typescript-api": "*" + "swagger-typescript-api": "*", + "typescript": "*" }, "engines": { "node": ">=20.0.0 <21.0.0" @@ -2978,6 +2981,57 @@ "dev": true, "license": "MIT" }, + "node_modules/@chevrotain/cst-dts-gen": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/cst-dts-gen/-/cst-dts-gen-10.5.0.tgz", + "integrity": "sha512-lhmC/FyqQ2o7pGK4Om+hzuDrm9rhFYIJ/AXoQBeongmn870Xeb0L6oGEiuR8nohFNL5sMaQEJWCxr1oIVIVXrw==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/gast": "10.5.0", + "@chevrotain/types": "10.5.0", + "lodash": "4.17.21" + } + }, + "node_modules/@chevrotain/cst-dts-gen/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/@chevrotain/gast": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/gast/-/gast-10.5.0.tgz", + "integrity": "sha512-pXdMJ9XeDAbgOWKuD1Fldz4ieCs6+nLNmyVhe2gZVqoO7v8HXuHYs5OV2EzUtbuai37TlOAQHrTDvxMnvMJz3A==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/types": "10.5.0", + "lodash": "4.17.21" + } + }, + "node_modules/@chevrotain/gast/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/@chevrotain/types": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/types/-/types-10.5.0.tgz", + "integrity": "sha512-f1MAia0x/pAVPWH/T73BJVyO2XU5tI4/iE7cnxb7tqdNTNhQI3Uq3XkqcoteTmD4t1aM0LbHCJOhgIDn07kl2A==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@chevrotain/utils": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/@chevrotain/utils/-/utils-10.5.0.tgz", + "integrity": "sha512-hBzuU5+JjB2cqNZyszkDHZgOSrUUT8V3dhgRl8Q9Gp6dAj/H5+KILGjbhDpc3Iy9qmqlm/akuOI2ut9VUtzJxQ==", + "devOptional": true, + "license": "Apache-2.0" + }, "node_modules/@colors/colors": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz", @@ -3350,20 +3404,6 @@ "node": ">=8" } }, - "node_modules/@commitlint/load/node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/@commitlint/message": { "version": "17.8.1", "resolved": "https://registry.npmjs.org/@commitlint/message/-/message-17.8.1.tgz", @@ -3636,6 +3676,36 @@ "ms": "^2.1.1" } }, + "node_modules/@electric-sql/pglite": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/@electric-sql/pglite/-/pglite-0.3.2.tgz", + "integrity": "sha512-zfWWa+V2ViDCY/cmUfRqeWY1yLto+EpxjXnZzenB1TyxsTiXaTWeZFIZw6mac52BsuQm0RjCnisjBtdBaXOI6w==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@electric-sql/pglite-socket": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/@electric-sql/pglite-socket/-/pglite-socket-0.0.6.tgz", + "integrity": "sha512-6RjmgzphIHIBA4NrMGJsjNWK4pu+bCWJlEWlwcxFTVY3WT86dFpKwbZaGWZV6C5Rd7sCk1Z0CI76QEfukLAUXw==", + "devOptional": true, + "license": "Apache-2.0", + "bin": { + "pglite-server": "dist/scripts/server.js" + }, + "peerDependencies": { + "@electric-sql/pglite": "0.3.2" + } + }, + "node_modules/@electric-sql/pglite-tools": { + "version": "0.2.7", + "resolved": "https://registry.npmjs.org/@electric-sql/pglite-tools/-/pglite-tools-0.2.7.tgz", + "integrity": "sha512-9dAccClqxx4cZB+Ar9B+FZ5WgxDc/Xvl9DPrTWv+dYTf0YNubLzi4wHHRGRGhrJv15XwnyKcGOZAP1VXSneSUg==", + "devOptional": true, + "license": "Apache-2.0", + "peerDependencies": { + "@electric-sql/pglite": "0.3.2" + } + }, "node_modules/@eslint-community/eslint-utils": { "version": "4.4.0", "resolved": "https://registry.npmjs.org/@eslint-community/eslint-utils/-/eslint-utils-4.4.0.tgz", @@ -3798,6 +3868,19 @@ "@hapi/hoek": "^9.0.0" } }, + "node_modules/@hono/node-server": { + "version": "1.14.2", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.14.2.tgz", + "integrity": "sha512-GHjpOeHYbr9d1vkID2sNUYkl5IxumyhDrUJB7wBp7jvqYwPFt+oNKsAPBRcdSbV7kIrXhouLE199ks1QcK4r7A==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.13.0", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.13.0.tgz", @@ -4813,6 +4896,30 @@ "integrity": "sha512-Y28PR25bHXUg88kCV7nivXrP2Nj2RueZ3/l/jdx6J9f8J4nsEGcgX0Qe6lt7Pa+J79+kPiJU3LguR6O/6zrLOw==", "license": "BSD-2-Clause" }, + "node_modules/@mrleebo/prisma-ast": { + "version": "0.12.1", + "resolved": "https://registry.npmjs.org/@mrleebo/prisma-ast/-/prisma-ast-0.12.1.tgz", + "integrity": "sha512-JwqeCQ1U3fvccttHZq7Tk0m/TMC6WcFAQZdukypW3AzlJYKYTGNVd1ANU2GuhKnv4UQuOFj3oAl0LLG/gxFN1w==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "chevrotain": "^10.5.0", + "lilconfig": "^2.1.0" + }, + "engines": { + "node": ">=16" + } + }, + "node_modules/@mrleebo/prisma-ast/node_modules/lilconfig": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-2.1.0.tgz", + "integrity": "sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=10" + } + }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -5238,127 +5345,235 @@ "jsonc-parser": "^3.3.1" } }, + "node_modules/@prisma/adapter-mssql": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/adapter-mssql/-/adapter-mssql-7.0.1.tgz", + "integrity": "sha512-wxoea8UbaHDZPUYApzUjp+XzJlgq4FcDc7U4aQNXz5bx4LOmpZ5dNlfWj10fhvP9h+aIpkArsJlv2qFCeV/xlA==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/driver-adapter-utils": "7.0.1", + "async-mutex": "0.5.0", + "mssql": "^11.0.1" + } + }, "node_modules/@prisma/client": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.20.0.tgz", - "integrity": "sha512-CLv55ZuMuUawMsxoqxGtLT3bEZoa2W8L3Qnp6rDIFWy+ZBrUcOFKdoeGPSnbBqxc3SkdxJrF+D1veN/WNynZYA==", - "hasInstallScript": true, + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/client/-/client-7.0.1.tgz", + "integrity": "sha512-O74T6xcfaGAq5gXwCAvfTLvI6fmC3and2g5yLRMkNjri1K8mSpEgclDNuUWs9xj5AwNEMQ88NeD3asI+sovm1g==", "license": "Apache-2.0", + "dependencies": { + "@prisma/client-runtime-utils": "7.0.1" + }, "engines": { - "node": ">=16.13" + "node": "^20.19 || ^22.12 || >=24.0" }, "peerDependencies": { - "prisma": "*" + "prisma": "*", + "typescript": ">=5.4.0" }, "peerDependenciesMeta": { "prisma": { "optional": true + }, + "typescript": { + "optional": true } } }, - "node_modules/@prisma/debug": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.20.0.tgz", - "integrity": "sha512-oCx79MJ4HSujokA8S1g0xgZUGybD4SyIOydoHMngFYiwEwYDQ5tBQkK5XoEHuwOYDKUOKRn/J0MEymckc4IgsQ==", + "node_modules/@prisma/client-runtime-utils": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/client-runtime-utils/-/client-runtime-utils-7.0.1.tgz", + "integrity": "sha512-R26BVX9D/iw4toUmZKZf3jniM/9pMGHHdZN5LVP2L7HNiCQKNQQx/9LuMtjepbgRqSqQO3oHN0yzojHLnKTGEw==", + "license": "Apache-2.0" + }, + "node_modules/@prisma/config": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/config/-/config-7.0.1.tgz", + "integrity": "sha512-MacIjXdo+hNKxPvtMzDXykIIc8HCRWoyjQ2nguJTFqLDzJBD5L6QRaANGTLOqbGtJ3sFvLRmfXhrFg3pWoK1BA==", "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "c12": "3.1.0", + "deepmerge-ts": "7.1.5", + "effect": "3.18.4", + "empathic": "2.0.0" + } + }, + "node_modules/@prisma/debug": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-7.0.1.tgz", + "integrity": "sha512-5+25XokVeAK2Z2C9W457AFw7Hk032Q3QI3G58KYKXPlpgxy+9FvV1+S1jqfJ2d4Nmq9LP/uACrM6OVhpJMSr8w==", "license": "Apache-2.0" }, + "node_modules/@prisma/dev": { + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@prisma/dev/-/dev-0.13.0.tgz", + "integrity": "sha512-QMmF6zFeUF78yv1HYbHvod83AQnl7u6NtKyDhTRZOJup3h1icWs8R7RUVxBJZvM2tBXNAMpLQYYM/8kPlOPegA==", + "devOptional": true, + "license": "ISC", + "dependencies": { + "@electric-sql/pglite": "0.3.2", + "@electric-sql/pglite-socket": "0.0.6", + "@electric-sql/pglite-tools": "0.2.7", + "@hono/node-server": "1.14.2", + "@mrleebo/prisma-ast": "0.12.1", + "@prisma/get-platform": "6.8.2", + "@prisma/query-plan-executor": "6.18.0", + "foreground-child": "3.3.1", + "get-port-please": "3.1.2", + "hono": "4.7.10", + "http-status-codes": "2.3.0", + "pathe": "2.0.3", + "proper-lockfile": "4.1.2", + "remeda": "2.21.3", + "std-env": "3.9.0", + "valibot": "1.1.0", + "zeptomatch": "2.0.2" + } + }, + "node_modules/@prisma/driver-adapter-utils": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/driver-adapter-utils/-/driver-adapter-utils-7.0.1.tgz", + "integrity": "sha512-sBbxm/yysHLLF2iMAB+qcX/nn3WFgsiC4DQNz0uM6BwGSIs8lIvgo0u8nR9nxe5gvFgKiIH8f4z2fgOEMeXc8w==", + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.0.1" + } + }, "node_modules/@prisma/engines": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.20.0.tgz", - "integrity": "sha512-DtqkP+hcZvPEbj8t8dK5df2b7d3B8GNauKqaddRRqQBBlgkbdhJkxhoJTrOowlS3vaRt2iMCkU0+CSNn0KhqAQ==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-7.0.1.tgz", + "integrity": "sha512-f+D/vdKeImqUHysd5Bgv8LQ1whl4sbLepHyYMQQMK61cp4WjwJVryophleLUrfEJRpBLGTBI/7fnLVENxxMFPQ==", "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.20.0", - "@prisma/engines-version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284", - "@prisma/fetch-engine": "5.20.0", - "@prisma/get-platform": "5.20.0" + "@prisma/debug": "7.0.1", + "@prisma/engines-version": "7.1.0-2.f09f2815f091dbba658cdcd2264306d88bb5bda6", + "@prisma/fetch-engine": "7.0.1", + "@prisma/get-platform": "7.0.1" } }, "node_modules/@prisma/engines-version": { - "version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284", - "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284.tgz", - "integrity": "sha512-Lg8AS5lpi0auZe2Mn4gjuCg081UZf88k3cn0RCwHgR+6cyHHpttPZBElJTHf83ZGsRNAmVCZCfUGA57WB4u4JA==", + "version": "7.1.0-2.f09f2815f091dbba658cdcd2264306d88bb5bda6", + "resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-7.1.0-2.f09f2815f091dbba658cdcd2264306d88bb5bda6.tgz", + "integrity": "sha512-RA7pShKvijHib4USRB3YuLTQamHKJPkTRDc45AwxfahUQngiGVMlIj4ix4emUxkrum4o/jwn82WIwlG57EtgiQ==", "devOptional": true, "license": "Apache-2.0" }, + "node_modules/@prisma/engines/node_modules/@prisma/get-platform": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-7.0.1.tgz", + "integrity": "sha512-DrsGnZOsF7PlAE7UtqmJenWti87RQtg7v9qW9alS71Pj0P6ZQV0RuzRQaql9dCWoo6qKAaF5U/L4kI826MmiZg==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.0.1" + } + }, "node_modules/@prisma/fetch-engine": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.20.0.tgz", - "integrity": "sha512-JVcaPXC940wOGpCOwuqQRTz6I9SaBK0c1BAyC1pcz9xBi+dzFgUu3G/p9GV1FhFs9OKpfSpIhQfUJE9y00zhqw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-7.0.1.tgz", + "integrity": "sha512-5DnSairYIYU7dcv/9pb1KCwIRHZfhVOd34855d01lUI5QdF9rdCkMywPQbBM67YP7iCgQoEZO0/COtOMpR4i9A==", "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.20.0", - "@prisma/engines-version": "5.20.0-12.06fc58a368dc7be9fbbbe894adf8d445d208c284", - "@prisma/get-platform": "5.20.0" + "@prisma/debug": "7.0.1", + "@prisma/engines-version": "7.1.0-2.f09f2815f091dbba658cdcd2264306d88bb5bda6", + "@prisma/get-platform": "7.0.1" + } + }, + "node_modules/@prisma/fetch-engine/node_modules/@prisma/get-platform": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-7.0.1.tgz", + "integrity": "sha512-DrsGnZOsF7PlAE7UtqmJenWti87RQtg7v9qW9alS71Pj0P6ZQV0RuzRQaql9dCWoo6qKAaF5U/L4kI826MmiZg==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@prisma/debug": "7.0.1" } }, "node_modules/@prisma/get-platform": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.20.0.tgz", - "integrity": "sha512-8/+CehTZZNzJlvuryRgc77hZCWrUDYd/PmlZ7p2yNXtmf2Una4BWnTbak3us6WVdqoz5wmptk6IhsXdG2v5fmA==", + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-6.8.2.tgz", + "integrity": "sha512-vXSxyUgX3vm1Q70QwzwkjeYfRryIvKno1SXbIqwSptKwqKzskINnDUcx85oX+ys6ooN2ATGSD0xN2UTfg6Zcow==", "devOptional": true, "license": "Apache-2.0", "dependencies": { - "@prisma/debug": "5.20.0" + "@prisma/debug": "6.8.2" } }, + "node_modules/@prisma/get-platform/node_modules/@prisma/debug": { + "version": "6.8.2", + "resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-6.8.2.tgz", + "integrity": "sha512-4muBSSUwJJ9BYth5N8tqts8JtiLT8QI/RSAzEogwEfpbYGFo9mYsInsVo8dqXdPO2+Rm5OG5q0qWDDE3nyUbVg==", + "devOptional": true, + "license": "Apache-2.0" + }, "node_modules/@prisma/instrumentation": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/@prisma/instrumentation/-/instrumentation-5.20.0.tgz", - "integrity": "sha512-SHaI+3F4mu879fuD19qXKZGv+scgUOnFjX29/KFVwURpjz7trq3yfz91rwZaFuN4IAqUKJNcqEt4UOzoFHWklw==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/@prisma/instrumentation/-/instrumentation-7.0.1.tgz", + "integrity": "sha512-akYN1HvEARcV+bkutLJcsEw2MDnj1qP2A8b66KGsSDpAdesvGAy8bqyWKPHizzHD5brR5HPMC/cObUCIeMbg/w==", + "license": "Apache-2.0", + "dependencies": { + "@opentelemetry/instrumentation": "^0.207.0" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.8" + } + }, + "node_modules/@prisma/instrumentation/node_modules/@opentelemetry/api-logs": { + "version": "0.207.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api-logs/-/api-logs-0.207.0.tgz", + "integrity": "sha512-lAb0jQRVyleQQGiuuvCOTDVspc14nx6XJjP4FspJ1sNARo3Regq4ZZbrc3rN4b1TYSuUCvgH+UXUPug4SLOqEQ==", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/api": "^1.8", - "@opentelemetry/instrumentation": "^0.49 || ^0.50 || ^0.51 || ^0.52.0 || ^0.53.0", - "@opentelemetry/sdk-trace-base": "^1.22" + "@opentelemetry/api": "^1.3.0" + }, + "engines": { + "node": ">=8.0.0" } }, "node_modules/@prisma/instrumentation/node_modules/@opentelemetry/instrumentation": { - "version": "0.53.0", - "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.53.0.tgz", - "integrity": "sha512-DMwg0hy4wzf7K73JJtl95m/e0boSoWhH07rfvHvYzQtBD3Bmv0Wc1x733vyZBqmFm8OjJD0/pfiUg1W3JjFX0A==", + "version": "0.207.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/instrumentation/-/instrumentation-0.207.0.tgz", + "integrity": "sha512-y6eeli9+TLKnznrR8AZlQMSJT7wILpXH+6EYq5Vf/4Ao+huI7EedxQHwRgVUOMLFbe7VFDvHJrX9/f4lcwnJsA==", "license": "Apache-2.0", "dependencies": { - "@opentelemetry/api-logs": "0.53.0", - "@types/shimmer": "^1.2.0", - "import-in-the-middle": "^1.8.1", - "require-in-the-middle": "^7.1.1", - "semver": "^7.5.2", - "shimmer": "^1.2.1" + "@opentelemetry/api-logs": "0.207.0", + "import-in-the-middle": "^2.0.0", + "require-in-the-middle": "^8.0.0" }, "engines": { - "node": ">=14" + "node": "^18.19.0 || >=20.6.0" }, "peerDependencies": { "@opentelemetry/api": "^1.3.0" } }, "node_modules/@prisma/instrumentation/node_modules/import-in-the-middle": { - "version": "1.11.2", - "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-1.11.2.tgz", - "integrity": "sha512-gK6Rr6EykBcc6cVWRSBR5TWf8nn6hZMYSRYqCcHa0l0d1fPK7JSYo6+Mlmck76jIX9aL/IZ71c06U2VpFwl1zA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/import-in-the-middle/-/import-in-the-middle-2.0.0.tgz", + "integrity": "sha512-yNZhyQYqXpkT0AKq3F3KLasUSK4fHvebNH5hOsKQw2dhGSALvQ4U0BqUc5suziKvydO5u5hgN2hy1RJaho8U5A==", "license": "Apache-2.0", "dependencies": { - "acorn": "^8.8.2", + "acorn": "^8.14.0", "acorn-import-attributes": "^1.9.5", "cjs-module-lexer": "^1.2.2", "module-details-from-path": "^1.0.3" } }, - "node_modules/@prisma/instrumentation/node_modules/semver": { - "version": "7.6.3", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.3.tgz", - "integrity": "sha512-oVekP1cKtI+CTDvHWYFUcMtsK/00wmAEfyqKfNdARm8u1wNVhSgaX7A8d4UuIlUI5e84iEwOhs7ZPYRmzU9U6A==", - "license": "ISC", - "bin": { - "semver": "bin/semver.js" + "node_modules/@prisma/instrumentation/node_modules/require-in-the-middle": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/require-in-the-middle/-/require-in-the-middle-8.0.1.tgz", + "integrity": "sha512-QT7FVMXfWOYFbeRBF6nu+I6tr2Tf3u0q8RIEjNob/heKY/nh7drD/k7eeMFmSQgnTtCzLDcCu/XEnpW2wk4xCQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.3.5", + "module-details-from-path": "^1.0.3" }, "engines": { - "node": ">=10" + "node": ">=9.3.0 || >=8.10.0 <9.0.0" } }, "node_modules/@prisma/prisma-fmt-wasm": { @@ -5368,6 +5583,25 @@ "dev": true, "license": "Apache-2.0" }, + "node_modules/@prisma/query-plan-executor": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/@prisma/query-plan-executor/-/query-plan-executor-6.18.0.tgz", + "integrity": "sha512-jZ8cfzFgL0jReE1R10gT8JLHtQxjWYLiQ//wHmVYZ2rVkFHoh0DT8IXsxcKcFlfKN7ak7k6j0XMNn2xVNyr5cA==", + "devOptional": true, + "license": "Apache-2.0" + }, + "node_modules/@prisma/studio-core": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/@prisma/studio-core/-/studio-core-0.8.2.tgz", + "integrity": "sha512-/iAEWEUpTja+7gVMu1LtR2pPlvDmveAwMHdTWbDeGlT7yiv0ZTCPpmeAGdq/Y9aJ9Zj1cEGBXGRbmmNPj022PQ==", + "devOptional": true, + "license": "UNLICENSED", + "peerDependencies": { + "@types/react": "^18.0.0 || ^19.0.0", + "react": "^18.0.0 || ^19.0.0", + "react-dom": "^18.0.0 || ^19.0.0" + } + }, "node_modules/@puppeteer/browsers": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@puppeteer/browsers/-/browsers-2.4.0.tgz", @@ -5940,6 +6174,13 @@ "@sinonjs/commons": "^3.0.0" } }, + "node_modules/@standard-schema/spec": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/@standard-schema/spec/-/spec-1.0.0.tgz", + "integrity": "sha512-m2bOd0f2RT9k8QJx1JN85cZYyH1RqFBdlwtkSlf4tBDYLCiiZnv1fIIwacK6cqwXavOydf0NPToMQgpKq+dVlA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/@supercharge/promise-pool": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@supercharge/promise-pool/-/promise-pool-2.4.0.tgz", @@ -5961,6 +6202,12 @@ "node": ">=14.16" } }, + "node_modules/@tediousjs/connection-string": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/@tediousjs/connection-string/-/connection-string-0.5.0.tgz", + "integrity": "sha512-7qSgZbincDDDFyRweCIEvZULFAw5iz/DeunhvuxpL31nfntX3P4Yd4HkHBRg9H8CdqY1e5WFN1PZIz/REL9MVQ==", + "license": "MIT" + }, "node_modules/@testing-library/dom": { "version": "8.20.1", "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.20.1.tgz", @@ -6689,6 +6936,17 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/react": { + "version": "19.2.7", + "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.7.tgz", + "integrity": "sha512-MWtvHrGZLFttgeEj28VXHxpmwYbor/ATPYbBfSFZEIRK0ecCFLl2Qo55z52Hss+UV9CRN7trSeq1zbgx7YDWWg==", + "devOptional": true, + "license": "MIT", + "peer": true, + "dependencies": { + "csstype": "^3.2.2" + } + }, "node_modules/@types/readable-stream": { "version": "4.0.15", "resolved": "https://registry.npmjs.org/@types/readable-stream/-/readable-stream-4.0.15.tgz", @@ -7275,9 +7533,9 @@ } }, "node_modules/acorn": { - "version": "8.12.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.12.1.tgz", - "integrity": "sha512-tcpGyI9zbizT9JbV6oYE477V6mTlXvvi0T0G3SNIYE2apm/G5huBa1+K89VGeovbg+jycCrfhl3ADxErOuO6Jg==", + "version": "8.15.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.15.0.tgz", + "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "license": "MIT", "bin": { "acorn": "bin/acorn" @@ -7762,6 +8020,15 @@ "semver": "bin/semver" } }, + "node_modules/async-mutex": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/async-mutex/-/async-mutex-0.5.0.tgz", + "integrity": "sha512-1A94B18jkJ3DYq284ohPxoXbfTA5HsQ7/Mf4DEhcyLx3Bz27Rh59iScbB6EPiP+B+joue6YCxcMXSbFC1tZKwA==", + "license": "MIT", + "dependencies": { + "tslib": "^2.4.0" + } + }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -8881,6 +9148,78 @@ "node": ">= 0.8" } }, + "node_modules/c12": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/c12/-/c12-3.1.0.tgz", + "integrity": "sha512-uWoS8OU1MEIsOv8p/5a82c3H31LsWVR5qiyXVfBNOzfffjUWtPnhAb4BYI2uG2HfGmZmFjCtui5XNWaps+iFuw==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "chokidar": "^4.0.3", + "confbox": "^0.2.2", + "defu": "^6.1.4", + "dotenv": "^16.6.1", + "exsolve": "^1.0.7", + "giget": "^2.0.0", + "jiti": "^2.4.2", + "ohash": "^2.0.11", + "pathe": "^2.0.3", + "perfect-debounce": "^1.0.0", + "pkg-types": "^2.2.0", + "rc9": "^2.1.2" + }, + "peerDependencies": { + "magicast": "^0.3.5" + }, + "peerDependenciesMeta": { + "magicast": { + "optional": true + } + } + }, + "node_modules/c12/node_modules/chokidar": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", + "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "readdirp": "^4.0.1" + }, + "engines": { + "node": ">= 14.16.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/c12/node_modules/dotenv": { + "version": "16.6.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", + "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", + "devOptional": true, + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/c12/node_modules/readdirp": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", + "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">= 14.18.0" + }, + "funding": { + "type": "individual", + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/cacheable-lookup": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-7.0.0.tgz", @@ -9088,6 +9427,28 @@ "node": ">= 0.8.0" } }, + "node_modules/chevrotain": { + "version": "10.5.0", + "resolved": "https://registry.npmjs.org/chevrotain/-/chevrotain-10.5.0.tgz", + "integrity": "sha512-Pkv5rBY3+CsHOYfV5g/Vs5JY9WTHHDEKOlohI2XeygaZhUeqhAlldZ8Hz9cRmxu709bvS08YzxHdTPHhffc13A==", + "devOptional": true, + "license": "Apache-2.0", + "dependencies": { + "@chevrotain/cst-dts-gen": "10.5.0", + "@chevrotain/gast": "10.5.0", + "@chevrotain/types": "10.5.0", + "@chevrotain/utils": "10.5.0", + "lodash": "4.17.21", + "regexp-to-ast": "0.5.0" + } + }, + "node_modules/chevrotain/node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "devOptional": true, + "license": "MIT" + }, "node_modules/chokidar": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", @@ -9358,6 +9719,16 @@ "node": ">=8" } }, + "node_modules/citty": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/citty/-/citty-0.1.6.tgz", + "integrity": "sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "consola": "^3.2.3" + } + }, "node_modules/cjs-module-lexer": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.4.1.tgz", @@ -9836,6 +10207,13 @@ "typedarray": "^0.0.6" } }, + "node_modules/confbox": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/confbox/-/confbox-0.2.2.tgz", + "integrity": "sha512-1NB+BKqhtNipMsov4xI/NnhCKp9XG9NamYp5PVm9klAT0fsrNPjaFICsCFhNhwZJKNh7zB/3q8qXz0E9oaMNtQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/connect-redis": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/connect-redis/-/connect-redis-7.1.1.tgz", @@ -9849,10 +10227,10 @@ } }, "node_modules/consola": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", - "integrity": "sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==", - "dev": true, + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/consola/-/consola-3.4.2.tgz", + "integrity": "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==", + "devOptional": true, "license": "MIT", "engines": { "node": "^14.18.0 || >=16.10.0" @@ -10176,10 +10554,10 @@ } }, "node_modules/cross-spawn": { - "version": "7.0.3", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", - "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", - "dev": true, + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "devOptional": true, "license": "MIT", "dependencies": { "path-key": "^3.1.0", @@ -10244,6 +10622,14 @@ "node": ">=18" } }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "devOptional": true, + "license": "MIT", + "peer": true + }, "node_modules/csv-stringify": { "version": "6.5.1", "resolved": "https://registry.npmjs.org/csv-stringify/-/csv-stringify-6.5.1.tgz", @@ -10886,6 +11272,16 @@ "node": ">=0.10.0" } }, + "node_modules/deepmerge-ts": { + "version": "7.1.5", + "resolved": "https://registry.npmjs.org/deepmerge-ts/-/deepmerge-ts-7.1.5.tgz", + "integrity": "sha512-HOJkrhaYsweh+W+e74Yn7YStZOilkoPb6fycpwNLKzSPtruFs48nYis0zy5yJz1+ktUhHxoRDJ27RQAWLIJVJw==", + "devOptional": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=16.0.0" + } + }, "node_modules/defaults": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/defaults/-/defaults-1.0.4.tgz", @@ -10962,6 +11358,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/defu": { + "version": "6.1.4", + "resolved": "https://registry.npmjs.org/defu/-/defu-6.1.4.tgz", + "integrity": "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg==", + "devOptional": true, + "license": "MIT" + }, "node_modules/degenerator": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/degenerator/-/degenerator-5.0.1.tgz", @@ -11004,6 +11407,13 @@ "node": ">= 0.8" } }, + "node_modules/destr": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/destr/-/destr-2.0.5.tgz", + "integrity": "sha512-ugFTXCtDZunbzasqBxrK93Ik/DRYsO6S/fedkWEMKqt04xZ4csmnmwGDBAb07QWNaGMAmnTIemsYZCksjATwsA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/destroy": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/destroy/-/destroy-1.2.0.tgz", @@ -11381,6 +11791,17 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "license": "MIT" }, + "node_modules/effect": { + "version": "3.18.4", + "resolved": "https://registry.npmjs.org/effect/-/effect-3.18.4.tgz", + "integrity": "sha512-b1LXQJLe9D11wfnOKAk3PKxuqYshQ0Heez+y5pnkd3jLj1yx9QhM72zZ9uUrOQyNvrs2GZZd/3maL0ZV18YuDA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "@standard-schema/spec": "^1.0.0", + "fast-check": "^3.23.1" + } + }, "node_modules/electron-to-chromium": { "version": "1.5.31", "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.31.tgz", @@ -11416,6 +11837,16 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "license": "MIT" }, + "node_modules/empathic": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/empathic/-/empathic-2.0.0.tgz", + "integrity": "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=14" + } + }, "node_modules/encodeurl": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", @@ -12548,6 +12979,13 @@ "node": ">= 0.8.0" } }, + "node_modules/exsolve": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/exsolve/-/exsolve-1.0.8.tgz", + "integrity": "sha512-LmDxfWXwcTArk8fUEnOfSZpHOJ6zOMUJKOtFLFqJLoKJetuQG874Uc7/Kki7zFLzYybmZhp1M7+98pfMqeX8yA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -12630,6 +13068,29 @@ ], "license": "MIT" }, + "node_modules/fast-check": { + "version": "3.23.2", + "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.23.2.tgz", + "integrity": "sha512-h5+1OzzfCC3Ef7VbtKdcv7zsstUQwUDlYpUTvjeUsJAssPgLn7QzbboPtL5ro04Mq0rPOsMzl7q5hIbRs2wD1A==", + "devOptional": true, + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/dubzzz" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fast-check" + } + ], + "license": "MIT", + "dependencies": { + "pure-rand": "^6.1.0" + }, + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/fast-copy": { "version": "2.1.7", "resolved": "https://registry.npmjs.org/fast-copy/-/fast-copy-2.1.7.tgz", @@ -12994,13 +13455,13 @@ } }, "node_modules/foreground-child": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.0.tgz", - "integrity": "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg==", - "dev": true, + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", + "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "devOptional": true, "license": "ISC", "dependencies": { - "cross-spawn": "^7.0.0", + "cross-spawn": "^7.0.6", "signal-exit": "^4.0.1" }, "engines": { @@ -13014,7 +13475,7 @@ "version": "4.1.0", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, + "devOptional": true, "license": "ISC", "engines": { "node": ">=14" @@ -13263,6 +13724,13 @@ "node": ">=8.0.0" } }, + "node_modules/get-port-please": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/get-port-please/-/get-port-please-3.1.2.tgz", + "integrity": "sha512-Gxc29eLs1fbn6LQ4jSU4vXjlwyZhF5HsGuMAa7gqBP4Rw4yxxltyDUuF5MBclFzDTXO+ACchGQoeela4DSfzdQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/get-stream": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", @@ -13339,6 +13807,24 @@ "assert-plus": "^1.0.0" } }, + "node_modules/giget": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/giget/-/giget-2.0.0.tgz", + "integrity": "sha512-L5bGsVkxJbJgdnwyuheIunkGatUF/zssUoxxjACCseZYAVbaqdh9Tsmmlkl8vYan09H7sbvKt4pS8GqKLBrEzA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "citty": "^0.1.6", + "consola": "^3.4.0", + "defu": "^6.1.4", + "node-fetch-native": "^1.6.6", + "nypm": "^0.6.0", + "pathe": "^2.0.3" + }, + "bin": { + "giget": "dist/cli.mjs" + } + }, "node_modules/git-raw-commits": { "version": "2.0.11", "resolved": "https://registry.npmjs.org/git-raw-commits/-/git-raw-commits-2.0.11.tgz", @@ -13589,9 +14075,16 @@ "version": "4.2.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", - "dev": true, + "devOptional": true, "license": "ISC" }, + "node_modules/grammex": { + "version": "3.1.11", + "resolved": "https://registry.npmjs.org/grammex/-/grammex-3.1.11.tgz", + "integrity": "sha512-HNwLkgRg9SqTAd1N3Uh/MnKwTBTzwBxTOPbXQ8pb0tpwydjk90k4zRE8JUn9fMUiRwKtXFZ1TWFmms3dZHN+Fg==", + "devOptional": true, + "license": "MIT" + }, "node_modules/graphemer": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/graphemer/-/graphemer-1.4.0.tgz", @@ -13802,6 +14295,16 @@ "node": ">=0.10.0" } }, + "node_modules/hono": { + "version": "4.7.10", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.7.10.tgz", + "integrity": "sha512-QkACju9MiN59CKSY5JsGZCYmPZkA6sIW6OFCUp7qDjZu6S6KHtJHhAc9Uy9mV9F8PJ1/HQ3ybZF2yjCa/73fvQ==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=16.9.0" + } + }, "node_modules/hosted-git-info": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-4.1.0.tgz", @@ -13990,6 +14493,13 @@ "node": ">=0.10" } }, + "node_modules/http-status-codes": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/http-status-codes/-/http-status-codes-2.3.0.tgz", + "integrity": "sha512-RJ8XvFvpPM/Dmc5SV+dC4y5PCeOhT3x1Hq0NU3rjGeg5a/CqlhZ7uudknPwZFz4aeAXDcbAyaeP7GAo9lvngtA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/http2-client": { "version": "1.3.5", "resolved": "https://registry.npmjs.org/http2-client/-/http2-client-1.3.5.tgz", @@ -15066,7 +15576,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/isstream": { @@ -17331,6 +17841,16 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, + "node_modules/jiti": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.6.1.tgz", + "integrity": "sha512-ekilCSN1jwRvIbgeg/57YFh8qQDNbwDb9xT/qu2DAHbFFZUicIl4ygVaAvzveMhMVr3LnpSKTNnwt8PoOfmKhQ==", + "devOptional": true, + "license": "MIT", + "bin": { + "jiti": "lib/jiti-cli.mjs" + } + }, "node_modules/joi": { "version": "17.13.3", "resolved": "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz", @@ -19006,6 +19526,35 @@ "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", "license": "MIT" }, + "node_modules/mssql": { + "version": "11.0.1", + "resolved": "https://registry.npmjs.org/mssql/-/mssql-11.0.1.tgz", + "integrity": "sha512-KlGNsugoT90enKlR8/G36H0kTxPthDhmtNUCwEHvgRza5Cjpjoj+P2X6eMpFUDN7pFrJZsKadL4x990G8RBE1w==", + "license": "MIT", + "dependencies": { + "@tediousjs/connection-string": "^0.5.0", + "commander": "^11.0.0", + "debug": "^4.3.3", + "rfdc": "^1.3.0", + "tarn": "^3.0.2", + "tedious": "^18.2.1" + }, + "bin": { + "mssql": "bin/mssql" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/mssql/node_modules/commander": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-11.1.0.tgz", + "integrity": "sha512-yPVavfyCcRhmorC7rWlkHn15b4wDVgVmBA7kV4QVBsF7kv/9TKJAbAXVTxvTnwP8HHKjRCJDClKbciiYS7p0DQ==", + "license": "MIT", + "engines": { + "node": ">=16" + } + }, "node_modules/mute-stream": { "version": "0.0.8", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", @@ -19014,15 +19563,15 @@ "license": "ISC" }, "node_modules/mysql2": { - "version": "3.11.3", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.3.tgz", - "integrity": "sha512-Qpu2ADfbKzyLdwC/5d4W7+5Yz7yBzCU05YWt5npWzACST37wJsB23wgOSo00qi043urkiRwXtEvJc9UnuLX/MQ==", + "version": "3.15.3", + "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.15.3.tgz", + "integrity": "sha512-FBrGau0IXmuqg4haEZRBfHNWB5mUARw6hNwPDXXGg0XzVJ50mr/9hb267lvpVMnhZ1FON3qNd4Xfcez1rbFwSg==", "license": "MIT", "dependencies": { "aws-ssl-profiles": "^1.1.1", "denque": "^2.1.0", "generate-function": "^2.3.1", - "iconv-lite": "^0.6.3", + "iconv-lite": "^0.7.0", "long": "^5.2.1", "lru.min": "^1.0.0", "named-placeholders": "^1.1.3", @@ -19034,15 +19583,19 @@ } }, "node_modules/mysql2/node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.0.tgz", + "integrity": "sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ==", "license": "MIT", "dependencies": { "safer-buffer": ">= 2.1.2 < 3.0.0" }, "engines": { "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" } }, "node_modules/named-placeholders": { @@ -19207,6 +19760,13 @@ "node": "4.x || >=6.0.0" } }, + "node_modules/node-fetch-native": { + "version": "1.6.7", + "resolved": "https://registry.npmjs.org/node-fetch-native/-/node-fetch-native-1.6.7.tgz", + "integrity": "sha512-g9yhqoedzIUm0nTnTqAQvueMPVOuIY16bqgAJJC8XOOubYFNwz6IER9qs0Gq2Xd0+CecCKFjtdDTMA4u4xG06Q==", + "devOptional": true, + "license": "MIT" + }, "node_modules/node-html-parser": { "version": "5.4.2", "resolved": "https://registry.npmjs.org/node-html-parser/-/node-html-parser-5.4.2.tgz", @@ -19619,6 +20179,26 @@ "integrity": "sha512-cTGB9ptp9dY9A5VbMSe7fQBcl/tt22Vcqdq8+eN93rblOuE0aCFu4aZ2vMwct/2t+lFnosm8RkQW1I0Omb1UtQ==", "license": "MIT" }, + "node_modules/nypm": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/nypm/-/nypm-0.6.2.tgz", + "integrity": "sha512-7eM+hpOtrKrBDCh7Ypu2lJ9Z7PNZBdi/8AT3AX8xoCj43BBVHD0hPSTEvMtkMpfs8FCqBGhxB+uToIQimA111g==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "citty": "^0.1.6", + "consola": "^3.4.2", + "pathe": "^2.0.3", + "pkg-types": "^2.3.0", + "tinyexec": "^1.0.1" + }, + "bin": { + "nypm": "dist/cli.mjs" + }, + "engines": { + "node": "^14.16.0 || >=16.10.0" + } + }, "node_modules/oas-kit-common": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/oas-kit-common/-/oas-kit-common-1.0.8.tgz", @@ -19761,6 +20341,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/ohash": { + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/ohash/-/ohash-2.0.11.tgz", + "integrity": "sha512-RdR9FQrFwNBNXAr4GixM8YaRZRJ5PUWbKYbE5eOsrwAjJW0q2REGcf79oYPsLyskQCZG1PLN+S/K1V00joZAoQ==", + "devOptional": true, + "license": "MIT" + }, "node_modules/on-exit-leak-free": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/on-exit-leak-free/-/on-exit-leak-free-2.1.2.tgz", @@ -20182,7 +20769,7 @@ "version": "3.1.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=8" @@ -20234,6 +20821,13 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "devOptional": true, + "license": "MIT" + }, "node_modules/pathval": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", @@ -20250,6 +20844,13 @@ "dev": true, "license": "MIT" }, + "node_modules/perfect-debounce": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/perfect-debounce/-/perfect-debounce-1.0.0.tgz", + "integrity": "sha512-xCy9V055GLEqoFaHoC1SoLIaLmWctgCUaBaWxDZ7/Zx4CTyX7cJQLJOok/orfjZAh9kEYpjJa4d0KcJmCbctZA==", + "devOptional": true, + "license": "MIT" + }, "node_modules/performance-now": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", @@ -20709,6 +21310,18 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/pkg-types": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pkg-types/-/pkg-types-2.3.0.tgz", + "integrity": "sha512-SIqCzDRg0s9npO5XQ3tNZioRY1uK06lA41ynBC1YmFTmnY6FjUjVt6s4LoADmwoig1qqD0oK8h1p/8mlMx8Oig==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "confbox": "^0.2.2", + "exsolve": "^1.0.7", + "pathe": "^2.0.3" + } + }, "node_modules/pluralize": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-8.0.0.tgz", @@ -20763,6 +21376,20 @@ "dev": true, "license": "MIT" }, + "node_modules/postgres": { + "version": "3.4.7", + "resolved": "https://registry.npmjs.org/postgres/-/postgres-3.4.7.tgz", + "integrity": "sha512-Jtc2612XINuBjIl/QTWsV5UvE8UHuNblcO3vVADSrKsrc6RqGX6lOW1cEo3CM2v0XG4Nat8nI+YM7/f26VxXLw==", + "devOptional": true, + "license": "Unlicense", + "engines": { + "node": ">=12" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/porsager" + } + }, "node_modules/preact": { "version": "8.5.3", "resolved": "https://registry.npmjs.org/preact/-/preact-8.5.3.tgz", @@ -20855,23 +21482,37 @@ } }, "node_modules/prisma": { - "version": "5.20.0", - "resolved": "https://registry.npmjs.org/prisma/-/prisma-5.20.0.tgz", - "integrity": "sha512-6obb3ucKgAnsGS9x9gLOe8qa51XxvJ3vLQtmyf52CTey1Qcez3A6W6ROH5HIz5Q5bW+0VpmZb8WBohieMFGpig==", + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/prisma/-/prisma-7.0.1.tgz", + "integrity": "sha512-zp93MdFMSU1IHPEXbUHVUuD8wauh2BUm14OVxhxGrWJQQpXpda0rW4VSST2bci4raoldX64/wQxHKkl/wqDskQ==", "devOptional": true, "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { - "@prisma/engines": "5.20.0" + "@prisma/config": "7.0.1", + "@prisma/dev": "0.13.0", + "@prisma/engines": "7.0.1", + "@prisma/studio-core": "0.8.2", + "mysql2": "3.15.3", + "postgres": "3.4.7" }, "bin": { "prisma": "build/index.js" }, "engines": { - "node": ">=16.13" + "node": "^20.19 || ^22.12 || >=24.0" }, - "optionalDependencies": { - "fsevents": "2.3.3" + "peerDependencies": { + "better-sqlite3": ">=9.0.0", + "typescript": ">=5.4.0" + }, + "peerDependenciesMeta": { + "better-sqlite3": { + "optional": true + }, + "typescript": { + "optional": true + } } }, "node_modules/process": { @@ -20939,6 +21580,18 @@ "node": ">= 8" } }, + "node_modules/proper-lockfile": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/proper-lockfile/-/proper-lockfile-4.1.2.tgz", + "integrity": "sha512-TjNPblN4BwAWMXU8s9AEz4JmQxnD1NNL7bNOY/AKUzyamc379FWASUhc/K1pL2noVb+XmZKLL68cjzLsiOAMaA==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "graceful-fs": "^4.2.4", + "retry": "^0.12.0", + "signal-exit": "^3.0.2" + } + }, "node_modules/prosemirror-commands": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/prosemirror-commands/-/prosemirror-commands-1.6.0.tgz", @@ -21170,27 +21823,11 @@ } } }, - "node_modules/puppeteer/node_modules/typescript": { - "version": "5.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.6.2.tgz", - "integrity": "sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw==", - "dev": true, - "license": "Apache-2.0", - "optional": true, - "peer": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, "node_modules/pure-rand": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", - "dev": true, + "devOptional": true, "funding": [ { "type": "individual", @@ -21330,6 +21967,42 @@ "node": ">= 0.8" } }, + "node_modules/rc9": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/rc9/-/rc9-2.1.2.tgz", + "integrity": "sha512-btXCnMmRIBINM2LDZoEmOogIZU7Qe7zn4BpomSKZ/ykbLObuBdvG+mFq11DL6fjH1DRwHhrlgtYWG96bJiC7Cg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "defu": "^6.1.4", + "destr": "^2.0.3" + } + }, + "node_modules/react": { + "version": "19.2.0", + "resolved": "https://registry.npmjs.org/react/-/react-19.2.0.tgz", + "integrity": "sha512-tmbWg6W31tQLeB5cdIBOicJDJRR2KzXsV7uSK9iNfLWQ5bIZfxuPEHp7M8wiHyHnn0DD1i7w3Zmin0FtkrwoCQ==", + "devOptional": true, + "license": "MIT", + "peer": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "19.2.0", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.2.0.tgz", + "integrity": "sha512-UlbRu4cAiGaIewkPyiRGJk0imDN2T3JjieT6spoL2UeSf5od4n5LB/mQ4ejmxhCFT1tYe8IvaFulzynWovsEFQ==", + "devOptional": true, + "license": "MIT", + "peer": true, + "dependencies": { + "scheduler": "^0.27.0" + }, + "peerDependencies": { + "react": "^19.2.0" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -21664,6 +22337,13 @@ "@babel/runtime": "^7.8.4" } }, + "node_modules/regexp-to-ast": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/regexp-to-ast/-/regexp-to-ast-0.5.0.tgz", + "integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==", + "devOptional": true, + "license": "MIT" + }, "node_modules/regexp.prototype.flags": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.2.tgz", @@ -21721,6 +22401,29 @@ "regjsparser": "bin/parser" } }, + "node_modules/remeda": { + "version": "2.21.3", + "resolved": "https://registry.npmjs.org/remeda/-/remeda-2.21.3.tgz", + "integrity": "sha512-XXrZdLA10oEOQhLLzEJEiFFSKi21REGAkHdImIb4rt/XXy8ORGXh5HCcpUOsElfPNDb+X6TA/+wkh+p2KffYmg==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "type-fest": "^4.39.1" + } + }, + "node_modules/remeda/node_modules/type-fest": { + "version": "4.41.0", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.41.0.tgz", + "integrity": "sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA==", + "devOptional": true, + "license": "(MIT OR CC0-1.0)", + "engines": { + "node": ">=16" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/request-progress": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", @@ -21939,6 +22642,16 @@ "node": ">=4" } }, + "node_modules/retry": { + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/retry/-/retry-0.12.0.tgz", + "integrity": "sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">= 4" + } + }, "node_modules/retry-as-promised": { "version": "7.0.4", "resolved": "https://registry.npmjs.org/retry-as-promised/-/retry-as-promised-7.0.4.tgz", @@ -21960,7 +22673,6 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/rfdc/-/rfdc-1.4.1.tgz", "integrity": "sha512-q1b3N5QkRUWUl7iyylaaj3kOpIT0N2i9MqIEQXP73GVsN9cw3fdx8X63cEmWhJGi2PPCF23Ijp7ktmd39rawIA==", - "dev": true, "license": "MIT" }, "node_modules/rhea": { @@ -22300,6 +23012,14 @@ "node": ">=v12.22.7" } }, + "node_modules/scheduler": { + "version": "0.27.0", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.27.0.tgz", + "integrity": "sha512-eNv+WrVbKu1f3vbYJT/xtiF5syA5HPIMtf9IgY/nKg0sWqzAUEvqY/xm7OcZc/qafLx/iO9FgOmeSAp4v5ti/Q==", + "devOptional": true, + "license": "MIT", + "peer": true + }, "node_modules/schema-utils": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-4.2.0.tgz", @@ -22599,7 +23319,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, + "devOptional": true, "license": "MIT", "dependencies": { "shebang-regex": "^3.0.0" @@ -22612,7 +23332,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, + "devOptional": true, "license": "MIT", "engines": { "node": ">=8" @@ -22716,7 +23436,7 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true, + "devOptional": true, "license": "ISC" }, "node_modules/signale": { @@ -23111,6 +23831,13 @@ "node": ">= 0.8" } }, + "node_modules/std-env": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", + "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", + "devOptional": true, + "license": "MIT" + }, "node_modules/stop-iteration-iterator": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", @@ -23757,6 +24484,15 @@ "streamx": "^2.15.0" } }, + "node_modules/tarn": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/tarn/-/tarn-3.0.2.tgz", + "integrity": "sha512-51LAVKUSZSVfI05vjPESNc5vwqqZpbXCsU+/+wxlOrUjk2SnFTt97v9ZgQrD4YmxYW1Px6w2KjaDitCfkvgxMQ==", + "license": "MIT", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/tedious": { "version": "18.6.1", "resolved": "https://registry.npmjs.org/tedious/-/tedious-18.6.1.tgz", @@ -24108,6 +24844,16 @@ "node": ">= 6" } }, + "node_modules/tinyexec": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-1.0.2.tgz", + "integrity": "sha512-W/KYk+NFhkmsYpuHq5JykngiOCnxeVL8v8dFnqxSD8qEEdRfXk1SDM6JzNqcERbcGYj9tMrDQBYV9cjgnunFIg==", + "devOptional": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, "node_modules/tmp": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.2.3.tgz", @@ -24585,17 +25331,17 @@ "license": "MIT" }, "node_modules/typescript": { - "version": "4.7.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", - "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", - "dev": true, + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "devOptional": true, "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" }, "engines": { - "node": ">=4.2.0" + "node": ">=14.17" } }, "node_modules/uid-safe": { @@ -24857,6 +25603,21 @@ "node": ">=10.12.0" } }, + "node_modules/valibot": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/valibot/-/valibot-1.1.0.tgz", + "integrity": "sha512-Nk8lX30Qhu+9txPYTwM0cFlWLdPFsFr6LblzqIySfbZph9+BFsAHsNvHOymEviUepeIW6KFHzpX8TKhbptBXXw==", + "devOptional": true, + "license": "MIT", + "peerDependencies": { + "typescript": ">=5" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, "node_modules/validate-npm-package-license": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.4.tgz", @@ -25170,7 +25931,7 @@ "version": "2.0.2", "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, + "devOptional": true, "license": "ISC", "dependencies": { "isexe": "^2.0.0" @@ -25592,6 +26353,16 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/zeptomatch": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/zeptomatch/-/zeptomatch-2.0.2.tgz", + "integrity": "sha512-H33jtSKf8Ijtb5BW6wua3G5DhnFjbFML36eFu+VdOoVY4HD9e7ggjqdM6639B+L87rjnR6Y+XeRzBXZdy52B/g==", + "devOptional": true, + "license": "MIT", + "dependencies": { + "grammex": "^3.1.10" + } + }, "node_modules/zod": { "version": "3.23.8", "resolved": "https://registry.npmjs.org/zod/-/zod-3.23.8.tgz", diff --git a/package.json b/package.json index e66eca75fc..dde63c0263 100644 --- a/package.json +++ b/package.json @@ -63,8 +63,9 @@ "@pins/redis": "^0.0.0", "@planning-inspectorate/address-lookup": "^1.0.6", "@planning-inspectorate/data-model": "~2.27.0", - "@prisma/client": "^5.13.0", - "@prisma/instrumentation": "^5.6.0", + "@prisma/adapter-mssql": "^7.0.1", + "@prisma/client": "^7.0.1", + "@prisma/instrumentation": "^7.0.1", "@supercharge/promise-pool": "^2.4.0", "@toast-ui/editor": "^3.2.2", "accessible-autocomplete": "2.0.4", @@ -193,7 +194,7 @@ "postcss": "^8.4.31", "prettier": "^2.6.2", "prettier-plugin-prisma": "^4.13.0", - "prisma": "^5.13.0", + "prisma": "^7.0.1", "puppeteer": "^23.5.0", "rimraf": "^3.0.2", "rollup": "^4.22.4", @@ -207,7 +208,7 @@ "terser": "^5.13.1", "turbo": "^1.2.14", "type-fest": "^2.12.2", - "typescript": "4.7.4" + "typescript": "^5.9.3" }, "packageManager": "npm@10.1.0", "lint-staged": { diff --git a/packages/express/types/express.d.ts b/packages/express/types/express.d.ts index 06da7dd0c4..06d3c195dd 100644 --- a/packages/express/types/express.d.ts +++ b/packages/express/types/express.d.ts @@ -73,6 +73,20 @@ export interface RenderHandler< ): void; } +export interface RenderHandlerNoNext< + RenderOptions extends Record, + ReqLocals extends Record = undefined, + ReqBody = undefined, + ReqQuery extends ParsedQs = ParsedQs, + Params extends ParamsDictionary = ParamsDictionary, + Locals extends Record = Record +> { + ( + req: Request, + res: RenderedResponse + ): void; +} + interface RenderedResponse< RenderOptions extends Record, Locals extends Record, diff --git a/packages/scripts/jsconfig.json b/packages/scripts/jsconfig.json index bad61c5ada..7ade04a8b2 100644 --- a/packages/scripts/jsconfig.json +++ b/packages/scripts/jsconfig.json @@ -1,4 +1,4 @@ { "extends": "../../jsconfig.json", - "include": ["**/*.js"] + "include": ["src/regenerate-api-keys.js"] } diff --git a/packages/scripts/package.json b/packages/scripts/package.json index 1ce3b0e276..f8d2a1ce14 100644 --- a/packages/scripts/package.json +++ b/packages/scripts/package.json @@ -18,5 +18,9 @@ "dependencies": { "@azure/identity": "*", "@azure/keyvault-secrets": "*" + }, + "imports": { + "#database-client": "../../apps/api/src/database/client", + "#utils/*": "../../apps/api/src/server/utils/*" } } diff --git a/packages/scripts/src/remove-cases.js b/packages/scripts/src/remove-cases.js index 9ec14574c0..dc5c8312ef 100644 --- a/packages/scripts/src/remove-cases.js +++ b/packages/scripts/src/remove-cases.js @@ -12,7 +12,7 @@ const specifiedCases = const blobs = []; /** - * @typedef {import('@prisma/client')} PrismaClient + * @typedef {import('@pins/applications.api/src/database/client')} PrismaClient */ /** @@ -37,7 +37,7 @@ const removeApplicationDetails = async (tx, caseDetails) => { /** * Delete all the ProjectUpdateNotifications records for a case, and all the ProjectUpdate records on the case * - * @param {import('@prisma/client')} tx + * @param {PrismaClient} tx * @param caseDetails * @returns {Promise} */ @@ -60,7 +60,7 @@ const removeProjectUpdates = async (tx, caseDetails) => { * Delete all the RepresentationAction records on Reps on the case, all RepresentationAttachment associative records, and all the Representations on the case, * and associated ServiceUser records and Address records * - * @param {import('@prisma/client')} tx + * @param {PrismaClient} tx * @param caseDetails * @returns {Promise} */ @@ -103,7 +103,7 @@ const removeRepresentations = async (tx, caseDetails) => { /** * Delete the Exam timetable item records, and the exam timetable parent record on a case * - * @param {import('@prisma/client')} tx + * @param {PrismaClient} tx * @param caseDetails * @returns {Promise} */ @@ -454,7 +454,7 @@ export const removeSpecifiedCases = async () => { * * @param {PrismaClient} tx * @param {string} reference - * @returns {import('@prisma/client').PrismaPromise} + * @returns {PrismaClient.PrismaPromise} * */ const getCaseByReference = async (tx, reference) => { return tx.case.findFirst({