@literary-universe/sdk 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +2 -2
- package/dist/esm/index.js +2 -2
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -60,7 +60,7 @@ class LiteraryUniverseClient {
|
|
|
60
60
|
? typeof options.credentials !== 'function' ||
|
|
61
61
|
options.token !== undefined
|
|
62
62
|
: typeof options.token !== 'string' ||
|
|
63
|
-
!/^
|
|
63
|
+
!/^[\x21-\x7e]+$/.test(options.token))
|
|
64
64
|
throw invalid();
|
|
65
65
|
this.endpoint = new URL(`${base.origin}${base.pathname.replace(/\/+$/, '')}/graphql`);
|
|
66
66
|
this.#token = options.token;
|
|
@@ -379,7 +379,7 @@ class LiteraryUniverseClient {
|
|
|
379
379
|
const credential = await providedCredential(this.#credentials, signal);
|
|
380
380
|
if (credential?.kind !== 'api-key' ||
|
|
381
381
|
typeof credential.token !== 'string' ||
|
|
382
|
-
!/^
|
|
382
|
+
!/^[\x21-\x7e]+$/.test(credential.token))
|
|
383
383
|
throw new LiteraryUniverseApiError('INVALID_CONFIGURATION', 'Credential provider must return a valid API key');
|
|
384
384
|
return credential.token;
|
|
385
385
|
}
|
package/dist/esm/index.js
CHANGED
|
@@ -55,7 +55,7 @@ export class LiteraryUniverseClient {
|
|
|
55
55
|
? typeof options.credentials !== 'function' ||
|
|
56
56
|
options.token !== undefined
|
|
57
57
|
: typeof options.token !== 'string' ||
|
|
58
|
-
!/^
|
|
58
|
+
!/^[\x21-\x7e]+$/.test(options.token))
|
|
59
59
|
throw invalid();
|
|
60
60
|
this.endpoint = new URL(`${base.origin}${base.pathname.replace(/\/+$/, '')}/graphql`);
|
|
61
61
|
this.#token = options.token;
|
|
@@ -374,7 +374,7 @@ export class LiteraryUniverseClient {
|
|
|
374
374
|
const credential = await providedCredential(this.#credentials, signal);
|
|
375
375
|
if (credential?.kind !== 'api-key' ||
|
|
376
376
|
typeof credential.token !== 'string' ||
|
|
377
|
-
!/^
|
|
377
|
+
!/^[\x21-\x7e]+$/.test(credential.token))
|
|
378
378
|
throw new LiteraryUniverseApiError('INVALID_CONFIGURATION', 'Credential provider must return a valid API key');
|
|
379
379
|
return credential.token;
|
|
380
380
|
}
|