@shopware/api-gen 1.5.2 → 1.5.3
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 +11 -3
- package/dist/cli.mjs +96 -27
- package/dist/index.mjs +1 -1
- package/dist/shared/{api-gen.DDkIkZIo.mjs → api-gen.DwUlbL4g.mjs} +70 -35
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -99,6 +99,14 @@ export type operations = {
|
|
|
99
99
|
> [!IMPORTANT]
|
|
100
100
|
> Overriding components or operations in the TS files requires you to have a full object definitions!
|
|
101
101
|
|
|
102
|
+
Override-only projects (extra plugin endpoints, no local OpenAPI JSON) should
|
|
103
|
+
import components from `@shopware/api-client/store-api-types` and merge the
|
|
104
|
+
overlay in `shopware.d.ts` with `WithApiOverrides` from `@shopware/api-client`.
|
|
105
|
+
That keeps StackBlitz working without committing a generated `storeApiTypes.d.ts`.
|
|
106
|
+
See the [api-client TypeScript overrides](https://www.npmjs.com/package/@shopware/api-client) docs.
|
|
107
|
+
When you do run `generate`, it still applies the same overlay onto whatever base
|
|
108
|
+
schema it resolved (local JSON, or the types shipped with the api-client).
|
|
109
|
+
|
|
102
110
|
### Partial overrides
|
|
103
111
|
|
|
104
112
|
There is a possiblity to add patches (partial overrides) to the schema. Partial overrides are applied directly to the JSON schema, so the syntax needs to be correct. It can then be used by the backend CI tool to validate and apply these patches directly to the schema to fix inconsistencies.
|
|
@@ -401,9 +409,9 @@ await split({
|
|
|
401
409
|
|
|
402
410
|
Full changelog for stable version is available [here](https://github.com/shopware/frontends/blob/main/packages/api-gen/CHANGELOG.md)
|
|
403
411
|
|
|
404
|
-
### Latest changes: 1.5.
|
|
412
|
+
### Latest changes: 1.5.3
|
|
405
413
|
|
|
406
414
|
### Patch Changes
|
|
407
415
|
|
|
408
|
-
- Updated dependencies [[`
|
|
409
|
-
- @shopware/api-client@1.
|
|
416
|
+
- Updated dependencies [[`44ece9d`](https://github.com/shopware/frontends/commit/44ece9dac2e4d0248c2270f7eff496c258632f5b), [`4b43e64`](https://github.com/shopware/frontends/commit/4b43e64a8d78be6eca1f8d9c24140e046193af41)]:
|
|
417
|
+
- @shopware/api-client@1.7.0
|
package/dist/cli.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
2
|
import { hideBin } from 'yargs/helpers';
|
|
3
|
-
import { a as getAugmentedNamespace, f as formatSource, g as generate, l as loadSchema, v as validateJson } from './shared/api-gen.
|
|
3
|
+
import { a as getAugmentedNamespace, f as formatSource, g as generate, l as loadSchema, v as validateJson } from './shared/api-gen.DwUlbL4g.mjs';
|
|
4
4
|
import { mkdirSync, writeFileSync } from 'node:fs';
|
|
5
5
|
import { resolve as resolve$2 } from 'node:path';
|
|
6
6
|
import require$$0$5 from 'fs';
|
|
@@ -32,7 +32,7 @@ import __cjs_mod__ from 'module';
|
|
|
32
32
|
const __filename = __cjs_url__.fileURLToPath(import.meta.url);
|
|
33
33
|
const __dirname = __cjs_path__.dirname(__filename);
|
|
34
34
|
const require = __cjs_mod__.createRequire(import.meta.url);
|
|
35
|
-
const version$1 = "1.5.
|
|
35
|
+
const version$1 = "1.5.3";
|
|
36
36
|
const packageJson = {
|
|
37
37
|
version: version$1};
|
|
38
38
|
|
|
@@ -153,6 +153,26 @@ function requireBraceExpansion () {
|
|
|
153
153
|
// characters) so legitimate input is unaffected.
|
|
154
154
|
var EXPANSION_MAX_LENGTH = 4000000;
|
|
155
155
|
|
|
156
|
+
// `expand` recurses once per level of brace *nesting* - both when expanding a
|
|
157
|
+
// set's comma members and when re-wrapping a set whose body is a single part.
|
|
158
|
+
// The CVE-2026-14257 fix made the *tail* iterative (recursion on `m.post`, one
|
|
159
|
+
// level per chained group), which left nesting depth unbounded: about 3,100
|
|
160
|
+
// levels of `{{{...a,b...}}}` - only ~6KB of input - exhausted the native stack
|
|
161
|
+
// and crashed the process. `EXPANSION_MAX_DEPTH` bounds how deep the parser
|
|
162
|
+
// will follow nesting. It sits far above any realistic pattern and well below
|
|
163
|
+
// the depth at which the stack runs out.
|
|
164
|
+
var EXPANSION_MAX_DEPTH = 1000;
|
|
165
|
+
|
|
166
|
+
// Bash keeps a quirk where a brace group followed by a comma set still expands
|
|
167
|
+
// (`{a},b}`). The parser implements it by rewriting the string and restarting
|
|
168
|
+
// the scan, absorbing one `}` per pass. `n` trailing braces therefore cost `n`
|
|
169
|
+
// full passes over a string that itself grows by one `escClose` sentinel each
|
|
170
|
+
// time - quadratic in `n`, with a ~26x constant from the sentinel's length.
|
|
171
|
+
// 128KB of `'{a}' + '}'.repeat(n) + ',z}'` blocked the event loop for 27
|
|
172
|
+
// seconds to produce two results. `EXPANSION_MAX_REWRITES` bounds how many
|
|
173
|
+
// times the scan may restart. Real `{a},b}` input needs a handful.
|
|
174
|
+
var EXPANSION_MAX_REWRITES = 1000;
|
|
175
|
+
|
|
156
176
|
function numeric(str) {
|
|
157
177
|
return parseInt(str, 10) == str
|
|
158
178
|
? parseInt(str, 10)
|
|
@@ -176,34 +196,54 @@ function requireBraceExpansion () {
|
|
|
176
196
|
}
|
|
177
197
|
|
|
178
198
|
|
|
199
|
+
// Like `target.push(...items)` but doesn't overflow the stack
|
|
200
|
+
function pushAll(target, items) {
|
|
201
|
+
for (var i = 0; i < items.length; i++) {
|
|
202
|
+
target.push(items[i]);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
179
206
|
// Basically just str.split(","), but handling cases
|
|
180
207
|
// where we have nested braced sections, which should be
|
|
181
208
|
// treated as individual members, like {a,{b,c},d}
|
|
182
209
|
function parseCommaParts(str) {
|
|
183
|
-
if (!str)
|
|
184
|
-
return [''];
|
|
185
|
-
|
|
186
210
|
var parts = [];
|
|
187
|
-
var m = balanced('{', '}', str);
|
|
188
211
|
|
|
189
|
-
|
|
190
|
-
|
|
212
|
+
// Walk the brace groups iteratively. Recursing on `post` once per group let a
|
|
213
|
+
// chain of them exhaust the stack - the parsing-side counterpart to
|
|
214
|
+
// the `expand` overflow fixed for CVE-2026-14257, and not something `max` or
|
|
215
|
+
// `maxLength` can bound, since it happens before expansion.
|
|
216
|
+
//
|
|
217
|
+
// The part the next chunk continues
|
|
218
|
+
var carry = '';
|
|
191
219
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var post = m.post;
|
|
195
|
-
var p = pre.split(',');
|
|
220
|
+
for (;;) {
|
|
221
|
+
var m = balanced('{', '}', str);
|
|
196
222
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
223
|
+
if (!m) {
|
|
224
|
+
var tail = str.split(',');
|
|
225
|
+
tail[0] = carry + tail[0];
|
|
226
|
+
pushAll(parts, tail);
|
|
227
|
+
return parts;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
var pre = m.pre;
|
|
231
|
+
var body = m.body;
|
|
232
|
+
var post = m.post;
|
|
233
|
+
var p = pre.split(',');
|
|
203
234
|
|
|
204
|
-
|
|
235
|
+
p[0] = carry + p[0];
|
|
236
|
+
p[p.length-1] += '{' + body + '}';
|
|
205
237
|
|
|
206
|
-
|
|
238
|
+
if (!post.length) {
|
|
239
|
+
pushAll(parts, p);
|
|
240
|
+
return parts;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
carry = p.pop();
|
|
244
|
+
pushAll(parts, p);
|
|
245
|
+
str = post;
|
|
246
|
+
}
|
|
207
247
|
}
|
|
208
248
|
|
|
209
249
|
function expandTop(str, options) {
|
|
@@ -213,6 +253,8 @@ function requireBraceExpansion () {
|
|
|
213
253
|
options = options || {};
|
|
214
254
|
var max = options.max == null ? EXPANSION_MAX : options.max;
|
|
215
255
|
var maxLength = options.maxLength == null ? EXPANSION_MAX_LENGTH : options.maxLength;
|
|
256
|
+
var maxDepth = options.maxDepth == null ? EXPANSION_MAX_DEPTH : options.maxDepth;
|
|
257
|
+
var maxRewrites = options.maxRewrites == null ? EXPANSION_MAX_REWRITES : options.maxRewrites;
|
|
216
258
|
|
|
217
259
|
// I don't know why Bash 4.3 does this, but it does.
|
|
218
260
|
// Anything starting with {} will have the first two bytes preserved
|
|
@@ -224,7 +266,7 @@ function requireBraceExpansion () {
|
|
|
224
266
|
str = '\\{\\}' + str.substr(2);
|
|
225
267
|
}
|
|
226
268
|
|
|
227
|
-
return expand(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
|
|
269
|
+
return expand(escapeBraces(str), max, maxLength, maxDepth, 0, maxRewrites, true).map(unescapeBraces);
|
|
228
270
|
}
|
|
229
271
|
|
|
230
272
|
function embrace(str) {
|
|
@@ -336,8 +378,18 @@ function requireBraceExpansion () {
|
|
|
336
378
|
str,
|
|
337
379
|
max,
|
|
338
380
|
maxLength,
|
|
381
|
+
maxDepth,
|
|
382
|
+
depth,
|
|
383
|
+
maxRewrites,
|
|
339
384
|
isTop
|
|
340
385
|
) {
|
|
386
|
+
// Too deeply nested to keep following: treat the rest as literal, the same
|
|
387
|
+
// way a group that cannot expand is already handled. Truncating rather than
|
|
388
|
+
// throwing keeps expansion total, matching `max` and `maxLength`.
|
|
389
|
+
if (depth > maxDepth) {
|
|
390
|
+
return [str];
|
|
391
|
+
}
|
|
392
|
+
|
|
341
393
|
// Consume the string's top-level brace groups left to right, threading a
|
|
342
394
|
// running set of combined prefixes (`acc`). Expanding the tail iteratively -
|
|
343
395
|
// rather than recursing on `m.post` once per group - keeps the native stack
|
|
@@ -350,6 +402,9 @@ function requireBraceExpansion () {
|
|
|
350
402
|
// comma set - a sequence like `{a..\}` may legitimately yield ''. The drop
|
|
351
403
|
// is on the final strings, so it is applied to whichever `combine` produces
|
|
352
404
|
// them (the one with no brace set left in the tail).
|
|
405
|
+
// How many times the `{a},b}` rewrite below has restarted the scan. Each pass
|
|
406
|
+
// re-reads the whole string, so leaving this unbounded is quadratic.
|
|
407
|
+
var rewrites = 0;
|
|
353
408
|
var dropEmpties = false;
|
|
354
409
|
var firstGroup = true;
|
|
355
410
|
|
|
@@ -385,7 +440,8 @@ function requireBraceExpansion () {
|
|
|
385
440
|
var isOptions = m.body.indexOf(',') >= 0;
|
|
386
441
|
if (!isSequence && !isOptions) {
|
|
387
442
|
// {a},b}
|
|
388
|
-
if (m.post.match(/,(?!,).*\}/)) {
|
|
443
|
+
if (rewrites < maxRewrites && m.post.match(/,(?!,).*\}/)) {
|
|
444
|
+
rewrites++;
|
|
389
445
|
str = m.pre + '{' + m.body + escClose + m.post;
|
|
390
446
|
isTop = true;
|
|
391
447
|
continue;
|
|
@@ -413,7 +469,7 @@ function requireBraceExpansion () {
|
|
|
413
469
|
var n = parseCommaParts(m.body);
|
|
414
470
|
if (n.length === 1 && n[0] !== undefined) {
|
|
415
471
|
// x{{a,b}}y ==> x{a}y x{b}y
|
|
416
|
-
n = expand(n[0], max, maxLength, false).map(embrace);
|
|
472
|
+
n = expand(n[0], max, maxLength, maxDepth, depth + 1, maxRewrites, false).map(embrace);
|
|
417
473
|
//XXX is this necessary? Can't seem to hit it in tests.
|
|
418
474
|
/* c8 ignore start */
|
|
419
475
|
if (n.length === 1) {
|
|
@@ -447,7 +503,7 @@ function requireBraceExpansion () {
|
|
|
447
503
|
values = [];
|
|
448
504
|
var valuesLength = 0;
|
|
449
505
|
outer: for (var j = 0; j < n.length; j++) {
|
|
450
|
-
var expanded = expand(n[j], max, maxLength, false);
|
|
506
|
+
var expanded = expand(n[j], max, maxLength, maxDepth, depth + 1, maxRewrites, false);
|
|
451
507
|
for (var k = 0; k < expanded.length; k++) {
|
|
452
508
|
var v = expanded[k];
|
|
453
509
|
if (dropsEmpties && !v) continue
|
|
@@ -3124,19 +3180,28 @@ function requireLoader$1 () {
|
|
|
3124
3180
|
}
|
|
3125
3181
|
}
|
|
3126
3182
|
|
|
3183
|
+
function chargeMergeWork (state) {
|
|
3184
|
+
state.totalMergeKeys++;
|
|
3185
|
+
|
|
3186
|
+
if (state.maxTotalMergeKeys !== -1 && state.totalMergeKeys > state.maxTotalMergeKeys) {
|
|
3187
|
+
throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')');
|
|
3188
|
+
}
|
|
3189
|
+
}
|
|
3190
|
+
|
|
3127
3191
|
function mergeMappings (state, destination, source, overridableKeys) {
|
|
3128
3192
|
if (!common.isObject(source)) {
|
|
3129
3193
|
throwError(state, 'cannot merge mappings; the provided source object is unacceptable');
|
|
3130
3194
|
}
|
|
3131
3195
|
|
|
3196
|
+
// Count the source mapping itself to bound sequences of empty mappings.
|
|
3197
|
+
chargeMergeWork(state);
|
|
3198
|
+
|
|
3132
3199
|
const sourceKeys = Object.keys(source);
|
|
3133
3200
|
|
|
3134
3201
|
for (let index = 0, quantity = sourceKeys.length; index < quantity; index += 1) {
|
|
3135
3202
|
const key = sourceKeys[index];
|
|
3136
3203
|
|
|
3137
|
-
|
|
3138
|
-
throwError(state, 'merge keys exceeded maxTotalMergeKeys (' + state.maxTotalMergeKeys + ')');
|
|
3139
|
-
}
|
|
3204
|
+
chargeMergeWork(state);
|
|
3140
3205
|
|
|
3141
3206
|
if (!_hasOwnProperty.call(destination, key)) {
|
|
3142
3207
|
setProperty(destination, key, source[key]);
|
|
@@ -3179,6 +3244,10 @@ function requireLoader$1 () {
|
|
|
3179
3244
|
|
|
3180
3245
|
if (keyTag === 'tag:yaml.org,2002:merge') {
|
|
3181
3246
|
if (Array.isArray(valueNode)) {
|
|
3247
|
+
if (valueNode.length > 100) {
|
|
3248
|
+
throwError(state, 'abnormal merge sequence size');
|
|
3249
|
+
}
|
|
3250
|
+
|
|
3182
3251
|
for (let index = 0, quantity = valueNode.length; index < quantity; index += 1) {
|
|
3183
3252
|
mergeMappings(state, _result, valueNode[index], overridableKeys);
|
|
3184
3253
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -2272,7 +2272,7 @@ function getKeysOfEnumerableProperties(object, compareKeys) {
|
|
|
2272
2272
|
* with spacing, indentation, and comma
|
|
2273
2273
|
* without surrounding punctuation (for example, braces)
|
|
2274
2274
|
*/
|
|
2275
|
-
function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ") {
|
|
2275
|
+
function printIteratorEntries(iterator, config, indentation, depth, refs, printer, separator = ": ", length) {
|
|
2276
2276
|
let result = "";
|
|
2277
2277
|
let width = 0;
|
|
2278
2278
|
let current = iterator.next();
|
|
@@ -2282,7 +2282,7 @@ function printIteratorEntries(iterator, config, indentation, depth, refs, printe
|
|
|
2282
2282
|
while (!current.done) {
|
|
2283
2283
|
result += indentationNext;
|
|
2284
2284
|
if (width++ === config.maxWidth) {
|
|
2285
|
-
result += "…";
|
|
2285
|
+
result += typeof length === "number" ? `…(${length - width + 1})` : "…";
|
|
2286
2286
|
break;
|
|
2287
2287
|
}
|
|
2288
2288
|
const name = printer(current.value[0], config, indentationNext, depth, refs);
|
|
@@ -2304,7 +2304,7 @@ function printIteratorEntries(iterator, config, indentation, depth, refs, printe
|
|
|
2304
2304
|
* with spacing, indentation, and comma
|
|
2305
2305
|
* without surrounding punctuation (braces or brackets)
|
|
2306
2306
|
*/
|
|
2307
|
-
function printIteratorValues(iterator, config, indentation, depth, refs, printer) {
|
|
2307
|
+
function printIteratorValues(iterator, config, indentation, depth, refs, printer, length) {
|
|
2308
2308
|
let result = "";
|
|
2309
2309
|
let width = 0;
|
|
2310
2310
|
let current = iterator.next();
|
|
@@ -2314,7 +2314,7 @@ function printIteratorValues(iterator, config, indentation, depth, refs, printer
|
|
|
2314
2314
|
while (!current.done) {
|
|
2315
2315
|
result += indentationNext;
|
|
2316
2316
|
if (width++ === config.maxWidth) {
|
|
2317
|
-
result += "…";
|
|
2317
|
+
result += typeof length === "number" ? `…(${length - width + 1})` : "…";
|
|
2318
2318
|
break;
|
|
2319
2319
|
}
|
|
2320
2320
|
result += printer(current.value, config, indentationNext, depth, refs);
|
|
@@ -2345,7 +2345,7 @@ function printListItems(list, config, indentation, depth, refs, printer) {
|
|
|
2345
2345
|
for (let i = 0; i < length; i++) {
|
|
2346
2346
|
result += indentationNext;
|
|
2347
2347
|
if (i === config.maxWidth) {
|
|
2348
|
-
result +=
|
|
2348
|
+
result += `…(${length - i})`;
|
|
2349
2349
|
break;
|
|
2350
2350
|
}
|
|
2351
2351
|
if (isDataView(list) || i in list) {
|
|
@@ -2366,17 +2366,22 @@ function printListItems(list, config, indentation, depth, refs, printer) {
|
|
|
2366
2366
|
* with spacing, indentation, and comma
|
|
2367
2367
|
* without surrounding punctuation (for example, braces)
|
|
2368
2368
|
*/
|
|
2369
|
-
function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
|
2369
|
+
function printObjectProperties(val, config, indentation, depth, refs, printer, compareKeysOverride = config.compareKeys) {
|
|
2370
2370
|
let result = "";
|
|
2371
|
-
const keys = getKeysOfEnumerableProperties(val,
|
|
2371
|
+
const keys = getKeysOfEnumerableProperties(val, compareKeysOverride);
|
|
2372
2372
|
if (keys.length > 0) {
|
|
2373
2373
|
result += config.spacingOuter;
|
|
2374
2374
|
const indentationNext = indentation + config.indent;
|
|
2375
2375
|
for (let i = 0; i < keys.length; i++) {
|
|
2376
|
+
result += indentationNext;
|
|
2377
|
+
if (i === config.maxWidth) {
|
|
2378
|
+
result += `…(${keys.length - i})`;
|
|
2379
|
+
break;
|
|
2380
|
+
}
|
|
2376
2381
|
const key = keys[i];
|
|
2377
|
-
const name = printer(key, config, indentationNext, depth, refs);
|
|
2382
|
+
const name = !config.quoteKeys && isUnquotableKey(key) ? key : printer(key, config, indentationNext, depth, refs);
|
|
2378
2383
|
const value = printer(val[key], config, indentationNext, depth, refs);
|
|
2379
|
-
result += `${
|
|
2384
|
+
result += `${name}: ${value}`;
|
|
2380
2385
|
if (i < keys.length - 1) {
|
|
2381
2386
|
result += `,${config.spacingInner}`;
|
|
2382
2387
|
} else if (!config.min) {
|
|
@@ -2387,6 +2392,12 @@ function printObjectProperties(val, config, indentation, depth, refs, printer) {
|
|
|
2387
2392
|
}
|
|
2388
2393
|
return result;
|
|
2389
2394
|
}
|
|
2395
|
+
// https://github.com/nodejs/node/blob/61102cdbb3d59155ad5bb4fc9419627a31e63f7a/lib/internal/util/inspect.js#L249
|
|
2396
|
+
// /^[a-zA-Z_][a-zA-Z_0-9]*$/
|
|
2397
|
+
const keyStrRegExp = /^[a-z_]\w*$/i;
|
|
2398
|
+
function isUnquotableKey(key) {
|
|
2399
|
+
return typeof key === "string" && key !== "__proto__" && keyStrRegExp.test(key);
|
|
2400
|
+
}
|
|
2390
2401
|
|
|
2391
2402
|
const asymmetricMatcher = typeof Symbol === "function" && Symbol.for ? Symbol.for("jest.asymmetricMatcher") : 1267621;
|
|
2392
2403
|
const SPACE$2 = " ";
|
|
@@ -2463,7 +2474,7 @@ function printProps(keys, props, config, indentation, depth, refs, printer) {
|
|
|
2463
2474
|
return keys.map((key) => {
|
|
2464
2475
|
const value = props[key];
|
|
2465
2476
|
// hidden injected value that should not be printed
|
|
2466
|
-
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") &&
|
|
2477
|
+
if (typeof value === "string" && value[0] === "_" && value.startsWith("__vitest_") && /__vitest_\d+__/.test(value)) {
|
|
2467
2478
|
return "";
|
|
2468
2479
|
}
|
|
2469
2480
|
let printed = printer(value, config, indentationNext, depth, refs);
|
|
@@ -2561,7 +2572,7 @@ const plugin$3 = {
|
|
|
2561
2572
|
test: test$3
|
|
2562
2573
|
};
|
|
2563
2574
|
|
|
2564
|
-
// SENTINEL constants are from https://github.com/
|
|
2575
|
+
// SENTINEL constants are from https://github.com/immutable-js/immutable-js
|
|
2565
2576
|
const IS_ITERABLE_SENTINEL = "@@__IMMUTABLE_ITERABLE__@@";
|
|
2566
2577
|
const IS_LIST_SENTINEL = "@@__IMMUTABLE_LIST__@@";
|
|
2567
2578
|
const IS_KEYED_SENTINEL = "@@__IMMUTABLE_KEYED__@@";
|
|
@@ -2608,7 +2619,9 @@ function printImmutableSeq(val, config, indentation, depth, refs, printer) {
|
|
|
2608
2619
|
return printAsLeaf(name);
|
|
2609
2620
|
}
|
|
2610
2621
|
if (val[IS_KEYED_SENTINEL]) {
|
|
2611
|
-
return `${name + SPACE}{${
|
|
2622
|
+
return `${name + SPACE}{${
|
|
2623
|
+
// from Immutable collection of entries or from ECMAScript object
|
|
2624
|
+
val._iter || val._object ? printIteratorEntries(val.entries(), config, indentation, depth, refs, printer) : LAZY}}`;
|
|
2612
2625
|
}
|
|
2613
2626
|
return `${name + SPACE}[${val._iter || val._array || val._collection || val._iterable ? printIteratorValues(val.values(), config, indentation, depth, refs, printer) : LAZY}]`;
|
|
2614
2627
|
}
|
|
@@ -2991,7 +3004,7 @@ function printError(val) {
|
|
|
2991
3004
|
* The first port of call for printing an object, handles most of the
|
|
2992
3005
|
* data-types in JS.
|
|
2993
3006
|
*/
|
|
2994
|
-
function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
3007
|
+
function printBasicValue(val, printFunctionName, escapeRegex, escapeString, singleQuote) {
|
|
2995
3008
|
if (val === true || val === false) {
|
|
2996
3009
|
return `${val}`;
|
|
2997
3010
|
}
|
|
@@ -3009,10 +3022,15 @@ function printBasicValue(val, printFunctionName, escapeRegex, escapeString) {
|
|
|
3009
3022
|
return printBigInt(val);
|
|
3010
3023
|
}
|
|
3011
3024
|
if (typeOf === "string") {
|
|
3025
|
+
const q = singleQuote ? "'" : "\"";
|
|
3012
3026
|
if (escapeString) {
|
|
3013
|
-
|
|
3027
|
+
// escape quote in each case, e.g.
|
|
3028
|
+
// it's me -> 'it\'s me'
|
|
3029
|
+
// say "hi" -> "say \"hi\""
|
|
3030
|
+
const escapePattern = singleQuote ? /['\\]/g : /["\\]/g;
|
|
3031
|
+
return `${q}${val.replaceAll(escapePattern, "\\$&")}${q}`;
|
|
3014
3032
|
}
|
|
3015
|
-
return
|
|
3033
|
+
return `${q}${val}${q}`;
|
|
3016
3034
|
}
|
|
3017
3035
|
if (typeOf === "function") {
|
|
3018
3036
|
return printFunction(val, printFunctionName);
|
|
@@ -3071,17 +3089,17 @@ function printComplexValue(val, config, indentation, depth, refs, hasCalledToJSO
|
|
|
3071
3089
|
return hitMaxDepth ? "[Arguments]" : `${min ? "" : "Arguments "}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
3072
3090
|
}
|
|
3073
3091
|
if (isToStringedArrayType(toStringed)) {
|
|
3074
|
-
return hitMaxDepth ? `[${val.constructor.name}]` : `${
|
|
3092
|
+
return hitMaxDepth ? `[${val.constructor.name}]` : `${!config.printBasicPrototype && val.constructor.name === "Array" ? "" : `${val.constructor.name} `}[${printListItems(val, config, indentation, depth, refs, printer)}]`;
|
|
3075
3093
|
}
|
|
3076
3094
|
if (toStringed === "[object Map]") {
|
|
3077
|
-
return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ")}}`;
|
|
3095
|
+
return hitMaxDepth ? "[Map]" : `Map {${printIteratorEntries(val.entries(), config, indentation, depth, refs, printer, " => ", val.size)}}`;
|
|
3078
3096
|
}
|
|
3079
3097
|
if (toStringed === "[object Set]") {
|
|
3080
|
-
return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer)}}`;
|
|
3098
|
+
return hitMaxDepth ? "[Set]" : `Set {${printIteratorValues(val.values(), config, indentation, depth, refs, printer, val.size)}}`;
|
|
3081
3099
|
}
|
|
3082
3100
|
// Avoid failure to serialize global window object in jsdom test environment.
|
|
3083
3101
|
// For example, not even relevant if window is prop of React element.
|
|
3084
|
-
return hitMaxDepth || isWindow(val) ? `[${getConstructorName$1(val)}]` : `${
|
|
3102
|
+
return hitMaxDepth || isWindow(val) ? `[${getConstructorName$1(val)}]` : `${!config.printBasicPrototype && getConstructorName$1(val) === "Object" ? "" : `${getConstructorName$1(val)} `}{${printObjectProperties(val, config, indentation, depth, refs, printer)}}`;
|
|
3085
3103
|
}
|
|
3086
3104
|
const ErrorPlugin = {
|
|
3087
3105
|
test: (val) => val && val instanceof Error,
|
|
@@ -3099,7 +3117,7 @@ const ErrorPlugin = {
|
|
|
3099
3117
|
...rest
|
|
3100
3118
|
};
|
|
3101
3119
|
const name = val.name !== "Error" ? val.name : getConstructorName$1(val);
|
|
3102
|
-
return hitMaxDepth ? `[${name}]` : `${name} {${
|
|
3120
|
+
return hitMaxDepth ? `[${name}]` : `${name} {${printObjectProperties(entries, config, indentation, depth, refs, printer, null)}}`;
|
|
3103
3121
|
}
|
|
3104
3122
|
};
|
|
3105
3123
|
function isNewPlugin(plugin) {
|
|
@@ -3142,7 +3160,7 @@ function printer(val, config, indentation, depth, refs, hasCalledToJSON) {
|
|
|
3142
3160
|
if (plugin !== null) {
|
|
3143
3161
|
result = printPlugin(plugin, val, config, indentation, depth, refs);
|
|
3144
3162
|
} else {
|
|
3145
|
-
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString);
|
|
3163
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString, config.singleQuote);
|
|
3146
3164
|
if (basicResult !== null) {
|
|
3147
3165
|
result = basicResult;
|
|
3148
3166
|
} else {
|
|
@@ -3178,6 +3196,8 @@ const DEFAULT_OPTIONS = {
|
|
|
3178
3196
|
highlight: false,
|
|
3179
3197
|
indent: 2,
|
|
3180
3198
|
maxDepth: Number.POSITIVE_INFINITY,
|
|
3199
|
+
// Practical default hard-limit to avoid too long string being generated
|
|
3200
|
+
// (Node's limit is buffer.constants.MAX_STRING_LENGTH ~ 512MB)
|
|
3181
3201
|
maxOutputLength: 1e6,
|
|
3182
3202
|
maxWidth: Number.POSITIVE_INFINITY,
|
|
3183
3203
|
min: false,
|
|
@@ -3185,7 +3205,11 @@ const DEFAULT_OPTIONS = {
|
|
|
3185
3205
|
printBasicPrototype: true,
|
|
3186
3206
|
printFunctionName: true,
|
|
3187
3207
|
printShadowRoot: true,
|
|
3188
|
-
theme: DEFAULT_THEME
|
|
3208
|
+
theme: DEFAULT_THEME,
|
|
3209
|
+
singleQuote: false,
|
|
3210
|
+
quoteKeys: true,
|
|
3211
|
+
spacingInner: "\n",
|
|
3212
|
+
spacingOuter: "\n"
|
|
3189
3213
|
};
|
|
3190
3214
|
function validateOptions(options) {
|
|
3191
3215
|
for (const key of Object.keys(options)) {
|
|
@@ -3239,11 +3263,13 @@ function getConfig(options) {
|
|
|
3239
3263
|
maxWidth: options?.maxWidth ?? DEFAULT_OPTIONS.maxWidth,
|
|
3240
3264
|
min: options?.min ?? DEFAULT_OPTIONS.min,
|
|
3241
3265
|
plugins: options?.plugins ?? DEFAULT_OPTIONS.plugins,
|
|
3242
|
-
printBasicPrototype: options?.printBasicPrototype ??
|
|
3266
|
+
printBasicPrototype: options?.printBasicPrototype ?? !options?.min,
|
|
3243
3267
|
printFunctionName: getPrintFunctionName(options),
|
|
3244
3268
|
printShadowRoot: options?.printShadowRoot ?? true,
|
|
3245
|
-
spacingInner: options?.min ? " " : "\n",
|
|
3246
|
-
spacingOuter: options?.min ? "" : "\n",
|
|
3269
|
+
spacingInner: options?.spacingInner ?? (options?.min ? " " : "\n"),
|
|
3270
|
+
spacingOuter: options?.spacingOuter ?? (options?.min ? "" : "\n"),
|
|
3271
|
+
singleQuote: options?.singleQuote ?? DEFAULT_OPTIONS.singleQuote,
|
|
3272
|
+
quoteKeys: options?.quoteKeys ?? DEFAULT_OPTIONS.quoteKeys,
|
|
3247
3273
|
maxOutputLength: options?.maxOutputLength ?? DEFAULT_OPTIONS.maxOutputLength,
|
|
3248
3274
|
_outputLengthPerDepth: []
|
|
3249
3275
|
};
|
|
@@ -3259,18 +3285,17 @@ function createIndent(indent) {
|
|
|
3259
3285
|
function format(val, options) {
|
|
3260
3286
|
if (options) {
|
|
3261
3287
|
validateOptions(options);
|
|
3262
|
-
if (options.plugins) {
|
|
3263
|
-
const plugin = findPlugin(options.plugins, val);
|
|
3264
|
-
if (plugin !== null) {
|
|
3265
|
-
return printPlugin(plugin, val, getConfig(options), "", 0, []);
|
|
3266
|
-
}
|
|
3267
|
-
}
|
|
3268
3288
|
}
|
|
3269
|
-
const
|
|
3289
|
+
const config = getConfig(options);
|
|
3290
|
+
const plugin = findPlugin(config.plugins, val);
|
|
3291
|
+
if (plugin !== null) {
|
|
3292
|
+
return printPlugin(plugin, val, config, "", 0, []);
|
|
3293
|
+
}
|
|
3294
|
+
const basicResult = printBasicValue(val, config.printFunctionName, config.escapeRegex, config.escapeString, config.singleQuote);
|
|
3270
3295
|
if (basicResult !== null) {
|
|
3271
3296
|
return basicResult;
|
|
3272
3297
|
}
|
|
3273
|
-
return printComplexValue(val,
|
|
3298
|
+
return printComplexValue(val, config, "", 0, []);
|
|
3274
3299
|
}
|
|
3275
3300
|
const plugins = {
|
|
3276
3301
|
AsymmetricMatcher: plugin$5,
|
|
@@ -8943,6 +8968,7 @@ function eq(a, b, aStack, bStack, customTesters, hasKey) {
|
|
|
8943
8968
|
// of `NaN` are equivalent.
|
|
8944
8969
|
return numA === numB || Number.isNaN(numA) && Number.isNaN(numB);
|
|
8945
8970
|
}
|
|
8971
|
+
// RegExps are compared by their source patterns and flags.
|
|
8946
8972
|
case "[object RegExp]": return a.source === b.source && a.flags === b.flags;
|
|
8947
8973
|
case "[object Temporal.Instant]":
|
|
8948
8974
|
case "[object Temporal.ZonedDateTime]":
|
|
@@ -9055,7 +9081,13 @@ if (!Object.hasOwn(globalThis, MATCHERS_OBJECT)) {
|
|
|
9055
9081
|
const matchers = Object.create(null);
|
|
9056
9082
|
const customEqualityTesters = [];
|
|
9057
9083
|
const asymmetricMatchers = Object.create(null);
|
|
9058
|
-
|
|
9084
|
+
// `configurable` so that vm pools can strip the accessors from a disposed
|
|
9085
|
+
// context: the getters capture the expect state, which would otherwise keep
|
|
9086
|
+
// the whole test-file world reachable from the leaked context shell
|
|
9087
|
+
Object.defineProperty(globalThis, MATCHERS_OBJECT, {
|
|
9088
|
+
configurable: true,
|
|
9089
|
+
get: () => globalState
|
|
9090
|
+
});
|
|
9059
9091
|
Object.defineProperty(globalThis, JEST_MATCHERS_OBJECT, {
|
|
9060
9092
|
configurable: true,
|
|
9061
9093
|
get: () => ({
|
|
@@ -9064,7 +9096,10 @@ if (!Object.hasOwn(globalThis, MATCHERS_OBJECT)) {
|
|
|
9064
9096
|
customEqualityTesters
|
|
9065
9097
|
})
|
|
9066
9098
|
});
|
|
9067
|
-
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
|
|
9099
|
+
Object.defineProperty(globalThis, ASYMMETRIC_MATCHERS_OBJECT, {
|
|
9100
|
+
configurable: true,
|
|
9101
|
+
get: () => asymmetricMatchers
|
|
9102
|
+
});
|
|
9068
9103
|
}
|
|
9069
9104
|
|
|
9070
9105
|
const KEYS_TO_HANDLE = ["oneOf", "anyOf", "allOf", "not", "$ref"];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopware/api-gen",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.3",
|
|
4
4
|
"description": "Shopware CLI for API client generation.",
|
|
5
5
|
"author": "Shopware",
|
|
6
6
|
"type": "module",
|
|
@@ -37,11 +37,13 @@
|
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/yargs": "17.0.35",
|
|
39
39
|
"@typescript/native-preview": "7.0.0-dev.20260205.1",
|
|
40
|
-
"@vitest/coverage-v8": "
|
|
40
|
+
"@vitest/coverage-v8": "5.0.0",
|
|
41
|
+
"@vitest/expect": "5.0.0",
|
|
42
|
+
"@vitest/utils": "5.0.0",
|
|
41
43
|
"json5": "2.2.3",
|
|
42
44
|
"picocolors": "1.1.1",
|
|
43
45
|
"unbuild": "3.6.1",
|
|
44
|
-
"vitest": "
|
|
46
|
+
"vitest": "5.0.0",
|
|
45
47
|
"tsconfig": "0.0.0"
|
|
46
48
|
},
|
|
47
49
|
"dependencies": {
|
|
@@ -51,7 +53,7 @@
|
|
|
51
53
|
"ts-morph": "27.0.2",
|
|
52
54
|
"typescript": "5.9.3",
|
|
53
55
|
"yargs": "18.0.0",
|
|
54
|
-
"@shopware/api-client": "1.
|
|
56
|
+
"@shopware/api-client": "1.7.0"
|
|
55
57
|
},
|
|
56
58
|
"scripts": {
|
|
57
59
|
"build": "unbuild",
|