@share-crm/sharedev-cli 0.0.5-rc.1 → 0.0.5-rc.2

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 (2) hide show
  1. package/dist/sharedev.js +114 -22
  2. package/package.json +1 -1
package/dist/sharedev.js CHANGED
@@ -15031,7 +15031,6 @@ async function download(title, files, options = {}) {
15031
15031
  const failures = [];
15032
15032
  let succeeded = 0;
15033
15033
  let failed = 0;
15034
- let processed = 0;
15035
15034
  let cursor = 0;
15036
15035
  const session = logger_ts_1.loggerService.startDownload(title);
15037
15036
  // const summary = session.createProgress(summaryName);
@@ -15046,7 +15045,6 @@ async function download(title, files, options = {}) {
15046
15045
  }
15047
15046
  const file = files[index];
15048
15047
  const progress = session.createProgress(file.fileName);
15049
- progress.update(0, 1);
15050
15048
  const context = createDownloadTaskContext(progress);
15051
15049
  try {
15052
15050
  if (delayMs > 0) {
@@ -15055,7 +15053,8 @@ async function download(title, files, options = {}) {
15055
15053
  const value = await file.download(context);
15056
15054
  values.push(value);
15057
15055
  succeeded += 1;
15058
- progress.update(1, 1);
15056
+ // 没有字节流进度的任务无需伪造 1 B/1 B;成功后及时移除已完成任务。
15057
+ progress.finish();
15059
15058
  }
15060
15059
  catch (error) {
15061
15060
  failed += 1;
@@ -15063,10 +15062,6 @@ async function download(title, files, options = {}) {
15063
15062
  failures.push({ fileName: file.fileName, message });
15064
15063
  progress.fail(message);
15065
15064
  }
15066
- finally {
15067
- processed += 1;
15068
- // summary.update(processed, files.length);
15069
- }
15070
15065
  }
15071
15066
  };
15072
15067
  await Promise.all(new Array(maxConcurrency).fill(0).map(() => worker()));
@@ -28096,8 +28091,10 @@ exports.toObjectSearchSummary = toObjectSearchSummary;
28096
28091
  exports.isExactObjectApiNameMatch = isExactObjectApiNameMatch;
28097
28092
  exports.extractObjectDescribe = extractObjectDescribe;
28098
28093
  const node_path_1 = __importDefault(__webpack_require__(76760));
28094
+ const request_ts_1 = __webpack_require__(83733);
28099
28095
  const request_execute_ts_1 = __webpack_require__(4839);
28100
28096
  const request_execute_command_paths_ts_1 = __webpack_require__(23634);
28097
+ const request_channel_ts_1 = __webpack_require__(43355);
28101
28098
  const download_ts_1 = __webpack_require__(15142);
28102
28099
  const logger_ts_1 = __webpack_require__(87562);
28103
28100
  const layout_list_ts_1 = __webpack_require__(95164);
@@ -28117,6 +28114,18 @@ function buildObjectSearchPayload(type) {
28117
28114
  async function getObjectDescribeList(options = {}) {
28118
28115
  const items = [];
28119
28116
  const types = options.type ? [options.type] : ['package', 'custom'];
28117
+ // certificate/FHH 通道继续调用既有对象描述接口,避免依赖未部署的操作中心 action。
28118
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'fhh') {
28119
+ for (const type of types) {
28120
+ const response = await request_ts_1.requestService.FHH({
28121
+ url: '/EM1HNCRM/API/v1/object/describe/service/findDescribeManageList',
28122
+ data: buildObjectSearchPayload(type)
28123
+ });
28124
+ items.push(...(response.objectDescribeList ?? []));
28125
+ }
28126
+ return items;
28127
+ }
28128
+ // sharecrm 网页登录通过 Open API 操作中心读取对象描述列表。
28120
28129
  for (const type of types) {
28121
28130
  const response = await (0, request_execute_ts_1.executeShareCliCommand)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('objectDev', 'queryDescribeManageList'), { ...buildObjectSearchPayload(type), includeControlLevel: true });
28122
28131
  const root = (0, types_ts_1.narrowObjectDevResponse)(response);
@@ -28160,6 +28169,22 @@ function filterObjectDescribeList(items, query) {
28160
28169
  .sort((left, right) => compareObjectSearchItems(left, right, normalizedQuery));
28161
28170
  }
28162
28171
  async function getObjectDescribeByApiName(apiName) {
28172
+ // certificate/FHH 通道保留既有详情接口,其响应已包含 detail layout。
28173
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'fhh') {
28174
+ return request_ts_1.requestService.FHH({
28175
+ url: '/EM1HNCRM/API/v1/object/describe/service/findDescribeByApiName',
28176
+ data: {
28177
+ describe_apiname: apiName,
28178
+ include_layout: true,
28179
+ layout_type: 'detail',
28180
+ get_label_direct: true,
28181
+ include_describe_extra: false,
28182
+ include_fields_extra: false,
28183
+ check_cross_filter: false
28184
+ }
28185
+ });
28186
+ }
28187
+ // sharecrm 网页登录通过 Open API 操作中心查询对象及其 detail layout。
28163
28188
  const response = await (0, request_execute_ts_1.executeShareCliCommand)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('objectDev', 'queryDescribeListByApiName'), { describe_apiname_list: [apiName], excludeBigObject: true, include_describe_extra: true });
28164
28189
  const root = (0, types_ts_1.narrowObjectDevResponse)(response);
28165
28190
  if (root?.success !== true || root.code !== 'OK') {
@@ -28218,6 +28243,26 @@ async function downloadObjectDescribeByApiNames(apiNames, options) {
28218
28243
  });
28219
28244
  }
28220
28245
  async function getRuntimeNamespaceList() {
28246
+ // certificate/FHH 通道保留既有运行时接口;华为云等环境未注册操作中心同名 action。
28247
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'fhh') {
28248
+ const response = await request_ts_1.requestService.FHH({
28249
+ url: '/EM1HFUNC/runtime/namespace',
28250
+ data: {}
28251
+ });
28252
+ const data = (0, types_ts_1.narrowObjectDevResponse)(response.data);
28253
+ const items = (0, types_ts_1.narrowObjectDevResponse)(data?.namespaces) ?? [];
28254
+ const namespaces = Array.from(new Set(items
28255
+ .map((item) => {
28256
+ const value = item.value ?? item.namespace ?? item.name;
28257
+ return typeof value === 'string' ? value.trim() : '';
28258
+ })
28259
+ .filter(Boolean))).sort((left, right) => left.localeCompare(right));
28260
+ return {
28261
+ namespaces,
28262
+ raw: response
28263
+ };
28264
+ }
28265
+ // sharecrm 网页登录仅能使用 Open API 操作中心命令。
28221
28266
  const response = await (0, apl_create_ts_1.getAplNamespaceOptionsNew)();
28222
28267
  const namespaces = response.namespaces.map((item) => item.value).filter(Boolean);
28223
28268
  return {
@@ -29953,11 +29998,13 @@ async function runInitDownloadsConcurrently(context, options, pullSelections, ag
29953
29998
  }
29954
29999
  if (hasCredentials && (pullSelections.pullAllApl || pullSelections.pullAllPwc)) {
29955
30000
  request_ts_1.requestService.configure(context.settings);
29956
- tasks.push((0, dev_metadata_service_ts_1.downloadInitMetadata)(context).then((result) => {
30001
+ tasks.push((async () => {
30002
+ const result = await (0, dev_metadata_service_ts_1.downloadInitMetadata)(context);
30003
+ // 单个对象缺失布局等元数据不完整场景不应阻断工作区初始化,已成功的对象仍可使用。
29957
30004
  if (!result.success) {
29958
- throw new Error(`Metadata pull incomplete: ${result.objectsFailed} object(s) failed.`);
30005
+ logger_ts_1.loggerService.warn(`Object metadata pull completed with ${result.objectsFailed} incomplete object(s); continuing initialization.`);
29959
30006
  }
29960
- }));
30007
+ })());
29961
30008
  }
29962
30009
  if (hasCredentials && pullSelections.pullAllApl) {
29963
30010
  tasks.push(runInitAplPull(context).then((success) => {
@@ -46198,6 +46245,7 @@ const file_ts_1 = __webpack_require__(57452);
46198
46245
  const zip_ts_1 = __webpack_require__(89139);
46199
46246
  const logger_ts_1 = __webpack_require__(87562);
46200
46247
  const request_ts_1 = __webpack_require__(83733);
46248
+ const request_channel_ts_1 = __webpack_require__(43355);
46201
46249
  const sharecrm_session_ts_1 = __webpack_require__(47166);
46202
46250
  const pwc_service_ts_1 = __webpack_require__(63358);
46203
46251
  const pwc_pull_ts_1 = __webpack_require__(42094);
@@ -46242,18 +46290,62 @@ async function pwcPullCommand(apiName, options, context) {
46242
46290
  if (options.type !== 'component' && options.type !== 'plugin') {
46243
46291
  throw new Error(`Invalid type: ${options.type}, accept 'component|plugin'.`);
46244
46292
  }
46245
- // 拉取 PWC 资源:统一走 open API 链路(code-dev vscode-extension download-code),
46246
- // 不再依赖 FHH 下载通道;失败信息由 service 汇总,这里统一打印。
46247
- const result = await (0, pwc_pull_ts_1.pwcPullNewService)(normalizedApiName, options.type, context, { all });
46248
- if (result.errorMessages.length) {
46249
- result.errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
46293
+ // sharecrm 网页登录通过操作中心下载 PWC 资源。
46294
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
46295
+ const result = await (0, pwc_pull_ts_1.pwcPullNewService)(normalizedApiName, options.type, context, { all });
46296
+ if (result.errorMessages.length) {
46297
+ result.errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
46298
+ }
46299
+ if (all) {
46300
+ logger_ts_1.loggerService.info(`PWC pull completed: target=${result.found}, success=${result.written}, failed=${result.failed}`);
46301
+ return result.failed === 0;
46302
+ }
46303
+ logger_ts_1.loggerService.success(`Pulled PWC resource ${result.apiNames[0]} to ${result.componentRoot}`);
46304
+ return true;
46250
46305
  }
46306
+ // certificate/FHH 通道保留既有 VscodeExtension 下载接口。
46251
46307
  if (all) {
46252
- logger_ts_1.loggerService.info(`PWC pull completed: target=${result.found}, success=${result.written}, failed=${result.failed}`);
46253
- return result.failed === 0;
46308
+ logger_ts_1.loggerService.startLoading(`Fetching PWC resources for type=${options.type}`);
46309
+ try {
46310
+ const components = await (0, pwc_service_ts_1.fetchCodeByType)(options.type);
46311
+ let written = 0;
46312
+ let failed = 0;
46313
+ logger_ts_1.loggerService.updateLoading(`Found ${components.length} PWC resources, pulling...`);
46314
+ for (const component of components) {
46315
+ try {
46316
+ assertPwcComponentType(component, options.type);
46317
+ const componentRoot = await hydrateAndWritePwcComponent(context, component);
46318
+ written += 1;
46319
+ logger_ts_1.loggerService.success(`Pulled PWC resource ${component.apiName} to ${componentRoot}`);
46320
+ }
46321
+ catch (error) {
46322
+ failed += 1;
46323
+ const message = error instanceof Error ? error.message : String(error);
46324
+ logger_ts_1.loggerService.error(`Failed to pull PWC resource ${component.apiName || '<unknown>'}: ${message}`);
46325
+ }
46326
+ }
46327
+ logger_ts_1.loggerService.info(`PWC pull completed: target=${components.length}, success=${written}, failed=${failed}`);
46328
+ return failed === 0;
46329
+ }
46330
+ finally {
46331
+ logger_ts_1.loggerService.stopLoading();
46332
+ }
46333
+ }
46334
+ logger_ts_1.loggerService.startLoading(`Fetching PWC resource ${normalizedApiName}`);
46335
+ try {
46336
+ const components = await (0, pwc_service_ts_1.fetchCode)(options.type, normalizedApiName);
46337
+ const component = components[0];
46338
+ if (!component) {
46339
+ throw new Error(`PWC resource not found: ${normalizedApiName}`);
46340
+ }
46341
+ assertPwcComponentType(component, options.type);
46342
+ const componentRoot = await hydrateAndWritePwcComponent(context, component);
46343
+ logger_ts_1.loggerService.success(`Pulled PWC resource ${normalizedApiName} to ${componentRoot}`);
46344
+ return true;
46345
+ }
46346
+ finally {
46347
+ logger_ts_1.loggerService.stopLoading();
46254
46348
  }
46255
- logger_ts_1.loggerService.success(`Pulled PWC resource ${result.apiNames[0]} to ${result.componentRoot}`);
46256
- return true;
46257
46349
  }
46258
46350
  async function pwcCreateCommand(options, context) {
46259
46351
  logger_ts_1.loggerService.startLoading('Preparing PWC create');
@@ -47525,7 +47617,7 @@ var __webpack_unused_export__;
47525
47617
  __webpack_unused_export__ = ({ value: true });
47526
47618
  exports.uploadPwcFileList = uploadPwcFileList;
47527
47619
  exports.fetchCode = fetchCode;
47528
- __webpack_unused_export__ = fetchCodeByType;
47620
+ exports.fetchCodeByType = fetchCodeByType;
47529
47621
  exports.updateCodeSource = updateCodeSource;
47530
47622
  exports.buildCode = buildCode;
47531
47623
  exports.getBuildResult = getBuildResult;
@@ -51628,8 +51720,8 @@ async function readCliPackageMeta() {
51628
51720
  ? "@share-crm/sharedev-cli".trim()
51629
51721
  : '@share-crm/sharedev-cli';
51630
51722
  const debugEnabled = true && Boolean(false);
51631
- const rawVersion = ( true && "0.0.5-rc.1".trim())
51632
- ? "0.0.5-rc.1".trim()
51723
+ const rawVersion = ( true && "0.0.5-rc.2".trim())
51724
+ ? "0.0.5-rc.2".trim()
51633
51725
  : '0.0.0';
51634
51726
  const version = rawVersion + (debugEnabled ? '-debug' : '');
51635
51727
  return { name, version };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@share-crm/sharedev-cli",
3
- "version": "0.0.5-rc.1",
3
+ "version": "0.0.5-rc.2",
4
4
  "private": false,
5
5
  "description": "sharedev command line tool",
6
6
  "type": "module",