Skip to content
Merged
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
600 changes: 300 additions & 300 deletions .yarn/releases/yarn-4.10.3.cjs → .yarn/releases/yarn-4.12.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.10.3.cjs
yarnPath: .yarn/releases/yarn-4.12.0.cjs
40 changes: 20 additions & 20 deletions biome.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://biomejs.dev/schemas/1.9.3/schema.json",
"$schema": "https://biomejs.dev/schemas/2.4.2/schema.json",
"linter": {
"enabled": true,
"rules": {
Expand Down Expand Up @@ -40,29 +40,29 @@
"noDelete": "off"
}
},
"ignore": [
"node_modules",
"jest.config.js",
"dist",
"build",
"CHANGELOG.md",
"package.json",
"tsconfig.json"
"includes": [
"**",
"!**/node_modules",
"!**/jest.config.js",
"!**/dist",
"!**/build",
"!**/CHANGELOG.md",
"!**/package.json",
"!**/tsconfig.json"
]
},
"organizeImports": {
"enabled": true
},
"assist": { "actions": { "source": { "organizeImports": "on" } } },
"formatter": {
"indentStyle": "space",
"ignore": [
"node_modules",
"jest.config.js",
"dist",
"build",
"CHANGELOG.md",
"package.json",
"tsconfig.json"
"includes": [
"**",
"!**/node_modules",
"!**/jest.config.js",
"!**/dist",
"!**/build",
"!**/CHANGELOG.md",
"!**/package.json",
"!**/tsconfig.json"
],
"indentWidth": 4
},
Expand Down
52 changes: 26 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
"scripts": {
"build": "tsc --pretty",
"example": "yarn run build && node example",
"lint": "biome lint --write ./src",
"lint": "biome check --write ./src",
"test": "jest",
"updateSnapshots": "jest -u",
"prepare": "npm run build",
"dev": "ENABLE_OAS=true ts-node-dev src/start.ts",
"fmt": "biome format ./src --write",
"fmt:check": "biome format ./src",
"fmt": "biome check ./src --write",
"fmt:check": "biome check ./src",
"biome:ci": "biome ci ./src"
},
"repository": {
Expand Down Expand Up @@ -41,33 +41,33 @@
"dependencies": {
"@wesleytodd/openapi": "^1.1.0",
"compression": "^1.8.1",
"cors": "^2.8.5",
"express": "^4.21.2",
"json-schema-to-ts": "^3.1.0",
"cors": "^2.8.6",
"express": "^4.22.1",
"json-schema-to-ts": "^3.1.1",
"openapi-types": "^12.1.3",
"prom-client": "^15.1.3",
"qs": "^6.12.3",
"type-is": "^1.6.18",
"unleash-client": "^6.7.0"
"qs": "^6.15.0",
"type-is": "^2.0.1",
"unleash-client": "^6.9.6"
},
"devDependencies": {
"@apidevtools/swagger-parser": "10.1.0",
"@babel/core": "^7.25.2",
"@biomejs/biome": "^1.9.3",
"@types/compression": "^1.7.5",
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "20.14.8",
"@types/supertest": "^6.0.2",
"@types/type-is": "^1.6.6",
"babel-jest": "^29.7.0",
"jest": "^29.7.0",
"semver": "^7.6.3",
"supertest": "^7.0.0",
"ts-jest": "^29.2.4",
"@apidevtools/swagger-parser": "12.1.0",
"@babel/core": "^7.29.0",
"@biomejs/biome": "^2.4.2",
"@types/compression": "^1.8.1",
"@types/cors": "^2.8.19",
"@types/express": "^4.17.25",
"@types/jest": "^30.0.0",
"@types/node": "20.19.33",
"@types/supertest": "^6.0.3",
"@types/type-is": "^1.6.7",
"babel-jest": "^30.2.0",
"jest": "^30.2.0",
"semver": "^7.7.4",
"supertest": "^7.2.2",
"ts-jest": "^29.4.6",
"ts-node-dev": "^2.0.0",
"typescript": "^5.5.4"
"typescript": "^5.9.3"
},
"resolutions": {
"cookie": "^1.0.0",
Expand All @@ -78,5 +78,5 @@
"cookiejar": "^2.1.4",
"router/path-to-regexp": "0.1.12"
},
"packageManager": "yarn@4.10.3"
"packageManager": "yarn@4.12.0"
}
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import compression from 'compression';
import cors from 'cors';
import express, { type Application } from 'express';
import type { IClient } from './client';
import { type IProxyOption, createProxyConfig } from './config';
import { createProxyConfig, type IProxyOption } from './config';

import requireContentType from './content-type-checker';
import { createNewClient, createSingletonClient } from './create-client';
Expand Down
22 changes: 11 additions & 11 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ class Client extends EventEmitter implements IClient {
this.metrics.start();
});
this.unleash.on(UnleashEvents.Unchanged, () => {
lastMetricsFetch.set(new Date().getTime());
lastMetricsFetch.set(Date.now());
});
this.unleash.on(UnleashEvents.Changed, () => {
const updatedAt = new Date().getTime();
const updatedAt = Date.now();
lastMetricsFetch.set(updatedAt);
lastMetricsUpdate.set(updatedAt);
});
Expand Down Expand Up @@ -190,19 +190,19 @@ class Client extends EventEmitter implements IClient {
const toggle = toggles[toggleName];
const yesCount: number = toggle.yes ?? 0;
const noCount: number = toggle.no ?? 0;
[...Array(yesCount)].forEach(() =>
this.metrics.count(toggleName, true),
);
[...Array(noCount)].forEach(() =>
this.metrics.count(toggleName, false),
);
[...Array(yesCount)].forEach(() => {
this.metrics.count(toggleName, true);
});
[...Array(noCount)].forEach(() => {
this.metrics.count(toggleName, false);
});
const variants = toggle.variants;
if (variants) {
Object.entries(variants).forEach(
([variantName, variantCount]) => {
[...Array(variantCount)].forEach(() =>
this.metrics.countVariant(toggleName, variantName),
);
[...Array(variantCount)].forEach(() => {
this.metrics.countVariant(toggleName, variantName);
});
},
);
}
Expand Down
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { HttpOptions } from 'unleash-client/lib/http-options';
import type { BootstrapOptions } from 'unleash-client/lib/repository/bootstrap-provider';
import type { StorageProvider } from 'unleash-client/lib/repository/storage-provider';
import type { ContextEnricher } from './enrich-context';
import { type LogLevel, type Logger, SimpleLogger } from './logger';
import { type Logger, type LogLevel, SimpleLogger } from './logger';
import { generateInstanceId } from './util';

export interface ServerSideSdkConfig {
Expand Down Expand Up @@ -89,7 +89,7 @@ function safeNumber(envVar: string | undefined, defaultVal: number): number {
if (envVar) {
try {
return Number.parseInt(envVar, 10);
} catch (err) {
} catch (_err) {
return defaultVal;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/create-client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Unleash, initialize } from 'unleash-client';
import { initialize, Unleash } from 'unleash-client';
import Metrics from 'unleash-client/lib/metrics';
import { defaultStrategies } from 'unleash-client/lib/strategy';
import Client from './client';
Expand Down
2 changes: 1 addition & 1 deletion src/examples/custom-strategies.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class TestStrat extends Strategy {
super('FromFile');
}

isEnabled(parameters, context) {
isEnabled(_parameters, _context) {
// do something cool with params and context.
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/openapi/openapi-service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import openapi, { type IExpressOpenApi } from '@wesleytodd/openapi';
import type { Application, RequestHandler } from 'express';
import type { OpenAPIV3 } from 'openapi-types';
import { createOpenApiSchema } from '.';
import type { IProxyConfig } from '../config';
import { createOpenApiSchema } from '.';
import { format500ErrorMessage } from './common-responses';

export class OpenApiService {
Expand Down
2 changes: 1 addition & 1 deletion src/prom-metrics/createCounter.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Counter as PromCounter, type CounterConfiguration } from 'prom-client';
import { type CounterConfiguration, Counter as PromCounter } from 'prom-client';

/**
* A wrapped instance of prom-client's Counter, overriding some of its methods for enhanced functionality and type-safety.
Expand Down
2 changes: 1 addition & 1 deletion src/prom-metrics/createGauge.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Gauge as PromGauge, type GaugeConfiguration } from 'prom-client';
import { type GaugeConfiguration, Gauge as PromGauge } from 'prom-client';

/**
* A wrapped instance of prom-client's Gauge, overriding some of its methods for enhanced functionality and type-safety.
Expand Down
2 changes: 1 addition & 1 deletion src/prom-metrics/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { createGauge, type Gauge } from './createGauge';
import { createCounter } from './createCounter';
import { createGauge, type Gauge } from './createGauge';

export * from './createCounter';
export * from './createGauge';
Expand Down
2 changes: 1 addition & 1 deletion src/test/__snapshots__/openapi.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing

exports[`should serve the OpenAPI UI 1`] = `
"<!DOCTYPE html>
Expand Down
30 changes: 16 additions & 14 deletions src/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ test('should load custom activation strategy', () => {
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
isEnabled(parameters: any, context: any) {
isEnabled(_parameters: any, _context: any) {
return true;
}
}
Expand Down Expand Up @@ -450,16 +450,18 @@ test.each([
expect(config.proxyBasePath).toBe(`/base/path`);
});

test.each(['', ' ', ' ', undefined])(
`%s as base path should be treated the same as empty string`,
(p) => {
const config = createProxyConfig({
unleashUrl: 'some',
unleashApiToken: 'some',
clientKeys: ['s1'],
proxyBasePath: p,
});

expect(config.proxyBasePath).toBe(``);
},
);
test.each([
'',
' ',
' ',
undefined,
])(`%s as base path should be treated the same as empty string`, (p) => {
const config = createProxyConfig({
unleashUrl: 'some',
unleashApiToken: 'some',
clientKeys: ['s1'],
proxyBasePath: p,
});

expect(config.proxyBasePath).toBe(``);
});
5 changes: 2 additions & 3 deletions src/test/content-type-checker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const mockRequestWithBody = mockRequest('chunked');
const mockRequestWithoutBody = mockRequest(undefined);

const returns415: (t: jest.Mock) => Response = (t) => ({
// @ts-ignore
// @ts-expect-error
status: (code) => {
expect(415).toBe(code);
return {
Expand All @@ -33,9 +33,8 @@ const returns415: (t: jest.Mock) => Response = (t) => ({
});

const expectNoCall: (t: jest.Mock) => Response = (t) => ({
// @ts-ignore
status: () => ({
// @ts-ignore
// @ts-expect-error
end: () => expect(t).toHaveBeenCalledTimes(0),
}),
});
Expand Down
Loading
Loading