Skip to content

Commit acf351d

Browse files
committed
Fix NodeNext interop with CJS dependencies on Node 24
Under module:NodeNext, default imports of CJS packages can resolve to the module namespace rather than the runtime export, and some dep bumps moved public types out of the package's barrel. Adjusts four call sites: - api-gateway cache-provider: switch ioredis to a named import so Redis resolves as a class. - auth-service metrics: import expressMiddleware by name from prometheus-api-metrics instead of the default. - auth-service meeco.service: drop the base64url package in favor of Buffer.toString('base64url') (built into Node since 16). - policy-service math-context: derive BoxedExpression from ComputeEngine['box']'s return type since @cortex-js/compute-engine 0.27 no longer re-exports the interface at the top level. Signed-off-by: Alex Piatakov <alex.piatakov@swirldslabs.com>
1 parent 82e0412 commit acf351d

6 files changed

Lines changed: 9 additions & 7 deletions

File tree

api-gateway/src/helpers/providers/cache-provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Provider } from '@nestjs/common';
22

3-
import Cache from 'ioredis';
3+
import { Redis as Cache } from 'ioredis';
44

55
//types and interfaces
66
export type CacheClient = Cache;

auth-service/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"@nestjs/microservices": "11.1.11",
1616
"axios": "1.12.0",
1717
"base-x": "^4.0.0",
18-
"base64url": "^3.0.1",
1918
"cron": "^2.4.0",
2019
"dotenv": "^16.0.0",
2120
"express": "^5.1.0",

auth-service/src/meeco/meeco.service.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { IMeecoConfig, MeecoApi } from './meeco-api.js';
33
import { IPassphraseArtefact } from './models/keys.js';
44
import { IMe } from '../meeco/models/me.js';
55
import { IPresentationRequest, IPresentationSubmission, IPresentationSubmissions } from './models/presentation-request.js';
6-
import base64url from 'base64url';
76
import * as jwt from 'jsonwebtoken';
87
import { Vc, VerifiableCredential } from '@guardian/common';
98
import { StatusList } from '../helpers/credentials-validation/status-list.js';
@@ -144,7 +143,7 @@ export class MeecoService {
144143
const keyPair = nacl.sign.keyPair.fromSeed(kp.key.bytes);
145144

146145
const signature = nacl.sign.detached(Buffer.from(unsignedRequestJwt), keyPair.secretKey)
147-
const signatureBase64 = base64url.encode(signature as any);
146+
const signatureBase64 = Buffer.from(signature).toString('base64url');
148147

149148
const signedRequest = `${unsignedRequestJwt}.${signatureBase64}`;
150149

auth-service/src/utils/metrics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import express from 'express';
22
import client from 'prom-client';
3-
import guardianServicePrometheusMetrics from 'prometheus-api-metrics';
3+
import { expressMiddleware as guardianServicePrometheusMetrics } from 'prometheus-api-metrics';
44

55
const app = express();
66

frontend/src/app/modules/policy-engine/dialogs/math-editor-dialog/math-model/math-context.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { getValueByPath, convertValue, createComputeEngine, getDocumentValueByPa
44
import { MathItemType } from './math-item.type';
55
import { IContext } from './math.interface';
66
import { DocumentMap } from './document-map';
7-
import { BoxedExpression, ComputeEngine } from '@cortex-js/compute-engine';
7+
import { ComputeEngine } from '@cortex-js/compute-engine';
8+
9+
type BoxedExpression = ReturnType<ComputeEngine['box']>;
810

911
export function getList(expr: any): any[] {
1012
if (!expr) { return []; }

policy-service/src/policy-engine/helpers/math-model/math-context.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ import { getValueByPath, convertValue, createComputeEngine, getDocumentValueByPa
44
import { MathItemType } from './math-item.type.js';
55
import { IContext } from './math.interface.js';
66
import { DocumentMap } from './document-map.js';
7-
import { BoxedExpression, ComputeEngine } from '@cortex-js/compute-engine';
7+
import { ComputeEngine } from '@cortex-js/compute-engine';
8+
9+
type BoxedExpression = ReturnType<ComputeEngine['box']>;
810

911
export function getList(expr: any): any[] {
1012
if (!expr) { return []; }

0 commit comments

Comments
 (0)