@share-crm/sharedev-cli 0.0.4-rc.23 → 0.0.4-rc.24

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 +892 -5
  2. package/package.json +1 -1
package/dist/sharedev.js CHANGED
@@ -10623,6 +10623,12 @@ Examples:
10623
10623
  $ sharedev object-dev option-set list
10624
10624
  $ sharedev object-dev option-set pull --all
10625
10625
  $ sharedev object-dev option-set push --apiNames demo_option_set,test_option_set
10626
+ $ sharedev object-dev global-variable pull
10627
+ $ sharedev object-dev global-variable push
10628
+ $ sharedev object-dev global-variable push --apiNames var_demo__g,var_demo2__g
10629
+ $ sharedev object-dev multi-currency pull
10630
+ $ sharedev object-dev multi-currency push
10631
+ $ sharedev object-dev multi-currency push --currencyCodes USD,EUR
10626
10632
  $ sharedev object-dev scene create --objectApiName AccountObj --data "{}"
10627
10633
  $ sharedev object-dev scene list --objectApiName AccountObj
10628
10634
  $ sharedev object-dev scene pull --objectApiNames AccountObj,LeadsObj
@@ -11029,6 +11035,42 @@ Examples:
11029
11035
  void context;
11030
11036
  await (0, index_ts_1.objectDevOptionSetPushCommand)(options);
11031
11037
  }));
11038
+ const globalVariableCommand = objectDev.command('global-variable').description('Global variable operations');
11039
+ globalVariableCommand
11040
+ .command('pull')
11041
+ .description('Pull global variables via shareCli execute')
11042
+ .option('--force', 'Force overwrite local metadata files regardless of local status')
11043
+ .option('--yes', 'Skip the force confirmation prompt')
11044
+ .action((0, command_ts_1.createCommandAction)('object-dev', 'global-variable.pull', runtimeContext, async ({ options, context }) => {
11045
+ void context;
11046
+ await (0, index_ts_1.objectDevGlobalVariablePullCommand)(options);
11047
+ }));
11048
+ globalVariableCommand
11049
+ .command('push')
11050
+ .description('Push global variables via shareCli execute')
11051
+ .option('--apiNames <apiNames>', 'Target global-variable apiNames, comma separated. Push all local global variables when omitted')
11052
+ .action((0, command_ts_1.createCommandAction)('object-dev', 'global-variable.push', runtimeContext, async ({ options, context }) => {
11053
+ void context;
11054
+ await (0, index_ts_1.objectDevGlobalVariablePushCommand)(options);
11055
+ }));
11056
+ const multiCurrencyCommand = objectDev.command('multi-currency').description('Multi-currency operations');
11057
+ multiCurrencyCommand
11058
+ .command('pull')
11059
+ .description('Pull multi-currency settings via shareCli execute')
11060
+ .option('--force', 'Force overwrite local metadata files regardless of local status')
11061
+ .option('--yes', 'Skip the force confirmation prompt')
11062
+ .action((0, command_ts_1.createCommandAction)('object-dev', 'multi-currency.pull', runtimeContext, async ({ options, context }) => {
11063
+ void context;
11064
+ await (0, index_ts_1.objectDevMultiCurrencyPullCommand)(options);
11065
+ }));
11066
+ multiCurrencyCommand
11067
+ .command('push')
11068
+ .description('Push multi-currency settings via shareCli execute')
11069
+ .option('--currencyCodes <currencyCodes>', 'Target currency codes, comma separated. Push all local currencies when omitted')
11070
+ .action((0, command_ts_1.createCommandAction)('object-dev', 'multi-currency.push', runtimeContext, async ({ options, context }) => {
11071
+ void context;
11072
+ await (0, index_ts_1.objectDevMultiCurrencyPushCommand)(options);
11073
+ }));
11032
11074
  const sceneCommand = objectDev.command('scene').description('Object scene operations');
11033
11075
  sceneCommand
11034
11076
  .command('create')
@@ -12026,6 +12068,13 @@ function registerWorkflowNamespace(program, runtimeContext) {
12026
12068
  .action((0, command_ts_1.createCommandAction)('workflow def', 'support', runtimeContext, async ({ context }) => {
12027
12069
  await (0, workflow_def_command_ts_1.workflowDefSupportCommand)(context, {});
12028
12070
  }));
12071
+ // workflow def get-license-info
12072
+ workflowDef
12073
+ .command('get-license-info')
12074
+ .description('工作流查询定义配额')
12075
+ .action((0, command_ts_1.createCommandAction)('workflow def', 'get-license-info', runtimeContext, async ({ context }) => {
12076
+ await (0, workflow_def_command_ts_1.workflowDefGetLicenseInfoCommand)(context, {});
12077
+ }));
12029
12078
  }
12030
12079
 
12031
12080
 
@@ -12835,6 +12884,18 @@ const SHARE_CLI_COMMAND_PATH_MAP = {
12835
12884
  emailTemplate: {
12836
12885
  'template-page': ['object-dev', 'email-template', 'template-page'],
12837
12886
  },
12887
+ globalVariable: {
12888
+ list: ['object-dev', 'global-variable', 'list'],
12889
+ create: ['object-dev', 'global-variable', 'create'],
12890
+ update: ['object-dev', 'global-variable', 'update'],
12891
+ },
12892
+ multiCurrency: {
12893
+ status: ['object-dev', 'multi-currency', 'status'],
12894
+ 'currency-list': ['object-dev', 'multi-currency', 'currency-list'],
12895
+ 'add-currency': ['object-dev', 'multi-currency', 'add-currency'],
12896
+ 'edit-currency': ['object-dev', 'multi-currency', 'edit-currency'],
12897
+ 'batch-modify-rate': ['object-dev', 'multi-currency', 'batch-modify-rate'],
12898
+ },
12838
12899
  dataAuth: {
12839
12900
  getCommonPrivilegeList: ['access', 'data-auth', 'get-common-privilege-list'],
12840
12901
  batchUpdateCommonPrivilege: ['access', 'data-auth', 'batch-update-common-privilege'],
@@ -12915,6 +12976,7 @@ const SHARE_CLI_COMMAND_PATH_MAP = {
12915
12976
  findCustomObjs: ['WorkflowDefFindCustomObjs'],
12916
12977
  getExternalNoticeOuterRoles: ['WorkflowDefGetExternalNoticeAppOuterRoles'],
12917
12978
  support: ['WorkflowDefSupport'],
12979
+ getLicenseInfo: ['WorkflowDefGetLicenseInfo'],
12918
12980
  },
12919
12981
  flowDef: {
12920
12982
  list: ['FlowDefList'],
@@ -13824,6 +13886,18 @@ exports.q = {
13824
13886
  apiNameVariable: 'apiName',
13825
13887
  defaultOpenTag: '<OptionSet xmlns="http://sharecrm.com/metadata">',
13826
13888
  },
13889
+ GlobalVariable: {
13890
+ dirPathTemplate: 'tenant-config/global-variables',
13891
+ fileNameTemplate: '{apiName}.global-variable-meta.xml',
13892
+ apiNameVariable: 'apiName',
13893
+ defaultOpenTag: '<GlobalVariable xmlns="http://sharecrm.com/metadata">',
13894
+ },
13895
+ MultiCurrency: {
13896
+ dirPathTemplate: 'tenant-config/multi-currency',
13897
+ fileNameTemplate: '{currencyCode}.multi-currency-meta.xml',
13898
+ apiNameVariable: 'currencyCode',
13899
+ defaultOpenTag: '<MultiCurrency xmlns="http://sharecrm.com/metadata">',
13900
+ },
13827
13901
  CommonPrivilege: {
13828
13902
  dirPathTemplate: 'tenant-config/data-auth/common-privilege',
13829
13903
  fileNameTemplate: '{apiName}.common-privilege-info.xml',
@@ -20050,6 +20124,48 @@ async function objectDevFieldPushCommand(options) {
20050
20124
  }
20051
20125
 
20052
20126
 
20127
+ /***/ },
20128
+
20129
+ /***/ 6844
20130
+ (__unused_webpack_module, exports, __webpack_require__) {
20131
+
20132
+
20133
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20134
+ exports.objectDevGlobalVariablePullCommand = objectDevGlobalVariablePullCommand;
20135
+ exports.objectDevGlobalVariablePushCommand = objectDevGlobalVariablePushCommand;
20136
+ const prompts_1 = __webpack_require__(388);
20137
+ const logger_ts_1 = __webpack_require__(8802);
20138
+ const index_ts_1 = __webpack_require__(6076);
20139
+ const printErrorMessages = (errorMessages) => {
20140
+ if (!errorMessages.length) {
20141
+ return false;
20142
+ }
20143
+ errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
20144
+ return true;
20145
+ };
20146
+ async function objectDevGlobalVariablePullCommand(options) {
20147
+ if (options.force && options.yes !== true) {
20148
+ const confirmed = await (0, prompts_1.confirm)({
20149
+ message: 'This will force overwrite local global-variable metadata files regardless of local status. Continue?',
20150
+ initialValue: false
20151
+ });
20152
+ if (!confirmed) {
20153
+ throw new Error('Command cancelled.');
20154
+ }
20155
+ }
20156
+ const result = await (0, index_ts_1.globalVariablePullService)(options.force === true);
20157
+ if (printErrorMessages(result.errorMessages))
20158
+ return;
20159
+ logger_ts_1.loggerService.success(`Global variable pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
20160
+ }
20161
+ async function objectDevGlobalVariablePushCommand(options) {
20162
+ const result = await (0, index_ts_1.globalVariablePushService)(options.apiNames);
20163
+ if (printErrorMessages(result.errorMessages))
20164
+ return;
20165
+ logger_ts_1.loggerService.success(`Global variable push completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
20166
+ }
20167
+
20168
+
20053
20169
  /***/ },
20054
20170
 
20055
20171
  /***/ 8574
@@ -20058,8 +20174,8 @@ async function objectDevFieldPushCommand(options) {
20058
20174
  var __webpack_unused_export__;
20059
20175
 
20060
20176
  __webpack_unused_export__ = ({ value: true });
20061
- exports.objectDevConvertRuleListCommand = exports.objectDevObjectMappingPushCommand = exports.objectDevObjectMappingUpdateCommand = exports.objectDevObjectMappingCreateCommand = exports.objectDevObjectMappingPullCommand = exports.objectDevButtonPushCommand = exports.objectDevButtonUpdateCommand = exports.objectDevButtonCreateCommand = exports.objectDevButtonPullCommand = exports.objectDevButtonListCommand = exports.objectDevValidateRuleUpdateCommand = exports.objectDevValidateRulePushCommand = exports.objectDevValidateRulePullCommand = exports.objectDevValidateRuleListCommand = exports.objectDevValidateRuleCreateCommand = exports.objectDevLayoutRuleUpdateCommand = exports.objectDevLayoutRulePushCommand = exports.objectDevLayoutRulePullCommand = exports.objectDevLayoutRuleListCommand = exports.objectDevLayoutRuleCreateCommand = exports.objectDevLayoutUpdateCommand = exports.objectDevLayoutPushCommand = exports.objectDevLayoutPullCommand = exports.objectDevLayoutListCommand = exports.objectDevLayoutEnableEditCommand = exports.objectDevLayoutEditStatusCommand = exports.objectDevLayoutCreateCommand = exports.objectDevFieldPushCommand = exports.objectDevFieldUpdateCommand = exports.objectDevFieldCreateCommand = exports.objectDevFieldListCommand = exports.objectDevObjectPushCommand = exports.objectDevObjectUpdateCommand = exports.objectDevObjectCreateCommand = exports.objectDevSceneUpdateCommand = exports.objectDevScenePushCommand = exports.objectDevScenePullCommand = exports.objectDevSceneListCommand = exports.objectDevSceneCreateCommand = exports.objectDevOptionSetUpdateCommand = exports.objectDevOptionSetPushCommand = exports.objectDevOptionSetPullCommand = exports.objectDevOptionSetListCommand = exports.objectDevOptionSetDeleteCommand = exports.objectDevOptionSetCreateCommand = exports.objectDevObjectRelatedPullCommand = __webpack_unused_export__ = __webpack_unused_export__ = exports.objectDevObjectPullCommand = exports.objectDevObjectListCommand = void 0;
20062
- exports.objectDevEmailTemplateListCommand = exports.objectDevConvertRulePushCommand = exports.objectDevConvertRuleUpdateCommand = exports.objectDevConvertRuleCreateCommand = exports.objectDevConvertRulePullCommand = void 0;
20177
+ exports.objectDevObjectMappingPullCommand = exports.objectDevButtonPushCommand = exports.objectDevButtonUpdateCommand = exports.objectDevButtonCreateCommand = exports.objectDevButtonPullCommand = exports.objectDevButtonListCommand = exports.objectDevValidateRuleUpdateCommand = exports.objectDevValidateRulePushCommand = exports.objectDevValidateRulePullCommand = exports.objectDevValidateRuleListCommand = exports.objectDevValidateRuleCreateCommand = exports.objectDevLayoutRuleUpdateCommand = exports.objectDevLayoutRulePushCommand = exports.objectDevLayoutRulePullCommand = exports.objectDevLayoutRuleListCommand = exports.objectDevLayoutRuleCreateCommand = exports.objectDevLayoutUpdateCommand = exports.objectDevLayoutPushCommand = exports.objectDevLayoutPullCommand = exports.objectDevLayoutListCommand = exports.objectDevLayoutEnableEditCommand = exports.objectDevLayoutEditStatusCommand = exports.objectDevLayoutCreateCommand = exports.objectDevFieldPushCommand = exports.objectDevFieldUpdateCommand = exports.objectDevFieldCreateCommand = exports.objectDevFieldListCommand = exports.objectDevObjectPushCommand = exports.objectDevObjectUpdateCommand = exports.objectDevObjectCreateCommand = exports.objectDevSceneUpdateCommand = exports.objectDevScenePushCommand = exports.objectDevScenePullCommand = exports.objectDevSceneListCommand = exports.objectDevSceneCreateCommand = exports.objectDevMultiCurrencyPushCommand = exports.objectDevMultiCurrencyPullCommand = exports.objectDevGlobalVariablePushCommand = exports.objectDevGlobalVariablePullCommand = exports.objectDevOptionSetUpdateCommand = exports.objectDevOptionSetPushCommand = exports.objectDevOptionSetPullCommand = exports.objectDevOptionSetListCommand = exports.objectDevOptionSetDeleteCommand = exports.objectDevOptionSetCreateCommand = exports.objectDevObjectRelatedPullCommand = __webpack_unused_export__ = __webpack_unused_export__ = exports.objectDevObjectPullCommand = exports.objectDevObjectListCommand = void 0;
20178
+ exports.objectDevEmailTemplateListCommand = exports.objectDevConvertRulePushCommand = exports.objectDevConvertRuleUpdateCommand = exports.objectDevConvertRuleCreateCommand = exports.objectDevConvertRulePullCommand = exports.objectDevConvertRuleListCommand = exports.objectDevObjectMappingPushCommand = exports.objectDevObjectMappingUpdateCommand = exports.objectDevObjectMappingCreateCommand = void 0;
20063
20179
  var object_ts_1 = __webpack_require__(6983);
20064
20180
  Object.defineProperty(exports, "objectDevObjectListCommand", ({ enumerable: true, get: function () { return object_ts_1.objectDevObjectListCommand; } }));
20065
20181
  Object.defineProperty(exports, "objectDevObjectPullCommand", ({ enumerable: true, get: function () { return object_ts_1.objectDevObjectPullCommand; } }));
@@ -20074,6 +20190,12 @@ Object.defineProperty(exports, "objectDevOptionSetListCommand", ({ enumerable: t
20074
20190
  Object.defineProperty(exports, "objectDevOptionSetPullCommand", ({ enumerable: true, get: function () { return option_set_ts_1.objectDevOptionSetPullCommand; } }));
20075
20191
  Object.defineProperty(exports, "objectDevOptionSetPushCommand", ({ enumerable: true, get: function () { return option_set_ts_1.objectDevOptionSetPushCommand; } }));
20076
20192
  Object.defineProperty(exports, "objectDevOptionSetUpdateCommand", ({ enumerable: true, get: function () { return option_set_ts_1.objectDevOptionSetUpdateCommand; } }));
20193
+ var global_variable_ts_1 = __webpack_require__(6844);
20194
+ Object.defineProperty(exports, "objectDevGlobalVariablePullCommand", ({ enumerable: true, get: function () { return global_variable_ts_1.objectDevGlobalVariablePullCommand; } }));
20195
+ Object.defineProperty(exports, "objectDevGlobalVariablePushCommand", ({ enumerable: true, get: function () { return global_variable_ts_1.objectDevGlobalVariablePushCommand; } }));
20196
+ var multi_currency_ts_1 = __webpack_require__(6099);
20197
+ Object.defineProperty(exports, "objectDevMultiCurrencyPullCommand", ({ enumerable: true, get: function () { return multi_currency_ts_1.objectDevMultiCurrencyPullCommand; } }));
20198
+ Object.defineProperty(exports, "objectDevMultiCurrencyPushCommand", ({ enumerable: true, get: function () { return multi_currency_ts_1.objectDevMultiCurrencyPushCommand; } }));
20077
20199
  var scene_ts_1 = __webpack_require__(9158);
20078
20200
  Object.defineProperty(exports, "objectDevSceneCreateCommand", ({ enumerable: true, get: function () { return scene_ts_1.objectDevSceneCreateCommand; } }));
20079
20201
  Object.defineProperty(exports, "objectDevSceneListCommand", ({ enumerable: true, get: function () { return scene_ts_1.objectDevSceneListCommand; } }));
@@ -20358,6 +20480,48 @@ function resolveLayoutPullObjectApiNames(objectApiNames, objectApiName) {
20358
20480
  }
20359
20481
 
20360
20482
 
20483
+ /***/ },
20484
+
20485
+ /***/ 6099
20486
+ (__unused_webpack_module, exports, __webpack_require__) {
20487
+
20488
+
20489
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20490
+ exports.objectDevMultiCurrencyPullCommand = objectDevMultiCurrencyPullCommand;
20491
+ exports.objectDevMultiCurrencyPushCommand = objectDevMultiCurrencyPushCommand;
20492
+ const prompts_1 = __webpack_require__(388);
20493
+ const logger_ts_1 = __webpack_require__(8802);
20494
+ const index_ts_1 = __webpack_require__(6076);
20495
+ const printErrorMessages = (errorMessages) => {
20496
+ if (!errorMessages.length) {
20497
+ return false;
20498
+ }
20499
+ errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
20500
+ return true;
20501
+ };
20502
+ async function objectDevMultiCurrencyPullCommand(options) {
20503
+ if (options.force && options.yes !== true) {
20504
+ const confirmed = await (0, prompts_1.confirm)({
20505
+ message: 'This will force overwrite local multi-currency metadata files regardless of local status. Continue?',
20506
+ initialValue: false
20507
+ });
20508
+ if (!confirmed) {
20509
+ throw new Error('Command cancelled.');
20510
+ }
20511
+ }
20512
+ const result = await (0, index_ts_1.multiCurrencyPullService)(options.force === true);
20513
+ if (printErrorMessages(result.errorMessages))
20514
+ return;
20515
+ logger_ts_1.loggerService.success(`Multi-currency pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
20516
+ }
20517
+ async function objectDevMultiCurrencyPushCommand(options) {
20518
+ const result = await (0, index_ts_1.multiCurrencyPushService)(options.currencyCodes);
20519
+ if (printErrorMessages(result.errorMessages))
20520
+ return;
20521
+ logger_ts_1.loggerService.success(`Multi-currency push completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
20522
+ }
20523
+
20524
+
20361
20525
  /***/ },
20362
20526
 
20363
20527
  /***/ 6320
@@ -22269,6 +22433,283 @@ const fieldUpdateService = async (objectApiName, fieldApiName, data) => {
22269
22433
  exports.fieldUpdateService = fieldUpdateService;
22270
22434
 
22271
22435
 
22436
+ /***/ },
22437
+
22438
+ /***/ 6394
22439
+ (__unused_webpack_module, exports, __webpack_require__) {
22440
+
22441
+
22442
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22443
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22444
+ };
22445
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
22446
+ exports.globalVariableListService = globalVariableListService;
22447
+ const logger_ts_1 = __webpack_require__(8802);
22448
+ const request_execute_command_paths_ts_1 = __webpack_require__(1402);
22449
+ const normalize_ts_1 = __importDefault(__webpack_require__(7495));
22450
+ const request_ts_1 = __webpack_require__(1153);
22451
+ const types_ts_1 = __webpack_require__(9213);
22452
+ const requestGlobalVariableListExecute = async () => await (0, request_ts_1.requestObjectDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('globalVariable', 'list'), {
22453
+ label: '',
22454
+ realTimeTrans: true
22455
+ });
22456
+ async function globalVariableListService() {
22457
+ const errorMessages = [];
22458
+ logger_ts_1.loggerService.startLoading('Fetching global variable list...');
22459
+ try {
22460
+ const response = await requestGlobalVariableListExecute();
22461
+ const result = await (0, request_ts_1.extractObjectDevServiceResult)(response, (serviceResponse) => {
22462
+ const data = (0, types_ts_1.narrowObjectDevResponse)(serviceResponse.data);
22463
+ const globalVariableList = (0, types_ts_1.narrowObjectDevResponse)(data?.globalVariableList);
22464
+ if (!globalVariableList) {
22465
+ return [];
22466
+ }
22467
+ return globalVariableList.map((item) => ({
22468
+ label: normalize_ts_1.default.normalizeText(item.label),
22469
+ apiName: normalize_ts_1.default.normalizeText(item.api_name),
22470
+ type: normalize_ts_1.default.normalizeText(item.type),
22471
+ value: normalize_ts_1.default.normalizeText(item.value),
22472
+ defineType: normalize_ts_1.default.normalizeText(item.define_type),
22473
+ createTime: normalize_ts_1.default.normalizeDateTime(item.create_time),
22474
+ lastModifiedTime: normalize_ts_1.default.normalizeDateTime(item.last_modified_time),
22475
+ content: item
22476
+ })).filter((item) => item.apiName);
22477
+ });
22478
+ if (!result.success) {
22479
+ throw new Error(result.errorMessage);
22480
+ }
22481
+ return {
22482
+ globalVariables: result.data || [],
22483
+ found: result.data?.length || 0,
22484
+ errorMessages
22485
+ };
22486
+ }
22487
+ catch (error) {
22488
+ errorMessages.push(`Global variable list failed: ${error}`);
22489
+ return {
22490
+ globalVariables: [],
22491
+ found: 0,
22492
+ errorMessages
22493
+ };
22494
+ }
22495
+ finally {
22496
+ logger_ts_1.loggerService.stopLoading();
22497
+ }
22498
+ }
22499
+
22500
+
22501
+ /***/ },
22502
+
22503
+ /***/ 8850
22504
+ (__unused_webpack_module, exports, __webpack_require__) {
22505
+
22506
+
22507
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
22508
+ exports.globalVariablePullService = globalVariablePullService;
22509
+ const logger_ts_1 = __webpack_require__(8802);
22510
+ const index_ts_1 = __webpack_require__(7774);
22511
+ const global_variable_list_ts_1 = __webpack_require__(6394);
22512
+ const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
22513
+ async function globalVariablePullService(force = false) {
22514
+ const errorMessages = [];
22515
+ const listResult = await (0, global_variable_list_ts_1.globalVariableListService)();
22516
+ errorMessages.push(...listResult.errorMessages);
22517
+ if (errorMessages.length) {
22518
+ return {
22519
+ objectApiNames: [],
22520
+ found: 0,
22521
+ written: 0,
22522
+ skipped: 0,
22523
+ errorMessages
22524
+ };
22525
+ }
22526
+ let written = 0;
22527
+ let skipped = 0;
22528
+ logger_ts_1.loggerService.startLoading(`global-variable pull write xml: ${listResult.globalVariables.length}`);
22529
+ try {
22530
+ for (const globalVariable of listResult.globalVariables) {
22531
+ const localStatus = await xmlMetadataManager.readXml('GlobalVariable', globalVariable.apiName, { fields: ['status'] });
22532
+ if (!force && localStatus.status !== 'unchanged') {
22533
+ skipped += 1;
22534
+ logger_ts_1.loggerService.info(`Global-variable local status ${localStatus.status}, skip overwrite: ${globalVariable.apiName}. Use --force to overwrite local metadata.`);
22535
+ continue;
22536
+ }
22537
+ await xmlMetadataManager.writeXml('GlobalVariable', globalVariable.apiName, globalVariable.content, {
22538
+ status: 'unchanged'
22539
+ });
22540
+ written += 1;
22541
+ }
22542
+ }
22543
+ catch (error) {
22544
+ errorMessages.push(`Global variable pull failed: ${error}`);
22545
+ }
22546
+ finally {
22547
+ logger_ts_1.loggerService.stopLoading();
22548
+ }
22549
+ return {
22550
+ objectApiNames: [],
22551
+ found: listResult.found,
22552
+ written,
22553
+ skipped,
22554
+ errorMessages
22555
+ };
22556
+ }
22557
+
22558
+
22559
+ /***/ },
22560
+
22561
+ /***/ 4326
22562
+ (__unused_webpack_module, exports, __webpack_require__) {
22563
+
22564
+
22565
+ var __importDefault = (this && this.__importDefault) || function (mod) {
22566
+ return (mod && mod.__esModule) ? mod : { "default": mod };
22567
+ };
22568
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
22569
+ exports.globalVariablePushService = void 0;
22570
+ const normalize_ts_1 = __importDefault(__webpack_require__(7495));
22571
+ const logger_ts_1 = __webpack_require__(8802);
22572
+ const request_execute_command_paths_ts_1 = __webpack_require__(1402);
22573
+ const index_ts_1 = __webpack_require__(7774);
22574
+ const global_variable_list_ts_1 = __webpack_require__(6394);
22575
+ const global_variable_pull_ts_1 = __webpack_require__(8850);
22576
+ const request_ts_1 = __webpack_require__(1153);
22577
+ const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
22578
+ const isRecord = normalize_ts_1.default.isRecord;
22579
+ const globalVariablePushService = async (apiNames) => {
22580
+ const errorMessages = [];
22581
+ const globalVariableApiNames = await resolveTargetApiNames(apiNames);
22582
+ if (!globalVariableApiNames.length) {
22583
+ throw new Error('No global-variable metadata found. Use object-dev global-variable pull or pass --apiNames <apiNames>.');
22584
+ }
22585
+ const globalVariableListResult = await (0, global_variable_list_ts_1.globalVariableListService)();
22586
+ errorMessages.push(...globalVariableListResult.errorMessages);
22587
+ if (errorMessages.length) {
22588
+ return {
22589
+ objectApiNames: globalVariableApiNames,
22590
+ found: globalVariableApiNames.length,
22591
+ written: 0,
22592
+ skipped: globalVariableApiNames.length,
22593
+ errorMessages
22594
+ };
22595
+ }
22596
+ let written = 0;
22597
+ let skipped = 0;
22598
+ logger_ts_1.loggerService.startLoading(`global-variable push request: ${globalVariableApiNames.length}`);
22599
+ try {
22600
+ for (const globalVariableApiName of globalVariableApiNames) {
22601
+ try {
22602
+ let globalVariableMeta = await xmlMetadataManager.readXml('GlobalVariable', globalVariableApiName);
22603
+ if (!globalVariableMeta.content || !isRecord(globalVariableMeta.content)) {
22604
+ throw new Error(`Invalid global-variable content: ${globalVariableApiName}`);
22605
+ }
22606
+ const remoteItem = globalVariableListResult.globalVariables.find((item) => item.apiName === globalVariableApiName);
22607
+ const remoteExists = Boolean(remoteItem);
22608
+ if (globalVariableMeta.status === 'new' && remoteExists) {
22609
+ await xmlMetadataManager.writeXml('GlobalVariable', globalVariableApiName, globalVariableMeta.content, {
22610
+ status: 'modified',
22611
+ features: globalVariableMeta.features,
22612
+ extra: globalVariableMeta.extra
22613
+ });
22614
+ logger_ts_1.loggerService.warn(`Global-variable exists remotely, local status changed from new to modified: ${globalVariableApiName}`);
22615
+ globalVariableMeta = await xmlMetadataManager.readXml('GlobalVariable', globalVariableApiName);
22616
+ }
22617
+ if (globalVariableMeta.status !== 'new' && !remoteExists) {
22618
+ await xmlMetadataManager.writeXml('GlobalVariable', globalVariableApiName, globalVariableMeta.content, {
22619
+ status: 'new',
22620
+ features: globalVariableMeta.features,
22621
+ extra: globalVariableMeta.extra
22622
+ });
22623
+ logger_ts_1.loggerService.warn(`Global-variable does not exist remotely, local status changed from ${globalVariableMeta.status} to new: ${globalVariableApiName}`);
22624
+ globalVariableMeta = await xmlMetadataManager.readXml('GlobalVariable', globalVariableApiName);
22625
+ }
22626
+ const isCreate = globalVariableMeta.status === 'new';
22627
+ if (!globalVariableMeta.content || !isRecord(globalVariableMeta.content)) {
22628
+ throw new Error(`Invalid global-variable content: ${globalVariableApiName}`);
22629
+ }
22630
+ const payload = buildGlobalVariablePayload(globalVariableMeta.content, globalVariableApiName, isCreate ? undefined : remoteItem?.content);
22631
+ const response = await (0, request_ts_1.requestObjectDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('globalVariable', isCreate ? 'create' : 'update'), {
22632
+ json_data: JSON.stringify(payload)
22633
+ });
22634
+ if (response.success !== true || normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(response.code)) !== 'OK') {
22635
+ throw new Error(normalize_ts_1.default.normalizeText(response.message) || 'Unknown error');
22636
+ }
22637
+ await xmlMetadataManager.writeXml('GlobalVariable', globalVariableApiName, payload, {
22638
+ status: 'unchanged',
22639
+ features: globalVariableMeta.features,
22640
+ extra: globalVariableMeta.extra
22641
+ });
22642
+ written += 1;
22643
+ logger_ts_1.loggerService.info(`Global-variable pushed: ${globalVariableApiName}`);
22644
+ }
22645
+ catch (error) {
22646
+ skipped += 1;
22647
+ errorMessages.push(`Global-variable push failed: ${globalVariableApiName}: ${error}`);
22648
+ }
22649
+ }
22650
+ }
22651
+ finally {
22652
+ logger_ts_1.loggerService.stopLoading();
22653
+ }
22654
+ if (written > 0) {
22655
+ logger_ts_1.loggerService.startLoading(`global-variable push post-pull: ${globalVariableApiNames.length}`);
22656
+ try {
22657
+ const postPullResult = await (0, global_variable_pull_ts_1.globalVariablePullService)(true);
22658
+ errorMessages.push(...postPullResult.errorMessages);
22659
+ }
22660
+ finally {
22661
+ logger_ts_1.loggerService.stopLoading();
22662
+ }
22663
+ }
22664
+ return {
22665
+ objectApiNames: globalVariableApiNames,
22666
+ found: globalVariableApiNames.length,
22667
+ written,
22668
+ skipped,
22669
+ errorMessages
22670
+ };
22671
+ };
22672
+ exports.globalVariablePushService = globalVariablePushService;
22673
+ async function resolveTargetApiNames(apiNames) {
22674
+ const requestedApiNames = (apiNames ?? '')
22675
+ .split(',')
22676
+ .map((item) => normalize_ts_1.default.normalizeString(item))
22677
+ .filter((item) => Boolean(item));
22678
+ if (requestedApiNames.length) {
22679
+ return [...new Set(requestedApiNames)];
22680
+ }
22681
+ const index = await xmlMetadataManager.listLocalXmlApiName(undefined, ['GlobalVariable']);
22682
+ return index['']?.GlobalVariable ?? [];
22683
+ }
22684
+ function buildGlobalVariablePayload(localContent, apiName, remoteContent) {
22685
+ const payload = {
22686
+ ...(remoteContent ?? {}),
22687
+ ...localContent,
22688
+ api_name: apiName
22689
+ };
22690
+ const existingId = normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(remoteContent?._id));
22691
+ if (existingId) {
22692
+ payload._id = existingId;
22693
+ }
22694
+ else {
22695
+ delete payload._id;
22696
+ }
22697
+ if (!normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(payload.define_type))) {
22698
+ payload.define_type = 'custom';
22699
+ }
22700
+ if (typeof payload.is_deleted !== 'boolean') {
22701
+ payload.is_deleted = false;
22702
+ }
22703
+ if (!normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(payload.label))) {
22704
+ payload.label = apiName;
22705
+ }
22706
+ if (!normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(payload.type))) {
22707
+ payload.type = 'text';
22708
+ }
22709
+ return payload;
22710
+ }
22711
+
22712
+
22272
22713
  /***/ },
22273
22714
 
22274
22715
  /***/ 6076
@@ -22277,8 +22718,8 @@ exports.fieldUpdateService = fieldUpdateService;
22277
22718
  var __webpack_unused_export__;
22278
22719
 
22279
22720
  __webpack_unused_export__ = ({ value: true });
22280
- exports.fetchConvertRuleList = exports.objectMappingPushService = exports.objectMappingUpdateService = exports.objectMappingCreateService = __webpack_unused_export__ = __webpack_unused_export__ = exports.objectMappingPullService = exports.buttonPushService = exports.buttonUpdateService = exports.buttonCreateService = exports.buttonListService = exports.buttonPullService = exports.validateRulePushService = exports.validateRuleUpdateService = exports.validateRuleCreateService = exports.validateRulePullService = exports.validateRuleListService = exports.layoutRulePushService = exports.layoutRulePullService = exports.layoutRuleUpdateService = exports.layoutRuleListService = exports.layoutRuleCreateService = exports.layoutPushService = exports.layoutPullService = exports.layoutUpdateService = exports.layoutListService = exports.layoutEnableEditService = exports.layoutEditStatusService = exports.layoutCreateService = exports.sceneUpdateService = exports.scenePushService = exports.scenePullService = exports.sceneListService = exports.sceneCreateService = exports.optionSetUpdateService = exports.optionSetPushService = exports.optionSetPullService = exports.optionSetListService = exports.optionSetDeleteService = exports.optionSetCreateService = exports.fieldPushService = exports.fieldUpdateService = exports.fieldListService = exports.fieldCreateService = exports.objectPushService = exports.objectUpdateService = exports.objectCreateService = exports.objectListService = exports.objectRelatedPullService = exports.objectPullService = void 0;
22281
- __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.fetchEmailTemplateList = exports.convertRulePushService = exports.convertRuleUpdateService = exports.convertRuleCreateService = exports.convertRulePullService = __webpack_unused_export__ = void 0;
22721
+ exports.buttonPushService = exports.buttonUpdateService = exports.buttonCreateService = exports.buttonListService = exports.buttonPullService = exports.validateRulePushService = exports.validateRuleUpdateService = exports.validateRuleCreateService = exports.validateRulePullService = exports.validateRuleListService = exports.layoutRulePushService = exports.layoutRulePullService = exports.layoutRuleUpdateService = exports.layoutRuleListService = exports.layoutRuleCreateService = exports.layoutPushService = exports.layoutPullService = exports.layoutUpdateService = exports.layoutListService = exports.layoutEnableEditService = exports.layoutEditStatusService = exports.layoutCreateService = exports.sceneUpdateService = exports.scenePushService = exports.scenePullService = exports.sceneListService = exports.sceneCreateService = exports.multiCurrencyPushService = exports.multiCurrencyPullService = __webpack_unused_export__ = __webpack_unused_export__ = exports.globalVariablePushService = exports.globalVariablePullService = __webpack_unused_export__ = exports.optionSetUpdateService = exports.optionSetPushService = exports.optionSetPullService = exports.optionSetListService = exports.optionSetDeleteService = exports.optionSetCreateService = exports.fieldPushService = exports.fieldUpdateService = exports.fieldListService = exports.fieldCreateService = exports.objectPushService = exports.objectUpdateService = exports.objectCreateService = exports.objectListService = exports.objectRelatedPullService = exports.objectPullService = void 0;
22722
+ __webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.fetchEmailTemplateList = exports.convertRulePushService = exports.convertRuleUpdateService = exports.convertRuleCreateService = exports.convertRulePullService = __webpack_unused_export__ = exports.fetchConvertRuleList = exports.objectMappingPushService = exports.objectMappingUpdateService = exports.objectMappingCreateService = __webpack_unused_export__ = __webpack_unused_export__ = exports.objectMappingPullService = void 0;
22282
22723
  var object_pull_ts_1 = __webpack_require__(1180);
22283
22724
  Object.defineProperty(exports, "objectPullService", ({ enumerable: true, get: function () { return object_pull_ts_1.objectPullService; } }));
22284
22725
  var object_related_pull_ts_1 = __webpack_require__(8550);
@@ -22311,6 +22752,20 @@ var option_set_push_ts_1 = __webpack_require__(2554);
22311
22752
  Object.defineProperty(exports, "optionSetPushService", ({ enumerable: true, get: function () { return option_set_push_ts_1.optionSetPushService; } }));
22312
22753
  var option_set_update_ts_1 = __webpack_require__(7695);
22313
22754
  Object.defineProperty(exports, "optionSetUpdateService", ({ enumerable: true, get: function () { return option_set_update_ts_1.optionSetUpdateService; } }));
22755
+ var global_variable_list_ts_1 = __webpack_require__(6394);
22756
+ __webpack_unused_export__ = ({ enumerable: true, get: function () { return global_variable_list_ts_1.globalVariableListService; } });
22757
+ var global_variable_pull_ts_1 = __webpack_require__(8850);
22758
+ Object.defineProperty(exports, "globalVariablePullService", ({ enumerable: true, get: function () { return global_variable_pull_ts_1.globalVariablePullService; } }));
22759
+ var global_variable_push_ts_1 = __webpack_require__(4326);
22760
+ Object.defineProperty(exports, "globalVariablePushService", ({ enumerable: true, get: function () { return global_variable_push_ts_1.globalVariablePushService; } }));
22761
+ var multi_currency_status_ts_1 = __webpack_require__(7793);
22762
+ __webpack_unused_export__ = ({ enumerable: true, get: function () { return multi_currency_status_ts_1.multiCurrencyStatusService; } });
22763
+ var multi_currency_list_ts_1 = __webpack_require__(531);
22764
+ __webpack_unused_export__ = ({ enumerable: true, get: function () { return multi_currency_list_ts_1.multiCurrencyListService; } });
22765
+ var multi_currency_pull_ts_1 = __webpack_require__(8020);
22766
+ Object.defineProperty(exports, "multiCurrencyPullService", ({ enumerable: true, get: function () { return multi_currency_pull_ts_1.multiCurrencyPullService; } }));
22767
+ var multi_currency_push_ts_1 = __webpack_require__(6911);
22768
+ Object.defineProperty(exports, "multiCurrencyPushService", ({ enumerable: true, get: function () { return multi_currency_push_ts_1.multiCurrencyPushService; } }));
22314
22769
  var scene_create_ts_1 = __webpack_require__(1440);
22315
22770
  Object.defineProperty(exports, "sceneCreateService", ({ enumerable: true, get: function () { return scene_create_ts_1.sceneCreateService; } }));
22316
22771
  var scene_list_ts_1 = __webpack_require__(6140);
@@ -23346,6 +23801,423 @@ const layoutUpdateService = async (objectApiName, layoutApiName, data) => {
23346
23801
  exports.layoutUpdateService = layoutUpdateService;
23347
23802
 
23348
23803
 
23804
+ /***/ },
23805
+
23806
+ /***/ 531
23807
+ (__unused_webpack_module, exports, __webpack_require__) {
23808
+
23809
+
23810
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23811
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23812
+ };
23813
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
23814
+ exports.multiCurrencyListService = multiCurrencyListService;
23815
+ const logger_ts_1 = __webpack_require__(8802);
23816
+ const request_execute_command_paths_ts_1 = __webpack_require__(1402);
23817
+ const normalize_ts_1 = __importDefault(__webpack_require__(7495));
23818
+ const request_ts_1 = __webpack_require__(1153);
23819
+ const types_ts_1 = __webpack_require__(9213);
23820
+ async function multiCurrencyListService() {
23821
+ const errorMessages = [];
23822
+ logger_ts_1.loggerService.startLoading('Fetching multi-currency list...');
23823
+ try {
23824
+ const response = await (0, request_ts_1.requestObjectDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('multiCurrency', 'currency-list'), {});
23825
+ const result = await (0, request_ts_1.extractObjectDevServiceResult)(response, (serviceResponse) => {
23826
+ const data = (0, types_ts_1.narrowObjectDevResponse)(serviceResponse.data);
23827
+ const currencyList = (0, types_ts_1.narrowObjectDevResponse)(data?.currencyList);
23828
+ if (!currencyList) {
23829
+ return [];
23830
+ }
23831
+ return currencyList.map((item) => ({
23832
+ currencyCode: normalize_ts_1.default.normalizeText(item.currencyCode),
23833
+ currencyLabel: normalize_ts_1.default.normalizeText(item.currencyLabel),
23834
+ exchangeRate: normalize_ts_1.default.normalizeText(item.exchangeRate),
23835
+ currencySymbol: normalize_ts_1.default.normalizeText(item.currencySymbol),
23836
+ currencyUnit: normalize_ts_1.default.normalizeText(item.currencyUnit),
23837
+ currencyPrefix: normalize_ts_1.default.normalizeText(item.currencyPrefix),
23838
+ currencySuffix: normalize_ts_1.default.normalizeText(item.currencySuffix),
23839
+ currencyType: normalize_ts_1.default.normalizeText(item.currencyType),
23840
+ isFunctional: normalize_ts_1.default.normalizeText(item.isFunctional),
23841
+ status: normalize_ts_1.default.normalizeText(item.status),
23842
+ createTime: normalize_ts_1.default.normalizeDateTime(item.createTime),
23843
+ lastModifiedTime: normalize_ts_1.default.normalizeDateTime(item.lastModifiedTime),
23844
+ content: item
23845
+ })).filter((item) => item.currencyCode);
23846
+ });
23847
+ if (!result.success) {
23848
+ throw new Error(result.errorMessage);
23849
+ }
23850
+ return {
23851
+ currencies: result.data || [],
23852
+ found: result.data?.length || 0,
23853
+ errorMessages
23854
+ };
23855
+ }
23856
+ catch (error) {
23857
+ errorMessages.push(`Multi-currency list failed: ${error}`);
23858
+ return {
23859
+ currencies: [],
23860
+ found: 0,
23861
+ errorMessages
23862
+ };
23863
+ }
23864
+ finally {
23865
+ logger_ts_1.loggerService.stopLoading();
23866
+ }
23867
+ }
23868
+
23869
+
23870
+ /***/ },
23871
+
23872
+ /***/ 8020
23873
+ (__unused_webpack_module, exports, __webpack_require__) {
23874
+
23875
+
23876
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
23877
+ exports.multiCurrencyPullService = multiCurrencyPullService;
23878
+ const logger_ts_1 = __webpack_require__(8802);
23879
+ const index_ts_1 = __webpack_require__(7774);
23880
+ const multi_currency_list_ts_1 = __webpack_require__(531);
23881
+ const multi_currency_status_ts_1 = __webpack_require__(7793);
23882
+ const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
23883
+ async function multiCurrencyPullService(force = false) {
23884
+ const errorMessages = [];
23885
+ const statusResult = await (0, multi_currency_status_ts_1.multiCurrencyStatusService)();
23886
+ errorMessages.push(...statusResult.errorMessages);
23887
+ if (errorMessages.length) {
23888
+ return {
23889
+ objectApiNames: [],
23890
+ found: 0,
23891
+ written: 0,
23892
+ skipped: 0,
23893
+ errorMessages
23894
+ };
23895
+ }
23896
+ if (!statusResult.enabled) {
23897
+ errorMessages.push('Multi-currency is not enabled for current tenant.');
23898
+ return {
23899
+ objectApiNames: [],
23900
+ found: 0,
23901
+ written: 0,
23902
+ skipped: 0,
23903
+ errorMessages
23904
+ };
23905
+ }
23906
+ const listResult = await (0, multi_currency_list_ts_1.multiCurrencyListService)();
23907
+ errorMessages.push(...listResult.errorMessages);
23908
+ if (errorMessages.length) {
23909
+ return {
23910
+ objectApiNames: [],
23911
+ found: 0,
23912
+ written: 0,
23913
+ skipped: 0,
23914
+ errorMessages
23915
+ };
23916
+ }
23917
+ let written = 0;
23918
+ let skipped = 0;
23919
+ logger_ts_1.loggerService.startLoading(`multi-currency pull write xml: ${listResult.currencies.length}`);
23920
+ try {
23921
+ for (const currency of listResult.currencies) {
23922
+ const localStatus = await xmlMetadataManager.readXml('MultiCurrency', currency.currencyCode, { fields: ['status'] });
23923
+ if (!force && localStatus.status !== 'unchanged') {
23924
+ skipped += 1;
23925
+ logger_ts_1.loggerService.info(`Multi-currency local status ${localStatus.status}, skip overwrite: ${currency.currencyCode}. Use --force to overwrite local metadata.`);
23926
+ continue;
23927
+ }
23928
+ await xmlMetadataManager.writeXml('MultiCurrency', currency.currencyCode, currency.content, {
23929
+ status: 'unchanged',
23930
+ extra: statusResult.content
23931
+ });
23932
+ written += 1;
23933
+ }
23934
+ }
23935
+ catch (error) {
23936
+ errorMessages.push(`Multi-currency pull failed: ${error}`);
23937
+ }
23938
+ finally {
23939
+ logger_ts_1.loggerService.stopLoading();
23940
+ }
23941
+ return {
23942
+ objectApiNames: [],
23943
+ found: listResult.found,
23944
+ written,
23945
+ skipped,
23946
+ errorMessages
23947
+ };
23948
+ }
23949
+
23950
+
23951
+ /***/ },
23952
+
23953
+ /***/ 6911
23954
+ (__unused_webpack_module, exports, __webpack_require__) {
23955
+
23956
+
23957
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23958
+ return (mod && mod.__esModule) ? mod : { "default": mod };
23959
+ };
23960
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
23961
+ exports.multiCurrencyPushService = void 0;
23962
+ const normalize_ts_1 = __importDefault(__webpack_require__(7495));
23963
+ const logger_ts_1 = __webpack_require__(8802);
23964
+ const request_execute_command_paths_ts_1 = __webpack_require__(1402);
23965
+ const index_ts_1 = __webpack_require__(7774);
23966
+ const multi_currency_list_ts_1 = __webpack_require__(531);
23967
+ const multi_currency_pull_ts_1 = __webpack_require__(8020);
23968
+ const multi_currency_status_ts_1 = __webpack_require__(7793);
23969
+ const request_ts_1 = __webpack_require__(1153);
23970
+ const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
23971
+ const isRecord = normalize_ts_1.default.isRecord;
23972
+ const DISPLAY_FIELDS = [
23973
+ 'currencyLabel',
23974
+ 'currencySymbol',
23975
+ 'currencyUnit',
23976
+ 'currencyPrefix',
23977
+ 'currencySuffix',
23978
+ 'currencyType'
23979
+ ];
23980
+ const multiCurrencyPushService = async (currencyCodes) => {
23981
+ const errorMessages = [];
23982
+ const targetCurrencyCodes = await resolveTargetCurrencyCodes(currencyCodes);
23983
+ if (!targetCurrencyCodes.length) {
23984
+ throw new Error('No multi-currency metadata found. Use object-dev multi-currency pull or pass --currencyCodes <currencyCodes>.');
23985
+ }
23986
+ const statusResult = await (0, multi_currency_status_ts_1.multiCurrencyStatusService)();
23987
+ errorMessages.push(...statusResult.errorMessages);
23988
+ if (errorMessages.length) {
23989
+ return buildSkippedResult(targetCurrencyCodes, errorMessages);
23990
+ }
23991
+ if (!statusResult.enabled) {
23992
+ errorMessages.push('Multi-currency is not enabled for current tenant.');
23993
+ return buildSkippedResult(targetCurrencyCodes, errorMessages);
23994
+ }
23995
+ const listResult = await (0, multi_currency_list_ts_1.multiCurrencyListService)();
23996
+ errorMessages.push(...listResult.errorMessages);
23997
+ if (errorMessages.length) {
23998
+ return buildSkippedResult(targetCurrencyCodes, errorMessages);
23999
+ }
24000
+ let written = 0;
24001
+ let skipped = 0;
24002
+ const exchangeRateList = [];
24003
+ logger_ts_1.loggerService.startLoading(`multi-currency push request: ${targetCurrencyCodes.length}`);
24004
+ try {
24005
+ for (const currencyCode of targetCurrencyCodes) {
24006
+ try {
24007
+ let currencyMeta = await xmlMetadataManager.readXml('MultiCurrency', currencyCode);
24008
+ if (!currencyMeta.content || !isRecord(currencyMeta.content)) {
24009
+ throw new Error(`Invalid multi-currency content: ${currencyCode}`);
24010
+ }
24011
+ const remoteItem = listResult.currencies.find((item) => item.currencyCode === currencyCode);
24012
+ const remoteExists = Boolean(remoteItem);
24013
+ if (currencyMeta.status === 'new' && remoteExists) {
24014
+ await xmlMetadataManager.writeXml('MultiCurrency', currencyCode, currencyMeta.content, {
24015
+ status: 'modified',
24016
+ features: currencyMeta.features,
24017
+ extra: currencyMeta.extra
24018
+ });
24019
+ logger_ts_1.loggerService.warn(`Multi-currency exists remotely, local status changed from new to modified: ${currencyCode}`);
24020
+ currencyMeta = await xmlMetadataManager.readXml('MultiCurrency', currencyCode);
24021
+ }
24022
+ if (currencyMeta.status !== 'new' && !remoteExists) {
24023
+ await xmlMetadataManager.writeXml('MultiCurrency', currencyCode, currencyMeta.content, {
24024
+ status: 'new',
24025
+ features: currencyMeta.features,
24026
+ extra: currencyMeta.extra
24027
+ });
24028
+ logger_ts_1.loggerService.warn(`Multi-currency does not exist remotely, local status changed from ${currencyMeta.status} to new: ${currencyCode}`);
24029
+ currencyMeta = await xmlMetadataManager.readXml('MultiCurrency', currencyCode);
24030
+ }
24031
+ if (!currencyMeta.content || !isRecord(currencyMeta.content)) {
24032
+ throw new Error(`Invalid multi-currency content: ${currencyCode}`);
24033
+ }
24034
+ if (currencyMeta.status === 'new') {
24035
+ const addPayload = buildAddCurrencyPayload(currencyMeta.content, currencyCode);
24036
+ await requestMultiCurrencyAction('add-currency', addPayload);
24037
+ written += 1;
24038
+ logger_ts_1.loggerService.info(`Multi-currency added: ${currencyCode}`);
24039
+ await xmlMetadataManager.writeXml('MultiCurrency', currencyCode, addPayload, {
24040
+ status: 'unchanged',
24041
+ features: currencyMeta.features,
24042
+ extra: currencyMeta.extra
24043
+ });
24044
+ continue;
24045
+ }
24046
+ if (!remoteItem) {
24047
+ throw new Error(`Remote currency not found after status correction: ${currencyCode}`);
24048
+ }
24049
+ const displayPayload = buildEditCurrencyPayload(currencyMeta.content, remoteItem.content, currencyCode);
24050
+ if (hasDisplayChanged(displayPayload, remoteItem.content)) {
24051
+ await requestMultiCurrencyAction('edit-currency', displayPayload);
24052
+ written += 1;
24053
+ logger_ts_1.loggerService.info(`Multi-currency display updated: ${currencyCode}`);
24054
+ }
24055
+ if (hasExchangeRateChanged(currencyMeta.content, remoteItem.content)) {
24056
+ exchangeRateList.push({
24057
+ currencyCode,
24058
+ exchangeRate: normalize_ts_1.default.normalizeText(currencyMeta.content.exchangeRate)
24059
+ });
24060
+ }
24061
+ await xmlMetadataManager.writeXml('MultiCurrency', currencyCode, {
24062
+ ...remoteItem.content,
24063
+ ...currencyMeta.content,
24064
+ currencyCode
24065
+ }, {
24066
+ status: 'unchanged',
24067
+ features: currencyMeta.features,
24068
+ extra: currencyMeta.extra
24069
+ });
24070
+ }
24071
+ catch (error) {
24072
+ skipped += 1;
24073
+ errorMessages.push(`Multi-currency push failed: ${currencyCode}: ${error}`);
24074
+ }
24075
+ }
24076
+ if (exchangeRateList.length) {
24077
+ await requestMultiCurrencyAction('batch-modify-rate', { exchangeRateList });
24078
+ written += exchangeRateList.length;
24079
+ exchangeRateList.forEach((item) => logger_ts_1.loggerService.info(`Multi-currency rate updated: ${item.currencyCode}`));
24080
+ }
24081
+ }
24082
+ finally {
24083
+ logger_ts_1.loggerService.stopLoading();
24084
+ }
24085
+ if (written > 0) {
24086
+ logger_ts_1.loggerService.startLoading(`multi-currency push post-pull: ${targetCurrencyCodes.length}`);
24087
+ try {
24088
+ const postPullResult = await (0, multi_currency_pull_ts_1.multiCurrencyPullService)(true);
24089
+ errorMessages.push(...postPullResult.errorMessages);
24090
+ }
24091
+ finally {
24092
+ logger_ts_1.loggerService.stopLoading();
24093
+ }
24094
+ }
24095
+ return {
24096
+ objectApiNames: targetCurrencyCodes,
24097
+ found: targetCurrencyCodes.length,
24098
+ written,
24099
+ skipped,
24100
+ errorMessages
24101
+ };
24102
+ };
24103
+ exports.multiCurrencyPushService = multiCurrencyPushService;
24104
+ async function resolveTargetCurrencyCodes(currencyCodes) {
24105
+ const requestedCurrencyCodes = (currencyCodes ?? '')
24106
+ .split(',')
24107
+ .map((item) => normalize_ts_1.default.normalizeString(item))
24108
+ .filter((item) => Boolean(item));
24109
+ if (requestedCurrencyCodes.length) {
24110
+ return [...new Set(requestedCurrencyCodes)];
24111
+ }
24112
+ const index = await xmlMetadataManager.listLocalXmlApiName(undefined, ['MultiCurrency']);
24113
+ return index['']?.MultiCurrency ?? [];
24114
+ }
24115
+ function buildSkippedResult(currencyCodes, errorMessages) {
24116
+ return {
24117
+ objectApiNames: currencyCodes,
24118
+ found: currencyCodes.length,
24119
+ written: 0,
24120
+ skipped: currencyCodes.length,
24121
+ errorMessages
24122
+ };
24123
+ }
24124
+ async function requestMultiCurrencyAction(action, data) {
24125
+ const response = await (0, request_ts_1.requestObjectDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('multiCurrency', action), data);
24126
+ if (response.success !== true || normalize_ts_1.default.normalizeString(normalize_ts_1.default.asString(response.code)) !== 'OK') {
24127
+ throw new Error(normalize_ts_1.default.normalizeText(response.message) || 'Unknown error');
24128
+ }
24129
+ }
24130
+ function buildAddCurrencyPayload(content, currencyCode) {
24131
+ return {
24132
+ currencyCode,
24133
+ currencyLabel: normalize_ts_1.default.normalizeText(content.currencyLabel),
24134
+ exchangeRate: normalize_ts_1.default.normalizeText(content.exchangeRate),
24135
+ currencySymbol: normalize_ts_1.default.normalizeText(content.currencySymbol),
24136
+ currencyUnit: normalize_ts_1.default.normalizeText(content.currencyUnit),
24137
+ currencyPrefix: normalize_ts_1.default.normalizeText(content.currencyPrefix),
24138
+ currencySuffix: normalize_ts_1.default.normalizeText(content.currencySuffix),
24139
+ currencyType: normalize_ts_1.default.normalizeText(content.currencyType) || 'system'
24140
+ };
24141
+ }
24142
+ function buildEditCurrencyPayload(localContent, remoteContent, currencyCode) {
24143
+ return {
24144
+ id: normalize_ts_1.default.normalizeText(remoteContent.id),
24145
+ currencyCode,
24146
+ currencyLabel: normalize_ts_1.default.normalizeText(localContent.currencyLabel),
24147
+ currencySymbol: normalize_ts_1.default.normalizeText(localContent.currencySymbol),
24148
+ currencyUnit: normalize_ts_1.default.normalizeText(localContent.currencyUnit),
24149
+ currencyPrefix: normalize_ts_1.default.normalizeText(localContent.currencyPrefix),
24150
+ currencySuffix: normalize_ts_1.default.normalizeText(localContent.currencySuffix),
24151
+ currencyType: normalize_ts_1.default.normalizeText(localContent.currencyType) || normalize_ts_1.default.normalizeText(remoteContent.currencyType) || 'system'
24152
+ };
24153
+ }
24154
+ function hasDisplayChanged(payload, remoteContent) {
24155
+ return DISPLAY_FIELDS.some((field) => normalize_ts_1.default.normalizeText(payload[field]) !== normalize_ts_1.default.normalizeText(remoteContent[field]));
24156
+ }
24157
+ function hasExchangeRateChanged(localContent, remoteContent) {
24158
+ return normalize_ts_1.default.normalizeText(localContent.exchangeRate) !== normalize_ts_1.default.normalizeText(remoteContent.exchangeRate);
24159
+ }
24160
+
24161
+
24162
+ /***/ },
24163
+
24164
+ /***/ 7793
24165
+ (__unused_webpack_module, exports, __webpack_require__) {
24166
+
24167
+
24168
+ var __importDefault = (this && this.__importDefault) || function (mod) {
24169
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24170
+ };
24171
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
24172
+ exports.multiCurrencyStatusService = multiCurrencyStatusService;
24173
+ const logger_ts_1 = __webpack_require__(8802);
24174
+ const request_execute_command_paths_ts_1 = __webpack_require__(1402);
24175
+ const normalize_ts_1 = __importDefault(__webpack_require__(7495));
24176
+ const request_ts_1 = __webpack_require__(1153);
24177
+ const types_ts_1 = __webpack_require__(9213);
24178
+ async function multiCurrencyStatusService() {
24179
+ const errorMessages = [];
24180
+ logger_ts_1.loggerService.startLoading('Fetching multi-currency status...');
24181
+ try {
24182
+ const response = await (0, request_ts_1.requestObjectDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('multiCurrency', 'status'), {});
24183
+ const result = await (0, request_ts_1.extractObjectDevServiceResult)(response, (serviceResponse) => {
24184
+ const data = (0, types_ts_1.narrowObjectDevResponse)(serviceResponse.data);
24185
+ return (data ?? {});
24186
+ });
24187
+ if (!result.success) {
24188
+ throw new Error(result.errorMessage);
24189
+ }
24190
+ const content = result.data ?? {};
24191
+ const status = typeof content.status === 'number' ? content.status : undefined;
24192
+ const userCurrencyTransformStatus = typeof content.userCurrencyTransformStatus === 'boolean'
24193
+ ? content.userCurrencyTransformStatus
24194
+ : undefined;
24195
+ const isExchangeRateHighPrecision = typeof content.isExchangeRateHighPrecision === 'boolean'
24196
+ ? content.isExchangeRateHighPrecision
24197
+ : undefined;
24198
+ return {
24199
+ enabled: userCurrencyTransformStatus !== false && status !== 0,
24200
+ status,
24201
+ userCurrencyTransformStatus,
24202
+ isExchangeRateHighPrecision,
24203
+ content,
24204
+ errorMessages
24205
+ };
24206
+ }
24207
+ catch (error) {
24208
+ errorMessages.push(`Multi-currency status failed: ${normalize_ts_1.default.normalizeText(error instanceof Error ? error.message : String(error))}`);
24209
+ return {
24210
+ enabled: false,
24211
+ content: {},
24212
+ errorMessages
24213
+ };
24214
+ }
24215
+ finally {
24216
+ logger_ts_1.loggerService.stopLoading();
24217
+ }
24218
+ }
24219
+
24220
+
23349
24221
  /***/ },
23350
24222
 
23351
24223
  /***/ 2226
@@ -28349,6 +29221,7 @@ exports.workflowDefGetExternalNoticeCommand = workflowDefGetExternalNoticeComman
28349
29221
  exports.workflowDefFindCustomObjsCommand = workflowDefFindCustomObjsCommand;
28350
29222
  exports.workflowDefGetExternalNoticeOuterRolesCommand = workflowDefGetExternalNoticeOuterRolesCommand;
28351
29223
  exports.workflowDefSupportCommand = workflowDefSupportCommand;
29224
+ exports.workflowDefGetLicenseInfoCommand = workflowDefGetLicenseInfoCommand;
28352
29225
  const logger_ts_1 = __webpack_require__(8802);
28353
29226
  const request_execute_command_paths_ts_1 = __webpack_require__(1402);
28354
29227
  const workflow_def_service_ts_1 = __webpack_require__(5616);
@@ -28608,6 +29481,20 @@ async function workflowDefSupportCommand(_context, options) {
28608
29481
  throw error;
28609
29482
  }
28610
29483
  }
29484
+ async function workflowDefGetLicenseInfoCommand(_context, options) {
29485
+ void _context;
29486
+ const data = buildOptionsData(options, {});
29487
+ logger_ts_1.loggerService.startLoading('Executing workflowDef get-license-info');
29488
+ try {
29489
+ const response = await (0, workflow_def_service_ts_1.executeWorkflowDefShareCli)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('workflowDef', 'getLicenseInfo'), data);
29490
+ logger_ts_1.loggerService.stopLoading();
29491
+ logger_ts_1.loggerService.printJson(response);
29492
+ }
29493
+ catch (error) {
29494
+ logger_ts_1.loggerService.stopLoading();
29495
+ throw error;
29496
+ }
29497
+ }
28611
29498
 
28612
29499
 
28613
29500
  /***/ },
@@ -45513,7 +46400,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
45513
46400
  /***/ 8330
45514
46401
  (module) {
45515
46402
 
45516
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@share-crm/sharedev-cli","version":"0.0.4-rc.23","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"},"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"}');
46403
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@share-crm/sharedev-cli","version":"0.0.4-rc.24","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"},"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"}');
45517
46404
 
45518
46405
  /***/ }
45519
46406
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@share-crm/sharedev-cli",
3
- "version": "0.0.4-rc.23",
3
+ "version": "0.0.4-rc.24",
4
4
  "private": false,
5
5
  "description": "sharedev command line tool",
6
6
  "type": "module",