@tidal-music/api 0.9.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.
package/dist/index.d.ts CHANGED
@@ -1637,7 +1637,7 @@ export declare interface components {
1637
1637
  status: string;
1638
1638
  }[];
1639
1639
  };
1640
- Included: (components["schemas"]["AlbumStatistics_Resource_Object"] | components["schemas"]["Albums_Resource_Object"] | components["schemas"]["Appreciations_Resource_Object"] | components["schemas"]["ArtistBiographies_Resource_Object"] | components["schemas"]["ArtistClaims_Resource_Object"] | components["schemas"]["ArtistRoles_Resource_Object"] | components["schemas"]["Artists_Resource_Object"] | components["schemas"]["Artworks_Resource_Object"] | components["schemas"]["Comments_Resource_Object"] | components["schemas"]["ContentClaims_Resource_Object"] | components["schemas"]["Credits_Resource_Object"] | components["schemas"]["Downloads_Resource_Object"] | components["schemas"]["DspSharingLinks_Resource_Object"] | components["schemas"]["DynamicModules_Resource_Object"] | components["schemas"]["DynamicPages_Resource_Object"] | components["schemas"]["Genres_Resource_Object"] | components["schemas"]["Installations_Resource_Object"] | components["schemas"]["Lyrics_Resource_Object"] | components["schemas"]["ManualArtistClaims_Resource_Object"] | components["schemas"]["OfflineTasks_Resource_Object"] | components["schemas"]["PlayQueues_Resource_Object"] | components["schemas"]["Playlists_Resource_Object"] | components["schemas"]["PriceConfigurations_Resource_Object"] | components["schemas"]["Providers_Resource_Object"] | components["schemas"]["Reactions_Resource_Object"] | components["schemas"]["SavedShares_Resource_Object"] | components["schemas"]["SearchResults_Resource_Object"] | components["schemas"]["SearchSuggestions_Resource_Object"] | components["schemas"]["Shares_Resource_Object"] | components["schemas"]["StripeConnections_Resource_Object"] | components["schemas"]["StripeDashboardLinks_Resource_Object"] | components["schemas"]["TrackFiles_Resource_Object"] | components["schemas"]["TrackManifests_Resource_Object"] | components["schemas"]["TrackSourceFiles_Resource_Object"] | components["schemas"]["TrackStatistics_Resource_Object"] | components["schemas"]["Tracks_Resource_Object"] | components["schemas"]["TracksMetadataStatus_Resource_Object"] | components["schemas"]["UsageRules_Resource_Object"] | components["schemas"]["UserCollectionAlbums_Resource_Object"] | components["schemas"]["UserCollectionArtists_Resource_Object"] | components["schemas"]["UserCollectionFolders_Resource_Object"] | components["schemas"]["UserCollectionPlaylists_Resource_Object"] | components["schemas"]["UserCollectionTracks_Resource_Object"] | components["schemas"]["UserCollectionVideos_Resource_Object"] | components["schemas"]["UserCollections_Resource_Object"] | components["schemas"]["UserRecommendations_Resource_Object"] | components["schemas"]["UserReports_Resource_Object"] | components["schemas"]["Users_Resource_Object"] | components["schemas"]["VideoManifests_Resource_Object"] | components["schemas"]["Videos_Resource_Object"])[];
1640
+ Included: (components["schemas"]["AlbumStatistics_Resource_Object"] | components["schemas"]["Albums_Resource_Object"] | components["schemas"]["Appreciations_Resource_Object"] | components["schemas"]["ArtistBiographies_Resource_Object"] | components["schemas"]["ArtistClaims_Resource_Object"] | components["schemas"]["ArtistRoles_Resource_Object"] | components["schemas"]["Artists_Resource_Object"] | components["schemas"]["Artworks_Resource_Object"] | components["schemas"]["Comments_Resource_Object"] | components["schemas"]["ContentClaims_Resource_Object"] | components["schemas"]["Credits_Resource_Object"] | components["schemas"]["Downloads_Resource_Object"] | components["schemas"]["DspSharingLinks_Resource_Object"] | components["schemas"]["DynamicModules_Resource_Object"] | components["schemas"]["DynamicPages_Resource_Object"] | components["schemas"]["Genres_Resource_Object"] | components["schemas"]["Installations_Resource_Object"] | components["schemas"]["Lyrics_Resource_Object"] | components["schemas"]["ManualArtistClaims_Resource_Object"] | components["schemas"]["OfflineTasks_Resource_Object"] | components["schemas"]["PlayQueues_Resource_Object"] | components["schemas"]["Playlists_Resource_Object"] | components["schemas"]["PriceConfigurations_Resource_Object"] | components["schemas"]["Providers_Resource_Object"] | components["schemas"]["Reactions_Resource_Object"] | components["schemas"]["SavedShares_Resource_Object"] | components["schemas"]["SearchResults_Resource_Object"] | components["schemas"]["SearchSuggestions_Resource_Object"] | components["schemas"]["Shares_Resource_Object"] | components["schemas"]["StripeConnections_Resource_Object"] | components["schemas"]["StripeDashboardLinks_Resource_Object"] | components["schemas"]["TrackFiles_Resource_Object"] | components["schemas"]["TrackManifests_Resource_Object"] | components["schemas"]["TrackSourceFiles_Resource_Object"] | components["schemas"]["TrackStatistics_Resource_Object"] | components["schemas"]["Tracks_Resource_Object"] | components["schemas"]["TracksMetadataStatus_Resource_Object"] | components["schemas"]["UsageRules_Resource_Object"] | components["schemas"]["UserCollectionAlbums_Resource_Object"] | components["schemas"]["UserCollectionArtists_Resource_Object"] | components["schemas"]["UserCollectionFolders_Resource_Object"] | components["schemas"]["UserCollectionPlaylists_Resource_Object"] | components["schemas"]["UserCollectionTracks_Resource_Object"] | components["schemas"]["UserCollectionVideos_Resource_Object"] | components["schemas"]["UserCollections_Resource_Object"] | components["schemas"]["UserDataExportRequests_Resource_Object"] | components["schemas"]["UserRecommendations_Resource_Object"] | components["schemas"]["UserReports_Resource_Object"] | components["schemas"]["Users_Resource_Object"] | components["schemas"]["VideoManifests_Resource_Object"] | components["schemas"]["Videos_Resource_Object"])[];
1641
1641
  InstallationsCreateOperation_Payload: {
1642
1642
  data: components["schemas"]["InstallationsCreateOperation_Payload_Data"];
1643
1643
  };
@@ -4430,6 +4430,48 @@ export declare interface components {
4430
4430
  /** Format: date-time */
4431
4431
  addedAt: string;
4432
4432
  };
4433
+ UserDataExportRequestsCreateOperation_Payload: {
4434
+ data: components["schemas"]["UserDataExportRequestsCreateOperation_Payload_Data"];
4435
+ };
4436
+ UserDataExportRequestsCreateOperation_Payload_Data: {
4437
+ attributes: components["schemas"]["UserDataExportRequestsCreateOperation_Payload_Data_Attributes"];
4438
+ /** @enum {string} */
4439
+ type: "userDataExportRequests";
4440
+ };
4441
+ UserDataExportRequestsCreateOperation_Payload_Data_Attributes: {
4442
+ /** @enum {string} */
4443
+ flowType: "GDPR" | "CCPA" | "COPPA" | "ANZ_PA" | "US_PRIVACY_REGULATION" | "APPI" | "RETENTION_POLICY";
4444
+ };
4445
+ UserDataExportRequests_Attributes: {
4446
+ /**
4447
+ * @description The type of data export flow
4448
+ * @enum {string}
4449
+ */
4450
+ flowType: "GDPR" | "CCPA" | "COPPA" | "ANZ_PA" | "US_PRIVACY_REGULATION" | "APPI" | "RETENTION_POLICY";
4451
+ };
4452
+ UserDataExportRequests_Multi_Resource_Data_Document: {
4453
+ data: components["schemas"]["UserDataExportRequests_Resource_Object"][];
4454
+ included?: components["schemas"]["Included"];
4455
+ links: components["schemas"]["Links"];
4456
+ };
4457
+ UserDataExportRequests_Resource_Object: {
4458
+ attributes?: components["schemas"]["UserDataExportRequests_Attributes"];
4459
+ /**
4460
+ * @description Resource id
4461
+ * @example 12345
4462
+ */
4463
+ id: string;
4464
+ /**
4465
+ * @description Resource type (enum property replaced by openapi-typescript)
4466
+ * @enum {string}
4467
+ */
4468
+ type: "userDataExportRequests";
4469
+ };
4470
+ UserDataExportRequests_Single_Resource_Data_Document: {
4471
+ data: components["schemas"]["UserDataExportRequests_Resource_Object"];
4472
+ included?: components["schemas"]["Included"];
4473
+ links: components["schemas"]["Links"];
4474
+ };
4433
4475
  UserRecommendations_Attributes: Record<string, never>;
4434
4476
  UserRecommendations_Multi_Relationship_Data_Document: {
4435
4477
  data?: components["schemas"]["Resource_Identifier"][];
@@ -19474,6 +19516,62 @@ declare interface paths {
19474
19516
  patch?: never;
19475
19517
  trace?: never;
19476
19518
  };
19519
+ "/userDataExportRequests": {
19520
+ parameters: {
19521
+ query?: never;
19522
+ header?: never;
19523
+ path?: never;
19524
+ cookie?: never;
19525
+ };
19526
+ get?: never;
19527
+ put?: never;
19528
+ /**
19529
+ * Create single userDataExportRequest.
19530
+ * @description Creates a new userDataExportRequest.
19531
+ */
19532
+ post: {
19533
+ parameters: {
19534
+ query?: never;
19535
+ header?: {
19536
+ /** @description Unique idempotency key for safe retry of mutation requests. If a duplicate key is sent with the same payload, the original response is replayed. If the payload differs, a 422 error is returned. */
19537
+ "Idempotency-Key"?: components["parameters"]["IdempotencyKey"];
19538
+ };
19539
+ path?: never;
19540
+ cookie?: never;
19541
+ };
19542
+ requestBody?: {
19543
+ content: {
19544
+ "application/vnd.api+json": components["schemas"]["UserDataExportRequestsCreateOperation_Payload"];
19545
+ };
19546
+ };
19547
+ responses: {
19548
+ /** @description Successful response */
19549
+ 201: {
19550
+ headers: {
19551
+ [name: string]: unknown;
19552
+ };
19553
+ content: {
19554
+ "application/vnd.api+json": components["schemas"]["UserDataExportRequests_Single_Resource_Data_Document"];
19555
+ };
19556
+ };
19557
+ 400: components["responses"]["Default400Response"];
19558
+ 404: components["responses"]["Default404Response"];
19559
+ 405: components["responses"]["Default405Response"];
19560
+ 406: components["responses"]["Default406Response"];
19561
+ 409: components["responses"]["Idempotency409Response"];
19562
+ 415: components["responses"]["Default415Response"];
19563
+ 422: components["responses"]["Idempotency422Response"];
19564
+ 429: components["responses"]["Default429Response"];
19565
+ 500: components["responses"]["Default500Response"];
19566
+ 503: components["responses"]["Default503Response"];
19567
+ };
19568
+ };
19569
+ delete?: never;
19570
+ options?: never;
19571
+ head?: never;
19572
+ patch?: never;
19573
+ trace?: never;
19574
+ };
19477
19575
  "/userRecommendations/{id}": {
19478
19576
  parameters: {
19479
19577
  query?: never;
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: u,
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: E,
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
- E && (x = typeof E == "function" ? E : M({
38
- ...typeof r == "object" ? r : {},
39
- ...E
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(u, 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
- u,
56
- I,
57
- w.header
58
- ), h = [...g, ...G], K = {
59
- redirect: "follow",
60
- ...J,
61
- ...v,
62
- body: U,
63
- headers: _
64
- };
65
- let S, T, y = new D(
66
- re(a, { baseUrl: C, params: w, querySerializer: x, pathSerializer: k }),
67
- K
68
- ), c;
69
- for (const d in v)
70
- d in y || (y[d] = v[d]);
71
- if (h.length) {
72
- S = 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 h)
81
- if (d && typeof d == "object" && typeof d.onRequest == "function") {
82
- const f = await d.onRequest({
83
- request: y,
84
- schemaPath: a,
85
- params: w,
86
- options: T,
87
- id: S
88
- });
89
- if (f)
90
- if (f instanceof D)
91
- y = f;
92
- else if (f instanceof Response) {
93
- c = f;
94
- break;
95
- } else
96
- throw new Error("onRequest: must return new Request() or Response() when modifying the request");
97
- }
98
- }
99
- if (!c) {
100
- try {
101
- c = await O(y, $);
102
- } catch (d) {
103
- let f = d;
104
- if (h.length)
105
- for (let b = h.length - 1; b >= 0; b--) {
106
- const z = h[b];
107
- if (z && typeof z == "object" && typeof z.onError == "function") {
108
- const R = await z.onError({
109
- request: y,
110
- error: f,
111
- schemaPath: a,
112
- params: w,
113
- options: T,
114
- id: S
115
- });
116
- if (R) {
117
- if (R instanceof Response) {
118
- f = void 0, c = R;
119
- break;
120
- }
121
- if (R instanceof Error) {
122
- f = R;
123
- continue;
124
- }
125
- throw new Error("onError: must return new Response() or instance of Error");
126
- }
127
- }
128
- }
129
- if (f)
130
- throw f;
131
- }
132
- if (h.length)
133
- for (let d = h.length - 1; d >= 0; d--) {
134
- const f = h[d];
135
- if (f && typeof f == "object" && typeof f.onResponse == "function") {
136
- const b = await f.onResponse({
137
- request: y,
138
- response: c,
139
- schemaPath: a,
140
- params: w,
141
- options: T,
142
- id: S
143
- });
144
- if (b) {
145
- if (!(b instanceof Response))
146
- throw new Error("onResponse: must return new Response() when modifying the response");
147
- c = b;
148
- }
149
- }
150
- }
151
- }
152
- const L = c.headers.get("Content-Length");
153
- if (c.status === 204 || y.method === "HEAD" || L === "0" && !c.headers.get("Transfer-Encoding")?.includes("chunked"))
154
- return c.ok ? { data: void 0, response: c } : { error: void 0, response: c };
155
- if (c.ok)
156
- return { data: await (async () => {
157
- if (j === "stream")
158
- return c.body;
159
- if (j === "json" && !L) {
160
- const f = await c.text();
161
- return f ? JSON.parse(f) : void 0;
162
- }
163
- return await c[j]();
164
- })(), response: c };
165
- let q = await c.text();
166
- try {
167
- q = JSON.parse(q);
168
- } catch {
169
- }
170
- return { error: q, response: c };
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 u in t)
245
- o.push(u, e.allowReserved === !0 ? t[u] : encodeURIComponent(t[u]));
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 u = e.style === "deepObject" ? `${n}[${l}]` : l;
260
- o.push(A(u, 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((u) => encodeURIComponent(u))).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 u = t[r];
332
- if (Array.isArray(u)) {
333
- e = e.replace(o, W(r, u, { style: l, explode: i }));
334
- continue;
335
- }
336
- if (typeof u == "object") {
337
- e = e.replace(o, F(r, u, { style: l, explode: i }));
338
- continue;
339
- }
340
- if (l === "matrix") {
341
- e = e.replace(o, `;${A(r, u)}`);
342
- continue;
343
- }
344
- e = e.replace(o, l === "label" ? `.${encodeURIComponent(u)}` : encodeURIComponent(u));
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 };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tidal-music/api",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist"
@@ -18,18 +18,18 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "openapi-fetch": "0.17.0",
21
- "@tidal-music/api": "0.9.1"
21
+ "@tidal-music/api": "0.10.0"
22
22
  },
23
23
  "devDependencies": {
24
- "@vitest/coverage-v8": "4.0.18",
25
- "@vitest/ui": "4.0.18",
24
+ "@vitest/coverage-v8": "4.1.0",
25
+ "@vitest/ui": "4.1.0",
26
26
  "openapi-typescript": "7.13.0",
27
27
  "typescript": "5.9.3",
28
- "vite": "7.3.1",
28
+ "vite": "8.0.0",
29
29
  "vite-plugin-dts": "4.5.4",
30
- "vitest": "4.0.18",
31
- "@tidal-music/auth": "^1.4.0",
32
- "@tidal-music/common": "^0.2.0"
30
+ "vitest": "4.1.0",
31
+ "@tidal-music/common": "^0.2.0",
32
+ "@tidal-music/auth": "^1.4.0"
33
33
  },
34
34
  "scripts": {
35
35
  "build": "vite build",