storyblok 3.24.2 → 3.25.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/README.md CHANGED
@@ -14,7 +14,7 @@ We added the `region` option upon login. If you are using the CLI, please `logou
14
14
 
15
15
  ## Installation
16
16
 
17
- Make sure you have Node `>= 9.11.0` installed.
17
+ Make sure you have Node `>= 18.0.0` installed.
18
18
 
19
19
  ```sh
20
20
  $ npm i storyblok -g
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyblok",
3
- "version": "3.24.2",
3
+ "version": "3.25.1",
4
4
  "description": "A simple CLI to start Storyblok from your command line.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -42,12 +42,12 @@
42
42
  "p-series": "^2.1.0",
43
43
  "path": "^0.12.7",
44
44
  "simple-uuid": "^0.0.1",
45
- "storyblok-js-client": "^4.5.6",
45
+ "storyblok-js-client": "^5.12.0",
46
46
  "update-notifier": "^5.1.0",
47
47
  "xml-js": "^1.6.11"
48
48
  },
49
49
  "engines": {
50
- "node": ">=10.0.0"
50
+ "node": ">=18.0.0"
51
51
  },
52
52
  "devDependencies": {
53
53
  "concat-stream": "^2.0.0",
package/src/constants.js CHANGED
@@ -28,6 +28,11 @@ const COMMANDS = {
28
28
  SYNC: 'sync'
29
29
  }
30
30
 
31
+ const DEFAULT_AGENT = {
32
+ SB_Agent: 'SB-CLI',
33
+ SB_Agent_Version: process.env.npm_package_version || '3.0.0'
34
+ }
35
+
31
36
  module.exports = {
32
37
  LOGIN_URL,
33
38
  SIGNUP_URL,
@@ -35,5 +40,6 @@ module.exports = {
35
40
  SYNC_TYPES,
36
41
  US_API_URL,
37
42
  CN_API_URL,
38
- COMMANDS
43
+ COMMANDS,
44
+ DEFAULT_AGENT
39
45
  }
@@ -46,7 +46,7 @@ class SyncDatasources {
46
46
  const entriesFirstPage = await this.client.get(`spaces/${spaceId}/datasource_entries/?datasource_id=${datasourceId}${dimensionQuery}`)
47
47
  const entriesRequets = []
48
48
  for (let i = 2; i <= Math.ceil(entriesFirstPage.total / 25); i++) {
49
- entriesRequets.push(this.client.get(`spaces/${spaceId}/datasource_entries/?datasource_id=${datasourceId}`, { page: i }))
49
+ entriesRequets.push(await this.client.get(`spaces/${spaceId}/datasource_entries/?datasource_id=${datasourceId}&page=${i}`))
50
50
  }
51
51
  return entriesFirstPage.data.datasource_entries.concat(...(await Promise.all(entriesRequets)).map(r => r.data.datasource_entries))
52
52
  } catch (err) {
package/src/utils/api.js CHANGED
@@ -5,7 +5,7 @@ const inquirer = require('inquirer')
5
5
 
6
6
  const creds = require('./creds')
7
7
  const getQuestions = require('./get-questions')
8
- const { SIGNUP_URL, API_URL, US_API_URL, CN_API_URL } = require('../constants')
8
+ const { SIGNUP_URL, API_URL, US_API_URL, CN_API_URL, DEFAULT_AGENT } = require('../constants')
9
9
 
10
10
  module.exports = {
11
11
  accessToken: '',
@@ -20,7 +20,10 @@ module.exports = {
20
20
  return new Storyblok({
21
21
  accessToken: this.accessToken,
22
22
  oauthToken: this.oauthToken,
23
- region: this.region
23
+ region: this.region,
24
+ headers: {
25
+ ...DEFAULT_AGENT
26
+ }
24
27
  }, this.apiSwitcher(region))
25
28
  } catch (error) {
26
29
  throw new Error(error)
@@ -277,7 +280,10 @@ module.exports = {
277
280
  const customClient = new Storyblok({
278
281
  accessToken: this.accessToken,
279
282
  oauthToken: this.oauthToken,
280
- region
283
+ region,
284
+ headers: {
285
+ ...DEFAULT_AGENT
286
+ }
281
287
  }, this.apiSwitcher(region))
282
288
  return await customClient
283
289
  .get('spaces/', {})