Skip to content

Commit 7ab832f

Browse files
committed
Merge branch 'andrius/update-versions' into 'main'
Version upgrades See merge request flarenetwork/ftso/ftso-scaling!160
2 parents 851cbeb + 8b68fbd commit 7ab832f

File tree

7 files changed

+3071
-2857
lines changed

7 files changed

+3071
-2857
lines changed

.gitlab-ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ workflow:
77
test-all:
88
stage: test
99
needs: []
10-
image: node:18
10+
image: node:22
1111
cache:
1212
- key:
1313
files:

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.17.1
1+
v22

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM node:18-slim AS nodemodules
1+
FROM node:22-slim AS nodemodules
22

33
WORKDIR /app
44

55
COPY package.json yarn.lock ./
66
RUN yarn install --frozen-lockfile --network-timeout 100000
77

8-
FROM node:18-slim AS build
8+
FROM node:22-slim AS build
99

1010
WORKDIR /app
1111

@@ -15,7 +15,7 @@ COPY . ./
1515
RUN yarn build
1616
RUN yarn build ftso-reward-calculation-process
1717

18-
FROM node:18-slim AS runtime
18+
FROM node:22-slim AS runtime
1919

2020
WORKDIR /app
2121

apps/ftso-data-provider/src/feed-value-provider-api/generated/provider-api.ts

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/* eslint-disable */
22
/* tslint:disable */
3+
// @ts-nocheck
34
/*
45
* ---------------------------------------------------------------
56
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
@@ -34,12 +35,19 @@ export interface FeedValueResponse {
3435
data: FeedValueData;
3536
}
3637

37-
import type { AxiosInstance, AxiosRequestConfig, AxiosResponse, HeadersDefaults, ResponseType } from "axios";
38+
import type {
39+
AxiosInstance,
40+
AxiosRequestConfig,
41+
AxiosResponse,
42+
HeadersDefaults,
43+
ResponseType,
44+
} from "axios";
3845
import axios from "axios";
3946

4047
export type QueryParamsType = Record<string | number, any>;
4148

42-
export interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
49+
export interface FullRequestParams
50+
extends Omit<AxiosRequestConfig, "data" | "params" | "url" | "responseType"> {
4351
/** set parameter to `true` for call `securityWorker` for this request */
4452
secure?: boolean;
4553
/** request path */
@@ -54,18 +62,23 @@ export interface FullRequestParams extends Omit<AxiosRequestConfig, "data" | "pa
5462
body?: unknown;
5563
}
5664

57-
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
65+
export type RequestParams = Omit<
66+
FullRequestParams,
67+
"body" | "method" | "query" | "path"
68+
>;
5869

59-
export interface ApiConfig<SecurityDataType = unknown> extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
70+
export interface ApiConfig<SecurityDataType = unknown>
71+
extends Omit<AxiosRequestConfig, "data" | "cancelToken"> {
6072
securityWorker?: (
61-
securityData: SecurityDataType | null
73+
securityData: SecurityDataType | null,
6274
) => Promise<AxiosRequestConfig | void> | AxiosRequestConfig | void;
6375
secure?: boolean;
6476
format?: ResponseType;
6577
}
6678

6779
export enum ContentType {
6880
Json = "application/json",
81+
JsonApi = "application/vnd.api+json",
6982
FormData = "multipart/form-data",
7083
UrlEncoded = "application/x-www-form-urlencoded",
7184
Text = "text/plain",
@@ -78,8 +91,16 @@ export class HttpClient<SecurityDataType = unknown> {
7891
private secure?: boolean;
7992
private format?: ResponseType;
8093

81-
constructor({ securityWorker, secure, format, ...axiosConfig }: ApiConfig<SecurityDataType> = {}) {
82-
this.instance = axios.create({ ...axiosConfig, baseURL: axiosConfig.baseURL || "" });
94+
constructor({
95+
securityWorker,
96+
secure,
97+
format,
98+
...axiosConfig
99+
}: ApiConfig<SecurityDataType> = {}) {
100+
this.instance = axios.create({
101+
...axiosConfig,
102+
baseURL: axiosConfig.baseURL || "",
103+
});
83104
this.secure = secure;
84105
this.format = format;
85106
this.securityWorker = securityWorker;
@@ -89,15 +110,22 @@ export class HttpClient<SecurityDataType = unknown> {
89110
this.securityData = data;
90111
};
91112

92-
protected mergeRequestParams(params1: AxiosRequestConfig, params2?: AxiosRequestConfig): AxiosRequestConfig {
113+
protected mergeRequestParams(
114+
params1: AxiosRequestConfig,
115+
params2?: AxiosRequestConfig,
116+
): AxiosRequestConfig {
93117
const method = params1.method || (params2 && params2.method);
94118

95119
return {
96120
...this.instance.defaults,
97121
...params1,
98122
...(params2 || {}),
99123
headers: {
100-
...((method && this.instance.defaults.headers[method.toLowerCase() as keyof HeadersDefaults]) || {}),
124+
...((method &&
125+
this.instance.defaults.headers[
126+
method.toLowerCase() as keyof HeadersDefaults
127+
]) ||
128+
{}),
101129
...(params1.headers || {}),
102130
...((params2 && params2.headers) || {}),
103131
},
@@ -113,13 +141,20 @@ export class HttpClient<SecurityDataType = unknown> {
113141
}
114142

115143
protected createFormData(input: Record<string, unknown>): FormData {
144+
if (input instanceof FormData) {
145+
return input;
146+
}
116147
return Object.keys(input || {}).reduce((formData, key) => {
117148
const property = input[key];
118-
const propertyContent: any[] = property instanceof Array ? property : [property];
149+
const propertyContent: any[] =
150+
property instanceof Array ? property : [property];
119151

120152
for (const formItem of propertyContent) {
121153
const isFileType = formItem instanceof Blob || formItem instanceof File;
122-
formData.append(key, isFileType ? formItem : this.stringifyFormItem(formItem));
154+
formData.append(
155+
key,
156+
isFileType ? formItem : this.stringifyFormItem(formItem),
157+
);
123158
}
124159

125160
return formData;
@@ -143,19 +178,29 @@ export class HttpClient<SecurityDataType = unknown> {
143178
const requestParams = this.mergeRequestParams(params, secureParams);
144179
const responseFormat = format || this.format || undefined;
145180

146-
if (type === ContentType.FormData && body && body !== null && typeof body === "object") {
181+
if (
182+
type === ContentType.FormData &&
183+
body &&
184+
body !== null &&
185+
typeof body === "object"
186+
) {
147187
body = this.createFormData(body as Record<string, unknown>);
148188
}
149189

150-
if (type === ContentType.Text && body && body !== null && typeof body !== "string") {
190+
if (
191+
type === ContentType.Text &&
192+
body &&
193+
body !== null &&
194+
typeof body !== "string"
195+
) {
151196
body = JSON.stringify(body);
152197
}
153198

154199
return this.instance.request({
155200
...requestParams,
156201
headers: {
157202
...(requestParams.headers || {}),
158-
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
203+
...(type ? { "Content-Type": type } : {}),
159204
},
160205
params: query,
161206
responseType: responseFormat,
@@ -172,7 +217,9 @@ export class HttpClient<SecurityDataType = unknown> {
172217
*
173218
* This server is used by the FTSO protocol data provider.
174219
*/
175-
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
220+
export class Api<
221+
SecurityDataType extends unknown,
222+
> extends HttpClient<SecurityDataType> {
176223
feedValueProviderApi = {
177224
/**
178225
* No description
@@ -182,7 +229,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
182229
* @request POST:/feed-values/{votingRoundId}
183230
* @response `201` `FeedValuesResponse`
184231
*/
185-
getFeedValues: (votingRoundId: number, data: FeedValuesRequest, params: RequestParams = {}) =>
232+
getFeedValues: (
233+
votingRoundId: number,
234+
data: FeedValuesRequest,
235+
params: RequestParams = {},
236+
) =>
186237
this.request<FeedValuesResponse, any>({
187238
path: `/feed-values/${votingRoundId}`,
188239
method: "POST",
@@ -207,7 +258,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
207258
category: number;
208259
name: string;
209260
},
210-
params: RequestParams = {}
261+
params: RequestParams = {},
211262
) =>
212263
this.request<FeedValueResponse, any>({
213264
path: `/feed-value/${votingRoundId}/${feed}`,

apps/ftso-data-provider/src/feed-value-provider-api/provider-generator.ts

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ console.log(`Generating API from ${input} to ${output}`);
1010

1111
/* NOTE: all fields are optional expect one of `input`, `url`, `spec` */
1212
generateApi({
13-
name: "provider-api.ts",
13+
fileName: "provider-api.ts",
1414
// set to `false` to prevent the tool from writing to disk
1515
output: output,
1616
input: input,
@@ -38,12 +38,6 @@ generateApi({
3838
addReadonly: false,
3939
sortTypes: false,
4040
sortRoutes: false,
41-
extractingOptions: {
42-
requestBodySuffix: ["Payload", "Body", "Input"],
43-
requestParamsSuffix: ["Params"],
44-
responseBodySuffix: ["Data", "Result", "Output"],
45-
responseErrorSuffix: ["Error", "Fail", "Fails", "ErrorData", "HttpError", "BadResponse"],
46-
},
4741
})
4842
.then(({ files, configuration }) => {
4943
console.log(`Generated ${files.length} files`);

package.json

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
{
2-
"name": "nest-typescript-starter",
2+
"name": "ftso-scaling",
33
"private": true,
44
"version": "1.0.0",
5-
"description": "Nest TypeScript starter repository",
5+
"description": "FTSO data provider client and reward calculator",
66
"license": "MIT",
7+
"engines": {
8+
"node": ">=22.0.0"
9+
},
710
"scripts": {
811
"build": "nest build",
912
"format": "prettier --write \"apps/**/*.ts\" \"libs/**/*.ts\"",
@@ -17,68 +20,67 @@
1720
"test:integration": "yarn test 'test/**/integration/**/*.test.ts'",
1821
"test:all": "yarn test 'test/**/*.test.ts'",
1922
"test:coverage": "nyc yarn test:all",
20-
"-----CUSTOM-SCRIPTS-----": "",
21-
"start:dev:provider": "nest start example_provider --watch",
2223
"-----DEVELOP-SCRIPTS-----": "echo ONLY FOR DEVELOPMENT",
2324
"ftso-data-provider-provider-api-gen": "ts-node apps/ftso-data-provider/src/feed-value-provider-api/provider-generator.ts"
2425
},
2526
"dependencies": {
26-
"@nestjs/common": "^10.0.0",
27-
"@nestjs/config": "^3.1.1",
28-
"@nestjs/core": "^10.0.0",
29-
"@nestjs/passport": "^10.0.3",
30-
"@nestjs/platform-express": "^10.0.0",
31-
"@nestjs/swagger": "^7.1.17",
32-
"@nestjs/typeorm": "^10.0.1",
27+
"@nestjs/common": "^11.1.3",
28+
"@nestjs/config": "^4.0.2",
29+
"@nestjs/core": "^11.1.3",
30+
"@nestjs/passport": "^10",
31+
"@nestjs/platform-express": "^11.1.3",
32+
"@nestjs/swagger": "^11.2.0",
33+
"@nestjs/typeorm": "^11.0.0",
3334
"@scure/base": "^1.2.1",
3435
"axios": "^1.6.5",
3536
"class-transformer": "^0.5.1",
3637
"ethers": "^6.6.0",
37-
"glob": "^10.3.10",
38-
"helmet": "^7.1.0",
39-
"lru-cache": "^10.2.0",
38+
"glob": "^11.0.2",
39+
"helmet": "^8.1.0",
40+
"lru-cache": "^11.1.0",
4041
"mysql2": "^3.6.5",
4142
"nest-commander": "^3.12.5",
4243
"passport": "^0.7.0",
4344
"passport-headerapikey": "^1.2.2",
44-
"reflect-metadata": "^0.1.13",
45+
"reflect-metadata": "^0.2.2",
4546
"rxjs": "^7.8.1",
47+
"string-width": "7.2.0",
4648
"typeorm": "^0.3.17",
4749
"web3": "^4",
4850
"workerpool": "^9.1.0"
4951
},
5052
"devDependencies": {
5153
"@istanbuljs/nyc-config-typescript": "^1.0.2",
52-
"@nestjs/cli": "^10.0.1",
53-
"@nestjs/schematics": "^10.0.1",
54-
"@nestjs/testing": "^10.3.0",
55-
"@sinonjs/fake-timers": "^11.2.2",
56-
"@swc/cli": "^0.1.62",
54+
"@nestjs/cli": "^11.0.7",
55+
"@nestjs/schematics": "^11.0.5",
56+
"@nestjs/testing": "^11.1.3",
57+
"@sinonjs/fake-timers": "^14.0.0",
58+
"@swc/cli": "^0.7.7",
5759
"@swc/core": "^1.3.64",
58-
"@types/chai": "^4.3.11",
59-
"@types/chai-as-promised": "^7.1.8",
60-
"@types/express": "^4.17.17",
60+
"@types/chai": "^5.2.2",
61+
"@types/chai-as-promised": "^8.0.2",
62+
"@types/express": "^5.0.3",
6163
"@types/mocha": "^10.0.6",
62-
"@types/node": "^20.3.1",
64+
"@types/node": "^24.0.0",
6365
"@types/sinon": "^17.0.3",
6466
"@types/sinonjs__fake-timers": "^8.1.5",
65-
"@types/workerpool": "^6.4.7",
66-
"@typescript-eslint/eslint-plugin": "^5.59.11",
67-
"@typescript-eslint/parser": "^5.59.11",
68-
"axios-mock-adapter": "^1.22.0",
69-
"chai": "^4.3.7",
70-
"chai-as-promised": "7.1.1",
71-
"eslint": "^8.42.0",
72-
"eslint-config-prettier": "^8.8.0",
73-
"eslint-plugin-prettier": "^4.2.1",
74-
"mocha": "^10.2.0",
75-
"nyc": "^15.1.0",
67+
"@types/workerpool": "^9.0.0",
68+
"@typescript-eslint/eslint-plugin": "^8.34.0",
69+
"@typescript-eslint/parser": "^8.34.0",
70+
"axios-mock-adapter": "^2.1.0",
71+
"chai": "^5.2.0",
72+
"chai-as-promised": "8.0.1",
73+
"eslint": "^9.28.0",
74+
"eslint-config-prettier": "^10.1.5",
75+
"eslint-plugin-prettier": "^5.4.1",
76+
"mocha": "^11.6.0",
77+
"nyc": "^17.1.0",
7678
"prando": "^6.0.1",
77-
"prettier": "^2.8.8",
78-
"sinon": "^17.0.1",
79+
"prettier": "^3.5.3",
80+
"sinon": "^20.0.0",
7981
"source-map-support": "^0.5.21",
8082
"sqlite3": "^5.1.7",
81-
"supertest": "^6.3.3",
83+
"supertest": "^7.1.1",
8284
"swagger-typescript-api": "^13.0.3",
8385
"ts-loader": "^9.4.3",
8486
"ts-node": "^10.9.1",

0 commit comments

Comments
 (0)