@geelato/gl-runtime-core 0.0.1

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 (117) hide show
  1. package/dist/gl-runtime-core.css +1 -0
  2. package/dist/gl-runtime-core.css.gz +0 -0
  3. package/dist/gl-runtime-core.js +169768 -0
  4. package/dist/gl-runtime-core.js.gz +0 -0
  5. package/dist/gl-runtime-core.umd.cjs +35 -0
  6. package/dist/iconfont-BJ2VOOKJ.js +35 -0
  7. package/dist/iconfont-BJ2VOOKJ.js.gz +0 -0
  8. package/dist/types/actions/JsScriptExecutor.d.ts +291 -0
  9. package/dist/types/actions/fns/datetime.d.ts +22 -0
  10. package/dist/types/actions/fns/device.d.ts +23 -0
  11. package/dist/types/actions/fns/math.d.ts +27 -0
  12. package/dist/types/api/EntityApi.d.ts +143 -0
  13. package/dist/types/api/EntityDataSource.d.ts +272 -0
  14. package/dist/types/api/EntityDeleteService.d.ts +47 -0
  15. package/dist/types/api/EntityQueryCache.d.ts +62 -0
  16. package/dist/types/api/EntityQueryService.d.ts +71 -0
  17. package/dist/types/api/EntityResultMapping.d.ts +11 -0
  18. package/dist/types/api/EntitySaveService.d.ts +46 -0
  19. package/dist/types/api/EntityTypes.d.ts +135 -0
  20. package/dist/types/api/EntityUtilService.d.ts +42 -0
  21. package/dist/types/assets/globalConfig.d.ts +5 -0
  22. package/dist/types/components/AppProvideProxy.d.ts +21 -0
  23. package/dist/types/components/ComponentTreeParser.d.ts +17 -0
  24. package/dist/types/components/FormProvideProxy.d.ts +35 -0
  25. package/dist/types/components/Hooks.d.ts +7 -0
  26. package/dist/types/components/PageDataSourceManager.d.ts +28 -0
  27. package/dist/types/components/PageLoader.d.ts +6 -0
  28. package/dist/types/components/PageProvideProxy.d.ts +413 -0
  29. package/dist/types/components/UiEventNames.d.ts +15 -0
  30. package/dist/types/components/gl-chart/GlChart.vue.d.ts +135 -0
  31. package/dist/types/components/gl-component/GlComponent.vue.d.ts +191 -0
  32. package/dist/types/components/gl-component/GlComponentSupport.d.ts +49 -0
  33. package/dist/types/components/gl-component/GlInsts.vue.d.ts +19 -0
  34. package/dist/types/components/gl-div/GlDiv.vue.d.ts +107 -0
  35. package/dist/types/components/gl-dnd-placeholder/Index.vue.d.ts +112 -0
  36. package/dist/types/components/gl-html/Index.vue.d.ts +7 -0
  37. package/dist/types/components/gl-iconfont/IconsJson.d.ts +15 -0
  38. package/dist/types/components/gl-iconfont/Index.vue.d.ts +19 -0
  39. package/dist/types/components/gl-loader/GlLoader.vue.d.ts +3 -0
  40. package/dist/types/components/gl-login/FloatingActionButton.vue.d.ts +9 -0
  41. package/dist/types/components/gl-login/LoginDialog.vue.d.ts +9 -0
  42. package/dist/types/components/gl-loop/GlLoop.vue.d.ts +230 -0
  43. package/dist/types/components/gl-page-viewer/GlPageViewer.vue.d.ts +221 -0
  44. package/dist/types/components/gl-scanner/GlScanner.vue.d.ts +44 -0
  45. package/dist/types/components/gl-template/GlTemplate.vue.d.ts +154 -0
  46. package/dist/types/components/gl-template/Typs.d.ts +4 -0
  47. package/dist/types/components/gl-virtual/Index.vue.d.ts +3 -0
  48. package/dist/types/components/mixins.d.ts +86 -0
  49. package/dist/types/components/ui-mixins.d.ts +16 -0
  50. package/dist/types/composables/useApiUrl.d.ts +30 -0
  51. package/dist/types/composables/useGlobal.d.ts +21 -0
  52. package/dist/types/composables/useLoading.d.ts +6 -0
  53. package/dist/types/composables/useLogger.d.ts +32 -0
  54. package/dist/types/composables/useMessages.d.ts +15 -0
  55. package/dist/types/composables/useRole.d.ts +5 -0
  56. package/dist/types/locales/index.d.ts +21 -0
  57. package/dist/types/locales/lang/en-US.d.ts +4 -0
  58. package/dist/types/locales/lang/zh-CN.d.ts +4 -0
  59. package/dist/types/m/datasource/ApplicationApi.d.ts +163 -0
  60. package/dist/types/m/datasource/ArcoApi.d.ts +76 -0
  61. package/dist/types/m/datasource/Base.d.ts +99 -0
  62. package/dist/types/m/datasource/BranchApi.d.ts +2 -0
  63. package/dist/types/m/datasource/CompanyApi.d.ts +49 -0
  64. package/dist/types/m/datasource/DictApi.d.ts +127 -0
  65. package/dist/types/m/datasource/DictionaryApi.d.ts +16 -0
  66. package/dist/types/m/datasource/EncodingApi.d.ts +59 -0
  67. package/dist/types/m/datasource/Entry.d.ts +5 -0
  68. package/dist/types/m/datasource/FieldMeta.d.ts +6 -0
  69. package/dist/types/m/datasource/FileApi.d.ts +273 -0
  70. package/dist/types/m/datasource/FileTemplateApi.d.ts +114 -0
  71. package/dist/types/m/datasource/InterApi.d.ts +104 -0
  72. package/dist/types/m/datasource/MarketApi.d.ts +191 -0
  73. package/dist/types/m/datasource/MessageApi.d.ts +27 -0
  74. package/dist/types/m/datasource/ModelApi.d.ts +327 -0
  75. package/dist/types/m/datasource/NoticeApi.d.ts +37 -0
  76. package/dist/types/m/datasource/OcrPdfApi.d.ts +145 -0
  77. package/dist/types/m/datasource/PluginApi.d.ts +35 -0
  78. package/dist/types/m/datasource/ScheduleApi.d.ts +67 -0
  79. package/dist/types/m/datasource/SecurityApi.d.ts +253 -0
  80. package/dist/types/m/datasource/SiteApi.d.ts +38 -0
  81. package/dist/types/m/datasource/SqlApi.d.ts +45 -0
  82. package/dist/types/m/datasource/SysConfigApi.d.ts +52 -0
  83. package/dist/types/m/datasource/TenantApi.d.ts +107 -0
  84. package/dist/types/m/datasource/UserApi.d.ts +173 -0
  85. package/dist/types/m/datasource/VersionApi.d.ts +59 -0
  86. package/dist/types/m/datasource/WeChatApi.d.ts +34 -0
  87. package/dist/types/m/datasource/WorkflowApi.d.ts +317 -0
  88. package/dist/types/m/datasource/ZxingApi.d.ts +38 -0
  89. package/dist/types/main.d.ts +114 -0
  90. package/dist/types/store/index.d.ts +2 -0
  91. package/dist/types/store/modules/user/index.d.ts +16 -0
  92. package/dist/types/types/Operators.d.ts +19 -0
  93. package/dist/types/types/global.d.ts +198 -0
  94. package/dist/types/types/options.d.ts +35 -0
  95. package/dist/types/utils/Auth.d.ts +37 -0
  96. package/dist/types/utils/CacheManager.d.ts +110 -0
  97. package/dist/types/utils/CheckUtil.d.ts +5 -0
  98. package/dist/types/utils/ClipboardUtil.d.ts +24 -0
  99. package/dist/types/utils/ConvertUtil.d.ts +81 -0
  100. package/dist/types/utils/Event.d.ts +2 -0
  101. package/dist/types/utils/FileUtil.d.ts +7 -0
  102. package/dist/types/utils/GenerateUtil.d.ts +14 -0
  103. package/dist/types/utils/IsUtil.d.ts +126 -0
  104. package/dist/types/utils/MixUtil.d.ts +49 -0
  105. package/dist/types/utils/Monitor.d.ts +2 -0
  106. package/dist/types/utils/PageUtil.d.ts +14 -0
  107. package/dist/types/utils/PluginUtil.d.ts +9 -0
  108. package/dist/types/utils/RecordsUtil.d.ts +3 -0
  109. package/dist/types/utils/SseClient.d.ts +34 -0
  110. package/dist/types/utils/StoreUtil.d.ts +8 -0
  111. package/dist/types/utils/StringUtil.d.ts +29 -0
  112. package/dist/types/utils/Utils.d.ts +217 -0
  113. package/dist/types/utils/emitter.d.ts +3 -0
  114. package/dist/types/utils/renderTemplate.d.ts +6 -0
  115. package/dist/types/utils/toChineseCurrency.d.ts +5 -0
  116. package/package.json +76 -0
  117. package/src/main.ts +498 -0
@@ -0,0 +1,272 @@
1
+ import { default as EntityResultMapping } from './EntityResultMapping.ts';
2
+ export declare const compareMeta: {
3
+ cops: {
4
+ label: string;
5
+ value: string;
6
+ priority: number;
7
+ description: string;
8
+ }[];
9
+ copDict: {
10
+ eq: string;
11
+ neq: string;
12
+ lt: string;
13
+ lte: string;
14
+ gt: string;
15
+ gte: string;
16
+ startwith: string;
17
+ endwith: string;
18
+ contains: string;
19
+ nil: string;
20
+ bt: string;
21
+ in: string;
22
+ nin: string;
23
+ fis: string;
24
+ nfis: string;
25
+ };
26
+ };
27
+ export declare const EntityDataSource: {
28
+ keyFiledName: string;
29
+ };
30
+ export declare const fetchEvents: string[];
31
+ /**
32
+ * 字段元数据示例:{
33
+ * charMaxLength: '19',
34
+ * comment: '所属流程定义',
35
+ * defaultValue: '5043740024504455168',
36
+ * name: 'proceDefId',
37
+ * nullable: false,
38
+ * precision: 0,
39
+ * scale: 0,
40
+ * selectType: 'ENTITY',
41
+ * title: '所属流程定义',
42
+ * type: 'String',
43
+ * typeExtra: '5043739996989820928'
44
+ * }
45
+ */
46
+ export declare class FieldMeta {
47
+ [key: string]: any;
48
+ name: string;
49
+ title: string;
50
+ alias: string;
51
+ isLocalComputeFiled: boolean;
52
+ valueExpression?: string;
53
+ constructor(name?: string, alias?: string, title?: string);
54
+ }
55
+ export declare class EntityLiteMeta {
56
+ entityName: string;
57
+ entityType: string;
58
+ entityTitle: string;
59
+ }
60
+ export declare class EntityMeta extends EntityLiteMeta {
61
+ [key: string]: any;
62
+ fieldMetas: Array<FieldMeta>;
63
+ }
64
+ export declare class EntitySaverField {
65
+ name: string;
66
+ value?: string | number | boolean | Array<string | number | boolean>;
67
+ valueExpression?: string;
68
+ constructor(name?: string, value?: string | number | boolean | Array<string | number | boolean> | undefined, valueExpression?: string);
69
+ }
70
+ export declare class EntityReaderParam {
71
+ groupName: string;
72
+ name: string;
73
+ cop: string;
74
+ value: string | number | boolean | Array<string | number | boolean> | undefined;
75
+ valueExpression?: string;
76
+ constructor(name?: string, cop?: string, value?: string | number | boolean | Array<string | number | boolean>, groupName?: string, valueExpression?: string);
77
+ getGroupName(): string;
78
+ setGroupName(groupName?: string): void;
79
+ isGroup(): boolean;
80
+ /**
81
+ * 转换成Mql格式的参数名
82
+ */
83
+ static getMqlParamName(param: EntityReaderParam): string;
84
+ static isValidParam(param: EntityReaderParam): boolean | "";
85
+ /**
86
+ * 转换成Mql格式的参数值
87
+ * 将boolean转成tinyint,和服务端数据库存储的数据一致
88
+ */
89
+ static getMqlParamValue(param: EntityReaderParam): string | number | boolean | (string | number | boolean)[] | undefined;
90
+ /**
91
+ * 转换成Mql格式的参数对象
92
+ * 格式1:字段|[比较符或函数]:参数值
93
+ * 格式2:函数表达式|比较符:参数值
94
+ * 对于cop为fuzzymatch、nfuzzymatch需要采用格式2
95
+ */
96
+ static getMqlParam(param: EntityReaderParam): {
97
+ [x: string]: string | number | boolean | (string | number | boolean)[] | undefined;
98
+ };
99
+ }
100
+ export declare class EntityReaderParamGroup {
101
+ static readonly DEFAULT_NAME = "__";
102
+ static readonly GROUP_SPLIT_FLAG = ">";
103
+ readonly logic: string;
104
+ readonly name: string;
105
+ readonly children: Array<EntityReaderParamGroup | EntityReaderParam>;
106
+ /**
107
+ * @param simpleGroupName or:groupA,该groupName为只有一级的分组名称
108
+ */
109
+ constructor(simpleGroupName: string);
110
+ /**
111
+ * 获取组合后的组名
112
+ */
113
+ getGroupName(): string;
114
+ isGroup(): boolean;
115
+ isSameGroup(groupName: string): boolean;
116
+ /**
117
+ * 在push时,会依据当前的groupNamePath和groupLevel来分析是否将param设置到该层(groupLevel),
118
+ * 可能需创建子级EntityReaderParamGroup,再调用push
119
+ * @param param 最终的参数
120
+ * @param groupNamePath 分组名可能是 or:groupA>and:groupB这样的嵌套格式(分组名称路径)
121
+ * @param groupLevel 参数设置到第几层分组,默认为0
122
+ */
123
+ push(param: EntityReaderParam, groupNamePath: string, groupLevel?: number): void;
124
+ }
125
+ export declare enum TriggerMode {
126
+ onCreated = "onCreated",
127
+ onInvoked = "onInvoked",
128
+ onValueChanged = "onValueChanged"
129
+ }
130
+ export declare enum TriggerConstraint {
131
+ DoNoFetchWhenEmpty = "DoNoFetchWhenEmpty",
132
+ Param1ValueEmpty = "Param1ValueEmpty",
133
+ Param2ValueEmpty = "Param2ValueEmpty",
134
+ Param3ValueEmpty = "Param3ValueEmpty",
135
+ Param4ValueEmpty = "Param4ValueEmpty",
136
+ Param5ValueEmpty = "Param5ValueEmpty"
137
+ }
138
+ export declare enum EntityReaderOrderEnum {
139
+ ASC = "+",
140
+ DESC = "-"
141
+ }
142
+ export declare class EntityReaderOrder {
143
+ field: string;
144
+ order: string;
145
+ /**
146
+ *
147
+ * @param field 排序字段
148
+ * @param order 上降序 'ascend' | 'descend' | ''
149
+ */
150
+ constructor(field?: string, order?: string);
151
+ /**
152
+ * @param order 'ascend' | 'descend' | 'asc' | 'desc' | ''
153
+ */
154
+ convert(order?: string): string | undefined;
155
+ }
156
+ export declare class EntityReader {
157
+ entity: string;
158
+ fields: Array<FieldMeta>;
159
+ params: Array<EntityReaderParam>;
160
+ pageNo: number;
161
+ pageSize: number;
162
+ order: Array<EntityReaderOrder>;
163
+ withMeta: boolean;
164
+ resultMapping: EntityResultMapping;
165
+ description: string;
166
+ immediate?: boolean;
167
+ triggerConstraints?: Array<TriggerConstraint>;
168
+ lazyLoad?: boolean;
169
+ /**
170
+ * 将字符串格式转成数组
171
+ * 字符串支持别名,如:id key
172
+ * @param fieldStr id key,name,age,...
173
+ */
174
+ setFields(fieldStr: string): FieldMeta[];
175
+ /**
176
+ * 添加参数
177
+ * @param name
178
+ * @param cop
179
+ * @param value
180
+ * @param groupName
181
+ * @param valueExpression
182
+ */
183
+ addParam(name: string, cop: string, value: string | number | boolean | Array<string | number | boolean>, groupName?: string, valueExpression?: string): void;
184
+ /**
185
+ * 添加排序字段,可以多次调用,添加多个排序
186
+ * @param field 排序字段名
187
+ * @param order 上降序 默认为升序 'ascend' | 'descend' | '+' | '--'
188
+ */
189
+ addOrder(field: string, order?: string): void;
190
+ }
191
+ export declare enum EntityRecordStatus {
192
+ Pushed = "Pushed",
193
+ UnPushed = "UnPushed",
194
+ Normal = "Normal",
195
+ New = "New",
196
+ Update = "Update"
197
+ }
198
+ /**
199
+ * 实体保存对象,一条记录对应一个EntitySaver
200
+ */
201
+ export declare class EntitySaver {
202
+ /**
203
+ * 一般同组件id,即该entitySaver是基于哪个组件创建的,则采用该id,如GlEntityForm的id、GlEntityTablePlus的id
204
+ * 在基于脚本编码时可能不会设置该值,此时为空
205
+ */
206
+ id?: string;
207
+ /**
208
+ * 实体名称
209
+ */
210
+ entity: string;
211
+ /**
212
+ * 本实体作为子实体时,指向父实体id字段的外健字段的名称
213
+ */
214
+ pidName?: string;
215
+ /**
216
+ * 保存的记录
217
+ */
218
+ record: Record<string, any>;
219
+ /**
220
+ * 可带有脚本的保存字段,如果有该值,该值计算之后,覆盖record中的值
221
+ */
222
+ fields?: EntitySaverField[];
223
+ /**
224
+ * 数据记录的状态
225
+ */
226
+ recordStatus?: EntityRecordStatus;
227
+ /**
228
+ * 子表单
229
+ */
230
+ children: EntitySaver[];
231
+ constructor(entity?: string);
232
+ }
233
+ export declare class EntityDeleter {
234
+ id?: string;
235
+ entity: string;
236
+ pidName?: string;
237
+ record?: Record<string, any>;
238
+ children: EntityDeleter[];
239
+ constructor(entity?: string);
240
+ }
241
+ /**
242
+ * 调用组件getEntitySavers方法的获取返回结果
243
+ * 默认值为失败
244
+ */
245
+ export declare class GetEntitySaversResult {
246
+ id?: string;
247
+ error: boolean;
248
+ values: EntitySaver[];
249
+ message: string;
250
+ componentName: string;
251
+ validateResult?: Record<string, any>;
252
+ }
253
+ /**
254
+ * 是否需要阻断加载数据
255
+ * @param value 组件值
256
+ * @param triggerConstraint 触发阻断条件
257
+ */
258
+ export declare const isStopLoadDataByValue: (value: any, triggerConstraint: TriggerConstraint[]) => boolean;
259
+ /**
260
+ * 是否需要阻断加载数据,依据参数值条件
261
+ * @param params 参数列表
262
+ * @param triggerConstraint 触发阻断条件
263
+ */
264
+ export declare const isStopLoadDataByParams: (params: EntityReaderParam[], triggerConstraint: TriggerConstraint[]) => boolean;
265
+ /**
266
+ * 1、依据当前的查询参数和触发约束条件检索是否可以触发查询
267
+ * 2、依据当前组件的值和触发约束条件检索是否可以触发查询
268
+ * @param entityReader 实体查询对象,包含查询参数params和触发约束条件triggerConstraints
269
+ * @param value 组件的值
270
+ * @returns {boolean} true: 可触发查询,false:不可以触发查询
271
+ */
272
+ export declare const isEntityQueryAble: (entityReader: EntityReader, value?: any) => boolean;
@@ -0,0 +1,47 @@
1
+ import { ApiResult } from '../types/global';
2
+ import { AxiosInstance, AxiosStatic } from 'axios';
3
+ import { EntityDeleter } from './EntityDataSource.ts';
4
+ import { MqlObject } from './EntityTypes.ts';
5
+ export declare class EntityDeleteService {
6
+ private service;
7
+ private url;
8
+ private updateMethod;
9
+ constructor(service: AxiosStatic | AxiosInstance, url: any, updateMethod: Function);
10
+ /**
11
+ * 逻辑删除(基于参数组合)
12
+ * @param entityName
13
+ * @param keyValues
14
+ * @param biz
15
+ */
16
+ delete(entityName: string, keyValues: object, biz?: string): Promise<ApiResult>;
17
+ /**
18
+ * 删除(基于id)
19
+ */
20
+ deleteById(entityName: string, id: string, biz?: string): Promise<ApiResult>;
21
+ /**
22
+ * 删除多条记录(基于id)
23
+ */
24
+ deleteByIds(entityName: string, ids: string[], biz?: string): Promise<ApiResult>;
25
+ /**
26
+ * 批量删除
27
+ * @param items
28
+ * @param biz
29
+ */
30
+ deleteBatch(items: Array<{
31
+ entityName: string;
32
+ keyValues: object;
33
+ }>, biz?: string): Promise<ApiResult[]>;
34
+ /**
35
+ * 基于实体删除对象进行删除,支持父子实体对象删除
36
+ * @param entitySaver 实体删除对象(结构同EntitySaver,children为子级)
37
+ * @param biz
38
+ */
39
+ deleteByDeleter(entityDeleter: EntityDeleter, biz?: string): Promise<ApiResult>;
40
+ /**
41
+ * 批量删除(同一实体的多个删除对象)
42
+ * @param entitySavers
43
+ * @param biz
44
+ */
45
+ deleteBatchDeleter(entityDeleters: EntityDeleter[], biz?: string): Promise<ApiResult[]>;
46
+ convertEntityDeleterToMql(entityDeleter: EntityDeleter, biz?: string): MqlObject;
47
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * 实体查询缓存
3
+ *
4
+ * 关键设计:
5
+ * 1. 缓存的是Promise对象,用于短时间内避免重复请求(去重机制)
6
+ * 2. Promise resolve的res对象会被多处引用,不能随意删除
7
+ * 3. 采用"软删除"策略:标记过期但不删除,让GC自然回收
8
+ */
9
+ declare class EntityQueryCache {
10
+ private _logger?;
11
+ data: Record<string, any>;
12
+ private maxSize;
13
+ private cleanupBatchSize;
14
+ private getLogger;
15
+ private get logger();
16
+ /**
17
+ * @param key gql 对象字符串
18
+ * @param value promise对象
19
+ * @param maxAge 毫秒
20
+ */
21
+ set(key: string, value: any, maxAge: any): void;
22
+ get(key: string): any;
23
+ /**
24
+ * 标记删除(软删除),不实际删除对象
25
+ * 让GC在合适的时机自然回收
26
+ */
27
+ delete(key: string): boolean;
28
+ /**
29
+ * 清理过期缓存(批量处理,限制清理数量)
30
+ * @param maxCleanup 最大清理数量,防止一次性清理过多导致卡顿
31
+ * @returns 实际清理的数量
32
+ */
33
+ cleanup(maxCleanup?: number): number;
34
+ /**
35
+ * 计算清理优先级分数(分数越高越优先清理)
36
+ */
37
+ private calculateCleanupScore;
38
+ /**
39
+ * 完全清空缓存(谨慎使用)
40
+ */
41
+ clear(): void;
42
+ /**
43
+ * 设置最大缓存数量
44
+ */
45
+ setMaxSize(size: number): void;
46
+ /**
47
+ * 获取缓存统计信息
48
+ */
49
+ getStats(): {
50
+ totalSize: number;
51
+ expiredCount: number;
52
+ markedExpiredCount: number;
53
+ activeCount: number;
54
+ maxSize: number;
55
+ };
56
+ }
57
+ declare const entityQueryCache: EntityQueryCache;
58
+ /**
59
+ * 销毁缓存实例
60
+ */
61
+ export declare const destory: () => Promise<void>;
62
+ export default entityQueryCache;
@@ -0,0 +1,71 @@
1
+ import { AxiosInstance, AxiosStatic } from 'axios';
2
+ import { EntityReader } from './EntityDataSource.ts';
3
+ import { MqlObject } from './EntityTypes.ts';
4
+ export declare class EntityQueryService {
5
+ private service;
6
+ private url;
7
+ constructor(service: AxiosStatic | AxiosInstance, url: any);
8
+ /**
9
+ * 基于mql对象进行查询
10
+ * @param mql Object or mqlArray
11
+ * @param withMeta 是否需同时查询出各列表字段的元数据信息
12
+ * @param disabledClientQueryCache 禁止客户端本次从缓存中查询,且禁止客户端缓存本次查询结果,默认为否
13
+ * @param bizCode
14
+ * @returns {*}
15
+ */
16
+ queryByMql(mql: MqlObject | Array<MqlObject>, withMeta?: boolean, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
17
+ /**
18
+ * 将entityReader对象转换mql对象
19
+ * 若无设置delStatus值,默认加上条件delStatus|eq:0
20
+ * 若无设置排序,则默认加上排序updateAt|-
21
+ * 以上规则对platform_oprecord例外
22
+ * !! 注意:若entityReader.params中包含表达式,需在调用前先对表达式求值
23
+ * @param entityReader
24
+ */
25
+ convertEntityReaderToMql(entityReader: EntityReader): MqlObject;
26
+ /**
27
+ * 基于实体数据源查询
28
+ * 分页默认为1页15条记录
29
+ * 如果没有传删除状态,默认会带上删除訚为0,即delStatus='0'
30
+ * @param entityReader
31
+ * @param disabledClientQueryCache 禁止客户端本次从缓存中查询,且禁止客户端缓存本次查询结果,默认为否
32
+ * @param bizCode 业务代码,用于区分不同业务
33
+ * @returns Promise<{data:Record<string,any>[]}>
34
+ */
35
+ queryByEntityReader(entityReader: EntityReader, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
36
+ /**
37
+ * 查询单条记录,基于实体数据源查询
38
+ * 查询条多记录详见:queryByEntityReader
39
+ * @param entityReader
40
+ * @param disabledClientQueryCache
41
+ * @param bizCode
42
+ * @returns Promise<Record<string,any>>
43
+ */
44
+ queryOneByEntityReader(entityReader: EntityReader, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
45
+ /**
46
+ * 从queryByEntityReader的返回结果中获取第一条记录
47
+ * 如果没有记录时返回undefined
48
+ * @param res
49
+ */
50
+ getFirstRecordFromRes(res: any): any;
51
+ getRecordsFromRes(res: any): any;
52
+ /**
53
+ * 实体查询,内部依据参数构建mql对象进行查询
54
+ * 更复杂、高级的查询@see queryByMql
55
+ * @param entityName e.g. platform_dev_project
56
+ * @param fieldNames 查询的列字段 e.g. id,name
57
+ * @param params 查询要件键值对 e.g. {id:123456,name:'张三'} or {'@order':'name|+'}。不指定数据状态时,默认不查询已删除的数据
58
+ * @param withMeta
59
+ * @param disabledClientQueryCache
60
+ * @param bizCode
61
+ * @param order 排序,例如:'name|+'、'updateAt|-'
62
+ */
63
+ query(entityName: string, fieldNames: string, params: Record<string, any>, withMeta?: boolean, disabledClientQueryCache?: boolean, bizCode?: string, order?: string): Promise<any>;
64
+ queryById(entityName: string, id: string, fieldNames: string, withMeta?: boolean, disabledClientQueryCache?: boolean, bizCode?: string): Promise<any>;
65
+ /**
66
+ * 批量查询
67
+ * @param queryParamArray 例如:[{entityName:String,keyValues:{key1:value1,key2:value2,...},fieldNames:'id,name,...'},...]
68
+ * @param withMeta
69
+ */
70
+ queryBatch(queryParamArray: Array<object>, withMeta: boolean): Promise<any>;
71
+ }
@@ -0,0 +1,11 @@
1
+ export default class EntityResultMapping {
2
+ fieldMappings: FieldMapping[];
3
+ isEmpty(): boolean;
4
+ findFieldMapping(fieldName: string): FieldMapping | undefined;
5
+ }
6
+ export declare class FieldMapping {
7
+ name: string;
8
+ value?: string;
9
+ valueExpression?: string;
10
+ constructor(name?: string, value?: string, valueExpression?: string);
11
+ }
@@ -0,0 +1,46 @@
1
+ import { AxiosInstance, AxiosStatic, AxiosResponse } from 'axios';
2
+ import { EntitySaver } from './EntityDataSource.ts';
3
+ import { MqlObject } from './EntityTypes.ts';
4
+ export declare class EntitySaveService {
5
+ private service;
6
+ private url;
7
+ constructor(service: AxiosStatic | AxiosInstance, url: any);
8
+ /**
9
+ * 基于实体保存对象进行保存,支持父子实体对象保存
10
+ * @param entitySaver 实体保存对象
11
+ * @param biz
12
+ */
13
+ saveEntity(entitySaver: EntitySaver, biz?: string): Promise< AxiosResponse<any, any>>;
14
+ /**
15
+ * 该entitySavers指的是同一个实体名(即多个一样的父实体),若有多个不同的实体,请用方法saveMultiEntity
16
+ * 若有不同的实体
17
+ * @param entitySavers
18
+ * @param biz
19
+ */
20
+ saveBatchEntity(entitySavers: EntitySaver[], biz?: string): Promise< AxiosResponse<any, any>>;
21
+ /**
22
+ * @param entityName 实体名称
23
+ * @param keyValues Object类型
24
+ * @param biz
25
+ * @param successMsg
26
+ * @param errorMsg
27
+ * @returns {*}
28
+ */
29
+ save(entityName: string, keyValues: object, biz?: string, successMsg?: string, errorMsg?: string): Promise< AxiosResponse<any, any>>;
30
+ /**
31
+ * 基于mql对象进行查询
32
+ * @param mql or mqlArray
33
+ * @param biz 业务代码
34
+ * @returns {*}
35
+ */
36
+ saveByMql(biz: string, mql: MqlObject | Array<MqlObject>): Promise< AxiosResponse<any, any>>;
37
+ saveBatch(entityName: string, records: Array<Record<string, any>>, biz?: string): Promise< AxiosResponse<any, any>>;
38
+ update(url: string, entityName: string, keyValues: object, biz?: string, successMsg?: string, errorMsg?: string): Promise< AxiosResponse<any, any>>;
39
+ /**
40
+ * 将 EntitySaver 对象转换为 MQL 对象
41
+ * @param entitySaver 实体保存对象
42
+ * @param biz 业务编码
43
+ * @returns MQL 对象
44
+ */
45
+ convertEntitySaverToMql(entitySaver: EntitySaver, biz?: string): MqlObject;
46
+ }
@@ -0,0 +1,135 @@
1
+ import { EntitySaver, EntityDeleter } from './EntityDataSource.ts';
2
+ export type MqlObject = {
3
+ [key: string]: {
4
+ [key: string]: any;
5
+ };
6
+ };
7
+ export type ParsedMqlResult = {
8
+ key: string;
9
+ mqlObj: Record<string, any>;
10
+ };
11
+ export declare const entitySaverInstTemplate: EntitySaver;
12
+ /**
13
+ * 检查是否为有效的EntitySaver格式
14
+ * @param es
15
+ */
16
+ export declare const checkEntitySaver: (es: EntitySaver) => boolean;
17
+ export declare const checkEntityDeleter: (ed: EntityDeleter) => boolean;
18
+ /**
19
+ * 检查mql对象的格式
20
+ * @param mql
21
+ */
22
+ export declare const checkMqlObject: (mql: MqlObject | Array<MqlObject>) => boolean;
23
+ export interface EntityFullMetadata {
24
+ entityName: string;
25
+ entityTitle: string;
26
+ classType: string | null;
27
+ entityType: string;
28
+ catalog: string;
29
+ cacheType: string | null;
30
+ id: EntityColumnMeta;
31
+ tableMeta: EntityTableMeta;
32
+ tableAlias: string | null;
33
+ versionControl: boolean;
34
+ fieldNames: string[];
35
+ }
36
+ export interface EntityColumnMeta {
37
+ columnMeta: ColumnMeta;
38
+ fieldName: string;
39
+ fieldType: string;
40
+ equals: boolean;
41
+ title: string;
42
+ columnName: string;
43
+ }
44
+ export interface ColumnMeta {
45
+ id: string;
46
+ createAt: string | null;
47
+ creator: string | null;
48
+ creatorName: string | null;
49
+ buId: string | null;
50
+ deptId: string | null;
51
+ tenantCode: string | null;
52
+ updateAt: string | null;
53
+ updater: string | null;
54
+ updaterName: string | null;
55
+ deleteAt: string | null;
56
+ delStatus: number;
57
+ seqNo: string;
58
+ appId: string;
59
+ title: string;
60
+ abstractColumnExpressions: string | null;
61
+ fieldName: string;
62
+ tableId: string;
63
+ tableSchema: string | null;
64
+ tableName: string;
65
+ tableCatalog: string | null;
66
+ name: string;
67
+ comment: string;
68
+ ordinalPosition: number;
69
+ defaultValue: string | null;
70
+ type: string;
71
+ key: boolean;
72
+ nullable: boolean;
73
+ dataType: string;
74
+ extra: string | null;
75
+ autoIncrement: boolean;
76
+ uniqued: boolean;
77
+ charMaxLength: string;
78
+ numericPrecision: number;
79
+ numericScale: number;
80
+ numericSigned: boolean;
81
+ datetimePrecision: number;
82
+ enableStatus: number;
83
+ linked: number;
84
+ description: string | null;
85
+ refLocalCol: string | null;
86
+ refColName: string | null;
87
+ refTables: string | null;
88
+ selectType: string;
89
+ typeExtra: string | null;
90
+ extraValue: string | null;
91
+ extraMap: any | null;
92
+ autoAdd: boolean;
93
+ autoName: string | null;
94
+ synced: boolean;
95
+ encrypted: boolean;
96
+ marker: string | null;
97
+ drawed: boolean;
98
+ isRefColumn: boolean;
99
+ abstractColumn: boolean;
100
+ befColName: string | null;
101
+ }
102
+ export interface EntityTableMeta {
103
+ id: string;
104
+ createAt: string | null;
105
+ creator: string | null;
106
+ creatorName: string | null;
107
+ buId: string | null;
108
+ deptId: string | null;
109
+ tenantCode: string | null;
110
+ updateAt: string | null;
111
+ updater: string | null;
112
+ updaterName: string | null;
113
+ deleteAt: string | null;
114
+ delStatus: number;
115
+ seqNo: string;
116
+ appId: string;
117
+ title: string;
118
+ connectId: string;
119
+ dbType: string;
120
+ tableSchema: string;
121
+ tableName: string;
122
+ entityName: string;
123
+ tableType: string;
124
+ tableComment: string;
125
+ enableStatus: number;
126
+ linked: number;
127
+ description: string;
128
+ synced: boolean;
129
+ sourceType: string;
130
+ packBusData: number;
131
+ viewSql: string;
132
+ acrossApp: boolean;
133
+ acrossWorkflow: boolean;
134
+ cacheType: string | null;
135
+ }
@@ -0,0 +1,42 @@
1
+ import { AxiosInstance, AxiosStatic, AxiosResponse } from 'axios';
2
+ import { ApiResult } from '../types/global.ts';
3
+ import { EntityFullMetadata } from './EntityTypes.ts';
4
+ export declare class EntityUtilService {
5
+ private service;
6
+ private url;
7
+ constructor(service: AxiosStatic | AxiosInstance, url: any);
8
+ /**
9
+ * 实体对像的数据转换
10
+ * @param data 简单一层对象,如:{id:'123456',name:'张三'}
11
+ * @param dataMapping 可为可层对象,如两层对像:{query: {fullName: '$ctx.name'}}
12
+ * @return <Object> 若dataMapping为空,则直接返回data,{query: {fullName: '张三'}}
13
+ */
14
+ entityDataMappingHandler(data: Record<string, any>, dataMapping?: Record<string, any>): Record<string, any>;
15
+ /**
16
+ * 查询数据定义信息,即元数据信息
17
+ * @returns {*}
18
+ * @param entityName
19
+ */
20
+ queryMeta(entityName: string): Promise<AxiosResponse<any, any>>;
21
+ queryMetaFullDefined(entityName: string): Promise<AxiosResponse<ApiResult<EntityFullMetadata>>>;
22
+ queryEntityNames(): Promise<AxiosResponse<any, any>>;
23
+ queryEntityLiteMetas(appCode?: string): Promise<AxiosResponse<any, any>>;
24
+ /**
25
+ * 清除缓存
26
+ * @param keys 多个key值,用逗号分隔
27
+ */
28
+ removeCache(keys: string): Promise<AxiosResponse<any, any>> | undefined;
29
+ /**
30
+ * 单字检查是否唯一
31
+ * @param entityName
32
+ * @param filedName
33
+ * @param fieldValue
34
+ * @param id 可选,记录的id值
35
+ */
36
+ checkFieldUniqueness(entityName: string, filedName: string, fieldValue: any, id?: string): Promise<AxiosResponse<any, any>>;
37
+ /**
38
+ * 执行sqlKey
39
+ * 只支持基于POST方法
40
+ */
41
+ executeSqlKey(sqlKey: string, connectId: string, params: Record<string, any>): Promise<AxiosResponse<any, any>>;
42
+ }
@@ -0,0 +1,5 @@
1
+ declare const _default: {
2
+ interceptorCode: number;
3
+ oauth2LoginSuccess: number;
4
+ };
5
+ export default _default;