@freelog/tools-lib 0.1.162 → 0.1.165

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.
@@ -0,0 +1,29 @@
1
+ import FUtil from '../utils';
2
+ // import {CommonReturn} from "./tools";
3
+
4
+ // 根据编号取资源类型
5
+ interface GetInfoByCodeType {
6
+ code: string;
7
+ }
8
+
9
+ export function getInfoByCode({...params}: GetInfoByCodeType) {
10
+ return FUtil.Request({
11
+ method: 'GET',
12
+ url: `/v2/resources/types/getInfoByCode`,
13
+ params: params,
14
+ });
15
+ }
16
+
17
+ // 根据编号取资源类型
18
+ interface GetInfoByCodeOrNameType {
19
+ code?: string;
20
+ name?: string;
21
+ }
22
+
23
+ export function getInfoByCodeOrName({...params}: GetInfoByCodeOrNameType) {
24
+ return FUtil.Request({
25
+ method: 'GET',
26
+ url: `/v2/resources/types/getInfoByCodeOrName`,
27
+ params: params,
28
+ });
29
+ }
@@ -29,15 +29,22 @@ interface IResourceInfo {
29
29
  updateDate: string;
30
30
  userId: number;
31
31
  username: string;
32
+ operationType: number;
32
33
  }
33
34
 
34
35
  // 创建资源
35
36
  export interface CreateParamsType {
36
37
  name: string;
38
+ subjectType?: 1 | 4; // 标的物类型(1:普通资源 4:合集资源) 默认是1
39
+ resourceTitle?: string;
37
40
  // resourceType: string[]
38
41
  resourceTypeCode: string;
39
42
  resourceTypeName?: string;
40
- policies?: any[];
43
+ policies?: {
44
+ policyName: string;
45
+ policyText: string;
46
+ status?: 0 | 1;
47
+ }[];
41
48
  coverImages?: string[];
42
49
  intro?: string;
43
50
  tags?: string[];
@@ -184,6 +191,7 @@ interface ListParamsType {
184
191
  // startResourceId?: string;
185
192
  operationCategoryCode?: string;
186
193
  operationTypes?: string;
194
+ subjectType?: 1 | 4;
187
195
  }
188
196
 
189
197
  // interface ListReturnType extends CommonReturn {
@@ -694,6 +702,7 @@ interface ListSimpleByParentCodeParamsType {
694
702
  category?: 1 | 2; // 种类 1:基础资源类型 2:自定义资源类型
695
703
  excludeParentCode?: boolean;
696
704
  isTerminate?: boolean;
705
+ nameChain?: string;
697
706
  }
698
707
 
699
708
  export function ListSimpleByParentCode({...params}: ListSimpleByParentCodeParamsType) {
@@ -769,3 +778,410 @@ export function generateResourceNames({resourceNames}: GenerateResourceNamesPara
769
778
  },
770
779
  });
771
780
  }
781
+
782
+ // 更新资源合集版本
783
+ interface UpdateCollectionParamsType {
784
+ resourceId: string;
785
+ description?: string;
786
+ // serializeStatus?: 0 | 1;
787
+ dependencies?: {
788
+ resourceId: string;
789
+ versionRange: string;
790
+ }[];
791
+ customPropertyDescriptors?: {
792
+ key: string;
793
+ defaultValue: string;
794
+ type: string;
795
+ candidateItems?: string[];
796
+ remark?: string;
797
+ }[];
798
+ resolveResources?: {
799
+ resourceId: string;
800
+ contracts: {
801
+ policyId: string;
802
+ }[]
803
+ }[];
804
+ // optionalResolveResources?: {
805
+ // resourceId: string;
806
+ // contracts: {
807
+ // policyId: string;
808
+ // }[]
809
+ // }[];
810
+ // addCollectionItems?: {
811
+ // resourceId: string;
812
+ // itemTitle: string;
813
+ // }[];
814
+ catalogueProperty?: {
815
+ collection_item_no_display?: 'collection_item_no_display_show' | 'collection_item_no_display_hide';
816
+ collection_item_image_display?: 'collection_item_image_display_show' | 'collection_item_image_display_hide';
817
+ collection_item_descr_display?: 'collection_item_descr_display_show' | 'collection_item_descr_display_hide';
818
+ collection_view?: 'collection_view_list' | 'collection_view_card';
819
+ };
820
+ isMergeCatalogueDraft?: 0 | 1;
821
+ }
822
+
823
+ export function updateCollection({resourceId, ...params}: UpdateCollectionParamsType) {
824
+ return FUtil.Request({
825
+ method: 'PUT',
826
+ url: `/v2/resources/catalogue/${resourceId}`,
827
+ data: params,
828
+ });
829
+ }
830
+
831
+ // 批量删除合集资源单品
832
+ interface deleteCollectionUnitResourcesParamsType {
833
+ resourceId: string;
834
+ removeCollectionItemIds: string[];
835
+ }
836
+
837
+ export function deleteCollectionUnitResource({
838
+ resourceId,
839
+ removeCollectionItemIds
840
+ }: deleteCollectionUnitResourcesParamsType) {
841
+ return FUtil.Request({
842
+ method: 'DELETE',
843
+ url: `/v2/resources/catalogue/${resourceId}?removeCollectionItemIds=${removeCollectionItemIds.join(',')}`,
844
+ // data: params,
845
+ });
846
+ }
847
+
848
+ // 获取合集资源的单品列表
849
+ interface GetCollectionItemsParamsType {
850
+ resourceId: string;
851
+ skip?: number;
852
+ limit?: number;
853
+ sortField?: string;
854
+ sortType?: 1 | -1;
855
+ keywords?: string;
856
+ isLoadLatestVersionInfo?: 0 | 1;
857
+ }
858
+
859
+ export function getCollectionItems({resourceId, ...params}: GetCollectionItemsParamsType) {
860
+ return FUtil.Request({
861
+ method: 'GET',
862
+ url: `/v2/resources/catalogue/${resourceId}/items`,
863
+ params: params,
864
+ });
865
+ }
866
+
867
+ // 获取合集资源的单品列表(草稿)
868
+ interface GetCollectionItems_Draft_ParamsType {
869
+ resourceId: string;
870
+ skip?: number;
871
+ limit?: number;
872
+ sortField?: string;
873
+ sortType?: 1 | -1;
874
+ keywords?: string;
875
+ isLoadLatestVersionInfo?: 0 | 1;
876
+ }
877
+
878
+ export function getCollectionItems_Draft({resourceId, ...params}: GetCollectionItems_Draft_ParamsType) {
879
+ return FUtil.Request({
880
+ method: 'GET',
881
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
882
+ params: params,
883
+ });
884
+ }
885
+
886
+ // 设置合集资源的单品排序序号
887
+ interface SetCollectionItemSortParamsType {
888
+ resourceId: string;
889
+ itemId: string;
890
+ targetSortId: number;
891
+ }
892
+
893
+ export function setCollectionItemSort({resourceId, ...params}: SetCollectionItemSortParamsType) {
894
+ return FUtil.Request({
895
+ method: 'PUT',
896
+ url: `/v2/resources/catalogue/${resourceId}/manualSort`,
897
+ data: params,
898
+ });
899
+ }
900
+
901
+ // 重置合集资源的单品排序序号
902
+ interface ReorderCollectionItemsSortParamsType {
903
+ resourceId: string;
904
+ sortField: string;
905
+ sortType: 1 | -1;
906
+ }
907
+
908
+ export function reorderCollectionItemsSort({resourceId, ...params}: ReorderCollectionItemsSortParamsType) {
909
+ return FUtil.Request({
910
+ method: 'PUT',
911
+ url: `/v2/resources/catalogue/${resourceId}/reorder`,
912
+ data: params,
913
+ });
914
+ }
915
+
916
+ // 查看资源是否在单品目录中存在
917
+ interface CheckExistCollectionItemsParamsType {
918
+ resourceId: string;
919
+ resourceIds: string;
920
+ }
921
+
922
+ export function checkExistCollectionItems({resourceId, ...params}: CheckExistCollectionItemsParamsType) {
923
+ return FUtil.Request({
924
+ method: 'GET',
925
+ url: `/v2/resources/catalogue/${resourceId}/items/checkExists`,
926
+ params: params,
927
+ });
928
+ }
929
+
930
+ // 批量查询单品在资源侧的授权
931
+ interface GetCollectionItemsAuthParamsType {
932
+ resourceId: string;
933
+ itemIds: string;
934
+ }
935
+
936
+ export function getCollectionItemsAuth({resourceId, ...params}: GetCollectionItemsAuthParamsType) {
937
+ return FUtil.Request({
938
+ method: 'GET',
939
+ url: `/v2/auths/resources/${resourceId}/items/batchAuth`,
940
+ params: params,
941
+ });
942
+ }
943
+
944
+ // 批量分组获取合集资源的单品列表
945
+ interface BatchResourceItemsParamsType {
946
+ resourceIds: string;
947
+ limit?: number;
948
+ sortField?: string;
949
+ sortType?: 1 | -1;
950
+ isLoadItemResourceDetailInfo?: 0 | 1;
951
+ }
952
+
953
+ export function batchResourceItems({...params}: BatchResourceItemsParamsType) {
954
+ return FUtil.Request({
955
+ method: 'GET',
956
+ url: `/v2/resources/catalogue/items/batch/list`,
957
+ params: params,
958
+ });
959
+ }
960
+
961
+ // 批量分组获取合集资源的单品列表(草稿)
962
+ interface BatchResourceItems_Draft_ParamsType {
963
+ resourceIds: string;
964
+ limit?: number;
965
+ sortField?: string;
966
+ sortType?: 1 | -1;
967
+ isLoadItemResourceDetailInfo?: 0 | 1;
968
+ }
969
+
970
+ export function batchResourceItems_Draft({...params}: BatchResourceItems_Draft_ParamsType) {
971
+ return FUtil.Request({
972
+ method: 'GET',
973
+ url: `/v2/resources/catalogues/drafts/items/batch/list`,
974
+ params: params,
975
+ });
976
+ }
977
+
978
+ // 查看合集更新日志分页列表
979
+ interface GetCollectionUpdateLogsParamsType {
980
+ resourceId: string;
981
+ skip?: number;
982
+ limit?: number;
983
+ sortType?: 1 | -1;
984
+ }
985
+
986
+ export function getCollectionUpdateLogs({resourceId, ...params}: GetCollectionUpdateLogsParamsType) {
987
+ return FUtil.Request({
988
+ method: 'GET',
989
+ url: `/v2/resources/catalogue/${resourceId}/updateLogs`,
990
+ params: params,
991
+ });
992
+ }
993
+
994
+ // 获取合集单品自动收录规则
995
+ interface GetCollectionCollectRulesParamsType {
996
+ resourceId: string;
997
+ }
998
+
999
+ export function getCollectionCollectRules({resourceId}: GetCollectionCollectRulesParamsType) {
1000
+ return FUtil.Request({
1001
+ method: 'GET',
1002
+ url: `/v2/resources/catalogue/${resourceId}/items/collectRules`,
1003
+ // params: params,
1004
+ });
1005
+ }
1006
+
1007
+ // 创建或更新合集单品自动收录规则
1008
+ interface SetCollectRulesParamsType {
1009
+ resourceId: string;
1010
+ serializeStatus?: 0 | 1;
1011
+ status: 0 | 1;
1012
+ conditionType: 1 | 2;
1013
+ filterConditions: {
1014
+ key: 'resourceTitle' | 'resourceTypeCode' | 'authIdentity';
1015
+ limitOperatorType: 'INCLUDES' | 'NOT_INCLUDES' | 'STARTS_WITH' | 'ENDS_WITH' | 'EQUAL' | 'NOT_EQUAL';
1016
+ value: string;
1017
+ }[];
1018
+ }
1019
+
1020
+ export function setCollectRules({resourceId, ...params}: SetCollectRulesParamsType) {
1021
+ return FUtil.Request({
1022
+ method: 'POST',
1023
+ url: `/v2/resources/catalogue/${resourceId}/items/collectRules`,
1024
+ data: params,
1025
+ });
1026
+ }
1027
+
1028
+ // 批量更新同合集下的单品信息
1029
+ interface SetItemsTitleParamsType {
1030
+ resourceId: string;
1031
+ data: {
1032
+ itemId: string;
1033
+ itemTitle: string;
1034
+ }[];
1035
+ }
1036
+
1037
+ export function setItemsTitle({resourceId, data}: SetItemsTitleParamsType) {
1038
+ return FUtil.Request({
1039
+ method: 'PUT',
1040
+ url: `/v2/resources/catalogue/${resourceId}/items`,
1041
+ data: data,
1042
+ });
1043
+ }
1044
+
1045
+ // 批量删除合集资源单品(草稿)
1046
+ interface deleteCollectionItems_Draft_ParamsType {
1047
+ resourceId: string;
1048
+ removeCollectionItemIds: string[]
1049
+ }
1050
+
1051
+ export function deleteCollectionItems_Draft({
1052
+ resourceId,
1053
+ removeCollectionItemIds
1054
+ }: deleteCollectionItems_Draft_ParamsType) {
1055
+ return FUtil.Request({
1056
+ method: 'DELETE',
1057
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items?removeCollectionItemIds=${removeCollectionItemIds.join(',')}`,
1058
+ // data: params,
1059
+ });
1060
+ }
1061
+
1062
+ // 设置合集资源的单品排序序号(草稿)
1063
+ interface SetCollectionItemsSortID_Draft_ParamsType {
1064
+ resourceId: string;
1065
+ data: {
1066
+ itemId: string;
1067
+ targetSortId: number;
1068
+ };
1069
+ }
1070
+
1071
+ export function setCollectionItemsSortID_Draft({resourceId, data}: SetCollectionItemsSortID_Draft_ParamsType) {
1072
+ return FUtil.Request({
1073
+ method: 'PUT',
1074
+ url: `/v2/resources/catalogues/drafts/${resourceId}/manualSort`,
1075
+ data: data,
1076
+ });
1077
+ }
1078
+
1079
+ // 重置合集资源的单品排序序号(草稿)
1080
+ interface ReorderCollectionItems_Draft_ParamsType {
1081
+ resourceId: string;
1082
+ sortField: 'createDate' | 'itemTitle' | 'sortId' | 'resourceUpdateDate';
1083
+ sortType: -1 | 1;
1084
+ }
1085
+
1086
+ export function reorderCollectionItems_Draft({resourceId, ...params}: ReorderCollectionItems_Draft_ParamsType) {
1087
+ return FUtil.Request({
1088
+ method: 'PUT',
1089
+ url: `/v2/resources/catalogues/drafts/${resourceId}/reorder`,
1090
+ data: params,
1091
+ });
1092
+ }
1093
+
1094
+ // 查看资源是否在单品目录中存在(草稿)
1095
+ interface ResourceIsExistInItems_Draft_ParamsType {
1096
+ resourceId: string;
1097
+ resourceIds: string;
1098
+ }
1099
+
1100
+ export function resourceIsExistInItems_Draft({resourceId, ...params}: ResourceIsExistInItems_Draft_ParamsType) {
1101
+ return FUtil.Request({
1102
+ method: 'GET',
1103
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items/checkExists`,
1104
+ params: params,
1105
+ });
1106
+ }
1107
+
1108
+ // 批量更新同合集下的单品信息(草稿)
1109
+ interface UpdateCollectionItemsInfo_Draft_ParamsType {
1110
+ resourceId: string;
1111
+ data: {
1112
+ itemId: string;
1113
+ itemTitle: string;
1114
+ }[];
1115
+ }
1116
+
1117
+ export function updateCollectionItemsInfo_Draft({resourceId, data}: UpdateCollectionItemsInfo_Draft_ParamsType) {
1118
+ return FUtil.Request({
1119
+ method: 'PUT',
1120
+ // url: `/v2/resources/catalogue/${resourceId}/items`,
1121
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1122
+ data: data,
1123
+ });
1124
+ }
1125
+
1126
+ // 更新单品授权方案(草稿)
1127
+ interface UpdateCollectionItemAuthorization_Draft_ParamsType {
1128
+ resourceId: string;
1129
+ itemId: string;
1130
+ resolveResources: {
1131
+ resourceId: string;
1132
+ contracts: {
1133
+ policyId: string;
1134
+ }[];
1135
+ }[];
1136
+ }
1137
+
1138
+ export function updateCollectionItemAuthorization_Draft({
1139
+ resourceId,
1140
+ itemId,
1141
+ ...params
1142
+ }: UpdateCollectionItemAuthorization_Draft_ParamsType) {
1143
+ return FUtil.Request({
1144
+ method: 'PUT',
1145
+ // url: `/v2/resources/catalogues/${resourceId}/items/${itemId}`,
1146
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items/${itemId}`,
1147
+ data: params,
1148
+ });
1149
+ }
1150
+
1151
+ // 批量新增合集资源单品(草稿)
1152
+ interface AddResourceItems_Draft_ParamsType {
1153
+ resourceId: string;
1154
+ addCollectionItems: {
1155
+ resourceId: string;
1156
+ itemTitle: string;
1157
+ resolveResources?: {
1158
+ resourceId: string;
1159
+ contracts: {
1160
+ policyId: string;
1161
+ }[];
1162
+ }[];
1163
+ }[];
1164
+ isPublish: 1 | 0;
1165
+ }
1166
+
1167
+ export function addResourceItems_Draft({resourceId, ...params}: AddResourceItems_Draft_ParamsType) {
1168
+ return FUtil.Request({
1169
+ method: 'POST',
1170
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items`,
1171
+ data: params,
1172
+ });
1173
+ }
1174
+
1175
+ // 批量查询草稿中的单品在资源侧的授权
1176
+ interface GetCollectionItemsAuth_Draft_ParamsType {
1177
+ resourceId: string;
1178
+ itemIds: string;
1179
+ }
1180
+
1181
+ export function getCollectionItemsAuth_Draft({resourceId, ...params}: GetCollectionItemsAuth_Draft_ParamsType) {
1182
+ return FUtil.Request({
1183
+ method: 'GET',
1184
+ url: `/v2/resources/catalogues/drafts/${resourceId}/items/batchAuth`,
1185
+ params: params,
1186
+ });
1187
+ }