Skip to content

Commit 7394605

Browse files
author
uid10804
committed
fix(server): update packages to have a functional state again
1 parent a28e68a commit 7394605

File tree

12 files changed

+9982
-8835
lines changed

12 files changed

+9982
-8835
lines changed

packages/server/package-lock.json

Lines changed: 9855 additions & 8638 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/server/package.json

Lines changed: 40 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -33,58 +33,56 @@
3333
},
3434
"homepage": "https://github.com/pharindoko/json-serverless.git#readme",
3535
"dependencies": {
36-
"@azure/storage-blob": "^12.3.0",
37-
"@azure/storage-file-share": "^12.3.0",
38-
"@types/lowdb": "1.0.9",
39-
"@types/pino": "6.3.3",
40-
"ajv": "^8.0.0",
36+
"@azure/storage-blob": "^12.15.0",
37+
"@azure/storage-file-share": "^12.15.0",
38+
"@types/lowdb": "1.0.11",
39+
"@types/pino": "7.0.4",
40+
"ajv": "^8.12.0",
4141
"cors": "^2.8.5",
42-
"express": "^4.17.1",
42+
"express": "^4.18.2",
4343
"express-graphql": "^0.12.0",
44-
"express-list-endpoints": "^5.0.0",
44+
"express-list-endpoints": "^6.0.0",
4545
"graphql": "^15.4.0",
46-
"helmet": "^4.3.1",
47-
"json-server": "^0.16.3",
48-
"lowdb": "^2.0.0",
46+
"helmet": "^7.0.0",
47+
"json-server": "^0.17.3",
48+
"lowdb": "^1.0.0",
4949
"lowdb-adapter-aws-s3": "^1.1.2",
50-
"node-fetch": "^2.6.0",
51-
"passport": "^0.4.1",
50+
"node-fetch": "^2.6.12",
51+
"passport": "^0.6.0",
5252
"passport-headerapikey": "^1.2.2",
53-
"pino": "^6.9.0",
54-
"serverless-http": "^2.6.0",
53+
"pino": "^8.15.0",
54+
"serverless-http": "^3.2.0",
5555
"swagger-to-graphql": "^4.0.2",
56-
"swagger-ui-express": "^4.1.6",
57-
"table": "^6.0.6"
56+
"swagger-ui-express": "^5.0.0",
57+
"table": "^6.8.1"
5858
},
5959
"devDependencies": {
60-
"@types/aws-lambda": "8.10.64",
61-
"@types/body-parser": "1.19.0",
62-
"@types/cors": "2.8.8",
60+
"@types/aws-lambda": "8.10.119",
61+
"@types/body-parser": "1.19.2",
62+
"@types/cors": "2.8.13",
6363
"@types/dotenv": "6.1.1",
64-
"@types/express": "4.17.8",
65-
"@types/express-serve-static-core": "4.17.13",
66-
"@types/jest": "27.0.0",
67-
"@types/json-server": "0.14.2",
68-
"@types/node": "16.11.6",
69-
"@types/passport": "1.0.4",
70-
"@types/supertest": "2.0.10",
71-
"@types/swagger-schema-official": "2.0.21",
72-
"@types/swagger-ui-express": "4.1.2",
64+
"@types/jest": "29.5.3",
65+
"@types/json-server": "0.14.4",
66+
"@types/node": "20.5.0",
67+
"@types/passport": "1.0.12",
68+
"@types/supertest": "2.0.12",
69+
"@types/swagger-schema-official": "2.0.22",
70+
"@types/swagger-ui-express": "4.1.3",
7371
"@types/table": "6.0.0",
74-
"cypress": "9.0.0",
75-
"dotenv": "10.0.0",
76-
"eslint": "8.0.0",
72+
"cypress": "12.17.4",
73+
"dotenv": "16.3.1",
74+
"eslint": "8.47.0",
7775
"eslint-config-airbnb-base": "15.0.0",
78-
"eslint-plugin-import": "2.22.1",
79-
"gts": "2.0.0",
80-
"jest": "27.0.1",
81-
"source-map-support": "0.5.19",
82-
"supertest": "6.0.0",
83-
"ts-jest": "27.0.0",
84-
"ts-loader": "9.1.2",
85-
"ts-node": "10.0.0",
86-
"tsc-watch": "4.2.9",
87-
"typescript": "4.1.2"
76+
"eslint-plugin-import": "2.28.0",
77+
"gts": "5.0.0",
78+
"jest": "29.6.2",
79+
"source-map-support": "0.5.21",
80+
"supertest": "6.3.3",
81+
"ts-jest": "29.1.1",
82+
"ts-loader": "9.4.4",
83+
"ts-node": "10.9.1",
84+
"tsc-watch": "6.0.4",
85+
"typescript": "5.1.6"
8886
},
8987
"config": {
9088
"commitizen": {
@@ -94,4 +92,4 @@
9492
"files": [
9593
"lib/**/*"
9694
]
97-
}
95+
}

packages/server/src/specifications/swagger/swaggerspec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export class SwaggerSpec {
4242
title: '',
4343
};
4444
this.packageInfo = JSON.parse(
45-
fs.readFileSync(this.packageJsonPath, 'UTF-8')
45+
fs.readFileSync(this.packageJsonPath, 'utf8')
4646
) as PackageInfo;
4747
if (this.packageInfo.name) {
4848
newInfo.title = this.packageInfo.name;

packages/server/src/storage/azure.fileshare.storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export class AzureFileShareStorageAdapter implements StorageAdapter {
2222

2323
init(): AdapterAsync {
2424
console.log('initController');
25-
const db = JSON.parse(fs.readFileSync(this.jsonFilePath, 'UTF-8'));
25+
const db = JSON.parse(fs.readFileSync(this.jsonFilePath, 'utf8'));
2626
const storageAdapter = new AzureFileShareLowDBAdapter(
2727
db,
2828
this.azureStorageConnectionString,

packages/server/src/storage/dynamodb.storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class DynamoDBStorageAdapter implements StorageAdapter {
1717

1818
init(): import('lowdb').AdapterAsync {
1919
console.log('initController');
20-
const db = JSON.parse(fs.readFileSync(this.jsonFilePath, 'UTF-8'));
20+
const db = JSON.parse(fs.readFileSync(this.jsonFilePath, 'utf8'));
2121
const storageAdapter = new DynamoDBLowDBAdapter(
2222
db,
2323
this.table,

packages/server/src/storage/s3.storage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export class S3StorageAdapter implements StorageAdapter {
1111
}
1212

1313
init(): import('lowdb').AdapterAsync {
14-
const db = JSON.parse(fs.readFileSync(this.s3file, 'UTF-8'));
14+
const db = JSON.parse(fs.readFileSync(this.s3file, 'utf8'));
1515
const storageAdapter = new awsAdapter(this.s3file, {
1616
defaultValue: db,
1717
aws: { bucketName: this.s3bucket },

packages/server/src/utils/grapqhl_callback.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import fetch from 'node-fetch';
1+
import * as fetch from 'node-fetch';
22
import { URLSearchParams } from 'url';
33
import { CallBackendArguments } from 'swagger-to-graphql';
44

@@ -49,7 +49,7 @@ export class GraphQLMethods {
4949
headers
5050
);
5151

52-
const response = await fetch(url, {
52+
const response = await fetch.default(url, {
5353
method,
5454
...bodyAndHeaders,
5555
});

packages/server/src/utils/output.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ValidationResult } from '../validations/validationresult';
33
import { table } from 'table';
44
export class Output {
55
static setWarning(message: string) {
6-
Logger.getInstance().warning(message);
6+
Logger.getInstance().warn(message);
77
}
88
static setError(message: string) {
99
Logger.getInstance().error(message);

packages/server/src/validations/validationrule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ export class EmptyArrayRule extends ValidationRule {
105105
const ruleSeverityError = RuleResultSeverity.ALERT;
106106
const messageError =
107107
'empty array found at path: ' +
108-
error.dataPath +
108+
error.instancePath +
109109
' - please deactivate Swagger/GraphQL interface (--no-swagger) or add at least one item in the array';
110110
this.ruleEvents.push(
111111
new RuleEvent(ruleSeverityError, messageError)

packages/server/tests/end2end.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ describe('end2end test with cypress', () => {
77
appConfig.jsonFile = './tests/resources/validate.handler.json';
88

99
const localServer = initServerComponents(appConfig);
10-
beforeAll(async done => {
10+
beforeAll(async () => {
1111
await localServer.init();
12-
done();
1312
});
1413

15-
test('all pages should be available', async done => {
14+
test('all pages should be available', async () => {
1615
const cypress = require('cypress');
1716
await cypress.run({
1817
reporter: 'junit',
@@ -22,6 +21,5 @@ describe('end2end test with cypress', () => {
2221
video: false,
2322
},
2423
});
25-
done();
2624
}, 60000);
2725
});

packages/server/tests/graphql.spec.ts

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,11 @@ describe('public graphql calls', () => {
77
appConfig.jsonFile = './tests/resources/validate.graphql.json';
88

99
const localServer = initServerComponents(appConfig);
10-
beforeAll(async done => {
10+
beforeAll(async () => {
1111
await localServer.init();
12-
done();
1312
});
1413

15-
test('Graphql: It should return a response from posts endpoint', async done => {
14+
test('Graphql: It should return a response from posts endpoint', async () => {
1615
try {
1716
const response = await request(localServer.server)
1817
.post(
@@ -24,11 +23,9 @@ describe('public graphql calls', () => {
2423
} catch (error) {
2524
console.log(error);
2625
}
27-
28-
done();
2926
});
3027

31-
test('Graphql: It should create, update and delete a new post item using querystring', async done => {
28+
test('Graphql: It should create, update and delete a new post item using querystring', async () => {
3229
try {
3330
const createReponse = await request(localServer.server)
3431
.post(
@@ -71,11 +68,9 @@ describe('public graphql calls', () => {
7168
} catch (error) {
7269
console.log(error);
7370
}
74-
75-
done();
7671
});
7772

78-
test('Graphql: It should create, update and delete a new post item using body', async done => {
73+
test('Graphql: It should create, update and delete a new post item using body', async () => {
7974
try {
8075
const createReponse = await request(localServer.server)
8176
.post('/graphql')
@@ -113,8 +108,6 @@ describe('public graphql calls', () => {
113108
} catch (error) {
114109
console.log(error);
115110
}
116-
117-
done();
118111
});
119112
});
120113

@@ -124,12 +117,11 @@ describe('apikey secured graphql calls', () => {
124117
appConfig.jsonFile = './tests/resources/validate.graphql.apikey.json';
125118
appConfig.enableApiKeyAuth = false;
126119
const localServer = initServerComponents(appConfig);
127-
beforeAll(async done => {
120+
beforeAll(async () => {
128121
await localServer.init();
129-
done();
130122
});
131123

132-
test('Graphql: It should return a response from posts endpoint', async done => {
124+
test('Graphql: It should return a response from posts endpoint', async () => {
133125
try {
134126
const response = await request(localServer.server)
135127
.post(
@@ -142,11 +134,9 @@ describe('apikey secured graphql calls', () => {
142134
} catch (error) {
143135
console.log(error);
144136
}
145-
146-
done();
147137
});
148138

149-
test('Graphql: It should create, update and delete a new post item using querystring', async done => {
139+
test('Graphql: It should create, update and delete a new post item using querystring', async () => {
150140
try {
151141
const createReponse = await request(localServer.server)
152142
.post(
@@ -192,11 +182,9 @@ describe('apikey secured graphql calls', () => {
192182
} catch (error) {
193183
console.log(error);
194184
}
195-
196-
done();
197185
});
198186

199-
test('Graphql: It should create, update and delete a new post item using body', async done => {
187+
test('Graphql: It should create, update and delete a new post item using body', async () => {
200188
try {
201189
const createReponse = await request(localServer.server)
202190
.post('/graphql')
@@ -238,7 +226,5 @@ describe('apikey secured graphql calls', () => {
238226
console.log(error);
239227
throw error;
240228
}
241-
242-
done();
243229
});
244230
});

0 commit comments

Comments
 (0)