json-machete 0.6.1-alpha-2f33c8db0.0 → 0.7.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 +7 -7
- package/index.mjs +13 -13
- package/package.json +4 -2
package/index.js
CHANGED
|
@@ -6,10 +6,10 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
6
6
|
|
|
7
7
|
const jsonPtr = require('json-ptr');
|
|
8
8
|
const utils = require('@graphql-mesh/utils');
|
|
9
|
-
const
|
|
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
|
-
const
|
|
12
|
+
const utils$1 = require('@graphql-tools/utils');
|
|
13
13
|
const toJsonSchema = _interopDefault(require('to-json-schema'));
|
|
14
14
|
|
|
15
15
|
(function (OnCircularReference) {
|
|
@@ -322,7 +322,7 @@ function isURL(str) {
|
|
|
322
322
|
const getAbsolute$Ref = (given$ref, baseFilePath) => {
|
|
323
323
|
const [givenExternalFileRelativePath, givenRefPath] = given$ref.split('#');
|
|
324
324
|
if (givenExternalFileRelativePath) {
|
|
325
|
-
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) :
|
|
325
|
+
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) : crossHelpers.path.dirname(baseFilePath);
|
|
326
326
|
const givenExternalFilePath = getAbsolutePath(givenExternalFileRelativePath, cwd);
|
|
327
327
|
if (givenRefPath) {
|
|
328
328
|
return `${givenExternalFilePath}#${givenRefPath}`;
|
|
@@ -346,13 +346,13 @@ function getAbsolutePath(path, cwd) {
|
|
|
346
346
|
if (isURL(cwd)) {
|
|
347
347
|
return normalizeUrl(urlJoin(cwd, path));
|
|
348
348
|
}
|
|
349
|
-
if (
|
|
349
|
+
if (crossHelpers.path.isAbsolute(path)) {
|
|
350
350
|
return path;
|
|
351
351
|
}
|
|
352
|
-
return
|
|
352
|
+
return crossHelpers.path.join(cwd, path);
|
|
353
353
|
}
|
|
354
354
|
function getCwd(path) {
|
|
355
|
-
return isURL(path) ? getCwdForUrl(path) :
|
|
355
|
+
return isURL(path) ? getCwdForUrl(path) : crossHelpers.path.dirname(path);
|
|
356
356
|
}
|
|
357
357
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
358
358
|
async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch = crossUndiciFetch.fetch, headers, } = {}) {
|
|
@@ -506,7 +506,7 @@ function deduplicateJSONSchema(schema, seenMap = new Map()) {
|
|
|
506
506
|
if (titleReserved) {
|
|
507
507
|
schema.title = undefined;
|
|
508
508
|
}
|
|
509
|
-
const stringified =
|
|
509
|
+
const stringified = utils$1.inspect(schema);
|
|
510
510
|
if (titleReserved) {
|
|
511
511
|
schema.title = titleReserved;
|
|
512
512
|
}
|
package/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { JsonPointer } from 'json-ptr';
|
|
2
2
|
import { AggregateError, readFileOrUrl } from '@graphql-mesh/utils';
|
|
3
|
-
import
|
|
3
|
+
import { path } from '@graphql-mesh/cross-helpers';
|
|
4
4
|
import urlJoin from 'url-join';
|
|
5
5
|
import { fetch } from 'cross-undici-fetch';
|
|
6
|
-
import { inspect } from '
|
|
6
|
+
import { inspect } from '@graphql-tools/utils';
|
|
7
7
|
import toJsonSchema from 'to-json-schema';
|
|
8
8
|
|
|
9
9
|
var OnCircularReference;
|
|
@@ -317,7 +317,7 @@ function isURL(str) {
|
|
|
317
317
|
const getAbsolute$Ref = (given$ref, baseFilePath) => {
|
|
318
318
|
const [givenExternalFileRelativePath, givenRefPath] = given$ref.split('#');
|
|
319
319
|
if (givenExternalFileRelativePath) {
|
|
320
|
-
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) :
|
|
320
|
+
const cwd = isURL(baseFilePath) ? getCwdForUrl(baseFilePath) : path.dirname(baseFilePath);
|
|
321
321
|
const givenExternalFilePath = getAbsolutePath(givenExternalFileRelativePath, cwd);
|
|
322
322
|
if (givenRefPath) {
|
|
323
323
|
return `${givenExternalFilePath}#${givenRefPath}`;
|
|
@@ -334,20 +334,20 @@ function getCwdForUrl(url) {
|
|
|
334
334
|
function normalizeUrl(url) {
|
|
335
335
|
return new URL(url).toString();
|
|
336
336
|
}
|
|
337
|
-
function getAbsolutePath(path, cwd) {
|
|
338
|
-
if (isURL(path)) {
|
|
339
|
-
return path;
|
|
337
|
+
function getAbsolutePath(path$1, cwd) {
|
|
338
|
+
if (isURL(path$1)) {
|
|
339
|
+
return path$1;
|
|
340
340
|
}
|
|
341
341
|
if (isURL(cwd)) {
|
|
342
|
-
return normalizeUrl(urlJoin(cwd, path));
|
|
342
|
+
return normalizeUrl(urlJoin(cwd, path$1));
|
|
343
343
|
}
|
|
344
|
-
if (
|
|
345
|
-
return path;
|
|
344
|
+
if (path.isAbsolute(path$1)) {
|
|
345
|
+
return path$1;
|
|
346
346
|
}
|
|
347
|
-
return
|
|
347
|
+
return path.join(cwd, path$1);
|
|
348
348
|
}
|
|
349
|
-
function getCwd(path) {
|
|
350
|
-
return isURL(path) ? getCwdForUrl(path) :
|
|
349
|
+
function getCwd(path$1) {
|
|
350
|
+
return isURL(path$1) ? getCwdForUrl(path$1) : path.dirname(path$1);
|
|
351
351
|
}
|
|
352
352
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
353
353
|
async function dereferenceObject(obj, { cwd = process.cwd(), externalFileCache = new Map(), refMap = new Map(), root = obj, fetch: fetch$1 = fetch, headers, } = {}) {
|
|
@@ -501,7 +501,7 @@ function deduplicateJSONSchema(schema, seenMap = new Map()) {
|
|
|
501
501
|
if (titleReserved) {
|
|
502
502
|
schema.title = undefined;
|
|
503
503
|
}
|
|
504
|
-
const stringified = inspect(schema
|
|
504
|
+
const stringified = inspect(schema);
|
|
505
505
|
if (titleReserved) {
|
|
506
506
|
schema.title = titleReserved;
|
|
507
507
|
}
|
package/package.json
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "json-machete",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@graphql-mesh/
|
|
6
|
+
"@graphql-mesh/cross-helpers": "0.1.0",
|
|
7
|
+
"@graphql-mesh/utils": "0.32.0",
|
|
8
|
+
"@graphql-tools/utils": "8.6.3",
|
|
7
9
|
"@json-schema-tools/meta-schema": "1.6.19",
|
|
8
10
|
"cross-undici-fetch": "0.1.27",
|
|
9
11
|
"json-ptr": "3.1.0",
|