apaas-oapi-client 0.1.35 → 0.1.36
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/UserManual.md +6 -5
- package/dist/index.js +34 -5
- package/package.json +1 -1
- package/src/index.ts +36 -1
package/UserManual.md
CHANGED
|
@@ -368,12 +368,13 @@ console.log('✅ 文档导出成功!');
|
|
|
368
368
|
- 📊 每个对象的详细信息(中英文名称、创建时间、字段数量)
|
|
369
369
|
- 📝 字段列表(中文名称、API名称、类型、必填、唯一性)
|
|
370
370
|
- ⚙️ 字段配置详情:
|
|
371
|
-
-
|
|
372
|
-
-
|
|
373
|
-
-
|
|
374
|
-
-
|
|
371
|
+
- **选项字段**:展示所有选项值
|
|
372
|
+
- **公式字段**:显示公式表达式和返回类型
|
|
373
|
+
- **引用字段**:显示引用来源和字段
|
|
374
|
+
- **汇总字段(rollup)**:汇总类型(计数/求和/平均值等)、汇总对象、关联字段、过滤条件
|
|
375
|
+
- **lookup 字段**:显示关联对象
|
|
375
376
|
- 其他配置:最大长度、小数位、显示样式等
|
|
376
|
-
- 🎯
|
|
377
|
+
- 🎯 字段智能排序(系统字段、业务字段、特殊字段分类展示)
|
|
377
378
|
|
|
378
379
|
***
|
|
379
380
|
|
package/dist/index.js
CHANGED
|
@@ -316,7 +316,7 @@ class Client {
|
|
|
316
316
|
* ```
|
|
317
317
|
*/
|
|
318
318
|
export2markdown: async (options) => {
|
|
319
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
319
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x;
|
|
320
320
|
const objectNames = options === null || options === void 0 ? void 0 : options.object_names;
|
|
321
321
|
this.log(LoggerLevel.info, `[object.metadata.export2markdown] Starting markdown export${objectNames && objectNames.length > 0 ? ` for ${objectNames.length} objects` : ' for all objects'}`);
|
|
322
322
|
let items = [];
|
|
@@ -373,7 +373,7 @@ class Client {
|
|
|
373
373
|
if (obj.fields && obj.fields.length > 0) {
|
|
374
374
|
// 对字段进行分类和排序
|
|
375
375
|
const systemFieldOrder = ['_name', '_createdBy', '_createdAt', '_updatedBy', '_updatedAt'];
|
|
376
|
-
const specialFieldTypes = ['formula', 'referenceField'];
|
|
376
|
+
const specialFieldTypes = ['formula', 'referenceField', 'rollup'];
|
|
377
377
|
let idField = null;
|
|
378
378
|
const normalFields = [];
|
|
379
379
|
const specialFields = [];
|
|
@@ -451,6 +451,35 @@ class Client {
|
|
|
451
451
|
otherSettings.push(`返回类型: ${settings.returnType}`);
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
+
// rollup 类型:汇总字段
|
|
455
|
+
if (((_s = field.type) === null || _s === void 0 ? void 0 : _s.name) === 'rollup') {
|
|
456
|
+
otherSettings.push(`⚙️ 系统自动维护,不需要写/更新`);
|
|
457
|
+
// 汇总函数类型映射
|
|
458
|
+
const functionTypeMap = {
|
|
459
|
+
'count': '计数',
|
|
460
|
+
'sum': '求和',
|
|
461
|
+
'avg': '平均值',
|
|
462
|
+
'max': '最大值',
|
|
463
|
+
'min': '最小值',
|
|
464
|
+
'countDistinct': '去重计数'
|
|
465
|
+
};
|
|
466
|
+
const functionType = functionTypeMap[settings.functionType] || settings.functionType;
|
|
467
|
+
if (functionType) {
|
|
468
|
+
otherSettings.push(`📊 汇总类型: ${functionType}`);
|
|
469
|
+
}
|
|
470
|
+
if (settings.objectAPIName) {
|
|
471
|
+
otherSettings.push(`📦 汇总对象: \`${settings.objectAPIName}\``);
|
|
472
|
+
}
|
|
473
|
+
if (settings.lookupFieldAPIName) {
|
|
474
|
+
otherSettings.push(`🔗 关联字段: \`${settings.lookupFieldAPIName}\``);
|
|
475
|
+
}
|
|
476
|
+
if (settings.fieldAPIName) {
|
|
477
|
+
otherSettings.push(`📋 汇总字段: \`${settings.fieldAPIName}\``);
|
|
478
|
+
}
|
|
479
|
+
if (settings.rangeFilter && settings.rangeFilter.conditions && settings.rangeFilter.conditions.length > 0) {
|
|
480
|
+
otherSettings.push(`🔍 有过滤条件 (${settings.rangeFilter.conditions.length}个)`);
|
|
481
|
+
}
|
|
482
|
+
}
|
|
454
483
|
// 根据不同类型展示不同的设置
|
|
455
484
|
if (settings.maxLength) {
|
|
456
485
|
otherSettings.push(`最大长度:${settings.maxLength}`);
|
|
@@ -470,7 +499,7 @@ class Client {
|
|
|
470
499
|
if (settings.hierarchy) {
|
|
471
500
|
otherSettings.push('层级');
|
|
472
501
|
}
|
|
473
|
-
if (settings.displayStyle && ((
|
|
502
|
+
if (settings.displayStyle && ((_t = field.type) === null || _t === void 0 ? void 0 : _t.name) !== 'lookup') {
|
|
474
503
|
otherSettings.push(`显示样式:${settings.displayStyle}`);
|
|
475
504
|
}
|
|
476
505
|
if (settings.referenceObjectApiName) {
|
|
@@ -480,7 +509,7 @@ class Client {
|
|
|
480
509
|
otherSettings.push(`汇总:${settings.rollUpType}`);
|
|
481
510
|
}
|
|
482
511
|
// 如果是 option 类型,获取选项列表
|
|
483
|
-
if (((
|
|
512
|
+
if (((_u = field.type) === null || _u === void 0 ? void 0 : _u.name) === 'option') {
|
|
484
513
|
// 优先使用已有的 optionList,避免额外 API 请求
|
|
485
514
|
const options = settings.optionList;
|
|
486
515
|
if (options && options.length > 0) {
|
|
@@ -499,7 +528,7 @@ class Client {
|
|
|
499
528
|
object_name: obj.apiName,
|
|
500
529
|
field_name: field.apiName
|
|
501
530
|
});
|
|
502
|
-
const fetchedOptions = (
|
|
531
|
+
const fetchedOptions = (_x = (_w = (_v = optionsResult === null || optionsResult === void 0 ? void 0 : optionsResult.data) === null || _v === void 0 ? void 0 : _v.type) === null || _w === void 0 ? void 0 : _w.settings) === null || _x === void 0 ? void 0 : _x.optionList;
|
|
503
532
|
if (fetchedOptions && fetchedOptions.length > 0) {
|
|
504
533
|
const optionTexts = fetchedOptions.map((opt) => {
|
|
505
534
|
var _a, _b;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -593,7 +593,7 @@ class Client {
|
|
|
593
593
|
if (obj.fields && obj.fields.length > 0) {
|
|
594
594
|
// 对字段进行分类和排序
|
|
595
595
|
const systemFieldOrder = ['_name', '_createdBy', '_createdAt', '_updatedBy', '_updatedAt'];
|
|
596
|
-
const specialFieldTypes = ['formula', 'referenceField'];
|
|
596
|
+
const specialFieldTypes = ['formula', 'referenceField', 'rollup'];
|
|
597
597
|
|
|
598
598
|
let idField: any = null;
|
|
599
599
|
const normalFields: any[] = [];
|
|
@@ -678,6 +678,41 @@ class Client {
|
|
|
678
678
|
}
|
|
679
679
|
}
|
|
680
680
|
|
|
681
|
+
// rollup 类型:汇总字段
|
|
682
|
+
if (field.type?.name === 'rollup') {
|
|
683
|
+
otherSettings.push(`⚙️ 系统自动维护,不需要写/更新`);
|
|
684
|
+
|
|
685
|
+
// 汇总函数类型映射
|
|
686
|
+
const functionTypeMap: { [key: string]: string } = {
|
|
687
|
+
'count': '计数',
|
|
688
|
+
'sum': '求和',
|
|
689
|
+
'avg': '平均值',
|
|
690
|
+
'max': '最大值',
|
|
691
|
+
'min': '最小值',
|
|
692
|
+
'countDistinct': '去重计数'
|
|
693
|
+
};
|
|
694
|
+
const functionType = functionTypeMap[settings.functionType] || settings.functionType;
|
|
695
|
+
if (functionType) {
|
|
696
|
+
otherSettings.push(`📊 汇总类型: ${functionType}`);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
if (settings.objectAPIName) {
|
|
700
|
+
otherSettings.push(`📦 汇总对象: \`${settings.objectAPIName}\``);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
if (settings.lookupFieldAPIName) {
|
|
704
|
+
otherSettings.push(`🔗 关联字段: \`${settings.lookupFieldAPIName}\``);
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
if (settings.fieldAPIName) {
|
|
708
|
+
otherSettings.push(`📋 汇总字段: \`${settings.fieldAPIName}\``);
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
if (settings.rangeFilter && settings.rangeFilter.conditions && settings.rangeFilter.conditions.length > 0) {
|
|
712
|
+
otherSettings.push(`🔍 有过滤条件 (${settings.rangeFilter.conditions.length}个)`);
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
|
|
681
716
|
// 根据不同类型展示不同的设置
|
|
682
717
|
if (settings.maxLength) {
|
|
683
718
|
otherSettings.push(`最大长度:${settings.maxLength}`);
|