Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade various dependencies #543

Merged
merged 6 commits into from
Oct 21, 2024
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
1,201 changes: 559 additions & 642 deletions package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions packages/ckan/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"types": "dist/ckan/src/index.d.ts",
"type": "module",
"scripts": {
"test": "c8 --all --reporter=lcovonly --reporter=text mocha",
"test": "c8 --all --reporter=lcovonly --reporter=text node --test **/*.test.js",
"example-instance": "node test/support/run-instance.js",
"clean": "rimraf dist/",
"prebuild": "npm run clean",
Expand Down Expand Up @@ -47,11 +47,10 @@
"xmlbuilder2": "^3.1.1"
},
"devDependencies": {
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"c8": "^10.1.2",
"chai": "^5.1.1",
"chai-subset": "^1.6.0",
"mocha": "^10.7.3",
"rimraf": "^6.0.1",
"trifid-core": "^5.0.0",
"trifid-handler-fetch": "^3.3.1",
Expand Down
4 changes: 2 additions & 2 deletions packages/ckan/test/ckan.test.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @ts-check

import { strictEqual } from 'node:assert'
import { readFile } from 'fs/promises'
import { readFile } from 'node:fs/promises'
import { describe, it, beforeEach, afterEach } from 'node:test'
import { expect } from 'chai'
import * as chai from 'chai'
import chaiSubset from 'chai-subset'
import * as xml from 'xml2js'
import xpath from 'xml2js-xpath'
import { describe, it } from 'mocha'
import { convertLegacyFrequency } from '../src/xml.js'
import { createTrifidInstance, getListenerURL } from './support/utils.js'

Expand Down
3 changes: 1 addition & 2 deletions packages/ckan/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"skipLibCheck": true
"outDir": "dist"
}
}
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
},
"devDependencies": {
"@rdfjs/types": "^1.1.2",
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"c8": "^10.1.2",
"chai": "^5.1.1",
"mocha": "^10.7.3",
Expand Down
10 changes: 10 additions & 0 deletions packages/core/test/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ describe('config', () => {
})

it('sould throw if we add some non-supported fields', () => {
// @ts-ignore (this is what we want to test)
expect(() => parser({ thisFieldIsNotSupported: true })).to.throw()
})

Expand Down Expand Up @@ -50,13 +51,15 @@ describe('config', () => {
// this is a string instead of an array of strings
expect(() => {
parser({
// @ts-ignore (this is what we want to test)
extends: 'this is a string instead of an array',
})
}).to.throw()

// this is not an array of strings, but an array of integers
expect(() => {
parser({
// @ts-ignore (this is what we want to test)
extends: [1, 2, 3],
})
}).to.throw()
Expand Down Expand Up @@ -116,6 +119,7 @@ describe('config', () => {
// this is a string instead of an object
expect(() => {
parser({
// @ts-ignore (this is what we want to test)
server: 'this is a string instead of an object',
})
}).to.throw()
Expand All @@ -126,6 +130,7 @@ describe('config', () => {
server: {
listener: {},
options: {},
// @ts-ignore (this is what we want to test)
unsupportedField: true,
},
})
Expand All @@ -149,6 +154,7 @@ describe('config', () => {
server: {
listener: {
port: 8080,
// @ts-ignore (this is what we want to test)
unsupportedField: true,
},
options: {},
Expand Down Expand Up @@ -197,6 +203,7 @@ describe('config', () => {
// this is a string instead of an object
expect(() => {
parser({
// @ts-ignore (this is what we want to test)
globals: 'this is a string instead of an object',
})
}).to.throw()
Expand Down Expand Up @@ -271,6 +278,7 @@ describe('config', () => {
it('should throw if plugins is a string', () => {
return expect(() => {
parser({
// @ts-ignore (this is what we want to test)
plugins: 'this is a string instead of an object',
})
}).to.throw()
Expand All @@ -280,7 +288,9 @@ describe('config', () => {
return expect(() => {
parser({
plugins: {
// @ts-ignore (this is what we want to test)
order: 42,
// @ts-ignore (this is what we want to test)
name: 'module',
},
})
Expand Down
164 changes: 164 additions & 0 deletions packages/core/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
/**
* Trifid Plugin Configuration.
*/
export type TrifidPluginConfig = {
/**
* The order of the plugin (for loading them).
*/
order?: number;
/**
* The NPM module of the plugin.
*/
module?: string;
/**
* The paths to apply the plugin to.
*/
paths?: string | string[];
/**
* The HTTP methods to apply the plugin to.
*/
methods?: string | string[];
/**
* The hosts to apply the plugin to.
*/
hosts?: string | string[];
/**
* The plugin configuration.
*/
config?: {
[x: string]: any;
};
};
/**
* Trifid configuration.
*/
export type TrifidConfig = {
/**
* Fastify server.
*/
server?: {
listener?: {
host?: string;
port?: number | string;
};
logLevel?: "fatal" | "error" | "warn" | "info" | "debug" | "trace" | "silent";
logFormat?: "pretty" | "json";
options?: {
[x: string]: any;
};
};
/**
* Global settings.
*/
globals?: {
[x: string]: any;
};
/**
* Template settings.
*/
template?: {
[x: string]: any;
};
/**
* Plugins.
*/
plugins?: {
[x: string]: TrifidPluginConfig;
};
};
/**
* Object that have an optional `extends` field.
*/
export type ObjectWithExtends = {
/**
* The configuration to extend.
*/
extends?: string[];
};
/**
* Trifid configuration with `extends` field.
*/
export type TrifidConfigWithExtends = TrifidConfig & ObjectWithExtends;
/**
* Fastify route handler.
*/
export type FastifyRouteHandler = Function;
/**
* Trifid Plugin Argument.
*/
export type TrifidPluginArgument = {
/**
* The paths to apply the plugin to.
*/
paths?: string[];
/**
* The HTTP methods to apply the plugin to.
*/
methods?: string[];
/**
* The hosts to apply the plugin to.
*/
hosts?: string[];
/**
* The logger instance.
*/
logger: import("pino").Logger;
/**
* The Fastify server instance.
*/
server: import("fastify").FastifyInstance & {
locals: Map<string, any>;
};
/**
* The Trifid configuration.
*/
config: {
[x: string]: any;
};
/**
* The render function.
*/
render: (request: import("fastify").FastifyRequest & {
session: Map<string, any>;
}, templatePath: string, context: {
[x: string]: any;
}, options?: {
[x: string]: any;
}) => Promise<string>;
/**
* The SPARQL query function.
*/
query: TrifidQuery;
/**
* The Trifid events emitter.
*/
trifidEvents: import("node:events").EventEmitter;
/**
* Register a template helper, that can be used by the template engine.
*/
registerTemplateHelper: (name: string, fn: import("handlebars").HelperDelegate) => void;
};
/**
* Trifid Plugin Setup.
*/
export type TrifidPluginSetup = {
/**
* Default configurations for this plugin.
*/
defaultConfiguration?: () => Promise<TrifidPluginConfig>;
/**
* Route handler.
*/
routeHandler?: () => Promise<FastifyRouteHandler>;
};
/**
* Trifid Plugin.
*/
export type TrifidPlugin = (trifid: TrifidPluginArgument) => Promise<TrifidPluginSetup | void>;
/**
* Trifid Query.
*/
export type TrifidQuery = (query: string, options?: {
[x: string]: any;
}) => Promise<any>;
//# sourceMappingURL=index.d.ts.map
2 changes: 0 additions & 2 deletions packages/graph-explorer/.npmignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.eslintrc
.github
node_modules
test
coverage/
Expand Down
12 changes: 9 additions & 3 deletions packages/graph-explorer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"description": "Trifid Graph Explorer plugin",
"type": "module",
"main": "index.js",
"types": "dist/index.d.ts",
"version": "2.0.4",
"license": "MIT",
"homepage": "https://github.com/zazuko/trifid",
Expand All @@ -16,7 +17,11 @@
},
"scripts": {
"coverage": "codecov",
"test": "c8 --all --reporter=lcovonly --reporter=text node --test **/*.test.js"
"test": "c8 --all --reporter=lcovonly --reporter=text node --test **/*.test.js",
"clean": "rimraf dist/",
"prebuild": "npm run clean",
"build": "tsc",
"prepack": "npm run build"
},
"author": {
"name": "Zazuko GmbH",
Expand All @@ -33,9 +38,10 @@
"import-meta-resolve": "^4.1.0"
},
"devDependencies": {
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"c8": "^10.1.2",
"trifid-core": "^5.0.0"
"trifid-core": "^5.0.0",
"typescript": "^5.6.3"
},
"publishConfig": {
"access": "public",
Expand Down
6 changes: 6 additions & 0 deletions packages/graph-explorer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"outDir": "dist"
}
}
2 changes: 1 addition & 1 deletion packages/handler-fetch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"uuid": "^10.0.0"
},
"devDependencies": {
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"@types/uuid": "^10.0.0",
"c8": "^10.1.2",
"rimraf": "^6.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/markdown-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"CHANGELOG.md"
],
"devDependencies": {
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"c8": "^10.1.2",
"rimraf": "^6.0.1",
"trifid-core": "^5.0.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/sparql-proxy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"trifid-core": "^5.0.0"
},
"devDependencies": {
"@types/node": "^22.7.4",
"@types/node": "^22.7.7",
"chai": "^5.1.1",
"mocha": "^10.7.3",
"sinon": "^19.0.2",
Expand Down
2 changes: 2 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"emitDeclarationOnly": true,
"declarationMap": true,
"esModuleInterop": true,
"skipLibCheck": true,
"composite": true,
"moduleResolution": "NodeNext",
"module": "NodeNext",
"outDir": "dist"
Expand Down