storyblok 3.31.0 → 3.31.1
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/cli.mjs +25 -15
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -525,21 +525,31 @@ const api = {
|
|
|
525
525
|
oauthToken: "",
|
|
526
526
|
spaceId: null,
|
|
527
527
|
region: "",
|
|
528
|
-
getClient() {
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
528
|
+
getClient: /* @__PURE__ */ function() {
|
|
529
|
+
let client, accessToken, oauthToken, region, credsRegion;
|
|
530
|
+
return function getClient() {
|
|
531
|
+
const { region: _credsRegion } = creds.get();
|
|
532
|
+
if (client && accessToken === this.accessToken && oauthToken === this.oauthToken && region === this.region && credsRegion === _credsRegion) {
|
|
533
|
+
return client;
|
|
534
|
+
}
|
|
535
|
+
accessToken = this.accessToken;
|
|
536
|
+
oauthToken = this.oauthToken;
|
|
537
|
+
region = this.region;
|
|
538
|
+
credsRegion = _credsRegion;
|
|
539
|
+
try {
|
|
540
|
+
return client = new Storyblok({
|
|
541
|
+
accessToken,
|
|
542
|
+
oauthToken,
|
|
543
|
+
region,
|
|
544
|
+
headers: {
|
|
545
|
+
...DEFAULT_AGENT
|
|
546
|
+
}
|
|
547
|
+
}, this.apiSwitcher(credsRegion));
|
|
548
|
+
} catch (error) {
|
|
549
|
+
throw new Error(error);
|
|
550
|
+
}
|
|
551
|
+
};
|
|
552
|
+
}(),
|
|
543
553
|
getPath(path) {
|
|
544
554
|
if (this.spaceId) {
|
|
545
555
|
return `spaces/${this.spaceId}/${path}`;
|