@teamnovu/kit-shopware-api-client 0.1.0 → 0.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0](https://github.com/teamnovu/kit/compare/kit-shopware-api-client-v0.1.0...kit-shopware-api-client-v0.2.0) (2026-11-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * lazy-load zod ([b0bc660](https://github.com/teamnovu/kit/commit/b0bc66085d4512ba252b4311edbaddd514124f73))
9
+
3
10
  ## [0.1.0](https://github.com/teamnovu/kit/compare/kit-shopware-api-client-v0.0.15...kit-shopware-api-client-v0.1.0) (2026-11-12)
4
11
 
5
12
 
package/dist/error.d.ts CHANGED
@@ -1,17 +1,17 @@
1
- import { z } from 'zod';
2
- declare const shopwareErrorSchema: z.ZodObject<{
3
- status: z.ZodString;
4
- code: z.ZodString;
5
- title: z.ZodOptional<z.ZodString>;
6
- detail: z.ZodOptional<z.ZodString>;
7
- meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
8
- source: z.ZodOptional<z.ZodObject<{
9
- pointer: z.ZodOptional<z.ZodString>;
1
+ import * as z from 'zod/mini';
2
+ declare const shopwareErrorSchema: z.ZodMiniObject<{
3
+ status: z.ZodMiniString<string>;
4
+ code: z.ZodMiniString<string>;
5
+ title: z.ZodMiniOptional<z.ZodMiniString<string>>;
6
+ detail: z.ZodMiniOptional<z.ZodMiniString<string>>;
7
+ meta: z.ZodMiniOptional<z.ZodMiniRecord<z.ZodMiniString<string>, z.ZodMiniUnknown>>;
8
+ source: z.ZodMiniOptional<z.ZodMiniObject<{
9
+ pointer: z.ZodMiniOptional<z.ZodMiniString<string>>;
10
10
  }, z.core.$strip>>;
11
- trace: z.ZodOptional<z.ZodArray<z.ZodObject<{
12
- file: z.ZodString;
13
- line: z.ZodNumber;
14
- function: z.ZodString;
11
+ trace: z.ZodMiniOptional<z.ZodMiniArray<z.ZodMiniObject<{
12
+ file: z.ZodMiniString<string>;
13
+ line: z.ZodMiniNumber<number>;
14
+ function: z.ZodMiniString<string>;
15
15
  }, z.core.$strip>>>;
16
16
  }, z.core.$strip>;
17
17
  export type ShopwareError = z.infer<typeof shopwareErrorSchema>;
package/dist/index.mjs CHANGED
@@ -1,25 +1,942 @@
1
- import { z as e } from "zod";
2
- // \0rolldown/runtime.js
3
- var t = e.object({
4
- status: e.string(),
5
- code: e.string(),
6
- title: e.string().optional(),
7
- detail: e.string().optional(),
8
- meta: e.record(e.string(), e.unknown()).optional(),
9
- source: e.object({ pointer: e.string().optional() }).optional(),
10
- trace: e.array(e.object({
11
- file: e.string(),
12
- line: e.number(),
13
- function: e.string()
14
- })).optional()
15
- }), n = e.object({ errors: e.array(t) }), ShopwareApiError = class extends Error {
1
+ // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/util.js
2
+ function jsonStringifyReplacer(e, t) {
3
+ return typeof t == "bigint" ? t.toString() : t;
4
+ }
5
+ var Cached = class {
6
+ constructor(e) {
7
+ this._getter = e, this._value = void 0;
8
+ }
9
+ get value() {
10
+ let e = this._getter;
11
+ return e !== void 0 && (this._value = e(), this._getter = void 0), this._value;
12
+ }
13
+ };
14
+ function cached(e) {
15
+ return new Cached(e);
16
+ }
17
+ function cleanRegex(e) {
18
+ let t = +!!e.startsWith("^"), n = e.endsWith("$") ? e.length - 1 : e.length;
19
+ return e.slice(t, n);
20
+ }
21
+ function assignProp(e, t, n) {
22
+ Object.defineProperty(e, t, {
23
+ value: n,
24
+ writable: !0,
25
+ enumerable: !0,
26
+ configurable: !0
27
+ });
28
+ }
29
+ var e = "captureStackTrace" in Error ? Error.captureStackTrace : (...e) => {};
30
+ function isObject(e) {
31
+ return typeof e == "object" && !!e && !Array.isArray(e);
32
+ }
33
+ function isPlainObject(e) {
34
+ if (isObject(e) === !1) return !1;
35
+ let t = e.constructor;
36
+ if (t === void 0 || typeof t != "function") return !0;
37
+ let n = t.prototype;
38
+ return isObject(n) !== !1 && Object.prototype.hasOwnProperty.call(n, "isPrototypeOf") !== !1;
39
+ }
40
+ function clone(e, t, n) {
41
+ let r = new e._zod.constr(t ?? e._zod.def);
42
+ return (!t || n?.parent) && (r._zod.parent = e), r;
43
+ }
44
+ function normalizeParams(e) {
45
+ let t = e;
46
+ if (!t) return {};
47
+ if (typeof t == "string") return { error: () => t };
48
+ if (t?.message !== void 0) {
49
+ if (t?.error !== void 0) throw Error("Cannot specify both `message` and `error` params");
50
+ t.error = t.message;
51
+ }
52
+ return delete t.message, typeof t.error == "string" ? {
53
+ ...t,
54
+ error: () => t.error
55
+ } : t;
56
+ }
57
+ function optionalKeys(e) {
58
+ return Object.keys(e).filter((t) => e[t]._zod.optin !== void 0 && e[t]._zod.optout === "optional");
59
+ }
60
+ function aborted(e, t = 0) {
61
+ if (e.aborted === !0) return !0;
62
+ for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue !== !0) return !0;
63
+ return !1;
64
+ }
65
+ function explicitlyAborted(e, t = 0) {
66
+ if (e.aborted === !0) return !0;
67
+ for (let n = t; n < e.issues.length; n++) if (e.issues[n]?.continue === !1) return !0;
68
+ return !1;
69
+ }
70
+ function prefixIssues(e, t) {
71
+ return t.map((t) => {
72
+ var n;
73
+ return (n = t).path ?? (n.path = []), t.path.unshift(e), t;
74
+ });
75
+ }
76
+ function unwrapMessage(e) {
77
+ return typeof e == "string" ? e : e?.message;
78
+ }
79
+ function sizeCaps(e) {
80
+ let t = [];
81
+ for (let n of e ?? []) {
82
+ let e = n._zod.def;
83
+ if (!/_(length|size)$|_equals$/.test(e.check)) break;
84
+ let r = e.maximum ?? e.length ?? e.size;
85
+ r >= 0 && t.push([r, n]);
86
+ }
87
+ return t;
88
+ }
89
+ function attachSchema(e, t, n) {
90
+ var r;
91
+ for (let i = t; i < e.length; i++) (r = e[i]).schema ?? (r.schema = n);
92
+ }
93
+ function finalizeIssue(e, t, n) {
94
+ var r;
95
+ let i = e.inst?._zod?.traits;
96
+ i?.has("$ZodType") && (i.has("$ZodCheck") ? (r = e).schema ?? (r.schema = e.inst) : e.schema = e.inst);
97
+ let a = e.schema === e.inst ? void 0 : e.schema?._zod.def?.error, o = e.message ? e.message : unwrapMessage(e.inst?._zod.def?.error?.(e)) ?? unwrapMessage(a?.(e)) ?? unwrapMessage(t?.error?.(e)) ?? unwrapMessage(n.customError?.(e)) ?? unwrapMessage(n.localeError?.(e)) ?? "Invalid input", s = {};
98
+ for (let t of Object.keys(e)) t !== "inst" && t !== "schema" && t !== "continue" && t !== "input" && t !== "__proto__" && (s[t] = e[t]);
99
+ return s.path ??= [], s.message = o, t?.reportInput && (s.input = e.input), s;
100
+ }
101
+ function members(e, t) {
102
+ for (let n in t) {
103
+ let r = Object.getOwnPropertyDescriptor(t, n);
104
+ r.get ? Object.defineProperty(e, n, {
105
+ ...r,
106
+ enumerable: !1
107
+ }) : defineBound(e, n, r.value);
108
+ }
109
+ }
110
+ function own(e, t, n, r = !0) {
111
+ return Object.defineProperty(e, t, {
112
+ configurable: !0,
113
+ writable: !0,
114
+ enumerable: r,
115
+ value: n
116
+ }), n;
117
+ }
118
+ function hide(e, t, n) {
119
+ return own(e, t, n, !1);
120
+ }
121
+ function defineBound(e, t, n) {
122
+ Object.defineProperty(e, t, {
123
+ configurable: !0,
124
+ get() {
125
+ return this == null ? n : own(this, t, n.bind(this));
126
+ },
127
+ set(e) {
128
+ own(this, t, e);
129
+ }
130
+ });
131
+ }
132
+ function claim(e, t) {
133
+ let n = Object.getPrototypeOf(e);
134
+ return t in n ? void 0 : n;
135
+ }
136
+ var t, n = !1, r = {
137
+ configurable: !0,
138
+ get() {
139
+ n = !0;
140
+ }
141
+ };
142
+ function defineLazyInternal(e, i, a) {
143
+ let o = Object.getPrototypeOf(e._zod);
144
+ i in o && t !== e._zod ? t = void 0 : (t = e._zod, Object.defineProperty(o, i, {
145
+ configurable: !0,
146
+ get() {
147
+ Object.defineProperty(this, i, r);
148
+ let e = n;
149
+ n = !1;
150
+ try {
151
+ let t = a(this);
152
+ return n ? delete this[i] : Object.defineProperty(this, i, {
153
+ configurable: !0,
154
+ writable: !0,
155
+ value: t
156
+ }), n ||= e, t;
157
+ } catch (t) {
158
+ throw delete this[i], n ||= e, t;
159
+ }
160
+ },
161
+ set(e) {
162
+ Object.defineProperty(this, i, {
163
+ configurable: !0,
164
+ writable: !0,
165
+ value: e
166
+ });
167
+ }
168
+ }));
169
+ }
170
+ function installLazyProp(e, t, n, r) {
171
+ let i = claim(e, t);
172
+ i && Object.defineProperty(i, t, {
173
+ configurable: !0,
174
+ get() {
175
+ let e = {
176
+ configurable: !0,
177
+ writable: !0,
178
+ enumerable: r,
179
+ value: void 0
180
+ };
181
+ return Object.defineProperty(this, t, e), e.value = n(this), Object.defineProperty(this, t, e), e.value;
182
+ },
183
+ set(e) {
184
+ Object.defineProperty(this, t, {
185
+ configurable: !0,
186
+ writable: !0,
187
+ enumerable: r,
188
+ value: e
189
+ });
190
+ }
191
+ });
192
+ }
193
+ // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/core.js
194
+ var i, a = {
195
+ value: void 0,
196
+ enumerable: !1
197
+ }, o = "captureStackTrace" in Error ? Error : null;
198
+ function newError(e) {
199
+ let t = o;
200
+ if (t) {
201
+ let n = t.stackTraceLimit;
202
+ if (typeof n == "number") {
203
+ try {
204
+ t.stackTraceLimit = 0;
205
+ } catch {
206
+ return o = null, new e();
207
+ }
208
+ try {
209
+ return new e();
210
+ } finally {
211
+ t.stackTraceLimit = n;
212
+ }
213
+ }
214
+ }
215
+ return new e();
216
+ }
217
+ /* @__NO_SIDE_EFFECTS__ */
218
+ function $constructor(e, t, n, r) {
219
+ let i = {};
220
+ function Internals(e) {
221
+ this.def = e, this.constr = _, this.traits = /* @__PURE__ */ new Set();
222
+ }
223
+ Internals.prototype = i;
224
+ let o = n, s = o && /* @__PURE__ */ new WeakSet();
225
+ function init(n, r) {
226
+ if (!n._zod) {
227
+ a.value = new Internals(r);
228
+ try {
229
+ Object.defineProperty(n, "_zod", a);
230
+ } finally {
231
+ a.value = void 0;
232
+ }
233
+ } else if (n._zod.traits.has(e)) return;
234
+ if (n._zod.traits.add(e), t(n, r), s) {
235
+ let e = Object.getPrototypeOf(n), t = n._zod.constr.prototype, r = e;
236
+ for (; r && r !== t;) r = Object.getPrototypeOf(r);
237
+ let i = r ?? e;
238
+ s.has(i) || (s.add(i), members(i, o));
239
+ }
240
+ let i = _.prototype;
241
+ for (let e in i) Object.prototype.hasOwnProperty.call(i, e) && (e in n || (n[e] = i[e].bind(n)));
242
+ }
243
+ let c = r?.Parent ?? Object;
244
+ class Definition extends c {}
245
+ Object.defineProperty(Definition, "name", { value: e });
246
+ function _(e) {
247
+ let t = r?.Parent ? newError(Definition) : this;
248
+ init(t, e);
249
+ let n = t._zod.deferred;
250
+ if (n) {
251
+ for (let e of n) e();
252
+ t._zod.deferred = void 0;
253
+ }
254
+ let i = globalThis.__zod_globalConfig?.postProcessor;
255
+ return i && i(t), t;
256
+ }
257
+ return Object.defineProperty(_, "init", { value: init }), Object.defineProperty(_, Symbol.hasInstance, { value: (t) => r?.Parent && t instanceof r.Parent ? !0 : t?._zod?.traits?.has(e) }), Object.defineProperty(_, "name", { value: e }), _;
258
+ }
259
+ var $ZodAsyncError = class extends Error {
260
+ constructor() {
261
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
262
+ }
263
+ };
264
+ (i = globalThis).__zod_globalConfig ?? (i.__zod_globalConfig = {});
265
+ var s = globalThis.__zod_globalConfig;
266
+ function config(e) {
267
+ return e && Object.assign(s, e), s;
268
+ }
269
+ // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/errors.js
270
+ function _getMessage() {
271
+ let e = this._zod;
272
+ return e.message ??= JSON.stringify(e.def, jsonStringifyReplacer, 2), e.message;
273
+ }
274
+ function _setMessage(e) {
275
+ this._zod.message = e;
276
+ }
277
+ var c = {
278
+ get: _getMessage,
279
+ set: _setMessage,
280
+ enumerable: !0,
281
+ configurable: !0
282
+ }, l = {
283
+ value: void 0,
284
+ enumerable: !1
285
+ }, u = /* @__PURE__ */ new WeakSet([Object.prototype, Error.prototype]), initializer = (e, t) => {
286
+ e.name = "$ZodError", l.value = t, Object.defineProperty(e, "issues", l), l.value = void 0, Object.defineProperty(e, "message", c);
287
+ let n = Object.getPrototypeOf(e);
288
+ u.has(n) || (u.add(n), Object.defineProperty(n, "toString", {
289
+ configurable: !0,
290
+ enumerable: !1,
291
+ get() {
292
+ let value = () => this.message;
293
+ return Object.defineProperty(this, "toString", {
294
+ value,
295
+ configurable: !0,
296
+ writable: !0
297
+ }), value;
298
+ },
299
+ set(e) {
300
+ Object.defineProperty(this, "toString", {
301
+ value: e,
302
+ configurable: !0,
303
+ writable: !0
304
+ });
305
+ }
306
+ }));
307
+ }, d = /* @__PURE__ */ $constructor("$ZodError", initializer, void 0, { Parent: Error }), _parse = (t) => {
308
+ let fn = (n, r, i, a) => {
309
+ let o = i ? {
310
+ ...i,
311
+ async: !1
312
+ } : { async: !1 }, s = n._zod.run({
313
+ value: r,
314
+ issues: []
315
+ }, o);
316
+ if (s instanceof Promise) throw new $ZodAsyncError();
317
+ if (s.issues.length) {
318
+ let n = new ((a?.Err) ?? t)(s.issues.map((e) => finalizeIssue(e, o, config())));
319
+ throw e(n, a?.callee ?? fn), n;
320
+ }
321
+ return s.value;
322
+ };
323
+ return fn;
324
+ }, f = /* @__PURE__*/ _parse(d), _parseAsync = (t) => {
325
+ let fn = async (n, r, i, a) => {
326
+ let o = i ? {
327
+ ...i,
328
+ async: !0
329
+ } : { async: !0 }, s = n._zod.run({
330
+ value: r,
331
+ issues: []
332
+ }, o);
333
+ if (s instanceof Promise && (s = await s), s.issues.length) {
334
+ let n = new ((a?.Err) ?? t)(s.issues.map((e) => finalizeIssue(e, o, config())));
335
+ throw e(n, a?.callee ?? fn), n;
336
+ }
337
+ return s.value;
338
+ };
339
+ return fn;
340
+ }, p = /* @__PURE__*/ _parseAsync(d), _safeParse = (e) => (t, n, r) => {
341
+ let i = r ? {
342
+ ...r,
343
+ async: !1
344
+ } : { async: !1 }, a = t._zod.run({
345
+ value: n,
346
+ issues: []
347
+ }, i);
348
+ if (a instanceof Promise) throw new $ZodAsyncError();
349
+ return a.issues.length ? failure(e, a.issues, i) : {
350
+ success: !0,
351
+ data: a.value
352
+ };
353
+ }, m = /* @__PURE__*/ _safeParse(d);
354
+ function failure(e, t, n) {
355
+ let r;
356
+ return {
357
+ success: !1,
358
+ get error() {
359
+ return r || (r = new e(t.map((e) => finalizeIssue(e, n, config()))), t = void 0, n = void 0), r;
360
+ },
361
+ set error(e) {
362
+ r = e, t = void 0, n = void 0;
363
+ }
364
+ };
365
+ }
366
+ var _safeParseAsync = (e) => async (t, n, r) => {
367
+ let i = r ? {
368
+ ...r,
369
+ async: !0
370
+ } : { async: !0 }, a = t._zod.run({
371
+ value: n,
372
+ issues: []
373
+ }, i);
374
+ return a instanceof Promise && (a = await a), a.issues.length ? failure(e, a.issues, i) : {
375
+ success: !0,
376
+ data: a.value
377
+ };
378
+ }, h = /* @__PURE__*/ _safeParseAsync(d), g = /^[\s\S]{0,}$/, v = /^-?\d+(?:\.\d+)?$/, y = {
379
+ major: 4,
380
+ minor: 6,
381
+ patch: 7
382
+ }, b = /*@__PURE__*/ $constructor("$ZodType", (e, t) => {
383
+ var n;
384
+ e ??= {}, e._zod.def = t, e._zod.bag = e._zod.bag || {}, e._zod.version = y;
385
+ let r = e._zod.def.checks, i = e._zod.traits.has("$ZodCheck") ? [e, ...r ?? []] : r?.length ? [...r] : [];
386
+ for (let t of i) for (let n of t._zod.onattach) n(e);
387
+ if (i.length === 0) (n = e._zod).deferred ?? (n.deferred = []), e._zod.deferred?.push(() => {
388
+ e._zod.run = e._zod.parse;
389
+ });
390
+ else {
391
+ let runChecks = (t, n, r) => {
392
+ if (t.memo) return t;
393
+ let i = aborted(t), a;
394
+ for (let o of n) {
395
+ if (o._zod.def.when) {
396
+ if (explicitlyAborted(t) || !o._zod.def.when(t)) continue;
397
+ } else if (i) continue;
398
+ let n = t.issues.length, s = o._zod.check(t);
399
+ if (s instanceof Promise && r?.async === !1) throw new $ZodAsyncError();
400
+ if (a || s instanceof Promise) a = (a ?? Promise.resolve()).then(async () => {
401
+ await s, t.issues.length !== n && (attachSchema(t.issues, n, e), i ||= aborted(t, n));
402
+ });
403
+ else {
404
+ if (t.issues.length === n) continue;
405
+ attachSchema(t.issues, n, e), i ||= aborted(t, n);
406
+ }
407
+ }
408
+ return a ? a.then(() => t) : t;
409
+ }, handleCanaryResult = (t, n, r) => {
410
+ if (aborted(t)) return t.aborted = !0, t;
411
+ let a = runChecks(n, i, r);
412
+ if (a instanceof Promise) {
413
+ if (r.async === !1) throw new $ZodAsyncError();
414
+ return a.then((t) => e._zod.parse(t, r));
415
+ }
416
+ return e._zod.parse(a, r);
417
+ };
418
+ e._zod.run = (t, n) => {
419
+ if (n.skipChecks) return e._zod.parse(t, n);
420
+ if (n.direction === "backward") {
421
+ let r = e._zod.parse({
422
+ value: t.value,
423
+ issues: []
424
+ }, {
425
+ ...n,
426
+ skipChecks: !0
427
+ });
428
+ return r instanceof Promise ? r.then((e) => handleCanaryResult(e, t, n)) : handleCanaryResult(r, t, n);
429
+ }
430
+ let r = e._zod.parse(t, n);
431
+ if (r instanceof Promise) {
432
+ if (n.async === !1) throw new $ZodAsyncError();
433
+ return r.then((e) => runChecks(e, i, n));
434
+ }
435
+ return runChecks(r, i, n);
436
+ };
437
+ }
438
+ }, {
439
+ get "~standard"() {
440
+ return hide(this, "~standard", standardProps(this));
441
+ },
442
+ set "~standard"(e) {
443
+ own(this, "~standard", e);
444
+ }
445
+ }), toStandardResult = (e, t) => e.issues.length ? { issues: e.issues.map((e) => finalizeIssue(e, t, config())) } : { value: e.value };
446
+ async function validateAsync(e, t) {
447
+ let n = { async: !0 };
448
+ return toStandardResult(await e._zod.run({
449
+ value: t,
450
+ issues: []
451
+ }, n), n);
452
+ }
453
+ function standardProps(e) {
454
+ return {
455
+ validate: (t) => {
456
+ let n = { async: !1 };
457
+ try {
458
+ let r = e._zod.run({
459
+ value: t,
460
+ issues: []
461
+ }, n);
462
+ if (!(r instanceof Promise)) return toStandardResult(r, n);
463
+ } catch {}
464
+ return validateAsync(e, t);
465
+ },
466
+ vendor: "zod",
467
+ version: 1
468
+ };
469
+ }
470
+ var x = /*@__PURE__*/ $constructor("$ZodString", (e, t) => {
471
+ b.init(e, t), e._zod.pattern = t.pattern ?? g, e._zod.parse = (n, r) => {
472
+ if (t.coerce) try {
473
+ n.value = String(n.value);
474
+ } catch {}
475
+ return typeof n.value == "string" || n.issues.push({
476
+ expected: "string",
477
+ code: "invalid_type",
478
+ input: n.value,
479
+ inst: e
480
+ }), n;
481
+ };
482
+ }), S = /*@__PURE__*/ $constructor("$ZodNumber", (e, t) => {
483
+ b.init(e, t), e._zod.pattern = v, e._zod.parse = (n, r) => {
484
+ if (t.coerce) try {
485
+ n.value = Number(n.value);
486
+ } catch {}
487
+ let i = n.value;
488
+ if (typeof i == "number" && !Number.isNaN(i) && Number.isFinite(i)) return n;
489
+ let a = typeof i == "number" ? Number.isNaN(i) ? "NaN" : Number.isFinite(i) ? void 0 : String(i) : void 0;
490
+ return n.issues.push({
491
+ expected: "number",
492
+ code: "invalid_type",
493
+ input: i,
494
+ inst: e,
495
+ ...a ? { received: a } : {}
496
+ }), n;
497
+ };
498
+ }), C = /*@__PURE__*/ $constructor("$ZodUnknown", (e, t) => {
499
+ b.init(e, t), e._zod.parse = (e) => e;
500
+ });
501
+ function capSize(e, t) {
502
+ let n = sizeCaps(e._zod.def.checks);
503
+ if (!n.length) return;
504
+ let r = Math.min(...n.map((e) => e[0])), i = e._zod.parse;
505
+ e._zod.parse = (n, a) => {
506
+ let o = t(n.value);
507
+ if (o > r && !a?.skipChecks && a?.direction !== "backward") {
508
+ for (let [t, r] of sizeCaps(e._zod.def.checks)) if (o > t && r._zod.def.when(n)) {
509
+ let t = n.issues.length;
510
+ return r._zod.check(n), n.issues[t].continue = !1, attachSchema(n.issues, t, e), n;
511
+ }
512
+ }
513
+ return i(n, a);
514
+ };
515
+ }
516
+ var arraySize = (e) => Array.isArray(e) ? e.length : -1;
517
+ function handleArrayResult(e, t, n) {
518
+ e.issues.length && t.issues.push(...prefixIssues(n, e.issues)), t.value[n] = e.value;
519
+ }
520
+ var w = /*@__PURE__*/ $constructor("$ZodArray", (e, t) => {
521
+ b.init(e, t);
522
+ let n = s.memoizer;
523
+ n?.attach(e), e._zod.parse = (r, i) => {
524
+ let a = r.value;
525
+ if (!Array.isArray(a)) return r.issues.push({
526
+ expected: "array",
527
+ code: "invalid_type",
528
+ input: a,
529
+ inst: e
530
+ }), r;
531
+ r.value = n ? n.alloc(e, r, Array(a.length), i) : Array(a.length);
532
+ let o = [], s = i?.abortEarly;
533
+ for (let e = 0; e < a.length; e++) {
534
+ let n = a[e], c = t.element._zod.run({
535
+ value: n,
536
+ issues: []
537
+ }, i);
538
+ if (c instanceof Promise) o.push(c.then((t) => handleArrayResult(t, r, e)));
539
+ else if (handleArrayResult(c, r, e), s && c.issues.length !== 0 && aborted(c)) break;
540
+ }
541
+ return o.length ? Promise.all(o).then(() => r) : r;
542
+ }, capSize(e, arraySize);
543
+ });
544
+ function handlePropertyResult(e, t, n, r, i, a) {
545
+ let o = n in r, s = a === "optional";
546
+ if (o || !s || i !== "optional") {
547
+ if (e.issues.length) {
548
+ if (i !== void 0 && s && !o) return;
549
+ t.issues.push(...prefixIssues(n, e.issues));
550
+ }
551
+ !o && i === void 0 ? e.issues.length || t.issues.push({
552
+ code: "invalid_type",
553
+ expected: "nonoptional",
554
+ input: void 0,
555
+ path: [n]
556
+ }) : e.value === void 0 ? (o || i === "defaulted" && !s) && (t.value[n] = void 0) : t.value[n] = e.value;
557
+ }
558
+ }
559
+ var T = [];
560
+ function normalizeDef(e) {
561
+ let t = Object.keys(e.shape), n = Object.getOwnPropertySymbols(e.shape), r = n.length ? n : T, i = r.length ? [...t, ...r] : t;
562
+ for (let t of i) if (!e.shape?.[t]?._zod?.traits?.has("$ZodType")) throw Error(`Invalid element at key "${String(t)}": expected a Zod schema`);
563
+ let a = optionalKeys(e.shape);
564
+ return {
565
+ ...e,
566
+ allKeys: i,
567
+ symbolKeys: r,
568
+ keySet: new Set(t),
569
+ numKeys: t.length,
570
+ optionalKeys: new Set(a)
571
+ };
572
+ }
573
+ function handleCatchall(e, t, n, r, i, a, o) {
574
+ let s = [], c = i.keySet, l = i.catchall._zod, u = l.def.type, d = l.optin, f = l.optout, p = 0;
575
+ for (let i in t) {
576
+ if (o && n.issues.length !== p) {
577
+ if (aborted(n, p)) break;
578
+ p = n.issues.length;
579
+ }
580
+ if (c.has(i)) continue;
581
+ if (i === "__proto__") {
582
+ u === "never" && s.push(i);
583
+ continue;
584
+ }
585
+ if (u === "never") {
586
+ s.push(i);
587
+ continue;
588
+ }
589
+ let a = l.run({
590
+ value: t[i],
591
+ issues: []
592
+ }, r);
593
+ a instanceof Promise ? e.push(a.then((e) => handlePropertyResult(e, n, i, t, d, f))) : handlePropertyResult(a, n, i, t, d, f);
594
+ }
595
+ return s.length && n.issues.push({
596
+ code: "unrecognized_keys",
597
+ keys: s,
598
+ input: t,
599
+ inst: a,
600
+ continue: !0
601
+ }), e.length ? Promise.all(e).then(() => n) : n;
602
+ }
603
+ var E = /*@__PURE__*/ $constructor("$ZodObject", (e, t) => {
604
+ b.init(e, t);
605
+ let n = Object.getOwnPropertyDescriptor(t, "shape"), r = n?.get ? n.get.raw : t.shape ?? {};
606
+ if (r) {
607
+ let get = () => {
608
+ let e = { ...r };
609
+ return Object.defineProperty(t, "shape", { value: e }), get.raw = e, e;
610
+ };
611
+ get.raw = r, Object.defineProperty(t, "shape", { get });
612
+ }
613
+ let i = cached(() => normalizeDef(t));
614
+ defineLazyInternal(e, "propValues", (e) => {
615
+ let t = e.def.shape, n = {};
616
+ for (let e in t) {
617
+ let r = t[e]._zod;
618
+ if (r.values) {
619
+ Object.prototype.hasOwnProperty.call(n, e) || assignProp(n, e, /* @__PURE__ */ new Set());
620
+ for (let t of r.values) n[e].add(t);
621
+ r.optin !== void 0 && n[e].add(void 0);
622
+ }
623
+ }
624
+ return n;
625
+ });
626
+ let a = isObject, o = t.catchall, c, l = s.memoizer;
627
+ l?.attach(e), e._zod.parse = (t, n) => {
628
+ c ??= i.value;
629
+ let r = t.value;
630
+ if (!a(r)) return t.issues.push({
631
+ expected: "object",
632
+ code: "invalid_type",
633
+ input: r,
634
+ inst: e
635
+ }), t;
636
+ t.value = l ? l.alloc(e, t, {}, n) : {};
637
+ let s = [], u = c.shape, d = n?.abortEarly, f = t.issues.length;
638
+ for (let e of c.allKeys) {
639
+ if (d && t.issues.length !== f) {
640
+ if (aborted(t, f)) break;
641
+ f = t.issues.length;
642
+ }
643
+ if (e === "__proto__") continue;
644
+ let i = u[e], a = i._zod.optin, o = i._zod.optout, c = i._zod.run({
645
+ value: r[e],
646
+ issues: []
647
+ }, n);
648
+ c instanceof Promise ? s.push(c.then((n) => handlePropertyResult(n, t, e, r, a, o))) : handlePropertyResult(c, t, e, r, a, o);
649
+ }
650
+ return o ? handleCatchall(s, r, t, n, i.value, e, d === !0) : s.length ? Promise.all(s).then(() => t) : t;
651
+ };
652
+ }), D = /*@__PURE__*/ $constructor("$ZodRecord", (e, t) => {
653
+ b.init(e, t);
654
+ let n = s.memoizer;
655
+ n?.attach(e), e._zod.parse = (r, i) => {
656
+ let a = r.value;
657
+ if (!isPlainObject(a)) return r.issues.push({
658
+ expected: "record",
659
+ code: "invalid_type",
660
+ input: a,
661
+ inst: e
662
+ }), r;
663
+ let o = [], s = t.keyType._zod.values;
664
+ if (s && !t.partial) {
665
+ r.value = n ? n.alloc(e, r, {}, i) : {};
666
+ let c = /* @__PURE__ */ new Set();
667
+ for (let n of s) if (typeof n == "string" || typeof n == "number" || typeof n == "symbol") {
668
+ if (c.add(typeof n == "number" ? n.toString() : n), n === "__proto__") continue;
669
+ let s = t.keyType._zod.run({
670
+ value: n,
671
+ issues: []
672
+ }, i);
673
+ if (s instanceof Promise) throw Error("Async schemas not supported in object keys currently");
674
+ if (s.issues.length) {
675
+ r.issues.push({
676
+ code: "invalid_key",
677
+ origin: "record",
678
+ issues: s.issues.map((e) => finalizeIssue(e, i, config())),
679
+ input: n,
680
+ path: [n],
681
+ inst: e
682
+ });
683
+ continue;
684
+ }
685
+ let l = s.value;
686
+ if (l === "__proto__") continue;
687
+ let u = t.valueType._zod.run({
688
+ value: a[n],
689
+ issues: []
690
+ }, i);
691
+ u instanceof Promise ? o.push(u.then((e) => {
692
+ e.issues.length && r.issues.push(...prefixIssues(n, e.issues)), r.value[l] = e.value;
693
+ })) : (u.issues.length && r.issues.push(...prefixIssues(n, u.issues)), r.value[l] = u.value);
694
+ }
695
+ let l;
696
+ for (let e in a) if (!c.has(e)) {
697
+ if (t.mode === "loose") {
698
+ if (e === "__proto__") continue;
699
+ r.value[e] = a[e];
700
+ } else l ??= [], l.push(e);
701
+ }
702
+ l && l.length > 0 && r.issues.push({
703
+ code: "unrecognized_keys",
704
+ input: a,
705
+ inst: e,
706
+ keys: l,
707
+ continue: !0
708
+ });
709
+ } else {
710
+ r.value = n ? n.alloc(e, r, {}, i) : {};
711
+ let c;
712
+ for (let n of Reflect.ownKeys(a)) {
713
+ if (n === "__proto__" || !Object.prototype.propertyIsEnumerable.call(a, n)) continue;
714
+ let l = t.keyType._zod.run({
715
+ value: n,
716
+ issues: []
717
+ }, i);
718
+ if (l instanceof Promise) throw Error("Async schemas not supported in object keys currently");
719
+ if (typeof n == "string" && v.test(n) && l.issues.length) {
720
+ let e = t.keyType._zod.run({
721
+ value: Number(n),
722
+ issues: []
723
+ }, i);
724
+ if (e instanceof Promise) throw Error("Async schemas not supported in object keys currently");
725
+ e.issues.length === 0 && (l = e);
726
+ }
727
+ if (l.issues.length) {
728
+ t.mode === "loose" ? r.value[n] = a[n] : s ? (c ??= [], c.push(n)) : r.issues.push({
729
+ code: "invalid_key",
730
+ origin: "record",
731
+ issues: l.issues.map((e) => finalizeIssue(e, i, config())),
732
+ input: n,
733
+ path: [n],
734
+ inst: e
735
+ });
736
+ continue;
737
+ }
738
+ let u = l.value;
739
+ if (u === "__proto__") continue;
740
+ let d = t.valueType._zod.run({
741
+ value: a[n],
742
+ issues: []
743
+ }, i);
744
+ d instanceof Promise ? o.push(d.then((e) => {
745
+ e.issues.length && r.issues.push(...prefixIssues(n, e.issues)), r.value[u] = e.value;
746
+ })) : (d.issues.length && r.issues.push(...prefixIssues(n, d.issues)), r.value[u] = d.value);
747
+ }
748
+ c && c.length > 0 && r.issues.push({
749
+ code: "unrecognized_keys",
750
+ input: a,
751
+ inst: e,
752
+ keys: c,
753
+ continue: !0
754
+ });
755
+ }
756
+ return o.length ? Promise.all(o).then(() => r) : r;
757
+ };
758
+ });
759
+ function handleOptionalResult(e, t) {
760
+ return e.value = t.issues.length ? void 0 : t.value, e;
761
+ }
762
+ var O = /*@__PURE__*/ $constructor("$ZodOptional", (e, t) => {
763
+ b.init(e, t), defineLazyInternal(e, "optin", (e) => e.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional"), e._zod.optout = "optional", defineLazyInternal(e, "values", (e) => {
764
+ let t = e.def.innerType._zod.values;
765
+ return t ? /* @__PURE__ */ new Set([...t, void 0]) : void 0;
766
+ }), defineLazyInternal(e, "pattern", (e) => {
767
+ let t = e.def.innerType._zod.pattern;
768
+ return t ? RegExp(`^(${cleanRegex(t.source)})?$`) : void 0;
769
+ }), e._zod.parse = (e, n) => {
770
+ if (e.value === void 0) {
771
+ if (t.innerType._zod.optin !== "defaulted") return e;
772
+ let r = t.innerType._zod.run({
773
+ value: e.value,
774
+ issues: []
775
+ }, n);
776
+ return r instanceof Promise ? r.then((t) => handleOptionalResult(e, t)) : handleOptionalResult(e, r);
777
+ }
778
+ return t.innerType._zod.run(e, n);
779
+ };
780
+ });
781
+ // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/core/api.js
782
+ function snapshotChecks(e) {
783
+ return e.checks &&= [...e.checks], e;
784
+ }
785
+ // @__NO_SIDE_EFFECTS__
786
+ function _string(e, t) {
787
+ return new e(snapshotChecks({
788
+ type: "string",
789
+ ...normalizeParams(t)
790
+ }));
791
+ }
792
+ // @__NO_SIDE_EFFECTS__
793
+ function _number(e, t) {
794
+ return new e(snapshotChecks({
795
+ type: "number",
796
+ checks: [],
797
+ ...normalizeParams(t)
798
+ }));
799
+ }
800
+ // @__NO_SIDE_EFFECTS__
801
+ function _unknown(e) {
802
+ return new e({ type: "unknown" });
803
+ }
804
+ // ../../node_modules/.pnpm/zod@4.6.7/node_modules/zod/v4/mini/schemas.js
805
+ var k = /*@__PURE__*/ $constructor("ZodMiniType", (e, t) => {
806
+ if (!e._zod) throw Error("Uninitialized schema in ZodMiniType.");
807
+ b.init(e, t), e.def = t, e.type = t.type;
808
+ }, {
809
+ get with() {
810
+ return this.check;
811
+ },
812
+ set with(e) {
813
+ own(this, "with", e);
814
+ },
815
+ parse(e, t) {
816
+ return f(this, e, t, { callee: this.parse });
817
+ },
818
+ parseAsync(e, t) {
819
+ return p(this, e, t, { callee: this.parseAsync });
820
+ },
821
+ safeParse(e, t) {
822
+ return m(this, e, t);
823
+ },
824
+ safeParseAsync(e, t) {
825
+ return h(this, e, t);
826
+ },
827
+ check(...e) {
828
+ let t = this.def;
829
+ return this.clone({
830
+ ...t,
831
+ checks: [...t.checks ?? [], ...e.map((e) => typeof e == "function" ? { _zod: {
832
+ check: e,
833
+ def: { check: "custom" },
834
+ onattach: []
835
+ } } : e)]
836
+ }, { parent: !0 });
837
+ },
838
+ clone(e, t) {
839
+ return clone(this, e, t);
840
+ },
841
+ brand() {
842
+ return this;
843
+ },
844
+ register(e, t) {
845
+ return e.add(this, t), this;
846
+ },
847
+ apply(e, ...t) {
848
+ return t.length === 0 ? e(this) : e(this, ...t);
849
+ }
850
+ }), A = /*@__PURE__*/ $constructor("ZodMiniString", (e, t) => {
851
+ x.init(e, t), k.init(e, t);
852
+ });
853
+ // @__NO_SIDE_EFFECTS__
854
+ function string(e) {
855
+ return /* @__PURE__ */ _string(A, e);
856
+ }
857
+ var j = /*@__PURE__*/ $constructor("ZodMiniNumber", (e, t) => {
858
+ S.init(e, t), k.init(e, t);
859
+ });
860
+ // @__NO_SIDE_EFFECTS__
861
+ function number(e) {
862
+ return /* @__PURE__ */ _number(j, e);
863
+ }
864
+ var M = /*@__PURE__*/ $constructor("ZodMiniUnknown", (e, t) => {
865
+ C.init(e, t), k.init(e, t);
866
+ });
867
+ // @__NO_SIDE_EFFECTS__
868
+ function unknown() {
869
+ return /* @__PURE__ */ _unknown(M);
870
+ }
871
+ var N = /*@__PURE__*/ $constructor("ZodMiniArray", (e, t) => {
872
+ w.init(e, t), k.init(e, t);
873
+ });
874
+ // @__NO_SIDE_EFFECTS__
875
+ function array(e, t) {
876
+ return new N({
877
+ type: "array",
878
+ element: e,
879
+ ...normalizeParams(t)
880
+ });
881
+ }
882
+ var P = /*@__PURE__*/ $constructor("ZodMiniObject", (e, t) => {
883
+ E.init(e, t), k.init(e, t), installLazyProp(e, "shape", (e) => e._zod.def.shape, !1);
884
+ });
885
+ // @__NO_SIDE_EFFECTS__
886
+ function object(e, t) {
887
+ return new P({
888
+ type: "object",
889
+ shape: e ?? {},
890
+ ...normalizeParams(t)
891
+ });
892
+ }
893
+ var F = /*@__PURE__*/ $constructor("ZodMiniRecord", (e, t) => {
894
+ D.init(e, t), k.init(e, t);
895
+ });
896
+ // @__NO_SIDE_EFFECTS__
897
+ function record(e, t, n) {
898
+ return !t || !t._zod ? new F({
899
+ type: "record",
900
+ keyType: /* @__PURE__ */ string(),
901
+ valueType: e,
902
+ ...normalizeParams(t)
903
+ }) : new F({
904
+ type: "record",
905
+ keyType: e,
906
+ valueType: t,
907
+ ...normalizeParams(n)
908
+ });
909
+ }
910
+ var I = /*@__PURE__*/ $constructor("ZodMiniOptional", (e, t) => {
911
+ O.init(e, t), k.init(e, t);
912
+ });
913
+ // @__NO_SIDE_EFFECTS__
914
+ function optional(e) {
915
+ return new I({
916
+ type: "optional",
917
+ innerType: e
918
+ });
919
+ }
920
+ var L = /* @__PURE__ */ object({ errors: /* @__PURE__ */ array(/* @__PURE__ */ object({
921
+ status: /* @__PURE__ */ string(),
922
+ code: /* @__PURE__ */ string(),
923
+ title: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
924
+ detail: /* @__PURE__ */ optional(/* @__PURE__ */ string()),
925
+ meta: /* @__PURE__ */ optional(/* @__PURE__ */ record(/* @__PURE__ */ string(), /* @__PURE__ */ unknown())),
926
+ source: /* @__PURE__ */ optional(/* @__PURE__ */ object({ pointer: /* @__PURE__ */ optional(/* @__PURE__ */ string()) })),
927
+ trace: /* @__PURE__ */ optional(/* @__PURE__ */ array(/* @__PURE__ */ object({
928
+ file: /* @__PURE__ */ string(),
929
+ line: /* @__PURE__ */ number(),
930
+ function: /* @__PURE__ */ string()
931
+ })))
932
+ })) }), ShopwareApiError = class extends Error {
16
933
  status;
17
934
  response;
18
935
  errors;
19
- constructor(e, t, r) {
20
- super(e), this.status = t, this.response = r, this.name = "ShopwareApiError";
21
- let { success: i, data: a } = n.safeParse(r);
22
- this.errors = i ? a.errors : [];
936
+ constructor(e, t, n) {
937
+ super(e), this.status = t, this.response = n, this.name = "ShopwareApiError";
938
+ let { success: r, data: i } = L.safeParse(n);
939
+ this.errors = r ? i.errors : [];
23
940
  }
24
941
  }, EventEmitter = class {
25
942
  listeners = /* @__PURE__ */ new Map();
@@ -101,7 +1018,7 @@ function createQueryParams(e) {
101
1018
  return t;
102
1019
  }
103
1020
  // src/client.ts
104
- var r = /^(?<name>\w+?)\s(?<method>get|post|put|patch|delete)\s+(?<url>\/.*)/i, ShopwareClient = class extends EventEmitter {
1021
+ var R = /^(?<name>\w+?)\s(?<method>get|post|put|patch|delete)\s+(?<url>\/.*)/i, ShopwareClient = class extends EventEmitter {
105
1022
  options = {
106
1023
  baseURL: "",
107
1024
  apiKey: "",
@@ -174,7 +1091,7 @@ var r = /^(?<name>\w+?)\s(?<method>get|post|put|patch|delete)\s+(?<url>\/.*)/i,
174
1091
  return this.options.queryClientId;
175
1092
  }
176
1093
  parseOperation(e) {
177
- let t = r.exec(e);
1094
+ let t = R.exec(e);
178
1095
  if (!t?.groups) throw Error("Invalid operation format");
179
1096
  return {
180
1097
  name: t.groups.name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamnovu/kit-shopware-api-client",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "A client for the Shopware API",
5
5
  "files": [
6
6
  "dist",