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

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 +116 -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()));
@@ -15744,6 +15739,8 @@ async function executeOnce(session, commandKey, args, flags, onTraceId) {
15744
15739
  headers: await buildCommandHeaders(session),
15745
15740
  body: JSON.stringify({
15746
15741
  commandKey,
15742
+ // 与 FHH shareCli/execute 保持同一 Agent 渠道标记,供操作中心路由和统计使用。
15743
+ agentChannels: ['share_dev'],
15747
15744
  arguments: args ?? {},
15748
15745
  ...(flags?.length ? { flags } : {})
15749
15746
  })
@@ -28096,8 +28093,10 @@ exports.toObjectSearchSummary = toObjectSearchSummary;
28096
28093
  exports.isExactObjectApiNameMatch = isExactObjectApiNameMatch;
28097
28094
  exports.extractObjectDescribe = extractObjectDescribe;
28098
28095
  const node_path_1 = __importDefault(__webpack_require__(76760));
28096
+ const request_ts_1 = __webpack_require__(83733);
28099
28097
  const request_execute_ts_1 = __webpack_require__(4839);
28100
28098
  const request_execute_command_paths_ts_1 = __webpack_require__(23634);
28099
+ const request_channel_ts_1 = __webpack_require__(43355);
28101
28100
  const download_ts_1 = __webpack_require__(15142);
28102
28101
  const logger_ts_1 = __webpack_require__(87562);
28103
28102
  const layout_list_ts_1 = __webpack_require__(95164);
@@ -28117,6 +28116,18 @@ function buildObjectSearchPayload(type) {
28117
28116
  async function getObjectDescribeList(options = {}) {
28118
28117
  const items = [];
28119
28118
  const types = options.type ? [options.type] : ['package', 'custom'];
28119
+ // certificate/FHH 通道继续调用既有对象描述接口,避免依赖未部署的操作中心 action。
28120
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'fhh') {
28121
+ for (const type of types) {
28122
+ const response = await request_ts_1.requestService.FHH({
28123
+ url: '/EM1HNCRM/API/v1/object/describe/service/findDescribeManageList',
28124
+ data: buildObjectSearchPayload(type)
28125
+ });
28126
+ items.push(...(response.objectDescribeList ?? []));
28127
+ }
28128
+ return items;
28129
+ }
28130
+ // sharecrm 网页登录通过 Open API 操作中心读取对象描述列表。
28120
28131
  for (const type of types) {
28121
28132
  const response = await (0, request_execute_ts_1.executeShareCliCommand)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('objectDev', 'queryDescribeManageList'), { ...buildObjectSearchPayload(type), includeControlLevel: true });
28122
28133
  const root = (0, types_ts_1.narrowObjectDevResponse)(response);
@@ -28160,6 +28171,22 @@ function filterObjectDescribeList(items, query) {
28160
28171
  .sort((left, right) => compareObjectSearchItems(left, right, normalizedQuery));
28161
28172
  }
28162
28173
  async function getObjectDescribeByApiName(apiName) {
28174
+ // certificate/FHH 通道保留既有详情接口,其响应已包含 detail layout。
28175
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'fhh') {
28176
+ return request_ts_1.requestService.FHH({
28177
+ url: '/EM1HNCRM/API/v1/object/describe/service/findDescribeByApiName',
28178
+ data: {
28179
+ describe_apiname: apiName,
28180
+ include_layout: true,
28181
+ layout_type: 'detail',
28182
+ get_label_direct: true,
28183
+ include_describe_extra: false,
28184
+ include_fields_extra: false,
28185
+ check_cross_filter: false
28186
+ }
28187
+ });
28188
+ }
28189
+ // sharecrm 网页登录通过 Open API 操作中心查询对象及其 detail layout。
28163
28190
  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
28191
  const root = (0, types_ts_1.narrowObjectDevResponse)(response);
28165
28192
  if (root?.success !== true || root.code !== 'OK') {
@@ -28218,6 +28245,26 @@ async function downloadObjectDescribeByApiNames(apiNames, options) {
28218
28245
  });
28219
28246
  }
28220
28247
  async function getRuntimeNamespaceList() {
28248
+ // certificate/FHH 通道保留既有运行时接口;华为云等环境未注册操作中心同名 action。
28249
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'fhh') {
28250
+ const response = await request_ts_1.requestService.FHH({
28251
+ url: '/EM1HFUNC/runtime/namespace',
28252
+ data: {}
28253
+ });
28254
+ const data = (0, types_ts_1.narrowObjectDevResponse)(response.data);
28255
+ const items = (0, types_ts_1.narrowObjectDevResponse)(data?.namespaces) ?? [];
28256
+ const namespaces = Array.from(new Set(items
28257
+ .map((item) => {
28258
+ const value = item.value ?? item.namespace ?? item.name;
28259
+ return typeof value === 'string' ? value.trim() : '';
28260
+ })
28261
+ .filter(Boolean))).sort((left, right) => left.localeCompare(right));
28262
+ return {
28263
+ namespaces,
28264
+ raw: response
28265
+ };
28266
+ }
28267
+ // sharecrm 网页登录仅能使用 Open API 操作中心命令。
28221
28268
  const response = await (0, apl_create_ts_1.getAplNamespaceOptionsNew)();
28222
28269
  const namespaces = response.namespaces.map((item) => item.value).filter(Boolean);
28223
28270
  return {
@@ -29953,11 +30000,13 @@ async function runInitDownloadsConcurrently(context, options, pullSelections, ag
29953
30000
  }
29954
30001
  if (hasCredentials && (pullSelections.pullAllApl || pullSelections.pullAllPwc)) {
29955
30002
  request_ts_1.requestService.configure(context.settings);
29956
- tasks.push((0, dev_metadata_service_ts_1.downloadInitMetadata)(context).then((result) => {
30003
+ tasks.push((async () => {
30004
+ const result = await (0, dev_metadata_service_ts_1.downloadInitMetadata)(context);
30005
+ // 单个对象缺失布局等元数据不完整场景不应阻断工作区初始化,已成功的对象仍可使用。
29957
30006
  if (!result.success) {
29958
- throw new Error(`Metadata pull incomplete: ${result.objectsFailed} object(s) failed.`);
30007
+ logger_ts_1.loggerService.warn(`Object metadata pull completed with ${result.objectsFailed} incomplete object(s); continuing initialization.`);
29959
30008
  }
29960
- }));
30009
+ })());
29961
30010
  }
29962
30011
  if (hasCredentials && pullSelections.pullAllApl) {
29963
30012
  tasks.push(runInitAplPull(context).then((success) => {
@@ -46198,6 +46247,7 @@ const file_ts_1 = __webpack_require__(57452);
46198
46247
  const zip_ts_1 = __webpack_require__(89139);
46199
46248
  const logger_ts_1 = __webpack_require__(87562);
46200
46249
  const request_ts_1 = __webpack_require__(83733);
46250
+ const request_channel_ts_1 = __webpack_require__(43355);
46201
46251
  const sharecrm_session_ts_1 = __webpack_require__(47166);
46202
46252
  const pwc_service_ts_1 = __webpack_require__(63358);
46203
46253
  const pwc_pull_ts_1 = __webpack_require__(42094);
@@ -46242,18 +46292,62 @@ async function pwcPullCommand(apiName, options, context) {
46242
46292
  if (options.type !== 'component' && options.type !== 'plugin') {
46243
46293
  throw new Error(`Invalid type: ${options.type}, accept 'component|plugin'.`);
46244
46294
  }
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));
46295
+ // sharecrm 网页登录通过操作中心下载 PWC 资源。
46296
+ if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
46297
+ const result = await (0, pwc_pull_ts_1.pwcPullNewService)(normalizedApiName, options.type, context, { all });
46298
+ if (result.errorMessages.length) {
46299
+ result.errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
46300
+ }
46301
+ if (all) {
46302
+ logger_ts_1.loggerService.info(`PWC pull completed: target=${result.found}, success=${result.written}, failed=${result.failed}`);
46303
+ return result.failed === 0;
46304
+ }
46305
+ logger_ts_1.loggerService.success(`Pulled PWC resource ${result.apiNames[0]} to ${result.componentRoot}`);
46306
+ return true;
46250
46307
  }
46308
+ // certificate/FHH 通道保留既有 VscodeExtension 下载接口。
46251
46309
  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;
46310
+ logger_ts_1.loggerService.startLoading(`Fetching PWC resources for type=${options.type}`);
46311
+ try {
46312
+ const components = await (0, pwc_service_ts_1.fetchCodeByType)(options.type);
46313
+ let written = 0;
46314
+ let failed = 0;
46315
+ logger_ts_1.loggerService.updateLoading(`Found ${components.length} PWC resources, pulling...`);
46316
+ for (const component of components) {
46317
+ try {
46318
+ assertPwcComponentType(component, options.type);
46319
+ const componentRoot = await hydrateAndWritePwcComponent(context, component);
46320
+ written += 1;
46321
+ logger_ts_1.loggerService.success(`Pulled PWC resource ${component.apiName} to ${componentRoot}`);
46322
+ }
46323
+ catch (error) {
46324
+ failed += 1;
46325
+ const message = error instanceof Error ? error.message : String(error);
46326
+ logger_ts_1.loggerService.error(`Failed to pull PWC resource ${component.apiName || '<unknown>'}: ${message}`);
46327
+ }
46328
+ }
46329
+ logger_ts_1.loggerService.info(`PWC pull completed: target=${components.length}, success=${written}, failed=${failed}`);
46330
+ return failed === 0;
46331
+ }
46332
+ finally {
46333
+ logger_ts_1.loggerService.stopLoading();
46334
+ }
46335
+ }
46336
+ logger_ts_1.loggerService.startLoading(`Fetching PWC resource ${normalizedApiName}`);
46337
+ try {
46338
+ const components = await (0, pwc_service_ts_1.fetchCode)(options.type, normalizedApiName);
46339
+ const component = components[0];
46340
+ if (!component) {
46341
+ throw new Error(`PWC resource not found: ${normalizedApiName}`);
46342
+ }
46343
+ assertPwcComponentType(component, options.type);
46344
+ const componentRoot = await hydrateAndWritePwcComponent(context, component);
46345
+ logger_ts_1.loggerService.success(`Pulled PWC resource ${normalizedApiName} to ${componentRoot}`);
46346
+ return true;
46347
+ }
46348
+ finally {
46349
+ logger_ts_1.loggerService.stopLoading();
46254
46350
  }
46255
- logger_ts_1.loggerService.success(`Pulled PWC resource ${result.apiNames[0]} to ${result.componentRoot}`);
46256
- return true;
46257
46351
  }
46258
46352
  async function pwcCreateCommand(options, context) {
46259
46353
  logger_ts_1.loggerService.startLoading('Preparing PWC create');
@@ -47525,7 +47619,7 @@ var __webpack_unused_export__;
47525
47619
  __webpack_unused_export__ = ({ value: true });
47526
47620
  exports.uploadPwcFileList = uploadPwcFileList;
47527
47621
  exports.fetchCode = fetchCode;
47528
- __webpack_unused_export__ = fetchCodeByType;
47622
+ exports.fetchCodeByType = fetchCodeByType;
47529
47623
  exports.updateCodeSource = updateCodeSource;
47530
47624
  exports.buildCode = buildCode;
47531
47625
  exports.getBuildResult = getBuildResult;
@@ -51628,8 +51722,8 @@ async function readCliPackageMeta() {
51628
51722
  ? "@share-crm/sharedev-cli".trim()
51629
51723
  : '@share-crm/sharedev-cli';
51630
51724
  const debugEnabled = true && Boolean(false);
51631
- const rawVersion = ( true && "0.0.5-rc.1".trim())
51632
- ? "0.0.5-rc.1".trim()
51725
+ const rawVersion = ( true && "0.0.5-rc.2.test.0".trim())
51726
+ ? "0.0.5-rc.2.test.0".trim()
51633
51727
  : '0.0.0';
51634
51728
  const version = rawVersion + (debugEnabled ? '-debug' : '');
51635
51729
  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.test.0",
4
4
  "private": false,
5
5
  "description": "sharedev command line tool",
6
6
  "type": "module",