json-machete 0.8.8 → 0.8.9-alpha-aa8d75313.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +9 -9
- package/index.mjs +1 -1
- package/package.json +3 -3
package/index.js
CHANGED
|
@@ -4,9 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
6
|
|
|
7
|
+
const crossHelpers = require('@graphql-mesh/cross-helpers');
|
|
7
8
|
const utils = require('@graphql-tools/utils');
|
|
8
9
|
const JsonPointer = _interopDefault(require('json-pointer'));
|
|
9
|
-
const crossHelpers = require('@graphql-mesh/cross-helpers');
|
|
10
10
|
const urlJoin = _interopDefault(require('url-join'));
|
|
11
11
|
const crossUndiciFetch = require('cross-undici-fetch');
|
|
12
12
|
const utils$1 = require('@graphql-mesh/utils');
|
|
@@ -23,7 +23,7 @@ async function visitJSONSchema(schema, visitorFn, { visitedSubschemaResultMap, p
|
|
|
23
23
|
visitedSubschemaResultMap: new WeakMap(),
|
|
24
24
|
path: '',
|
|
25
25
|
keepObjectRef: false,
|
|
26
|
-
onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
26
|
+
onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
27
27
|
}) {
|
|
28
28
|
if (typeof schema === 'object') {
|
|
29
29
|
if (!visitedSubschemaResultMap.has(schema)) {
|
|
@@ -274,7 +274,7 @@ function getCwd(path) {
|
|
|
274
274
|
return isURL(path) ? getCwdForUrl(path) : crossHelpers.path.dirname(path);
|
|
275
275
|
}
|
|
276
276
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
277
|
-
async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch = crossUndiciFetch.fetch, headers, } = {}) {
|
|
277
|
+
async function dereferenceObject(obj, { cwd = crossHelpers.process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch = crossUndiciFetch.fetch, headers, } = {}) {
|
|
278
278
|
var _a;
|
|
279
279
|
if (obj != null && typeof obj === 'object') {
|
|
280
280
|
if (isRefObject(obj)) {
|
|
@@ -283,7 +283,7 @@ async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache =
|
|
|
283
283
|
return refMap.get($ref);
|
|
284
284
|
}
|
|
285
285
|
else {
|
|
286
|
-
if (process.env.DEBUG) {
|
|
286
|
+
if (crossHelpers.process.env.DEBUG) {
|
|
287
287
|
console.log(`Dereferencing `, obj);
|
|
288
288
|
}
|
|
289
289
|
const [externalRelativeFilePath, refPath] = $ref.split('#');
|
|
@@ -490,7 +490,7 @@ async function compareJSONSchemas(oldSchema, newSchema) {
|
|
|
490
490
|
visitedSubschemaResultMap: new WeakMap(),
|
|
491
491
|
path: '',
|
|
492
492
|
keepObjectRef: true,
|
|
493
|
-
onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
493
|
+
onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
494
494
|
});
|
|
495
495
|
if (breakingChanges.length > 0) {
|
|
496
496
|
throw new utils.AggregateError(breakingChanges.map(breakingChange => new Error(breakingChange)), `Breaking changes are found:\n${breakingChanges.join('\n')}`);
|
|
@@ -554,7 +554,7 @@ async function getDeduplicatedTitles(schema) {
|
|
|
554
554
|
visitedSubschemaResultMap: new WeakMap(),
|
|
555
555
|
path: '',
|
|
556
556
|
keepObjectRef: true,
|
|
557
|
-
onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
557
|
+
onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
558
558
|
});
|
|
559
559
|
return duplicatedTypeNames;
|
|
560
560
|
}
|
|
@@ -563,7 +563,7 @@ async function healJSONSchema(schema) {
|
|
|
563
563
|
const duplicatedTypeNames = await getDeduplicatedTitles(deduplicatedSchema);
|
|
564
564
|
return visitJSONSchema(deduplicatedSchema, async function healSubschema(subSchema, { path }) {
|
|
565
565
|
if (typeof subSchema === 'object') {
|
|
566
|
-
if (process.env.DEBUG) {
|
|
566
|
+
if (crossHelpers.process.env.DEBUG) {
|
|
567
567
|
console.log(`Healing ${path}`);
|
|
568
568
|
}
|
|
569
569
|
// We don't support following properties
|
|
@@ -750,7 +750,7 @@ async function healJSONSchema(schema) {
|
|
|
750
750
|
visitedSubschemaResultMap: new WeakMap(),
|
|
751
751
|
path: '',
|
|
752
752
|
keepObjectRef: true,
|
|
753
|
-
onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
753
|
+
onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
|
|
754
754
|
});
|
|
755
755
|
}
|
|
756
756
|
|
|
@@ -758,7 +758,7 @@ async function referenceJSONSchema(schema) {
|
|
|
758
758
|
const definitions = {};
|
|
759
759
|
const finalSchema = await visitJSONSchema(schema, (subSchema, { path }) => {
|
|
760
760
|
if (typeof subSchema === 'object') {
|
|
761
|
-
if (process.env.DEBUG) {
|
|
761
|
+
if (crossHelpers.process.env.DEBUG) {
|
|
762
762
|
console.log(`Referencing ${path}`);
|
|
763
763
|
}
|
|
764
764
|
// Remove $id refs
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import { process, path } from '@graphql-mesh/cross-helpers';
|
|
1
2
|
import { AggregateError } from '@graphql-tools/utils';
|
|
2
3
|
import JsonPointer from 'json-pointer';
|
|
3
|
-
import { path } from '@graphql-mesh/cross-helpers';
|
|
4
4
|
import urlJoin from 'url-join';
|
|
5
5
|
import { fetch } from 'cross-undici-fetch';
|
|
6
6
|
import { readFileOrUrl } from '@graphql-mesh/utils';
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-machete",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.9-alpha-aa8d75313.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@graphql-mesh/cross-helpers": "0.1.
|
|
7
|
-
"@graphql-mesh/utils": "0.35.0",
|
|
6
|
+
"@graphql-mesh/cross-helpers": "0.1.6-alpha-aa8d75313.0",
|
|
7
|
+
"@graphql-mesh/utils": "0.35.1-alpha-aa8d75313.0",
|
|
8
8
|
"@graphql-tools/utils": "8.6.12",
|
|
9
9
|
"@json-schema-tools/meta-schema": "1.6.19",
|
|
10
10
|
"cross-undici-fetch": "^0.4.0",
|