@vllnt/convex-music 0.1.0-canary.09eea4e
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/LICENSE +21 -0
- package/README.md +169 -0
- package/dist/client/index.d.ts +284 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/index.js +166 -0
- package/dist/client/index.js.map +1 -0
- package/dist/client/types.d.ts +100 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/types.js +2 -0
- package/dist/client/types.js.map +1 -0
- package/dist/component/_generated/api.d.ts +125 -0
- package/dist/component/_generated/api.d.ts.map +1 -0
- package/dist/component/_generated/api.js +31 -0
- package/dist/component/_generated/api.js.map +1 -0
- package/dist/component/_generated/component.d.ts +1143 -0
- package/dist/component/_generated/component.d.ts.map +1 -0
- package/dist/component/_generated/component.js +11 -0
- package/dist/component/_generated/component.js.map +1 -0
- package/dist/component/_generated/dataModel.d.ts +46 -0
- package/dist/component/_generated/dataModel.d.ts.map +1 -0
- package/dist/component/_generated/dataModel.js +11 -0
- package/dist/component/_generated/dataModel.js.map +1 -0
- package/dist/component/_generated/server.d.ts +133 -0
- package/dist/component/_generated/server.d.ts.map +1 -0
- package/dist/component/_generated/server.js +80 -0
- package/dist/component/_generated/server.js.map +1 -0
- package/dist/component/actions.d.ts +144 -0
- package/dist/component/actions.d.ts.map +1 -0
- package/dist/component/actions.js +125 -0
- package/dist/component/actions.js.map +1 -0
- package/dist/component/catalog/browse_order.d.ts +22 -0
- package/dist/component/catalog/browse_order.d.ts.map +1 -0
- package/dist/component/catalog/browse_order.js +37 -0
- package/dist/component/catalog/browse_order.js.map +1 -0
- package/dist/component/catalog/field_source_policy.d.ts +30 -0
- package/dist/component/catalog/field_source_policy.d.ts.map +1 -0
- package/dist/component/catalog/field_source_policy.js +36 -0
- package/dist/component/catalog/field_source_policy.js.map +1 -0
- package/dist/component/catalog/merge.d.ts +58 -0
- package/dist/component/catalog/merge.d.ts.map +1 -0
- package/dist/component/catalog/merge.js +74 -0
- package/dist/component/catalog/merge.js.map +1 -0
- package/dist/component/catalog/mutations.d.ts +78 -0
- package/dist/component/catalog/mutations.d.ts.map +1 -0
- package/dist/component/catalog/mutations.js +259 -0
- package/dist/component/catalog/mutations.js.map +1 -0
- package/dist/component/catalog/promote.d.ts +21 -0
- package/dist/component/catalog/promote.d.ts.map +1 -0
- package/dist/component/catalog/promote.js +25 -0
- package/dist/component/catalog/promote.js.map +1 -0
- package/dist/component/catalog/queries.d.ts +421 -0
- package/dist/component/catalog/queries.d.ts.map +1 -0
- package/dist/component/catalog/queries.js +168 -0
- package/dist/component/catalog/queries.js.map +1 -0
- package/dist/component/config/mutations.d.ts +11 -0
- package/dist/component/config/mutations.d.ts.map +1 -0
- package/dist/component/config/mutations.js +30 -0
- package/dist/component/config/mutations.js.map +1 -0
- package/dist/component/config/queries.d.ts +9 -0
- package/dist/component/config/queries.d.ts.map +1 -0
- package/dist/component/config/queries.js +20 -0
- package/dist/component/config/queries.js.map +1 -0
- package/dist/component/convex.config.d.ts +3 -0
- package/dist/component/convex.config.d.ts.map +1 -0
- package/dist/component/convex.config.js +30 -0
- package/dist/component/convex.config.js.map +1 -0
- package/dist/component/crons.d.ts +11 -0
- package/dist/component/crons.d.ts.map +1 -0
- package/dist/component/crons.js +41 -0
- package/dist/component/crons.js.map +1 -0
- package/dist/component/imports/actions.d.ts +119 -0
- package/dist/component/imports/actions.d.ts.map +1 -0
- package/dist/component/imports/actions.js +442 -0
- package/dist/component/imports/actions.js.map +1 -0
- package/dist/component/imports/dedupe.d.ts +29 -0
- package/dist/component/imports/dedupe.d.ts.map +1 -0
- package/dist/component/imports/dedupe.js +33 -0
- package/dist/component/imports/dedupe.js.map +1 -0
- package/dist/component/imports/mutations.d.ts +59 -0
- package/dist/component/imports/mutations.d.ts.map +1 -0
- package/dist/component/imports/mutations.js +151 -0
- package/dist/component/imports/mutations.js.map +1 -0
- package/dist/component/imports/queries.d.ts +68 -0
- package/dist/component/imports/queries.d.ts.map +1 -0
- package/dist/component/imports/queries.js +22 -0
- package/dist/component/imports/queries.js.map +1 -0
- package/dist/component/imports/state.d.ts +36 -0
- package/dist/component/imports/state.d.ts.map +1 -0
- package/dist/component/imports/state.js +62 -0
- package/dist/component/imports/state.js.map +1 -0
- package/dist/component/mutations.d.ts +55 -0
- package/dist/component/mutations.d.ts.map +1 -0
- package/dist/component/mutations.js +74 -0
- package/dist/component/mutations.js.map +1 -0
- package/dist/component/providers/actions.d.ts +26 -0
- package/dist/component/providers/actions.d.ts.map +1 -0
- package/dist/component/providers/actions.js +92 -0
- package/dist/component/providers/actions.js.map +1 -0
- package/dist/component/providers/apple/impl.d.ts +52 -0
- package/dist/component/providers/apple/impl.d.ts.map +1 -0
- package/dist/component/providers/apple/impl.js +127 -0
- package/dist/component/providers/apple/impl.js.map +1 -0
- package/dist/component/providers/apple/jwt.d.ts +32 -0
- package/dist/component/providers/apple/jwt.d.ts.map +1 -0
- package/dist/component/providers/apple/jwt.js +68 -0
- package/dist/component/providers/apple/jwt.js.map +1 -0
- package/dist/component/providers/apple/mappers.d.ts +20 -0
- package/dist/component/providers/apple/mappers.d.ts.map +1 -0
- package/dist/component/providers/apple/mappers.js +68 -0
- package/dist/component/providers/apple/mappers.js.map +1 -0
- package/dist/component/providers/apple/types.d.ts +80 -0
- package/dist/component/providers/apple/types.d.ts.map +1 -0
- package/dist/component/providers/apple/types.js +7 -0
- package/dist/component/providers/apple/types.js.map +1 -0
- package/dist/component/providers/deezer/impl.d.ts +37 -0
- package/dist/component/providers/deezer/impl.d.ts.map +1 -0
- package/dist/component/providers/deezer/impl.js +99 -0
- package/dist/component/providers/deezer/impl.js.map +1 -0
- package/dist/component/providers/deezer/mappers.d.ts +18 -0
- package/dist/component/providers/deezer/mappers.d.ts.map +1 -0
- package/dist/component/providers/deezer/mappers.js +53 -0
- package/dist/component/providers/deezer/mappers.js.map +1 -0
- package/dist/component/providers/deezer/types.d.ts +59 -0
- package/dist/component/providers/deezer/types.d.ts.map +1 -0
- package/dist/component/providers/deezer/types.js +7 -0
- package/dist/component/providers/deezer/types.js.map +1 -0
- package/dist/component/providers/fetch.d.ts +69 -0
- package/dist/component/providers/fetch.d.ts.map +1 -0
- package/dist/component/providers/fetch.js +145 -0
- package/dist/component/providers/fetch.js.map +1 -0
- package/dist/component/providers/musicbrainz/impl.d.ts +36 -0
- package/dist/component/providers/musicbrainz/impl.d.ts.map +1 -0
- package/dist/component/providers/musicbrainz/impl.js +74 -0
- package/dist/component/providers/musicbrainz/impl.js.map +1 -0
- package/dist/component/providers/musicbrainz/mappers.d.ts +10 -0
- package/dist/component/providers/musicbrainz/mappers.d.ts.map +1 -0
- package/dist/component/providers/musicbrainz/mappers.js +32 -0
- package/dist/component/providers/musicbrainz/mappers.js.map +1 -0
- package/dist/component/providers/musicbrainz/types.d.ts +24 -0
- package/dist/component/providers/musicbrainz/types.d.ts.map +1 -0
- package/dist/component/providers/musicbrainz/types.js +7 -0
- package/dist/component/providers/musicbrainz/types.js.map +1 -0
- package/dist/component/providers/registry.d.ts +22 -0
- package/dist/component/providers/registry.d.ts.map +1 -0
- package/dist/component/providers/registry.js +33 -0
- package/dist/component/providers/registry.js.map +1 -0
- package/dist/component/providers/spotify/client.d.ts +25 -0
- package/dist/component/providers/spotify/client.d.ts.map +1 -0
- package/dist/component/providers/spotify/client.js +30 -0
- package/dist/component/providers/spotify/client.js.map +1 -0
- package/dist/component/providers/spotify/impl.d.ts +51 -0
- package/dist/component/providers/spotify/impl.d.ts.map +1 -0
- package/dist/component/providers/spotify/impl.js +131 -0
- package/dist/component/providers/spotify/impl.js.map +1 -0
- package/dist/component/providers/spotify/mappers.d.ts +18 -0
- package/dist/component/providers/spotify/mappers.d.ts.map +1 -0
- package/dist/component/providers/spotify/mappers.js +60 -0
- package/dist/component/providers/spotify/mappers.js.map +1 -0
- package/dist/component/providers/spotify/types.d.ts +97 -0
- package/dist/component/providers/spotify/types.d.ts.map +1 -0
- package/dist/component/providers/spotify/types.js +7 -0
- package/dist/component/providers/spotify/types.js.map +1 -0
- package/dist/component/providers/types.d.ts +84 -0
- package/dist/component/providers/types.d.ts.map +1 -0
- package/dist/component/providers/types.js +10 -0
- package/dist/component/providers/types.js.map +1 -0
- package/dist/component/providers/wikidata/impl.d.ts +34 -0
- package/dist/component/providers/wikidata/impl.d.ts.map +1 -0
- package/dist/component/providers/wikidata/impl.js +88 -0
- package/dist/component/providers/wikidata/impl.js.map +1 -0
- package/dist/component/providers/wikidata/mappers.d.ts +11 -0
- package/dist/component/providers/wikidata/mappers.d.ts.map +1 -0
- package/dist/component/providers/wikidata/mappers.js +53 -0
- package/dist/component/providers/wikidata/mappers.js.map +1 -0
- package/dist/component/providers/wikidata/types.d.ts +35 -0
- package/dist/component/providers/wikidata/types.d.ts.map +1 -0
- package/dist/component/providers/wikidata/types.js +8 -0
- package/dist/component/providers/wikidata/types.js.map +1 -0
- package/dist/component/queries.d.ts +103 -0
- package/dist/component/queries.d.ts.map +1 -0
- package/dist/component/queries.js +45 -0
- package/dist/component/queries.js.map +1 -0
- package/dist/component/schema.d.ts +566 -0
- package/dist/component/schema.d.ts.map +1 -0
- package/dist/component/schema.js +59 -0
- package/dist/component/schema.js.map +1 -0
- package/dist/component/sources/actions.d.ts +51 -0
- package/dist/component/sources/actions.d.ts.map +1 -0
- package/dist/component/sources/actions.js +164 -0
- package/dist/component/sources/actions.js.map +1 -0
- package/dist/component/sources/mutations.d.ts +25 -0
- package/dist/component/sources/mutations.d.ts.map +1 -0
- package/dist/component/sources/mutations.js +64 -0
- package/dist/component/sources/mutations.js.map +1 -0
- package/dist/component/sources/queries.d.ts +19 -0
- package/dist/component/sources/queries.d.ts.map +1 -0
- package/dist/component/sources/queries.js +20 -0
- package/dist/component/sources/queries.js.map +1 -0
- package/dist/component/sync/lifecycle.d.ts +46 -0
- package/dist/component/sync/lifecycle.d.ts.map +1 -0
- package/dist/component/sync/lifecycle.js +87 -0
- package/dist/component/sync/lifecycle.js.map +1 -0
- package/dist/component/sync/mutations.d.ts +101 -0
- package/dist/component/sync/mutations.d.ts.map +1 -0
- package/dist/component/sync/mutations.js +132 -0
- package/dist/component/sync/mutations.js.map +1 -0
- package/dist/component/sync/queries.d.ts +69 -0
- package/dist/component/sync/queries.d.ts.map +1 -0
- package/dist/component/sync/queries.js +32 -0
- package/dist/component/sync/queries.js.map +1 -0
- package/dist/component/validators.d.ts +1112 -0
- package/dist/component/validators.d.ts.map +1 -0
- package/dist/component/validators.js +317 -0
- package/dist/component/validators.js.map +1 -0
- package/dist/react/index.d.ts +42 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +43 -0
- package/dist/react/index.js.map +1 -0
- package/dist/shared.d.ts +28 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +24 -0
- package/dist/shared.js.map +1 -0
- package/package.json +126 -0
- package/src/client/index.ts +558 -0
- package/src/client/types.ts +117 -0
- package/src/component/_generated/api.ts +141 -0
- package/src/component/_generated/component.ts +1814 -0
- package/src/component/_generated/dataModel.ts +60 -0
- package/src/component/_generated/server.ts +169 -0
- package/src/component/actions.ts +156 -0
- package/src/component/catalog/browse_order.test.ts +55 -0
- package/src/component/catalog/browse_order.ts +43 -0
- package/src/component/catalog/field_source_policy.test.ts +47 -0
- package/src/component/catalog/field_source_policy.ts +44 -0
- package/src/component/catalog/merge.test.ts +187 -0
- package/src/component/catalog/merge.ts +134 -0
- package/src/component/catalog/mutations.ts +328 -0
- package/src/component/catalog/promote.ts +40 -0
- package/src/component/catalog/queries.ts +220 -0
- package/src/component/config/mutations.ts +29 -0
- package/src/component/config/queries.ts +20 -0
- package/src/component/convex.config.ts +32 -0
- package/src/component/crons.test.ts +8 -0
- package/src/component/crons.ts +52 -0
- package/src/component/imports/actions.ts +553 -0
- package/src/component/imports/dedupe.test.ts +66 -0
- package/src/component/imports/dedupe.ts +54 -0
- package/src/component/imports/mutations.ts +203 -0
- package/src/component/imports/queries.ts +25 -0
- package/src/component/imports/state.test.ts +60 -0
- package/src/component/imports/state.ts +74 -0
- package/src/component/mutations.ts +96 -0
- package/src/component/providers/actions.ts +127 -0
- package/src/component/providers/apple/impl.test.ts +267 -0
- package/src/component/providers/apple/impl.ts +224 -0
- package/src/component/providers/apple/jwt.test.ts +153 -0
- package/src/component/providers/apple/jwt.ts +99 -0
- package/src/component/providers/apple/mappers.test.ts +190 -0
- package/src/component/providers/apple/mappers.ts +100 -0
- package/src/component/providers/apple/types.ts +77 -0
- package/src/component/providers/deezer/impl.test.ts +109 -0
- package/src/component/providers/deezer/impl.ts +179 -0
- package/src/component/providers/deezer/mappers.test.ts +78 -0
- package/src/component/providers/deezer/mappers.ts +72 -0
- package/src/component/providers/deezer/types.ts +59 -0
- package/src/component/providers/fetch.test.ts +282 -0
- package/src/component/providers/fetch.ts +190 -0
- package/src/component/providers/musicbrainz/impl.test.ts +79 -0
- package/src/component/providers/musicbrainz/impl.ts +132 -0
- package/src/component/providers/musicbrainz/mappers.test.ts +75 -0
- package/src/component/providers/musicbrainz/mappers.ts +34 -0
- package/src/component/providers/musicbrainz/types.ts +20 -0
- package/src/component/providers/registry.test.ts +14 -0
- package/src/component/providers/registry.ts +48 -0
- package/src/component/providers/spotify/client.test.ts +80 -0
- package/src/component/providers/spotify/client.ts +57 -0
- package/src/component/providers/spotify/impl.test.ts +311 -0
- package/src/component/providers/spotify/impl.ts +230 -0
- package/src/component/providers/spotify/mappers.test.ts +182 -0
- package/src/component/providers/spotify/mappers.ts +81 -0
- package/src/component/providers/spotify/types.ts +101 -0
- package/src/component/providers/types.ts +95 -0
- package/src/component/providers/wikidata/impl.test.ts +81 -0
- package/src/component/providers/wikidata/impl.ts +139 -0
- package/src/component/providers/wikidata/mappers.test.ts +62 -0
- package/src/component/providers/wikidata/mappers.ts +66 -0
- package/src/component/providers/wikidata/types.ts +28 -0
- package/src/component/queries.ts +51 -0
- package/src/component/schema.ts +81 -0
- package/src/component/sources/actions.ts +177 -0
- package/src/component/sources/mutations.ts +67 -0
- package/src/component/sources/queries.ts +21 -0
- package/src/component/sync/lifecycle.test.ts +72 -0
- package/src/component/sync/lifecycle.ts +121 -0
- package/src/component/sync/mutations.ts +154 -0
- package/src/component/sync/queries.ts +33 -0
- package/src/component/validators.ts +411 -0
- package/src/react/index.test.ts +78 -0
- package/src/react/index.ts +112 -0
- package/src/shared.ts +32 -0
- package/src/test.ts +22 -0
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Apple Music developer token, signed with Web Crypto (ECDSA P-256 / ES256).
|
|
3
|
+
* A Convex component runs in V8 — it cannot use `jsonwebtoken` (Node `crypto`),
|
|
4
|
+
* so songtrivia's `jwt.sign(...)` is re-architected here on `crypto.subtle`:
|
|
5
|
+
* PKCS8 key import → JWS assembly → base64url, zero-dependency. Web Crypto emits
|
|
6
|
+
* the raw `r||s` signature JWS/ES256 expects, so no DER conversion is needed.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
/** Inputs for an Apple Music developer token. */
|
|
10
|
+
export interface AppleTokenInput {
|
|
11
|
+
/** Apple Developer Team ID — the `iss` claim. */
|
|
12
|
+
issuer: string;
|
|
13
|
+
/** MusicKit private-key id — the JWS `kid` header. */
|
|
14
|
+
keyId: string;
|
|
15
|
+
/** PEM-encoded PKCS8 EC P-256 private key. */
|
|
16
|
+
privateKeyPem: string;
|
|
17
|
+
/** Issued-at, in seconds since the epoch. */
|
|
18
|
+
nowSec: number;
|
|
19
|
+
/** Lifetime in seconds (default 6 months — Apple's maximum). */
|
|
20
|
+
ttlSec?: number;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Apple's maximum developer-token lifetime: ~6 months in seconds. */
|
|
24
|
+
export const APPLE_TOKEN_MAX_TTL_SEC = 15_777_000;
|
|
25
|
+
|
|
26
|
+
/** Base64url-encode bytes (no padding), per JWS. */
|
|
27
|
+
function base64Url(bytes: Uint8Array): string {
|
|
28
|
+
let binary = "";
|
|
29
|
+
for (const byte of bytes) binary += String.fromCharCode(byte);
|
|
30
|
+
return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** Base64url-encode a JSON value, per JWS. */
|
|
34
|
+
function base64UrlJson(value: unknown): string {
|
|
35
|
+
return base64Url(new TextEncoder().encode(JSON.stringify(value)));
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Decode a PEM block to the raw DER bytes Web Crypto imports. */
|
|
39
|
+
function pemToDer(pem: string): ArrayBuffer {
|
|
40
|
+
const body = pem
|
|
41
|
+
.replace(/-----BEGIN [^-]+-----/, "")
|
|
42
|
+
.replace(/-----END [^-]+-----/, "")
|
|
43
|
+
.replace(/\s+/g, "");
|
|
44
|
+
if (body.length === 0) {
|
|
45
|
+
throw new Error("Apple private key PEM is empty");
|
|
46
|
+
}
|
|
47
|
+
let binary: string;
|
|
48
|
+
try {
|
|
49
|
+
binary = atob(body);
|
|
50
|
+
} catch {
|
|
51
|
+
// A non-base64 body (e.g. a PEM pasted with literal `\n` escapes) — fail with
|
|
52
|
+
// an actionable message, never echoing the key material.
|
|
53
|
+
throw new Error("Apple private key PEM is malformed");
|
|
54
|
+
}
|
|
55
|
+
const buffer = new ArrayBuffer(binary.length);
|
|
56
|
+
const bytes = new Uint8Array(buffer);
|
|
57
|
+
for (let i = 0; i < binary.length; i += 1) bytes[i] = binary.charCodeAt(i);
|
|
58
|
+
return buffer;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Sign an Apple Music developer token. The signed JWT authorizes Apple Music API
|
|
63
|
+
* requests for ~6 months (cache it; re-signing is cheap but pointless).
|
|
64
|
+
*
|
|
65
|
+
* @param input - issuer/keyId/PEM + issued-at + optional ttl.
|
|
66
|
+
* @param subtle - Web Crypto subtle (injectable for tests; defaults to the runtime).
|
|
67
|
+
* @returns the compact JWS `header.payload.signature`.
|
|
68
|
+
*/
|
|
69
|
+
export async function signAppleDeveloperToken(
|
|
70
|
+
input: AppleTokenInput,
|
|
71
|
+
subtle: SubtleCrypto = crypto.subtle,
|
|
72
|
+
): Promise<string> {
|
|
73
|
+
// Clamp to Apple's 6-month maximum: a longer-lived signed token is rejected by
|
|
74
|
+
// Apple anyway, and a long-lived credential widens the blast radius if leaked.
|
|
75
|
+
const ttl = Math.min(
|
|
76
|
+
input.ttlSec ?? APPLE_TOKEN_MAX_TTL_SEC,
|
|
77
|
+
APPLE_TOKEN_MAX_TTL_SEC,
|
|
78
|
+
);
|
|
79
|
+
const header = { alg: "ES256", kid: input.keyId, typ: "JWT" };
|
|
80
|
+
const payload = {
|
|
81
|
+
iss: input.issuer,
|
|
82
|
+
iat: input.nowSec,
|
|
83
|
+
exp: input.nowSec + ttl,
|
|
84
|
+
};
|
|
85
|
+
const signingInput = `${base64UrlJson(header)}.${base64UrlJson(payload)}`;
|
|
86
|
+
const key = await subtle.importKey(
|
|
87
|
+
"pkcs8",
|
|
88
|
+
pemToDer(input.privateKeyPem),
|
|
89
|
+
{ name: "ECDSA", namedCurve: "P-256" },
|
|
90
|
+
false,
|
|
91
|
+
["sign"],
|
|
92
|
+
);
|
|
93
|
+
const signature = await subtle.sign(
|
|
94
|
+
{ name: "ECDSA", hash: "SHA-256" },
|
|
95
|
+
key,
|
|
96
|
+
new TextEncoder().encode(signingInput),
|
|
97
|
+
);
|
|
98
|
+
return `${signingInput}.${base64Url(new Uint8Array(signature))}`;
|
|
99
|
+
}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import {
|
|
3
|
+
APPLE_ARTWORK_SIZE,
|
|
4
|
+
formatArtwork,
|
|
5
|
+
mapAppleAlbum,
|
|
6
|
+
mapAppleArtist,
|
|
7
|
+
mapApplePlaylist,
|
|
8
|
+
mapAppleTrack,
|
|
9
|
+
} from "./mappers.js";
|
|
10
|
+
import type {
|
|
11
|
+
AppleAlbum,
|
|
12
|
+
AppleArtist,
|
|
13
|
+
ApplePlaylist,
|
|
14
|
+
AppleSong,
|
|
15
|
+
} from "./types.js";
|
|
16
|
+
|
|
17
|
+
describe("formatArtwork", () => {
|
|
18
|
+
it("templates {w}x{h} at the default size", () => {
|
|
19
|
+
expect(
|
|
20
|
+
formatArtwork({ url: "https://a/{w}x{h}.jpg", width: 3000, height: 3000 }),
|
|
21
|
+
).toBe(`https://a/${APPLE_ARTWORK_SIZE}x${APPLE_ARTWORK_SIZE}.jpg`);
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it("templates at a custom size", () => {
|
|
25
|
+
expect(formatArtwork({ url: "https://a/{w}x{h}.jpg" }, 100)).toBe(
|
|
26
|
+
"https://a/100x100.jpg",
|
|
27
|
+
);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it("returns undefined when absent", () => {
|
|
31
|
+
expect(formatArtwork(undefined)).toBe(undefined);
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("mapAppleArtist", () => {
|
|
36
|
+
it("maps a full artist", () => {
|
|
37
|
+
const raw: AppleArtist = {
|
|
38
|
+
id: "a1",
|
|
39
|
+
type: "artists",
|
|
40
|
+
attributes: {
|
|
41
|
+
name: "Daft Punk",
|
|
42
|
+
genreNames: ["Electronic"],
|
|
43
|
+
url: "https://music.apple.com/artist/a1",
|
|
44
|
+
artwork: { url: "https://art/{w}x{h}.jpg" },
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
expect(mapAppleArtist(raw)).toEqual({
|
|
48
|
+
name: "Daft Punk",
|
|
49
|
+
genres: ["Electronic"],
|
|
50
|
+
imageUrl: "https://art/600x600.jpg",
|
|
51
|
+
url: "https://music.apple.com/artist/a1",
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("defaults genres + omits missing fields", () => {
|
|
56
|
+
expect(
|
|
57
|
+
mapAppleArtist({ id: "a2", type: "artists", attributes: { name: "X" } }),
|
|
58
|
+
).toEqual({ name: "X", genres: [], imageUrl: undefined, url: undefined });
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
describe("mapAppleTrack", () => {
|
|
63
|
+
it("maps a full song with relationship artist id", () => {
|
|
64
|
+
const raw: AppleSong = {
|
|
65
|
+
id: "s1",
|
|
66
|
+
type: "songs",
|
|
67
|
+
attributes: {
|
|
68
|
+
name: "One More Time",
|
|
69
|
+
isrc: "GBDUW0000059",
|
|
70
|
+
genreNames: ["Electronic"],
|
|
71
|
+
artistName: "Daft Punk",
|
|
72
|
+
durationInMillis: 320_000,
|
|
73
|
+
artwork: { url: "https://art/{w}x{h}.jpg" },
|
|
74
|
+
url: "https://music.apple.com/song/s1",
|
|
75
|
+
previews: [{ url: "https://preview/1" }],
|
|
76
|
+
},
|
|
77
|
+
relationships: { artists: { data: [{ id: "a1" }] } },
|
|
78
|
+
};
|
|
79
|
+
expect(mapAppleTrack(raw)).toEqual({
|
|
80
|
+
title: "One More Time",
|
|
81
|
+
artists: [{ name: "Daft Punk", externalId: "a1" }],
|
|
82
|
+
isrc: "GBDUW0000059",
|
|
83
|
+
genres: ["Electronic"],
|
|
84
|
+
durationMs: 320_000,
|
|
85
|
+
previewUrl: "https://preview/1",
|
|
86
|
+
coverUrl: "https://art/600x600.jpg",
|
|
87
|
+
url: "https://music.apple.com/song/s1",
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it("maps a song with no relationship + no previews", () => {
|
|
92
|
+
const raw: AppleSong = {
|
|
93
|
+
id: "s2",
|
|
94
|
+
type: "songs",
|
|
95
|
+
attributes: { name: "Bare", artistName: "Solo" },
|
|
96
|
+
};
|
|
97
|
+
expect(mapAppleTrack(raw)).toEqual({
|
|
98
|
+
title: "Bare",
|
|
99
|
+
artists: [{ name: "Solo" }],
|
|
100
|
+
isrc: undefined,
|
|
101
|
+
genres: [],
|
|
102
|
+
durationMs: undefined,
|
|
103
|
+
previewUrl: undefined,
|
|
104
|
+
coverUrl: undefined,
|
|
105
|
+
url: undefined,
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
describe("mapAppleAlbum", () => {
|
|
111
|
+
it("maps a full album", () => {
|
|
112
|
+
const raw: AppleAlbum = {
|
|
113
|
+
id: "al1",
|
|
114
|
+
type: "albums",
|
|
115
|
+
attributes: {
|
|
116
|
+
name: "Discovery",
|
|
117
|
+
artistName: "Daft Punk",
|
|
118
|
+
releaseDate: "2001-03-12",
|
|
119
|
+
trackCount: 14,
|
|
120
|
+
artwork: { url: "https://art/{w}x{h}.jpg" },
|
|
121
|
+
url: "https://music.apple.com/album/al1",
|
|
122
|
+
},
|
|
123
|
+
relationships: { artists: { data: [{ id: "a1" }] } },
|
|
124
|
+
};
|
|
125
|
+
expect(mapAppleAlbum(raw)).toEqual({
|
|
126
|
+
title: "Discovery",
|
|
127
|
+
artists: [{ name: "Daft Punk", externalId: "a1" }],
|
|
128
|
+
releaseDate: "2001-03-12",
|
|
129
|
+
coverUrl: "https://art/600x600.jpg",
|
|
130
|
+
url: "https://music.apple.com/album/al1",
|
|
131
|
+
trackCount: 14,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
it("maps a bare album", () => {
|
|
136
|
+
expect(
|
|
137
|
+
mapAppleAlbum({
|
|
138
|
+
id: "al2",
|
|
139
|
+
type: "albums",
|
|
140
|
+
attributes: { name: "Bare", artistName: "Solo" },
|
|
141
|
+
}),
|
|
142
|
+
).toEqual({
|
|
143
|
+
title: "Bare",
|
|
144
|
+
artists: [{ name: "Solo" }],
|
|
145
|
+
releaseDate: undefined,
|
|
146
|
+
coverUrl: undefined,
|
|
147
|
+
url: undefined,
|
|
148
|
+
trackCount: undefined,
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
describe("mapApplePlaylist", () => {
|
|
154
|
+
it("maps a full playlist", () => {
|
|
155
|
+
const raw: ApplePlaylist = {
|
|
156
|
+
id: "p1",
|
|
157
|
+
type: "playlists",
|
|
158
|
+
attributes: {
|
|
159
|
+
name: "Top",
|
|
160
|
+
description: { standard: "the best" },
|
|
161
|
+
curatorName: "Apple Music",
|
|
162
|
+
artwork: { url: "https://art/{w}x{h}.jpg" },
|
|
163
|
+
url: "https://music.apple.com/playlist/p1",
|
|
164
|
+
},
|
|
165
|
+
};
|
|
166
|
+
expect(mapApplePlaylist(raw)).toEqual({
|
|
167
|
+
title: "Top",
|
|
168
|
+
description: "the best",
|
|
169
|
+
coverUrl: "https://art/600x600.jpg",
|
|
170
|
+
url: "https://music.apple.com/playlist/p1",
|
|
171
|
+
owner: "Apple Music",
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("maps a bare playlist", () => {
|
|
176
|
+
expect(
|
|
177
|
+
mapApplePlaylist({
|
|
178
|
+
id: "p2",
|
|
179
|
+
type: "playlists",
|
|
180
|
+
attributes: { name: "Bare" },
|
|
181
|
+
}),
|
|
182
|
+
).toEqual({
|
|
183
|
+
title: "Bare",
|
|
184
|
+
description: undefined,
|
|
185
|
+
coverUrl: undefined,
|
|
186
|
+
url: undefined,
|
|
187
|
+
owner: undefined,
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Map raw Apple Music responses to the component's normalized schema. Pure
|
|
3
|
+
* functions; Apple's `{w}x{h}` artwork URLs are templated to a concrete size.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type {
|
|
7
|
+
ArtistRef,
|
|
8
|
+
NormalizedAlbum,
|
|
9
|
+
NormalizedArtist,
|
|
10
|
+
NormalizedTrack,
|
|
11
|
+
} from "../../../client/types.js";
|
|
12
|
+
import type { NormalizedPlaylist } from "../types.js";
|
|
13
|
+
import type {
|
|
14
|
+
AppleAlbum,
|
|
15
|
+
AppleArtist,
|
|
16
|
+
AppleArtwork,
|
|
17
|
+
ApplePlaylist,
|
|
18
|
+
AppleSong,
|
|
19
|
+
} from "./types.js";
|
|
20
|
+
|
|
21
|
+
/** Default artwork edge length when templating `{w}`/`{h}`. */
|
|
22
|
+
export const APPLE_ARTWORK_SIZE = 600;
|
|
23
|
+
|
|
24
|
+
/** Resolve Apple's templated artwork URL to a concrete size, if present. */
|
|
25
|
+
export function formatArtwork(
|
|
26
|
+
artwork: AppleArtwork | undefined,
|
|
27
|
+
size: number = APPLE_ARTWORK_SIZE,
|
|
28
|
+
): string | undefined {
|
|
29
|
+
if (artwork === undefined) return undefined;
|
|
30
|
+
return artwork.url
|
|
31
|
+
.replace("{w}", String(size))
|
|
32
|
+
.replace("{h}", String(size));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** The credited artist ref for a song/album (Apple gives one primary name). */
|
|
36
|
+
function primaryArtistRef(
|
|
37
|
+
name: string,
|
|
38
|
+
relationshipArtistId: string | undefined,
|
|
39
|
+
): ArtistRef {
|
|
40
|
+
return relationshipArtistId === undefined
|
|
41
|
+
? { name }
|
|
42
|
+
: { name, externalId: relationshipArtistId };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** Apple artist → normalized artist (no popularity; genres from genreNames). */
|
|
46
|
+
export function mapAppleArtist(raw: AppleArtist): NormalizedArtist {
|
|
47
|
+
return {
|
|
48
|
+
name: raw.attributes.name,
|
|
49
|
+
genres: raw.attributes.genreNames ?? [],
|
|
50
|
+
imageUrl: formatArtwork(raw.attributes.artwork),
|
|
51
|
+
url: raw.attributes.url,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
/** Apple song → normalized track. */
|
|
56
|
+
export function mapAppleTrack(raw: AppleSong): NormalizedTrack {
|
|
57
|
+
return {
|
|
58
|
+
title: raw.attributes.name,
|
|
59
|
+
artists: [
|
|
60
|
+
primaryArtistRef(
|
|
61
|
+
raw.attributes.artistName,
|
|
62
|
+
raw.relationships?.artists?.data?.[0]?.id,
|
|
63
|
+
),
|
|
64
|
+
],
|
|
65
|
+
isrc: raw.attributes.isrc,
|
|
66
|
+
genres: raw.attributes.genreNames ?? [],
|
|
67
|
+
durationMs: raw.attributes.durationInMillis,
|
|
68
|
+
previewUrl: raw.attributes.previews?.[0]?.url,
|
|
69
|
+
coverUrl: formatArtwork(raw.attributes.artwork),
|
|
70
|
+
url: raw.attributes.url,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/** Apple album → normalized album. */
|
|
75
|
+
export function mapAppleAlbum(raw: AppleAlbum): NormalizedAlbum {
|
|
76
|
+
return {
|
|
77
|
+
title: raw.attributes.name,
|
|
78
|
+
artists: [
|
|
79
|
+
primaryArtistRef(
|
|
80
|
+
raw.attributes.artistName,
|
|
81
|
+
raw.relationships?.artists?.data?.[0]?.id,
|
|
82
|
+
),
|
|
83
|
+
],
|
|
84
|
+
releaseDate: raw.attributes.releaseDate,
|
|
85
|
+
coverUrl: formatArtwork(raw.attributes.artwork),
|
|
86
|
+
url: raw.attributes.url,
|
|
87
|
+
trackCount: raw.attributes.trackCount,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/** Apple playlist → normalized playlist metadata. */
|
|
92
|
+
export function mapApplePlaylist(raw: ApplePlaylist): NormalizedPlaylist {
|
|
93
|
+
return {
|
|
94
|
+
title: raw.attributes.name,
|
|
95
|
+
description: raw.attributes.description?.standard,
|
|
96
|
+
coverUrl: formatArtwork(raw.attributes.artwork),
|
|
97
|
+
url: raw.attributes.url,
|
|
98
|
+
owner: raw.attributes.curatorName,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Raw Apple Music API response shapes — private to the Apple adapter. Apple wraps
|
|
3
|
+
* resources as `{ data: [{ id, type, attributes, relationships }] }`; only the
|
|
4
|
+
* consumed fields are modeled. The public contract is the normalized schema.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
export interface AppleArtwork {
|
|
8
|
+
url: string;
|
|
9
|
+
width?: number;
|
|
10
|
+
height?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AppleArtistRelationship {
|
|
14
|
+
data?: Array<{ id: string }>;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface AppleArtistAttributes {
|
|
18
|
+
name: string;
|
|
19
|
+
genreNames?: string[];
|
|
20
|
+
url?: string;
|
|
21
|
+
artwork?: AppleArtwork;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface AppleSongAttributes {
|
|
25
|
+
name: string;
|
|
26
|
+
isrc?: string;
|
|
27
|
+
genreNames?: string[];
|
|
28
|
+
artistName: string;
|
|
29
|
+
durationInMillis?: number;
|
|
30
|
+
artwork?: AppleArtwork;
|
|
31
|
+
url?: string;
|
|
32
|
+
previews?: Array<{ url: string }>;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export interface AppleAlbumAttributes {
|
|
36
|
+
name: string;
|
|
37
|
+
artistName: string;
|
|
38
|
+
releaseDate?: string;
|
|
39
|
+
trackCount?: number;
|
|
40
|
+
artwork?: AppleArtwork;
|
|
41
|
+
url?: string;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface ApplePlaylistAttributes {
|
|
45
|
+
name: string;
|
|
46
|
+
description?: { standard?: string };
|
|
47
|
+
curatorName?: string;
|
|
48
|
+
artwork?: AppleArtwork;
|
|
49
|
+
url?: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface AppleResource<A> {
|
|
53
|
+
id: string;
|
|
54
|
+
type: string;
|
|
55
|
+
attributes: A;
|
|
56
|
+
relationships?: {
|
|
57
|
+
artists?: AppleArtistRelationship;
|
|
58
|
+
tracks?: { data?: Array<AppleResource<AppleSongAttributes>> };
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export type AppleArtist = AppleResource<AppleArtistAttributes>;
|
|
63
|
+
export type AppleSong = AppleResource<AppleSongAttributes>;
|
|
64
|
+
export type AppleAlbum = AppleResource<AppleAlbumAttributes>;
|
|
65
|
+
export type ApplePlaylist = AppleResource<ApplePlaylistAttributes>;
|
|
66
|
+
|
|
67
|
+
export interface AppleDataResponse<T> {
|
|
68
|
+
data: T[];
|
|
69
|
+
next?: string;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface AppleSearchResponse {
|
|
73
|
+
results?: {
|
|
74
|
+
artists?: { data: AppleArtist[] };
|
|
75
|
+
songs?: { data: AppleSong[] };
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import type { FetchDeps } from "../fetch.js";
|
|
3
|
+
import { DEFAULT_DEEZER_CONFIG, DeezerProvider } from "./impl.js";
|
|
4
|
+
|
|
5
|
+
interface Route {
|
|
6
|
+
match: RegExp;
|
|
7
|
+
body: unknown;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
function makeProvider(routes: Route[]): DeezerProvider {
|
|
11
|
+
const deps: FetchDeps = {
|
|
12
|
+
fetch: (url) => {
|
|
13
|
+
const route = routes.find((r) => r.match.test(url));
|
|
14
|
+
return Promise.resolve(
|
|
15
|
+
new Response(JSON.stringify(route?.body ?? {}), {
|
|
16
|
+
status: route === undefined ? 404 : 200,
|
|
17
|
+
headers: { "content-type": "application/json" },
|
|
18
|
+
}),
|
|
19
|
+
);
|
|
20
|
+
},
|
|
21
|
+
sleep: () => Promise.resolve(),
|
|
22
|
+
random: () => 0,
|
|
23
|
+
};
|
|
24
|
+
return new DeezerProvider(DEFAULT_DEEZER_CONFIG, deps);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const track = (id: number, isrc?: string) => ({
|
|
28
|
+
id,
|
|
29
|
+
title: `t${id}`,
|
|
30
|
+
isrc,
|
|
31
|
+
artist: { id: 27, name: "Daft Punk" },
|
|
32
|
+
duration: 100,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
describe("DeezerProvider", () => {
|
|
36
|
+
it("getArtist / getTrack", async () => {
|
|
37
|
+
const p = makeProvider([
|
|
38
|
+
{ match: /\/artist\/27$/, body: { id: 27, name: "Daft Punk" } },
|
|
39
|
+
{ match: /\/track\/1$/, body: track(1, "GBDUW0000059") },
|
|
40
|
+
]);
|
|
41
|
+
expect((await p.getArtist("27")).value.name).toBe("Daft Punk");
|
|
42
|
+
expect((await p.getTrack("1")).value.isrc).toBe("GBDUW0000059");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("getAlbum + getPlaylist inline their tracks", async () => {
|
|
46
|
+
const p = makeProvider([
|
|
47
|
+
{ match: /\/album\/9$/, body: { id: 9, title: "Discovery", tracks: { data: [track(1), track(2)] } } },
|
|
48
|
+
{ match: /\/playlist\/5$/, body: { id: 5, title: "PL", tracks: { data: [track(1)] } } },
|
|
49
|
+
]);
|
|
50
|
+
expect((await p.getAlbum("9")).tracks).toHaveLength(2);
|
|
51
|
+
expect((await p.getPlaylist("5")).tracks).toHaveLength(1);
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("getPlaylist + getAlbum tolerate no tracks", async () => {
|
|
55
|
+
const p = makeProvider([
|
|
56
|
+
{ match: /\/playlist\/6$/, body: { id: 6, title: "Empty" } },
|
|
57
|
+
{ match: /\/album\/8$/, body: { id: 8, title: "NoTracks" } },
|
|
58
|
+
]);
|
|
59
|
+
expect((await p.getPlaylist("6")).tracks).toEqual([]);
|
|
60
|
+
expect((await p.getAlbum("8")).tracks).toEqual([]);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("getArtistTopTracks", async () => {
|
|
64
|
+
const p = makeProvider([
|
|
65
|
+
{ match: /\/artist\/27\/top/, body: { data: [track(1), track(2)] } },
|
|
66
|
+
]);
|
|
67
|
+
expect(await p.getArtistTopTracks("27")).toHaveLength(2);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("getArtistAlbums flags partial on next + fetches album tracks", async () => {
|
|
71
|
+
const p = makeProvider([
|
|
72
|
+
{
|
|
73
|
+
match: /\/artist\/27\/albums/,
|
|
74
|
+
body: { data: [{ id: 9, title: "Discovery" }], next: "https://more" },
|
|
75
|
+
},
|
|
76
|
+
{ match: /\/album\/9$/, body: { id: 9, title: "Discovery", tracks: { data: [track(1)] } } },
|
|
77
|
+
]);
|
|
78
|
+
const result = await p.getArtistAlbums("27");
|
|
79
|
+
expect(result.isPartial).toBe(true);
|
|
80
|
+
expect(result.albums[0]?.tracks).toHaveLength(1);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
it("getArtistAlbums is complete with no next", async () => {
|
|
84
|
+
const p = makeProvider([
|
|
85
|
+
{ match: /\/artist\/28\/albums/, body: { data: [] } },
|
|
86
|
+
]);
|
|
87
|
+
expect((await p.getArtistAlbums("28")).isPartial).toBe(false);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it("search(artist) + search(track)", async () => {
|
|
91
|
+
const p = makeProvider([
|
|
92
|
+
{ match: /\/search\/artist/, body: { data: [{ id: 27, name: "Daft Punk" }] } },
|
|
93
|
+
{ match: /\/search\/track/, body: { data: [track(1)] } },
|
|
94
|
+
]);
|
|
95
|
+
expect((await p.search("daft", "artist"))[0]?.type).toBe("artist");
|
|
96
|
+
expect((await p.search("one", "track"))[0]?.type).toBe("track");
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it("searchByIsrc returns the track, or [] on a Deezer error", async () => {
|
|
100
|
+
const hit = makeProvider([
|
|
101
|
+
{ match: /\/track\/isrc:GBDUW0000059/, body: track(1, "GBDUW0000059") },
|
|
102
|
+
]);
|
|
103
|
+
expect(await hit.searchByIsrc("GBDUW0000059")).toHaveLength(1);
|
|
104
|
+
const miss = makeProvider([
|
|
105
|
+
{ match: /\/track\/isrc:NONE/, body: { error: { type: "DataException" } } },
|
|
106
|
+
]);
|
|
107
|
+
expect(await miss.searchByIsrc("NONE")).toEqual([]);
|
|
108
|
+
});
|
|
109
|
+
});
|