storyblok 3.32.1 → 3.32.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/cli.d.mts CHANGED
@@ -23,7 +23,7 @@ type ComponentPropertySchema = {
23
23
  component_whitelist?: string[];
24
24
  email_link_type?: boolean;
25
25
  exclude_empty_option?: boolean;
26
- filter_content_type?: string[];
26
+ filter_content_type?: string | string[];
27
27
  key: string;
28
28
  options?: ComponentPropertySchemaOption[];
29
29
  pos: number;
package/dist/cli.d.ts CHANGED
@@ -23,7 +23,7 @@ type ComponentPropertySchema = {
23
23
  component_whitelist?: string[];
24
24
  email_link_type?: boolean;
25
25
  exclude_empty_option?: boolean;
26
- filter_content_type?: string[];
26
+ filter_content_type?: string | string[];
27
27
  key: string;
28
28
  options?: ComponentPropertySchemaOption[];
29
29
  pos: number;
package/dist/cli.mjs CHANGED
@@ -1108,10 +1108,32 @@ class SyncComponents {
1108
1108
  );
1109
1109
  component.component_group_uuid = targetGroupData.uuid;
1110
1110
  }
1111
+ const { internal_tags_list, internal_tag_ids, ...rest } = component;
1112
+ const existingTags = await this.getSpaceInternalTags(this.targetSpaceId);
1113
+ let processedInternalTagsIds = [];
1114
+ if (internal_tags_list.length > 0) {
1115
+ await internal_tags_list.forEach(async (tag) => {
1116
+ const existingTag = existingTags.find(({ name }) => tag.name === name);
1117
+ if (!existingTag) {
1118
+ try {
1119
+ const response = await this.createComponentInternalTag(this.targetSpaceId, tag);
1120
+ processedInternalTagsIds.push(response.id);
1121
+ } catch (e) {
1122
+ console.error(chalk.red("X") + ` Internal tag ${tag} creation failed: ${e.message}`);
1123
+ }
1124
+ } else {
1125
+ processedInternalTagsIds.push(existingTag.id);
1126
+ }
1127
+ });
1128
+ }
1129
+ const componentData = {
1130
+ ...rest,
1131
+ internal_tag_ids: processedInternalTagsIds || internal_tag_ids
1132
+ };
1111
1133
  try {
1112
1134
  const componentCreated = await this.createComponent(
1113
1135
  this.targetSpaceId,
1114
- component
1136
+ componentData
1115
1137
  );
1116
1138
  console.log(chalk.green("\u2713") + ` Component ${component.name} created`);
1117
1139
  if (componentPresets.length) {
@@ -1126,7 +1148,7 @@ class SyncComponents {
1126
1148
  await this.updateComponent(
1127
1149
  this.targetSpaceId,
1128
1150
  componentTarget.id,
1129
- component,
1151
+ componentData,
1130
1152
  componentTarget
1131
1153
  );
1132
1154
  console.log(chalk.green("\u2713") + ` Component ${component.name} synced`);
@@ -1177,7 +1199,11 @@ class SyncComponents {
1177
1199
  targetComponentData
1178
1200
  )
1179
1201
  };
1180
- return this.client.put(`spaces/${spaceId}/components/${componentId}`, payload);
1202
+ payload.component.internal_tag_ids = sourceComponentData.internal_tag_ids;
1203
+ return this.client.put(`spaces/${spaceId}/components/${componentId}`, payload).then((response) => {
1204
+ const component = response.data.component || {};
1205
+ return component;
1206
+ }).catch((error) => Promise.reject(error));
1181
1207
  }
1182
1208
  mergeComponents(sourceComponent, targetComponent = {}) {
1183
1209
  const data = this.componentsFullSync ? {
@@ -1229,6 +1255,17 @@ class SyncComponents {
1229
1255
  return targetGroupData.uuid;
1230
1256
  });
1231
1257
  }
1258
+ getSpaceInternalTags(spaceId) {
1259
+ return this.client.get(`spaces/${spaceId}/internal_tags`).then((response) => response.data.internal_tags || []);
1260
+ }
1261
+ createComponentInternalTag(spaceId, tag) {
1262
+ return this.client.post(`spaces/${spaceId}/internal_tags`, {
1263
+ internal_tag: {
1264
+ name: tag.name,
1265
+ object_type: "component"
1266
+ }
1267
+ }).then((response) => response.data.internal_tag || {}).catch((error) => Promise.reject(error));
1268
+ }
1232
1269
  }
1233
1270
 
1234
1271
  class SyncDatasources {
@@ -3319,6 +3356,11 @@ getPropertyTypeAnnotation_fn = function(property) {
3319
3356
  }
3320
3357
  if (property.source === "internal_stories") {
3321
3358
  if (property.filter_content_type) {
3359
+ if (typeof property.filter_content_type === "string") {
3360
+ return {
3361
+ tsType: `(${__privateMethod(this, _getStoryType, getStoryType_fn).call(this, property.filter_content_type)} | string )${property.type === "options" ? "[]" : ""}`
3362
+ };
3363
+ }
3322
3364
  return {
3323
3365
  tsType: `(${property.filter_content_type.map((type2) => __privateMethod(this, _getStoryType, getStoryType_fn).call(this, type2)).join(" | ")} | string )${property.type === "options" ? "[]" : ""}`
3324
3366
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "storyblok",
3
- "version": "3.32.1",
3
+ "version": "3.32.3",
4
4
  "description": "A simple CLI to start Storyblok from your command line.",
5
5
  "repository": {
6
6
  "type": "git",