diff --git a/backend/backend/package.json b/backend/backend/package.json index ca5aa85e..4b09a05f 100644 --- a/backend/backend/package.json +++ b/backend/backend/package.json @@ -45,7 +45,6 @@ "dependencies": { "@elastic/elasticsearch": "8.10.0", "@openstapps/core": "workspace:*", - "@openstapps/core-tools": "workspace:*", "@openstapps/logger": "workspace:*", "@types/body-parser": "1.19.2", "@types/cors": "2.8.13", diff --git a/examples/minimal-connector/package.json b/examples/minimal-connector/package.json index 8684b1ca..2f8052e3 100644 --- a/examples/minimal-connector/package.json +++ b/examples/minimal-connector/package.json @@ -38,7 +38,6 @@ "commander": "10.0.0" }, "devDependencies": { - "@openstapps/core-tools": "workspace:*", "@openstapps/eslint-config": "workspace:*", "@openstapps/prettier-config": "workspace:*", "@openstapps/tsconfig": "workspace:*", diff --git a/examples/minimal-plugin/package.json b/examples/minimal-plugin/package.json index d8e990d5..41b12142 100644 --- a/examples/minimal-plugin/package.json +++ b/examples/minimal-plugin/package.json @@ -30,8 +30,8 @@ "dependencies": { "@openstapps/api": "workspace:*", "@openstapps/api-plugin": "workspace:*", + "@openstapps/json-schema-generator": "workspace:*", "@openstapps/core": "workspace:*", - "@openstapps/core-tools": "workspace:*", "@openstapps/logger": "workspace:*", "commander": "10.0.0", "express": "4.18.2", @@ -46,15 +46,6 @@ "tsup": "6.7.0", "typescript": "5.1.6" }, - "tsup": { - "entry": [ - "src/app.ts" - ], - "sourcemap": true, - "clean": true, - "format": "esm", - "outDir": "lib" - }, "prettier": "@openstapps/prettier-config", "eslintConfig": { "extends": [ diff --git a/examples/minimal-plugin/src/app.ts b/examples/minimal-plugin/src/app.ts index be52ff57..15dc680f 100644 --- a/examples/minimal-plugin/src/app.ts +++ b/examples/minimal-plugin/src/app.ts @@ -15,7 +15,6 @@ */ import {HttpClient} from '@openstapps/api'; import {PluginClient} from '@openstapps/api-plugin'; -import {Converter} from '@openstapps/core-tools'; import {Logger} from '@openstapps/logger'; import {Command, Option} from 'commander'; import {readFileSync} from 'fs'; @@ -52,18 +51,11 @@ const pluginClient = new PluginClient(new HttpClient(), options.backendUrl); // create an instance of your plugin const plugin = new MinimalPlugin( - // tslint:disable-next-line:no-magic-numbers Number.parseInt(options.port, 10), options.pluginName, options.url, `/${options.routeName}`, options.backendUrl, - new Converter(path.resolve(__dirname, '..', 'src', 'plugin', 'protocol')), // an instance of the converter. Required - // because your requests and response schemas are defined in the plugin. The path should lead to your request and - // response interfaces - 'SCMinimalRequest', // TODO: adjust name of the request interface - 'SCMinimalResponse', // TODO: adjust name of the response interface - JSON.parse(readFileSync(path.resolve(__dirname, '..', 'package.json')).toString()).version, // get the version of the plugin from the package.json ); pluginClient diff --git a/examples/minimal-plugin/src/plugin/minimal-plugin.ts b/examples/minimal-plugin/src/plugin/minimal-plugin.ts index a0137b76..b78ad5c6 100644 --- a/examples/minimal-plugin/src/plugin/minimal-plugin.ts +++ b/examples/minimal-plugin/src/plugin/minimal-plugin.ts @@ -14,6 +14,7 @@ */ import {Plugin} from '@openstapps/api-plugin'; import * as express from 'express'; +import schema from '../../lib/schema.json'; import {SCMinimalRequest} from './protocol/request.js'; import {SCMinimalResponse} from './protocol/response.js'; @@ -24,6 +25,10 @@ import {SCMinimalResponse} from './protocol/response.js'; * TODO: rename the class */ export class MinimalPlugin extends Plugin { + requestSchema = schema.SCMinimalRequest; + + responseSchema = schema.SCMinimalResponse; + /** * Calculates the sum of a list of numbers * diff --git a/examples/minimal-plugin/src/plugin/protocol/request.ts b/examples/minimal-plugin/src/plugin/protocol/request.ts index da6fe388..a31bfca7 100644 --- a/examples/minimal-plugin/src/plugin/protocol/request.ts +++ b/examples/minimal-plugin/src/plugin/protocol/request.ts @@ -27,3 +27,5 @@ export interface SCMinimalRequest { */ numbers: number[]; } + +export {default as requestSchema} from 'schema:#SCMinimalRequest'; diff --git a/examples/minimal-plugin/src/plugin/protocol/response.ts b/examples/minimal-plugin/src/plugin/protocol/response.ts index 8f43cf3d..6bd91e60 100644 --- a/examples/minimal-plugin/src/plugin/protocol/response.ts +++ b/examples/minimal-plugin/src/plugin/protocol/response.ts @@ -27,3 +27,5 @@ export interface SCMinimalResponse { */ sum: number; } + +export {default as requestSchema} from 'schema:#SCMinimalResponse'; diff --git a/examples/minimal-plugin/src/plugin/protocol/tsconfig.json b/examples/minimal-plugin/src/plugin/protocol/tsconfig.json deleted file mode 100644 index 579a39ff..00000000 --- a/examples/minimal-plugin/src/plugin/protocol/tsconfig.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@openstapps/tsconfig" -} diff --git a/examples/minimal-plugin/tsup.config.ts b/examples/minimal-plugin/tsup.config.ts new file mode 100644 index 00000000..1f2c6b40 --- /dev/null +++ b/examples/minimal-plugin/tsup.config.ts @@ -0,0 +1,12 @@ +import {defineConfig} from 'tsup'; +import {jsonSchemaPlugin} from '@openstapps/json-schema-generator'; + +export default defineConfig({ + entry: ['src/app.ts'], + sourcemap: true, + clean: true, + format: 'esm', + outDir: 'lib', + noExternal: [/.*:schema#.*/], + plugins: [jsonSchemaPlugin('schema.json')], +}); diff --git a/flake.lock b/flake.lock index 8395d915..90d9cb46 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "nixpkgs": { "locked": { - "lastModified": 1689752456, - "narHash": "sha256-VOChdECcEI8ixz8QY+YC4JaNEFwQd1V8bA0G4B28Ki0=", + "lastModified": 1698553279, + "narHash": "sha256-T/9P8yBSLcqo/v+FTOBK+0rjzjPMctVymZydbvR/Fak=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "7f256d7da238cb627ef189d56ed590739f42f13b", + "rev": "90e85bc7c1a6fc0760a94ace129d3a1c61c3d035", "type": "github" }, "original": { diff --git a/packages/api-cli/package.json b/packages/api-cli/package.json index 3ce5e366..28054ac6 100644 --- a/packages/api-cli/package.json +++ b/packages/api-cli/package.json @@ -34,11 +34,9 @@ "lint:fix": "eslint --fix --ext .ts src/", "test": "c8 mocha --exit" }, - "dependencies": { + "dpendencies": { "@openstapps/api": "workspace:*", "@openstapps/core": "workspace:*", - "@openstapps/core-tools": "workspace:*", - "@openstapps/eslint-config": "workspace:*", "@openstapps/logger": "workspace:*", "@types/cli-progress": "3.11.0", "@types/express": "4.17.17", @@ -56,6 +54,7 @@ }, "devDependencies": { "@openstapps/prettier-config": "workspace:*", + "@openstapps/eslint-config": "workspace:*", "@openstapps/tsconfig": "workspace:*", "@types/chai": "4.3.5", "@types/chai-as-promised": "7.1.5", diff --git a/packages/api-plugin/package.json b/packages/api-plugin/package.json index e57c1198..5bcd2092 100644 --- a/packages/api-plugin/package.json +++ b/packages/api-plugin/package.json @@ -34,7 +34,6 @@ "dependencies": { "@openstapps/api": "workspace:*", "@openstapps/core": "workspace:*", - "@openstapps/core-tools": "workspace:*", "@openstapps/logger": "workspace:*", "@types/body-parser": "1.19.2", "@types/express": "4.17.17", diff --git a/packages/api-plugin/src/plugin.ts b/packages/api-plugin/src/plugin.ts index ab56d8f0..4dbb7f2a 100644 --- a/packages/api-plugin/src/plugin.ts +++ b/packages/api-plugin/src/plugin.ts @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {Converter} from '@openstapps/core-tools'; import {Logger} from '@openstapps/logger'; import bodyParser from 'body-parser'; import express from 'express'; @@ -63,12 +62,12 @@ export abstract class Plugin { /** * The schema of the request interfaces defined by the user */ - public readonly requestSchema: JSONSchema7 = {}; + abstract readonly requestSchema: JSONSchema7; /** * The schema of the response interfaces defined by the user */ - public readonly responseSchema: JSONSchema7 = {}; + abstract readonly responseSchema: JSONSchema7; /** * Normalize a port into a number, string, or false. @@ -104,10 +103,6 @@ export abstract class Plugin { * @param url The url of the plugin without the port or anything else, for example `http://localhost` * @param route The desired route that will be registered in the backend * @param backendUrl The url of the backend - * @param converter If you want to use an already existing converter, you can pass it here - * @param requestName the name of the request schema - * @param responseName the name of the response schema - * @param version the version. You should retrieve it from the package.json */ constructor( port: number, @@ -115,10 +110,6 @@ export abstract class Plugin { public url: string, public route: string, protected backendUrl: string, - converter: Converter, - requestName: string, - responseName: string, - version: string, ) { this.app.use(bodyParser.json()); this.port = Plugin.normalizePort( @@ -139,9 +130,6 @@ export abstract class Plugin { this.onListening(); }); - this.requestSchema = converter.getSchema(requestName, version); - this.responseSchema = converter.getSchema(responseName, version); - this.app.use(morgan('dev')); this.app.set('env', process.env.NODE_ENV); @@ -212,7 +200,7 @@ export abstract class Plugin { * Closes the server * * This will stop the plugin from listening to any requests at all, and is currently an irreversible process. - * This means, that the instantiated plugin is basically useless afterwards. + * This means that the instantiated plugin is basically useless afterward. */ public async close() { return new Promise((resolve, reject) => { diff --git a/packages/core-tools/CHANGELOG.md b/packages/core-tools/CHANGELOG.md deleted file mode 100644 index 8ed9fbe6..00000000 --- a/packages/core-tools/CHANGELOG.md +++ /dev/null @@ -1,498 +0,0 @@ -# @openstapps/core-tools - -## 3.0.0 - -### Major Changes - -- 98546a97: Removed pack tool - - Use a bundler like `tsup` in conjunction with an - `index.ts` that aggregates all exports instead. - -- 64caebaf: Move project to a turbo monorepo & pnpm - - Internal dependencies are now defined using `"@openstapps/package": "workspace:*"` - - - Removed extraneous files from packages - - `.npmrc` - - `.npmignore` - - `.mailmap` - - `.gitignore` - - `CONTRIBUTING.md` - - `LICENSE` (Project license file is added upon publishing, see [pnpm.io](https://pnpm.io/cli/publish)) - - `package-lock.json` - - `.editorconfig` - - `.eslintrc.json` (moved eslint config to `package.json`) - - `.eslintignore` - - `.gitlab-ci.yml` (Most workflows are workspace-level) - - `.gitlab/**` (issue templates etc. are now workspace-level) - - `.dockerignore` (Docker files are determined by which files are deployed with `pnpm deploy`, as per `package.json/files`) - - TSConfig has been moved to its own package (You can now use `"extends": "@openstapps/tsconfig"`) - - Removed ESLint and Prettier peer dependency hell by injecting them through the `.pnpmfile.cjs` - - Added syncpack for keeping dependency versions in sync (and consistent key ordering in `package.json`) - - Replaced conventional changelog with changesets - - Apps with binaries now use a top level `app.js` - - ```js - #!/usr/bin/env node - import './lib/app.js'; - ``` - -- 64caebaf: Migrate to ESM - - CommonJS is no longer supported in any capacity. To use the new - version, you will need to migrate your package to ESM. - We recommend using `tsup` and `Node 18`. - - ```json - { - "type": "module" - } - ``` - -- 64caebaf: Migrate package to Node 18 - - - Consumers of this package will need to migrate to Node 18 or - higher. - - Packages have been migrated from promisified `readFile` or - `readFileSync` towards `fs/promises` - - Packages use native `flatMap` now - -- 64caebaf: Migrate openapi generation to output single file - - The OpenAPI generator now outputs a single file instead - of a directory with the `openapi.json` and copied schema - files. - -- 64caebaf: Migrate build system to `tsup` - - All packages now use an `index.ts` file to expose contents. - - You will need to migrate paths from `import foo from '@scope/package/lib/foo` to `import foo from '@scope/package'` - -- 64caebaf: Migrate easy-ast to separate package - - The `easy-ast` part of `core-tools` has been moved to its own package. - For migration, simply use the new package. - -### Minor Changes - -- 64caebaf: Migrate tests to C8/Chai/Mocha - - - `@testdeck` OOP testing has been removed. - - Tests have been unified - - CommonJS module mocking has been replaced through - refactoring of tests, as ES Modules cannot be mocked - (do yourself a favor and don't try to mock them) - - C8 now replaces NYC as a native coverage tool - -- 64caebaf: Migrate away from `@krlwlfrt/async-pool` - - ```ts - import {mapAsyncLimit} from '@openstapps/collection-utils'; - - await mapAsyncLimit( - [1, 2, 3], - async it => { - await someNetworkRequest(it); - }, - 5, - ); - ``` - -### Patch Changes - -- 64caebaf: Migrated changelogs to changeset format - - ```js - import fs from 'fs'; - - const path = 'packages/logger/CHANGELOG.md'; - - fs.writeFileSync(path, fs.readFileSync(path, 'utf8').replace(/^#+\s+\[/gm, '## [')); - ``` - -- 98546a97: Migrate away from @openstapps/configuration -- 23481d0d: Update to TypeScript 5.1.6 -- 98546a97: Migrate from away from lodash -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [98546a97] -- Updated dependencies [23481d0d] -- Updated dependencies [64caebaf] -- Updated dependencies [98546a97] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] - - @openstapps/collection-utils@3.0.0 - - @openstapps/easy-ast@3.0.0 - - @openstapps/logger@3.0.0 - -## 3.0.0-next.4 - -### Patch Changes - -- 23481d0d: Update to TypeScript 5.1.6 -- Updated dependencies [23481d0d] - - @openstapps/collection-utils@3.0.0-next.4 - - @openstapps/easy-ast@3.0.0-next.4 - - @openstapps/logger@3.0.0-next.4 - -## 3.0.0-next.0 - -### Major Changes - -- 98546a97: Removed pack tool - - Use a bundler like `tsup` in conjunction with an - `index.ts` that aggregates all exports instead. - -- 64caebaf: Move project to a turbo monorepo & pnpm - - Internal dependencies are now defined using `"@openstapps/package": "workspace:*"` - - - Removed extraneous files from packages - - `.npmrc` - - `.npmignore` - - `.mailmap` - - `.gitignore` - - `CONTRIBUTING.md` - - `LICENSE` (Project license file is added upon publishing, see [pnpm.io](https://pnpm.io/cli/publish)) - - `package-lock.json` - - `.editorconfig` - - `.eslintrc.json` (moved eslint config to `package.json`) - - `.eslintignore` - - `.gitlab-ci.yml` (Most workflows are workspace-level) - - `.gitlab/**` (issue templates etc. are now workspace-level) - - `.dockerignore` (Docker files are determined by which files are deployed with `pnpm deploy`, as per `package.json/files`) - - TSConfig has been moved to its own package (You can now use `"extends": "@openstapps/tsconfig"`) - - Removed ESLint and Prettier peer dependency hell by injecting them through the `.pnpmfile.cjs` - - Added syncpack for keeping dependency versions in sync (and consistent key ordering in `package.json`) - - Replaced conventional changelog with changesets - - Apps with binaries now use a top level `app.js` - - ```js - #!/usr/bin/env node - import './lib/app.js'; - ``` - -- 64caebaf: Migrate to ESM - - CommonJS is no longer supported in any capacity. To use the new - version, you will need to migrate your package to ESM. - We recommend using `tsup` and `Node 18`. - - ```json - { - "type": "module" - } - ``` - -- 64caebaf: Migrate package to Node 18 - - - Consumers of this package will need to migrate to Node 18 or - higher. - - Packages have been migrated from promisified `readFile` or - `readFileSync` towards `fs/promises` - - Packages use native `flatMap` now - -- 64caebaf: Migrate openapi generation to output single file - - The OpenAPI generator now outputs a single file instead - of a directory with the `openapi.json` and copied schema - files. - -- 64caebaf: Migrate build system to `tsup` - - All packages now use an `index.ts` file to expose contents. - - You will need to migrate paths from `import foo from '@scope/package/lib/foo` to `import foo from '@scope/package'` - -- 64caebaf: Migrate easy-ast to separate package - - The `easy-ast` part of `core-tools` has been moved to its own package. - For migration, simply use the new package. - -### Minor Changes - -- 64caebaf: Migrate tests to C8/Chai/Mocha - - - `@testdeck` OOP testing has been removed. - - Tests have been unified - - CommonJS module mocking has been replaced through - refactoring of tests, as ES Modules cannot be mocked - (do yourself a favor and don't try to mock them) - - C8 now replaces NYC as a native coverage tool - -- 64caebaf: Migrate away from `@krlwlfrt/async-pool` - - ```ts - import {mapAsyncLimit} from '@openstapps/collection-utils'; - - await mapAsyncLimit( - [1, 2, 3], - async it => { - await someNetworkRequest(it); - }, - 5, - ); - ``` - -### Patch Changes - -- 64caebaf: Migrated changelogs to changeset format - - ```js - import fs from 'fs'; - - const path = 'packages/logger/CHANGELOG.md'; - - fs.writeFileSync(path, fs.readFileSync(path, 'utf8').replace(/^#+\s+\[/gm, '## [')); - ``` - -- 98546a97: Migrate away from @openstapps/configuration -- 98546a97: Migrate from away from lodash -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] -- Updated dependencies [98546a97] -- Updated dependencies [64caebaf] -- Updated dependencies [98546a97] -- Updated dependencies [64caebaf] -- Updated dependencies [64caebaf] - - @openstapps/collection-utils@3.0.0-next.0 - - @openstapps/easy-ast@3.0.0-next.0 - - @openstapps/logger@3.0.0-next.0 - -## [0.34.0](https://gitlab.com/openstapps/core-tools/compare/v0.33.0...v0.34.0) (2023-01-30) - -## [0.33.0](https://gitlab.com/openstapps/core-tools/compare/v0.32.0...v0.33.0) (2023-01-12) - -### Bug Fixes - -- convert schema glob path to posix path ([c3d66b3](https://gitlab.com/openstapps/core-tools/commit/c3d66b36c8b4bdf84b3e23cd0ab8318d3fd068f9)) - -## [0.32.0](https://gitlab.com/openstapps/core-tools/compare/v0.31.0...v0.32.0) (2022-08-17) - -### Bug Fixes - -- documentation not beeing generated ([51ae246](https://gitlab.com/openstapps/core-tools/commit/51ae246a0fd10144cf6af348bc7ded88e6dab27a)) - -## [0.31.0](https://gitlab.com/openstapps/core-tools/compare/v0.30.1...v0.31.0) (2022-06-27) - -## [0.30.1](https://gitlab.com/openstapps/core-tools/compare/v0.30.0...v0.30.1) (2022-05-27) - -## [0.30.0](https://gitlab.com/openstapps/core-tools/compare/v0.29.1...v0.30.0) (2022-04-04) - -## [0.29.1](https://gitlab.com/openstapps/core-tools/compare/v0.29.0...v0.29.1) (2022-03-21) - -## [0.29.0](https://gitlab.com/openstapps/core-tools/compare/v0.28.0...v0.29.0) (2022-01-25) - -## [0.28.0](https://gitlab.com/openstapps/core-tools/compare/v0.27.0...v0.28.0) (2021-12-17) - -### Bug Fixes - -- ajv related tranistive build errors ([e82f4e9](https://gitlab.com/openstapps/core-tools/commit/e82f4e92099359baed5ea89f64bd7204700c2785)) - -## [0.27.0](https://gitlab.com/openstapps/core-tools/compare/v0.26.0...v0.27.0) (2021-12-15) - -## [0.26.0](https://gitlab.com/openstapps/core-tools/compare/v0.25.0...v0.26.0) (2021-12-15) - -## [0.25.0](https://gitlab.com/openstapps/core-tools/compare/v0.24.3...v0.25.0) (2021-08-31) - -### Bug Fixes - -- generate schemas for type aliases ([96e3acf](https://gitlab.com/openstapps/core-tools/commit/96e3acf9ba330c3414eb1e38b347ca9e597fee88)) - -## [0.24.3](https://gitlab.com/openstapps/core-tools/compare/v0.24.2...v0.24.3) (2021-08-27) - -### Bug Fixes - -- add cruical Converter ceation option ([f82b465](https://gitlab.com/openstapps/core-tools/commit/f82b4652637808abf68f1e72b1de0c76b228457a)) - -## [0.24.2](https://gitlab.com/openstapps/core-tools/compare/v0.24.1...v0.24.2) (2021-08-25) - -## [0.24.1](https://gitlab.com/openstapps/core-tools/compare/v0.24.0...v0.24.1) (2021-08-25) - -## [0.24.0](https://gitlab.com/openstapps/core-tools/compare/v0.23.2...v0.24.0) (2021-08-25) - -### Features - -- modernize core-tools ([fe59204](https://gitlab.com/openstapps/core-tools/commit/fe59204b4210831b15445fa9aa7dbc20de75e96d)) - -## [0.23.2](https://gitlab.com/openstapps/core-tools/compare/v0.23.0...v0.23.2) (2021-08-02) - -### Bug Fixes - -- rollback ajv version to 6.12.6 ([7a5d2bb](https://gitlab.com/openstapps/core-tools/commit/7a5d2bb1e98b41d1143fbfe21b29e3aef2133c8f)) - -## [0.23.0](https://gitlab.com/openstapps/core-tools/compare/v0.22.0...v0.23.0) (2021-07-21) - -### Features - -- replace route markdown with openapi ([f4bf7ab](https://gitlab.com/openstapps/core-tools/commit/f4bf7abc895f87a57fa34b2269311809f2a9413d)) - -## [0.22.0](https://gitlab.com/openstapps/core-tools/compare/v0.21.0...v0.22.0) (2021-07-07) - -### Bug Fixes - -- fix inherited properties not working correctly ([f20038c](https://gitlab.com/openstapps/core-tools/commit/f20038c8f9a37424fd7a95484e744e0c672f5cfb)) - -## [0.21.0](https://gitlab.com/openstapps/core-tools/compare/v0.20.0...v0.21.0) (2021-05-12) - -### Features - -- add support for non-external premaps ([7429806](https://gitlab.com/openstapps/core-tools/commit/74298065e0386c8e4646e565e5e383b5ae08dfaa)) - -## [0.20.0](https://gitlab.com/openstapps/core-tools/compare/v0.19.0...v0.20.0) (2021-04-26) - -### Features - -- add filterable annotation option for integer ([7ba8233](https://gitlab.com/openstapps/core-tools/commit/7ba8233f5b81f4ab3c3aeec2c8a47a7bad3ae502)) - -## [0.19.0](https://gitlab.com/openstapps/core-tools/compare/v0.18.0...v0.19.0) (2021-04-06) - -## [0.18.0](https://gitlab.com/openstapps/core-tools/compare/v0.17.0...v0.18.0) (2021-03-24) - -### Features - -- make Point type sortable in Elasticsearch ([724a686](https://gitlab.com/openstapps/core-tools/commit/724a6866c80a544dec4ce11d70d648bd724f9aba)) - -## [0.17.0](https://gitlab.com/openstapps/core-tools/compare/v0.16.0...v0.17.0) (2020-12-02) - -### Features - -- add support for [@inherit](https://gitlab.com/inherit)Tags ([485430b](https://gitlab.com/openstapps/core-tools/commit/485430b7f27fb9c751a6f5697e74eb5531ac7889)) -- add support for date mapping ([a09be1d](https://gitlab.com/openstapps/core-tools/commit/a09be1d941df88826ccaa8aa468680ece29d35a5)) - -## [0.16.0](https://gitlab.com/openstapps/core-tools/compare/v0.15.0...v0.16.0) (2020-10-28) - -### Bug Fixes - -- use value type in IndexSignature type instead of key type ([b7cdb6a](https://gitlab.com/openstapps/core-tools/commit/b7cdb6a9ad2bdb1fc09d0f535daf4ec778501fec)) - -## [0.15.0](https://gitlab.com/openstapps/core-tools/compare/v0.14.0...v0.15.0) (2020-10-05) - -### Bug Fixes - -- array tags did not propagate ([e5511d0](https://gitlab.com/openstapps/core-tools/commit/e5511d07386e93b032b5dbefa3e6cc46c07219ed)) - -## [0.14.0](https://gitlab.com/openstapps/core-tools/compare/v0.13.0...v0.14.0) (2020-02-11) - -## [0.13.0](https://gitlab.com/openstapps/core-tools/compare/v0.12.0...v0.13.0) (2020-01-28) - -## [0.12.0](https://gitlab.com/openstapps/core-tools/compare/v0.11.0...v0.12.0) (2019-12-03) - -### Bug Fixes - -- make fields with index signatures a dynamic mapping ([8f5570e](https://gitlab.com/openstapps/core-tools/commit/8f5570e2e2d350d6153b34f940f4cd5c407b5bc9)) - -## [0.11.0](https://gitlab.com/openstapps/core-tools/compare/v0.10.0...v0.11.0) (2019-11-12) - -### Bug Fixes - -- use .raw field for aggregations ([4c1a374](https://gitlab.com/openstapps/core-tools/commit/4c1a374a9ee266884bd33e8a3b3f52fcef8f4019)) - -## [0.10.0](https://gitlab.com/openstapps/core-tools/compare/v0.9.0...v0.10.0) (2019-11-08) - -### Bug Fixes - -- make mapping of generics work correctly ([8f7201e](https://gitlab.com/openstapps/core-tools/commit/8f7201e2cf010ed9ef457d9cf938167a4e970963)), closes [#27](https://gitlab.com/openstapps/core-tools/issues/27) -- make mapping tags work for overwritten values ([47361d4](https://gitlab.com/openstapps/core-tools/commit/47361d412a92ae34dc1b81298402d6b441b4f4ba)) - -### Features - -- generate aggreations from annotations in the core ([18ad651](https://gitlab.com/openstapps/core-tools/commit/18ad651286bafcbc929e14ee9429c7b852d86f3b)) - -## [0.9.0](https://gitlab.com/openstapps/core-tools/compare/v0.8.0...v0.9.0) (2019-09-10) - -### Bug Fixes - -- read type tags correctly after the first time ([77e4914](https://gitlab.com/openstapps/core-tools/commit/77e49146c0619566919815bd5d63ddf34dc19387)) - -### Features - -- add support for [@filterable](https://gitlab.com/filterable) tag ([36bf17e](https://gitlab.com/openstapps/core-tools/commit/36bf17e3236a555e6d1193466141be880b280db9)) - -## [0.8.0](https://gitlab.com/openstapps/core-tools/compare/v0.7.0...v0.8.0) (2019-07-25) - -### Bug Fixes - -- apply stricter tslint rules ([967f946](https://gitlab.com/openstapps/core-tools/commit/967f94652723d8589b7f272454185449233ac838)) -- emend the imports in the test files ([53e8047](https://gitlab.com/openstapps/core-tools/commit/53e80476c85027194cf406ad87fe8950d6c2f3a8)) -- remove duplicate job ([af904a7](https://gitlab.com/openstapps/core-tools/commit/af904a7a05de56cdef6aea136a7e3bb237c4beb2)) -- update the uml job to use our node image ([a478715](https://gitlab.com/openstapps/core-tools/commit/a478715d8045dd26cd345ba3cbb469fda651b84f)) - -### Features - -- add automatic mapping generation ([7b198f9](https://gitlab.com/openstapps/core-tools/commit/7b198f95ce7bbd75454247e70757d34af462cefc)), closes [#6](https://gitlab.com/openstapps/core-tools/issues/6) -- add the uml generator ([0f21da4](https://gitlab.com/openstapps/core-tools/commit/0f21da4a92b4e0ef11a5f274468d3679fc9784ee)) -- added output file name for uml generation ([843e598](https://gitlab.com/openstapps/core-tools/commit/843e59811a5a104df1c746627aa668d26fdc9f60)) - -## [0.7.0](https://gitlab.com/openstapps/core-tools/compare/v0.6.0...v0.7.0) (2019-06-24) - -## [0.6.0](https://gitlab.com/openstapps/core-tools/compare/v0.5.1...v0.6.0) (2019-04-16) - -## [0.5.1](https://gitlab.com/openstapps/core-tools/compare/v0.5.0...v0.5.1) (2019-04-09) - -## [0.5.0](https://gitlab.com/openstapps/core-tools/compare/v0.4.0...v0.5.0) (2019-04-09) - -## [0.4.0](https://gitlab.com/openstapps/core-tools/compare/v0.3.0...v0.4.0) (2019-04-03) - -### Features - -- add feature to validate schemas directly ([1022150](https://gitlab.com/openstapps/core-tools/commit/1022150ca3d2af846b819e0e0e46ead71134d5f8)) -- adjust generation of route documentation ([d3ce936](https://gitlab.com/openstapps/core-tools/commit/d3ce936626751f24f20081403271d77e2c346e03)), closes [#12](https://gitlab.com/openstapps/core-tools/issues/12) - -## [0.3.0](https://gitlab.com/openstapps/core-tools/compare/v0.2.1...v0.3.0) (2019-02-06) - -### Features - -- ensure correct path for input files ([1c74432](https://gitlab.com/openstapps/core-tools/commit/1c744328eb03dc8019fe6dc3a309f68260210146)) - -## [0.2.1](https://gitlab.com/openstapps/core-tools/compare/v0.2.0...v0.2.1) (2019-01-30) - -### Bug Fixes - -- add SC prefix to the camel cased type of the instance ([e559234](https://gitlab.com/openstapps/core-tools/commit/e559234cea9ef245733f8117ab4a27e83db54e14)) -- use tsconfig.json of project for schema generation ([6b1a420](https://gitlab.com/openstapps/core-tools/commit/6b1a4202f92759c9ef36d32d0960faf4f56cc8db)), closes [#10](https://gitlab.com/openstapps/core-tools/issues/10) - -### Features - -- add function to find tsconfig.json ([aa645a2](https://gitlab.com/openstapps/core-tools/commit/aa645a2cc4661c58c6050196ee1944dfd9e5eea8)) - -## [0.2.0](https://gitlab.com/openstapps/core-tools/compare/v0.1.1...v0.2.0) (2019-01-21) - -### Features - -- add pack script ([7438465](https://gitlab.com/openstapps/core-tools/commit/7438465149b591ebf1583a8bd6b9da56aa9c9f57)), closes [#4](https://gitlab.com/openstapps/core-tools/issues/4) - -## [0.1.1](https://gitlab.com/openstapps/core-tools/compare/v0.1.0...v0.1.1) (2019-01-14) - -### Bug Fixes - -- add missing dependency typedoc ([b248d1b](https://gitlab.com/openstapps/core-tools/commit/b248d1b5e0306247ce35e5c9d45637b0f3f83cac)), closes [#5](https://gitlab.com/openstapps/core-tools/issues/5) - -## [0.1.0](https://gitlab.com/openstapps/core-tools/compare/v0.0.3...v0.1.0) (2019-01-08) - -### Features - -- validate generated schemas ([7b7299d](https://gitlab.com/openstapps/core-tools/commit/7b7299d9c475105f9d2387c9dc31974139997483)), closes [#1](https://gitlab.com/openstapps/core-tools/issues/1) - -## [0.0.3](https://gitlab.com/openstapps/core-tools/compare/v0.0.2...v0.0.3) (2018-12-18) - -### Bug Fixes - -- do not ignore resources ([6502bcf](https://gitlab.com/openstapps/core-tools/commit/6502bcf2b517ab98909626a7b8baa08e7cdcdc3e)) - -## [0.0.2](https://gitlab.com/openstapps/core-tools/compare/v0.0.1...v0.0.2) (2018-12-18) - -## [0.0.1](https://gitlab.com/openstapps/core-tools/compare/1ac90ef6330bcfd0ea362505a11db66453f3386f...v0.0.1) (2018-12-18) - -### Features - -- add core tools ([1ac90ef](https://gitlab.com/openstapps/core-tools/commit/1ac90ef6330bcfd0ea362505a11db66453f3386f)) diff --git a/packages/core-tools/Dockerfile b/packages/core-tools/Dockerfile deleted file mode 100644 index 2c031ae9..00000000 --- a/packages/core-tools/Dockerfile +++ /dev/null @@ -1 +0,0 @@ -FROM plantuml/plantuml-server:tomcat \ No newline at end of file diff --git a/packages/core-tools/LICENSE b/packages/core-tools/LICENSE deleted file mode 100644 index 9df63ccc..00000000 --- a/packages/core-tools/LICENSE +++ /dev/null @@ -1,200 +0,0 @@ -GNU GENERAL PUBLIC LICENSE -Version 3, 29 June 2007 - -Copyright © 2007 Free Software Foundation, Inc. - -Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - -Preamble - -The GNU General Public License is a free, copyleft license for software and other kinds of works. - -The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. - -When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. - -To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. - -For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. - -Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. - -For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. - -Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. - -Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. - -The precise terms and conditions for copying, distribution and modification follow. - -TERMS AND CONDITIONS - -0. Definitions. -"This License" refers to version 3 of the GNU General Public License. - -"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. - -"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. - -To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. - -A "covered work" means either the unmodified Program or a work based on the Program. - -To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. - -To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. - -An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. - -1. Source Code. -The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. -A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. - -The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. - -The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. - -The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. - -The Corresponding Source for a work in source code form is that same work. - -2. Basic Permissions. -All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. -You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. - -Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. - -3. Protecting Users' Legal Rights From Anti-Circumvention Law. -No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. -When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. - -4. Conveying Verbatim Copies. -You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. -You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. - -5. Conveying Modified Source Versions. -You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: -a) The work must carry prominent notices stating that you modified it, and giving a relevant date. -b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". -c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. -d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. -A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. - -6. Conveying Non-Source Forms. -You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: -a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. -b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. -c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. -d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. -e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. -A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. - -A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. - -"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. - -If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). - -The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. - -Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. - -7. Additional Terms. -"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. -When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. - -Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: - -a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or -b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or -c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or -d) Limiting the use for publicity purposes of names of licensors or authors of the material; or -e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or -f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. -All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. - -If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. - -Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. - -8. Termination. -You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). -However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. - -Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. - -Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. - -9. Acceptance Not Required for Having Copies. -You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. -10. Automatic Licensing of Downstream Recipients. -Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. -An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. - -You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. - -11. Patents. -A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". -A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. - -Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. - -In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. - -If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. - -If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. - -A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. - -Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. - -12. No Surrender of Others' Freedom. -If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. -13. Use with the GNU Affero General Public License. -Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. -14. Revised Versions of this License. -The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. -Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. - -If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. - -Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. - -15. Disclaimer of Warranty. -THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. -16. Limitation of Liability. -IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -17. Interpretation of Sections 15 and 16. -If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. - -END OF TERMS AND CONDITIONS - -How to Apply These Terms to Your New Programs - -If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. - -To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - - -Copyright (C) - -This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - -If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: - - Copyright (C) -This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. -This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". - -You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see . - -The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . diff --git a/packages/core-tools/README.md b/packages/core-tools/README.md deleted file mode 100644 index 7c7a456b..00000000 --- a/packages/core-tools/README.md +++ /dev/null @@ -1,199 +0,0 @@ -# @openstapps/core-tools - -[![pipeline status](https://img.shields.io/gitlab/pipeline/openstapps/core-tools.svg?style=flat-square)](https://gitlab.com/openstapps/core-tools/commits/master) -[![npm](https://img.shields.io/npm/v/@openstapps/core-tools.svg?style=flat-square)](https://npmjs.com/package/@openstapps/core-tools) -[![license)](https://img.shields.io/npm/l/@openstapps/core-tools.svg?style=flat-square)](https://www.gnu.org/licenses/gpl-3.0.en.html) -[![documentation](https://img.shields.io/badge/documentation-online-blue.svg?style=flat-square)](https://openstapps.gitlab.io/core-tools) - -Tools to convert and validate StAppsCore - -## What are the tools for? - -The StAppsCore Converter is a tool for converting SC-types (TypeScript) into JSON schema files. - -JSON schema files are needed for run-time validation of SC-type objects, as this is a tedious task to do using SC-types defined in TypeScript (not possible without additional coding). That said, StAppsCore Converter practically prepares SC-types to be used for object validation (determining whether a JavaScript/JSON object is a valid object of the corresponding SC-type) using StAppsCore Validator. - -The StAppsCore Validator is a tool for run-time validation of objects (determining whether a JavaScript/JSON object is a valid object of the corresponding SC-type. It consumes JSON schema files from StAppsCore as the definitions of SC-types against which are validated concrete (actual) objects (as an example SCDish object in the example below). - -## Installation - -Installation of the npm package (using `npm install`) makes the tool available as an executable with the name `openstapps-core-tools`. - -## How to use the converter? - -Add `@validatable` to the Typedoc comment of the types that you want to convert to JSONSchema. - -The command `openstapps-core-tools` can then be called using these arguments: - -```shell -openstapps-core-tools schema -``` - -where: - -- `` is path to the project (where used `*.ts` files are, e.g. `src/core`, -- `` is directory to save output files to, e.g. `lib/schema`. - -Complete command with the example arguments is then: - -```shell -openstapps-core-tools schema src/core lib/schema -``` - -Inside of a script in `package.json` or if the npm package is installed globally, the tool `stapps-convert` can be called without its local path (`node_modules/.bin`): - -```shell -openstapps-core-tools schema src/core lib/schema -``` - -## How to use the validator? - -### Using the validator programatically - -```typescript -import {Validator} from '@openstapps/core-tools/lib/validate'; -import {SCDish, SCThingType} from '@openstapps/core'; -import {ValidatorResult} from 'jsonschema'; -import {join} from 'path'; - -const objectToValidate: SCDish = { - type: SCThingType.Dish, - // more properties -}; - -// instantiate a new validator -const validator = new Validator(); - -// make the validator read the schema files -validator.addSchemas(join('node_modules', '@openstapps', 'core', 'lib', 'schema')).then(() => { - // validate an object - const result: ValidatorResult = validator.validate(objectToValidate, 'SCDish'); -}); -``` - -#### Using validateFiles function - -The JSON files passed to the validateFiles method have an added layer. -That layer encapsulates the actual JSON data of the object to be verified and adds a property to enable true negative testing. - -Your basic JSON object: - -```json -{ - "property1": "value1", - "property2": "value2", - ... -} -``` - -JSON for validateFiles: - -```json -{ - "errorNames": [], - "instance": { - "property1": "value1", - "property2": "value2", - ... - }, - "schema": "NameOfSchema" -} -``` - -Where `errorNames` holds the string values of the name property of the expected ValidationErrors from JSON Schema. Empty array means no errors are expected. - -`schema` holds the name of the schema to validate the instance against. - -### How to use validator as a CLI tool (executable)? - -The command `openstapps-core-tools` can then be called using these arguments: - -```shell -openstapps-core-tools validate [reportPath] -``` - -where: - -- `` is a directory where JSON schema files are, e.g. `lib/schema`, -- `` is a directory where test files are, e.g. `src/test/resources`, -- `[reportPath]` is a file where the HTML report of the validation will be saved to, e.g. `report.html` (optional argument - if it's not provided no report will be written). - -Command with the example arguments is then for example: - -```shell -openstapps-core-tools validate lib/schema src/test/resources -``` - -Inside of a script in `package.json` or if the npm package is installed globally, the tool `openstapps-validate` can be called without its local path (`node_modules/.bin`): - -```shell -openstapps-core-tools validate lib/schema src/test/resources report.html -``` - -## Generate openapi JSON file for routes - -To generate a openapi JSON file that represents the routes according to openapi version 3.0.3 use the following command. - -```shell -openstapps-core-tools openapi PATH/TO/CORE/lib PATH/TO/PUT/FILES/TO -``` - -## How to use the UML generator - -The UML Generator generates PlantUML from the project reflection of the source files. By default it will include externals, which will take considerably longer to execute, you can disable this behaviour via an option. It can help you to visually explore the data model or document a specific part. - -You can either use the public PlantUML-server or start your own local instance. To run, restart or stop the container use the scripts provided in the `package.json`. - -### Generating from source-files - -```shell -openstapps-core-tools plantuml PATH/TO/SOURCEFILES http://PLANTUMLSERVER -``` - -Executing this command will generate a `.svg` file in your current working directory. - -Multiple options can be set to enhance the diagram. By default all additional information other than the definitions are disabled. You can use: - -- `--showProperties` to show all mandatory attributes of the classes and interfaces. -- `--showOptionalProperties` to show all mandatory attributes of the classes and interfaces. `--showProperties` must be set! -- `--showInheritedProperties` to show all inherited attributes of the classes and interfaces. `--showProperties` must be set! -- `--showEnumValues` to show all enumeration and type (enumeration-like) values -- `--showInheritance` to show the hierarchy of the classes and interfaces. Inherited attributes will only be shown in their parent. -- `--showAssociations` to show all references of classes and interfaces between one another -- `--excludeExternals` to exclude external definitions -- `--definitions ` to show only specific definitions to reduce the output of the diagram. `` is a comma seperated list of definitions. -- `--outputFileName ` for a custom file name, the file extension will be added automatically (.svg). Otherwise a generic file with a timestamp will be generated into the execution directory. If a file with the same name already exists it will be overwritten! - -The best way to explore models is to enable `--showInheritance` and `--showAssociations`. Start with just one definition in your `--definition `-list, generate the diagram, look at it, add a new definition that you have seen to your command and generate anew. - -#### Examples - -Show the class hierarchy of the whole project: - -```shell -openstapps-core-tools plantuml PATH/TO/SRCDIR http://PLANTUMLSERVER --showInheritance -``` - -Show the dish-module: - -```shell -openstapps-core-tools plantuml ../core http://localhost:8080 --showProperties --showOptionalProperties --showInheritance --showAssociations --showEnumValues --definitions SCDish,SCThingThatCanBeOfferedOffer -``` - -### Generating from existing file - -The plantuml code is persisted inside the generated file at the very bottom. You can tweak the model by using the function to generate UML from a PlantUML-file(simple text file). Extract the code (starting from `@startuml` to `@enduml`), edit it manually and execute this function. - -```shell -openstapps-core-tools plantuml-file /PATH/TO/Project.plantuml http://PLANTUMLSERVER OptionalCustomFileName -``` - -Example-File-Content of Project.plantuml - -``` -@startuml -interface MyClass{ - myProperty: string -} -@enduml -``` diff --git a/packages/core-tools/app.js b/packages/core-tools/app.js deleted file mode 100755 index 5ca3fea3..00000000 --- a/packages/core-tools/app.js +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env node -import './lib/app.js'; diff --git a/packages/core-tools/package.json b/packages/core-tools/package.json deleted file mode 100644 index 28fd02b9..00000000 --- a/packages/core-tools/package.json +++ /dev/null @@ -1,109 +0,0 @@ -{ - "name": "@openstapps/core-tools", - "description": "Tools to convert and validate StAppsCore", - "version": "3.0.0", - "type": "module", - "license": "GPL-3.0-only", - "repository": "git@gitlab.com:openstapps/core-tools.git", - "author": "Karl-Philipp Wulfert ", - "contributors": [ - "Anselm Stordeur ", - "Jovan Krunić ", - "Michel Jonathan Schmitz", - "Rainer Killinger ", - "Thea Schöbl " - ], - "keywords": [ - "StApps", - "StAppsCore", - "converter", - "core", - "validator" - ], - "main": "./lib/index.js", - "types": "./lib/index.d.ts", - "bin": { - "openstapps-core-tools": "app.js" - }, - "files": [ - "app.js", - "lib", - "Dockerfile", - "README.md", - "CHANGELOG.md" - ], - "scripts": { - "build": "tsup-node --dts", - "docs": "typedoc --json ./docs/docs.json --options ../../typedoc.base.json src/index.ts", - "format": "prettier . -c --ignore-path ../../.gitignore", - "format:fix": "prettier --write . --ignore-path ../../.gitignore", - "lint": "eslint --ext .ts src/", - "lint:fix": "eslint --fix --ext .ts src/", - "plantuml-restart": "docker restart plantuml-server", - "plantuml-start": "docker run --name plantuml-server -d -p 8080:8080 registry.gitlab.com/openstapps/core-tools:latest", - "plantuml-stop": "docker stop plantuml-server", - "test": "c8 mocha" - }, - "dependencies": { - "@openstapps/collection-utils": "workspace:*", - "@openstapps/easy-ast": "workspace:*", - "@openstapps/logger": "workspace:*", - "ajv": "8.12.0", - "ajv-formats": "2.1.1", - "better-ajv-errors": "1.2.0", - "commander": "10.0.0", - "deepmerge": "4.3.1", - "del": "6.1.1", - "flatted": "3.2.7", - "fs-extra": "10.1.0", - "glob": "10.2.7", - "got": "12.6.0", - "humanize-string": "3.0.0", - "json-schema": "0.4.0", - "mustache": "4.2.0", - "openapi-types": "12.1.3", - "plantuml-encoder": "1.4.0", - "toposort": "2.0.2", - "ts-json-schema-generator": "1.4.0" - }, - "devDependencies": { - "@openstapps/eslint-config": "workspace:*", - "@openstapps/prettier-config": "workspace:*", - "@openstapps/tsconfig": "workspace:*", - "@types/chai": "4.3.5", - "@types/fs-extra": "9.0.13", - "@types/glob": "8.0.1", - "@types/json-schema": "7.0.14", - "@types/mocha": "10.0.1", - "@types/mustache": "4.2.2", - "@types/node": "18.15.3", - "c8": "7.14.0", - "chai": "4.3.7", - "mocha": "10.2.0", - "mocha-junit-reporter": "2.2.0", - "nock": "13.3.1", - "ts-node": "10.9.1", - "tsup": "6.7.0", - "typedoc": "0.24.8", - "typescript": "5.1.6" - }, - "tsup": { - "entry": [ - "src/app.ts", - "src/index.ts" - ], - "sourcemap": true, - "clean": true, - "format": "esm", - "outDir": "lib" - }, - "prettier": "@openstapps/prettier-config", - "eslintConfig": { - "extends": [ - "@openstapps" - ] - }, - "eslintIgnore": [ - "resources" - ] -} diff --git a/packages/core-tools/resources/error.html.mustache b/packages/core-tools/resources/error.html.mustache deleted file mode 100644 index 477f6505..00000000 --- a/packages/core-tools/resources/error.html.mustache +++ /dev/null @@ -1,12 +0,0 @@ - -

{{idx}}

- -
{{name}}
-

{{message}}

-

{{suggestion}}

- - -

{{schemaPath}}

-
{{instance}}
- - diff --git a/packages/core-tools/resources/file.html.mustache b/packages/core-tools/resources/file.html.mustache deleted file mode 100644 index 92b48f5b..00000000 --- a/packages/core-tools/resources/file.html.mustache +++ /dev/null @@ -1,17 +0,0 @@ -
-

Errors in {{testFile}}

- - - - - - - - - - - {{&errors}} - - -
#ErrorInstance
-
diff --git a/packages/core-tools/resources/report.html.mustache b/packages/core-tools/resources/report.html.mustache deleted file mode 100644 index 6ff18db3..00000000 --- a/packages/core-tools/resources/report.html.mustache +++ /dev/null @@ -1,24 +0,0 @@ - - - - Report - - - - - -

Validation result

- -

Timestamp: {{timestamp}}

- - {{&report}} - - - - - - diff --git a/packages/core-tools/src/app.ts b/packages/core-tools/src/app.ts deleted file mode 100644 index 333ca158..00000000 --- a/packages/core-tools/src/app.ts +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright (C) 2018-2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {Logger} from '@openstapps/logger'; -import {Command} from 'commander'; -import {existsSync, readFileSync, writeFileSync} from 'fs'; -import path from 'path'; -import {lightweightDefinitionsFromPath, lightweightProjectFromPath} from '@openstapps/easy-ast'; -import {openapi3Template} from '../../openapi-generator/src/openapi-303-template.js'; -import { - gatherRouteInformation, - generateOpenAPIForRoute, -} from '../../openapi-generator/src/generator/routes.js'; -import {Converter, getValidatableTypesInPath, mergeSchemas} from './schema.js'; -import {createDiagram, createDiagramFromString} from './uml/create-diagram.js'; -import {UMLConfig} from './uml/uml-config.js'; -import {capitalize} from './util/string.js'; -import {fileURLToPath} from 'url'; -import {readFile} from 'fs/promises'; - -// handle unhandled promise rejections -process.on('unhandledRejection', async (reason: unknown) => { - if (reason instanceof Error) { - await Logger.error(reason.message); - Logger.info(reason.stack); - } - process.exit(1); -}); - -const commander = new Command('openstapps-core-tools'); - -// eslint-disable-next-line unicorn/prefer-module -commander.version( - JSON.parse( - readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), '..', 'package.json')).toString(), - ).version, -); - -commander.command('prototype ').action(async (sourcePath, out) => { - const files = lightweightProjectFromPath(sourcePath); - writeFileSync(path.resolve(out), JSON.stringify(files, undefined, 2)); -}); - -commander - .command('openapi ') - .action(async (relativeSourceBundlePath, relativeOutDirectoryPath) => {}); - -commander.command('schema ').action(async (relativeSourcePath, schemaPath) => { - const absoluteSourcePath = path.resolve(relativeSourcePath); - - // initialize new core converter - const coreConverter = new Converter(absoluteSourcePath); - - // get validatable types - const validatableTypes = getValidatableTypesInPath(absoluteSourcePath); - - Logger.info(`Found ${validatableTypes.length} type(s) to generate schemas for.`); - - Logger.info(`Trying to find a package.json for ${absoluteSourcePath}.`); - - let packagePath = absoluteSourcePath; - // TODO: this check should be less ugly! --- What is this doing anyway? - while (!existsSync(path.join(packagePath, 'package.json')) && packagePath.length > 5) { - packagePath = path.resolve(packagePath, '..'); - } - - const corePackageJsonPath = path.join(packagePath, 'package.json'); - - Logger.info(`Using ${corePackageJsonPath} to determine version for schemas.`); - - const buffer = await readFile(corePackageJsonPath); - const corePackageJson = JSON.parse(buffer.toString()); - const coreVersion = corePackageJson.version; - - Logger.log(`Using ${coreVersion} as version for schemas.`); - - // generate and write JSONSchema files for validatable types - const schema = mergeSchemas(validatableTypes.map(type => coreConverter.getSchema(type, coreVersion))); - writeFileSync(schemaPath, JSON.stringify(schema, undefined, 2)); - - Logger.ok(`Generated schemas for ${validatableTypes.length} type(s).`); -}); - -commander - .command('plantuml ') - .option('--definitions ', 'Shows these specific definitions (class, interface or enum)', it => - it.split(','), - ) - .option('--showAssociations', 'Shows associations of definitions') - .option('--showInheritance', 'Shows extensions and implementations of definitions') - .option('--showEnumValues', 'Show enum values') - .option('--showProperties', 'Show attributes') - .option('--showInheritedProperties', 'Shows inherited attributes, needs --showProperties') - .option('--showOptionalProperties', 'Shows optional attributes and relations, needs --showProperties') - .option('--excludeExternals', 'Exclude external definitions') - .option('--outputFileName ', 'Defines the filename of the output') - .action(async (relativeSourcePath, plantumlServer, options) => { - const plantUmlConfig: UMLConfig = { - definitions: options.definitions === undefined ? [] : options.definitions, - showAssociations: options.showAssociations === undefined ? false : options.showAssociations, - showEnumValues: options.showEnumValues === undefined ? false : options.showEnumValues, - showInheritance: options.showInheritance === undefined ? false : options.showInheritance, - showInheritedProperties: - options.showInheritedProperties === undefined ? false : options.showInheritedProperties, - showOptionalProperties: - options.showOptionalProperties === undefined ? false : options.showOptionalProperties, - showProperties: options.showProperties === undefined ? false : options.showProperties, - }; - if (options.outputFileName !== undefined) { - plantUmlConfig.outputFileName = options.outputFileName; - } - - Logger.log(`PlantUML options: ${JSON.stringify(plantUmlConfig)}`); - - await createDiagram(lightweightDefinitionsFromPath(relativeSourcePath), plantUmlConfig, plantumlServer); - }); - -commander - .command('plantuml-file [outputFile]') - .action(async (file: string, plantumlServer: string, outputFile: string) => { - const fileContent = readFileSync(path.resolve(file)).toString(); - await createDiagramFromString(fileContent, plantumlServer, outputFile); - }); - -commander.parse(process.argv); diff --git a/packages/core-tools/src/common.ts b/packages/core-tools/src/common.ts deleted file mode 100644 index 2df5f609..00000000 --- a/packages/core-tools/src/common.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2018-2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {Logger} from '@openstapps/logger'; -import path from 'path'; -import {existsSync} from 'fs'; - -/** - * Get path that contains a tsconfig.json - * @param startPath Path from where to start searching "upwards" - */ -export function getTsconfigPath(startPath: string): string { - let tsconfigPath = startPath; - - while (!existsSync(path.join(tsconfigPath, 'tsconfig.json'))) { - const parent = path.resolve(tsconfigPath, '..'); - if (tsconfigPath === parent) { - throw new Error( - `Reached file system root ${parent} while searching for 'tsconfig.json' in ${startPath}!`, - ); - } - - tsconfigPath = parent; - } - - Logger.info(`Using 'tsconfig.json' from ${tsconfigPath}.`); - - return tsconfigPath; -} diff --git a/packages/core-tools/src/index.ts b/packages/core-tools/src/index.ts deleted file mode 100644 index 1a47567b..00000000 --- a/packages/core-tools/src/index.ts +++ /dev/null @@ -1,10 +0,0 @@ -export * from './types/validator.js'; - -export * from './uml/uml-config.js'; -export * from './uml/create-diagram.js'; - -export * from '../../openapi-generator/src/generator/routes.js'; -export * from '../../openapi-generator/src/generator/types/routes.js'; - -export * from './schema.js'; -export * from './types/schema.js'; diff --git a/packages/core-tools/src/resources/foo.ts b/packages/core-tools/src/resources/foo.ts deleted file mode 100644 index 36c2484c..00000000 --- a/packages/core-tools/src/resources/foo.ts +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -/** - * This is a simple interface declaration for - * testing the schema generation and validation. - * - * @validatable - */ -export interface Foo { - /** - * Dummy parameter - */ - lorem: 'lorem' | 'ipsum'; - - /** - * String literal type property - */ - type: FooType; -} - -/** - * This is a simple type declaration for - * usage in the Foo interface. - */ -export type FooType = 'Foo'; diff --git a/packages/core-tools/src/schema.ts b/packages/core-tools/src/schema.ts deleted file mode 100644 index 00927364..00000000 --- a/packages/core-tools/src/schema.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (C) 2018, 2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import Ajv, {JSONSchemaType} from 'ajv'; -import { - Config, - DEFAULT_CONFIG, - SchemaGenerator, - createParser, - createFormatter, - createProgram, -} from 'ts-json-schema-generator'; -import {getTsconfigPath} from './common.js'; -import {definitionsOf, lightweightProjectFromPath} from '@openstapps/easy-ast'; -import path from 'path'; - -/** - * StAppsCore converter - * - * Converts TypeScript source files to JSON schema files - */ -export class Converter { - private readonly generator: SchemaGenerator; - - private readonly schemaValidator: Ajv.default; - - /** - * @param projectPath Path to the project - * @param sourcePath Path to optionally point to a different directory of / or single source file - */ - constructor(projectPath: string, sourcePath?: string) { - const config: Config = { - ...DEFAULT_CONFIG, - path: sourcePath, - tsconfig: path.join(getTsconfigPath(projectPath), 'tsconfig.json'), - }; - - const program = createProgram(config); - this.generator = new SchemaGenerator(program, createParser(program, config), createFormatter(config)); - this.schemaValidator = new Ajv.default(); - } - - /** - * Get schema for specific StAppsCore type - * @param type Type to get the schema for - * @param _version Version to set for the schema - * @returns Generated schema - */ - getSchema(type: string, _version: string): JSONSchemaType { - const schema = this.generator.createSchema(type) as JSONSchemaType; - this.schemaValidator.validateSchema(schema, true); - return schema; - } -} - -/** - * Get a list of validatable types from an API extractor file - */ -export function getValidatableTypesInPath(path: string): string[] { - return Object.values(definitionsOf(lightweightProjectFromPath(path))) - .filter(type => !!type.comment?.tags?.find(it => it.name === 'validatable')) - .map(type => type.name); -} - -/** - * Merge multiple schemas - */ -export function mergeSchemas(schemas: JSONSchemaType[]): JSONSchemaType { - const completeSchema = {definitions: {}} as JSONSchemaType; - for (const schema of schemas) { - Object.assign(completeSchema.definitions!, schema.definitions); - } - return completeSchema; -} diff --git a/packages/core-tools/src/types/schema.ts b/packages/core-tools/src/types/schema.ts deleted file mode 100644 index d9099fe2..00000000 --- a/packages/core-tools/src/types/schema.ts +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2018-2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {JSONSchema7 as JSONSchema} from 'json-schema'; -import {Definition} from 'ts-json-schema-generator'; - -/** - * A schema with definitions - */ -export interface SchemaWithDefinitions extends JSONSchema { - /** - * Definitions of the schema - */ - definitions?: {[name: string]: Definition}; -} diff --git a/packages/core-tools/src/types/validator.ts b/packages/core-tools/src/types/validator.ts deleted file mode 100644 index 499c5c0e..00000000 --- a/packages/core-tools/src/types/validator.ts +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2018-2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -/** - * The validation result - */ -export interface ValidationResult { - /** - * A list of errors that occurred - */ - errors: ValidationError[]; - - /** - * whether the validation was successful - */ - valid: boolean; -} - -/** - * An error that occurred while validating - * - * This is a duplicate of the ValidationError in core/protocol/errors/validation because of incompatibilities - * between TypeDoc and TypeScript - */ -export interface ValidationError { - /** - * JSON schema path - */ - dataPath: string; - - /** - * The instance - */ - instance: unknown; - - /** - * The message - * - * Provided by https://www.npmjs.com/package/better-ajv-errors - */ - message: string; - - /** - * Name of the error - */ - name: string; - - /** - * Path within the Schema - */ - schemaPath: string; - - /** - * Suggestion to fix the occurring error - * - * Provided by https://www.npmjs.com/package/better-ajv-errors - */ - suggestion?: string; -} - -/** - * An expected error - */ -export interface ExpectedValidationError extends ValidationError { - /** - * Whether or not the error is expected - */ - expected: boolean; -} - -/** - * A map of files and their expected validation errors - */ -export interface ExpectedValidationErrors { - [fileName: string]: ExpectedValidationError[]; -} diff --git a/packages/core-tools/src/uml/create-diagram.ts b/packages/core-tools/src/uml/create-diagram.ts deleted file mode 100644 index c1fa949a..00000000 --- a/packages/core-tools/src/uml/create-diagram.ts +++ /dev/null @@ -1,257 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {Logger} from '@openstapps/logger'; -import * as request from 'got'; -import { - expandTypeValue, - isLightweightClass, - LightweightAliasDefinition, - LightweightClassDefinition, - LightweightDefinition, - LightweightProperty, - LightweightType, -} from '@openstapps/easy-ast'; -import {UMLConfig} from './uml-config.js'; -import {writeFile} from 'fs/promises'; - -/** - * Converts the lightweight class/enum definitions according to the configuration, - * to valid PlantUML Code, which will then be encoded, converted by the plantuml server - * and saved as a .svg file in directory, in which this method was called - * @param definitions all type definitions of the project - * @param config contains information on how the PlantUML should be generated - * @param plantUmlBaseURL Hostname of the PlantUML-Server - */ -export async function createDiagram( - definitions: LightweightDefinition[], - config: UMLConfig, - plantUmlBaseURL: string, -): Promise { - // when non definitions were specified use all - config.definitions = definitions.map(it => it.name); - - // when providing definitions and either showing associations or inheritance the - // inherited definitions will be added automatically - if (config.showInheritance) { - // TODO: showInheritance - /*const inheritedDefinitions = gatherTypeAssociations( - definitions, - config.definitions, - );*/ - // config.definitions = config.definitions.concat(inheritedDefinitions); - } - - // creates a UML definition for every specified definition name - // however if no definitions were provided all definitions will be transformed - const modelPlantUMLCode = definitions - .filter(it => !config.definitions.includes(it.name)) - .map(definition => - isLightweightClass(definition) - ? createPlantUMLCodeForClass(config, definition) - : createPlantUMLCodeForEnum(config, definition), - ) - .join(''); - - return createDiagramFromString(modelPlantUMLCode, plantUmlBaseURL, config.outputFileName); -} - -/** - * This will encode the plantuml code and post the code to the plantuml server - * The server will then parse the code and create a corresponding diagram - * @param modelPlantUMLCode raw PlantUML code - * @param plantUmlBaseURL PlantUML server address that shall be used - * @param outputFile filename of the output file without file extension - */ -export async function createDiagramFromString( - modelPlantUMLCode: string, - plantUmlBaseURL: string, - outputFile = `Diagram-${new Date().toISOString()}`, -) { - // @ts-expect-error no declarations - const plantumlEncoder = await import('plantuml-encoder'); - const plantUMLCode = plantumlEncoder.encode(`@startuml\n${modelPlantUMLCode}\n@enduml`); - const url = `${plantUmlBaseURL}/svg/${plantUMLCode}`; - let response; - try { - response = await request.default.get(url); - const httpOK = 200; - if (response.statusCode !== httpOK) { - await Logger.error(`Plantuml Server responded with an error.\n${response.statusMessage}`); - throw new Error('Response not okay'); - } - } catch (error) { - Logger.log( - `Please try using the public plantuml server:\nhttp://www.plantuml.com/plantuml/svg/${plantUMLCode}`, - ); - throw error; - } - // attach file extension - const fileName = `${outputFile.replaceAll(/[^\w-]/g, '_')}.svg`; - - await writeFile(fileName, response.body); - Logger.log(`Writen data to file: ${fileName}`); - - return fileName; -} - -/** - * Recursively iterates over all types, to find implemented generic types and parents - * @param definitions all type definitions of the project - * @param abstractionNames currently known string values of inherited classes - */ - -/*function gatherTypeAssociations( - definitions: LightweightDefinition[], - abstractionNames: string[], -): string[] { - let abstractions: string[] = []; - for (const name of abstractionNames) { - const declaration = definitions.find( - (definition) => definition.name === name, - ); - if (isLightweightClass(declaration)) { - const currentAbstractions: string[] = declaration.extendedDefinitions.concat( - declaration.implementedDefinitions, - ); - - abstractions = abstractions.concat(currentAbstractions); - abstractions = abstractions.concat( - gatherTypeAssociations(definitions, currentAbstractions), - ); - } - } - - return abstractions; -}*/ - -/** - * Collects all reference information of this type. - * - * Reference information is everything that is indirectly referencing a type or class by name. - * @param type Type with references to other types - */ -function getReferenceTypes(type: LightweightType): string[] { - const types: string[] = []; - if (type.referenceName !== undefined) { - types.push(type.referenceName); - } - - if (type.genericsTypes) { - for (const specificType of type.genericsTypes) { - for (const value of getReferenceTypes(specificType)) { - types.push(value); - } - } - } - - if (Array.isArray(type.specificationTypes)) { - for (const specificType of type.specificationTypes) { - for (const value of getReferenceTypes(specificType)) { - types.push(value); - } - } - } - - return types; -} - -/** - * Creates Plant UML code according to the config for the provided class - * @param config Configuration for how the UML should be tweaked - * @param readerClass Class or interface representation - */ -function createPlantUMLCodeForClass(config: UMLConfig, readerClass: LightweightClassDefinition): string { - // create the definition header, what type the definition is, it's name and it's inheritance - let model = `${readerClass.modifiers} ${readerClass.name}`; - - if (readerClass.typeParameters?.length ?? 0 > 0) { - model += `<${readerClass.typeParameters!.join(', ')}>`; - } - - if (config.showInheritance && (readerClass.extendedDefinitions?.length ?? 0 > 0)) { - // PlantUML will automatically create links, when using extends - model += ` extends ${readerClass.extendedDefinitions!.join(', ')}`; - } - if (config.showInheritance && (readerClass.implementedDefinitions?.length ?? 0 > 0)) { - // PlantUML will automatically create links, when using implements - model += ` implements ${readerClass.implementedDefinitions!.join(', ')}`; - } - model += '{'; - - // add the properties to the definition body - if (config.showProperties && readerClass.properties) { - for (const key in readerClass.properties) { - const property = readerClass.properties[key]; - if (property.optional && !config.showOptionalProperties) { - // don't show optional attributes - continue; - } - /*if (property.inherited && !config.showInheritedProperties) { - // don't show inherited properties - continue; - }*/ - model += `\n\t${createPropertyLine(property)}`; - } - } - - // close the definition body - model += '\n}\n'; - - // add associations from properties with references - if (readerClass.properties) { - for (const key in readerClass.properties) { - const property = readerClass.properties[key]; - const types: string[] = getReferenceTypes(property.type); - for (const type of types) { - if (config.showAssociations) { - /*if (property.inherited && !config.showInheritedProperties) { - continue; - }*/ - model += `${readerClass.name} -up-> ${type} : ${property.name} >\n`; - } - } - } - } - - return model; -} - -/** - * Creates PlantUML code according to the config for the provided enum/-like definition - * @param config Configuration for how the UML should be tweaked - * @param readerEnum Enum/-like representation - */ -function createPlantUMLCodeForEnum(config: UMLConfig, readerEnum: LightweightAliasDefinition): string { - // create enum header - let model = `enum ${readerEnum.name} {`; - // add values - if (config.showEnumValues && readerEnum.type?.specificationTypes) { - for (const value of readerEnum.type?.specificationTypes) { - model += `\n\t${value.toString()}`; - } - } - model += '\n}\n'; - - return model; -} - -/** - * Creates a property PlantUML Line - */ -function createPropertyLine(property: LightweightProperty): string { - const prefix = `${/*(property.inherited ? '/ ' : */ ''}${property.optional ? '? ' : ''}`; - - return `${prefix}${property.name} : ${expandTypeValue(property.type)}`; -} diff --git a/packages/core-tools/src/uml/uml-config.ts b/packages/core-tools/src/uml/uml-config.ts deleted file mode 100644 index c0c1e57c..00000000 --- a/packages/core-tools/src/uml/uml-config.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -/** - * Holds configuration information of how the UML code should be build - */ -export interface UMLConfig { - /** - * Defines which definitions are shown - */ - definitions: string[]; - - /** - * Defines the output file name without file extension - */ - outputFileName?: string; - - /** - * Should the associations between definitions be shown - */ - showAssociations: boolean; - - /** - * Should enum/-like values be shown - */ - showEnumValues: boolean; - - /** - * Should the inheritance be shown - */ - showInheritance: boolean; - - /** - * Should the inherited properties be shown - */ - showInheritedProperties: boolean; - - /** - * Should optional properties be shown - */ - showOptionalProperties: boolean; - - /** - * Should properties be shown - */ - showProperties: boolean; -} diff --git a/packages/core-tools/src/util/collections.ts b/packages/core-tools/src/util/collections.ts deleted file mode 100644 index e1e07a53..00000000 --- a/packages/core-tools/src/util/collections.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -/** - * Filters only defined elements - */ -export function rejectNil(array: Array): T[] { - // eslint-disable-next-line unicorn/no-null - return array.filter(it => it != null) as T[]; -} - -/** - * Map elements that are not null - */ -export function mapNotNil(array: readonly T[], transform: (element: T) => S | undefined | null): S[] { - return rejectNil(array.map(transform)); -} - -/** - * Deletes all properties with the value 'undefined', [] or {} - */ -// eslint-disable-next-line @typescript-eslint/ban-types -export function cleanupEmpty(object: T): T { - const out = {} as T; - for (const key in object) { - const value = object[key]; - // eslint-disable-next-line unicorn/no-null - if (value != null && (typeof value !== 'object' || Object.values(value).length > 0)) { - out[key] = value; - } - } - return out; -} diff --git a/packages/core-tools/src/util/guards.ts b/packages/core-tools/src/util/guards.ts deleted file mode 100644 index 1070e412..00000000 --- a/packages/core-tools/src/util/guards.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {JSONSchema7 as JSONSchema} from 'json-schema'; -import {SchemaWithDefinitions} from '../types/schema.js'; - -/** - * Guard for if a JSON schema is in fact a schema with definitions - */ -export function isSchemaWithDefinitions(schema: JSONSchema): schema is SchemaWithDefinitions { - return schema.definitions !== undefined; -} - -/** - * Guard method for determining if an object (a thing) has a type property with a type of string - */ -export function isThingWithType(thing: unknown): thing is {type: string} { - return ( - typeof thing === 'object' && - thing !== null && - 'type' in thing && - typeof (thing as {type: unknown}).type === 'string' - ); -} diff --git a/packages/core-tools/src/util/io.ts b/packages/core-tools/src/util/io.ts deleted file mode 100644 index 36a85bcd..00000000 --- a/packages/core-tools/src/util/io.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {readdirSync, statSync} from 'fs'; -import path from 'path'; - -/** - * Expand a path to a list of all files deeply contained in it - */ -export function expandPathToFilesSync(sourcePath: string, accept: (fileName: string) => boolean): string[] { - const fullPath = path.resolve(sourcePath); - const directory = statSync(fullPath); - - return directory.isDirectory() - ? readdirSync(fullPath).flatMap(fragment => - expandPathToFilesSync(path.resolve(sourcePath, fragment), accept), - ) - : [fullPath].filter(accept); -} - -/** - * Take a Windows path and make a Unix path out of it - */ -export function toUnixPath(pathString: string): string { - return pathString.replaceAll('\\', '/'); -} diff --git a/packages/core-tools/src/util/posix-path.ts b/packages/core-tools/src/util/posix-path.ts deleted file mode 100644 index 0b032a3a..00000000 --- a/packages/core-tools/src/util/posix-path.ts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import path from 'path'; -import {PathLike} from 'fs'; - -/** - * Convert a path to a POSIX path - * - * Replaces the system separator with posix separators - * Replaces Windows drive letters with a root '/' - */ -export function toPosixPath(pathLike: PathLike, separator = path.sep): string { - return pathLike - .toString() - .split(separator) - .join(path.posix.sep) - .replace(/^[A-z]:\//, '/'); -} diff --git a/packages/core-tools/src/util/string.ts b/packages/core-tools/src/util/string.ts deleted file mode 100644 index 5162af4c..00000000 --- a/packages/core-tools/src/util/string.ts +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright (C) 2021 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ diff --git a/packages/core-tools/test/common.spec.ts b/packages/core-tools/test/common.spec.ts deleted file mode 100644 index a7014034..00000000 --- a/packages/core-tools/test/common.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* eslint-disable unicorn/prefer-module */ -/* - * Copyright (C) 2018-2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {Logger} from '@openstapps/logger'; -import {expect} from 'chai'; -import {getTsconfigPath} from '../src/common.js'; -import path from 'path'; -import {fileURLToPath} from 'url'; - -process.on('unhandledRejection', (reason: unknown): void => { - if (reason instanceof Error) { - void Logger.error('UNHANDLED REJECTION', reason.stack); - } - process.exit(1); -}); - -describe('common', function () { - describe('getTsconfigPath', function () { - it('should get tsconfig path', function () { - expect(getTsconfigPath(path.dirname(fileURLToPath(import.meta.url)))).to.be.equal(process.cwd()); - }); - }); -}); diff --git a/packages/core-tools/test/create-diagram.spec.ts b/packages/core-tools/test/create-diagram.spec.ts deleted file mode 100644 index 173ce1f2..00000000 --- a/packages/core-tools/test/create-diagram.spec.ts +++ /dev/null @@ -1,83 +0,0 @@ -/* eslint-disable unicorn/prefer-module */ -/* - * Copyright (C) 2018-2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {expect} from 'chai'; -import {unlink} from 'fs/promises'; -import {createDiagram, createDiagramFromString} from '../src/index.js'; -import {UMLConfig} from '../src/index.js'; -import {lightweightDefinitionsFromPath} from '@openstapps/easy-ast'; -import nock = require('nock'); -import path from 'path'; -import {existsSync} from 'fs'; -import {fileURLToPath} from 'url'; - -describe('CreateDiagram', function () { - this.timeout(15_000); - this.slow(5000); - - const plantUmlConfig: UMLConfig = { - definitions: [], - showAssociations: true, - showEnumValues: true, - showInheritance: true, - showInheritedProperties: true, - showOptionalProperties: true, - showProperties: true, - }; - - const definitions = lightweightDefinitionsFromPath('./test/model'); - - it('should refuse request', async function () { - const testPlantUmlCode = 'class Test{\n}'; - try { - await createDiagramFromString(testPlantUmlCode, 'http://plantuml:8080'); - } catch (error) { - expect([ - new Error('getaddrinfo ENOTFOUND plantuml plantuml:8080').message, - new Error('getaddrinfo EAI_AGAIN plantuml plantuml:8080').message, - new Error('getaddrinfo ENOTFOUND plantuml').message, - ]).to.include((error as NodeJS.ErrnoException).message); - } - }); - - /** - * This test will only test the functionality of the method - * - Converting the definitions to plantuml code - * - Sending the code to a server - * - Writing the response to a file - * This test will not check the file content - */ - it('should create diagrams', async function () { - nock('http://plantuml:8080') - .persist() - .get(() => true) - .reply(200, 'This will be the file content'); - - let fileName = await createDiagram(definitions, plantUmlConfig, 'http://plantuml:8080'); - let filePath = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', fileName); - expect(existsSync(filePath)).to.be.true; - - await unlink(fileName); - plantUmlConfig.showAssociations = false; - - plantUmlConfig.showInheritance = false; - fileName = await createDiagram(definitions, plantUmlConfig, 'http://plantuml:8080'); - filePath = path.join(path.dirname(fileURLToPath(import.meta.url)), '..', fileName); - expect(existsSync(filePath)).to.be.true; - await unlink(fileName); - - nock.cleanAll(); - }); -}); diff --git a/packages/core-tools/test/model/src/test-class.ts b/packages/core-tools/test/model/src/test-class.ts deleted file mode 100644 index 0cd89913..00000000 --- a/packages/core-tools/test/model/src/test-class.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2018-2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {TestFirstUnion} from './test-union.js'; - -export class TestClass { - test2: T; - - test4: TestFirstUnion; - - constructor(type: T) { - this.test2 = type; - this.test4 = 'test1'; - } - - /** - * Should not be processed at all - */ - testClassFunction(): boolean { - return true; - } -} - -export class TestSecondClass extends TestClass {} diff --git a/packages/core-tools/test/model/src/test-enum.ts b/packages/core-tools/test/model/src/test-enum.ts deleted file mode 100644 index db9fff42..00000000 --- a/packages/core-tools/test/model/src/test-enum.ts +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (C) 2018-2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -export enum TestFirstEnum { - TEST1, - TEST2, - TEST3, -} - -export enum TestSecondEnum { - TEST1 = 'one', - TEST2 = 'two', - TEST3 = 'three', -} diff --git a/packages/core-tools/test/model/src/test-interface.ts b/packages/core-tools/test/model/src/test-interface.ts deleted file mode 100644 index 13afe1bd..00000000 --- a/packages/core-tools/test/model/src/test-interface.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright (C) 2018-2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {TestClass, TestSecondClass} from './test-class.js'; -import {TestFirstEnum} from './test-enum.js'; -import {TestThirdUnion} from './test-union.js'; - -export interface TestInterface { - articleBody: string[]; - categorySpecificValues?: {[s: string]: string}; - inputType: 'multipleChoice'; - maintainer: TestThirdUnion | TestFirstEnum; - remainingAttendeeCapacity?: number; - test1: Array; - test2: TestClass; - test3: 'test1' | 'test2'; - test4: TestSecondClass; - universityRole: keyof TestFirstEnum; -} - -export interface TestSecondInterface { - [k: string]: string; -} diff --git a/packages/core-tools/test/model/src/test-union.ts b/packages/core-tools/test/model/src/test-union.ts deleted file mode 100644 index 4fa5524c..00000000 --- a/packages/core-tools/test/model/src/test-union.ts +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2018-2019 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ - -export type TestFirstUnion = 'test1' | 'test2'; - -export type TestSecondUnion = 'test3'; - -export type TestThirdUnion = TestFirstUnion | TestSecondUnion; - -export type TestFourthUnion = T extends TestFirstUnion ? TestFirstUnion : never; diff --git a/packages/core-tools/test/model/tsconfig.json b/packages/core-tools/test/model/tsconfig.json deleted file mode 100644 index 4730a9d3..00000000 --- a/packages/core-tools/test/model/tsconfig.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "../../node_modules/@openstapps/configuration/tsconfig.json", - "exclude": [] -} diff --git a/packages/core-tools/test/posix-path.spec.ts b/packages/core-tools/test/posix-path.spec.ts deleted file mode 100644 index 7d23a983..00000000 --- a/packages/core-tools/test/posix-path.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2022 StApps - * This program is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the Free - * Software Foundation, version 3. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program. If not, see . - */ -import {expect} from 'chai'; -import {toPosixPath} from '../src/util/posix-path.js'; -import path from 'path'; - -describe('posix-path', function () { - it('should convert Windows paths', function () { - expect(toPosixPath('a\\b\\c', path.win32.sep)).to.be.equal('a/b/c'); - }); - - it('should leave POSIX paths untouched', function () { - expect(toPosixPath('a/b/c', path.posix.sep)).to.be.equal('a/b/c'); - }); - - it('should replace Windows drive letters', function () { - expect(toPosixPath('C:\\a\\b\\c', path.win32.sep)).to.be.equal('/a/b/c'); - }); - - it('should leave POSIX root separator untouched', function () { - expect(toPosixPath('/a/b/c', path.posix.sep)).to.be.equal('/a/b/c'); - }); -}); diff --git a/packages/core-tools/tsconfig.json b/packages/core-tools/tsconfig.json deleted file mode 100644 index aff26de6..00000000 --- a/packages/core-tools/tsconfig.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": "@openstapps/tsconfig", - "compilerOptions": { - "noUnusedLocals": false, - "stripInternal": true - } -} diff --git a/packages/core-validator/package.json b/packages/core-validator/package.json index 57aa2f18..ad715bca 100644 --- a/packages/core-validator/package.json +++ b/packages/core-validator/package.json @@ -37,7 +37,6 @@ "ajv-formats": "2.1.1" }, "devDependencies": { - "@openstapps/core-tools": "workspace:*", "@openstapps/eslint-config": "workspace:*", "@openstapps/prettier-config": "workspace:*", "@openstapps/tsconfig": "workspace:*", diff --git a/packages/core-validator/src/index.ts b/packages/core-validator/src/index.ts index 048634f5..01d92c7c 100644 --- a/packages/core-validator/src/index.ts +++ b/packages/core-validator/src/index.ts @@ -1,7 +1,6 @@ import Ajv, {AnySchema} from 'ajv'; import addFormats from 'ajv-formats'; -import schema from '../schema/core.schema.json'; -import {SchemaMap} from '../schema/core.schema.js'; +import schema, {SchemaMap} from '@openstapps/core/schema.json'; export type RemoveNeverProperties = { [K in Exclude< diff --git a/packages/core-tools/test/validate.spec.ts b/packages/core-validator/test/validate.spec.ts similarity index 94% rename from packages/core-tools/test/validate.spec.ts rename to packages/core-validator/test/validate.spec.ts index 81b4d086..ff010976 100644 --- a/packages/core-tools/test/validate.spec.ts +++ b/packages/core-validator/test/validate.spec.ts @@ -13,16 +13,16 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {Logger} from '@openstapps/logger'; +import {Logger} from 'packages/logger/lib/index.js'; import {expect} from 'chai'; import {existsSync} from 'fs'; import {JSONSchema7 as Schema} from 'json-schema'; -import {Foo} from '../src/resources/foo.js'; +import {Foo} from '@openstapps/core-tools/src/resources/foo.js'; import {Validator} from '../src/validate.js'; import path from 'path'; import {fileURLToPath} from 'url'; import {rm, mkdir, writeFile} from 'fs/promises'; -import {Converter} from '../src/index.js'; +import {Converter} from '@openstapps/core-tools/src/index.js'; process.on('unhandledRejection', (error: unknown) => { if (error instanceof Error) { diff --git a/packages/core/package.json b/packages/core/package.json index 9707086e..649cc6b1 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -25,6 +25,16 @@ ], "main": "./lib/index.js", "types": "./lib/index.d.ts", + "exports": { + ".": { + "import": "./lib/index.js", + "types": "./lib/index.d.ts" + }, + "./schema.json": { + "import": "./lib/schema.json", + "types": "./lib/schema.d.ts" + } + }, "files": [ "lib", "test/resources", @@ -41,7 +51,6 @@ "test": "c8 mocha" }, "dependencies": { - "@openstapps/core-tools": "workspace:*", "@types/geojson": "1.0.6", "fast-deep-equal": "3.1.3", "http-status-codes": "2.2.0", diff --git a/packages/core/src/protocol/errors/validation.ts b/packages/core/src/protocol/errors/validation.ts index 63e7246b..96f4c4a7 100644 --- a/packages/core/src/protocol/errors/validation.ts +++ b/packages/core/src/protocol/errors/validation.ts @@ -12,7 +12,6 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {ValidationError} from '@openstapps/core-tools'; import {StatusCodes} from 'http-status-codes'; import {SCError} from '../error.js'; @@ -24,14 +23,14 @@ export class SCValidationErrorResponse extends SCError { /** * List of validatation errors */ - additionalData: ValidationError[]; + additionalData: unknown[]; // TODO /** * Create a SCValidationErrorResponse * @param errors List of validation errors * @param stack Set to true if a stack trace should be created */ - constructor(errors: ValidationError[], stack?: boolean) { + constructor(errors: unknown[] /* TODO */, stack?: boolean) { super('ValidationError', 'Validation of request failed', StatusCodes.BAD_REQUEST, stack); this.additionalData = errors; } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 579a39ff..579c21ff 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,3 +1,6 @@ { - "extends": "@openstapps/tsconfig" + "extends": "@openstapps/tsconfig", + "compilerOptions": { + "typeRoots": ["./node_modules/@openstapps/json-schema-generator/types"] + } } diff --git a/packages/core/tsup.config.ts b/packages/core/tsup.config.ts index 1d181a1e..299c4daf 100644 --- a/packages/core/tsup.config.ts +++ b/packages/core/tsup.config.ts @@ -10,7 +10,7 @@ export default defineConfig({ format: 'esm', outDir: 'lib', plugins: [ - jsonSchemaPlugin('index.schema.json', elasticsearchMappingGenerator('elasticsearch.json')), - openapiPlugin('openapi.json', 'index.schema.json'), + jsonSchemaPlugin('schema.json', elasticsearchMappingGenerator('elasticsearch.json')), + openapiPlugin('openapi.json', 'schema.json'), ], }); diff --git a/packages/json-schema-generator/package.json b/packages/json-schema-generator/package.json index b12d3a89..15835a5a 100644 --- a/packages/json-schema-generator/package.json +++ b/packages/json-schema-generator/package.json @@ -31,6 +31,7 @@ }, "dependencies": { "@openstapps/tsup-plugin": "workspace:*", + "@types/json-schema": "7.0.14", "deepmerge": "4.3.1", "ts-json-schema-generator": "1.4.0" }, @@ -41,7 +42,6 @@ "@types/chai": "4.3.5", "@types/fs-extra": "9.0.13", "@types/glob": "8.0.1", - "@types/json-schema": "7.0.14", "@types/mocha": "10.0.1", "@types/mustache": "4.2.2", "@types/node": "18.15.3", @@ -58,7 +58,6 @@ }, "tsup": { "entry": [ - "src/app.ts", "src/index.ts" ], "sourcemap": true, diff --git a/packages/json-schema-generator/schema.d.ts b/packages/json-schema-generator/schema.d.ts new file mode 100644 index 00000000..2a2f1d15 --- /dev/null +++ b/packages/json-schema-generator/schema.d.ts @@ -0,0 +1,5 @@ +declare module 'schema:*' { + import {JSONSchema7} from 'json-schema'; + const schema: JSONSchema7; + export default schema; +} diff --git a/packages/json-schema-generator/src/generator/compile-schema.ts b/packages/json-schema-generator/src/generator/compile-schema.ts index 50d9243b..8efebca2 100644 --- a/packages/json-schema-generator/src/generator/compile-schema.ts +++ b/packages/json-schema-generator/src/generator/compile-schema.ts @@ -1,10 +1,11 @@ -import {createGenerator, SchemaGenerator} from 'ts-json-schema-generator'; +import {createGenerator} from 'ts-json-schema-generator'; import {getValidatableTypes} from './get-validatable-types.js'; +import {JSONSchema7} from 'json-schema'; /** * Compile the JSON schema for a path */ -export function compileSchema(path: string, tsconfig: string): ReturnType { +export function compileSchema(path: string, tsconfig: string): [schma: JSONSchema7, type: string] { const generator = createGenerator({ path, tsconfig, @@ -23,5 +24,11 @@ export function compileSchema(path: string, tsconfig: string): ReturnType ` '${schemaName}': core.${schemaName};`) + .join('\n')}\n}\n\nconst schema: JSONSchema7;\nexport default schema;`; + + return [fullSchema, schemaTypes]; } diff --git a/packages/json-schema-generator/src/generator/get-validatable-types.ts b/packages/json-schema-generator/src/generator/get-validatable-types.ts index fbc1fb62..8f1bd071 100644 --- a/packages/json-schema-generator/src/generator/get-validatable-types.ts +++ b/packages/json-schema-generator/src/generator/get-validatable-types.ts @@ -5,7 +5,7 @@ import {ts} from 'ts-json-schema-generator'; */ export function getValidatableTypes(program: ts.Program) { const checker = program.getTypeChecker(); - const declarationNames: string[] = []; + const declarationNames = new Set(); for (const sourceFile of program.getSourceFiles()) { const sourceFileSymbol = checker.getSymbolAtLocation(sourceFile); @@ -16,7 +16,7 @@ export function getValidatableTypes(program: ts.Program) { const name = ts.getNameOfDeclaration(declaration); if (name && validatableTags.length > 0) { - declarationNames.push(name.getText()); + declarationNames.add(name.getText()); } } } diff --git a/packages/json-schema-generator/src/index.ts b/packages/json-schema-generator/src/index.ts index 72ebba30..22711aa0 100644 --- a/packages/json-schema-generator/src/index.ts +++ b/packages/json-schema-generator/src/index.ts @@ -1,10 +1,44 @@ import {compileSchema} from './generator/compile-schema.js'; import {generateFiles, Plugin, PluginContext} from '@openstapps/tsup-plugin'; +import {JSONSchema7} from 'json-schema'; +import {Plugin as EsbuildPlugin} from 'esbuild'; +import {createGenerator} from 'ts-json-schema-generator'; -export type SchemaConsumer = ( - this: PluginContext, - schema: ReturnType, -) => Record; +export type SchemaConsumer = (this: PluginContext, schema: JSONSchema7) => Record; + +export const jsonSchema: EsbuildPlugin = { + name: 'json-schema', + setup(build) { + const fileRegex = /^schema:/; + const namespace = 'json-schema-ns'; + const schemas = new Map(); + + build.onResolve({filter: fileRegex}, ({path, importer}) => { + const [from, name] = path.replace(fileRegex, '').split('#', 1); + + return { + path: `${from === 'file' ? importer : from}#${name}`, + namespace, + }; + }); + + build.onLoad({filter: /.*/, namespace}, ({path}) => { + if (!schemas.has(path)) { + const [sourcePath, schemaName] = path.split('#', 1); + const generator = createGenerator({ + path: sourcePath, + extraTags: ['elasticsearch'], + skipTypeCheck: true, + }); + schemas.set(path, JSON.stringify(generator.createSchema(schemaName))); + } + return { + contents: schemas.get(path), + loader: 'json', + }; + }); + }, +}; /** * TSUp plugin for generating JSONSchema files @@ -18,12 +52,17 @@ export function jsonSchemaPlugin( return { name: 'json-schema-generator', async buildEnd() { - let schema: ReturnType; + let schema: JSONSchema7; await generateFiles('JSON-Schema', async function () { - schema = compileSchema((this.options.entry as string[])[0], this.options.tsconfig!); + const [jsonSchema, types] = compileSchema( + (this.options.entry as string[])[0], + this.options.tsconfig!, + ); + schema = jsonSchema; return { - [schemaName]: JSON.stringify(schema), + [schemaName]: JSON.stringify(jsonSchema), + [`${schemaName.replace(/\.json$/, '')}.d.ts`]: types, }; }).call(this); @@ -35,3 +74,5 @@ export function jsonSchemaPlugin( }, }; } + +export {compileSchema} from './generator/compile-schema.js'; diff --git a/packages/core-tools/test/schema.spec.ts b/packages/json-schema-generator/test/schema.spec.ts similarity index 96% rename from packages/core-tools/test/schema.spec.ts rename to packages/json-schema-generator/test/schema.spec.ts index 8f3db365..fe924771 100644 --- a/packages/core-tools/test/schema.spec.ts +++ b/packages/json-schema-generator/test/schema.spec.ts @@ -13,9 +13,9 @@ * You should have received a copy of the GNU General Public License along with * this program. If not, see . */ -import {Logger} from '@openstapps/logger'; +import {Logger} from 'packages/logger/lib/index.js'; import {expect} from 'chai'; -import {Converter} from '../src/schema.js'; +import {Converter} from '../../core-tools/src/schema.js'; import path from 'path'; import {fileURLToPath} from 'url'; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6ed535cd..51c47156 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -58,9 +58,6 @@ importers: '@openstapps/core': specifier: workspace:* version: link:../../packages/core - '@openstapps/core-tools': - specifier: workspace:* - version: link:../../packages/core-tools '@openstapps/logger': specifier: workspace:* version: link:../../packages/logger @@ -571,9 +568,6 @@ importers: specifier: 10.0.0 version: 10.0.0 devDependencies: - '@openstapps/core-tools': - specifier: workspace:* - version: link:../../packages/core-tools '@openstapps/eslint-config': specifier: workspace:* version: link:../../configuration/eslint-config @@ -663,9 +657,9 @@ importers: '@openstapps/core': specifier: workspace:* version: link:../../packages/core - '@openstapps/core-tools': + '@openstapps/json-schema-generator': specifier: workspace:* - version: link:../../packages/core-tools + version: link:../../packages/json-schema-generator '@openstapps/logger': specifier: workspace:* version: link:../../packages/logger @@ -1225,62 +1219,10 @@ importers: version: 5.22.1 packages/api-cli: - dependencies: - '@openstapps/api': - specifier: workspace:* - version: link:../api - '@openstapps/core': - specifier: workspace:* - version: link:../core - '@openstapps/core-tools': - specifier: workspace:* - version: link:../core-tools + devDependencies: '@openstapps/eslint-config': specifier: workspace:* version: link:../../configuration/eslint-config - '@openstapps/logger': - specifier: workspace:* - version: link:../logger - '@types/cli-progress': - specifier: 3.11.0 - version: 3.11.0 - '@types/express': - specifier: 4.17.17 - version: 4.17.17 - '@types/fs-extra': - specifier: 9.0.13 - version: 9.0.13 - '@types/json-schema': - specifier: 7.0.14 - version: 7.0.14 - '@types/junit-report-builder': - specifier: 3.0.0 - version: 3.0.0 - '@types/mocha': - specifier: 10.0.1 - version: 10.0.1 - '@types/node': - specifier: 18.15.3 - version: 18.15.3 - '@types/wait-on': - specifier: 5.3.1 - version: 5.3.1 - cli-progress: - specifier: 3.12.0 - version: 3.12.0 - commander: - specifier: 10.0.0 - version: 10.0.0 - fs-extra: - specifier: 10.1.0 - version: 10.1.0 - junit-report-builder: - specifier: 3.0.1 - version: 3.0.1 - wait-on: - specifier: 6.0.1 - version: 6.0.1 - devDependencies: '@openstapps/prettier-config': specifier: workspace:* version: link:../../configuration/prettier-config @@ -1296,6 +1238,12 @@ importers: '@types/chai-spies': specifier: 1.0.3 version: 1.0.3 + '@typescript-eslint/eslint-plugin': + specifier: 5.60.1 + version: 5.60.1(@typescript-eslint/parser@5.60.1)(eslint@8.43.0)(typescript@5.1.6) + '@typescript-eslint/parser': + specifier: 5.60.1 + version: 5.60.1(eslint@8.43.0)(typescript@5.1.6) c8: specifier: 7.14.0 version: 7.14.0 @@ -1308,6 +1256,21 @@ importers: chai-spies: specifier: 1.0.0 version: 1.0.0(chai@4.3.7) + eslint: + specifier: 8.43.0 + version: 8.43.0 + eslint-config-prettier: + specifier: 8.8.0 + version: 8.8.0(eslint@8.43.0) + eslint-plugin-jsdoc: + specifier: 46.4.2 + version: 46.4.2(eslint@8.43.0) + eslint-plugin-prettier: + specifier: 4.2.1 + version: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.43.0)(prettier@2.8.6) + eslint-plugin-unicorn: + specifier: 47.0.0 + version: 47.0.0(eslint@8.43.0) mocha: specifier: 10.2.0 version: 10.2.0 @@ -1338,9 +1301,6 @@ importers: '@openstapps/core': specifier: workspace:* version: link:../core - '@openstapps/core-tools': - specifier: workspace:* - version: link:../core-tools '@openstapps/logger': specifier: workspace:* version: link:../logger @@ -1522,9 +1482,6 @@ importers: packages/core: dependencies: - '@openstapps/core-tools': - specifier: workspace:* - version: link:../core-tools '@types/geojson': specifier: 1.0.6 version: 1.0.6 @@ -1641,151 +1598,6 @@ importers: specifier: 5.1.6 version: 5.1.6 - packages/core-tools: - dependencies: - '@openstapps/collection-utils': - specifier: workspace:* - version: link:../collection-utils - '@openstapps/easy-ast': - specifier: workspace:* - version: link:../easy-ast - '@openstapps/logger': - specifier: workspace:* - version: link:../logger - ajv: - specifier: 8.12.0 - version: 8.12.0 - ajv-formats: - specifier: 2.1.1 - version: 2.1.1(ajv@8.12.0) - better-ajv-errors: - specifier: 1.2.0 - version: 1.2.0(ajv@8.12.0) - commander: - specifier: 10.0.0 - version: 10.0.0 - deepmerge: - specifier: 4.3.1 - version: 4.3.1 - del: - specifier: 6.1.1 - version: 6.1.1 - flatted: - specifier: 3.2.7 - version: 3.2.7 - fs-extra: - specifier: 10.1.0 - version: 10.1.0 - glob: - specifier: 10.2.7 - version: 10.2.7 - got: - specifier: 12.6.0 - version: 12.6.0 - humanize-string: - specifier: 3.0.0 - version: 3.0.0 - json-schema: - specifier: 0.4.0 - version: 0.4.0 - mustache: - specifier: 4.2.0 - version: 4.2.0 - openapi-types: - specifier: 12.1.3 - version: 12.1.3 - plantuml-encoder: - specifier: 1.4.0 - version: 1.4.0 - toposort: - specifier: 2.0.2 - version: 2.0.2 - ts-json-schema-generator: - specifier: 1.4.0 - version: 1.4.0 - devDependencies: - '@openstapps/eslint-config': - specifier: workspace:* - version: link:../../configuration/eslint-config - '@openstapps/prettier-config': - specifier: workspace:* - version: link:../../configuration/prettier-config - '@openstapps/tsconfig': - specifier: workspace:* - version: link:../../configuration/tsconfig - '@types/chai': - specifier: 4.3.5 - version: 4.3.5 - '@types/fs-extra': - specifier: 9.0.13 - version: 9.0.13 - '@types/glob': - specifier: 8.0.1 - version: 8.0.1 - '@types/json-schema': - specifier: 7.0.14 - version: 7.0.14 - '@types/mocha': - specifier: 10.0.1 - version: 10.0.1 - '@types/mustache': - specifier: 4.2.2 - version: 4.2.2 - '@types/node': - specifier: 18.15.3 - version: 18.15.3 - '@typescript-eslint/eslint-plugin': - specifier: 5.60.1 - version: 5.60.1(@typescript-eslint/parser@5.60.1)(eslint@8.43.0)(typescript@5.1.6) - '@typescript-eslint/parser': - specifier: 5.60.1 - version: 5.60.1(eslint@8.43.0)(typescript@5.1.6) - c8: - specifier: 7.14.0 - version: 7.14.0 - chai: - specifier: 4.3.7 - version: 4.3.7 - eslint: - specifier: 8.43.0 - version: 8.43.0 - eslint-config-prettier: - specifier: 8.8.0 - version: 8.8.0(eslint@8.43.0) - eslint-plugin-jsdoc: - specifier: 46.4.2 - version: 46.4.2(eslint@8.43.0) - eslint-plugin-prettier: - specifier: 4.2.1 - version: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.43.0)(prettier@2.8.6) - eslint-plugin-unicorn: - specifier: 47.0.0 - version: 47.0.0(eslint@8.43.0) - mocha: - specifier: 10.2.0 - version: 10.2.0 - mocha-junit-reporter: - specifier: 2.2.0 - version: 2.2.0(mocha@10.2.0) - nock: - specifier: 13.3.1 - version: 13.3.1 - prettier: - specifier: 2.8.6 - version: 2.8.6 - ts-node: - specifier: 10.9.1 - version: 10.9.1(@types/node@18.15.3)(typescript@5.1.6) - tsup: - specifier: 6.7.0 - version: 6.7.0(ts-node@10.9.1)(typescript@5.1.6) - typedoc: - specifier: 0.24.8 - version: 0.24.8(typescript@5.1.6) - typescript: - specifier: 5.1.6 - version: 5.1.6 - packages/core-validator: dependencies: '@openstapps/core': @@ -1798,9 +1610,6 @@ importers: specifier: 2.1.1 version: 2.1.1(ajv@8.12.0) devDependencies: - '@openstapps/core-tools': - specifier: workspace:* - version: link:../core-tools '@openstapps/eslint-config': specifier: workspace:* version: link:../../configuration/eslint-config @@ -6127,16 +5936,6 @@ packages: resolution: {integrity: sha512-59SgoZ3EXbkfSX7b63tsou/SDGzwUEK6MuB5sKqgVK1/XE0fxmpsOb9DQI8LXW3KfGnAjImCGhhEb7uPPAUVNA==} dev: true - /@hapi/hoek@9.3.0: - resolution: {integrity: sha512-/c6rf4UJlmHlC9b5BaNvzAcFv7HZ2QHaV0D4/HNlBdvFnvQq8RI4kYdhyPCl7Xj+oWvTWQ8ujhqS53LIgAe6KQ==} - dev: false - - /@hapi/topo@5.1.0: - resolution: {integrity: sha512-foQZKJig7Ob0BMAYBfcJk8d77QtOe7Wo4ox7ff1lQYoNNAb6jwcY1ncdoy2e9wQZzvNy7ODZCYJkK8kzmcAnAg==} - dependencies: - '@hapi/hoek': 9.3.0 - dev: false - /@hugotomazi/capacitor-navigation-bar@2.0.0(@capacitor/core@4.6.1): resolution: {integrity: sha512-hebf0ixGPugiZfH6g7HS/hrDzkKmNdJV/pV2jUz5lfoZXFMjE+7aeAr1AqwW6EGNej65WcEP8VUL5YUc3wSCjw==} peerDependencies: @@ -6903,20 +6702,6 @@ packages: - chokidar dev: true - /@sideway/address@4.1.4: - resolution: {integrity: sha512-7vwq+rOHVWjyXxVlR76Agnvhy8I9rpzjosTESvmhNeXOXdZZB15Fl+TI9x1SiHZH5Jv2wTGduSxFDIaq0m3DUw==} - dependencies: - '@hapi/hoek': 9.3.0 - dev: false - - /@sideway/formula@3.0.1: - resolution: {integrity: sha512-/poHZJJVjx3L+zVD6g9KgHfYnb443oi7wLu/XKojDviHy6HOEOA6z1Trk5aR1dGcmPenJEgb2sK2I80LeS3MIg==} - dev: false - - /@sideway/pinpoint@2.0.0: - resolution: {integrity: sha512-RNiOoTPkptFtSVzQevY/yWtZwf/RxyVnPy/OcA9HBM3MlGDnBEYL5B41H0MTn0Uec8Hi+2qUtTfG2WWZBmMejQ==} - dev: false - /@sigstore/protobuf-specs@0.1.0: resolution: {integrity: sha512-a31EnjuIDSX8IXBUib3cYLDRlPMU36AWX4xS8ysLaNu4ZzUesDiPt83pgrW2X1YLMe5L2HbDyaKK5BrL4cNKaQ==} engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} @@ -7122,12 +6907,6 @@ packages: resolution: {integrity: sha512-mEo1sAde+UCE6b2hxn332f1g1E8WfYRu6p5SvTKr2ZKC1f7gFJXk4h5PyGP9Dt6gCaG8y8XhwnXWC6Iy2cmBng==} dev: true - /@types/cli-progress@3.11.0: - resolution: {integrity: sha512-XhXhBv1R/q2ahF3BM7qT5HLzJNlIL0wbcGyZVjqOTqAybAnsLisd7gy1UCyIqpL+5Iv6XhlSyzjLCnI2sIdbCg==} - dependencies: - '@types/node': 18.15.3 - dev: false - /@types/config@3.3.0: resolution: {integrity: sha512-9kZSbl3/X3TVNowLCu5HFQdQmD+4287Om55avknEYkuo6R2dDrsp/EXEHUFvfYeG7m1eJ0WYGj+cbcUIhARJAQ==} dev: false @@ -7229,6 +7008,7 @@ packages: resolution: {integrity: sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA==} dependencies: '@types/node': 18.15.3 + dev: true /@types/geojson@1.0.6: resolution: {integrity: sha512-Xqg/lIZMrUd0VRmSRbCAewtwGZiAk3mEUDvV4op1tGl+LvyPcb/MIOSxTl9z+9+J+R4/vpjiCAT4xeKzH9ji1w==} @@ -7300,10 +7080,6 @@ packages: resolution: {integrity: sha512-v7qlPA0VpKUlEdhghbDqRoKMxFB3h3Ch688TApBJ6v+XLDdvWCGLJIYiPKGZnS6MAOie+IorCfNYVHOPIHSWwQ==} dev: true - /@types/junit-report-builder@3.0.0: - resolution: {integrity: sha512-Rr3uts4+YVFsk7FCxzbapZQR04+4FCYVEvTvnxA6NNVnvNkA5Nx8bguU+iZrks1OMXHJJo0vWCi4+aUavRcJjw==} - dev: false - /@types/karma-coverage@2.0.1: resolution: {integrity: sha512-A5aJSn2IVJAy6XJl3zC8xAk78pqcj1dSAc9s0QPj3jnsmEpK5cGKmCTVVD7CYX8iEFk0C+IuSiS5YPVbacreSg==} dependencies: @@ -7363,6 +7139,7 @@ packages: /@types/mocha@10.0.1: resolution: {integrity: sha512-/fvYntiO1GeICvqbQ3doGDIP97vWmvFt83GKguJ6prmQM2iXZfFcq6YE8KteFyRtX2/h5Hf91BYvPodJKFYv5Q==} + dev: true /@types/morgan@1.9.4: resolution: {integrity: sha512-cXoc4k+6+YAllH3ZHmx4hf7La1dzUk6keTR4bF4b4Sc0mZxU/zK4wO7l+ZzezXm/jkYj/qC+uYGZrarZdIVvyQ==} @@ -7522,12 +7299,6 @@ packages: resolution: {integrity: sha512-c/I8ZRb51j+pYGAu5CrFMRxqZ2ke4y2grEBO5AUjgSkSk+qT2Ea+OdWElz/OiMf5MNpn2b17kuVBwZLQJXzihw==} dev: false - /@types/wait-on@5.3.1: - resolution: {integrity: sha512-2FFOKCF/YydrMUaqg+fkk49qf0e5rDgwt6aQsMzFQzbS419h2gNOXyiwp/o2yYy27bi/C1z+HgfncryjGzlvgQ==} - dependencies: - '@types/node': 18.15.3 - dev: false - /@types/ws@8.5.5: resolution: {integrity: sha512-lwhs8hktwxSjf9UaZ9tG5M03PGogvFaH8gUgLNbN9HKIg0dvv6q+gkSuJ8HN4/VbyxkuLzCjlN7GquQ0gUJfIg==} dependencies: @@ -7997,6 +7768,7 @@ packages: dependencies: clean-stack: 2.2.0 indent-string: 4.0.0 + dev: true /ajv-formats@2.1.0(ajv@8.6.2): resolution: {integrity: sha512-USH2jBb+C/hIpwD2iRjp0pe0k+MvzG0mlSn/FIdCgQhUb9ALPRjt2KIQdfZDS9r0ZIeUAg7gOu9KL0PFqGqr5Q==} @@ -8352,14 +8124,6 @@ packages: resolution: {integrity: sha512-NmWvPnx0F1SfrQbYwOi7OeaNGokp9XhzNioJ/CSBs8Qa4vxug81mhJEAVZwxXuBmYB5KDRfMq/F3RR0BIU7sWg==} dev: true - /axios@0.25.0: - resolution: {integrity: sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==} - dependencies: - follow-redirects: 1.15.2 - transitivePeerDependencies: - - debug - dev: false - /axios@0.27.2: resolution: {integrity: sha512-t+yRIyySRTp/wua5xEr+z1q60QmLq8ABsS5O9Me1AsE5dfKqgnCFzwiCZZ/cGNd1lq4/7akDWMxdhVlucjmnOQ==} dependencies: @@ -9039,6 +8803,7 @@ packages: /clean-stack@2.2.0: resolution: {integrity: sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A==} engines: {node: '>=6'} + dev: true /cli-cursor@2.1.0: resolution: {integrity: sha512-8lgKz8LmCRYZZQDpRyT2m5rKJ08TnU4tR9FFFW2rxpxR1FzWi4PQ/NfyODchAatHaUgnSPVcx/R5w6NuTBzFiw==} @@ -9054,13 +8819,6 @@ packages: restore-cursor: 3.1.0 dev: true - /cli-progress@3.12.0: - resolution: {integrity: sha512-tRkV3HJ1ASwm19THiiLIXLO7Im7wlTuKnvkYaTkyoAPefqjNg7W7DHKUlGRxy9vxDvbyCYQkQozvptuMkGCg8A==} - engines: {node: '>=4'} - dependencies: - string-width: 4.2.3 - dev: false - /cli-spinners@2.6.1: resolution: {integrity: sha512-x/5fWmGMnbKQAaNwN+UZlV79qBLM9JFnJuJ03gIi5whrob0xV0ofNVHy9DhwGdsMJQc2OKv0oGmLzvaqvAVv+g==} engines: {node: '>=6'} @@ -10239,11 +9997,6 @@ packages: engines: {node: '>=4.0'} dev: true - /date-format@4.0.3: - resolution: {integrity: sha512-7P3FyqDcfeznLZp2b+OMitV9Sz2lUnsT87WaTat9nVwqsBkTzPG3lPLNwW3en6F4pHUiWzr6vb8CLhjdK9bcxQ==} - engines: {node: '>=4.0'} - dev: false - /dateformat@3.0.3: resolution: {integrity: sha512-jyCETtSl3VMZMWeRo7iY1FL19ges1t55hMo5yaam4Jrsm5EPL89UQkoQRyiI+Yf4k8r2ZpdngkV8hr1lIdjb3Q==} dev: true @@ -10331,11 +10084,6 @@ packages: engines: {node: '>=10'} dev: true - /decamelize@6.0.0: - resolution: {integrity: sha512-Fv96DCsdOgB6mdGl67MT5JaTNKRzrzill5OH5s8bjYJXVlcXyPYGyPsUkWyGV5p1TXI5esYIYMMeDJL0hEIwaA==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dev: false - /decompress-response@6.0.0: resolution: {integrity: sha512-aW35yZM6Bb/4oJlZncMH2LCoZtJXTRxES17vE3hoRiowU2kWHaJKFkSBDnDR+cm9J+9QhXmREyIfv0pji9ejCQ==} engines: {node: '>=10'} @@ -10436,20 +10184,6 @@ packages: vm2: 3.9.19 dev: true - /del@6.1.1: - resolution: {integrity: sha512-ua8BhapfP0JUJKC/zV9yHHDW/rDoDxP4Zhn3AkA6/xT6gY7jYXJiaeyBZznYVujhZZET+UgcbZiQ7sN3WqcImg==} - engines: {node: '>=10'} - dependencies: - globby: 11.1.0 - graceful-fs: 4.2.11 - is-glob: 4.0.3 - is-path-cwd: 2.2.0 - is-path-inside: 3.0.3 - p-map: 4.0.0 - rimraf: 3.0.2 - slash: 3.0.0 - dev: false - /delaunator@5.0.0: resolution: {integrity: sha512-AyLvtyJdbv/U1GkiS6gUUzclRoAY4Gs75qkMygJJhU75LW4DNuSF2RMzpxs9jw9Oz1BobHjTdkG3zdP55VxAqw==} requiresBuild: true @@ -11741,6 +11475,7 @@ packages: graceful-fs: 4.2.11 jsonfile: 6.1.0 universalify: 2.0.0 + dev: true /fs-extra@11.1.1: resolution: {integrity: sha512-MGIE4HOvQCeUCzmlHs0vXpih4ysz4wg9qiSAu6cd42lVwPbTM1TjV7RusoyQqMmk/95gdQZX72u+YW+c3eEpFQ==} @@ -12186,6 +11921,7 @@ packages: /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} + dev: true /grapheme-splitter@1.0.4: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} @@ -12569,13 +12305,6 @@ packages: ms: 2.1.3 dev: true - /humanize-string@3.0.0: - resolution: {integrity: sha512-jhWD2GAZRMELz0IEIfqpEdi0M4CMQF1GpJpBYIopFN6wT+78STiujfQTKcKqZzOJgUkIgJSo2xFeHdsg922JZQ==} - engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} - dependencies: - decamelize: 6.0.0 - dev: false - /i18next-browser-languagedetector@6.1.8: resolution: {integrity: sha512-Svm+MduCElO0Meqpj1kJAriTC6OhI41VhlT/A0UPjGoPZBhAHIaGE5EfsHlTpgdH09UVX7rcc72pSDDBeKSQQA==} dependencies: @@ -12994,11 +12723,6 @@ packages: engines: {node: '>=8'} dev: true - /is-path-cwd@2.2.0: - resolution: {integrity: sha512-w942bTcih8fdJPJmQHFzkS76NEP8Kzzvmw92cXsazb8intwLqPibPPdXf4ANdKV3rYMuuQYGIWtvz9JilB3NFQ==} - engines: {node: '>=6'} - dev: false - /is-path-inside@3.0.3: resolution: {integrity: sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==} engines: {node: '>=8'} @@ -13287,16 +13011,6 @@ packages: topo: 3.0.3 dev: true - /joi@17.9.2: - resolution: {integrity: sha512-Itk/r+V4Dx0V3c7RLFdRh12IOjySm2/WGPMubBT92cQvRfYZhPM2W0hZlctjj72iES8jsRCwp7S/cRmWBnJ4nw==} - dependencies: - '@hapi/hoek': 9.3.0 - '@hapi/topo': 5.1.0 - '@sideway/address': 4.1.4 - '@sideway/formula': 3.0.1 - '@sideway/pinpoint': 2.0.0 - dev: false - /joycon@3.1.1: resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} engines: {node: '>=10'} @@ -13401,6 +13115,7 @@ packages: universalify: 2.0.0 optionalDependencies: graceful-fs: 4.2.11 + dev: true /jsonparse@1.3.1: resolution: {integrity: sha512-POQXvpdL69+CluYsillJ7SUhKvytYjW9vG/GKpnf+xP8UWgYEM/RaMzHHofbALDiKbbP1W8UEYmgGl39WkPZsg==} @@ -13437,16 +13152,6 @@ packages: verror: 1.10.0 dev: true - /junit-report-builder@3.0.1: - resolution: {integrity: sha512-B8AZ2q24iGwPM3j/ZHc9nD0BY1rKhcnWCA1UvT8mhHfR8Vo/HTtg3ojMyo55BgctqQGZG7H8z0+g+mEUc32jgg==} - engines: {node: '>=8'} - dependencies: - date-format: 4.0.3 - lodash: 4.17.21 - make-dir: 3.1.0 - xmlbuilder: 15.1.1 - dev: false - /junit-report-merger@6.0.2: resolution: {integrity: sha512-Jk9PXeaJhbgo3aUNza2r24JgxYzLUtCk2kwrub8fbmDuWUdXhT/nfbM2MlU3JQiFbjVud1bzBWdzr9/GGBWfmA==} engines: {node: '>=14'} @@ -14072,6 +13777,7 @@ packages: engines: {node: '>=8'} dependencies: semver: 6.3.1 + dev: true /make-error@1.3.6: resolution: {integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==} @@ -14362,6 +14068,7 @@ packages: /minimist@1.2.8: resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==} + dev: true /minipass-collect@1.0.2: resolution: {integrity: sha512-6T6lH0H8OG9kITm/Jm6tdooIbogG9e0tLgpY6mphXSm/A9u8Nq1ryBG+Qspiub9LjWlBPsPS3tWQ/Botq4FdxA==} @@ -15294,6 +15001,7 @@ packages: engines: {node: '>=10'} dependencies: aggregate-error: 3.1.0 + dev: true /p-queue@6.6.2: resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} @@ -15582,10 +15290,6 @@ packages: find-up: 4.1.0 dev: true - /plantuml-encoder@1.4.0: - resolution: {integrity: sha512-sxMwpDw/ySY1WB2CE3+IdMuEcWibJ72DDOsXLkSmEaSzwEUaYBT6DWgOfBiHGCux4q433X6+OEFWjlVqp7gL6g==} - dev: false - /plist@3.1.0: resolution: {integrity: sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==} engines: {node: '>=10.4.0'} @@ -16602,6 +16306,7 @@ packages: /semver@6.3.1: resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} hasBin: true + dev: true /semver@7.3.8: resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==} @@ -17943,10 +17648,6 @@ packages: hoek: 6.1.3 dev: true - /toposort@2.0.2: - resolution: {integrity: sha512-0a5EOkAUp8D4moMi2W8ZF8jcga7BgZd91O/yabJCFY8az+XSzeGyTKs0Aoo897iV1Nj6guFq8orWDS96z91oGg==} - dev: false - /totalist@1.1.0: resolution: {integrity: sha512-gduQwd1rOdDMGxFG1gEvhV88Oirdo2p+KjoYFU7k2g+i7n6AFFbDQ5kMPUsW0pNbfQsB/cwXvT1i4Bue0s9g5g==} engines: {node: '>=6'} @@ -18451,6 +18152,7 @@ packages: /universalify@2.0.0: resolution: {integrity: sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==} engines: {node: '>= 10.0.0'} + dev: true /unix-crypt-td-js@1.1.4: resolution: {integrity: sha512-8rMeVYWSIyccIJscb9NdCfZKSRBKYTeVnwmiRYT2ulE3qd1RaDQ0xQDP+rI3ccIWbhu/zuo5cgN8z73belNZgw==} @@ -18634,20 +18336,6 @@ packages: resolution: {integrity: sha512-AFbieoL7a5LMqcnOF04ji+rpXadgOXnZsxQr//r83kLPr7biP7am3g9zbaZIaBGwBRWeSvoMD4mgPdX3e4NWBg==} dev: true - /wait-on@6.0.1: - resolution: {integrity: sha512-zht+KASY3usTY5u2LgaNqn/Cd8MukxLGjdcZxT2ns5QzDmTFc4XoWBgC+C/na+sMRZTuVygQoMYwdcVjHnYIVw==} - engines: {node: '>=10.0.0'} - hasBin: true - dependencies: - axios: 0.25.0 - joi: 17.9.2 - lodash: 4.17.21 - minimist: 1.2.8 - rxjs: 7.8.1 - transitivePeerDependencies: - - debug - dev: false - /watchpack@2.4.0: resolution: {integrity: sha512-Lcvm7MGST/4fup+ifyKi2hjyIAwcdI4HRgtvTpIUxBRhB+RFtUh8XtDOxUfctVCnhVi+QQj49i91OyvzkJl6cg==} engines: {node: '>=10.13.0'} @@ -19103,6 +18791,7 @@ packages: /xmlbuilder@15.1.1: resolution: {integrity: sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==} engines: {node: '>=8.0'} + dev: true /xmldoc@1.3.0: resolution: {integrity: sha512-y7IRWW6PvEnYQZNZFMRLNJw+p3pezM4nKYPfr15g4OOW9i8VpeydycFuipE2297OvZnh3jSb2pxOt9QpkZUVng==}