Skip to content

Commit 4bb1e90

Browse files
authored
Bump dependencies Sep 22 (#213)
* chore: bump dependencies to latest - mongodb: use acknowledged instead of ok - commander: get opts() - remove stringify-object -> use JSON.stringify * chore: fix tests after dependecy bump * chore: fix unit-tests * fix: longer timeout for trino tests
1 parent 77d80cf commit 4bb1e90

17 files changed

+146
-140
lines changed

funks.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const jsb = require("js-beautify").js_beautify;
55
const { join, parse } = require("path");
66
const { promisify } = require("util");
77
const ejsRenderFile = promisify(ejs.renderFile);
8-
const stringify_obj = require("stringify-object");
98
const colors = require("colors/safe");
109
const { getModelDatabase } = require("./lib/generators-aux");
1110
const { getOperators } = require("./lib/operators-aux");
@@ -616,7 +615,7 @@ module.exports.getOptions = function (dataModel) {
616615
type: opts.idAttributeType,
617616
};
618617

619-
opts["definition"] = stringify_obj(dataModel);
618+
opts["definition"] = JSON.stringify(dataModel);
620619
delete opts.attributes[opts.idAttribute];
621620
return opts;
622621
};

index.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,10 @@ program
2424
.option("-b, --noBasicCode", "does not generate basic code", false)
2525
.parse(process.argv);
2626

27+
const opts = program.opts();
28+
2729
//check input JSON files
28-
if (!program.jsonFiles) {
30+
if (!opts.jsonFiles) {
2931
//msg
3032
console.log(
3133
colors.red("! Error: "),
@@ -35,18 +37,18 @@ if (!program.jsonFiles) {
3537
}
3638

3739
//ops: output/input directories
38-
let jsonFiles = program.jsonFiles;
39-
let directory = program.outputDirectory || __dirname;
40+
let jsonFiles = opts.jsonFiles;
41+
let directory = opts.outputDirectory || __dirname;
4042
//msg
4143
console.log("Input directory: ", colors.dim(path.resolve(jsonFiles)));
4244
console.log("Output directory: ", colors.dim(path.resolve(directory)));
4345

4446
//op: verbose, migrations
45-
let verbose = program.verbose !== undefined ? true : false;
46-
let migrations = program.migrations;
47-
let basicCode = !program.noBasicCode;
47+
let verbose = opts.verbose !== undefined ? true : false;
48+
let migrations = opts.migrations;
49+
let basicCode = !opts.noBasicCode;
4850
//run codegen
49-
funks.generateCode(program.jsonFiles, directory, {
51+
funks.generateCode(opts.jsonFiles, directory, {
5052
verbose,
5153
migrations,
5254
basicCode,

package.json

+12-13
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,24 @@
1919
"author": "Science-DB team",
2020
"license": "GPL-3.0",
2121
"dependencies": {
22-
"ajv": "^6.12.2",
23-
"aws-sdk": "^2.874.0",
22+
"ajv": "^8.11.0",
23+
"aws-sdk": "^2.1207.0",
2424
"colors": "^1.4.0",
25-
"commander": "^5.1.0",
26-
"dotenv": "^16.0.1",
27-
"ejs": "^3.1.3",
28-
"inflection": "^1.12.0",
29-
"js-beautify": "^1.11.0",
30-
"stringify-object": "^3.3.0",
25+
"commander": "^9.4.0",
26+
"dotenv": "^16.0.2",
27+
"ejs": "^3.1.8",
28+
"inflection": "^1.13.2",
29+
"js-beautify": "^1.14.6",
3130
"sync-request": "^6.1.0"
3231
},
3332
"devDependencies": {
34-
"axios": "^0.19.2",
35-
"chai": "^4.2.0",
36-
"delay": "^4.3.0",
37-
"eslint": "^7.0.0",
33+
"axios": "^0.27.2",
34+
"chai": "^4.3.6",
35+
"delay": "^5.0.0",
36+
"eslint": "^8.23.0",
3837
"eslint-plugin-ejs": "0.0.2",
3938
"jsonwebtoken": "^8.5.1",
40-
"mocha": "^7.1.2",
39+
"mocha": "^10.0.0",
4140
"require-from-string": "^2.0.2"
4241
}
4342
}

test/mocha_integration.test.js

+12-10
Original file line numberDiff line numberDiff line change
@@ -758,6 +758,7 @@ describe('Clean GraphQL Server: one new basic function per test ("Individual" mo
758758
{
759759
message:
760760
"Remote server (http://server1:3000/graphql) did not respond with data.",
761+
extensions: {},
761762
locations: [
762763
{
763764
line: 1,
@@ -1098,7 +1099,7 @@ describe('Clean GraphQL Server: one new basic function per test ("Individual" mo
10981099
errors: [
10991100
{
11001101
message:
1101-
'Field "hello" is not defined by type paginationCursorInput.',
1102+
'Field \"hello\" is not defined by type \"paginationCursorInput\".',
11021103
locations: [
11031104
{
11041105
line: 1,
@@ -1141,7 +1142,7 @@ describe('Clean GraphQL Server: one new basic function per test ("Individual" mo
11411142
errors: [
11421143
{
11431144
message:
1144-
'Expected type Date, found "today"; Date cannot represent an invalid date-string today.',
1145+
'Expected value of type \"Date\", found \"today\"; Date cannot represent an invalid date-string today.',
11451146
locations: [
11461147
{
11471148
line: 1,
@@ -1171,28 +1172,28 @@ describe('Clean GraphQL Server: one new basic function per test ("Individual" mo
11711172
validationErrors: [
11721173
{
11731174
keyword: "type",
1174-
dataPath: ".name",
1175+
instancePath: "/name",
11751176
schemaPath: "#/properties/name/anyOf/0/type",
11761177
params: {
11771178
type: "null",
11781179
},
1179-
message: "should be null",
1180+
message: "must be null",
11801181
},
11811182
{
11821183
keyword: "pattern",
1183-
dataPath: ".name",
1184+
instancePath: "/name",
11841185
schemaPath: "#/properties/name/anyOf/1/pattern",
11851186
params: {
11861187
pattern: "^[a-zA-Z0-9]+$",
11871188
},
1188-
message: 'should match pattern "^[a-zA-Z0-9]+$"',
1189+
message: 'must match pattern "^[a-zA-Z0-9]+$"',
11891190
},
11901191
{
11911192
keyword: "anyOf",
1192-
dataPath: ".name",
1193+
instancePath: "/name",
11931194
schemaPath: "#/properties/name/anyOf",
11941195
params: {},
1195-
message: "should match some schema in anyOf",
1196+
message: "must match a schema in anyOf",
11961197
},
11971198
],
11981199
},
@@ -2605,6 +2606,7 @@ describe("Zendro Webservice Data Models", function () {
26052606
{
26062607
message:
26072608
"Web-service http://server1:3000/graphql returned attached (see below) error(s).",
2609+
extensions: {},
26082610
locations: [{ line: 1, column: 10 }],
26092611
path: ["addAccession"],
26102612
},
@@ -2615,10 +2617,10 @@ describe("Zendro Webservice Data Models", function () {
26152617
validationErrors: [
26162618
{
26172619
keyword: "pattern",
2618-
dataPath: ".collectors_name",
2620+
instancePath: "/collectors_name",
26192621
schemaPath: "#/properties/collectors_name/pattern",
26202622
params: { pattern: "^[a-zA-Z0-9_]+$" },
2621-
message: 'should match pattern "^[a-zA-Z0-9_]+$"',
2623+
message: 'must match pattern "^[a-zA-Z0-9_]+$"',
26222624
},
26232625
],
26242626
receivedFrom: ["http://server1:3000/graphql"],

test/mocha_integration_acl.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1093,10 +1093,10 @@ describe("Zendro Webservice Data Models", function () {
10931093
validationErrors: [
10941094
{
10951095
keyword: "pattern",
1096-
dataPath: ".collectors_name",
1096+
instancePath: "/collectors_name",
10971097
schemaPath: "#/properties/collectors_name/pattern",
10981098
params: { pattern: "^[a-zA-Z0-9_]+$" },
1099-
message: 'should match pattern "^[a-zA-Z0-9_]+$"',
1099+
message: 'must match pattern "^[a-zA-Z0-9_]+$"',
11001100
},
11011101
],
11021102
receivedFrom: ["http://server1:3000/graphql"],

test/mocha_integration_amazon_s3.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ describe("Amazon S3/ Minio - Upload/Read Operations", () => {
5353
reader_name: "Sally",
5454
age: 15.4,
5555
student: true,
56-
lastSeen: "2020-10-03T10:15:30Z",
56+
lastSeen: "2020-10-03T10:15:30.000Z",
5757
history: [
5858
"Critique of Pure Reason",
5959
"The World as Will and Representation",
@@ -696,7 +696,7 @@ describe("Amazon S3/ Minio - Distributed Data Models", () => {
696696
reader_name: "dist_Sally",
697697
age: 15.4,
698698
student: true,
699-
lastSeen: "2020-10-03T10:15:30Z",
699+
lastSeen: "2020-10-03T10:15:30.000Z",
700700
history: [
701701
"Critique of Pure Reason",
702702
"The World as Will and Representation",

test/mocha_integration_neo4j.test.js

+2
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,7 @@ describe("Neo4j - Association", () => {
660660
{
661661
message:
662662
"director with director_id d1 has associated records with 'reject' reaction and is NOT valid for deletion. Please clean up before you delete.",
663+
extensions: {},
663664
locations: [
664665
{
665666
column: 12,
@@ -1417,6 +1418,7 @@ describe("data loader for readById method", () => {
14171418
expect(resBody.errors).to.deep.equal([
14181419
{
14191420
message: 'Record with ID = "m4" does not exist',
1421+
extensions: {},
14201422
locations: [
14211423
{
14221424
column: 7,

test/testenv_cli.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ if [[ $OPT_RUN_TESTS == "true" ]]; then
123123
mocha "${TEST_DIR}/mocha_integration_mongodb.test.js"
124124
mocha "${TEST_DIR}/mocha_integration_cassandra.test.js"
125125
mocha "${TEST_DIR}/mocha_integration_amazon_s3.test.js"
126-
mocha --timeout 10000 "${TEST_DIR}/mocha_integration_trino.test.js"
126+
mocha --timeout 15000 "${TEST_DIR}/mocha_integration_trino.test.js"
127127
mocha --timeout 10000 "${TEST_DIR}/mocha_integration_presto.test.js"
128128
mocha "${TEST_DIR}/mocha_integration_neo4j.test.js"
129129
fi

test/unit_test_misc/test-describe/distributed-models.js

+63-63
Original file line numberDiff line numberDiff line change
@@ -356,85 +356,85 @@ static readAllCursor(search, order, pagination, authorizedAdapters, benignErrorR
356356

357357
module.exports.person_ddm_many_association = `
358358
const definition = {
359-
model: 'Person',
360-
storageType: 'distributed-data-model',
361-
registry: [
362-
'PeopleOne',
363-
'PeopleTwo'
359+
"model": "Person",
360+
"storageType": "distributed-data-model",
361+
"registry": [
362+
"PeopleOne",
363+
"PeopleTwo"
364364
],
365-
attributes: {
366-
firstName: 'String',
367-
lastName: 'String',
368-
email: 'String',
369-
companyId: 'Int'
365+
"attributes": {
366+
"firstName": "String",
367+
"lastName": "String",
368+
"email": "String",
369+
"companyId": "Int"
370370
},
371-
associations: {
372-
works: {
373-
type: 'many_to_many',
374-
implementation: 'sql_cross_table',
375-
target: 'Book',
376-
targetKey: 'bookId',
377-
sourceKey: 'personId',
378-
keysIn: 'books_to_people',
379-
targetStorageType: 'sql'
371+
"associations": {
372+
"works": {
373+
"type": "many_to_many",
374+
"implementation": "sql_cross_table",
375+
"target": "Book",
376+
"targetKey": "bookId",
377+
"sourceKey": "personId",
378+
"keysIn": "books_to_people",
379+
"targetStorageType": "sql"
380380
},
381-
company: {
382-
type: 'many_to_one',
383-
implementation: 'foreignkeys',
384-
target: 'publi_sher',
385-
targetKey: 'companyId',
386-
keysIn: 'Person',
387-
targetStorageType: 'zendro-server'
381+
"company": {
382+
"type": "many_to_one",
383+
"implementation": "foreignkeys",
384+
"target": "publi_sher",
385+
"targetKey": "companyId",
386+
"keysIn": "Person",
387+
"targetStorageType": "zendro-server"
388388
},
389-
dogs: {
390-
type: 'one_to_many',
391-
implementation: 'foreignkeys',
392-
target: 'Dog',
393-
targetKey: 'personId',
394-
keysIn: 'Dog',
395-
targetStorageType: 'sql'
389+
"dogs": {
390+
"type": "one_to_many",
391+
"implementation": "foreignkeys",
392+
"target": "Dog",
393+
"targetKey": "personId",
394+
"keysIn": "Dog",
395+
"targetStorageType": "sql"
396396
},
397-
parrot: {
398-
type: 'many_to_one',
399-
implementation: 'foreignkeys',
400-
target: 'Parrot',
401-
targetKey: 'personId',
402-
keysIn: 'Parrot',
403-
targetStorageType: 'sql'
397+
"parrot": {
398+
"type": "many_to_one",
399+
"implementation": "foreignkeys",
400+
"target": "Parrot",
401+
"targetKey": "personId",
402+
"keysIn": "Parrot",
403+
"targetStorageType": "sql"
404404
}
405405
},
406-
id: {
407-
name: 'id',
408-
type: 'Int'
406+
"id": {
407+
"name": "id",
408+
"type": "Int"
409409
}
410410
};
411411
`;
412412
module.exports.dog_ddm_one_association = `
413413
const definition = {
414-
model: 'Dog',
415-
storageType: 'distributed-data-model',
416-
registry: [
417-
'DogsOne',
418-
'DogsTwo'
414+
"model": "Dog",
415+
"storageType": "distributed-data-model",
416+
"registry": [
417+
"DogsOne",
418+
"DogsTwo"
419419
],
420-
attributes: {
421-
name: 'String',
422-
breed: 'String',
423-
personId: 'String'
420+
"attributes": {
421+
"name": "String",
422+
"breed": "String",
423+
"personId": "String"
424424
},
425-
associations: {
426-
owner: {
427-
type: 'many_to_one',
428-
implementation: 'foreignkeys',
429-
target: 'Person',
430-
targetKey: 'personId',
431-
keysIn: 'Dog',
432-
targetStorageType: 'sql'
425+
"associations": {
426+
"owner": {
427+
"type": "many_to_one",
428+
"implementation": "foreignkeys",
429+
"target": "Person",
430+
"targetKey": "personId",
431+
"keysIn": "Dog",
432+
"targetStorageType": "sql"
433433
}
434434
},
435-
id: {
436-
name: 'id',
437-
type: 'Int'
435+
"id": {
436+
"name": "id",
437+
"type": "Int"
438438
}
439439
};
440440
`;

0 commit comments

Comments
 (0)