@tidal-music/api 0.8.1 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +3014 -864
  2. package/dist/index.js +333 -377
  3. package/package.json +8 -8
package/dist/index.js CHANGED
@@ -1,389 +1,345 @@
1
- const V = /\{[^{}]+\}/g, X = () => typeof process == "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici;
2
- function Y() {
3
- return Math.random().toString(36).slice(2, 11);
1
+ //#region ../../node_modules/.pnpm/openapi-fetch@0.17.0/node_modules/openapi-fetch/dist/index.mjs
2
+ var e = /\{[^{}]+\}/g, t = () => typeof process == "object" && Number.parseInt(process?.versions?.node?.substring(0, 2)) >= 18 && process.versions.undici;
3
+ function n() {
4
+ return Math.random().toString(36).slice(2, 11);
4
5
  }
5
- function Z(n) {
6
- let {
7
- baseUrl: t = "",
8
- Request: e = globalThis.Request,
9
- fetch: o = globalThis.fetch,
10
- querySerializer: r,
11
- bodySerializer: i,
12
- pathSerializer: l,
13
- headers: f,
14
- requestInitExt: $ = void 0,
15
- ...J
16
- } = { ...n };
17
- $ = X() ? $ : void 0, t = B(t);
18
- const g = [];
19
- async function p(a, s) {
20
- const {
21
- baseUrl: m,
22
- fetch: O = o,
23
- Request: D = e,
24
- headers: I,
25
- params: w = {},
26
- parseAs: j = "json",
27
- querySerializer: S,
28
- bodySerializer: H = i ?? te,
29
- pathSerializer: Q,
30
- body: P,
31
- middleware: G = [],
32
- ...v
33
- } = s || {};
34
- let C = t;
35
- m && (C = B(m) ?? t);
36
- let x = typeof r == "function" ? r : M(r);
37
- S && (x = typeof S == "function" ? S : M({
38
- ...typeof r == "object" ? r : {},
39
- ...S
40
- }));
41
- const k = Q || l || ee, U = P === void 0 ? void 0 : H(
42
- P,
43
- // Note: we declare mergeHeaders() both here and below because it’s a bit of a chicken-or-egg situation:
44
- // bodySerializer() needs all headers so we aren’t dropping ones set by the user, however,
45
- // the result of this ALSO sets the lowest-priority content-type header. So we re-merge below,
46
- // setting the content-type at the very beginning to be overwritten.
47
- // Lastly, based on the way headers work, it’s not a simple “present-or-not” check becauase null intentionally un-sets headers.
48
- N(f, I, w.header)
49
- ), _ = N(
50
- // with no body, we should not to set Content-Type
51
- U === void 0 || // if serialized body is FormData; browser will correctly set Content-Type & boundary expression
52
- U instanceof FormData ? {} : {
53
- "Content-Type": "application/json"
54
- },
55
- f,
56
- I,
57
- w.header
58
- ), y = [...g, ...G], K = {
59
- redirect: "follow",
60
- ...J,
61
- ...v,
62
- body: U,
63
- headers: _
64
- };
65
- let E, T, h = new D(
66
- re(a, { baseUrl: C, params: w, querySerializer: x, pathSerializer: k }),
67
- K
68
- ), u;
69
- for (const d in v)
70
- d in h || (h[d] = v[d]);
71
- if (y.length) {
72
- E = Y(), T = Object.freeze({
73
- baseUrl: C,
74
- fetch: O,
75
- parseAs: j,
76
- querySerializer: x,
77
- bodySerializer: H,
78
- pathSerializer: k
79
- });
80
- for (const d of y)
81
- if (d && typeof d == "object" && typeof d.onRequest == "function") {
82
- const c = await d.onRequest({
83
- request: h,
84
- schemaPath: a,
85
- params: w,
86
- options: T,
87
- id: E
88
- });
89
- if (c)
90
- if (c instanceof D)
91
- h = c;
92
- else if (c instanceof Response) {
93
- u = c;
94
- break;
95
- } else
96
- throw new Error("onRequest: must return new Request() or Response() when modifying the request");
97
- }
98
- }
99
- if (!u) {
100
- try {
101
- u = await O(h, $);
102
- } catch (d) {
103
- let c = d;
104
- if (y.length)
105
- for (let b = y.length - 1; b >= 0; b--) {
106
- const z = y[b];
107
- if (z && typeof z == "object" && typeof z.onError == "function") {
108
- const R = await z.onError({
109
- request: h,
110
- error: c,
111
- schemaPath: a,
112
- params: w,
113
- options: T,
114
- id: E
115
- });
116
- if (R) {
117
- if (R instanceof Response) {
118
- c = void 0, u = R;
119
- break;
120
- }
121
- if (R instanceof Error) {
122
- c = R;
123
- continue;
124
- }
125
- throw new Error("onError: must return new Response() or instance of Error");
126
- }
127
- }
128
- }
129
- if (c)
130
- throw c;
131
- }
132
- if (y.length)
133
- for (let d = y.length - 1; d >= 0; d--) {
134
- const c = y[d];
135
- if (c && typeof c == "object" && typeof c.onResponse == "function") {
136
- const b = await c.onResponse({
137
- request: h,
138
- response: u,
139
- schemaPath: a,
140
- params: w,
141
- options: T,
142
- id: E
143
- });
144
- if (b) {
145
- if (!(b instanceof Response))
146
- throw new Error("onResponse: must return new Response() when modifying the response");
147
- u = b;
148
- }
149
- }
150
- }
151
- }
152
- const L = u.headers.get("Content-Length");
153
- if (u.status === 204 || h.method === "HEAD" || L === "0")
154
- return u.ok ? { data: void 0, response: u } : { error: void 0, response: u };
155
- if (u.ok)
156
- return { data: await (async () => {
157
- if (j === "stream")
158
- return u.body;
159
- if (j === "json" && !L) {
160
- const c = await u.text();
161
- return c ? JSON.parse(c) : void 0;
162
- }
163
- return await u[j]();
164
- })(), response: u };
165
- let q = await u.text();
166
- try {
167
- q = JSON.parse(q);
168
- } catch {
169
- }
170
- return { error: q, response: u };
171
- }
172
- return {
173
- request(a, s, m) {
174
- return p(s, { ...m, method: a.toUpperCase() });
175
- },
176
- /** Call a GET endpoint */
177
- GET(a, s) {
178
- return p(a, { ...s, method: "GET" });
179
- },
180
- /** Call a PUT endpoint */
181
- PUT(a, s) {
182
- return p(a, { ...s, method: "PUT" });
183
- },
184
- /** Call a POST endpoint */
185
- POST(a, s) {
186
- return p(a, { ...s, method: "POST" });
187
- },
188
- /** Call a DELETE endpoint */
189
- DELETE(a, s) {
190
- return p(a, { ...s, method: "DELETE" });
191
- },
192
- /** Call a OPTIONS endpoint */
193
- OPTIONS(a, s) {
194
- return p(a, { ...s, method: "OPTIONS" });
195
- },
196
- /** Call a HEAD endpoint */
197
- HEAD(a, s) {
198
- return p(a, { ...s, method: "HEAD" });
199
- },
200
- /** Call a PATCH endpoint */
201
- PATCH(a, s) {
202
- return p(a, { ...s, method: "PATCH" });
203
- },
204
- /** Call a TRACE endpoint */
205
- TRACE(a, s) {
206
- return p(a, { ...s, method: "TRACE" });
207
- },
208
- /** Register middleware */
209
- use(...a) {
210
- for (const s of a)
211
- if (s) {
212
- if (typeof s != "object" || !("onRequest" in s || "onResponse" in s || "onError" in s))
213
- throw new Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");
214
- g.push(s);
215
- }
216
- },
217
- /** Unregister middleware */
218
- eject(...a) {
219
- for (const s of a) {
220
- const m = g.indexOf(s);
221
- m !== -1 && g.splice(m, 1);
222
- }
223
- }
224
- };
6
+ function r(e) {
7
+ let { baseUrl: r = "", Request: i = globalThis.Request, fetch: a = globalThis.fetch, querySerializer: o, bodySerializer: p, pathSerializer: m, headers: h, requestInitExt: g = void 0, ..._ } = { ...e };
8
+ g = t() ? g : void 0, r = f(r);
9
+ let v = [];
10
+ async function y(e, t) {
11
+ let { baseUrl: y, fetch: b = a, Request: x = i, headers: S, params: C = {}, parseAs: w = "json", querySerializer: T, bodySerializer: E = p ?? l, pathSerializer: D, body: O, middleware: k = [], ...A } = t || {}, j = r;
12
+ y && (j = f(y) ?? r);
13
+ let M = typeof o == "function" ? o : s(o);
14
+ T && (M = typeof T == "function" ? T : s({
15
+ ...typeof o == "object" ? o : {},
16
+ ...T
17
+ }));
18
+ let N = D || m || c, P = O === void 0 ? void 0 : E(O, d(h, S, C.header)), F = d(P === void 0 || P instanceof FormData ? {} : { "Content-Type": "application/json" }, h, S, C.header), I = [...v, ...k], L = {
19
+ redirect: "follow",
20
+ ..._,
21
+ ...A,
22
+ body: P,
23
+ headers: F
24
+ }, R, z, B = new x(u(e, {
25
+ baseUrl: j,
26
+ params: C,
27
+ querySerializer: M,
28
+ pathSerializer: N
29
+ }), L), V;
30
+ for (let e in A) e in B || (B[e] = A[e]);
31
+ if (I.length) {
32
+ R = n(), z = Object.freeze({
33
+ baseUrl: j,
34
+ fetch: b,
35
+ parseAs: w,
36
+ querySerializer: M,
37
+ bodySerializer: E,
38
+ pathSerializer: N
39
+ });
40
+ for (let t of I) if (t && typeof t == "object" && typeof t.onRequest == "function") {
41
+ let n = await t.onRequest({
42
+ request: B,
43
+ schemaPath: e,
44
+ params: C,
45
+ options: z,
46
+ id: R
47
+ });
48
+ if (n) if (n instanceof x) B = n;
49
+ else if (n instanceof Response) {
50
+ V = n;
51
+ break;
52
+ } else throw Error("onRequest: must return new Request() or Response() when modifying the request");
53
+ }
54
+ }
55
+ if (!V) {
56
+ try {
57
+ V = await b(B, g);
58
+ } catch (t) {
59
+ let n = t;
60
+ if (I.length) for (let t = I.length - 1; t >= 0; t--) {
61
+ let r = I[t];
62
+ if (r && typeof r == "object" && typeof r.onError == "function") {
63
+ let t = await r.onError({
64
+ request: B,
65
+ error: n,
66
+ schemaPath: e,
67
+ params: C,
68
+ options: z,
69
+ id: R
70
+ });
71
+ if (t) {
72
+ if (t instanceof Response) {
73
+ n = void 0, V = t;
74
+ break;
75
+ }
76
+ if (t instanceof Error) {
77
+ n = t;
78
+ continue;
79
+ }
80
+ throw Error("onError: must return new Response() or instance of Error");
81
+ }
82
+ }
83
+ }
84
+ if (n) throw n;
85
+ }
86
+ if (I.length) for (let t = I.length - 1; t >= 0; t--) {
87
+ let n = I[t];
88
+ if (n && typeof n == "object" && typeof n.onResponse == "function") {
89
+ let t = await n.onResponse({
90
+ request: B,
91
+ response: V,
92
+ schemaPath: e,
93
+ params: C,
94
+ options: z,
95
+ id: R
96
+ });
97
+ if (t) {
98
+ if (!(t instanceof Response)) throw Error("onResponse: must return new Response() when modifying the response");
99
+ V = t;
100
+ }
101
+ }
102
+ }
103
+ }
104
+ let H = V.headers.get("Content-Length");
105
+ if (V.status === 204 || B.method === "HEAD" || H === "0" && !V.headers.get("Transfer-Encoding")?.includes("chunked")) return V.ok ? {
106
+ data: void 0,
107
+ response: V
108
+ } : {
109
+ error: void 0,
110
+ response: V
111
+ };
112
+ if (V.ok) return {
113
+ data: await (async () => {
114
+ if (w === "stream") return V.body;
115
+ if (w === "json" && !H) {
116
+ let e = await V.text();
117
+ return e ? JSON.parse(e) : void 0;
118
+ }
119
+ return await V[w]();
120
+ })(),
121
+ response: V
122
+ };
123
+ let U = await V.text();
124
+ try {
125
+ U = JSON.parse(U);
126
+ } catch {}
127
+ return {
128
+ error: U,
129
+ response: V
130
+ };
131
+ }
132
+ return {
133
+ request(e, t, n) {
134
+ return y(t, {
135
+ ...n,
136
+ method: e.toUpperCase()
137
+ });
138
+ },
139
+ GET(e, t) {
140
+ return y(e, {
141
+ ...t,
142
+ method: "GET"
143
+ });
144
+ },
145
+ PUT(e, t) {
146
+ return y(e, {
147
+ ...t,
148
+ method: "PUT"
149
+ });
150
+ },
151
+ POST(e, t) {
152
+ return y(e, {
153
+ ...t,
154
+ method: "POST"
155
+ });
156
+ },
157
+ DELETE(e, t) {
158
+ return y(e, {
159
+ ...t,
160
+ method: "DELETE"
161
+ });
162
+ },
163
+ OPTIONS(e, t) {
164
+ return y(e, {
165
+ ...t,
166
+ method: "OPTIONS"
167
+ });
168
+ },
169
+ HEAD(e, t) {
170
+ return y(e, {
171
+ ...t,
172
+ method: "HEAD"
173
+ });
174
+ },
175
+ PATCH(e, t) {
176
+ return y(e, {
177
+ ...t,
178
+ method: "PATCH"
179
+ });
180
+ },
181
+ TRACE(e, t) {
182
+ return y(e, {
183
+ ...t,
184
+ method: "TRACE"
185
+ });
186
+ },
187
+ use(...e) {
188
+ for (let t of e) if (t) {
189
+ if (typeof t != "object" || !("onRequest" in t || "onResponse" in t || "onError" in t)) throw Error("Middleware must be an object with one of `onRequest()`, `onResponse() or `onError()`");
190
+ v.push(t);
191
+ }
192
+ },
193
+ eject(...e) {
194
+ for (let t of e) {
195
+ let e = v.indexOf(t);
196
+ e !== -1 && v.splice(e, 1);
197
+ }
198
+ }
199
+ };
225
200
  }
226
- function A(n, t, e) {
227
- if (t == null)
228
- return "";
229
- if (typeof t == "object")
230
- throw new Error(
231
- "Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these."
232
- );
233
- return `${n}=${e?.allowReserved === !0 ? t : encodeURIComponent(t)}`;
201
+ function i(e, t, n) {
202
+ if (t == null) return "";
203
+ if (typeof t == "object") throw Error("Deeply-nested arrays/objects aren’t supported. Provide your own `querySerializer()` to handle these.");
204
+ return `${e}=${n?.allowReserved === !0 ? t : encodeURIComponent(t)}`;
234
205
  }
235
- function F(n, t, e) {
236
- if (!t || typeof t != "object")
237
- return "";
238
- const o = [], r = {
239
- simple: ",",
240
- label: ".",
241
- matrix: ";"
242
- }[e.style] || "&";
243
- if (e.style !== "deepObject" && e.explode === !1) {
244
- for (const f in t)
245
- o.push(f, e.allowReserved === !0 ? t[f] : encodeURIComponent(t[f]));
246
- const l = o.join(",");
247
- switch (e.style) {
248
- case "form":
249
- return `${n}=${l}`;
250
- case "label":
251
- return `.${l}`;
252
- case "matrix":
253
- return `;${n}=${l}`;
254
- default:
255
- return l;
256
- }
257
- }
258
- for (const l in t) {
259
- const f = e.style === "deepObject" ? `${n}[${l}]` : l;
260
- o.push(A(f, t[l], e));
261
- }
262
- const i = o.join(r);
263
- return e.style === "label" || e.style === "matrix" ? `${r}${i}` : i;
206
+ function a(e, t, n) {
207
+ if (!t || typeof t != "object") return "";
208
+ let r = [], a = {
209
+ simple: ",",
210
+ label: ".",
211
+ matrix: ";"
212
+ }[n.style] || "&";
213
+ if (n.style !== "deepObject" && n.explode === !1) {
214
+ for (let e in t) r.push(e, n.allowReserved === !0 ? t[e] : encodeURIComponent(t[e]));
215
+ let i = r.join(",");
216
+ switch (n.style) {
217
+ case "form": return `${e}=${i}`;
218
+ case "label": return `.${i}`;
219
+ case "matrix": return `;${e}=${i}`;
220
+ default: return i;
221
+ }
222
+ }
223
+ for (let a in t) {
224
+ let o = n.style === "deepObject" ? `${e}[${a}]` : a;
225
+ r.push(i(o, t[a], n));
226
+ }
227
+ let o = r.join(a);
228
+ return n.style === "label" || n.style === "matrix" ? `${a}${o}` : o;
264
229
  }
265
- function W(n, t, e) {
266
- if (!Array.isArray(t))
267
- return "";
268
- if (e.explode === !1) {
269
- const i = { form: ",", spaceDelimited: "%20", pipeDelimited: "|" }[e.style] || ",", l = (e.allowReserved === !0 ? t : t.map((f) => encodeURIComponent(f))).join(i);
270
- switch (e.style) {
271
- case "simple":
272
- return l;
273
- case "label":
274
- return `.${l}`;
275
- case "matrix":
276
- return `;${n}=${l}`;
277
- // case "spaceDelimited":
278
- // case "pipeDelimited":
279
- default:
280
- return `${n}=${l}`;
281
- }
282
- }
283
- const o = { simple: ",", label: ".", matrix: ";" }[e.style] || "&", r = [];
284
- for (const i of t)
285
- e.style === "simple" || e.style === "label" ? r.push(e.allowReserved === !0 ? i : encodeURIComponent(i)) : r.push(A(n, i, e));
286
- return e.style === "label" || e.style === "matrix" ? `${o}${r.join(o)}` : r.join(o);
230
+ function o(e, t, n) {
231
+ if (!Array.isArray(t)) return "";
232
+ if (n.explode === !1) {
233
+ let r = {
234
+ form: ",",
235
+ spaceDelimited: "%20",
236
+ pipeDelimited: "|"
237
+ }[n.style] || ",", i = (n.allowReserved === !0 ? t : t.map((e) => encodeURIComponent(e))).join(r);
238
+ switch (n.style) {
239
+ case "simple": return i;
240
+ case "label": return `.${i}`;
241
+ case "matrix": return `;${e}=${i}`;
242
+ default: return `${e}=${i}`;
243
+ }
244
+ }
245
+ let r = {
246
+ simple: ",",
247
+ label: ".",
248
+ matrix: ";"
249
+ }[n.style] || "&", a = [];
250
+ for (let r of t) n.style === "simple" || n.style === "label" ? a.push(n.allowReserved === !0 ? r : encodeURIComponent(r)) : a.push(i(e, r, n));
251
+ return n.style === "label" || n.style === "matrix" ? `${r}${a.join(r)}` : a.join(r);
287
252
  }
288
- function M(n) {
289
- return function(e) {
290
- const o = [];
291
- if (e && typeof e == "object")
292
- for (const r in e) {
293
- const i = e[r];
294
- if (i != null) {
295
- if (Array.isArray(i)) {
296
- if (i.length === 0)
297
- continue;
298
- o.push(
299
- W(r, i, {
300
- style: "form",
301
- explode: !0,
302
- ...n?.array,
303
- allowReserved: n?.allowReserved || !1
304
- })
305
- );
306
- continue;
307
- }
308
- if (typeof i == "object") {
309
- o.push(
310
- F(r, i, {
311
- style: "deepObject",
312
- explode: !0,
313
- ...n?.object,
314
- allowReserved: n?.allowReserved || !1
315
- })
316
- );
317
- continue;
318
- }
319
- o.push(A(r, i, n));
320
- }
321
- }
322
- return o.join("&");
323
- };
253
+ function s(e) {
254
+ return function(t) {
255
+ let n = [];
256
+ if (t && typeof t == "object") for (let r in t) {
257
+ let s = t[r];
258
+ if (s != null) {
259
+ if (Array.isArray(s)) {
260
+ if (s.length === 0) continue;
261
+ n.push(o(r, s, {
262
+ style: "form",
263
+ explode: !0,
264
+ ...e?.array,
265
+ allowReserved: e?.allowReserved || !1
266
+ }));
267
+ continue;
268
+ }
269
+ if (typeof s == "object") {
270
+ n.push(a(r, s, {
271
+ style: "deepObject",
272
+ explode: !0,
273
+ ...e?.object,
274
+ allowReserved: e?.allowReserved || !1
275
+ }));
276
+ continue;
277
+ }
278
+ n.push(i(r, s, e));
279
+ }
280
+ }
281
+ return n.join("&");
282
+ };
324
283
  }
325
- function ee(n, t) {
326
- let e = n;
327
- for (const o of n.match(V) ?? []) {
328
- let r = o.substring(1, o.length - 1), i = !1, l = "simple";
329
- if (r.endsWith("*") && (i = !0, r = r.substring(0, r.length - 1)), r.startsWith(".") ? (l = "label", r = r.substring(1)) : r.startsWith(";") && (l = "matrix", r = r.substring(1)), !t || t[r] === void 0 || t[r] === null)
330
- continue;
331
- const f = t[r];
332
- if (Array.isArray(f)) {
333
- e = e.replace(o, W(r, f, { style: l, explode: i }));
334
- continue;
335
- }
336
- if (typeof f == "object") {
337
- e = e.replace(o, F(r, f, { style: l, explode: i }));
338
- continue;
339
- }
340
- if (l === "matrix") {
341
- e = e.replace(o, `;${A(r, f)}`);
342
- continue;
343
- }
344
- e = e.replace(o, l === "label" ? `.${encodeURIComponent(f)}` : encodeURIComponent(f));
345
- }
346
- return e;
284
+ function c(t, n) {
285
+ let r = t;
286
+ for (let s of t.match(e) ?? []) {
287
+ let e = s.substring(1, s.length - 1), t = !1, c = "simple";
288
+ if (e.endsWith("*") && (t = !0, e = e.substring(0, e.length - 1)), e.startsWith(".") ? (c = "label", e = e.substring(1)) : e.startsWith(";") && (c = "matrix", e = e.substring(1)), !n || n[e] === void 0 || n[e] === null) continue;
289
+ let l = n[e];
290
+ if (Array.isArray(l)) {
291
+ r = r.replace(s, o(e, l, {
292
+ style: c,
293
+ explode: t
294
+ }));
295
+ continue;
296
+ }
297
+ if (typeof l == "object") {
298
+ r = r.replace(s, a(e, l, {
299
+ style: c,
300
+ explode: t
301
+ }));
302
+ continue;
303
+ }
304
+ if (c === "matrix") {
305
+ r = r.replace(s, `;${i(e, l)}`);
306
+ continue;
307
+ }
308
+ r = r.replace(s, c === "label" ? `.${encodeURIComponent(l)}` : encodeURIComponent(l));
309
+ }
310
+ return r;
347
311
  }
348
- function te(n, t) {
349
- return n instanceof FormData ? n : t && (t.get instanceof Function ? t.get("Content-Type") ?? t.get("content-type") : t["Content-Type"] ?? t["content-type"]) === "application/x-www-form-urlencoded" ? new URLSearchParams(n).toString() : JSON.stringify(n);
312
+ function l(e, t) {
313
+ return e instanceof FormData ? e : t && (t.get instanceof Function ? t.get("Content-Type") ?? t.get("content-type") : t["Content-Type"] ?? t["content-type"]) === "application/x-www-form-urlencoded" ? new URLSearchParams(e).toString() : JSON.stringify(e);
350
314
  }
351
- function re(n, t) {
352
- let e = `${t.baseUrl}${n}`;
353
- t.params?.path && (e = t.pathSerializer(e, t.params.path));
354
- let o = t.querySerializer(t.params.query ?? {});
355
- return o.startsWith("?") && (o = o.substring(1)), o && (e += `?${o}`), e;
315
+ function u(e, t) {
316
+ let n = `${t.baseUrl}${e}`;
317
+ t.params?.path && (n = t.pathSerializer(n, t.params.path));
318
+ let r = t.querySerializer(t.params.query ?? {});
319
+ return r.startsWith("?") && (r = r.substring(1)), r && (n += `?${r}`), n;
356
320
  }
357
- function N(...n) {
358
- const t = new Headers();
359
- for (const e of n) {
360
- if (!e || typeof e != "object")
361
- continue;
362
- const o = e instanceof Headers ? e.entries() : Object.entries(e);
363
- for (const [r, i] of o)
364
- if (i === null)
365
- t.delete(r);
366
- else if (Array.isArray(i))
367
- for (const l of i)
368
- t.append(r, l);
369
- else i !== void 0 && t.set(r, i);
370
- }
371
- return t;
321
+ function d(...e) {
322
+ let t = new Headers();
323
+ for (let n of e) {
324
+ if (!n || typeof n != "object") continue;
325
+ let e = n instanceof Headers ? n.entries() : Object.entries(n);
326
+ for (let [n, r] of e) if (r === null) t.delete(n);
327
+ else if (Array.isArray(r)) for (let e of r) t.append(n, e);
328
+ else r !== void 0 && t.set(n, r);
329
+ }
330
+ return t;
372
331
  }
373
- function B(n) {
374
- return n.endsWith("/") ? n.substring(0, n.length - 1) : n;
332
+ function f(e) {
333
+ return e.endsWith("/") ? e.substring(0, e.length - 1) : e;
375
334
  }
376
- function ne(n, t = "https://openapi.tidal.com/v2/") {
377
- const e = {
378
- async onRequest({ request: r }) {
379
- const i = await n.getCredentials();
380
- return r.headers.set("Authorization", `Bearer ${i.token}`), (r.method === "POST" || r.method === "PATCH" || r.method === "DELETE") && r.headers.set("Content-Type", "application/vnd.api+json"), r;
381
- }
382
- }, o = Z({
383
- baseUrl: t
384
- });
385
- return o.use(e), o;
335
+ //#endregion
336
+ //#region src/api.ts
337
+ function p(e, t = "https://openapi.tidal.com/v2/") {
338
+ let n = { async onRequest({ request: t }) {
339
+ let n = await e.getCredentials();
340
+ return t.headers.set("Authorization", `Bearer ${n.token}`), (t.method === "POST" || t.method === "PATCH" || t.method === "DELETE") && t.headers.set("Content-Type", "application/vnd.api+json"), t;
341
+ } }, i = r({ baseUrl: t });
342
+ return i.use(n), i;
386
343
  }
387
- export {
388
- ne as createAPIClient
389
- };
344
+ //#endregion
345
+ export { p as createAPIClient };