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.
Files changed (2) hide show
  1. package/dist/cli.mjs +25 -15
  2. 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
- const { region } = creds.get();
530
- try {
531
- return new Storyblok({
532
- accessToken: this.accessToken,
533
- oauthToken: this.oauthToken,
534
- region: this.region,
535
- headers: {
536
- ...DEFAULT_AGENT
537
- }
538
- }, this.apiSwitcher(region));
539
- } catch (error) {
540
- throw new Error(error);
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}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyblok",
3
- "version": "3.31.0",
3
+ "version": "3.31.1",
4
4
  "description": "A simple CLI to start Storyblok from your command line.",
5
5
  "repository": {
6
6
  "type": "git",