@shopware/api-gen 1.2.0 → 1.3.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/README.md +7 -4
- package/dist/cli.mjs +671 -244
- package/package.json +6 -6
package/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
2
|
import { hideBin } from 'yargs/helpers';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
|
|
4
|
+
import { resolve, join, dirname } from 'node:path';
|
|
5
5
|
import openapiTS, { transformSchemaObjectWithComposition, astToString } from 'openapi-typescript';
|
|
6
6
|
import require$$1$1 from 'fs';
|
|
7
7
|
import require$$1 from 'path';
|
|
@@ -24,7 +24,7 @@ const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
|
24
24
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
25
25
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
26
26
|
const name$1 = "@shopware/api-gen";
|
|
27
|
-
const version$2 = "1.
|
|
27
|
+
const version$2 = "1.3.0";
|
|
28
28
|
const description$1 = "Shopware CLI for API client generation.";
|
|
29
29
|
const author = "Shopware";
|
|
30
30
|
const type$1 = "module";
|
|
@@ -66,18 +66,18 @@ const devDependencies$1 = {
|
|
|
66
66
|
"@biomejs/biome": "1.8.3",
|
|
67
67
|
"@types/prettier": "3.0.0",
|
|
68
68
|
"@types/yargs": "17.0.33",
|
|
69
|
-
"@vitest/coverage-v8": "
|
|
69
|
+
"@vitest/coverage-v8": "3.0.5",
|
|
70
70
|
json5: "2.2.3",
|
|
71
71
|
picocolors: "1.0.1",
|
|
72
72
|
tsconfig: "workspace:*",
|
|
73
73
|
unbuild: "2.0.0",
|
|
74
|
-
vitest: "
|
|
74
|
+
vitest: "3.0.5"
|
|
75
75
|
};
|
|
76
76
|
const dependencies = {
|
|
77
77
|
"@shopware/api-client": "workspace:*",
|
|
78
78
|
ofetch: "1.4.1",
|
|
79
|
-
"openapi-typescript": "7.
|
|
80
|
-
prettier: "3.
|
|
79
|
+
"openapi-typescript": "7.5.2",
|
|
80
|
+
prettier: "3.5.1",
|
|
81
81
|
"ts-morph": "24.0.0",
|
|
82
82
|
yargs: "17.7.2"
|
|
83
83
|
};
|
|
@@ -101,7 +101,7 @@ const packageJson$1 = {
|
|
|
101
101
|
|
|
102
102
|
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
103
103
|
|
|
104
|
-
function getDefaultExportFromCjs$
|
|
104
|
+
function getDefaultExportFromCjs$2 (x) {
|
|
105
105
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
106
106
|
}
|
|
107
107
|
|
|
@@ -197771,7 +197771,7 @@ ${e.message}`;
|
|
|
197771
197771
|
} (typescript));
|
|
197772
197772
|
|
|
197773
197773
|
var typescriptExports = typescript.exports;
|
|
197774
|
-
const ts = /*@__PURE__*/getDefaultExportFromCjs$
|
|
197774
|
+
const ts = /*@__PURE__*/getDefaultExportFromCjs$2(typescriptExports);
|
|
197775
197775
|
|
|
197776
197776
|
var main$1 = {exports: {}};
|
|
197777
197777
|
|
|
@@ -199779,10 +199779,10 @@ picocolors.exports = createColors();
|
|
|
199779
199779
|
picocolors.exports.createColors = createColors;
|
|
199780
199780
|
|
|
199781
199781
|
var picocolorsExports = picocolors.exports;
|
|
199782
|
-
const c = /*@__PURE__*/getDefaultExportFromCjs$
|
|
199782
|
+
const c = /*@__PURE__*/getDefaultExportFromCjs$2(picocolorsExports);
|
|
199783
199783
|
|
|
199784
199784
|
// src/index.ts
|
|
199785
|
-
var f
|
|
199785
|
+
var f = {
|
|
199786
199786
|
reset: [0, 0],
|
|
199787
199787
|
bold: [1, 22, "\x1B[22m\x1B[1m"],
|
|
199788
199788
|
dim: [2, 22, "\x1B[22m\x1B[2m"],
|
|
@@ -199824,7 +199824,7 @@ var f$1 = {
|
|
|
199824
199824
|
bgMagentaBright: [105, 49],
|
|
199825
199825
|
bgCyanBright: [106, 49],
|
|
199826
199826
|
bgWhiteBright: [107, 49]
|
|
199827
|
-
}, h = Object.entries(f
|
|
199827
|
+
}, h = Object.entries(f);
|
|
199828
199828
|
function a(n) {
|
|
199829
199829
|
return String(n);
|
|
199830
199830
|
}
|
|
@@ -199859,8 +199859,22 @@ function p(n = !1) {
|
|
|
199859
199859
|
return u;
|
|
199860
199860
|
}
|
|
199861
199861
|
|
|
199862
|
-
|
|
199863
|
-
|
|
199862
|
+
var s = p();
|
|
199863
|
+
|
|
199864
|
+
function _mergeNamespaces(n, m) {
|
|
199865
|
+
m.forEach(function (e) {
|
|
199866
|
+
e && typeof e !== 'string' && !Array.isArray(e) && Object.keys(e).forEach(function (k) {
|
|
199867
|
+
if (k !== 'default' && !(k in n)) {
|
|
199868
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
199869
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
199870
|
+
enumerable: true,
|
|
199871
|
+
get: function () { return e[k]; }
|
|
199872
|
+
});
|
|
199873
|
+
}
|
|
199874
|
+
});
|
|
199875
|
+
});
|
|
199876
|
+
return Object.freeze(n);
|
|
199877
|
+
}
|
|
199864
199878
|
|
|
199865
199879
|
function getKeysOfEnumerableProperties(object, compareKeys) {
|
|
199866
199880
|
const rawKeys = Object.keys(object);
|
|
@@ -200139,7 +200153,7 @@ function testNode(val) {
|
|
|
200139
200153
|
}
|
|
200140
200154
|
const test$3 = (val) => {
|
|
200141
200155
|
var _a;
|
|
200142
|
-
return ((_a = val == null ?
|
|
200156
|
+
return ((_a = val == null ? undefined : val.constructor) == null ? undefined : _a.name) && testNode(val);
|
|
200143
200157
|
};
|
|
200144
200158
|
function nodeIsText(node) {
|
|
200145
200159
|
return node.nodeType === TEXT_NODE;
|
|
@@ -200223,7 +200237,7 @@ function getRecordEntries(val) {
|
|
|
200223
200237
|
const key = val._keys[i++];
|
|
200224
200238
|
return { done: false, value: [key, val.get(key)] };
|
|
200225
200239
|
}
|
|
200226
|
-
return { done: true, value:
|
|
200240
|
+
return { done: true, value: undefined };
|
|
200227
200241
|
}
|
|
200228
200242
|
};
|
|
200229
200243
|
}
|
|
@@ -200326,6 +200340,313 @@ const serialize$2 = (val, config, indentation, depth, refs, printer) => {
|
|
|
200326
200340
|
const test$2 = (val) => val && (val[IS_ITERABLE_SENTINEL] === true || val[IS_RECORD_SENTINEL] === true);
|
|
200327
200341
|
const plugin$2 = { serialize: serialize$2, test: test$2 };
|
|
200328
200342
|
|
|
200343
|
+
function getDefaultExportFromCjs$1 (x) {
|
|
200344
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
200345
|
+
}
|
|
200346
|
+
|
|
200347
|
+
var reactIs$1 = {exports: {}};
|
|
200348
|
+
|
|
200349
|
+
var reactIs_production = {};
|
|
200350
|
+
|
|
200351
|
+
/**
|
|
200352
|
+
* @license React
|
|
200353
|
+
* react-is.production.js
|
|
200354
|
+
*
|
|
200355
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
200356
|
+
*
|
|
200357
|
+
* This source code is licensed under the MIT license found in the
|
|
200358
|
+
* LICENSE file in the root directory of this source tree.
|
|
200359
|
+
*/
|
|
200360
|
+
|
|
200361
|
+
var hasRequiredReactIs_production;
|
|
200362
|
+
|
|
200363
|
+
function requireReactIs_production () {
|
|
200364
|
+
if (hasRequiredReactIs_production) return reactIs_production;
|
|
200365
|
+
hasRequiredReactIs_production = 1;
|
|
200366
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
200367
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
200368
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
200369
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
200370
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
200371
|
+
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
200372
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
200373
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
200374
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
200375
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
200376
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
200377
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
200378
|
+
REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"),
|
|
200379
|
+
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
200380
|
+
function typeOf(object) {
|
|
200381
|
+
if ("object" === typeof object && null !== object) {
|
|
200382
|
+
var $$typeof = object.$$typeof;
|
|
200383
|
+
switch ($$typeof) {
|
|
200384
|
+
case REACT_ELEMENT_TYPE:
|
|
200385
|
+
switch (((object = object.type), object)) {
|
|
200386
|
+
case REACT_FRAGMENT_TYPE:
|
|
200387
|
+
case REACT_PROFILER_TYPE:
|
|
200388
|
+
case REACT_STRICT_MODE_TYPE:
|
|
200389
|
+
case REACT_SUSPENSE_TYPE:
|
|
200390
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
200391
|
+
return object;
|
|
200392
|
+
default:
|
|
200393
|
+
switch (((object = object && object.$$typeof), object)) {
|
|
200394
|
+
case REACT_CONTEXT_TYPE:
|
|
200395
|
+
case REACT_FORWARD_REF_TYPE:
|
|
200396
|
+
case REACT_LAZY_TYPE:
|
|
200397
|
+
case REACT_MEMO_TYPE:
|
|
200398
|
+
return object;
|
|
200399
|
+
case REACT_CONSUMER_TYPE:
|
|
200400
|
+
return object;
|
|
200401
|
+
default:
|
|
200402
|
+
return $$typeof;
|
|
200403
|
+
}
|
|
200404
|
+
}
|
|
200405
|
+
case REACT_PORTAL_TYPE:
|
|
200406
|
+
return $$typeof;
|
|
200407
|
+
}
|
|
200408
|
+
}
|
|
200409
|
+
}
|
|
200410
|
+
reactIs_production.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
200411
|
+
reactIs_production.ContextProvider = REACT_CONTEXT_TYPE;
|
|
200412
|
+
reactIs_production.Element = REACT_ELEMENT_TYPE;
|
|
200413
|
+
reactIs_production.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
200414
|
+
reactIs_production.Fragment = REACT_FRAGMENT_TYPE;
|
|
200415
|
+
reactIs_production.Lazy = REACT_LAZY_TYPE;
|
|
200416
|
+
reactIs_production.Memo = REACT_MEMO_TYPE;
|
|
200417
|
+
reactIs_production.Portal = REACT_PORTAL_TYPE;
|
|
200418
|
+
reactIs_production.Profiler = REACT_PROFILER_TYPE;
|
|
200419
|
+
reactIs_production.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
200420
|
+
reactIs_production.Suspense = REACT_SUSPENSE_TYPE;
|
|
200421
|
+
reactIs_production.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
200422
|
+
reactIs_production.isContextConsumer = function (object) {
|
|
200423
|
+
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
200424
|
+
};
|
|
200425
|
+
reactIs_production.isContextProvider = function (object) {
|
|
200426
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
200427
|
+
};
|
|
200428
|
+
reactIs_production.isElement = function (object) {
|
|
200429
|
+
return (
|
|
200430
|
+
"object" === typeof object &&
|
|
200431
|
+
null !== object &&
|
|
200432
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
200433
|
+
);
|
|
200434
|
+
};
|
|
200435
|
+
reactIs_production.isForwardRef = function (object) {
|
|
200436
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
200437
|
+
};
|
|
200438
|
+
reactIs_production.isFragment = function (object) {
|
|
200439
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
200440
|
+
};
|
|
200441
|
+
reactIs_production.isLazy = function (object) {
|
|
200442
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
200443
|
+
};
|
|
200444
|
+
reactIs_production.isMemo = function (object) {
|
|
200445
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
200446
|
+
};
|
|
200447
|
+
reactIs_production.isPortal = function (object) {
|
|
200448
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
200449
|
+
};
|
|
200450
|
+
reactIs_production.isProfiler = function (object) {
|
|
200451
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
200452
|
+
};
|
|
200453
|
+
reactIs_production.isStrictMode = function (object) {
|
|
200454
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
200455
|
+
};
|
|
200456
|
+
reactIs_production.isSuspense = function (object) {
|
|
200457
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
200458
|
+
};
|
|
200459
|
+
reactIs_production.isSuspenseList = function (object) {
|
|
200460
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
200461
|
+
};
|
|
200462
|
+
reactIs_production.isValidElementType = function (type) {
|
|
200463
|
+
return "string" === typeof type ||
|
|
200464
|
+
"function" === typeof type ||
|
|
200465
|
+
type === REACT_FRAGMENT_TYPE ||
|
|
200466
|
+
type === REACT_PROFILER_TYPE ||
|
|
200467
|
+
type === REACT_STRICT_MODE_TYPE ||
|
|
200468
|
+
type === REACT_SUSPENSE_TYPE ||
|
|
200469
|
+
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
200470
|
+
type === REACT_OFFSCREEN_TYPE ||
|
|
200471
|
+
("object" === typeof type &&
|
|
200472
|
+
null !== type &&
|
|
200473
|
+
(type.$$typeof === REACT_LAZY_TYPE ||
|
|
200474
|
+
type.$$typeof === REACT_MEMO_TYPE ||
|
|
200475
|
+
type.$$typeof === REACT_CONTEXT_TYPE ||
|
|
200476
|
+
type.$$typeof === REACT_CONSUMER_TYPE ||
|
|
200477
|
+
type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
200478
|
+
type.$$typeof === REACT_CLIENT_REFERENCE ||
|
|
200479
|
+
undefined !== type.getModuleId))
|
|
200480
|
+
? true
|
|
200481
|
+
: false;
|
|
200482
|
+
};
|
|
200483
|
+
reactIs_production.typeOf = typeOf;
|
|
200484
|
+
return reactIs_production;
|
|
200485
|
+
}
|
|
200486
|
+
|
|
200487
|
+
var reactIs_development$1 = {};
|
|
200488
|
+
|
|
200489
|
+
/**
|
|
200490
|
+
* @license React
|
|
200491
|
+
* react-is.development.js
|
|
200492
|
+
*
|
|
200493
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
200494
|
+
*
|
|
200495
|
+
* This source code is licensed under the MIT license found in the
|
|
200496
|
+
* LICENSE file in the root directory of this source tree.
|
|
200497
|
+
*/
|
|
200498
|
+
|
|
200499
|
+
var hasRequiredReactIs_development$1;
|
|
200500
|
+
|
|
200501
|
+
function requireReactIs_development$1 () {
|
|
200502
|
+
if (hasRequiredReactIs_development$1) return reactIs_development$1;
|
|
200503
|
+
hasRequiredReactIs_development$1 = 1;
|
|
200504
|
+
"production" !== process.env.NODE_ENV &&
|
|
200505
|
+
(function () {
|
|
200506
|
+
function typeOf(object) {
|
|
200507
|
+
if ("object" === typeof object && null !== object) {
|
|
200508
|
+
var $$typeof = object.$$typeof;
|
|
200509
|
+
switch ($$typeof) {
|
|
200510
|
+
case REACT_ELEMENT_TYPE:
|
|
200511
|
+
switch (((object = object.type), object)) {
|
|
200512
|
+
case REACT_FRAGMENT_TYPE:
|
|
200513
|
+
case REACT_PROFILER_TYPE:
|
|
200514
|
+
case REACT_STRICT_MODE_TYPE:
|
|
200515
|
+
case REACT_SUSPENSE_TYPE:
|
|
200516
|
+
case REACT_SUSPENSE_LIST_TYPE:
|
|
200517
|
+
return object;
|
|
200518
|
+
default:
|
|
200519
|
+
switch (((object = object && object.$$typeof), object)) {
|
|
200520
|
+
case REACT_CONTEXT_TYPE:
|
|
200521
|
+
case REACT_FORWARD_REF_TYPE:
|
|
200522
|
+
case REACT_LAZY_TYPE:
|
|
200523
|
+
case REACT_MEMO_TYPE:
|
|
200524
|
+
return object;
|
|
200525
|
+
case REACT_CONSUMER_TYPE:
|
|
200526
|
+
return object;
|
|
200527
|
+
default:
|
|
200528
|
+
return $$typeof;
|
|
200529
|
+
}
|
|
200530
|
+
}
|
|
200531
|
+
case REACT_PORTAL_TYPE:
|
|
200532
|
+
return $$typeof;
|
|
200533
|
+
}
|
|
200534
|
+
}
|
|
200535
|
+
}
|
|
200536
|
+
var REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"),
|
|
200537
|
+
REACT_PORTAL_TYPE = Symbol.for("react.portal"),
|
|
200538
|
+
REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"),
|
|
200539
|
+
REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"),
|
|
200540
|
+
REACT_PROFILER_TYPE = Symbol.for("react.profiler");
|
|
200541
|
+
var REACT_CONSUMER_TYPE = Symbol.for("react.consumer"),
|
|
200542
|
+
REACT_CONTEXT_TYPE = Symbol.for("react.context"),
|
|
200543
|
+
REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"),
|
|
200544
|
+
REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"),
|
|
200545
|
+
REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"),
|
|
200546
|
+
REACT_MEMO_TYPE = Symbol.for("react.memo"),
|
|
200547
|
+
REACT_LAZY_TYPE = Symbol.for("react.lazy"),
|
|
200548
|
+
REACT_OFFSCREEN_TYPE = Symbol.for("react.offscreen"),
|
|
200549
|
+
REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference");
|
|
200550
|
+
reactIs_development$1.ContextConsumer = REACT_CONSUMER_TYPE;
|
|
200551
|
+
reactIs_development$1.ContextProvider = REACT_CONTEXT_TYPE;
|
|
200552
|
+
reactIs_development$1.Element = REACT_ELEMENT_TYPE;
|
|
200553
|
+
reactIs_development$1.ForwardRef = REACT_FORWARD_REF_TYPE;
|
|
200554
|
+
reactIs_development$1.Fragment = REACT_FRAGMENT_TYPE;
|
|
200555
|
+
reactIs_development$1.Lazy = REACT_LAZY_TYPE;
|
|
200556
|
+
reactIs_development$1.Memo = REACT_MEMO_TYPE;
|
|
200557
|
+
reactIs_development$1.Portal = REACT_PORTAL_TYPE;
|
|
200558
|
+
reactIs_development$1.Profiler = REACT_PROFILER_TYPE;
|
|
200559
|
+
reactIs_development$1.StrictMode = REACT_STRICT_MODE_TYPE;
|
|
200560
|
+
reactIs_development$1.Suspense = REACT_SUSPENSE_TYPE;
|
|
200561
|
+
reactIs_development$1.SuspenseList = REACT_SUSPENSE_LIST_TYPE;
|
|
200562
|
+
reactIs_development$1.isContextConsumer = function (object) {
|
|
200563
|
+
return typeOf(object) === REACT_CONSUMER_TYPE;
|
|
200564
|
+
};
|
|
200565
|
+
reactIs_development$1.isContextProvider = function (object) {
|
|
200566
|
+
return typeOf(object) === REACT_CONTEXT_TYPE;
|
|
200567
|
+
};
|
|
200568
|
+
reactIs_development$1.isElement = function (object) {
|
|
200569
|
+
return (
|
|
200570
|
+
"object" === typeof object &&
|
|
200571
|
+
null !== object &&
|
|
200572
|
+
object.$$typeof === REACT_ELEMENT_TYPE
|
|
200573
|
+
);
|
|
200574
|
+
};
|
|
200575
|
+
reactIs_development$1.isForwardRef = function (object) {
|
|
200576
|
+
return typeOf(object) === REACT_FORWARD_REF_TYPE;
|
|
200577
|
+
};
|
|
200578
|
+
reactIs_development$1.isFragment = function (object) {
|
|
200579
|
+
return typeOf(object) === REACT_FRAGMENT_TYPE;
|
|
200580
|
+
};
|
|
200581
|
+
reactIs_development$1.isLazy = function (object) {
|
|
200582
|
+
return typeOf(object) === REACT_LAZY_TYPE;
|
|
200583
|
+
};
|
|
200584
|
+
reactIs_development$1.isMemo = function (object) {
|
|
200585
|
+
return typeOf(object) === REACT_MEMO_TYPE;
|
|
200586
|
+
};
|
|
200587
|
+
reactIs_development$1.isPortal = function (object) {
|
|
200588
|
+
return typeOf(object) === REACT_PORTAL_TYPE;
|
|
200589
|
+
};
|
|
200590
|
+
reactIs_development$1.isProfiler = function (object) {
|
|
200591
|
+
return typeOf(object) === REACT_PROFILER_TYPE;
|
|
200592
|
+
};
|
|
200593
|
+
reactIs_development$1.isStrictMode = function (object) {
|
|
200594
|
+
return typeOf(object) === REACT_STRICT_MODE_TYPE;
|
|
200595
|
+
};
|
|
200596
|
+
reactIs_development$1.isSuspense = function (object) {
|
|
200597
|
+
return typeOf(object) === REACT_SUSPENSE_TYPE;
|
|
200598
|
+
};
|
|
200599
|
+
reactIs_development$1.isSuspenseList = function (object) {
|
|
200600
|
+
return typeOf(object) === REACT_SUSPENSE_LIST_TYPE;
|
|
200601
|
+
};
|
|
200602
|
+
reactIs_development$1.isValidElementType = function (type) {
|
|
200603
|
+
return "string" === typeof type ||
|
|
200604
|
+
"function" === typeof type ||
|
|
200605
|
+
type === REACT_FRAGMENT_TYPE ||
|
|
200606
|
+
type === REACT_PROFILER_TYPE ||
|
|
200607
|
+
type === REACT_STRICT_MODE_TYPE ||
|
|
200608
|
+
type === REACT_SUSPENSE_TYPE ||
|
|
200609
|
+
type === REACT_SUSPENSE_LIST_TYPE ||
|
|
200610
|
+
type === REACT_OFFSCREEN_TYPE ||
|
|
200611
|
+
("object" === typeof type &&
|
|
200612
|
+
null !== type &&
|
|
200613
|
+
(type.$$typeof === REACT_LAZY_TYPE ||
|
|
200614
|
+
type.$$typeof === REACT_MEMO_TYPE ||
|
|
200615
|
+
type.$$typeof === REACT_CONTEXT_TYPE ||
|
|
200616
|
+
type.$$typeof === REACT_CONSUMER_TYPE ||
|
|
200617
|
+
type.$$typeof === REACT_FORWARD_REF_TYPE ||
|
|
200618
|
+
type.$$typeof === REACT_CLIENT_REFERENCE ||
|
|
200619
|
+
undefined !== type.getModuleId))
|
|
200620
|
+
? true
|
|
200621
|
+
: false;
|
|
200622
|
+
};
|
|
200623
|
+
reactIs_development$1.typeOf = typeOf;
|
|
200624
|
+
})();
|
|
200625
|
+
return reactIs_development$1;
|
|
200626
|
+
}
|
|
200627
|
+
|
|
200628
|
+
var hasRequiredReactIs$1;
|
|
200629
|
+
|
|
200630
|
+
function requireReactIs$1 () {
|
|
200631
|
+
if (hasRequiredReactIs$1) return reactIs$1.exports;
|
|
200632
|
+
hasRequiredReactIs$1 = 1;
|
|
200633
|
+
|
|
200634
|
+
if (process.env.NODE_ENV === 'production') {
|
|
200635
|
+
reactIs$1.exports = requireReactIs_production();
|
|
200636
|
+
} else {
|
|
200637
|
+
reactIs$1.exports = requireReactIs_development$1();
|
|
200638
|
+
}
|
|
200639
|
+
return reactIs$1.exports;
|
|
200640
|
+
}
|
|
200641
|
+
|
|
200642
|
+
var reactIsExports$1 = /*@__PURE__*/ requireReactIs$1();
|
|
200643
|
+
var index$1 = /*@__PURE__*/getDefaultExportFromCjs$1(reactIsExports$1);
|
|
200644
|
+
|
|
200645
|
+
var ReactIs19 = /*#__PURE__*/_mergeNamespaces({
|
|
200646
|
+
__proto__: null,
|
|
200647
|
+
default: index$1
|
|
200648
|
+
}, [reactIsExports$1]);
|
|
200649
|
+
|
|
200329
200650
|
var reactIs = {exports: {}};
|
|
200330
200651
|
|
|
200331
200652
|
var reactIs_production_min = {};
|
|
@@ -200347,9 +200668,9 @@ function requireReactIs_production_min () {
|
|
|
200347
200668
|
hasRequiredReactIs_production_min = 1;
|
|
200348
200669
|
var b=Symbol.for("react.element"),c=Symbol.for("react.portal"),d=Symbol.for("react.fragment"),e=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),g=Symbol.for("react.provider"),h=Symbol.for("react.context"),k=Symbol.for("react.server_context"),l=Symbol.for("react.forward_ref"),m=Symbol.for("react.suspense"),n=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),q=Symbol.for("react.lazy"),t=Symbol.for("react.offscreen"),u;u=Symbol.for("react.module.reference");
|
|
200349
200670
|
function v(a){if("object"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}reactIs_production_min.ContextConsumer=h;reactIs_production_min.ContextProvider=g;reactIs_production_min.Element=b;reactIs_production_min.ForwardRef=l;reactIs_production_min.Fragment=d;reactIs_production_min.Lazy=q;reactIs_production_min.Memo=p;reactIs_production_min.Portal=c;reactIs_production_min.Profiler=f;reactIs_production_min.StrictMode=e;reactIs_production_min.Suspense=m;
|
|
200350
|
-
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return
|
|
200671
|
+
reactIs_production_min.SuspenseList=n;reactIs_production_min.isAsyncMode=function(){return false};reactIs_production_min.isConcurrentMode=function(){return false};reactIs_production_min.isContextConsumer=function(a){return v(a)===h};reactIs_production_min.isContextProvider=function(a){return v(a)===g};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===b};reactIs_production_min.isForwardRef=function(a){return v(a)===l};reactIs_production_min.isFragment=function(a){return v(a)===d};reactIs_production_min.isLazy=function(a){return v(a)===q};reactIs_production_min.isMemo=function(a){return v(a)===p};
|
|
200351
200672
|
reactIs_production_min.isPortal=function(a){return v(a)===c};reactIs_production_min.isProfiler=function(a){return v(a)===f};reactIs_production_min.isStrictMode=function(a){return v(a)===e};reactIs_production_min.isSuspense=function(a){return v(a)===m};reactIs_production_min.isSuspenseList=function(a){return v(a)===n};
|
|
200352
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||
|
|
200673
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||"object"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||undefined!==a.getModuleId)?true:false};reactIs_production_min.typeOf=v;
|
|
200353
200674
|
return reactIs_production_min;
|
|
200354
200675
|
}
|
|
200355
200676
|
|
|
@@ -200597,7 +200918,33 @@ function requireReactIs () {
|
|
|
200597
200918
|
}
|
|
200598
200919
|
|
|
200599
200920
|
var reactIsExports = requireReactIs();
|
|
200921
|
+
var index = /*@__PURE__*/getDefaultExportFromCjs$1(reactIsExports);
|
|
200600
200922
|
|
|
200923
|
+
var ReactIs18 = /*#__PURE__*/_mergeNamespaces({
|
|
200924
|
+
__proto__: null,
|
|
200925
|
+
default: index
|
|
200926
|
+
}, [reactIsExports]);
|
|
200927
|
+
|
|
200928
|
+
const reactIsMethods = [
|
|
200929
|
+
"isAsyncMode",
|
|
200930
|
+
"isConcurrentMode",
|
|
200931
|
+
"isContextConsumer",
|
|
200932
|
+
"isContextProvider",
|
|
200933
|
+
"isElement",
|
|
200934
|
+
"isForwardRef",
|
|
200935
|
+
"isFragment",
|
|
200936
|
+
"isLazy",
|
|
200937
|
+
"isMemo",
|
|
200938
|
+
"isPortal",
|
|
200939
|
+
"isProfiler",
|
|
200940
|
+
"isStrictMode",
|
|
200941
|
+
"isSuspense",
|
|
200942
|
+
"isSuspenseList",
|
|
200943
|
+
"isValidElementType"
|
|
200944
|
+
];
|
|
200945
|
+
const ReactIs = Object.fromEntries(
|
|
200946
|
+
reactIsMethods.map((m) => [m, (v) => ReactIs18[m](v) || ReactIs19[m](v)])
|
|
200947
|
+
);
|
|
200601
200948
|
function getChildren(arg, children = []) {
|
|
200602
200949
|
if (Array.isArray(arg)) {
|
|
200603
200950
|
for (const item of arg) {
|
|
@@ -200616,27 +200963,27 @@ function getType$1(element) {
|
|
|
200616
200963
|
if (typeof type === "function") {
|
|
200617
200964
|
return type.displayName || type.name || "Unknown";
|
|
200618
200965
|
}
|
|
200619
|
-
if (
|
|
200966
|
+
if (ReactIs.isFragment(element)) {
|
|
200620
200967
|
return "React.Fragment";
|
|
200621
200968
|
}
|
|
200622
|
-
if (
|
|
200969
|
+
if (ReactIs.isSuspense(element)) {
|
|
200623
200970
|
return "React.Suspense";
|
|
200624
200971
|
}
|
|
200625
200972
|
if (typeof type === "object" && type !== null) {
|
|
200626
|
-
if (
|
|
200973
|
+
if (ReactIs.isContextProvider(element)) {
|
|
200627
200974
|
return "Context.Provider";
|
|
200628
200975
|
}
|
|
200629
|
-
if (
|
|
200976
|
+
if (ReactIs.isContextConsumer(element)) {
|
|
200630
200977
|
return "Context.Consumer";
|
|
200631
200978
|
}
|
|
200632
|
-
if (
|
|
200979
|
+
if (ReactIs.isForwardRef(element)) {
|
|
200633
200980
|
if (type.displayName) {
|
|
200634
200981
|
return type.displayName;
|
|
200635
200982
|
}
|
|
200636
200983
|
const functionName = type.render.displayName || type.render.name || "";
|
|
200637
200984
|
return functionName === "" ? "ForwardRef" : `ForwardRef(${functionName})`;
|
|
200638
200985
|
}
|
|
200639
|
-
if (
|
|
200986
|
+
if (ReactIs.isMemo(element)) {
|
|
200640
200987
|
const functionName = type.displayName || type.type.displayName || type.type.name || "";
|
|
200641
200988
|
return functionName === "" ? "Memo" : `Memo(${functionName})`;
|
|
200642
200989
|
}
|
|
@@ -200645,7 +200992,7 @@ function getType$1(element) {
|
|
|
200645
200992
|
}
|
|
200646
200993
|
function getPropKeys$1(element) {
|
|
200647
200994
|
const { props } = element;
|
|
200648
|
-
return Object.keys(props).filter((key) => key !== "children" && props[key] !==
|
|
200995
|
+
return Object.keys(props).filter((key) => key !== "children" && props[key] !== undefined).sort();
|
|
200649
200996
|
}
|
|
200650
200997
|
const serialize$1 = (element, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(getType$1(element), config) : printElement(
|
|
200651
200998
|
getType$1(element),
|
|
@@ -200669,13 +201016,13 @@ const serialize$1 = (element, config, indentation, depth, refs, printer) => ++de
|
|
|
200669
201016
|
config,
|
|
200670
201017
|
indentation
|
|
200671
201018
|
);
|
|
200672
|
-
const test$1 = (val) => val != null &&
|
|
201019
|
+
const test$1 = (val) => val != null && ReactIs.isElement(val);
|
|
200673
201020
|
const plugin$1 = { serialize: serialize$1, test: test$1 };
|
|
200674
201021
|
|
|
200675
201022
|
const testSymbol = typeof Symbol === "function" && Symbol.for ? Symbol.for("react.test.json") : 245830487;
|
|
200676
201023
|
function getPropKeys(object) {
|
|
200677
201024
|
const { props } = object;
|
|
200678
|
-
return props ? Object.keys(props).filter((key) => props[key] !==
|
|
201025
|
+
return props ? Object.keys(props).filter((key) => props[key] !== undefined).sort() : [];
|
|
200679
201026
|
}
|
|
200680
201027
|
const serialize = (object, config, indentation, depth, refs, printer) => ++depth > config.maxDepth ? printElementAsLeaf(object.type, config) : printElement(
|
|
200681
201028
|
object.type,
|
|
@@ -200746,7 +201093,7 @@ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
|
200746
201093
|
if (val === true || val === false) {
|
|
200747
201094
|
return `${val}`;
|
|
200748
201095
|
}
|
|
200749
|
-
if (val ===
|
|
201096
|
+
if (val === undefined) {
|
|
200750
201097
|
return "undefined";
|
|
200751
201098
|
}
|
|
200752
201099
|
if (val === null) {
|
|
@@ -200856,6 +201203,32 @@ function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSO
|
|
|
200856
201203
|
printer
|
|
200857
201204
|
)}}`;
|
|
200858
201205
|
}
|
|
201206
|
+
const ErrorPlugin = {
|
|
201207
|
+
test: (val) => val && val instanceof Error,
|
|
201208
|
+
serialize(val, config, indentation, depth, refs, printer2) {
|
|
201209
|
+
if (refs.includes(val)) {
|
|
201210
|
+
return "[Circular]";
|
|
201211
|
+
}
|
|
201212
|
+
refs = [...refs, val];
|
|
201213
|
+
const hitMaxDepth = ++depth > config.maxDepth;
|
|
201214
|
+
const { message, cause, ...rest } = val;
|
|
201215
|
+
const entries = {
|
|
201216
|
+
message,
|
|
201217
|
+
...typeof cause !== "undefined" ? { cause } : {},
|
|
201218
|
+
...val instanceof AggregateError ? { errors: val.errors } : {},
|
|
201219
|
+
...rest
|
|
201220
|
+
};
|
|
201221
|
+
const name = val.name !== "Error" ? val.name : getConstructorName$1(val);
|
|
201222
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printIteratorEntries(
|
|
201223
|
+
Object.entries(entries).values(),
|
|
201224
|
+
config,
|
|
201225
|
+
indentation,
|
|
201226
|
+
depth,
|
|
201227
|
+
refs,
|
|
201228
|
+
printer2
|
|
201229
|
+
)}}`;
|
|
201230
|
+
}
|
|
201231
|
+
};
|
|
200859
201232
|
function isNewPlugin(plugin) {
|
|
200860
201233
|
return plugin.serialize != null;
|
|
200861
201234
|
}
|
|
@@ -200932,7 +201305,7 @@ const DEFAULT_THEME = {
|
|
|
200932
201305
|
const DEFAULT_THEME_KEYS = Object.keys(DEFAULT_THEME);
|
|
200933
201306
|
const DEFAULT_OPTIONS = {
|
|
200934
201307
|
callToJSON: true,
|
|
200935
|
-
compareKeys:
|
|
201308
|
+
compareKeys: undefined,
|
|
200936
201309
|
escapeRegex: false,
|
|
200937
201310
|
escapeString: true,
|
|
200938
201311
|
highlight: false,
|
|
@@ -200951,7 +201324,7 @@ function validateOptions(options) {
|
|
|
200951
201324
|
throw new Error(`pretty-format: Unknown option "${key}".`);
|
|
200952
201325
|
}
|
|
200953
201326
|
}
|
|
200954
|
-
if (options.min && options.indent !==
|
|
201327
|
+
if (options.min && options.indent !== undefined && options.indent !== 0) {
|
|
200955
201328
|
throw new Error(
|
|
200956
201329
|
'pretty-format: Options "min" and "indent" cannot be used together.'
|
|
200957
201330
|
);
|
|
@@ -200960,7 +201333,7 @@ function validateOptions(options) {
|
|
|
200960
201333
|
function getColorsHighlight() {
|
|
200961
201334
|
return DEFAULT_THEME_KEYS.reduce((colors, key) => {
|
|
200962
201335
|
const value = DEFAULT_THEME[key];
|
|
200963
|
-
const color = value &&
|
|
201336
|
+
const color = value && s[value];
|
|
200964
201337
|
if (color && typeof color.close === "string" && typeof color.open === "string") {
|
|
200965
201338
|
colors[key] = color;
|
|
200966
201339
|
} else {
|
|
@@ -200978,30 +201351,30 @@ function getColorsEmpty() {
|
|
|
200978
201351
|
}, /* @__PURE__ */ Object.create(null));
|
|
200979
201352
|
}
|
|
200980
201353
|
function getPrintFunctionName(options) {
|
|
200981
|
-
return (options == null ?
|
|
201354
|
+
return (options == null ? undefined : options.printFunctionName) ?? DEFAULT_OPTIONS.printFunctionName;
|
|
200982
201355
|
}
|
|
200983
201356
|
function getEscapeRegex(options) {
|
|
200984
|
-
return (options == null ?
|
|
201357
|
+
return (options == null ? undefined : options.escapeRegex) ?? DEFAULT_OPTIONS.escapeRegex;
|
|
200985
201358
|
}
|
|
200986
201359
|
function getEscapeString(options) {
|
|
200987
|
-
return (options == null ?
|
|
201360
|
+
return (options == null ? undefined : options.escapeString) ?? DEFAULT_OPTIONS.escapeString;
|
|
200988
201361
|
}
|
|
200989
201362
|
function getConfig(options) {
|
|
200990
201363
|
return {
|
|
200991
|
-
callToJSON: (options == null ?
|
|
200992
|
-
colors: (options == null ?
|
|
200993
|
-
compareKeys: typeof (options == null ?
|
|
201364
|
+
callToJSON: (options == null ? undefined : options.callToJSON) ?? DEFAULT_OPTIONS.callToJSON,
|
|
201365
|
+
colors: (options == null ? undefined : options.highlight) ? getColorsHighlight() : getColorsEmpty(),
|
|
201366
|
+
compareKeys: typeof (options == null ? undefined : options.compareKeys) === "function" || (options == null ? undefined : options.compareKeys) === null ? options.compareKeys : DEFAULT_OPTIONS.compareKeys,
|
|
200994
201367
|
escapeRegex: getEscapeRegex(options),
|
|
200995
201368
|
escapeString: getEscapeString(options),
|
|
200996
|
-
indent: (options == null ?
|
|
200997
|
-
maxDepth: (options == null ?
|
|
200998
|
-
maxWidth: (options == null ?
|
|
200999
|
-
min: (options == null ?
|
|
201000
|
-
plugins: (options == null ?
|
|
201001
|
-
printBasicPrototype: (options == null ?
|
|
201369
|
+
indent: (options == null ? undefined : options.min) ? "" : createIndent((options == null ? undefined : options.indent) ?? DEFAULT_OPTIONS.indent),
|
|
201370
|
+
maxDepth: (options == null ? undefined : options.maxDepth) ?? DEFAULT_OPTIONS.maxDepth,
|
|
201371
|
+
maxWidth: (options == null ? undefined : options.maxWidth) ?? DEFAULT_OPTIONS.maxWidth,
|
|
201372
|
+
min: (options == null ? undefined : options.min) ?? DEFAULT_OPTIONS.min,
|
|
201373
|
+
plugins: (options == null ? undefined : options.plugins) ?? DEFAULT_OPTIONS.plugins,
|
|
201374
|
+
printBasicPrototype: (options == null ? undefined : options.printBasicPrototype) ?? true,
|
|
201002
201375
|
printFunctionName: getPrintFunctionName(options),
|
|
201003
|
-
spacingInner: (options == null ?
|
|
201004
|
-
spacingOuter: (options == null ?
|
|
201376
|
+
spacingInner: (options == null ? undefined : options.min) ? " " : "\n",
|
|
201377
|
+
spacingOuter: (options == null ? undefined : options.min) ? "" : "\n"
|
|
201005
201378
|
};
|
|
201006
201379
|
}
|
|
201007
201380
|
function createIndent(indent) {
|
|
@@ -201034,7 +201407,8 @@ const plugins = {
|
|
|
201034
201407
|
DOMElement: plugin$3,
|
|
201035
201408
|
Immutable: plugin$2,
|
|
201036
201409
|
ReactElement: plugin$1,
|
|
201037
|
-
ReactTestComponent: plugin
|
|
201410
|
+
ReactTestComponent: plugin,
|
|
201411
|
+
Error: ErrorPlugin
|
|
201038
201412
|
};
|
|
201039
201413
|
|
|
201040
201414
|
let getPromiseValue$1 = () => 'Promise{…}';
|
|
@@ -202116,30 +202490,31 @@ const DIFF_TRUNCATE_THRESHOLD_DEFAULT = 0;
|
|
|
202116
202490
|
function getDefaultOptions() {
|
|
202117
202491
|
return {
|
|
202118
202492
|
aAnnotation: "Expected",
|
|
202119
|
-
aColor:
|
|
202493
|
+
aColor: s.green,
|
|
202120
202494
|
aIndicator: "-",
|
|
202121
202495
|
bAnnotation: "Received",
|
|
202122
|
-
bColor:
|
|
202496
|
+
bColor: s.red,
|
|
202123
202497
|
bIndicator: "+",
|
|
202124
|
-
changeColor:
|
|
202498
|
+
changeColor: s.inverse,
|
|
202125
202499
|
changeLineTrailingSpaceColor: noColor,
|
|
202126
|
-
commonColor:
|
|
202500
|
+
commonColor: s.dim,
|
|
202127
202501
|
commonIndicator: " ",
|
|
202128
202502
|
commonLineTrailingSpaceColor: noColor,
|
|
202129
|
-
compareKeys:
|
|
202503
|
+
compareKeys: undefined,
|
|
202130
202504
|
contextLines: DIFF_CONTEXT_DEFAULT,
|
|
202131
202505
|
emptyFirstOrLastLinePlaceholder: "",
|
|
202132
202506
|
expand: true,
|
|
202133
202507
|
includeChangeCounts: false,
|
|
202134
202508
|
omitAnnotationLines: false,
|
|
202135
|
-
patchColor:
|
|
202509
|
+
patchColor: s.yellow,
|
|
202510
|
+
printBasicPrototype: false,
|
|
202136
202511
|
truncateThreshold: DIFF_TRUNCATE_THRESHOLD_DEFAULT,
|
|
202137
202512
|
truncateAnnotation: "... Diff result is truncated",
|
|
202138
202513
|
truncateAnnotationColor: noColor
|
|
202139
202514
|
};
|
|
202140
202515
|
}
|
|
202141
202516
|
function getCompareKeys(compareKeys) {
|
|
202142
|
-
return compareKeys && typeof compareKeys === "function" ? compareKeys :
|
|
202517
|
+
return compareKeys && typeof compareKeys === "function" ? compareKeys : undefined;
|
|
202143
202518
|
}
|
|
202144
202519
|
function getContextLines(contextLines) {
|
|
202145
202520
|
return typeof contextLines === "number" && Number.isSafeInteger(contextLines) && contextLines >= 0 ? contextLines : DIFF_CONTEXT_DEFAULT;
|
|
@@ -202256,9 +202631,9 @@ function diffLinesUnified2(aLinesDisplay, bLinesDisplay, aLinesCompare, bLinesCo
|
|
|
202256
202631
|
return printDiffLines(diffs, truncated, normalizeDiffOptions(options));
|
|
202257
202632
|
}
|
|
202258
202633
|
function diffLinesRaw(aLines, bLines, options) {
|
|
202259
|
-
const truncate = (options == null ?
|
|
202634
|
+
const truncate = (options == null ? undefined : options.truncateThreshold) ?? false;
|
|
202260
202635
|
const truncateThreshold = Math.max(
|
|
202261
|
-
Math.floor((options == null ?
|
|
202636
|
+
Math.floor((options == null ? undefined : options.truncateThreshold) ?? 0),
|
|
202262
202637
|
0
|
|
202263
202638
|
);
|
|
202264
202639
|
const aLength = truncate ? Math.min(aLines.length, truncateThreshold) : aLines.length;
|
|
@@ -202290,7 +202665,7 @@ function diffLinesRaw(aLines, bLines, options) {
|
|
|
202290
202665
|
}
|
|
202291
202666
|
|
|
202292
202667
|
function getType(value) {
|
|
202293
|
-
if (value ===
|
|
202668
|
+
if (value === undefined) {
|
|
202294
202669
|
return "undefined";
|
|
202295
202670
|
} else if (value === null) {
|
|
202296
202671
|
return "null";
|
|
@@ -202343,14 +202718,15 @@ const PLUGINS = [
|
|
|
202343
202718
|
DOMElement,
|
|
202344
202719
|
DOMCollection,
|
|
202345
202720
|
Immutable,
|
|
202346
|
-
AsymmetricMatcher
|
|
202721
|
+
AsymmetricMatcher,
|
|
202722
|
+
plugins.Error
|
|
202347
202723
|
];
|
|
202348
202724
|
const FORMAT_OPTIONS = {
|
|
202349
202725
|
plugins: PLUGINS
|
|
202350
202726
|
};
|
|
202351
202727
|
const FALLBACK_FORMAT_OPTIONS = {
|
|
202352
202728
|
callToJSON: false,
|
|
202353
|
-
maxDepth:
|
|
202729
|
+
maxDepth: 8,
|
|
202354
202730
|
plugins: PLUGINS
|
|
202355
202731
|
};
|
|
202356
202732
|
function diff(a, b, options) {
|
|
@@ -202362,19 +202738,25 @@ function diff(a, b, options) {
|
|
|
202362
202738
|
let omitDifference = false;
|
|
202363
202739
|
if (aType === "object" && typeof a.asymmetricMatch === "function") {
|
|
202364
202740
|
if (a.$$typeof !== Symbol.for("jest.asymmetricMatcher")) {
|
|
202365
|
-
return
|
|
202741
|
+
return undefined;
|
|
202366
202742
|
}
|
|
202367
202743
|
if (typeof a.getExpectedType !== "function") {
|
|
202368
|
-
return
|
|
202744
|
+
return undefined;
|
|
202369
202745
|
}
|
|
202370
202746
|
expectedType = a.getExpectedType();
|
|
202371
202747
|
omitDifference = expectedType === "string";
|
|
202372
202748
|
}
|
|
202373
202749
|
if (expectedType !== getType(b)) {
|
|
202750
|
+
let truncate2 = function(s) {
|
|
202751
|
+
return s.length <= MAX_LENGTH ? s : `${s.slice(0, MAX_LENGTH)}...`;
|
|
202752
|
+
};
|
|
202374
202753
|
const { aAnnotation, aColor, aIndicator, bAnnotation, bColor, bIndicator } = normalizeDiffOptions(options);
|
|
202375
202754
|
const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
|
|
202376
|
-
|
|
202377
|
-
|
|
202755
|
+
let aDisplay = format(a, formatOptions);
|
|
202756
|
+
let bDisplay = format(b, formatOptions);
|
|
202757
|
+
const MAX_LENGTH = 1e5;
|
|
202758
|
+
aDisplay = truncate2(aDisplay);
|
|
202759
|
+
bDisplay = truncate2(bDisplay);
|
|
202378
202760
|
const aDiff = `${aColor(`${aIndicator} ${aAnnotation}:`)}
|
|
202379
202761
|
${aDisplay}`;
|
|
202380
202762
|
const bDiff = `${bColor(`${bIndicator} ${bAnnotation}:`)}
|
|
@@ -202384,7 +202766,7 @@ ${bDisplay}`;
|
|
|
202384
202766
|
${bDiff}`;
|
|
202385
202767
|
}
|
|
202386
202768
|
if (omitDifference) {
|
|
202387
|
-
return
|
|
202769
|
+
return undefined;
|
|
202388
202770
|
}
|
|
202389
202771
|
switch (aType) {
|
|
202390
202772
|
case "string":
|
|
@@ -202421,7 +202803,7 @@ function compareObjects(a, b, options) {
|
|
|
202421
202803
|
hasThrown = true;
|
|
202422
202804
|
}
|
|
202423
202805
|
const noDiffMessage = getCommonMessage(NO_DIFF_MESSAGE, options);
|
|
202424
|
-
if (difference ===
|
|
202806
|
+
if (difference === undefined || difference === noDiffMessage) {
|
|
202425
202807
|
const formatOptions = getFormatOptions(FALLBACK_FORMAT_OPTIONS, options);
|
|
202426
202808
|
difference = getObjectsDifference(a, b, formatOptions, options);
|
|
202427
202809
|
if (difference !== noDiffMessage && !hasThrown) {
|
|
@@ -202436,10 +202818,11 @@ ${difference}`;
|
|
|
202436
202818
|
return difference;
|
|
202437
202819
|
}
|
|
202438
202820
|
function getFormatOptions(formatOptions, options) {
|
|
202439
|
-
const { compareKeys } = normalizeDiffOptions(options);
|
|
202821
|
+
const { compareKeys, printBasicPrototype } = normalizeDiffOptions(options);
|
|
202440
202822
|
return {
|
|
202441
202823
|
...formatOptions,
|
|
202442
|
-
compareKeys
|
|
202824
|
+
compareKeys,
|
|
202825
|
+
printBasicPrototype
|
|
202443
202826
|
};
|
|
202444
202827
|
}
|
|
202445
202828
|
function getObjectsDifference(a, b, formatOptions, options) {
|
|
@@ -206509,11 +206892,11 @@ const ASYMMETRIC_MATCHERS_OBJECT = Symbol.for(
|
|
|
206509
206892
|
"asymmetric-matchers-object"
|
|
206510
206893
|
);
|
|
206511
206894
|
|
|
206512
|
-
|
|
206513
|
-
|
|
206514
|
-
|
|
206515
|
-
|
|
206516
|
-
|
|
206895
|
+
s.green;
|
|
206896
|
+
s.red;
|
|
206897
|
+
s.inverse;
|
|
206898
|
+
s.bold;
|
|
206899
|
+
s.dim;
|
|
206517
206900
|
|
|
206518
206901
|
function equals(a, b, customTesters, strictCheck) {
|
|
206519
206902
|
customTesters = customTesters || [];
|
|
@@ -206526,7 +206909,7 @@ function asymmetricMatch(a, b) {
|
|
|
206526
206909
|
const asymmetricA = isAsymmetric(a);
|
|
206527
206910
|
const asymmetricB = isAsymmetric(b);
|
|
206528
206911
|
if (asymmetricA && asymmetricB) {
|
|
206529
|
-
return
|
|
206912
|
+
return undefined;
|
|
206530
206913
|
}
|
|
206531
206914
|
if (asymmetricA) {
|
|
206532
206915
|
return a.asymmetricMatch(b);
|
|
@@ -206538,7 +206921,7 @@ function asymmetricMatch(a, b) {
|
|
|
206538
206921
|
function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
206539
206922
|
let result = true;
|
|
206540
206923
|
const asymmetricResult = asymmetricMatch(a, b);
|
|
206541
|
-
if (asymmetricResult !==
|
|
206924
|
+
if (asymmetricResult !== undefined) {
|
|
206542
206925
|
return asymmetricResult;
|
|
206543
206926
|
}
|
|
206544
206927
|
const testerContext = { equals };
|
|
@@ -206549,13 +206932,10 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
206549
206932
|
b,
|
|
206550
206933
|
customTesters
|
|
206551
206934
|
);
|
|
206552
|
-
if (customTesterResult !==
|
|
206935
|
+
if (customTesterResult !== undefined) {
|
|
206553
206936
|
return customTesterResult;
|
|
206554
206937
|
}
|
|
206555
206938
|
}
|
|
206556
|
-
if (a instanceof Error && b instanceof Error) {
|
|
206557
|
-
return a.message === b.message;
|
|
206558
|
-
}
|
|
206559
206939
|
if (typeof URL === "function" && a instanceof URL && b instanceof URL) {
|
|
206560
206940
|
return a.href === b.href;
|
|
206561
206941
|
}
|
|
@@ -206608,6 +206988,14 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
206608
206988
|
if (className === "[object Array]" && a.length !== b.length) {
|
|
206609
206989
|
return false;
|
|
206610
206990
|
}
|
|
206991
|
+
if (a instanceof Error && b instanceof Error) {
|
|
206992
|
+
try {
|
|
206993
|
+
return isErrorEqual(a, b, aStack, bStack, customTesters, hasKey2);
|
|
206994
|
+
} finally {
|
|
206995
|
+
aStack.pop();
|
|
206996
|
+
bStack.pop();
|
|
206997
|
+
}
|
|
206998
|
+
}
|
|
206611
206999
|
const aKeys = keys(a, hasKey2);
|
|
206612
207000
|
let key;
|
|
206613
207001
|
let size = aKeys.length;
|
|
@@ -206625,6 +207013,17 @@ function eq(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
|
206625
207013
|
bStack.pop();
|
|
206626
207014
|
return result;
|
|
206627
207015
|
}
|
|
207016
|
+
function isErrorEqual(a, b, aStack, bStack, customTesters, hasKey2) {
|
|
207017
|
+
let result = Object.getPrototypeOf(a) === Object.getPrototypeOf(b) && a.name === b.name && a.message === b.message;
|
|
207018
|
+
if (typeof b.cause !== "undefined") {
|
|
207019
|
+
result && (result = eq(a.cause, b.cause, aStack, bStack, customTesters, hasKey2));
|
|
207020
|
+
}
|
|
207021
|
+
if (a instanceof AggregateError && b instanceof AggregateError) {
|
|
207022
|
+
result && (result = eq(a.errors, b.errors, aStack, bStack, customTesters, hasKey2));
|
|
207023
|
+
}
|
|
207024
|
+
result && (result = eq({ ...a }, { ...b }, aStack, bStack, customTesters, hasKey2));
|
|
207025
|
+
return result;
|
|
207026
|
+
}
|
|
206628
207027
|
function keys(obj, hasKey2) {
|
|
206629
207028
|
const keys2 = [];
|
|
206630
207029
|
for (const key in obj) {
|
|
@@ -206639,7 +207038,7 @@ function keys(obj, hasKey2) {
|
|
|
206639
207038
|
);
|
|
206640
207039
|
}
|
|
206641
207040
|
function hasDefinedKey(obj, key) {
|
|
206642
|
-
return hasKey(obj, key) && obj[key] !==
|
|
207041
|
+
return hasKey(obj, key) && obj[key] !== undefined;
|
|
206643
207042
|
}
|
|
206644
207043
|
function hasKey(obj, key) {
|
|
206645
207044
|
return Object.prototype.hasOwnProperty.call(obj, key);
|
|
@@ -206655,7 +207054,7 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
|
206655
207054
|
const globalState = /* @__PURE__ */ new WeakMap();
|
|
206656
207055
|
const matchers = /* @__PURE__ */ Object.create(null);
|
|
206657
207056
|
const customEqualityTesters = [];
|
|
206658
|
-
const
|
|
207057
|
+
const asymmetricMatchers = /* @__PURE__ */ Object.create(null);
|
|
206659
207058
|
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
206660
207059
|
get: () => globalState
|
|
206661
207060
|
});
|
|
@@ -206668,7 +207067,7 @@ if (!Object.prototype.hasOwnProperty.call(globalThis, MATCHERS_OBJECT)) {
|
|
|
206668
207067
|
})
|
|
206669
207068
|
});
|
|
206670
207069
|
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
|
|
206671
|
-
get: () =>
|
|
207070
|
+
get: () => asymmetricMatchers
|
|
206672
207071
|
});
|
|
206673
207072
|
}
|
|
206674
207073
|
|
|
@@ -206745,115 +207144,115 @@ function patchJsonSchema({
|
|
|
206745
207144
|
openApiSchema,
|
|
206746
207145
|
jsonOverrides
|
|
206747
207146
|
}) {
|
|
207147
|
+
var _a;
|
|
206748
207148
|
const patchedSchema = lib.parse(lib.stringify(openApiSchema));
|
|
207149
|
+
patchedSchema.components ?? (patchedSchema.components = {});
|
|
207150
|
+
(_a = patchedSchema.components).schemas ?? (_a.schemas = {});
|
|
207151
|
+
patchedSchema.paths ?? (patchedSchema.paths = {});
|
|
206749
207152
|
let alreadyApliedPatches = 0;
|
|
206750
207153
|
const outdatedPatches = [];
|
|
206751
207154
|
let appliedPatches = 0;
|
|
206752
207155
|
const todosToFix = [];
|
|
206753
207156
|
const schemaPaths = [];
|
|
206754
|
-
|
|
207157
|
+
function _applyPatches(initialObject, schemaName, overridePatches, originalSchema) {
|
|
207158
|
+
let patchedObject = initialObject;
|
|
207159
|
+
const patches = Array.isArray(overridePatches) ? overridePatches : [overridePatches];
|
|
207160
|
+
for (const patch of patches) {
|
|
207161
|
+
patchedObject = extendedDefu(patch, patchedObject);
|
|
207162
|
+
}
|
|
207163
|
+
const matchResult = equals(patchedObject, originalSchema);
|
|
207164
|
+
if (matchResult) {
|
|
207165
|
+
outdatedPatches.push([
|
|
207166
|
+
`${c.gray(
|
|
207167
|
+
`
|
|
207168
|
+
${c.bold("Info")}: Patch for ${c.bold(schemaName)} is already applied in schema. You can remove it from overrides.`
|
|
207169
|
+
)}`,
|
|
207170
|
+
c.red(lib.stringify(patches))
|
|
207171
|
+
]);
|
|
207172
|
+
alreadyApliedPatches++;
|
|
207173
|
+
} else {
|
|
207174
|
+
appliedPatches++;
|
|
207175
|
+
todosToFix.push([
|
|
207176
|
+
`Patch for "${c.cyan(schemaName)}" is missing in schema.
|
|
207177
|
+
Patched object:
|
|
207178
|
+
${c.cyan(
|
|
207179
|
+
lib.stringify(patchedObject)
|
|
207180
|
+
)}`,
|
|
207181
|
+
diff(patchedObject, originalSchema, {
|
|
207182
|
+
aColor: c.green,
|
|
207183
|
+
bColor: c.red
|
|
207184
|
+
}) || ""
|
|
207185
|
+
]);
|
|
207186
|
+
}
|
|
207187
|
+
return patchedObject;
|
|
207188
|
+
}
|
|
207189
|
+
function _applyPathPatches(pathName, httpMethod, overridePatches) {
|
|
207190
|
+
var _a2, _b;
|
|
207191
|
+
(_a2 = patchedSchema.paths)[pathName] ?? (_a2[pathName] = {});
|
|
207192
|
+
(_b = patchedSchema.paths[pathName])[httpMethod] ?? (_b[httpMethod] = {});
|
|
207193
|
+
patchedSchema.paths[pathName][httpMethod] = _applyPatches(
|
|
207194
|
+
patchedSchema.paths[pathName][httpMethod],
|
|
207195
|
+
`${pathName} ${httpMethod}`,
|
|
207196
|
+
overridePatches,
|
|
207197
|
+
openApiSchema.paths?.[pathName]?.[httpMethod]
|
|
207198
|
+
);
|
|
207199
|
+
}
|
|
207200
|
+
function _applyComponentsPatches(pathName, overridePatches) {
|
|
207201
|
+
var _a2;
|
|
207202
|
+
(_a2 = patchedSchema.components.schemas)[pathName] ?? (_a2[pathName] = {});
|
|
207203
|
+
patchedSchema.components.schemas[pathName] = _applyPatches(
|
|
207204
|
+
patchedSchema.components.schemas[pathName],
|
|
207205
|
+
pathName,
|
|
207206
|
+
overridePatches,
|
|
207207
|
+
openApiSchema.components?.schemas?.[pathName]
|
|
207208
|
+
);
|
|
207209
|
+
}
|
|
207210
|
+
for (const schemaName of Object.keys(
|
|
206755
207211
|
openApiSchema.components?.schemas || {}
|
|
206756
207212
|
)) {
|
|
206757
207213
|
if (jsonOverrides?.components?.[schemaName]) {
|
|
206758
207214
|
const overridePatches = jsonOverrides?.components[schemaName];
|
|
206759
|
-
|
|
206760
|
-
for (const patch of patches) {
|
|
206761
|
-
const mergedPatch = extendedDefu(patch, schema);
|
|
206762
|
-
patchedSchema.components.schemas[schemaName] = extendedDefu(
|
|
206763
|
-
patch,
|
|
206764
|
-
patchedSchema.components.schemas[schemaName]
|
|
206765
|
-
);
|
|
206766
|
-
appliedPatches++;
|
|
206767
|
-
const matchResult = equals(mergedPatch, schema);
|
|
206768
|
-
if (matchResult) {
|
|
206769
|
-
outdatedPatches.push([
|
|
206770
|
-
`${c.gray(
|
|
206771
|
-
`
|
|
206772
|
-
${c.bold("Info")}: Patch for ${c.bold(schemaName)} is already applied in schema. You can remove it from overrides.`
|
|
206773
|
-
)}`,
|
|
206774
|
-
c.red(lib.stringify(patch))
|
|
206775
|
-
]);
|
|
206776
|
-
alreadyApliedPatches++;
|
|
206777
|
-
} else {
|
|
206778
|
-
todosToFix.push([
|
|
206779
|
-
`Patch for ${c.cyan(
|
|
206780
|
-
c.bold(schemaName)
|
|
206781
|
-
)} is missing in schema.
|
|
206782
|
-
Patch:
|
|
206783
|
-
${c.cyan(
|
|
206784
|
-
lib.stringify(patch)
|
|
206785
|
-
)}`,
|
|
206786
|
-
diff(mergedPatch, schema, {
|
|
206787
|
-
aColor: c.green,
|
|
206788
|
-
bColor: c.red
|
|
206789
|
-
}) || ""
|
|
206790
|
-
]);
|
|
206791
|
-
}
|
|
206792
|
-
}
|
|
207215
|
+
_applyComponentsPatches(schemaName, overridePatches);
|
|
206793
207216
|
}
|
|
206794
207217
|
}
|
|
206795
|
-
for (const [schemaName,
|
|
207218
|
+
for (const [schemaName, patches] of Object.entries(
|
|
206796
207219
|
jsonOverrides?.components || {}
|
|
206797
207220
|
)) {
|
|
206798
207221
|
if (!openApiSchema.components?.schemas?.[schemaName]) {
|
|
206799
|
-
|
|
206800
|
-
|
|
206801
|
-
|
|
206802
|
-
|
|
206803
|
-
|
|
207222
|
+
_applyComponentsPatches(schemaName, patches);
|
|
207223
|
+
}
|
|
207224
|
+
}
|
|
207225
|
+
for (const [pathName, methodObject] of Object.entries(
|
|
207226
|
+
jsonOverrides?.paths || {}
|
|
207227
|
+
)) {
|
|
207228
|
+
for (const [httpMethod, overridePatches] of Object.entries(
|
|
207229
|
+
methodObject || {}
|
|
207230
|
+
)) {
|
|
207231
|
+
if (!openApiSchema.paths?.[pathName]?.[httpMethod]) {
|
|
207232
|
+
_applyPathPatches(
|
|
207233
|
+
pathName,
|
|
207234
|
+
httpMethod,
|
|
207235
|
+
overridePatches
|
|
206804
207236
|
);
|
|
206805
|
-
appliedPatches++;
|
|
206806
207237
|
}
|
|
206807
207238
|
}
|
|
206808
207239
|
}
|
|
206809
207240
|
for (const [pathName, pathObject] of Object.entries(
|
|
206810
207241
|
openApiSchema?.paths || {}
|
|
206811
207242
|
)) {
|
|
206812
|
-
for (const
|
|
207243
|
+
for (const httpMethod of Object.keys(pathObject)) {
|
|
207244
|
+
if (!(httpMethod in pathObject)) continue;
|
|
206813
207245
|
schemaPaths.push({
|
|
206814
207246
|
path: pathName,
|
|
206815
207247
|
method: httpMethod.toUpperCase()
|
|
206816
207248
|
});
|
|
206817
207249
|
if (jsonOverrides?.paths?.[pathName]?.[httpMethod]) {
|
|
206818
207250
|
const overridePatches = jsonOverrides?.paths[pathName][httpMethod];
|
|
206819
|
-
|
|
206820
|
-
|
|
206821
|
-
|
|
206822
|
-
|
|
206823
|
-
|
|
206824
|
-
);
|
|
206825
|
-
patchedSchema.paths[pathName][httpMethod] = extendedDefu(
|
|
206826
|
-
patch,
|
|
206827
|
-
patchedSchema.paths[pathName][httpMethod]
|
|
206828
|
-
);
|
|
206829
|
-
appliedPatches++;
|
|
206830
|
-
const matchResult = equals(mergedPatch, singlePath[1]);
|
|
206831
|
-
if (matchResult) {
|
|
206832
|
-
outdatedPatches.push([
|
|
206833
|
-
`${c.gray(
|
|
206834
|
-
`
|
|
206835
|
-
${c.bold("Info")}: Patch for "${c.bold(pathName)} ${c.bold(httpMethod)}" is already applied in schema. You can remove it from overrides.`
|
|
206836
|
-
)}`,
|
|
206837
|
-
c.red(lib.stringify(patch))
|
|
206838
|
-
]);
|
|
206839
|
-
alreadyApliedPatches++;
|
|
206840
|
-
} else {
|
|
206841
|
-
todosToFix.push([
|
|
206842
|
-
`Patch for ${c.cyan(
|
|
206843
|
-
c.bold(pathName)
|
|
206844
|
-
)} ${httpMethod} is missing in schema.
|
|
206845
|
-
Patch:
|
|
206846
|
-
${c.cyan(
|
|
206847
|
-
lib.stringify(patch)
|
|
206848
|
-
)}`,
|
|
206849
|
-
diff(mergedPatch, singlePath[1], {
|
|
206850
|
-
aColor: c.green,
|
|
206851
|
-
bColor: c.red
|
|
206852
|
-
}) || "",
|
|
206853
|
-
"\n\n"
|
|
206854
|
-
]);
|
|
206855
|
-
}
|
|
206856
|
-
}
|
|
207251
|
+
_applyPathPatches(
|
|
207252
|
+
pathName,
|
|
207253
|
+
httpMethod,
|
|
207254
|
+
overridePatches
|
|
207255
|
+
);
|
|
206857
207256
|
}
|
|
206858
207257
|
const requestBody = patchedSchema.paths[pathName][httpMethod].requestBody;
|
|
206859
207258
|
if (requestBody) {
|
|
@@ -206871,6 +207270,77 @@ ${c.cyan(
|
|
|
206871
207270
|
};
|
|
206872
207271
|
}
|
|
206873
207272
|
|
|
207273
|
+
function getTypePropertyNames(type) {
|
|
207274
|
+
return type.getProperties().map((prop) => prop.name);
|
|
207275
|
+
}
|
|
207276
|
+
function getDeepProperty({
|
|
207277
|
+
type,
|
|
207278
|
+
names,
|
|
207279
|
+
node,
|
|
207280
|
+
typeChecker
|
|
207281
|
+
}) {
|
|
207282
|
+
if (names.length === 0) {
|
|
207283
|
+
return type;
|
|
207284
|
+
}
|
|
207285
|
+
const [currentName, ...restNames] = names;
|
|
207286
|
+
const property = type.getProperty(currentName);
|
|
207287
|
+
if (!property) {
|
|
207288
|
+
return void 0;
|
|
207289
|
+
}
|
|
207290
|
+
const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, node);
|
|
207291
|
+
return getDeepProperty({
|
|
207292
|
+
type: propertyType,
|
|
207293
|
+
names: restNames,
|
|
207294
|
+
node,
|
|
207295
|
+
typeChecker
|
|
207296
|
+
});
|
|
207297
|
+
}
|
|
207298
|
+
function getDeepPropertyCode({
|
|
207299
|
+
type,
|
|
207300
|
+
names,
|
|
207301
|
+
node,
|
|
207302
|
+
typeChecker
|
|
207303
|
+
}) {
|
|
207304
|
+
const namesWithoutLast = names.slice(0, -1);
|
|
207305
|
+
const currentName = names[names.length - 1];
|
|
207306
|
+
const deepProperty = getDeepProperty({
|
|
207307
|
+
type,
|
|
207308
|
+
names: namesWithoutLast,
|
|
207309
|
+
node,
|
|
207310
|
+
typeChecker
|
|
207311
|
+
});
|
|
207312
|
+
if (deepProperty) {
|
|
207313
|
+
const property = deepProperty.getProperty(currentName);
|
|
207314
|
+
if (!property) {
|
|
207315
|
+
return void 0;
|
|
207316
|
+
}
|
|
207317
|
+
return property.valueDeclaration?.getText().replace(/^[^:]+:/, "");
|
|
207318
|
+
}
|
|
207319
|
+
}
|
|
207320
|
+
function isOptional(symbol) {
|
|
207321
|
+
const declarations = symbol.getDeclarations();
|
|
207322
|
+
if (!declarations) return false;
|
|
207323
|
+
const declaration = declarations[0];
|
|
207324
|
+
if (ts.isPropertySignature(declaration) && declaration.questionToken !== void 0) {
|
|
207325
|
+
return true;
|
|
207326
|
+
}
|
|
207327
|
+
if (ts.isParameter(declaration) && declaration.questionToken !== void 0) {
|
|
207328
|
+
return true;
|
|
207329
|
+
}
|
|
207330
|
+
return false;
|
|
207331
|
+
}
|
|
207332
|
+
function isNeverType(symbol) {
|
|
207333
|
+
if (!symbol) return false;
|
|
207334
|
+
return symbol.flags === ts.TypeFlags.Never;
|
|
207335
|
+
}
|
|
207336
|
+
async function loadLocalJSONFile(path) {
|
|
207337
|
+
const localPath = resolve(path);
|
|
207338
|
+
if (existsSync(localPath)) {
|
|
207339
|
+
return lib.parse(readFileSync(localPath, "utf-8"));
|
|
207340
|
+
}
|
|
207341
|
+
return void 0;
|
|
207342
|
+
}
|
|
207343
|
+
|
|
206874
207344
|
const API_GEN_CONFIG_FILENAME = "api-gen.config.json";
|
|
206875
207345
|
async function loadApiGenConfig(params = {}) {
|
|
206876
207346
|
try {
|
|
@@ -206903,21 +207373,44 @@ async function resolveSinglePath(pathToResolve) {
|
|
|
206903
207373
|
responseType: "json",
|
|
206904
207374
|
parseResponse: lib.parse
|
|
206905
207375
|
});
|
|
207376
|
+
console.log("Resolved file from", pathToResolve);
|
|
206906
207377
|
return response;
|
|
206907
207378
|
}
|
|
206908
|
-
const
|
|
206909
|
-
|
|
206910
|
-
|
|
206911
|
-
|
|
207379
|
+
const localFile = await loadLocalJSONFile(pathToResolve);
|
|
207380
|
+
if (localFile) {
|
|
207381
|
+
console.log("Resolved file from", pathToResolve);
|
|
207382
|
+
return localFile;
|
|
207383
|
+
}
|
|
207384
|
+
const apiTypesFolder = join(process.cwd(), "api-types");
|
|
207385
|
+
const apiTypesFile = join(apiTypesFolder, pathToResolve);
|
|
207386
|
+
const localApiTypesFile = await loadLocalJSONFile(apiTypesFile);
|
|
207387
|
+
if (localApiTypesFile) {
|
|
207388
|
+
console.log("Resolved file from", apiTypesFile);
|
|
207389
|
+
return localApiTypesFile;
|
|
207390
|
+
}
|
|
207391
|
+
const nodeModulesFolder = resolve(
|
|
207392
|
+
`node_modules/@shopware/api-client/api-types/${pathToResolve}`
|
|
207393
|
+
);
|
|
207394
|
+
const localNodeModulesFile = await loadLocalJSONFile(nodeModulesFolder);
|
|
207395
|
+
if (localNodeModulesFile) {
|
|
207396
|
+
console.log("Resolved file from", nodeModulesFolder);
|
|
207397
|
+
return localNodeModulesFile;
|
|
207398
|
+
}
|
|
207399
|
+
const githubFile = `https://raw.githubusercontent.com/shopware/frontends/main/packages/api-client/api-types/${pathToResolve}`;
|
|
207400
|
+
const localGithubFile = await loadLocalJSONFile(githubFile);
|
|
207401
|
+
if (localGithubFile) {
|
|
207402
|
+
console.log("Resolved file from", githubFile);
|
|
207403
|
+
return localGithubFile;
|
|
207404
|
+
}
|
|
206912
207405
|
} catch (error) {
|
|
206913
207406
|
console.warn(
|
|
206914
207407
|
c.yellow(
|
|
206915
|
-
`Problem with resolving
|
|
207408
|
+
`Problem with resolving file at address ${pathToResolve}. Check whether you configured it properly in your ${API_GEN_CONFIG_FILENAME}
|
|
206916
207409
|
`
|
|
206917
207410
|
),
|
|
206918
207411
|
error
|
|
206919
207412
|
);
|
|
206920
|
-
return
|
|
207413
|
+
return void 0;
|
|
206921
207414
|
}
|
|
206922
207415
|
}
|
|
206923
207416
|
async function loadJsonOverrides({
|
|
@@ -206937,7 +207430,7 @@ async function loadJsonOverrides({
|
|
|
206937
207430
|
);
|
|
206938
207431
|
return extendedDefu(
|
|
206939
207432
|
{},
|
|
206940
|
-
...results.filter((result) => result.status === "fulfilled").map((result) => result.value)
|
|
207433
|
+
...results.filter((result) => result.status === "fulfilled").map((result) => result.value || {})
|
|
206941
207434
|
);
|
|
206942
207435
|
} catch (error) {
|
|
206943
207436
|
console.warn(
|
|
@@ -207154,72 +207647,6 @@ async function prepareFileContent({
|
|
|
207154
207647
|
return project;
|
|
207155
207648
|
}
|
|
207156
207649
|
|
|
207157
|
-
function getTypePropertyNames(type) {
|
|
207158
|
-
return type.getProperties().map((prop) => prop.name);
|
|
207159
|
-
}
|
|
207160
|
-
function getDeepProperty({
|
|
207161
|
-
type,
|
|
207162
|
-
names,
|
|
207163
|
-
node,
|
|
207164
|
-
typeChecker
|
|
207165
|
-
}) {
|
|
207166
|
-
if (names.length === 0) {
|
|
207167
|
-
return type;
|
|
207168
|
-
}
|
|
207169
|
-
const [currentName, ...restNames] = names;
|
|
207170
|
-
const property = type.getProperty(currentName);
|
|
207171
|
-
if (!property) {
|
|
207172
|
-
return void 0;
|
|
207173
|
-
}
|
|
207174
|
-
const propertyType = typeChecker.getTypeOfSymbolAtLocation(property, node);
|
|
207175
|
-
return getDeepProperty({
|
|
207176
|
-
type: propertyType,
|
|
207177
|
-
names: restNames,
|
|
207178
|
-
node,
|
|
207179
|
-
typeChecker
|
|
207180
|
-
});
|
|
207181
|
-
}
|
|
207182
|
-
function getDeepPropertyCode({
|
|
207183
|
-
type,
|
|
207184
|
-
names,
|
|
207185
|
-
node,
|
|
207186
|
-
typeChecker
|
|
207187
|
-
}) {
|
|
207188
|
-
const namesWithoutLast = names.slice(0, -1);
|
|
207189
|
-
const currentName = names[names.length - 1];
|
|
207190
|
-
const deepProperty = getDeepProperty({
|
|
207191
|
-
type,
|
|
207192
|
-
names: namesWithoutLast,
|
|
207193
|
-
node,
|
|
207194
|
-
typeChecker
|
|
207195
|
-
});
|
|
207196
|
-
if (deepProperty) {
|
|
207197
|
-
const property = deepProperty.getProperty(currentName);
|
|
207198
|
-
if (!property) {
|
|
207199
|
-
return void 0;
|
|
207200
|
-
}
|
|
207201
|
-
return property.valueDeclaration?.getText().replace(/^[^:]+:/, "");
|
|
207202
|
-
}
|
|
207203
|
-
}
|
|
207204
|
-
function isOptional(symbol) {
|
|
207205
|
-
const declarations = symbol.getDeclarations();
|
|
207206
|
-
if (!declarations)
|
|
207207
|
-
return false;
|
|
207208
|
-
const declaration = declarations[0];
|
|
207209
|
-
if (ts.isPropertySignature(declaration) && declaration.questionToken !== void 0) {
|
|
207210
|
-
return true;
|
|
207211
|
-
}
|
|
207212
|
-
if (ts.isParameter(declaration) && declaration.questionToken !== void 0) {
|
|
207213
|
-
return true;
|
|
207214
|
-
}
|
|
207215
|
-
return false;
|
|
207216
|
-
}
|
|
207217
|
-
function isNeverType(symbol) {
|
|
207218
|
-
if (!symbol)
|
|
207219
|
-
return false;
|
|
207220
|
-
return symbol.flags === ts.TypeFlags.Never;
|
|
207221
|
-
}
|
|
207222
|
-
|
|
207223
207650
|
function createVirtualFiles(files) {
|
|
207224
207651
|
const filesMap = /* @__PURE__ */ new Map();
|
|
207225
207652
|
for (const fileDefinition of files) {
|
|
@@ -207612,8 +208039,8 @@ async function generate(args) {
|
|
|
207612
208039
|
const outputFilename = inputFilename.replace(".json", ".d.ts");
|
|
207613
208040
|
const fullInputFilePath = join(args.cwd, "api-types", inputFilename);
|
|
207614
208041
|
const fullOutputFilePath = join(args.cwd, "api-types", outputFilename);
|
|
207615
|
-
const
|
|
207616
|
-
if (!
|
|
208042
|
+
const resolvedSchema = await resolveSinglePath(inputFilename);
|
|
208043
|
+
if (!resolvedSchema && !args.apiType) {
|
|
207617
208044
|
console.log(
|
|
207618
208045
|
c.yellow(
|
|
207619
208046
|
`Schema file ${c.bold(
|
|
@@ -207628,11 +208055,8 @@ async function generate(args) {
|
|
|
207628
208055
|
let schema = "";
|
|
207629
208056
|
let processedSchemaAst;
|
|
207630
208057
|
let apiVersion = "unknown";
|
|
207631
|
-
if (
|
|
207632
|
-
const
|
|
207633
|
-
encoding: "utf-8"
|
|
207634
|
-
});
|
|
207635
|
-
const schemaForPatching = lib.parse(schemaFile);
|
|
208058
|
+
if (resolvedSchema) {
|
|
208059
|
+
const schemaForPatching = structuredClone(resolvedSchema);
|
|
207636
208060
|
apiVersion = schemaForPatching?.info?.version;
|
|
207637
208061
|
const configJSON = await loadApiGenConfig({
|
|
207638
208062
|
silent: true
|
|
@@ -207665,7 +208089,7 @@ async function generate(args) {
|
|
|
207665
208089
|
openApiSchema: schemaForPatching,
|
|
207666
208090
|
jsonOverrides
|
|
207667
208091
|
});
|
|
207668
|
-
const originalSchema =
|
|
208092
|
+
const originalSchema = structuredClone(resolvedSchema);
|
|
207669
208093
|
console.log("schema", originalSchema.info);
|
|
207670
208094
|
displayPatchingSummary({
|
|
207671
208095
|
todosToFix,
|
|
@@ -207719,8 +208143,7 @@ async function generate(args) {
|
|
|
207719
208143
|
];
|
|
207720
208144
|
const stringFields = Object.keys(schemaObject.properties).filter(
|
|
207721
208145
|
(key) => {
|
|
207722
|
-
if (notAllowedKeys.includes(key))
|
|
207723
|
-
return false;
|
|
208146
|
+
if (notAllowedKeys.includes(key)) return false;
|
|
207724
208147
|
const property = schemaObject.properties?.[key];
|
|
207725
208148
|
return !!property && "type" in property && property.type === "string";
|
|
207726
208149
|
}
|
|
@@ -207967,6 +208390,10 @@ Check whether the .env file is created.
|
|
|
207967
208390
|
});
|
|
207968
208391
|
const content = formatted.trim();
|
|
207969
208392
|
const dir = args.cwd;
|
|
208393
|
+
const apiTypesDir = join(dir, "api-types");
|
|
208394
|
+
if (!existsSync(apiTypesDir)) {
|
|
208395
|
+
mkdirSync(apiTypesDir);
|
|
208396
|
+
}
|
|
207970
208397
|
const filePath = join("api-types", outputFilename);
|
|
207971
208398
|
writeFileSync(join(dir, filePath), content, {
|
|
207972
208399
|
encoding: "utf-8"
|