ftdsy-attr 1.0.4 → 2.0.0

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.
Files changed (64) hide show
  1. package/dist/ftdsy-attr.cjs.js +2 -0
  2. package/dist/ftdsy-attr.cjs.js.map +1 -0
  3. package/dist/ftdsy-attr.d.ts +93 -0
  4. package/dist/ftdsy-attr.esm.js +2 -0
  5. package/dist/ftdsy-attr.esm.js.map +1 -0
  6. package/dist/index.html +831 -2563
  7. package/dist/types/api/tb/index.d.ts +3 -0
  8. package/dist/types/category/bags/bags_leather.d.ts +16 -0
  9. package/dist/types/category/bags/bags_motion.d.ts +16 -0
  10. package/dist/types/category/clothing/clothing_accessory.d.ts +16 -0
  11. package/dist/types/category/clothing/clothing_children.d.ts +16 -0
  12. package/dist/types/category/clothing/clothing_jewelry.d.ts +16 -0
  13. package/dist/types/category/clothing/clothing_men.d.ts +16 -0
  14. package/dist/types/category/clothing/clothing_motion.d.ts +16 -0
  15. package/dist/types/category/clothing/clothing_underwear.d.ts +16 -0
  16. package/dist/types/category/clothing/clothing_women.d.ts +16 -0
  17. package/dist/types/category/departmentStore/departmentStore_bedding.d.ts +16 -0
  18. package/dist/types/category/departmentStore/departmentStore_flower.d.ts +16 -0
  19. package/dist/types/category/departmentStore/departmentStore_homefabric.d.ts +16 -0
  20. package/dist/types/category/departmentStore/departmentStore_petanimal.d.ts +16 -0
  21. package/dist/types/category/departmentStore/departmentStore_storage.d.ts +16 -0
  22. package/dist/types/category/index.d.ts +7 -0
  23. package/dist/types/category/motherBaby/motherBaby_bady.d.ts +16 -0
  24. package/dist/types/category/motherBaby/motherBaby_gravida.d.ts +16 -0
  25. package/dist/types/category/numeral/numeral_accessory.d.ts +16 -0
  26. package/dist/types/category/numeral/numeral_camera.d.ts +16 -0
  27. package/dist/types/category/numeral/numeral_computer.d.ts +16 -0
  28. package/dist/types/category/shoes/shoes_children.d.ts +16 -0
  29. package/dist/types/category/shoes/shoes_men.d.ts +16 -0
  30. package/dist/types/category/shoes/shoes_motion.d.ts +16 -0
  31. package/dist/types/category/shoes/shoes_women.d.ts +16 -0
  32. package/dist/types/category/sportsOutdoor/sportsOutdoor_outdoors.d.ts +16 -0
  33. package/dist/types/category/sportsOutdoor/sportsOutdoor_sports.d.ts +16 -0
  34. package/dist/types/category/vehicle/vehicle_cycling.d.ts +16 -0
  35. package/dist/types/category/vehicle/vehicle_electricvehicle.d.ts +16 -0
  36. package/dist/types/category/vehicle/vehicle_motorcycle.d.ts +16 -0
  37. package/dist/types/main.d.ts +21 -0
  38. package/dist/types/models/defaultModel.d.ts +16 -0
  39. package/dist/types/models/index.d.ts +11 -0
  40. package/dist/types/models/modal.d.ts +11 -0
  41. package/dist/types/platform/index.d.ts +6 -0
  42. package/dist/types/platform/platform/albb.d.ts +6 -0
  43. package/dist/types/platform/platform/dy.d.ts +6 -0
  44. package/dist/types/platform/platform/jd.d.ts +6 -0
  45. package/dist/types/platform/platform/ks.d.ts +6 -0
  46. package/dist/types/platform/platform/pdd.d.ts +9 -0
  47. package/dist/types/platform/platform/shopee.d.ts +6 -0
  48. package/dist/types/platform/platform/tb.d.ts +6 -0
  49. package/dist/types/platform/platform/tiktok.d.ts +6 -0
  50. package/dist/types/platform/platform/tm.d.ts +6 -0
  51. package/dist/types/platform/platform/wxsph.d.ts +6 -0
  52. package/dist/types/platform/platform/xhs.d.ts +6 -0
  53. package/dist/types/platform/type.d.ts +70 -0
  54. package/dist/types/property/index.d.ts +10 -0
  55. package/dist/types/property/matchProperty.d.ts +6 -0
  56. package/dist/types/property/perpareProperty.d.ts +9 -0
  57. package/dist/types/property/predictionProperty.d.ts +9 -0
  58. package/dist/types/type.d.ts +36 -0
  59. package/dist/types/utils/axios.d.ts +15 -0
  60. package/dist/types/utils/error.d.ts +12 -0
  61. package/dist/types/utils/utils.d.ts +46 -0
  62. package/package.json +24 -19
  63. package/dist/ftdsy-attr.js +0 -13903
  64. package/dist/ftdsy-attr.js.map +0 -1
@@ -0,0 +1,70 @@
1
+ export type Platform = 'pdd' | 'tb' | 'jd' | 'dy' | 'shopee' | 'xhs' | 'ks' | 'dsy' | 'albb' | 'shopeebt' | 'tgc' | 'wxsph' | 'tiktok' | 'tm' | 'tiktokUs';
2
+ export type Category = {
3
+ title: string;
4
+ path?: string;
5
+ dsy?: string;
6
+ pdd: string;
7
+ tb: string;
8
+ tm: string;
9
+ jd: string;
10
+ dy: string;
11
+ shopee: string;
12
+ shopeebt?: string;
13
+ xhs: string;
14
+ ks: string;
15
+ albb: string;
16
+ wxsph: string;
17
+ tiktok: string;
18
+ tiktokUs: string;
19
+ };
20
+ export type GoodsAttr = {
21
+ id?: string | number;
22
+ attr_name: string;
23
+ value: string | string[];
24
+ value_id?: string | number | string[];
25
+ };
26
+ export type PropertyItem = {
27
+ property_id: string | number;
28
+ property_name: string;
29
+ property_required: boolean;
30
+ property_type: number;
31
+ property_value?: number | string | PropertySelectOption[] | PropertySelectOption | object;
32
+ property_values: PropertySelectOption[];
33
+ select_max_num: number;
34
+ select_custom: boolean;
35
+ input_num: number;
36
+ input_max_num: number;
37
+ input_type: string;
38
+ property_unit: string;
39
+ property_units: string[];
40
+ input_operator?: string;
41
+ input_values?: PropertyInputOption[];
42
+ date_format: string;
43
+ has_children: boolean;
44
+ show?: boolean;
45
+ show_condition: PropertyShowCondition[];
46
+ condition_values: PropertySelectOption[];
47
+ property_tips?: string;
48
+ measure_templates?: any;
49
+ property_cstore?: boolean;
50
+ };
51
+ export type PropertySelectOption = {
52
+ name: string;
53
+ value_id: string;
54
+ value: string;
55
+ parent_value?: string[];
56
+ parent_id?: string;
57
+ parent_name?: string;
58
+ children_values?: PropertySelectOption[];
59
+ disableContent?: boolean;
60
+ content?: number;
61
+ similarity?: number;
62
+ };
63
+ export type PropertyInputOption = {
64
+ title: string;
65
+ value: string;
66
+ };
67
+ export type PropertyShowCondition = {
68
+ parent_property_id: string;
69
+ parent_property_value: string[];
70
+ };
@@ -0,0 +1,10 @@
1
+ import { MatchInfo, MatchGoods, PropertiesData } from "@/type";
2
+ import { GoodsAttr, PropertyItem } from "@/platform/type";
3
+ declare const _default: {
4
+ matchPropertiesValue: typeof matchPropertiesValue;
5
+ };
6
+ export default _default;
7
+ /**
8
+ * 匹配属性值
9
+ * */
10
+ declare function matchPropertiesValue(matchInfo: MatchInfo, properties: PropertyItem[], attrs?: GoodsAttr[], goods?: MatchGoods): Promise<PropertiesData>;
@@ -0,0 +1,6 @@
1
+ import { MatchInfo, MatchGoods } from "@/type";
2
+ import { GoodsAttr, PropertyItem } from "@/platform/type";
3
+ /**
4
+ * 匹配属性
5
+ * */
6
+ export declare function matchPropertyItem(matchInfo: MatchInfo, propertyItem: PropertyItem, attrs?: GoodsAttr[], goods?: MatchGoods): void;
@@ -0,0 +1,9 @@
1
+ import { PropertiesData } from "../type";
2
+ import { PropertyItem } from "../platform/type";
3
+ /**
4
+ * 匹配前进行属性重组以及分组
5
+ * 1.过滤掉’品牌‘属性
6
+ * 2.区分必填、非必填、子属性
7
+ * 3.将子属性添加到对应父属性下
8
+ * */
9
+ export declare function perparePropertyGroup(properties: PropertyItem[]): PropertiesData;
@@ -0,0 +1,9 @@
1
+ import { MatchInfo, MatchGoods } from "../type";
2
+ import { PropertyItem } from "../platform/type";
3
+ /**
4
+ * 预测属性值
5
+ *
6
+ * 1.优先根据已有信息进行填写(标题,备注,货号等)
7
+ * 2.再设置默认值(使用默认值表)
8
+ * */
9
+ export declare function predictionPropertyItem(matchInfo: MatchInfo, propertyItem: PropertyItem, selectAttrs: string, goods: MatchGoods): void;
@@ -0,0 +1,36 @@
1
+ import { Platform, PropertyItem } from "./platform/type";
2
+ export interface MatchInfo {
3
+ cate_id: string;
4
+ cate_path: string;
5
+ platform: Platform;
6
+ is_prediction: boolean;
7
+ is_required_force: boolean;
8
+ is_other_force: boolean;
9
+ }
10
+ export interface MatchGoods {
11
+ title?: string;
12
+ goods_sn?: string;
13
+ ccc_code?: string;
14
+ remark?: string;
15
+ }
16
+ export interface MatchDatas extends MatchGoods {
17
+ cate_id: string;
18
+ cate_path: string;
19
+ platform: Platform;
20
+ properties: any[];
21
+ attrs?: any[];
22
+ }
23
+ export interface PropertiesData {
24
+ list: PropertyItem[];
25
+ require_total: number;
26
+ require_count: number;
27
+ required_list: PropertyItem[];
28
+ other_list: PropertyItem[];
29
+ children_list: PropertyItem[];
30
+ brand_property: PropertyItem | object;
31
+ material_quality_property: PropertyItem | object;
32
+ }
33
+ export interface MaterialInfo {
34
+ material: string;
35
+ percentage: number;
36
+ }
@@ -0,0 +1,15 @@
1
+ import { type AxiosRequestConfig } from 'axios';
2
+ type Config = {
3
+ maxRetries?: number;
4
+ retryDelay?: number;
5
+ };
6
+ export type Response<T> = {
7
+ code: number;
8
+ status: number;
9
+ msg?: string;
10
+ data: T;
11
+ };
12
+ export declare const fetchWithRetry: <T>(opt: AxiosRequestConfig, config?: Config) => Promise<T | undefined>;
13
+ export type UrlType = 'base' | 'tbApi' | 'dySupplier' | 'image';
14
+ export declare const fullUrl: (url: string, type?: UrlType) => string;
15
+ export {};
@@ -0,0 +1,12 @@
1
+ declare const _default: {
2
+ getError(message: string): {
3
+ msg: string;
4
+ code: number;
5
+ type: string;
6
+ } | {
7
+ msg: string;
8
+ code: string;
9
+ type: string;
10
+ };
11
+ };
12
+ export default _default;
@@ -0,0 +1,46 @@
1
+ import { MaterialInfo } from '@/type';
2
+ type PercentageRange = {
3
+ min: number | null;
4
+ max: number | null;
5
+ includeMin: boolean;
6
+ includeMax: boolean;
7
+ };
8
+ declare const _default: {
9
+ checkValue(value: unknown): boolean;
10
+ /**
11
+ * 获取2个字符串的相似度
12
+ * @param {string} str1 字符串1
13
+ * @param {string} str2 字符串2
14
+ * @returns {number} 相似度
15
+ */
16
+ getStringSimilarity(str1: string, str2: string): number;
17
+ /**
18
+ * 判断字符串中是否包含某些字符
19
+ *
20
+ * @param {String} text 检测字符串
21
+ * @param {Array} arr 检测内容字符串数组
22
+ * @param {string} type 检测方式,includeOne:包含一个,includeAll:包含全部,默认为 includeOne
23
+ * */
24
+ isTextInclude(text: string, arr: string[], type?: string): boolean;
25
+ /**
26
+ * 获取文本长度
27
+ *
28
+ * @param {String} text 待检查的字符串
29
+ * @param {Number} max 当text不是字符时返回的数字
30
+ * */
31
+ getTextLength(text: string, max?: number): number;
32
+ getCurrentTime(cate_path?: string): {
33
+ year: number;
34
+ month: number;
35
+ day: number;
36
+ season: string;
37
+ lastSeason: string;
38
+ };
39
+ parsePercentage(str: string | null | undefined): number;
40
+ parseMaterial(str: string): MaterialInfo;
41
+ parsePercentageRange(str: string): PercentageRange;
42
+ isMatchNumberRange(userMin: number, userMax: number, option: any): boolean;
43
+ mathRoundNumber(num: number): number;
44
+ mathRandomNumber(num: number): number;
45
+ };
46
+ export default _default;
package/package.json CHANGED
@@ -1,40 +1,45 @@
1
1
  {
2
2
  "name": "ftdsy-attr",
3
- "version": "1.0.4",
4
- "main": "dist/ftdsy-attr",
3
+ "version": "2.0.0",
4
+ "main": "dist/ftdsy-attr.cjs.js",
5
+ "module": "dist/ftdsy-attr.esm.js",
6
+ "types": "dist/ftdsy-attr.d.ts",
5
7
  "exports": {
6
- ".": "./dist/ftdsy-attr.js"
8
+ ".": {
9
+ "import": "./dist/ftdsy-attr.esm.js",
10
+ "require": "./dist/ftdsy-attr.cjs.js"
11
+ }
7
12
  },
8
13
  "files": [
9
14
  "dist"
10
15
  ],
11
16
  "type": "module",
12
17
  "scripts": {
13
- "dev": "NODE_ENV=development rollup -c -w",
14
- "build": "NODE_ENV=production rollup -c",
18
+ "dev": "NODE_ENV=development rollup -c rollup.config.js -w",
19
+ "build": "NODE_ENV=production rollup -c rollup.config.js",
15
20
  "serve": "live-server test --port=3000 --host=localhost"
16
21
  },
17
22
  "keywords": [],
18
23
  "author": "",
19
24
  "license": "ISC",
25
+ "peerDependencies": {
26
+ "@tensorflow/tfjs": "^4.15.0",
27
+ "axios": "^1.10.0"
28
+ },
20
29
  "devDependencies": {
21
- "@babel/core": "^7.26.9",
22
- "@babel/preset-env": "^7.26.9",
23
- "@rollup/plugin-babel": "^6.0.4",
24
- "@rollup/plugin-json": "^6.1.0",
25
- "@rollup/plugin-node-resolve": "^16.0.0",
30
+ "@rollup/plugin-commonjs": "^28.0.5",
31
+ "@rollup/plugin-node-resolve": "^16.0.1",
26
32
  "@rollup/plugin-terser": "^0.4.4",
27
- "@rollup/plugin-url": "^8.0.2",
28
- "live-server": "^1.2.2",
29
33
  "rollup": "^4.34.9",
30
- "rollup-plugin-copy": "^3.5.0",
34
+ "rollup-plugin-dts": "^6.2.1",
35
+ "rollup-plugin-livereload": "^2.0.5",
36
+ "rollup-plugin-peer-deps-external": "^2.2.4",
31
37
  "rollup-plugin-serve": "^3.0.0",
32
- "rollup-plugin-string": "^3.0.0"
38
+ "rollup-plugin-typescript2": "^0.36.0",
39
+ "typescript": "^5.8.3"
33
40
  },
41
+ "description": "",
34
42
  "dependencies": {
35
- "@rollup/plugin-commonjs": "^28.0.3",
36
- "@tensorflow/tfjs": "^4.15.0",
37
- "rollup-plugin-livereload": "^2.0.5"
38
- },
39
- "description": ""
43
+ "tslib": "^2.8.1"
44
+ }
40
45
  }