@share-crm/sharedev-cli 0.0.4-rc.27 → 0.0.4-rc.29
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/dist/sharedev.js +396 -32
- package/package.json +1 -1
package/dist/sharedev.js
CHANGED
|
@@ -9969,17 +9969,41 @@ function registerDataAuthNamespace(program, runtimeContext) {
|
|
|
9969
9969
|
/***/ },
|
|
9970
9970
|
|
|
9971
9971
|
/***/ 7170
|
|
9972
|
-
(__unused_webpack_module, exports) {
|
|
9972
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
9973
9973
|
|
|
9974
9974
|
|
|
9975
9975
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
9976
9976
|
exports.registerDataNamespace = registerDataNamespace;
|
|
9977
|
-
|
|
9977
|
+
const command_ts_1 = __webpack_require__(528);
|
|
9978
|
+
const index_ts_1 = __webpack_require__(3542);
|
|
9979
|
+
function registerDataNamespace(program, runtimeContext) {
|
|
9978
9980
|
const data = program.command('data').description('Data development workspace commands');
|
|
9979
9981
|
data.addHelpText('after', `
|
|
9980
9982
|
Examples:
|
|
9981
|
-
$ sharedev data
|
|
9983
|
+
$ sharedev data record query-by-fields --object AccountObj --fields "_id,name,owner,create_time"
|
|
9984
|
+
$ sharedev data record query-by-fields --object AccountObj --fields "_id,name" --limit 20 --offset 0
|
|
9985
|
+
$ sharedev data record query-by-fields --object AccountObj --fields "_id,name" \\
|
|
9986
|
+
--filter '[{"field_name":"owner","operator":"eq","field_values":["2051"]}]' \\
|
|
9987
|
+
--order '[{"fieldName":"create_time","isAsc":false}]'
|
|
9982
9988
|
`);
|
|
9989
|
+
// record 子命名空间
|
|
9990
|
+
const record = data.command('record').description('Data record operations');
|
|
9991
|
+
// record query-by-fields 子命令
|
|
9992
|
+
record
|
|
9993
|
+
.command('query-by-fields')
|
|
9994
|
+
.description('Query data records by fields (select_fields + search_template_query)')
|
|
9995
|
+
.requiredOption('--object <apiName>', 'Object api_name (e.g. AccountObj)')
|
|
9996
|
+
.requiredOption('--fields <csv>', 'Comma-separated select_fields (e.g. "_id,name,owner")')
|
|
9997
|
+
.option('--filter <json>', 'Filters as JSON array: [{"field_name","operator","field_values"}]')
|
|
9998
|
+
.option('--order <json>', 'Orders as JSON array: [{"fieldName","isAsc"}]')
|
|
9999
|
+
.option('--limit <n>', 'Page size (default 20)', '20')
|
|
10000
|
+
.option('--offset <n>', 'Page offset (default 0)', '0')
|
|
10001
|
+
.option('--need-count', 'Return total count (default true)')
|
|
10002
|
+
.option('--no-need-count', 'Do not return total count')
|
|
10003
|
+
.action((0, command_ts_1.createCommandAction)('data', 'record.query-by-fields', runtimeContext, async ({ options, context }) => {
|
|
10004
|
+
void context;
|
|
10005
|
+
await (0, index_ts_1.dataRecordQueryByFieldsCommand)(options);
|
|
10006
|
+
}));
|
|
9983
10007
|
}
|
|
9984
10008
|
|
|
9985
10009
|
|
|
@@ -13578,6 +13602,9 @@ const SHARE_CLI_COMMAND_PATH_MAP = {
|
|
|
13578
13602
|
webCustomPageUpdate: ['interface-dev', 'web-custom-page', 'update'],
|
|
13579
13603
|
mobileCustomPageUpdate: ['interface-dev', 'mobile-custom-page', 'update'],
|
|
13580
13604
|
},
|
|
13605
|
+
data: {
|
|
13606
|
+
recordQueryByFields: ['data', 'record', 'query-by-fields'],
|
|
13607
|
+
},
|
|
13581
13608
|
};
|
|
13582
13609
|
function getShareCliCommandPath(namespace, key) {
|
|
13583
13610
|
const raw = SHARE_CLI_COMMAND_PATH_MAP[namespace][key];
|
|
@@ -13592,9 +13619,12 @@ function getShareCliCommandPath(namespace, key) {
|
|
|
13592
13619
|
|
|
13593
13620
|
|
|
13594
13621
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
13622
|
+
exports.SHARE_CLI_BUSINESS_NAME = void 0;
|
|
13595
13623
|
exports.executeShareCliCommand = executeShareCliCommand;
|
|
13596
13624
|
const request_ts_1 = __webpack_require__(2088);
|
|
13597
13625
|
const trace_ts_1 = __webpack_require__(3632);
|
|
13626
|
+
/** 操作中心 shareCli/execute 的业务方标识 */
|
|
13627
|
+
exports.SHARE_CLI_BUSINESS_NAME = 'sharedev-cli';
|
|
13598
13628
|
async function executeShareCliCommand(commandPath, data, others) {
|
|
13599
13629
|
(0, trace_ts_1.traceExecute)(commandPath.join(' '));
|
|
13600
13630
|
const payload = {
|
|
@@ -13604,7 +13634,11 @@ async function executeShareCliCommand(commandPath, data, others) {
|
|
|
13604
13634
|
};
|
|
13605
13635
|
return request_ts_1.requestService.FHH({
|
|
13606
13636
|
url: '/EM1HActionCentre/shareCli/execute',
|
|
13607
|
-
data: payload
|
|
13637
|
+
data: payload,
|
|
13638
|
+
// 操作中心侧按业务方来源做识别/统计,仅 shareCli/execute 需要携带
|
|
13639
|
+
headers: {
|
|
13640
|
+
'x-fs-business-name': exports.SHARE_CLI_BUSINESS_NAME
|
|
13641
|
+
}
|
|
13608
13642
|
});
|
|
13609
13643
|
}
|
|
13610
13644
|
|
|
@@ -13765,6 +13799,16 @@ class RequestService {
|
|
|
13765
13799
|
}
|
|
13766
13800
|
return this.axiosInstance;
|
|
13767
13801
|
}
|
|
13802
|
+
/**
|
|
13803
|
+
* 干净的 axios 实例:无 baseURL、无 Authorization、无拦截器。
|
|
13804
|
+
* fetch 方法使用该实例,请求除 trace 与 debug 外不经过任何处理。
|
|
13805
|
+
*/
|
|
13806
|
+
get cleanInstance() {
|
|
13807
|
+
if (!this.cleanAxiosInstance) {
|
|
13808
|
+
this.cleanAxiosInstance = axios_1.default.create({ timeout: 30000 });
|
|
13809
|
+
}
|
|
13810
|
+
return this.cleanAxiosInstance;
|
|
13811
|
+
}
|
|
13768
13812
|
async request(config, requestSettings) {
|
|
13769
13813
|
const traceableConfig = config;
|
|
13770
13814
|
const rawUrl = traceableConfig.url ?? '';
|
|
@@ -13793,6 +13837,76 @@ class RequestService {
|
|
|
13793
13837
|
}
|
|
13794
13838
|
return result.Value ?? result;
|
|
13795
13839
|
}
|
|
13840
|
+
/**
|
|
13841
|
+
* 干净的 HTTP 请求:除 trace 与 debug 外不经过任何处理。
|
|
13842
|
+
*
|
|
13843
|
+
* 与 request/FHH 的区别:
|
|
13844
|
+
* - 不使用配置的 baseURL 与 Authorization(适用于公网/外部 URL)
|
|
13845
|
+
* - 不改写 URL(不做 EM\dH -> EMDH 替换)
|
|
13846
|
+
* - 不注入 traceId 查询参数
|
|
13847
|
+
* - 不解包 FHH 响应信封、不提取 UserInfo
|
|
13848
|
+
* - 仅保留 traceService 埋点与 writeDebug 调试记录
|
|
13849
|
+
*
|
|
13850
|
+
* @param url 完整请求 URL
|
|
13851
|
+
* @returns 原始响应体(response.data)
|
|
13852
|
+
*/
|
|
13853
|
+
async fetch(url, config, requestSettings) {
|
|
13854
|
+
const noDebug = !!requestSettings?.noDebug;
|
|
13855
|
+
const noTrace = !!requestSettings?.noTrace;
|
|
13856
|
+
const method = (config?.method ?? 'GET').toUpperCase();
|
|
13857
|
+
const fullUrl = url;
|
|
13858
|
+
const command = resolveDebugCommand({ ...config, url, method });
|
|
13859
|
+
const cliCommandRaw = resolveCliCommandRaw();
|
|
13860
|
+
const requestSnapshot = {
|
|
13861
|
+
params: config?.params,
|
|
13862
|
+
data: config?.data,
|
|
13863
|
+
headers: config?.headers
|
|
13864
|
+
};
|
|
13865
|
+
if (!noTrace) {
|
|
13866
|
+
(0, trace_ts_1.traceService)(fullUrl);
|
|
13867
|
+
}
|
|
13868
|
+
const writeDebugLog = !noDebug && (0, debug_ts_2.isRuntimeDebugEnabled)();
|
|
13869
|
+
try {
|
|
13870
|
+
const response = await this.cleanInstance.request({
|
|
13871
|
+
...config,
|
|
13872
|
+
url,
|
|
13873
|
+
method: config?.method ?? 'GET'
|
|
13874
|
+
});
|
|
13875
|
+
if (writeDebugLog) {
|
|
13876
|
+
void (0, debug_ts_1.writeDebug)({
|
|
13877
|
+
command,
|
|
13878
|
+
cliCommandRaw,
|
|
13879
|
+
version: await readCliVersion(),
|
|
13880
|
+
url: fullUrl,
|
|
13881
|
+
method,
|
|
13882
|
+
request: requestSnapshot,
|
|
13883
|
+
response: response.data,
|
|
13884
|
+
status: response.status,
|
|
13885
|
+
success: true,
|
|
13886
|
+
timestamp: new Date().toISOString()
|
|
13887
|
+
});
|
|
13888
|
+
}
|
|
13889
|
+
return response.data;
|
|
13890
|
+
}
|
|
13891
|
+
catch (error) {
|
|
13892
|
+
const axiosError = error;
|
|
13893
|
+
if (writeDebugLog) {
|
|
13894
|
+
void (0, debug_ts_1.writeDebug)({
|
|
13895
|
+
command,
|
|
13896
|
+
cliCommandRaw,
|
|
13897
|
+
version: await readCliVersion(),
|
|
13898
|
+
url: fullUrl,
|
|
13899
|
+
method,
|
|
13900
|
+
request: requestSnapshot,
|
|
13901
|
+
response: axiosError.response?.data ?? { message: axiosError.message },
|
|
13902
|
+
status: axiosError.response?.status,
|
|
13903
|
+
success: false,
|
|
13904
|
+
timestamp: new Date().toISOString()
|
|
13905
|
+
});
|
|
13906
|
+
}
|
|
13907
|
+
throw error;
|
|
13908
|
+
}
|
|
13909
|
+
}
|
|
13796
13910
|
}
|
|
13797
13911
|
exports.requestService = new RequestService();
|
|
13798
13912
|
|
|
@@ -18542,6 +18656,179 @@ function narrowDataAuthResponse(value) {
|
|
|
18542
18656
|
}
|
|
18543
18657
|
|
|
18544
18658
|
|
|
18659
|
+
/***/ },
|
|
18660
|
+
|
|
18661
|
+
/***/ 3542
|
|
18662
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
18663
|
+
|
|
18664
|
+
|
|
18665
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18666
|
+
exports.dataRecordQueryByFieldsCommand = void 0;
|
|
18667
|
+
var record_ts_1 = __webpack_require__(6409);
|
|
18668
|
+
Object.defineProperty(exports, "dataRecordQueryByFieldsCommand", ({ enumerable: true, get: function () { return record_ts_1.dataRecordQueryByFieldsCommand; } }));
|
|
18669
|
+
|
|
18670
|
+
|
|
18671
|
+
/***/ },
|
|
18672
|
+
|
|
18673
|
+
/***/ 6409
|
|
18674
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
18675
|
+
|
|
18676
|
+
|
|
18677
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18678
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18679
|
+
};
|
|
18680
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18681
|
+
exports.dataRecordQueryByFieldsCommand = dataRecordQueryByFieldsCommand;
|
|
18682
|
+
const logger_ts_1 = __webpack_require__(3333);
|
|
18683
|
+
const normalize_ts_1 = __importDefault(__webpack_require__(9268));
|
|
18684
|
+
const record_query_by_fields_ts_1 = __webpack_require__(8537);
|
|
18685
|
+
/**
|
|
18686
|
+
* 解析逗号分隔的字段列表
|
|
18687
|
+
*/
|
|
18688
|
+
function parseFields(value) {
|
|
18689
|
+
const raw = normalize_ts_1.default.normalizeString(value);
|
|
18690
|
+
if (!raw)
|
|
18691
|
+
return [];
|
|
18692
|
+
return raw
|
|
18693
|
+
.split(',')
|
|
18694
|
+
.map((item) => item.trim())
|
|
18695
|
+
.filter((item) => item.length > 0);
|
|
18696
|
+
}
|
|
18697
|
+
/**
|
|
18698
|
+
* 解析 JSON 数组
|
|
18699
|
+
*/
|
|
18700
|
+
function parseJsonArray(value, field) {
|
|
18701
|
+
const raw = normalize_ts_1.default.normalizeString(value);
|
|
18702
|
+
if (!raw)
|
|
18703
|
+
return undefined;
|
|
18704
|
+
try {
|
|
18705
|
+
const parsed = JSON.parse(raw);
|
|
18706
|
+
if (!Array.isArray(parsed)) {
|
|
18707
|
+
throw new Error(`--${field} must be a JSON array.`);
|
|
18708
|
+
}
|
|
18709
|
+
return parsed;
|
|
18710
|
+
}
|
|
18711
|
+
catch (error) {
|
|
18712
|
+
throw new Error(`--${field} must be a valid JSON array: ${error instanceof Error ? error.message : String(error)}`);
|
|
18713
|
+
}
|
|
18714
|
+
}
|
|
18715
|
+
/**
|
|
18716
|
+
* data record query-by-fields 命令
|
|
18717
|
+
* 按字段查询数据记录
|
|
18718
|
+
*/
|
|
18719
|
+
async function dataRecordQueryByFieldsCommand(options) {
|
|
18720
|
+
// 校验必填参数
|
|
18721
|
+
const objectApiName = normalize_ts_1.default.normalizeString(options.object);
|
|
18722
|
+
if (!objectApiName) {
|
|
18723
|
+
throw new Error('--object is required (object_api_name).');
|
|
18724
|
+
}
|
|
18725
|
+
const selectFields = parseFields(options.fields);
|
|
18726
|
+
if (selectFields.length === 0) {
|
|
18727
|
+
throw new Error('--fields is required (comma-separated select_fields).');
|
|
18728
|
+
}
|
|
18729
|
+
const filters = parseJsonArray(options.filter, 'filter');
|
|
18730
|
+
const orders = parseJsonArray(options.order, 'order');
|
|
18731
|
+
const limit = options.limit !== undefined ? Number(options.limit) : 20;
|
|
18732
|
+
const offset = options.offset !== undefined ? Number(options.offset) : 0;
|
|
18733
|
+
if (!Number.isFinite(limit) || limit < 0) {
|
|
18734
|
+
throw new Error('--limit must be a non-negative number.');
|
|
18735
|
+
}
|
|
18736
|
+
if (!Number.isFinite(offset) || offset < 0) {
|
|
18737
|
+
throw new Error('--offset must be a non-negative number.');
|
|
18738
|
+
}
|
|
18739
|
+
const needCount = options.needCount !== undefined ? options.needCount === true : true;
|
|
18740
|
+
logger_ts_1.loggerService.startLoading('Querying data records...');
|
|
18741
|
+
const result = await (0, record_query_by_fields_ts_1.recordQueryByFieldsService)({
|
|
18742
|
+
objectApiName,
|
|
18743
|
+
needCount,
|
|
18744
|
+
selectFields,
|
|
18745
|
+
searchTemplateQuery: {
|
|
18746
|
+
filters,
|
|
18747
|
+
orders,
|
|
18748
|
+
limit,
|
|
18749
|
+
offset,
|
|
18750
|
+
},
|
|
18751
|
+
});
|
|
18752
|
+
logger_ts_1.loggerService.stopLoading();
|
|
18753
|
+
if (!result.success) {
|
|
18754
|
+
throw new Error(result.errorMessage);
|
|
18755
|
+
}
|
|
18756
|
+
logger_ts_1.loggerService.printJson(result.data);
|
|
18757
|
+
logger_ts_1.loggerService.success(`Data record query completed: object=${objectApiName}, limit=${limit}, offset=${offset}`);
|
|
18758
|
+
}
|
|
18759
|
+
|
|
18760
|
+
|
|
18761
|
+
/***/ },
|
|
18762
|
+
|
|
18763
|
+
/***/ 8537
|
|
18764
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
18765
|
+
|
|
18766
|
+
|
|
18767
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18768
|
+
exports.recordQueryByFieldsService = recordQueryByFieldsService;
|
|
18769
|
+
const request_execute_command_paths_ts_1 = __webpack_require__(2351);
|
|
18770
|
+
const request_ts_1 = __webpack_require__(6393);
|
|
18771
|
+
/**
|
|
18772
|
+
* 查询数据记录(按字段查询)
|
|
18773
|
+
*
|
|
18774
|
+
* 调用 share-cli execute 接口,commandPath = ['data', 'record', 'query-by-fields']
|
|
18775
|
+
* options.raw = true,aiContext.scene = 'cli'
|
|
18776
|
+
*/
|
|
18777
|
+
async function recordQueryByFieldsService(options) {
|
|
18778
|
+
const commandPath = (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('data', 'recordQueryByFields');
|
|
18779
|
+
const data = {
|
|
18780
|
+
object_api_name: options.objectApiName,
|
|
18781
|
+
need_count: options.needCount,
|
|
18782
|
+
select_fields: options.selectFields,
|
|
18783
|
+
search_template_query: options.searchTemplateQuery,
|
|
18784
|
+
};
|
|
18785
|
+
const others = {
|
|
18786
|
+
options: { raw: true },
|
|
18787
|
+
aiContext: { scene: 'cli' },
|
|
18788
|
+
};
|
|
18789
|
+
const response = await (0, request_ts_1.requestDataExecute)(commandPath, data, others);
|
|
18790
|
+
const result = await (0, request_ts_1.extractDataServiceResult)(response, (res) => {
|
|
18791
|
+
return res.data;
|
|
18792
|
+
});
|
|
18793
|
+
return result;
|
|
18794
|
+
}
|
|
18795
|
+
|
|
18796
|
+
|
|
18797
|
+
/***/ },
|
|
18798
|
+
|
|
18799
|
+
/***/ 6393
|
|
18800
|
+
(__unused_webpack_module, exports, __webpack_require__) {
|
|
18801
|
+
|
|
18802
|
+
|
|
18803
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
18804
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18805
|
+
};
|
|
18806
|
+
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
18807
|
+
exports.requestDataExecute = requestDataExecute;
|
|
18808
|
+
exports.extractDataServiceResult = extractDataServiceResult;
|
|
18809
|
+
const request_execute_ts_1 = __webpack_require__(8554);
|
|
18810
|
+
const normalize_ts_1 = __importDefault(__webpack_require__(9268));
|
|
18811
|
+
async function requestDataExecute(commandPath, data, others) {
|
|
18812
|
+
const response = await (0, request_execute_ts_1.executeShareCliCommand)(commandPath, data, others);
|
|
18813
|
+
if (!response || typeof response !== 'object') {
|
|
18814
|
+
throw new Error('Response is not an object or is empty.');
|
|
18815
|
+
}
|
|
18816
|
+
return response;
|
|
18817
|
+
}
|
|
18818
|
+
async function extractDataServiceResult(response, dataGetter) {
|
|
18819
|
+
if (!response || typeof response !== 'object') {
|
|
18820
|
+
throw new Error('Response is not an object or is empty.');
|
|
18821
|
+
}
|
|
18822
|
+
if (response.success === true && response.code === 'OK') {
|
|
18823
|
+
const data = await dataGetter(response);
|
|
18824
|
+
return { success: true, errorMessage: '', data };
|
|
18825
|
+
}
|
|
18826
|
+
else {
|
|
18827
|
+
return { success: false, errorMessage: normalize_ts_1.default.normalizeText(response.message) || 'Unknown error.', data: undefined };
|
|
18828
|
+
}
|
|
18829
|
+
}
|
|
18830
|
+
|
|
18831
|
+
|
|
18545
18832
|
/***/ },
|
|
18546
18833
|
|
|
18547
18834
|
/***/ 707
|
|
@@ -23672,6 +23959,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23672
23959
|
};
|
|
23673
23960
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
23674
23961
|
exports.convertRulePushService = void 0;
|
|
23962
|
+
exports.toConvertRuleExecutePayload = toConvertRuleExecutePayload;
|
|
23675
23963
|
const normalize_ts_1 = __importDefault(__webpack_require__(9268));
|
|
23676
23964
|
const request_execute_command_paths_ts_1 = __webpack_require__(2351);
|
|
23677
23965
|
const index_ts_1 = __webpack_require__(9985);
|
|
@@ -23681,6 +23969,23 @@ const request_ts_1 = __webpack_require__(3176);
|
|
|
23681
23969
|
const logger_ts_1 = __webpack_require__(3333);
|
|
23682
23970
|
const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
|
|
23683
23971
|
const isRecord = normalize_ts_1.default.isRecord;
|
|
23972
|
+
/**
|
|
23973
|
+
* 组 CreateConvertRule / UpdateConvertRule 远程 payload。
|
|
23974
|
+
* 请求体必须用 snake_case `rule_list`,对齐:
|
|
23975
|
+
* - Java ConvertRule.Arg @JsonProperty("rule_list")
|
|
23976
|
+
* - 前端 fe-paas/vui convertrule create/update
|
|
23977
|
+
* - object-mapping createRule/updateRule 的请求字段
|
|
23978
|
+
* 本地/pull 内容里可能出现 camelCase `ruleList`(响应侧),push 时归一成 `rule_list`。
|
|
23979
|
+
*/
|
|
23980
|
+
function toConvertRuleExecutePayload(content) {
|
|
23981
|
+
const ruleListCandidate = content.rule_list ?? content.ruleList;
|
|
23982
|
+
if (!Array.isArray(ruleListCandidate)) {
|
|
23983
|
+
throw new Error('Invalid convert-rule content: rule_list is required and must be an array.');
|
|
23984
|
+
}
|
|
23985
|
+
return {
|
|
23986
|
+
rule_list: ruleListCandidate,
|
|
23987
|
+
};
|
|
23988
|
+
}
|
|
23684
23989
|
const convertRulePushService = async (ruleApiNames, skipOverwriteConfirm = false) => {
|
|
23685
23990
|
const errorMessages = [];
|
|
23686
23991
|
const targetRuleApiNames = (ruleApiNames ?? '')
|
|
@@ -23746,19 +24051,14 @@ const convertRulePushService = async (ruleApiNames, skipOverwriteConfirm = false
|
|
|
23746
24051
|
ruleMeta = await xmlMetadataManager.readXml('ConvertRule', ruleApiName);
|
|
23747
24052
|
}
|
|
23748
24053
|
const isCreate = ruleMeta.status === 'new';
|
|
23749
|
-
const
|
|
23750
|
-
|
|
23751
|
-
|
|
23752
|
-
|
|
23753
|
-
if (!updatedContent.rule_list) {
|
|
23754
|
-
updatedContent.rule_list = updatedContent.ruleList;
|
|
23755
|
-
}
|
|
23756
|
-
delete updatedContent.ruleList;
|
|
23757
|
-
}
|
|
24054
|
+
const sourceContent = ruleMeta.content && isRecord(ruleMeta.content)
|
|
24055
|
+
? ruleMeta.content
|
|
24056
|
+
: content;
|
|
24057
|
+
const executePayload = toConvertRuleExecutePayload(sourceContent);
|
|
23758
24058
|
logger_ts_1.loggerService.startLoading('convert-rule push request: ' + ruleApiName + ' (' + (isCreate ? 'create' : 'update') + ')');
|
|
23759
24059
|
const raw = await (0, request_ts_1.requestObjectDevExecute)(isCreate
|
|
23760
24060
|
? (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('convertRule', 'create-rule')
|
|
23761
|
-
: (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('convertRule', 'update-rule'),
|
|
24061
|
+
: (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('convertRule', 'update-rule'), executePayload);
|
|
23762
24062
|
const response = raw;
|
|
23763
24063
|
if (response.success !== true || normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(response.code)) !== 'OK') {
|
|
23764
24064
|
logger_ts_1.loggerService.stopLoading();
|
|
@@ -27815,7 +28115,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27815
28115
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27816
28116
|
};
|
|
27817
28117
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
27818
|
-
exports.scenePushService = void 0;
|
|
28118
|
+
exports.scenePushService = exports.buildSceneExecutePayload = void 0;
|
|
27819
28119
|
const normalize_ts_1 = __importDefault(__webpack_require__(9268));
|
|
27820
28120
|
const request_execute_command_paths_ts_1 = __webpack_require__(2351);
|
|
27821
28121
|
const index_ts_1 = __webpack_require__(9985);
|
|
@@ -27826,6 +28126,65 @@ const scene_pull_ts_1 = __webpack_require__(272);
|
|
|
27826
28126
|
const logger_ts_1 = __webpack_require__(3333);
|
|
27827
28127
|
const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
|
|
27828
28128
|
const isRecord = normalize_ts_1.default.isRecord;
|
|
28129
|
+
const asString = normalize_ts_1.default.asString;
|
|
28130
|
+
const normalizeString = normalize_ts_1.default.normalizeString;
|
|
28131
|
+
const SCENE_RUNTIME_FIELDS = [
|
|
28132
|
+
'id',
|
|
28133
|
+
'tenant_id',
|
|
28134
|
+
'created_by',
|
|
28135
|
+
'create_time',
|
|
28136
|
+
'last_modified_by',
|
|
28137
|
+
'last_modified_time'
|
|
28138
|
+
];
|
|
28139
|
+
/**
|
|
28140
|
+
* 将本地 scene-meta content(扁平场景本体)包装为 create/update 远程契约:
|
|
28141
|
+
* { describe_api_name, extend_attribute, scene, i18nInfoList? }
|
|
28142
|
+
* 与 action-centre / share-cli-curl 的 required 对齐。
|
|
28143
|
+
*/
|
|
28144
|
+
const buildSceneExecutePayload = (objectApiName, content, options = {}) => {
|
|
28145
|
+
const isCreate = options.isCreate !== false;
|
|
28146
|
+
const scene = { ...content };
|
|
28147
|
+
// i18n 属于远程 data 顶层可选字段,不落在 scene 本体里
|
|
28148
|
+
const i18nInfoList = Array.isArray(scene.i18nInfoList) ? scene.i18nInfoList : undefined;
|
|
28149
|
+
delete scene.i18nInfoList;
|
|
28150
|
+
if (isCreate) {
|
|
28151
|
+
// create:剥离运行时字段,由服务端生成
|
|
28152
|
+
for (const field of SCENE_RUNTIME_FIELDS) {
|
|
28153
|
+
delete scene[field];
|
|
28154
|
+
}
|
|
28155
|
+
}
|
|
28156
|
+
else {
|
|
28157
|
+
// update:远端强依赖 id/tenant_id 等运行时字段;本地草稿常缺失,从 list 结果回填
|
|
28158
|
+
for (const field of SCENE_RUNTIME_FIELDS) {
|
|
28159
|
+
const current = scene[field];
|
|
28160
|
+
const missing = current === undefined || current === null || current === '';
|
|
28161
|
+
if (!missing) {
|
|
28162
|
+
continue;
|
|
28163
|
+
}
|
|
28164
|
+
const remoteValue = options.remoteContent?.[field];
|
|
28165
|
+
if (remoteValue !== undefined && remoteValue !== null && remoteValue !== '') {
|
|
28166
|
+
scene[field] = remoteValue;
|
|
28167
|
+
}
|
|
28168
|
+
}
|
|
28169
|
+
}
|
|
28170
|
+
if (!normalizeString(asString(scene.object_describe_api_name))) {
|
|
28171
|
+
scene.object_describe_api_name = objectApiName;
|
|
28172
|
+
}
|
|
28173
|
+
if (!normalizeString(asString(scene.type))) {
|
|
28174
|
+
scene.type = 'tenant';
|
|
28175
|
+
}
|
|
28176
|
+
const payload = {
|
|
28177
|
+
describe_api_name: objectApiName,
|
|
28178
|
+
// curl 示例显式传空串;action-centre 也可 constant 注入,显式更稳
|
|
28179
|
+
extend_attribute: '',
|
|
28180
|
+
scene
|
|
28181
|
+
};
|
|
28182
|
+
if (i18nInfoList) {
|
|
28183
|
+
payload.i18nInfoList = i18nInfoList;
|
|
28184
|
+
}
|
|
28185
|
+
return payload;
|
|
28186
|
+
};
|
|
28187
|
+
exports.buildSceneExecutePayload = buildSceneExecutePayload;
|
|
27829
28188
|
const scenePushService = async (objectApiName, sceneApiNames) => {
|
|
27830
28189
|
const errorMessages = [];
|
|
27831
28190
|
// 1) 校验 object 参数并解析待推送 scene 列表
|
|
@@ -27908,9 +28267,13 @@ const scenePushService = async (objectApiName, sceneApiNames) => {
|
|
|
27908
28267
|
}
|
|
27909
28268
|
logger_ts_1.loggerService.startLoading(`scene push request: ${checkedObjectApiName}.${sceneApiName}`);
|
|
27910
28269
|
try {
|
|
28270
|
+
const remoteScene = sceneListResult.scenes.find((item) => item.apiName === sceneApiName);
|
|
27911
28271
|
const response = await (0, request_ts_1.requestObjectDevExecute)(isCreate
|
|
27912
28272
|
? (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('objectDev', 'createScene')
|
|
27913
|
-
: (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('objectDev', 'updateScene'), sceneMeta.content
|
|
28273
|
+
: (0, request_execute_command_paths_ts_1.getShareCliCommandPath)('objectDev', 'updateScene'), (0, exports.buildSceneExecutePayload)(checkedObjectApiName, sceneMeta.content, {
|
|
28274
|
+
isCreate,
|
|
28275
|
+
remoteContent: remoteScene?.content
|
|
28276
|
+
}));
|
|
27914
28277
|
if (response.success !== true || normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(response.code)) !== 'OK') {
|
|
27915
28278
|
throw new Error(normalize_ts_1.default.normalizeText(response.message) || 'Unknown error');
|
|
27916
28279
|
}
|
|
@@ -30379,14 +30742,11 @@ async function runSpecInit(cwd, options = {}) {
|
|
|
30379
30742
|
const showLoading = options.showLoading !== false;
|
|
30380
30743
|
// 1. 读取本地 specVersion
|
|
30381
30744
|
const localVersion = await (0, index_ts_1.readLocalSpecVersion)(cwd);
|
|
30382
|
-
// 2.
|
|
30745
|
+
// 2. 拉取远端 manifest(init 需要 manifest 本体,不走 specCheckService——
|
|
30746
|
+
// 后者在 currentVersion 为空时会短路返回且不拉取 manifest)
|
|
30383
30747
|
let manifest;
|
|
30384
30748
|
try {
|
|
30385
|
-
|
|
30386
|
-
if (!checkResult.manifest) {
|
|
30387
|
-
throw new Error(checkResult.errorMessage || 'Failed to fetch spec manifest.');
|
|
30388
|
-
}
|
|
30389
|
-
manifest = checkResult.manifest;
|
|
30749
|
+
manifest = await (0, index_ts_1.requestSpecManifest)();
|
|
30390
30750
|
}
|
|
30391
30751
|
catch (error) {
|
|
30392
30752
|
if (showLoading) {
|
|
@@ -30395,10 +30755,10 @@ async function runSpecInit(cwd, options = {}) {
|
|
|
30395
30755
|
throw error;
|
|
30396
30756
|
}
|
|
30397
30757
|
// 3. 已是最新版本则跳过
|
|
30398
|
-
if (!options.skipVersionCheck && localVersion && localVersion === manifest.version) {
|
|
30399
|
-
|
|
30400
|
-
|
|
30401
|
-
}
|
|
30758
|
+
// if (!options.skipVersionCheck && localVersion && localVersion === manifest.version) {
|
|
30759
|
+
// loggerService.info(`Spec template is already up-to-date (version: ${manifest.version}).`);
|
|
30760
|
+
// return;
|
|
30761
|
+
// }
|
|
30402
30762
|
// 4. 解析 agent 平台
|
|
30403
30763
|
const selectedAgents = await resolveAgentOptions(options.agentName);
|
|
30404
30764
|
const targets = selectedAgents.map((item) => ({
|
|
@@ -30467,18 +30827,22 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
30467
30827
|
exports.requestSpecArchive = exports.requestSpecManifest = void 0;
|
|
30468
30828
|
const download_ts_1 = __webpack_require__(1889);
|
|
30469
30829
|
const logger_ts_1 = __webpack_require__(3333);
|
|
30830
|
+
const request_ts_1 = __webpack_require__(2088);
|
|
30470
30831
|
const spec_config_ts_1 = __webpack_require__(8102);
|
|
30471
30832
|
/**
|
|
30472
30833
|
* 拉取 spec 模板远端 manifest
|
|
30473
30834
|
* @param signal 可选 AbortSignal,用于启动检查时加超时控制
|
|
30474
30835
|
*/
|
|
30475
30836
|
const requestSpecManifest = async (signal) => {
|
|
30476
|
-
|
|
30477
|
-
|
|
30478
|
-
|
|
30837
|
+
let data;
|
|
30838
|
+
try {
|
|
30839
|
+
data = await request_ts_1.requestService.fetch(spec_config_ts_1.SPEC_MANIFEST_URL, { signal });
|
|
30840
|
+
}
|
|
30841
|
+
catch (error) {
|
|
30842
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
30843
|
+
throw new Error(`Failed to fetch spec manifest: ${message}`);
|
|
30479
30844
|
}
|
|
30480
|
-
|
|
30481
|
-
if (!data.version || !data.archive) {
|
|
30845
|
+
if (!data || !data.version || !data.archive) {
|
|
30482
30846
|
throw new Error('Invalid spec manifest: missing version or archive field.');
|
|
30483
30847
|
}
|
|
30484
30848
|
return data;
|
|
@@ -46460,7 +46824,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
|
|
|
46460
46824
|
/***/ 8330
|
|
46461
46825
|
(module) {
|
|
46462
46826
|
|
|
46463
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@share-crm/sharedev-cli","version":"0.0.4-rc.
|
|
46827
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@share-crm/sharedev-cli","version":"0.0.4-rc.29","private":false,"description":"sharedev command line tool","type":"module","main":"dist/sharedev.js","bin":{"sharedev":"./bin/cli.mjs"},"author":{"name":"sharecrm-npm"},"files":["dist","bin","README.md"],"scripts":{"build":"tsc --noEmit && webpack --config build/webpack/webpack.prod.cjs","build:debug":"tsc --noEmit && webpack --config build/webpack/webpack.debug.cjs","build:bin":"bun build --compile --target=bun-darwin-x64 src/cli.ts --outfile scripts/sharedev-darwin-x64 && bun build --compile --target=bun-darwin-arm64 src/cli.ts --outfile scripts/sharedev-darwin-arm64 && bun build --compile --target=bun-windows-x64 src/cli.ts --outfile scripts/sharedev-windows-x64.exe","build:all":"npm run build && npm run build:bin","dev":"tsc --noEmit --watch & webpack --config build/webpack/webpack.dev.cjs --watch","dev2":"node src/cli.ts","typecheck":"tsc --noEmit","prettier":"prettier --write ./src/**/*.ts","test":"vitest run","test:watch":"vitest","test:coverage":"vitest run --coverage"},"dependencies":{"@clack/prompts":"^1.1.0","@mariozechner/pi-coding-agent":"^0.62.0","axios":"~1.13.0","chalk":"^5.6.2","commander":"^14.0.1","extract-zip":"^2.0.1","fast-xml-parser":"^5.2.5","fs-extra":"^11.3.2","lodash-es":"^4.18.1","ora":"^9.3.0","terser-webpack-plugin":"^5.6.1"},"devDependencies":{"@types/extract-zip":"^2.0.3","@types/fs-extra":"^11.0.4","@types/lodash-es":"^4.17.12","@types/node":"^24.3.0","@vitest/coverage-v8":"^4.1.8","ts-loader":"^9.5.4","typescript":"^5.9.2","vitest":"^3.2.6","webpack":"^5.101.3","webpack-cli":"^6.0.1","webpack-merge":"^6.0.1"},"packageManager":"pnpm@10.17.0"}');
|
|
46464
46828
|
|
|
46465
46829
|
/***/ }
|
|
46466
46830
|
|