storyblok 4.6.8 → 4.6.10

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.d.mts CHANGED
@@ -23,6 +23,51 @@ interface StoryblokAsset {
23
23
  }
24
24
  interface StoryblokMultiasset extends Array<StoryblokAsset> {
25
25
  }
26
+ interface StoryblokMultilinkStory {
27
+ name: string;
28
+ created_at: string;
29
+ published_at: string;
30
+ id: number;
31
+ uuid: string;
32
+ content: Record<string, any>;
33
+ slug: string;
34
+ full_slug: string;
35
+ sort_by_date?: string;
36
+ position?: number;
37
+ tag_list?: string[];
38
+ is_startpage?: boolean;
39
+ parent_id?: number | null;
40
+ meta_data?: Record<string, any> | null;
41
+ group_id?: string;
42
+ first_published_at?: string;
43
+ release_id?: number | null;
44
+ lang?: string;
45
+ path?: string | null;
46
+ alternates?: any[];
47
+ default_full_slug?: string | null;
48
+ translated_slugs?: any[] | null;
49
+ }
50
+ interface StoryblokMultilinkLink {
51
+ id: number;
52
+ uuid: string;
53
+ slug: string;
54
+ path: string | null;
55
+ parent_id: number;
56
+ name: string;
57
+ is_folder: boolean;
58
+ published: boolean;
59
+ is_startpage: boolean;
60
+ position: number;
61
+ real_path: string;
62
+ }
63
+ interface StoryblokMultilinkUrl {
64
+ name: string;
65
+ id: number;
66
+ uuid: string;
67
+ slug: string;
68
+ url: string;
69
+ full_slug: string;
70
+ }
26
71
  interface StoryblokMultilink {
27
72
  fieldtype: 'multilink';
28
73
  id: string;
@@ -34,30 +79,7 @@ interface StoryblokMultilink {
34
79
  title?: string;
35
80
  prep?: string;
36
81
  linktype: 'story' | 'url' | 'email' | 'asset';
37
- story?: {
38
- name: string;
39
- created_at: string;
40
- published_at: string;
41
- id: number;
42
- uuid: string;
43
- content: Record<string, any>;
44
- slug: string;
45
- full_slug: string;
46
- sort_by_date?: string;
47
- position?: number;
48
- tag_list?: string[];
49
- is_startpage?: boolean;
50
- parent_id?: number | null;
51
- meta_data?: Record<string, any> | null;
52
- group_id?: string;
53
- first_published_at?: string;
54
- release_id?: number | null;
55
- lang?: string;
56
- path?: string | null;
57
- alternates?: any[];
58
- default_full_slug?: string | null;
59
- translated_slugs?: any[] | null;
60
- };
82
+ story?: StoryblokMultilinkStory | StoryblokMultilinkLink | StoryblokMultilinkUrl;
61
83
  email?: string;
62
84
  }
63
85
  interface StoryblokTable {
@@ -88,4 +110,4 @@ interface StoryblokRichtext {
88
110
  text?: string;
89
111
  }
90
112
 
91
- export type { StoryblokAsset, StoryblokMultiasset, StoryblokMultilink, StoryblokPropertyType, StoryblokRichtext, StoryblokTable };
113
+ export type { StoryblokAsset, StoryblokMultiasset, StoryblokMultilink, StoryblokMultilinkLink, StoryblokMultilinkStory, StoryblokMultilinkUrl, StoryblokPropertyType, StoryblokRichtext, StoryblokTable };
package/dist/index.d.ts CHANGED
@@ -23,6 +23,51 @@ interface StoryblokAsset {
23
23
  }
24
24
  interface StoryblokMultiasset extends Array<StoryblokAsset> {
25
25
  }
26
+ interface StoryblokMultilinkStory {
27
+ name: string;
28
+ created_at: string;
29
+ published_at: string;
30
+ id: number;
31
+ uuid: string;
32
+ content: Record<string, any>;
33
+ slug: string;
34
+ full_slug: string;
35
+ sort_by_date?: string;
36
+ position?: number;
37
+ tag_list?: string[];
38
+ is_startpage?: boolean;
39
+ parent_id?: number | null;
40
+ meta_data?: Record<string, any> | null;
41
+ group_id?: string;
42
+ first_published_at?: string;
43
+ release_id?: number | null;
44
+ lang?: string;
45
+ path?: string | null;
46
+ alternates?: any[];
47
+ default_full_slug?: string | null;
48
+ translated_slugs?: any[] | null;
49
+ }
50
+ interface StoryblokMultilinkLink {
51
+ id: number;
52
+ uuid: string;
53
+ slug: string;
54
+ path: string | null;
55
+ parent_id: number;
56
+ name: string;
57
+ is_folder: boolean;
58
+ published: boolean;
59
+ is_startpage: boolean;
60
+ position: number;
61
+ real_path: string;
62
+ }
63
+ interface StoryblokMultilinkUrl {
64
+ name: string;
65
+ id: number;
66
+ uuid: string;
67
+ slug: string;
68
+ url: string;
69
+ full_slug: string;
70
+ }
26
71
  interface StoryblokMultilink {
27
72
  fieldtype: 'multilink';
28
73
  id: string;
@@ -34,30 +79,7 @@ interface StoryblokMultilink {
34
79
  title?: string;
35
80
  prep?: string;
36
81
  linktype: 'story' | 'url' | 'email' | 'asset';
37
- story?: {
38
- name: string;
39
- created_at: string;
40
- published_at: string;
41
- id: number;
42
- uuid: string;
43
- content: Record<string, any>;
44
- slug: string;
45
- full_slug: string;
46
- sort_by_date?: string;
47
- position?: number;
48
- tag_list?: string[];
49
- is_startpage?: boolean;
50
- parent_id?: number | null;
51
- meta_data?: Record<string, any> | null;
52
- group_id?: string;
53
- first_published_at?: string;
54
- release_id?: number | null;
55
- lang?: string;
56
- path?: string | null;
57
- alternates?: any[];
58
- default_full_slug?: string | null;
59
- translated_slugs?: any[] | null;
60
- };
82
+ story?: StoryblokMultilinkStory | StoryblokMultilinkLink | StoryblokMultilinkUrl;
61
83
  email?: string;
62
84
  }
63
85
  interface StoryblokTable {
@@ -88,4 +110,4 @@ interface StoryblokRichtext {
88
110
  text?: string;
89
111
  }
90
112
 
91
- export type { StoryblokAsset, StoryblokMultiasset, StoryblokMultilink, StoryblokPropertyType, StoryblokRichtext, StoryblokTable };
113
+ export type { StoryblokAsset, StoryblokMultiasset, StoryblokMultilink, StoryblokMultilinkLink, StoryblokMultilinkStory, StoryblokMultilinkUrl, StoryblokPropertyType, StoryblokRichtext, StoryblokTable };
package/dist/index.mjs CHANGED
@@ -3114,7 +3114,9 @@ async function saveRollbackData({
3114
3114
  const rollbackData = {
3115
3115
  storyId: story.id,
3116
3116
  name: story.name,
3117
- content: story.content
3117
+ content: story.content,
3118
+ published: story.published,
3119
+ unpublished_changes: story.unpublished_changes
3118
3120
  };
3119
3121
  const rollbacksPath = resolvePath(path, `migrations/${space}/rollbacks`);
3120
3122
  const componentNames = migrationNames.map((n) => getComponentNameFromFilename(n));
@@ -3235,7 +3237,13 @@ class MigrationStream extends Transform {
3235
3237
  await saveRollbackData({
3236
3238
  space: this.options.space,
3237
3239
  path: this.options.path,
3238
- story: { id: story.id, name: story.name || "", content: story.content },
3240
+ story: {
3241
+ id: story.id,
3242
+ name: story.name || "",
3243
+ content: story.content,
3244
+ published: story.published,
3245
+ unpublished_changes: story.unpublished_changes
3246
+ },
3239
3247
  migrationTimestamp: this.timestamp,
3240
3248
  migrationNames
3241
3249
  });
@@ -3248,7 +3256,9 @@ class MigrationStream extends Transform {
3248
3256
  return {
3249
3257
  storyId: story.id,
3250
3258
  name: story.name,
3251
- content: storyContent
3259
+ content: storyContent,
3260
+ published: story.published,
3261
+ unpublished_changes: story.unpublished_changes
3252
3262
  };
3253
3263
  } else if (processed && !contentChanged) {
3254
3264
  this.results.skipped.push({
@@ -3318,10 +3328,10 @@ class MigrationStream extends Transform {
3318
3328
  }
3319
3329
 
3320
3330
  const isStoryPublishedWithoutChanges = (story) => {
3321
- return true;
3331
+ return story.published && !story.unpublished_changes;
3322
3332
  };
3323
3333
  const isStoryWithUnpublishedChanges = (story) => {
3324
- return story.unpublished_changes;
3334
+ return story.published && story.unpublished_changes;
3325
3335
  };
3326
3336
 
3327
3337
  class UpdateStream extends Writable {
@@ -3355,7 +3365,7 @@ class UpdateStream extends Writable {
3355
3365
  }
3356
3366
  }
3357
3367
  async updateStory(migrationResult) {
3358
- const { storyId, name, content } = migrationResult;
3368
+ const { storyId, name, content, published, unpublished_changes } = migrationResult;
3359
3369
  const storyName = name || storyId.toString();
3360
3370
  try {
3361
3371
  const payload = {
@@ -3366,9 +3376,9 @@ class UpdateStream extends Writable {
3366
3376
  },
3367
3377
  force_update: "1"
3368
3378
  };
3369
- if (this.options.publish === "published" && isStoryPublishedWithoutChanges({ published: true, unpublished_changes: false })) {
3379
+ if (this.options.publish === "published" && isStoryPublishedWithoutChanges({ published, unpublished_changes })) {
3370
3380
  payload.publish = 1;
3371
- } else if (this.options.publish === "published-with-changes" && isStoryWithUnpublishedChanges({ published: true, unpublished_changes: true })) {
3381
+ } else if (this.options.publish === "published-with-changes" && isStoryWithUnpublishedChanges({ published, unpublished_changes })) {
3372
3382
  payload.publish = 1;
3373
3383
  } else if (this.options.publish === "all") {
3374
3384
  payload.publish = 1;
@@ -3583,14 +3593,20 @@ migrationsCommand.command("rollback [migrationFile]").description("Rollback a mi
3583
3593
  for (const story of rollbackData.stories) {
3584
3594
  const spinner = new Spinner({ verbose }).start(`Restoring story ${chalk.hex(colorPalette.PRIMARY)(story.name || story.storyId)}...`);
3585
3595
  try {
3586
- await updateStory(space, story.storyId, {
3596
+ const payload = {
3587
3597
  story: {
3588
3598
  content: story.content,
3589
3599
  id: story.storyId,
3590
3600
  name: story.name
3591
3601
  },
3592
3602
  force_update: "1"
3593
- });
3603
+ };
3604
+ if (story.published !== void 0 && story.unpublished_changes !== void 0) {
3605
+ if (story.published && !story.unpublished_changes) {
3606
+ payload.publish = 1;
3607
+ }
3608
+ }
3609
+ await updateStory(space, story.storyId, payload);
3594
3610
  spinner.succeed(`Restored story ${chalk.hex(colorPalette.PRIMARY)(story.name || story.storyId)}`);
3595
3611
  } catch (error) {
3596
3612
  spinner.failed(`Failed to restore story ${chalk.hex(colorPalette.PRIMARY)(story.name || story.storyId)}: ${error.message}`);
@@ -5183,7 +5199,7 @@ program$1.command(`${commands.CREATE} [project-path]`).alias("c").description(`S
5183
5199
  konsola.br();
5184
5200
  });
5185
5201
 
5186
- const version = "4.6.8";
5202
+ const version = "4.6.10";
5187
5203
  const pkg = {
5188
5204
  version: version};
5189
5205