itube-specs 0.0.753 → 0.0.755

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "itube-specs",
3
3
  "type": "module",
4
- "version": "0.0.753",
4
+ "version": "0.0.755",
5
5
  "main": "./nuxt.config.ts",
6
6
  "types": "./types/index.d.ts",
7
7
  "scripts": {
@@ -10,6 +10,6 @@ export const cleanChannelInfo = (card: IRawChannelInfo): ICardInfo => ({
10
10
  videosCount: card.videos_count || 0,
11
11
  isNetwork: card.is_network || false,
12
12
  updated: card.updated || 0,
13
- img: card.avatar_url || card.video_thumb_urls.webp?.[ThumbSize.Small] || '',
13
+ img: card.avatar_url || card.video_thumb_urls?.webp?.[ThumbSize.Small] || '',
14
14
  tags: card.tags || [],
15
15
  })
@@ -2,7 +2,7 @@ import type { IRawModelCard, IModelCard, IModelParameter } from '../../../types'
2
2
  import { ThumbSize } from '../../enums/thumb-size';
3
3
 
4
4
  const parameterNames = ['guy_type', 'ethnicity'];
5
- const age = (card: IRawModelCard) => card.parameters.find(item => item.name === 'age')?.values[0].title;
5
+ const age = (card: IRawModelCard) => card.parameters?.find(item => item.name === 'age')?.values?.[0]?.title;
6
6
 
7
7
  /** Нормализует сырую карточку модели к типу IModelCard, включая параметры (возраст, рост, вес) и страну. */
8
8
  export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
@@ -12,14 +12,14 @@ export const cleanModelCard = (card: IRawModelCard): IModelCard => ({
12
12
  primaryImageUrl: card.primary_image_url || '',
13
13
  guid: card.guid || '',
14
14
  country: {
15
- title: card.parameters?.find(item => item.name === 'birthplace_country')?.values[0].title || '',
16
- name: card.parameters?.find(item => item.name === 'birthplace_country')?.values[0].name || '',
15
+ title: card.parameters?.find(item => item.name === 'birthplace_country')?.values?.[0]?.title || '',
16
+ name: card.parameters?.find(item => item.name === 'birthplace_country')?.values?.[0]?.name || '',
17
17
  },
18
18
  parameters: [
19
- ...card.parameters.filter(item => parameterNames.includes(item.name) && item.values?.length).map((item: IModelParameter) => ({
19
+ ...(card.parameters?.filter(item => parameterNames.includes(item.name) && item.values?.length).map((item: IModelParameter) => ({
20
20
  title: item.name,
21
21
  value: item.values?.[0]?.title,
22
- })),
22
+ })) ?? []),
23
23
  ...(age(card) ? [{
24
24
  title: 'age',
25
25
  value: age(card),
@@ -5,10 +5,10 @@ import { ThumbSize } from '../../enums/thumb-size';
5
5
  export const cleanModelInfo = (card: IRawModelInfo): ICardInfo => ({
6
6
  title: card.title || '',
7
7
  description: card.description || '',
8
- social: card.social || '',
8
+ social: card.social || undefined,
9
9
  videosCount: card.videos_count || 0,
10
10
  img: card.video_thumb_urls?.webp?.[ThumbSize.Small] || '',
11
- parameters: card.parameters || '',
11
+ parameters: card.parameters || [],
12
12
  fullDescription: card.long_description || '',
13
13
  relatedNames: card.relatedNames || [],
14
14
  akaNames: card.aka_names?.join(', ') || '',
@@ -16,7 +16,7 @@ export const cleanPlaylistCard = (card: IRawPlaylistCard): IPlaylistCard => ({
16
16
  })),
17
17
  videosCount: card.videos_count || 0,
18
18
  firstVideoId: card.first_video_id || '',
19
- searchTags: card.search_tags || '',
19
+ searchTags: card.search_tags || [],
20
20
  views: card.views || 0,
21
21
  likes: card.likes || 0,
22
22
  dislikes: card.dislikes || 0,
@@ -9,7 +9,7 @@ export const cleanPlaylistData = (card: IRawPlaylistData): IPlaylistData => ({
9
9
  playlistType: card.playlist_type || '',
10
10
  videosCount: card.videos_count || 0,
11
11
  firstVideoId: card.first_video_id || '',
12
- searchTags: card.search_tags || '',
12
+ searchTags: card.search_tags || [],
13
13
  views: card.views || 0,
14
14
  likes: card.likes || 0,
15
15
  dislikes: card.dislikes || 0,
@@ -9,7 +9,7 @@ export const cleanVideoCard = (card: IRawVideoCard): IVideoCard => ({
9
9
  title: card.title || '',
10
10
  views: card.views || 0,
11
11
  id: card.id || '',
12
- tags: card.tags || '',
12
+ tags: card.tags || [],
13
13
  isNew: card.is_new || false,
14
14
  channelAvatar: card.channel?.avatar_url || '',
15
15
  channelName: card.channel?.name || '',
@@ -11,9 +11,9 @@ export const cleanVideoData = (data: IRawVideoData): IVideoData => ({
11
11
  views: data.views || 0,
12
12
  likes: data.likes || 0,
13
13
  id: data.id || '',
14
- tags: data.tags || '',
15
- models: data.models || '',
16
- categories: data.categories || '',
14
+ tags: data.tags || [],
15
+ models: data.models || [],
16
+ categories: data.categories || [],
17
17
  actions: data.actions || null,
18
18
  channelName: data.channel?.name || '',
19
19
  channelAvatar: data.channel?.avatar_url || '',
@@ -17,9 +17,14 @@ export class ApiHelper {
17
17
  'x-domain': runtimeConfig.public.xDomain,
18
18
  };
19
19
 
20
+ const method = String(fetchOptions.method || 'GET').toUpperCase();
21
+ const isIdempotent = method === 'GET' || method === 'HEAD';
22
+
20
23
  const res = await $fetch(`/bff${path}`, {
21
24
  ...fetchOptions,
22
- retry: 0,
25
+ retry: isIdempotent ? 2 : 0,
26
+ retryDelay: 300,
27
+ retryStatusCodes: [408, 425, 429, 500, 502, 503, 504],
23
28
  headers,
24
29
  } as any);
25
30