storyblok 4.6.2 → 4.6.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/index.mjs CHANGED
@@ -14,7 +14,6 @@ import path, { join, parse, resolve } from 'node:path';
14
14
  import filenamify from 'filenamify';
15
15
  import { exec, spawn } from 'node:child_process';
16
16
  import { promisify } from 'node:util';
17
- import { getRegion } from '@storyblok/region-helper';
18
17
  import { minimatch } from 'minimatch';
19
18
  import { Readable, pipeline, Transform, Writable } from 'node:stream';
20
19
  import { hash } from 'ohash';
@@ -1083,30 +1082,8 @@ program$f.command(commands.USER).description("Get the current user").action(asyn
1083
1082
  konsola.br();
1084
1083
  });
1085
1084
 
1086
- function getRegionFromSpaceId(spaceId) {
1087
- try {
1088
- const region = getRegion(spaceId);
1089
- return region;
1090
- } catch (error) {
1091
- console.warn(`Failed to determine region from space ID: ${error}`);
1092
- return void 0;
1093
- }
1094
- }
1095
- const resolveRegion = async (thisCommand) => {
1096
- const options = thisCommand.opts();
1097
- const spaceId = options.space;
1098
- if (spaceId) {
1099
- const { state, initializeSession } = session();
1100
- await initializeSession();
1101
- const detectedRegion = getRegionFromSpaceId(spaceId);
1102
- if (detectedRegion) {
1103
- state.region = detectedRegion;
1104
- }
1105
- }
1106
- };
1107
-
1108
1085
  const program$e = getProgram();
1109
- const componentsCommand = program$e.command(commands.COMPONENTS).alias("comp").description(`Manage your space's block schema`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/components").hook("preAction", resolveRegion);
1086
+ const componentsCommand = program$e.command(commands.COMPONENTS).alias("comp").description(`Manage your space's block schema`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/components");
1110
1087
 
1111
1088
  const fetchComponents = async (spaceId) => {
1112
1089
  try {
@@ -2721,7 +2698,7 @@ const saveLanguagesToFile = async (space, internationalizationOptions, options)
2721
2698
  };
2722
2699
 
2723
2700
  const program$b = getProgram();
2724
- const languagesCommand = program$b.command(commands.LANGUAGES).alias("lang").description(`Manage your space's languages`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/languages").hook("preAction", resolveRegion);
2701
+ const languagesCommand = program$b.command(commands.LANGUAGES).alias("lang").description(`Manage your space's languages`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/languages");
2725
2702
  languagesCommand.command("pull").description(`Download your space's languages schema as json`).option("-f, --filename <filename>", "filename to save the file as <filename>.<suffix>.json").option("--su, --suffix <suffix>", "suffix to add to the file name (e.g. languages.<suffix>.json). By default, the space ID is used.").action(async (options) => {
2726
2703
  konsola.title(`${commands.LANGUAGES}`, colorPalette.LANGUAGES);
2727
2704
  const verbose = program$b.opts().verbose;
@@ -2772,7 +2749,7 @@ languagesCommand.command("pull").description(`Download your space's languages sc
2772
2749
  });
2773
2750
 
2774
2751
  const program$a = getProgram();
2775
- const migrationsCommand = program$a.command(commands.MIGRATIONS).alias("mig").description(`Manage your space's migrations`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/migrations").hook("preAction", resolveRegion);
2752
+ const migrationsCommand = program$a.command(commands.MIGRATIONS).alias("mig").description(`Manage your space's migrations`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/migrations");
2776
2753
 
2777
2754
  const getMigrationTemplate = () => {
2778
2755
  return `export default function (block) {
@@ -2922,7 +2899,8 @@ async function* storiesIterator(spaceId, params, onTotal) {
2922
2899
  const result = await fetchStories(spaceId, {
2923
2900
  ...transformedParams,
2924
2901
  per_page: perPage,
2925
- page: 1
2902
+ page: 1,
2903
+ story_only: true
2926
2904
  });
2927
2905
  if (!result) {
2928
2906
  return;
@@ -2938,7 +2916,8 @@ async function* storiesIterator(spaceId, params, onTotal) {
2938
2916
  const result2 = await fetchStories(spaceId, {
2939
2917
  ...transformedParams,
2940
2918
  per_page: perPage,
2941
- page
2919
+ page,
2920
+ story_only: true
2942
2921
  });
2943
2922
  if (!result2) {
2944
2923
  return;
@@ -3164,19 +3143,18 @@ class MigrationStream extends Transform {
3164
3143
  results;
3165
3144
  migrationFunctions = /* @__PURE__ */ new Map();
3166
3145
  totalProcessed = 0;
3167
- _transform(chunk, _encoding, callback) {
3146
+ async _transform(chunk, _encoding, callback) {
3168
3147
  try {
3169
- this.processStory(chunk).then((results) => {
3170
- this.results.totalProcessed++;
3171
- this.options.onProgress?.(this.results.totalProcessed);
3172
- if (results.length > 0) {
3173
- this.totalProcessed += results.length;
3174
- this.options.onTotal?.(this.totalProcessed);
3175
- for (const result of results) {
3176
- this.push(result);
3177
- }
3148
+ const results = await this.processStory(chunk);
3149
+ this.results.totalProcessed++;
3150
+ this.options.onProgress?.(this.results.totalProcessed);
3151
+ if (results.length > 0) {
3152
+ this.totalProcessed += results.length;
3153
+ this.options.onTotal?.(this.totalProcessed);
3154
+ for (const result of results) {
3155
+ this.push(result);
3178
3156
  }
3179
- });
3157
+ }
3180
3158
  callback();
3181
3159
  } catch (error) {
3182
3160
  callback(error);
@@ -3585,7 +3563,7 @@ migrationsCommand.command("rollback [migrationFile]").description("Rollback a mi
3585
3563
  });
3586
3564
 
3587
3565
  const program$6 = getProgram();
3588
- const typesCommand = program$6.command(commands.TYPES).alias("ts").description(`Generate types d.ts for your component schemas`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/types").hook("preAction", resolveRegion);
3566
+ const typesCommand = program$6.command(commands.TYPES).alias("ts").description(`Generate types d.ts for your component schemas`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/types");
3589
3567
 
3590
3568
  const getAssetJSONSchema = (title) => ({
3591
3569
  $id: "#/asset",
@@ -4342,7 +4320,7 @@ typesCommand.command("generate").description("Generate types d.ts for your compo
4342
4320
  });
4343
4321
 
4344
4322
  const program$4 = getProgram();
4345
- const datasourcesCommand = program$4.command(commands.DATASOURCES).alias("ds").description(`Manage your space's datasources`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/datasources").hook("preAction", resolveRegion);
4323
+ const datasourcesCommand = program$4.command(commands.DATASOURCES).alias("ds").description(`Manage your space's datasources`).option("-s, --space <space>", "space ID").option("-p, --path <path>", "path to save the file. Default is .storyblok/datasources");
4346
4324
 
4347
4325
  const fetchDatasourceEntries = async (spaceId, datasourceId) => {
4348
4326
  try {
@@ -5163,7 +5141,7 @@ program$1.command(`${commands.CREATE} [project-path]`).alias("c").description(`S
5163
5141
  konsola.br();
5164
5142
  });
5165
5143
 
5166
- const version = "4.6.2";
5144
+ const version = "4.6.3";
5167
5145
  const pkg = {
5168
5146
  version: version};
5169
5147