Skip to content
Open
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 acceptance/repository-cloudant/docker.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function createDB() {
// retry if socket hangs up too early
try {
dbRequest(opts);
} catch (error) {
} catch {
dbRequest(opts);
}
return new Promise(() => {
Expand Down
2 changes: 1 addition & 1 deletion acceptance/repository-cloudant/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,6 @@
"loopback-connector-cloudant": "2.5.0",
"ms": "2.1.3",
"tslib": "^2.8.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion benchmark/src/__tests__/benchmark.integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('Benchmark (SLOW)', function (this: Mocha.Suite) {
urlPath: string,
options?: Omit<Options, 'url'>,
): Promise<EndpointStats> {
if (!options) options = {};
options ??= {};

const requestOptions: AxiosRequestConfig = {
url: this.buildUrl(urlPath),
Expand Down
2 changes: 1 addition & 1 deletion benchmark/src/rest-routing/routing-table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function givenRouter(router: RestRouter, spec: OpenApiSpec, count: number) {
try {
table.find(request);
found++;
} catch (e) {
} catch {
missed++;
}
}
Expand Down
20 changes: 11 additions & 9 deletions bin/sync-dev-deps.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,20 @@

const path = require('node:path');
const fse = require('fs-extra');
const {
loadLernaRepo,
writeJsonSync,
isDryRun,
printJson,
runMain,
} = require('./script-util');
const pkgJson = require('@npmcli/package-json');
const mapWorkspaces = require('@npmcli/map-workspaces');
const {writeJsonSync, isDryRun, printJson, runMain} = require('./script-util');

async function syncDevDeps(options) {
const {project, packages} = await loadLernaRepo();
const rootPath = process.cwd();

const rootPath = project.rootPath;
const {content: rootPkg} = await pkgJson.load(rootPath);
const workspaces = await mapWorkspaces({cwd: rootPath, pkg: rootPkg});

const packages = Array.from(workspaces, ([name, location]) => ({
name,
manifestLocation: path.join(location, 'package.json'),
}));

// Load dependencies from `packages/eslint-config/package.json`
const eslintDeps = require(
Expand Down
2 changes: 1 addition & 1 deletion bodyparsers/rest-msgpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
"@types/msgpack5": "^3.4.7",
"@types/node": "^20.19.43",
"@types/type-is": "^1.6.7",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/access-control-migration/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/binding-resolution/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"source-map-support": "^0.5.21",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/context/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,6 @@
"@loopback/testlab": "^8.0.15",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/context/src/custom-configuration-resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class EnvConfigResolver
);
try {
return JSON.parse(val);
} catch (err) {
} catch {
return val;
}
}
Expand Down
2 changes: 1 addition & 1 deletion examples/express-composition/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
"@types/express": "^4.17.25",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/file-transfer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,6 @@
"@types/multer": "^2.2.0",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
6 changes: 2 additions & 4 deletions examples/file-transfer/src/services/file-upload.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ import {FileUploadHandler} from '../types';
})
export class FileUploadProvider implements Provider<FileUploadHandler> {
constructor(@config() private options: multer.Options = {}) {
if (!this.options.storage) {
// Default to in-memory storage
this.options.storage = multer.memoryStorage();
}
// Default to in-memory storage
this.options.storage ??= multer.memoryStorage();
}

value(): FileUploadHandler {
Expand Down
2 changes: 1 addition & 1 deletion examples/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"graphql-ws": "^5.16.2",
"rimraf": "^5.0.10",
"source-map-support": "^0.5.21",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/greeter-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
"@types/debug": "4.1.13",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/greeting-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
"@types/debug": "4.1.13",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/hello-world/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
"@loopback/testlab": "^8.0.15",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/lb3-application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"should": "^13.2.3",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/log-extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@
"@types/debug": "^4.1.13",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/log-extension/src/decorators/log.decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {LevelMetadata} from '../types';
* @param level - The Log Level at or above it should log
*/
export function log(level?: number) {
if (level === undefined) level = LOG_LEVEL.WARN;
level ??= LOG_LEVEL.WARN;
return MethodDecoratorFactory.createDecorator<LevelMetadata>(
EXAMPLE_LOG_METADATA_KEY,
{
Expand Down
2 changes: 1 addition & 1 deletion examples/metrics-prometheus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@
"@loopback/testlab": "^8.0.15",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/multi-tenancy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"source-map-support": "^0.5.21",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/passport-login/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,6 @@
"axios": "^1.16.0",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class BasicStrategy implements AuthenticationStrategy {
return done(null, false);
}
const user = users[0];
if (!user.credentials || user.credentials.password !== password) {
if (user.credentials?.password !== password) {
return done(null, false);
}
// Authentication passed, return user profile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ export class LocalAuthStrategy implements AuthenticationStrategy {
return done(null, null, {message: AUTH_FAILED_MESSAGE});
}
const user = users[0];
if (!user.credentials || user.credentials.password !== password) {
if (user.credentials?.password !== password) {
return done(null, null, {message: AUTH_FAILED_MESSAGE});
}
// Authentication passed, return user profile
Expand Down
2 changes: 1 addition & 1 deletion examples/references-many/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/rest-crud/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/rpc-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@
"@types/express": "^4.17.25",
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/rpc-server/src/application.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class MyApplication extends Application {
super(options);
this.controller(GreetController);
this.server(RPCServer);
this.options.port = this.options.port || 3000;
this.options.port = this.options.port ?? 3000;
this.bind('rpcServer.config').to(this.options);
}
}
4 changes: 2 additions & 2 deletions examples/rpc-server/src/rpc.router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {RPCServer} from './rpc.server';

export function rpcRouter(server: RPCServer) {
const jsonParser = parser.json();
server.expressServer.post('*', jsonParser, async (request, response) => {
await routeHandler(server, request, response);
server.expressServer.post('*', jsonParser, (request, response, next) => {
routeHandler(server, request, response).catch(next);
});
}

Expand Down
2 changes: 1 addition & 1 deletion examples/soap-calculator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@
"eslint": "^8.57.1",
"mocha": "^12.0.1",
"source-map-support": "^0.5.21",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/socketio/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,6 @@
"eslint": "^8.57.1",
"socket.io-client": "^4.8.3",
"source-map-support": "^0.5.21",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/todo-jwt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/todo-list/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe('TodoListImageRepository', () => {
testdb,
async () => todoListRepo,
);
todoRepo = new TodoRepository(testdb, async () => todoListRepo);
});

beforeEach(givenEmptyDatabase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ describe('TodoRepository', () => {
async () => todoListImageRepo,
);
todoRepo = new TodoRepository(testdb, async () => todoListRepo);
todoListImageRepo = new TodoListImageRepository(
testdb,
async () => todoListRepo,
);
});

beforeEach(givenEmptyDatabase);
Expand Down
2 changes: 1 addition & 1 deletion examples/todo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/validation-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,6 @@
"@types/node": "^20.19.43",
"eslint": "^8.57.1",
"source-map-support": "^0.5.21",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
2 changes: 1 addition & 1 deletion examples/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"events": "^3.3.0",
"process": "^0.11.10",
"puppeteer": "^25.10.0",
"typescript": "~5.2.2",
"typescript": "npm:@typescript/typescript6@~6.0.2",
"util": "^0.12.5",
"webpack": "^5.110.3",
"webpack-cli": "^7.2.3"
Expand Down
2 changes: 1 addition & 1 deletion extensions/authentication-jwt/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,6 @@
"@types/lodash": "^4.17.25",
"@types/node": "^20.19.43",
"lodash": "^4.18.1",
"typescript": "~5.2.2"
"typescript": "npm:@typescript/typescript6@~6.0.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export class RefreshtokenService {
await this.refreshTokenRepository.delete(
new RefreshToken({refreshToken: refreshToken}),
);
} catch (e) {
} catch {
// ignore
}
}
Expand Down
7 changes: 5 additions & 2 deletions extensions/cron/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,13 @@ export class CronJob extends BaseCronJob {
} else {
this.name = `job-${++CronJob.count}`;
}
// Override `fireOnTick` to catch errors
// Override `fireOnTick` to catch errors. `cron` declares `fireOnTick` as a
// class field but installs it on the prototype, so it cannot be reached
// via `super`.
const fireOnTick = BaseCronJob.prototype.fireOnTick;
this.fireOnTick = () => {
try {
return super.fireOnTick();
return fireOnTick.call(this);
} catch (err) {
this.emitter.emit('error', err);
}
Expand Down
4 changes: 1 addition & 3 deletions extensions/graphql/src/graphql.container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,7 @@ export class LoopBackContainer implements ContainerType {
} else {
// Narrow down by key
found = bindings.find(filterByKey(resolverBinding.key));
if (!found) {
found = bindings[0];
}
found ??= bindings[0];
}

debug(
Expand Down
Loading
Loading