Skip to content

Commit

Permalink
Resolved merge conflict on types
Browse files Browse the repository at this point in the history
  • Loading branch information
aultac committed Jun 23, 2023
2 parents 4b33a60 + 0e863f4 commit 574a5f3
Show file tree
Hide file tree
Showing 80 changed files with 2,625 additions and 4,626 deletions.
560 changes: 280 additions & 280 deletions .yarn/releases/yarn-3.4.1.cjs → .yarn/releases/yarn-3.5.1.cjs

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
packageExtensions:
'@apidevtools/json-schema-ref-parser@10.1.0':
"@apidevtools/json-schema-ref-parser@10.1.0":
dependencies:
node-fetch: 'npm:node-fetch@^2.6.2'
node-fetch: "npm:node-fetch@^2.6.2"

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-typescript.cjs
spec: '@yarnpkg/plugin-typescript'
spec: "@yarnpkg/plugin-typescript"
- path: .yarn/plugins/@ojkelly/plugin-build.cjs
spec: 'https://yarn.build/latest/build'
spec: "https://yarn.build/latest/build"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: '@yarnpkg/plugin-interactive-tools'
spec: "@yarnpkg/plugin-interactive-tools"
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'
spec: "@yarnpkg/plugin-workspace-tools"

yarnPath: .yarn/releases/yarn-3.4.1.cjs
yarnPath: .yarn/releases/yarn-3.5.1.cjs
32 changes: 16 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,21 @@
"test:dev": "lerna run clean && lerna run build && lerna run test"
},
"devDependencies": {
"@tsconfig/node16": "^1.0.3",
"@typescript-eslint/eslint-plugin": "^5.50.0",
"@typescript-eslint/parser": "^5.50.0",
"@yarnpkg/sdks": "^3.0.0-rc.37",
"@tsconfig/node16": "^1.0.4",
"@typescript-eslint/eslint-plugin": "^5.59.6",
"@typescript-eslint/parser": "^5.59.6",
"@yarnpkg/sdks": "^3.0.0-rc.43",
"coveralls": "^3.1.1",
"eslint": "^8.33.0",
"eslint-config-prettier": "^8.6.0",
"eslint": "^8.40.0",
"eslint-config-prettier": "^8.8.0",
"eslint-config-xo": "^0.43.1",
"eslint-config-xo-typescript": "^0.55.1",
"eslint-config-xo-typescript": "^0.57.0",
"eslint-plugin-array-func": "^3.1.8",
"eslint-plugin-ava": "^14.0.0",
"eslint-plugin-escompat": "^3.3.4",
"eslint-plugin-escompat": "^3.4.0",
"eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-filenames": "^1.3.2",
"eslint-plugin-github": "^4.6.0",
"eslint-plugin-github": "^4.7.0",
"eslint-plugin-i18n-text": "^1.0.1",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-no-constructor-bind": "^2.0.4",
Expand All @@ -40,15 +40,15 @@
"eslint-plugin-optimize-regex": "^1.2.1",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-regexp": "^1.12.0",
"eslint-plugin-regexp": "^1.15.0",
"eslint-plugin-security": "^1.7.1",
"eslint-plugin-sonarjs": "^0.18.0",
"eslint-plugin-unicorn": "^45.0.2",
"lerna": "^6.4.1",
"prettier": "^2.8.3",
"typescript": "4.8.2"
"eslint-plugin-sonarjs": "^0.19.0",
"eslint-plugin-unicorn": "^47.0.0",
"lerna": "^6.6.2",
"prettier": "^2.8.8",
"typescript": "5.0.4"
},
"packageManager": "yarn@3.4.1",
"packageManager": "yarn@3.5.1",
"volta": {
"node": "16.15.1"
}
Expand Down
26 changes: 13 additions & 13 deletions packages/formats/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/formats",
"version": "3.4.3",
"version": "3.5.2",
"description": "Reworked OADA formats",
"keywords": [
"oada",
Expand Down Expand Up @@ -77,23 +77,23 @@
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"ajv-formats-draft2019": "^1.6.1",
"axios": "^1.3.2",
"axios": "^1.4.0",
"glob": "^8.1.0",
"glob-promise": "^5.0.1",
"glob-promise": "^6.0.2",
"tslib": "^2.5.0"
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
"@ava/typescript": "^4.0.0",
"@types/debug": "^4.1.7",
"@types/glob": "^8.0.1",
"@types/mkdirp": "^1.0.2",
"@types/node": "^16.18.11",
"@types/yargs": "^17.0.22",
"ava": "5.1.1",
"c8": "^7.12.0",
"@types/glob": "^8.1.0",
"@types/mkdirp": "^2.0.0",
"@types/node": "^16.18.31",
"@types/yargs": "^17.0.24",
"ava": "5.2.0",
"c8": "^7.13.0",
"debug": "^4.3.4",
"jsonschema8": "^1.1.1",
"mkdirp": "^2.1.3",
"yargs": "^17.6.2"
"jsonschema8": "^2.0.0",
"mkdirp": "^3.0.1",
"yargs": "^17.7.2"
}
}
9 changes: 7 additions & 2 deletions packages/formats/src/ajv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,20 @@
import type { JSONSchema8 as Schema } from 'jsonschema8';

import $ref from '@apidevtools/json-schema-ref-parser';
import { default as Ajv } from 'ajv';
import { default as addFormats } from 'ajv-formats';
import _Ajv from 'ajv';
import _addFormats from 'ajv-formats';
import addFormats2019 from 'ajv-formats-draft2019';
import { default as axios } from 'axios';

import { getSchema as contentTypeToKey } from '@oada/media-types';

import schemas, { requireSchema } from './schemas/index.js';

type Ajv = _Ajv.default;
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare
const Ajv = _Ajv as unknown as typeof _Ajv.default;
const addFormats = _addFormats as unknown as typeof _addFormats.default;

export const ajv: OADAFormats = addFormats2019(
addFormats(
new Ajv({
Expand Down
8 changes: 7 additions & 1 deletion packages/formats/src/migrate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@ import type {
JSONSchema8 as RealSchema,
JSONSchema8 as Schema,
} from 'jsonschema8';
import type { default as Ajv } from 'ajv';
import type _Ajv from 'ajv';
import { mkdirp } from 'mkdirp';

import { contentTypeToKey } from './ajv.js';

import traverse from './traverse.js';

type Ajv = _Ajv.default;

// eslint-disable-next-line @typescript-eslint/no-namespace
export namespace Old {
// The IDs on the generated schemas are weird
Expand Down Expand Up @@ -124,12 +126,14 @@ export async function migrate(
cb(s: Schema) {
// Fix any refs
if (s.$ref) {
// @ts-expect-error modify readonly
s.$ref = fixReference(s.$ref);
}

// Clean up types?
if (!('type' in s)) {
if ('properties' in s) {
// @ts-expect-error modify readonly
(s as JSONSchema8ObjectSchema).type = 'object';
}
} else if ('enum' in s || 'const' in s) {
Expand All @@ -155,6 +159,7 @@ export async function migrate(
// FIXME: Should probably just delete these keys...
// * is not a regex... (.* is)
if ((s as JSONSchema8StringSchema).pattern === '*') {
// @ts-expect-error modify readonly
(s as JSONSchema8StringSchema).pattern = '.*';
}

Expand Down Expand Up @@ -201,6 +206,7 @@ export async function migrate(
// Create "TypeScript" schema
output = `
import { JSONSchema8 as Schema } from 'jsonschema8'
import type Ajv from 'ajv';
const schema: Schema = ${json}
export default schema
Expand Down
10 changes: 5 additions & 5 deletions packages/media-types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/media-types",
"version": "3.4.3",
"version": "3.5.2",
"description": "OADA formats media type resolution",
"keywords": [
"oada",
Expand Down Expand Up @@ -75,8 +75,8 @@
"content-type": "^1.0.5"
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
"ava": "5.1.1",
"c8": "^7.12.0"
"@ava/typescript": "^4.0.0",
"ava": "5.2.0",
"c8": "^7.13.0"
}
}
}
12 changes: 6 additions & 6 deletions packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/formats-server",
"version": "3.4.3",
"version": "3.5.2",
"description": "OADA formats server plugins",
"keywords": [
"oada",
Expand Down Expand Up @@ -91,11 +91,11 @@
}
},
"devDependencies": {
"@ava/typescript": "^3.0.1",
"@ava/typescript": "^4.0.0",
"@types/content-type": "^1.1.5",
"@types/express": "^4.17.16",
"ava": "5.1.1",
"c8": "^7.12.0",
"fastify": "^4.12.0"
"@types/express": "^4.17.17",
"ava": "5.2.0",
"c8": "^7.13.0",
"fastify": "^4.17.0"
}
}
27 changes: 15 additions & 12 deletions packages/types/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oada/types",
"version": "3.4.3",
"version": "3.5.2",
"description": "TypeScript type definitions for OADA formats",
"keywords": [
"oada",
Expand Down Expand Up @@ -84,13 +84,16 @@
"./oada.js": "./dist/types/oada.js",
"./trellis.js": "./dist/types/trellis.js",
"./oada/list/v1.js": "./dist/types/oada/list/v1.js",
"./modus/slim/v1/0.js": "./dist/types/modus/slim/v1/0.js"
"./modus/slim/v1/0.js": "./dist/types/modus/slim/v1/0.js",
"./oada/list-nonresource/v1.js": "./dist/types/oada/list-nonresource/v1.js",
"./oada/service/jobs-change.js": "./dist/types/oada/service/jobs-change.js",
"./trellis/trading-partners/trading-partner.js": "./dist/types/trellis/trading-partners/trading-partner.js"
},
"directories": {
"lib": "dist"
},
"scripts": {
"clean": "yarn g:tsc --clean",
"clean": "yarn g:tsc --clean && rm -rf types dist",
"build": "yarn g:tsc && yarn node --enable-source-maps ./dist/src/compile.js && yarn g:tsc",
"prestart": "npm run build",
"prepare": "npm run build",
Expand Down Expand Up @@ -146,22 +149,22 @@
},
"devDependencies": {
"@apidevtools/json-schema-ref-parser": "^10.1.0",
"@ava/typescript": "^3.0.1",
"@ava/typescript": "^4.0.0",
"@oada/formats": "^3.0.0",
"@types/clone-deep": "^4.0.1",
"@types/debug": "^4.1.7",
"@types/json-schema-merge-allof": "^0.6.1",
"@types/lodash.omit": "^4.5.7",
"@types/mkdirp": "^1.0.2",
"@types/node": "^16.18.11",
"ava": "5.1.1",
"c8": "^7.12.0",
"@types/mkdirp": "^2.0.0",
"@types/node": "^16.18.31",
"ava": "5.2.0",
"c8": "^7.13.0",
"clone-deep": "^4.0.1",
"debug": "^4.3.4",
"json-schema-merge-allof": "^0.8.1",
"json-schema-to-typescript": "^11.0.3",
"jsonschema8": "^1.1.1",
"json-schema-to-typescript": "^11.0.5",
"jsonschema8": "^2.0.0",
"lodash.omit": "^4.5.0",
"mkdirp": "^2.1.3"
"mkdirp": "^3.0.1"
}
}
}
19 changes: 16 additions & 3 deletions packages/types/src/compile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,27 @@ import { promises as fs } from 'node:fs';
import { setTimeout } from 'node:timers/promises';

import { $RefParser } from '@apidevtools/json-schema-ref-parser';
import { default as Ajv } from 'ajv';
import { default as addFormats } from 'ajv-formats';
import _Ajv from 'ajv';
import _addFormats from 'ajv-formats';
import _standaloneCode from 'ajv/dist/standalone/index.js';
import addFormats2019 from 'ajv-formats-draft2019';
import clone from 'clone-deep';
import { compile } from 'json-schema-to-typescript';
import log from 'debug';
import { mkdirp } from 'mkdirp';
import { default as standaloneCode } from 'ajv/dist/standalone/index.js';
import { toSafeString } from 'json-schema-to-typescript/dist/src/utils.js';

import { loadSchema } from '@oada/formats/dist/ajv.js';

import { schemas } from '@oada/formats';

type Ajv = _Ajv.default;
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-redeclare
const Ajv = _Ajv as unknown as typeof _Ajv.default;
const addFormats = _addFormats as unknown as typeof _addFormats.default;
const standaloneCode =
_standaloneCode as unknown as typeof _standaloneCode.default;

const require = createRequire(import.meta.url);

const debug = log('@oada/types:compile:debug');
Expand Down Expand Up @@ -112,6 +119,12 @@ import validate from './${basename(packedfile)}'
*/
export const $id = '${$id}'
/**
* JSON Schema used to generate this type
* @see {@link ${$id}}
*/
export const schema = ${JSON.stringify(schema)} as const;
/**
* Returns true if \`val\` is a @type \`${typeName}\`, false otherwise
*/
Expand Down
6 changes: 2 additions & 4 deletions packages/types/src/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
* https://opensource.org/licenses/MIT.
*/

/* eslint-disable @typescript-eslint/no-duplicate-imports */

// Declare packed validation functions modules
declare module '*-validate.cjs' {
import type { ValidateFunction } from 'ajv';
Expand All @@ -28,13 +26,13 @@ declare module 'json-schema-traverse' {
parentSchema: Schema,
keyIndex: number
) => void;
type Options<Schema> = {
interface Options<Schema> {
cb: Callback<Schema> | { pre: Callback<Schema>; post: Callback<Schema> };
/**
* @default false
*/
allKeys?: boolean;
};
}

type Keywords = Record<string, boolean>;

Expand Down
5 changes: 4 additions & 1 deletion schemas/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,15 @@ import test from 'ava';
import { dirname, isAbsolute, join, relative } from 'node:path';

import { $RefParser } from '@apidevtools/json-schema-ref-parser';
import { default as Ajv } from 'ajv';
import type { JSONSchema6 } from 'json-schema';
import type { JSONSchema8 as Schema } from 'jsonschema8';
import _Ajv from 'ajv';

import schemas, { requireSchema } from './index.js';

// eslint-disable-next-line @typescript-eslint/naming-convention
const Ajv = _Ajv as unknown as typeof _Ajv.default;

/**
* @todo where should this live?
*/
Expand Down
Loading

0 comments on commit 574a5f3

Please sign in to comment.