Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/add-documentation-to-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: guardian-linux-medium
strategy:
matrix:
node-version: [ 20.20.2 ]
node-version: [ 24.15.0 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-after-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- 6379:6379
strategy:
matrix:
node-version: [ 20.20.2 ]
node-version: [ 24.15.0 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/api-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
- 6379:6379
strategy:
matrix:
node-version: [20.20.2]
mongodb-version: [7.0.21]
node-version: [ 24.15.0 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-schedule-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- 6379:6379
strategy:
matrix:
node-version: [ 20.20.2 ]
node-version: [ 24.15.0 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/api-schedule-vm0033.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- 6379:6379
strategy:
matrix:
node-version: [ 20.20.2 ]
node-version: [ 24.15.0 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
runs-on: guardian-linux-medium
strategy:
matrix:
node-version: [ 20.20.2 ]
node-version: [ 24.15.0 ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ui-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
- 6379:6379
strategy:
matrix:
node-version: [20.20.2]
mongodb-version: [7.0.21]
node-version: [ 24.15.0 ]
mongodb-version: [ 7.0.21 ]
steps:
- name: Harden Runner
uses: step-security/harden-runner@ab7a9404c0f3da075243ca237b5fac12c98deaa5 # v2.19.3
Expand Down
4 changes: 3 additions & 1 deletion ai-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
# Stage 0: Use node image for base image for all stages
ARG NODE_VERSION=20.20.2-alpine
ARG NODE_VERSION=24.15.0-alpine
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION} AS base
WORKDIR /usr/local/app
# Define an argument `YARN_CACHE_FOLDER` for the Yarn cache directory
Expand All @@ -19,6 +19,7 @@ RUN yarn pack
FROM base AS common
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link common/package.json common/tsconfig*.json yarn.lock ./
COPY --link patches patches/
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER} \
yarn install
Expand All @@ -30,6 +31,7 @@ FROM base AS deps
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz
COPY --link ai-service/package.json ai-service/tsconfig*.json yarn.lock ./
COPY --link patches patches/
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER},sharing=private \
yarn install --prod
Expand Down
42 changes: 23 additions & 19 deletions ai-service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,22 @@
"dependencies": {
"@guardian/common": "3.6.0-rc",
"@guardian/interfaces": "3.6.0-rc",
"@langchain/classic": "1.0.2",
"@langchain/community": "1.0.2",
"@langchain/core": "1.0.4",
"@langchain/openai": "1.1.0",
"@langchain/textsplitters": "1.0.0",
"@mikro-orm/core": "6.4.16",
"@mikro-orm/mongodb": "6.4.16",
"@nestjs/common": "^11.0.11",
"@nestjs/core": "^11.0.11",
"@types/express": "^5.0.1",
"@types/node": "^22.15.19",
"dotenv": "^16.3.1",
"express": "^5.1.0",
"@langchain/classic": "1.0.7",
"@langchain/community": "1.1.1",
"@langchain/core": "1.1.7",
"@langchain/openai": "1.2.0",
"@langchain/textsplitters": "1.0.1",
"@mikro-orm/core": "6.6.2",
"@mikro-orm/mongodb": "6.6.2",
"@nestjs/common": "11.1.11",
"@nestjs/core": "11.1.11",
"dotenv": "16.6.1",
"express": "5.2.1",
"faiss-node": "0.5.1",
"langchain": "1.0.4",
"module-alias": "2.2.3",
"langchain": "1.2.2",
"patch-package": "8.0.1",
"prebuild": "13.0.1",
"rxjs": "^7.8.1",
"typescript": "^5.8.3"
"rxjs": "7.8.2"
},
"imports": {
"#constants": "./dist/constants/index.js"
Expand All @@ -35,11 +32,18 @@
"debug": "nodemon dist/index.js",
"dev:docker": "nodemon .",
"dev": "tsc -w",
"start": "node dist/index.js"
"start": "node dist/index.js",
"postinstall": "patch-package"
},
"devDependencies": {
"@types/express": "5.0.6",
"@types/glob": "^8.1.0",
"nodemon": "^3.0.1"
"@types/node": "24.10.4",
"nodemon": "3.1.11",
"typescript": "^5.8.3"
},
"engines": {
"node": ">=24.15.0"
},
"type": "module"
}
2 changes: 1 addition & 1 deletion ai-service/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { aiSuggestionsAPI } from './api/service/ai-suggestions-service.js';
import { AISuggestionsDB } from './helpers/ai-suggestions-db.js';
import { AIManager } from './ai-manager.js';
import { ApplicationState, JwtServicesValidator, MessageBrokerChannel, mongoForLoggingInitialization, OldSecretManager, PinoLogger, pinoLoggerInitialization } from '@guardian/common';
import * as process from 'process';
import * as process from 'node:process';
import { ApplicationStates } from '@guardian/interfaces';

Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion ai-service/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import dotenv from 'dotenv';
import 'reflect-metadata'
import fs from 'fs';
import fs from 'node:fs';

dotenv.config();

Expand Down
3 changes: 1 addition & 2 deletions ai-service/src/helpers/api-response.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AISuggestionService } from './suggestions.js';
import { ApplicationState, MessageResponse } from '@guardian/common';
import { MessageResponse } from '@guardian/common';

/**
* API response
Expand All @@ -8,7 +8,6 @@ import { ApplicationState, MessageResponse } from '@guardian/common';
* @constructor
*/
export function ApiResponse<T>(event: any, handleFunc: (msg) => Promise<MessageResponse<T>>): void {
const state = new ApplicationState();
new AISuggestionService().registerListener(event, async (msg) => {
return await handleFunc(msg);
})
Expand Down
4 changes: 2 additions & 2 deletions ai-service/src/helpers/files-manager-helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as fs from 'fs';
import * as path from 'path';
import * as fs from 'node:fs';
import * as path from 'node:path';

import { GroupCategories } from './general-helper.js';
import { PolicyDescription } from '../models/models.js';
Expand Down
16 changes: 9 additions & 7 deletions ai-service/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,26 @@
{
"compileOnSave": true,
"compilerOptions": {
"skipLibCheck": true,
"declaration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"inlineSourceMap": true,
"lib": [
"es6"
"ES2023"
],
"module": "NodeNext",
"moduleResolution": "nodenext",
"moduleResolution": "NodeNext",
"noUnusedLocals": true,
"noUnusedParameters": false,
"outDir": "dist/",
"target": "es2022",
"paths": {
"#constants/*": [
"./src/constants/*"
]
}
},
"skipLibCheck": true,
"sourceMap": true,
"strict": false,
"target": "ES2023"
},
"exclude": [
"node_modules",
Expand Down
22 changes: 13 additions & 9 deletions ai-service/tsconfig.production.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
{
"compileOnSave": true,
"compilerOptions": {
"skipLibCheck": true,
"declaration": true,
"emitDecoratorMetadata": true,
"esModuleInterop": true,
"experimentalDecorators": true,
"inlineSourceMap": false,
"lib": [
"es6"
"ES2023"
],
"module": "NodeNext",
"moduleResolution": "nodenext",
"moduleResolution": "NodeNext",
"noUnusedLocals": true,
"noUnusedParameters": false,
"outDir": "dist/",
"target": "es2022",
"paths": {
"#constants/*": ["./src/constants/*"]
}
"#constants/*": [
"./src/constants/*"
]
},
"skipLibCheck": true,
"sourceMap": false,
"strict": false,
"target": "ES2023"
},
"exclude": [
"node_modules",
Expand All @@ -26,4 +30,4 @@
"include": [
"src/**/*.ts"
]
}
}
4 changes: 3 additions & 1 deletion analytics-service/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# syntax=docker/dockerfile:1
# Stage 0: Use node image for base image for all stages
ARG NODE_VERSION=20.20.2-alpine
ARG NODE_VERSION=24.15.0-alpine
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION} AS base
WORKDIR /usr/local/app
# Define an argument `YARN_CACHE_FOLDER` for the Yarn cache directory
Expand All @@ -19,6 +19,7 @@ RUN yarn pack
FROM base AS common
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link common/package.json common/tsconfig*.json yarn.lock ./
COPY --link patches patches/
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER} \
yarn install
Expand All @@ -30,6 +31,7 @@ FROM base AS deps
COPY --link --from=interfaces /usr/local/app/guardian-interfaces-*.tgz /tmp/interfaces.tgz
COPY --link --from=common /usr/local/app/guardian-common-*.tgz /tmp/common.tgz
COPY --link analytics-service/package.json analytics-service/tsconfig*.json yarn.lock ./
COPY --link patches patches/
RUN node -e "const fs=require('fs'); const input=JSON.parse(fs.readFileSync('package.json')); input.dependencies['@guardian/interfaces']='file:/tmp/interfaces.tgz'; input.dependencies['@guardian/common']='file:/tmp/common.tgz'; fs.writeFileSync('package.json', JSON.stringify(input));"
RUN --mount=type=cache,target=${YARN_CACHE_FOLDER},sharing=private \
yarn install --prod
Expand Down
62 changes: 33 additions & 29 deletions analytics-service/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"packageManager": "yarn@1.22.21",
"_moduleAliases": {
"@api": "dist/api",
"@helpers": "dist/helpers",
"@entity": "dist/entity",
"@interfaces": "dist/interfaces",
"@middlewares": "dist/middlewares"
"imports": {
"#api": "./dist/api",
"#entity": "./dist/entity",
"#helpers": "./dist/helpers",
"#interfaces": "./dist/interfaces",
"#middlewares": "./dist/middlewares"
},
"resolutions": {
"@azure/core-rest-pipeline": "1.12.1",
Expand All @@ -15,37 +15,40 @@
"dependencies": {
"@guardian/common": "3.6.0-rc",
"@guardian/interfaces": "3.6.0-rc",
"@nestjs/common": "^11.0.11",
"@nestjs/core": "^11.0.11",
"@nestjs/microservices": "^11.0.11",
"@nestjs/platform-express": "^11.0.11",
"@nestjs/swagger": "^11.0.6",
"@types/express-fileupload": "^1.4.1",
"class-transformer": "^0.5.1",
"class-validator": "^0.14.0",
"@nestjs/common": "11.1.11",
"@nestjs/core": "11.1.11",
"@nestjs/microservices": "11.1.11",
"@nestjs/platform-express": "11.1.11",
"@nestjs/swagger": "11.2.3",
"class-transformer": "0.5.1",
"class-validator": "0.14.3",
"cron": "^4.3.0",
"dotenv": "^16.0.0",
"dotenv": "16.6.1",
"excel4node": "^1.8.2",
"express": "^5.1.0",
"express-fileupload": "^1.4.0",
"hpp": "^0.2.3",
"jszip": "^3.7.1",
"prom-client": "^14.1.1",
"reflect-metadata": "^0.1.13",
"rxjs": "^7.8.1"
"express": "5.2.1",
"express-fileupload": "1.5.2",
"hpp": "0.2.3",
"jszip": "3.10.1",
"prom-client": "15.1.3",
"reflect-metadata": "0.2.2",
"patch-package": "8.0.1",
"rxjs": "7.8.2"
},
"description": "",
"devDependencies": {
"@types/express": "^5.0.1",
"@types/jszip": "^3.4.1",
"@types/node": "^22.15.19",
"@types/express": "5.0.6",
"@types/express-fileupload": "1.5.1",
"@types/node": "24.10.4",
"@types/glob": "^8.1.0",
"mocha": "^9.2.0",
"mocha-junit-reporter": "^2.0.2",
"nodemon": "^2.0.12",
"mocha": "10.8.2",
"mocha-junit-reporter": "2.2.1",
"nodemon": "3.1.11",
"tslint": "^6.1.3",
"typescript": "^5.8.3"
},
"engines": {
"node": ">=24.15.0"
},
"files": [
"dist"
],
Expand All @@ -61,7 +64,8 @@
"dev": "tsc -w",
"lint": "tslint --config ../tslint.json --project .",
"start": "node dist/index.js",
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ui-service.xml"
"test": "mocha tests/**/*.test.js --reporter mocha-junit-reporter --reporter-options mochaFile=../test_results/ui-service.xml",
"postinstall": "patch-package"
},
"type": "module",
"version": "3.6.0-rc"
Expand Down
2 changes: 1 addition & 1 deletion analytics-service/src/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { MiddlewareConsumer, Module } from '@nestjs/common';
import { ClientsModule, Transport } from '@nestjs/microservices';
import hpp from 'hpp';
import process from 'process';
import process from 'node:process';
import express from 'express';
import fileUpload from 'express-fileupload';
import { AnalyticsApi } from './api/analytics.js';
Expand Down
Loading
Loading