json-machete 0.8.9 → 0.8.10-alpha-cbbbc8b6d.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.
Files changed (3) hide show
  1. package/index.js +10 -11
  2. package/index.mjs +2 -3
  3. package/package.json +3 -3
package/index.js CHANGED
@@ -4,13 +4,12 @@ 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');
13
- const util = require('util');
14
13
  const toJsonSchema = _interopDefault(require('to-json-schema'));
15
14
 
16
15
  (function (OnCircularReference) {
@@ -23,7 +22,7 @@ async function visitJSONSchema(schema, visitorFn, { visitedSubschemaResultMap, p
23
22
  visitedSubschemaResultMap: new WeakMap(),
24
23
  path: '',
25
24
  keepObjectRef: false,
26
- onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
25
+ onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
27
26
  }) {
28
27
  if (typeof schema === 'object') {
29
28
  if (!visitedSubschemaResultMap.has(schema)) {
@@ -274,7 +273,7 @@ function getCwd(path) {
274
273
  return isURL(path) ? getCwdForUrl(path) : crossHelpers.path.dirname(path);
275
274
  }
276
275
  // 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, } = {}) {
276
+ async function dereferenceObject(obj, { cwd = crossHelpers.process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch = crossUndiciFetch.fetch, headers, } = {}) {
278
277
  var _a;
279
278
  if (obj != null && typeof obj === 'object') {
280
279
  if (isRefObject(obj)) {
@@ -283,7 +282,7 @@ async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache =
283
282
  return refMap.get($ref);
284
283
  }
285
284
  else {
286
- if (process.env.DEBUG) {
285
+ if (crossHelpers.process.env.DEBUG) {
287
286
  console.log(`Dereferencing `, obj);
288
287
  }
289
288
  const [externalRelativeFilePath, refPath] = $ref.split('#');
@@ -490,7 +489,7 @@ async function compareJSONSchemas(oldSchema, newSchema) {
490
489
  visitedSubschemaResultMap: new WeakMap(),
491
490
  path: '',
492
491
  keepObjectRef: true,
493
- onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
492
+ onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
494
493
  });
495
494
  if (breakingChanges.length > 0) {
496
495
  throw new utils.AggregateError(breakingChanges.map(breakingChange => new Error(breakingChange)), `Breaking changes are found:\n${breakingChanges.join('\n')}`);
@@ -521,7 +520,7 @@ function deduplicateJSONSchema(schema, seenMap = new Map()) {
521
520
  if (titleReserved) {
522
521
  schema.title = undefined;
523
522
  }
524
- const stringified = util.inspect(schema, undefined, 3);
523
+ const stringified = crossHelpers.util.inspect(schema, undefined, 3);
525
524
  if (titleReserved) {
526
525
  schema.title = titleReserved;
527
526
  }
@@ -554,7 +553,7 @@ async function getDeduplicatedTitles(schema) {
554
553
  visitedSubschemaResultMap: new WeakMap(),
555
554
  path: '',
556
555
  keepObjectRef: true,
557
- onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
556
+ onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
558
557
  });
559
558
  return duplicatedTypeNames;
560
559
  }
@@ -563,7 +562,7 @@ async function healJSONSchema(schema) {
563
562
  const duplicatedTypeNames = await getDeduplicatedTitles(deduplicatedSchema);
564
563
  return visitJSONSchema(deduplicatedSchema, async function healSubschema(subSchema, { path }) {
565
564
  if (typeof subSchema === 'object') {
566
- if (process.env.DEBUG) {
565
+ if (crossHelpers.process.env.DEBUG) {
567
566
  console.log(`Healing ${path}`);
568
567
  }
569
568
  // We don't support following properties
@@ -750,7 +749,7 @@ async function healJSONSchema(schema) {
750
749
  visitedSubschemaResultMap: new WeakMap(),
751
750
  path: '',
752
751
  keepObjectRef: true,
753
- onCircularReference: process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
752
+ onCircularReference: crossHelpers.process.env.DEBUG ? exports.OnCircularReference.WARN : exports.OnCircularReference.IGNORE,
754
753
  });
755
754
  }
756
755
 
@@ -758,7 +757,7 @@ async function referenceJSONSchema(schema) {
758
757
  const definitions = {};
759
758
  const finalSchema = await visitJSONSchema(schema, (subSchema, { path }) => {
760
759
  if (typeof subSchema === 'object') {
761
- if (process.env.DEBUG) {
760
+ if (crossHelpers.process.env.DEBUG) {
762
761
  console.log(`Referencing ${path}`);
763
762
  }
764
763
  // Remove $id refs
package/index.mjs CHANGED
@@ -1,10 +1,9 @@
1
+ import { process, path, util } 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';
7
- import { inspect } from 'util';
8
7
  import toJsonSchema from 'to-json-schema';
9
8
 
10
9
  var OnCircularReference;
@@ -516,7 +515,7 @@ function deduplicateJSONSchema(schema, seenMap = new Map()) {
516
515
  if (titleReserved) {
517
516
  schema.title = undefined;
518
517
  }
519
- const stringified = inspect(schema, undefined, 3);
518
+ const stringified = util.inspect(schema, undefined, 3);
520
519
  if (titleReserved) {
521
520
  schema.title = titleReserved;
522
521
  }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "json-machete",
3
- "version": "0.8.9",
3
+ "version": "0.8.10-alpha-cbbbc8b6d.0",
4
4
  "sideEffects": false,
5
5
  "dependencies": {
6
- "@graphql-mesh/cross-helpers": "0.1.5",
7
- "@graphql-mesh/utils": "0.35.1",
6
+ "@graphql-mesh/cross-helpers": "0.1.6-alpha-cbbbc8b6d.0",
7
+ "@graphql-mesh/utils": "0.35.2-alpha-cbbbc8b6d.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",