@share-crm/sharedev-cli 0.0.4-rc.34 → 0.0.4-rc.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/sharedev.js +2079 -1495
  2. package/package.json +1 -1
package/dist/sharedev.js CHANGED
@@ -8951,10 +8951,7 @@ Examples:
8951
8951
  Object.defineProperty(exports, "__esModule", ({ value: true }));
8952
8952
  exports.registerAppDevNamespace = void 0;
8953
8953
  const command_ts_1 = __webpack_require__(528);
8954
- const custom_app_command_ts_1 = __webpack_require__(4815);
8955
- const paas_app_command_ts_1 = __webpack_require__(7275);
8956
- const paas_app_view_command_ts_1 = __webpack_require__(439);
8957
- const paas_app_view_local_service_ts_1 = __webpack_require__(5443);
8954
+ const index_ts_1 = __webpack_require__(4355);
8958
8955
  const registerAppDevNamespace = (program, runtimeContext) => {
8959
8956
  const appDev = program.command('app-dev').description('Application development commands');
8960
8957
  const customApp = appDev.command('custom-app').description('Enterprise custom application operations');
@@ -8964,215 +8961,175 @@ const registerAppDevNamespace = (program, runtimeContext) => {
8964
8961
  .description('List manageable enterprise custom applications')
8965
8962
  .option('--nameKeyword <nameKeyword>', 'Filter by localized application name')
8966
8963
  .option('--json', 'Print the complete response as JSON')
8967
- .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.list', runtimeContext, async ({ options, context }) => (0, custom_app_command_ts_1.appDevCustomAppListCommand)(context, options)));
8964
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.list', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevCustomAppListCommand)(context, options)));
8968
8965
  customApp
8969
8966
  .command('create')
8970
- .description('Create a local enterprise custom application XML file (writes local only, push to sync remote)')
8967
+ .description('Create a local enterprise custom application XML file')
8971
8968
  .requiredOption('--localkey <localkey>', 'Local key identifier (letters/numbers/underscores, max 50 chars); file is named local-<localkey>')
8972
8969
  .requiredOption('--content <json>', 'Custom application create fields as a JSON object (appName is required)')
8973
8970
  .option('--force', 'Force overwrite local XML file if it already exists')
8974
- .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.create', runtimeContext, async ({ options, context }) => (0, custom_app_command_ts_1.appDevCustomAppCreateCommand)(context, options)));
8971
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.create', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevCustomAppCreateCommand)(context, options)));
8975
8972
  customApp
8976
8973
  .command('update')
8977
- .description('Update a local enterprise custom application XML file (writes local only, push to sync remote)')
8974
+ .description('Update a local enterprise custom application XML file')
8978
8975
  .requiredOption('--appId <appId>', 'Custom application id (local XML file name: server appId or local-<localkey>)')
8979
8976
  .requiredOption('--content <json>', 'Changed custom application fields as a JSON object')
8980
- .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.update', runtimeContext, async ({ options, context }) => (0, custom_app_command_ts_1.appDevCustomAppUpdateCommand)(context, options)));
8977
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.update', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevCustomAppUpdateCommand)(context, options)));
8981
8978
  customApp
8982
8979
  .command('pull')
8983
8980
  .description('Pull enterprise custom applications and write to local XML files')
8984
8981
  .option('--nameKeyword <nameKeyword>', 'Filter by localized application name')
8985
8982
  .option('--force', 'Force overwrite local XML files regardless of local status')
8986
8983
  .option('--yes', 'Skip the force confirmation prompt')
8987
- .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.pull', runtimeContext, async ({ options, context }) => (0, custom_app_command_ts_1.appDevCustomAppPullCommand)(context, options)));
8984
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.pull', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevCustomAppPullCommand)(context, options)));
8988
8985
  customApp
8989
8986
  .command('push')
8990
8987
  .description('Push local enterprise custom application XML files to remote')
8991
8988
  .option('--all', 'Push all local custom-app files')
8992
8989
  .option('--appId <appId>', 'Push a single custom-app by appId (server appId or local-<localkey>)')
8993
8990
  .option('--yes', 'Skip overwrite confirmation prompts during pre/post-pull')
8994
- .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.push', runtimeContext, async ({ options, context }) => (0, custom_app_command_ts_1.appDevCustomAppPushCommand)(context, options)));
8991
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'custom-app.push', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevCustomAppPushCommand)(context, options)));
8995
8992
  paasApp
8996
8993
  .command('list')
8997
8994
  .description('List PaaS applications')
8998
8995
  .option('--json', 'Print the complete response as JSON')
8999
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.list', runtimeContext, async ({ options, context }) => {
9000
- await (0, paas_app_command_ts_1.appDevPaasAppListCommand)(context, options);
9001
- }));
8996
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.list', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevPaasAppListCommand)(context, options)));
9002
8997
  paasApp
9003
8998
  .command('create')
9004
- .description('Create a local PaaS application XML file (writes local only, push to sync remote)')
8999
+ .description('Create a local PaaS application XML file')
9005
9000
  .requiredOption('--localkey <localkey>', 'Local key identifier (letters/numbers/underscores, max 50 chars); file is named local-<localkey>')
9006
9001
  .requiredOption('--content <json>', 'PaaS application content as a JSON object')
9007
9002
  .option('--force', 'Force overwrite local XML file if it already exists')
9008
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.create', runtimeContext, async ({ options, context }) => {
9009
- await (0, paas_app_command_ts_1.appDevPaasAppCreateCommand)(context, options);
9010
- }));
9003
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.create', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevPaasAppCreateCommand)(context, options)));
9011
9004
  paasApp
9012
9005
  .command('update')
9013
- .description('Update a local PaaS application XML file (writes local only, push to sync remote)')
9006
+ .description('Update a local PaaS application XML file')
9014
9007
  .requiredOption('--appId <appId>', 'PaaS application id (local XML file name: server appId or local-<localkey>)')
9015
9008
  .requiredOption('--content <json>', 'Complete PaaS application content as a JSON object')
9016
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.update', runtimeContext, async ({ options, context }) => {
9017
- await (0, paas_app_command_ts_1.appDevPaasAppUpdateCommand)(context, options);
9018
- }));
9009
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.update', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevPaasAppUpdateCommand)(context, options)));
9019
9010
  paasApp
9020
9011
  .command('pull')
9021
9012
  .description('Pull PaaS applications and write to local XML files')
9022
9013
  .option('--force', 'Force overwrite local XML files regardless of local status')
9023
9014
  .option('--yes', 'Skip the force confirmation prompt')
9024
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.pull', runtimeContext, async ({ options, context }) => {
9025
- await (0, paas_app_command_ts_1.appDevPaasAppPullCommand)(context, options);
9026
- }));
9015
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.pull', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevPaasAppPullCommand)(context, options)));
9027
9016
  paasApp
9028
9017
  .command('push')
9029
9018
  .description('Push local PaaS application XML files to remote')
9030
9019
  .option('--all', 'Push all local paas-app files')
9031
9020
  .option('--appId <appId>', 'Push a single paas-app by appId (server appId or local-<localkey>)')
9032
9021
  .option('--yes', 'Skip overwrite confirmation prompts during pre/post-pull')
9033
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.push', runtimeContext, async ({ options, context }) => {
9034
- await (0, paas_app_command_ts_1.appDevPaasAppPushCommand)(context, options);
9035
- }));
9022
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.push', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevPaasAppPushCommand)(context, options)));
9036
9023
  paasApp
9037
9024
  .command('app-view-web-list')
9038
9025
  .description('List Web views for a PaaS application')
9039
- .requiredOption('--appId <appId>', 'PaaS application ID returned by paas-app list')
9026
+ .requiredOption('--appId <appId>', 'PaaS application ID')
9040
9027
  .option('--pageNum <pageNum>', 'Page number, default 1')
9041
9028
  .option('--pageSize <pageSize>', 'Page size, default 20 and at most 100')
9042
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-list', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebListCommand)(context, options)));
9029
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-list', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebListCommand)(context, options)));
9043
9030
  paasApp
9044
9031
  .command('app-view-web-detail')
9045
9032
  .description('Show a complete PaaS application Web view')
9046
9033
  .requiredOption('--templateId <templateId>', 'Web view template ID returned by app-view-web-list')
9047
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-detail', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebDetailCommand)(context, options)));
9034
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-detail', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebDetailCommand)(context, options)));
9048
9035
  paasApp
9049
9036
  .command('app-view-web-create')
9050
- .description('Create a PaaS application Web view')
9051
- .option('--input-file <path>', 'Complete Web create request as a UTF-8 JSON file')
9052
- .option('--localKey <localKey>', 'Local view key for XML create')
9053
- .option('--content <json>', 'Complete local Web view content JSON')
9054
- .option('--force', 'Overwrite local XML file')
9055
- .option('--appId <appId>', 'PaaS application ID returned by paas-app list')
9056
- .option('--template <json>', 'Application view template fields as a JSON object')
9057
- .option('--menu <json>', 'Selected Web menu and display settings as a JSON object')
9058
- .option('--layout <json>', 'Web page layout as a JSON object')
9059
- .option('--utilityBar <json>', 'Optional Web utility bar as a JSON object')
9060
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-create', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebCreateCommand)(context, options)));
9037
+ .description('Create a local PaaS application Web view XML file')
9038
+ .requiredOption('--localKey <localKey>', 'Local view key identifier')
9039
+ .requiredOption('--content <json>', 'Complete local Web view content JSON')
9040
+ .option('--force', 'Overwrite local XML file if it already exists')
9041
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-create', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebCreateCommand)(context, options)));
9061
9042
  paasApp
9062
9043
  .command('app-view-web-update')
9063
- .description('Update selected resources in a PaaS application Web view')
9064
- .option('--input-file <path>', 'Complete Web update request as a UTF-8 JSON file')
9065
- .option('--content <json>', 'Partial local Web view content JSON')
9066
- .option('--templateId <templateId>', 'Web view template ID returned by app-view-web-list')
9044
+ .description('Update a local PaaS application Web view XML file')
9045
+ .requiredOption('--templateId <templateId>', 'Web view template ID (server ID or local-<localKey>)')
9046
+ .requiredOption('--content <json>', 'Changed Web view content fields as a JSON object')
9067
9047
  .option('--updateTime <updateTime>', 'Latest template updateTime returned by list or detail')
9068
- .option('--template <json>', 'Changed application view template fields as a JSON object')
9069
- .option('--menu <json>', 'Changed Web menu fields as a JSON object')
9070
- .option('--layout <json>', 'Changed Web page layout fields as a JSON object')
9071
- .option('--utilityBar <json>', 'Changed Web utility bar fields as a JSON object')
9072
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-update', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebUpdateCommand)(context, options)));
9048
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-update', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebUpdateCommand)(context, options)));
9073
9049
  paasApp
9074
9050
  .command('app-view-web-pull')
9075
9051
  .description('Pull PaaS application Web views into local XML files')
9076
9052
  .requiredOption('--appId <appId>', 'PaaS application ID')
9053
+ .option('--pageNum <pageNum>', 'Page number, default 1')
9054
+ .option('--pageSize <pageSize>', 'Page size, default 100 and at most 100')
9077
9055
  .option('--force', 'Overwrite local Web view XML files')
9078
- .action(async (options) => {
9079
- const result = await (0, paas_app_view_local_service_ts_1.appViewPullService)('web', options.appId, options.force === true);
9080
- if (result.errorMessages.length)
9081
- throw new Error(result.errorMessages.join('; '));
9082
- console.log(`Web view pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
9083
- });
9056
+ .option('--yes', 'Skip the force confirmation prompt')
9057
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-pull', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebPullCommand)(context, options)));
9084
9058
  paasApp
9085
9059
  .command('app-view-web-push')
9086
9060
  .description('Push local PaaS application Web view XML files')
9087
9061
  .option('--all', 'Push all local Web view files')
9088
9062
  .option('--templateId <templateId>', 'Push one local Web view')
9089
- .action(async (options) => {
9090
- const result = await (0, paas_app_view_local_service_ts_1.appViewPushService)('web', options);
9091
- if (result.errorMessages.length)
9092
- throw new Error(result.errorMessages.join('; '));
9093
- console.log(`Web view push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
9094
- });
9063
+ .option('--yes', 'Skip overwrite confirmation prompts during pre/post-pull')
9064
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-push', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebPushCommand)(context, options)));
9095
9065
  paasApp
9096
9066
  .command('app-view-web-menu-options')
9097
9067
  .description('List selectable Web menu items for PaaS application views')
9098
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-menu-options', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebMenuOptionsCommand)(context, options)));
9068
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-menu-options', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebMenuOptionsCommand)(context, options)));
9099
9069
  paasApp
9100
9070
  .command('app-view-web-layout-component-options')
9101
9071
  .description('List selectable Web layout components for PaaS application views')
9102
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-layout-component-options', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebLayoutComponentOptionsCommand)(context, options)));
9072
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-layout-component-options', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebLayoutComponentOptionsCommand)(context, options)));
9103
9073
  paasApp
9104
9074
  .command('app-view-web-utility-bar-component-options')
9105
9075
  .description('List selectable Web utility bar components for a PaaS application')
9106
- .requiredOption('--appId <appId>', 'PaaS application ID returned by paas-app list')
9107
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-utility-bar-component-options', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebUtilityBarComponentOptionsCommand)(context, options)));
9076
+ .requiredOption('--appId <appId>', 'PaaS application ID')
9077
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-utility-bar-component-options', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebUtilityBarComponentOptionsCommand)(context, options)));
9108
9078
  paasApp
9109
9079
  .command('app-view-web-utility-bar-icon-options')
9110
9080
  .description('List selectable Web utility bar icons for a PaaS application')
9111
- .requiredOption('--appId <appId>', 'PaaS application ID returned by paas-app list')
9112
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-utility-bar-icon-options', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewWebUtilityBarIconOptionsCommand)(context, options)));
9081
+ .requiredOption('--appId <appId>', 'PaaS application ID')
9082
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-web-utility-bar-icon-options', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewWebUtilityBarIconOptionsCommand)(context, options)));
9113
9083
  paasApp
9114
9084
  .command('app-view-mobile-list')
9115
9085
  .description('List Mobile views for a PaaS application')
9116
- .requiredOption('--appId <appId>', 'PaaS application ID returned by paas-app list')
9086
+ .requiredOption('--appId <appId>', 'PaaS application ID')
9117
9087
  .option('--pageNum <pageNum>', 'Page number, default 1')
9118
9088
  .option('--pageSize <pageSize>', 'Page size, default 20 and at most 100')
9119
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-list', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewMobileListCommand)(context, options)));
9089
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-list', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobileListCommand)(context, options)));
9120
9090
  paasApp
9121
9091
  .command('app-view-mobile-detail')
9122
9092
  .description('Show a complete PaaS application Mobile view')
9123
9093
  .requiredOption('--templateId <templateId>', 'Mobile view template ID returned by app-view-mobile-list')
9124
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-detail', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewMobileDetailCommand)(context, options)));
9094
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-detail', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobileDetailCommand)(context, options)));
9125
9095
  paasApp
9126
9096
  .command('app-view-mobile-create')
9127
- .description('Create a PaaS application Mobile view')
9128
- .option('--input-file <path>', 'Complete Mobile create request as a UTF-8 JSON file')
9129
- .option('--localKey <localKey>', 'Local view key for XML create')
9130
- .option('--content <json>', 'Complete local Mobile view content JSON')
9131
- .option('--force', 'Overwrite local XML file')
9132
- .option('--appId <appId>', 'PaaS application ID returned by paas-app list')
9133
- .option('--template <json>', 'Application view template fields as a JSON object')
9134
- .option('--pageData <json>', 'Mobile page data as a JSON object')
9135
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-create', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewMobileCreateCommand)(context, options)));
9097
+ .description('Create a local PaaS application Mobile view XML file')
9098
+ .requiredOption('--localKey <localKey>', 'Local view key identifier')
9099
+ .requiredOption('--content <json>', 'Complete local Mobile view content JSON')
9100
+ .option('--force', 'Overwrite local XML file if it already exists')
9101
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-create', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobileCreateCommand)(context, options)));
9136
9102
  paasApp
9137
9103
  .command('app-view-mobile-update')
9138
- .description('Update selected resources in a PaaS application Mobile view')
9139
- .option('--input-file <path>', 'Complete Mobile update request as a UTF-8 JSON file')
9140
- .option('--content <json>', 'Partial local Mobile view content JSON')
9141
- .option('--templateId <templateId>', 'Mobile view template ID returned by app-view-mobile-list')
9104
+ .description('Update a local PaaS application Mobile view XML file')
9105
+ .requiredOption('--templateId <templateId>', 'Mobile view template ID (server ID or local-<localKey>)')
9106
+ .requiredOption('--content <json>', 'Changed Mobile view content fields as a JSON object')
9142
9107
  .option('--updateTime <updateTime>', 'Latest template updateTime returned by list or detail')
9143
- .option('--template <json>', 'Changed application view template fields as a JSON object')
9144
- .option('--pageData <json>', 'Changed Mobile page data as a JSON object')
9145
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-update', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewMobileUpdateCommand)(context, options)));
9108
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-update', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobileUpdateCommand)(context, options)));
9146
9109
  paasApp
9147
9110
  .command('app-view-mobile-pull')
9148
9111
  .description('Pull PaaS application Mobile views into local XML files')
9149
9112
  .requiredOption('--appId <appId>', 'PaaS application ID')
9113
+ .option('--pageNum <pageNum>', 'Page number, default 1')
9114
+ .option('--pageSize <pageSize>', 'Page size, default 100 and at most 100')
9150
9115
  .option('--force', 'Overwrite local Mobile view XML files')
9151
- .action(async (options) => {
9152
- const result = await (0, paas_app_view_local_service_ts_1.appViewPullService)('mobile', options.appId, options.force === true);
9153
- if (result.errorMessages.length)
9154
- throw new Error(result.errorMessages.join('; '));
9155
- console.log(`Mobile view pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
9156
- });
9116
+ .option('--yes', 'Skip the force confirmation prompt')
9117
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-pull', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobilePullCommand)(context, options)));
9157
9118
  paasApp
9158
9119
  .command('app-view-mobile-push')
9159
9120
  .description('Push local PaaS application Mobile view XML files')
9160
9121
  .option('--all', 'Push all local Mobile view files')
9161
9122
  .option('--templateId <templateId>', 'Push one local Mobile view')
9162
- .action(async (options) => {
9163
- const result = await (0, paas_app_view_local_service_ts_1.appViewPushService)('mobile', options);
9164
- if (result.errorMessages.length)
9165
- throw new Error(result.errorMessages.join('; '));
9166
- console.log(`Mobile view push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
9167
- });
9123
+ .option('--yes', 'Skip overwrite confirmation prompts during pre/post-pull')
9124
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-push', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobilePushCommand)(context, options)));
9168
9125
  paasApp
9169
9126
  .command('app-view-mobile-page-component-options')
9170
9127
  .description('List selectable Mobile page components for PaaS application views')
9171
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-page-component-options', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewMobilePageComponentOptionsCommand)(context, options)));
9128
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-page-component-options', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobilePageComponentOptionsCommand)(context, options)));
9172
9129
  paasApp
9173
9130
  .command('app-view-mobile-menu-component-options')
9174
9131
  .description('List selectable Mobile menu-entry components for PaaS application views')
9175
- .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-menu-component-options', runtimeContext, async ({ options, context }) => (0, paas_app_view_command_ts_1.appDevPaasAppViewMobileMenuComponentOptionsCommand)(context, options)));
9132
+ .action((0, command_ts_1.createCommandAction)('app-dev', 'paas-app.app-view-mobile-menu-component-options', runtimeContext, async ({ options, context }) => (0, index_ts_1.appDevAppViewMobileMenuComponentOptionsCommand)(context, options)));
9176
9133
  };
9177
9134
  exports.registerAppDevNamespace = registerAppDevNamespace;
9178
9135
 
@@ -10623,6 +10580,35 @@ function registerEmailNamespace(program, runtimeContext) {
10623
10580
  }
10624
10581
 
10625
10582
 
10583
+ /***/ },
10584
+
10585
+ /***/ 5249
10586
+ (__unused_webpack_module, exports, __webpack_require__) {
10587
+
10588
+
10589
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
10590
+ exports.registerErNamespace = registerErNamespace;
10591
+ const index_ts_1 = __webpack_require__(1474);
10592
+ /**
10593
+ * 注册 er 命名空间(透传命令,全部参数直接透传操作中心 data)
10594
+ * 命令路径与操作中心 commandPath 完全一致
10595
+ */
10596
+ function registerErNamespace(program, runtimeContext) {
10597
+ const er = program.command('er').description('Enterprise resource commands');
10598
+ const passthrough = new index_ts_1.PassthroughCommandManager(er, { namespace: 'er', runtimeContext });
10599
+ passthrough
10600
+ .command('wechat')
10601
+ .command('queryWechatTemplates')
10602
+ .description('Query WeChat union message templates (passthrough to operation center)')
10603
+ .requiredOption('--appId <appId>', 'WeChat app id')
10604
+ .route({
10605
+ examples: [
10606
+ '$ sharedev er wechat queryWechatTemplates --appId wx3ce8441bd6cddce9',
10607
+ ],
10608
+ });
10609
+ }
10610
+
10611
+
10626
10612
  /***/ },
10627
10613
 
10628
10614
  /***/ 7843
@@ -11545,6 +11531,7 @@ const data_ts_1 = __webpack_require__(7170);
11545
11531
  const email_ts_1 = __webpack_require__(4952);
11546
11532
  const bi_ts_1 = __webpack_require__(9959);
11547
11533
  const erpdss_ts_1 = __webpack_require__(7843);
11534
+ const er_ts_1 = __webpack_require__(5249);
11548
11535
  const access_ts_1 = __webpack_require__(1696);
11549
11536
  const app_dev_ts_1 = __webpack_require__(4041);
11550
11537
  function registerNamespaces(program, context) {
@@ -11573,6 +11560,7 @@ function registerNamespaces(program, context) {
11573
11560
  (0, email_ts_1.registerEmailNamespace)(program, context);
11574
11561
  (0, bi_ts_1.registerBiNamespace)(program, context);
11575
11562
  (0, erpdss_ts_1.registerErpdssNamespace)(program, context);
11563
+ (0, er_ts_1.registerErNamespace)(program, context);
11576
11564
  (0, access_ts_1.registerAccessNamespace)(program, context);
11577
11565
  (0, app_dev_ts_1.registerAppDevNamespace)(program, context);
11578
11566
  }
@@ -11769,14 +11757,14 @@ Examples:
11769
11757
  .action((0, command_ts_1.createCommandAction)('interface-dev', 'web-navigation.list', runtimeContext, async ({ options }) => (0, index_ts_1.interfaceDevWebNavigationListCommand)(options)));
11770
11758
  webNavigationCommand
11771
11759
  .command('create')
11772
- .description('Create a local Web main navigation XML file (writes local only, push to sync remote)')
11760
+ .description('Create a local Web main navigation XML file')
11773
11761
  .requiredOption('--apiName <apiName>', 'Custom apiName ending with __c')
11774
11762
  .requiredOption('--content <json>', 'Complete Web main navigation content as a JSON object')
11775
11763
  .option('--force', 'Force overwrite local XML file if it already exists')
11776
11764
  .action((0, command_ts_1.createCommandAction)('interface-dev', 'web-navigation.create', runtimeContext, async ({ options }) => (0, index_ts_1.interfaceDevWebNavigationCreateCommand)(options)));
11777
11765
  webNavigationCommand
11778
11766
  .command('update')
11779
- .description('Update a local Web main navigation XML file (writes local only, push to sync remote)')
11767
+ .description('Update a local Web main navigation XML file')
11780
11768
  .requiredOption('--apiName <apiName>', 'Web main navigation apiName (local XML file name)')
11781
11769
  .requiredOption('--content <json>', 'Complete Web main navigation content as a JSON object')
11782
11770
  .action((0, command_ts_1.createCommandAction)('interface-dev', 'web-navigation.update', runtimeContext, async ({ options }) => (0, index_ts_1.interfaceDevWebNavigationUpdateCommand)(options)));
@@ -11819,14 +11807,14 @@ Examples:
11819
11807
  .action((0, command_ts_1.createCommandAction)('interface-dev', 'mobile-navigation.icon-list', runtimeContext, async () => (0, index_ts_1.interfaceDevMobileNavigationIconListCommand)()));
11820
11808
  mobileNavigationCommand
11821
11809
  .command('create')
11822
- .description('Create a local mobile main navigation XML file (writes local only, push to sync remote)')
11810
+ .description('Create a local mobile main navigation XML file')
11823
11811
  .requiredOption('--localkey <localkey>', 'Local key identifier (letters/numbers/underscores, max 50 chars); file is named local-<localkey>')
11824
11812
  .requiredOption('--content <json>', 'Mobile main navigation fields as a JSON object')
11825
11813
  .option('--force', 'Force overwrite local XML file if it already exists')
11826
11814
  .action((0, command_ts_1.createCommandAction)('interface-dev', 'mobile-navigation.create', runtimeContext, async ({ options }) => (0, index_ts_1.interfaceDevMobileNavigationCreateCommand)(options)));
11827
11815
  mobileNavigationCommand
11828
11816
  .command('update')
11829
- .description('Update a local mobile main navigation XML file (writes local only, push to sync remote)')
11817
+ .description('Update a local mobile main navigation XML file')
11830
11818
  .requiredOption('--id <id>', 'Mobile navigation id (local XML file name: server id or local-<localkey>)')
11831
11819
  .requiredOption('--content <json>', 'Mobile main navigation fields as a JSON object')
11832
11820
  .action((0, command_ts_1.createCommandAction)('interface-dev', 'mobile-navigation.update', runtimeContext, async ({ options }) => (0, index_ts_1.interfaceDevMobileNavigationUpdateCommand)(options)));
@@ -14285,6 +14273,7 @@ function prefix(message) {
14285
14273
  class LoggerService {
14286
14274
  constructor() {
14287
14275
  this.verboseEnabled = false;
14276
+ this.traceIds = [];
14288
14277
  this.spinnerState = { mode: 'ora', textActive: false };
14289
14278
  this.downloadProgressMap = new Map();
14290
14279
  this.downloadReporterSeq = 0;
@@ -14715,11 +14704,42 @@ class LoggerService {
14715
14704
  console.warn(chalk_1.default.yellow(withPrefix(line, DEFAULT_PREFIX)));
14716
14705
  });
14717
14706
  }
14707
+ /**
14708
+ * 记录本次执行产生的业务请求 traceId,供后续报错一并输出。
14709
+ * @param traceId 本次请求注入的 traceId
14710
+ */
14711
+ addTraceId(traceId) {
14712
+ if (!traceId || this.traceIds.includes(traceId)) {
14713
+ return;
14714
+ }
14715
+ this.traceIds.push(traceId);
14716
+ }
14717
+ /**
14718
+ * 读取本次执行已记录的全部业务请求 traceId。
14719
+ * @returns 按产生顺序排列的 traceId 列表
14720
+ */
14721
+ getTraceIds() {
14722
+ return [...this.traceIds];
14723
+ }
14724
+ /**
14725
+ * 清空本次执行已记录的业务请求 traceId。
14726
+ */
14727
+ clearTraceIds() {
14728
+ this.traceIds = [];
14729
+ }
14718
14730
  error(message) {
14719
14731
  this.ensureSpinnerStoppedBeforeOutput();
14720
14732
  message.split('\n').forEach((line) => {
14721
14733
  console.error(chalk_1.default.red(withPrefix(line, DEFAULT_PREFIX)));
14722
14734
  });
14735
+ this.printTraceIdsIfNeeded(message);
14736
+ }
14737
+ printTraceIdsIfNeeded(message) {
14738
+ const pending = this.traceIds.filter((traceId) => !message.includes(traceId));
14739
+ if (pending.length === 0) {
14740
+ return;
14741
+ }
14742
+ console.error(chalk_1.default.red(withPrefix(`traceId=${pending.join(', ')}`, DEFAULT_PREFIX)));
14723
14743
  }
14724
14744
  debug(message) {
14725
14745
  if (!this.verboseEnabled) {
@@ -15376,10 +15396,10 @@ const SHARE_CLI_COMMAND_PATH_MAP = {
15376
15396
  interfaceDev: {
15377
15397
  webCustomPageList: ['interface-dev', 'web-custom-page', 'list'],
15378
15398
  mobileCustomPageList: ['interface-dev', 'mobile-custom-page', 'list'],
15379
- webCustomPageCreate: ['interface-dev', 'custom-page', 'web-create'],
15380
- mobileCustomPageCreate: ['interface-dev', 'custom-page', 'mobile-create'],
15381
- webCustomPageUpdate: ['interface-dev', 'custom-page', 'web-update'],
15382
- mobileCustomPageUpdate: ['interface-dev', 'custom-page', 'mobile-update'],
15399
+ webCustomPageCreate: ['interface-dev', 'web-custom-page', 'create'],
15400
+ mobileCustomPageCreate: ['interface-dev', 'mobile-custom-page', 'create'],
15401
+ webCustomPageUpdate: ['interface-dev', 'web-custom-page', 'update'],
15402
+ mobileCustomPageUpdate: ['interface-dev', 'mobile-custom-page', 'update'],
15383
15403
  mobileCustomPagePageComponents: ['interface-dev', 'mobile-custom-page', 'page-components'],
15384
15404
  mobileCustomPageMenuComponents: ['interface-dev', 'mobile-custom-page', 'menu-components'],
15385
15405
  webNavigationList: ['interface-dev', 'web-navigation', 'list'],
@@ -15488,11 +15508,11 @@ function detectSystemLanguage() {
15488
15508
  const raw = process.env.LC_ALL || process.env.LC_MESSAGES || process.env.LANG;
15489
15509
  return normalize_ts_1.default.normalizeAcceptLanguage(raw) ?? 'zh-CN';
15490
15510
  }
15511
+ function isBusinessRequest(config) {
15512
+ return !config?.__sharedevNoDebug && !config?.__sharedevSkipInterceptor;
15513
+ }
15491
15514
  function shouldWriteDebugLog(config) {
15492
- if (config?.__sharedevNoDebug || config?.__sharedevSkipInterceptor) {
15493
- return false;
15494
- }
15495
- return true;
15515
+ return isBusinessRequest(config) && (0, debug_ts_1.isRuntimeDebugEnabled)();
15496
15516
  }
15497
15517
  function isBusinessFailure(response) {
15498
15518
  if (!response || typeof response !== 'object' || Array.isArray(response)) {
@@ -15562,13 +15582,6 @@ async function writeRequestDebug(meta, response, responseHeaders, status, succes
15562
15582
  return undefined;
15563
15583
  }
15564
15584
  }
15565
- function reportFailedRequest(meta, debugFilePath) {
15566
- const lines = [`Request failed. traceId=${meta.traceId}`];
15567
- if (debugFilePath) {
15568
- lines.push(`Debug record: ${debugFilePath}`);
15569
- }
15570
- logger_ts_1.loggerService.error(lines.join('\n'));
15571
- }
15572
15585
  class RequestService {
15573
15586
  configure(settings) {
15574
15587
  this.settings = settings;
@@ -15587,6 +15600,10 @@ class RequestService {
15587
15600
  logger_ts_1.loggerService.debug(`request ${config.method?.toUpperCase() ?? 'GET'} ${config.baseURL ?? ''}${config.url ?? ''}`);
15588
15601
  const traceableConfig = config;
15589
15602
  const traceId = generateTraceId();
15603
+ // 仅记录业务请求的 traceId,避免 identity / 埋点请求覆盖
15604
+ if (isBusinessRequest(traceableConfig)) {
15605
+ logger_ts_1.loggerService.addTraceId(traceId);
15606
+ }
15590
15607
  traceableConfig.__sharedevTraceMeta = {
15591
15608
  traceId,
15592
15609
  fullUrl: buildFullRequestUrl(config),
@@ -15624,10 +15641,7 @@ class RequestService {
15624
15641
  if (shouldWriteDebugLog(traceableConfig)) {
15625
15642
  const success = !isBusinessFailure(response.data);
15626
15643
  const debugFilePath = await writeRequestDebug(meta, response.data, response.headers, response.status, success);
15627
- if (!success) {
15628
- reportFailedRequest(meta, debugFilePath);
15629
- }
15630
- else if ((0, debug_ts_1.isRuntimeDebugEnabled)() && debugFilePath) {
15644
+ if (debugFilePath) {
15631
15645
  logger_ts_1.loggerService.info(`Debug record written to ${debugFilePath}`);
15632
15646
  }
15633
15647
  }
@@ -15646,7 +15660,9 @@ class RequestService {
15646
15660
  }
15647
15661
  if (shouldWriteDebugLog(traceableConfig)) {
15648
15662
  const debugFilePath = await writeRequestDebug(meta, error.response?.data ?? { message: error.message }, error.response?.headers, error.response?.status, false);
15649
- reportFailedRequest(meta, debugFilePath);
15663
+ if (debugFilePath) {
15664
+ logger_ts_1.loggerService.info(`Debug record written to ${debugFilePath}`);
15665
+ }
15650
15666
  }
15651
15667
  }
15652
15668
  return Promise.reject(error);
@@ -18442,48 +18458,291 @@ async function writeAplSnapshot(context, input) {
18442
18458
 
18443
18459
  /***/ },
18444
18460
 
18445
- /***/ 7564
18461
+ /***/ 8023
18446
18462
  (__unused_webpack_module, exports, __webpack_require__) {
18447
18463
 
18448
18464
 
18449
- var __importDefault = (this && this.__importDefault) || function (mod) {
18450
- return (mod && mod.__esModule) ? mod : { "default": mod };
18465
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
18466
+ exports.appDevAppViewMobileListCommand = appDevAppViewMobileListCommand;
18467
+ exports.appDevAppViewMobileDetailCommand = appDevAppViewMobileDetailCommand;
18468
+ exports.appDevAppViewMobileCreateCommand = appDevAppViewMobileCreateCommand;
18469
+ exports.appDevAppViewMobileUpdateCommand = appDevAppViewMobileUpdateCommand;
18470
+ exports.appDevAppViewMobilePullCommand = appDevAppViewMobilePullCommand;
18471
+ exports.appDevAppViewMobilePushCommand = appDevAppViewMobilePushCommand;
18472
+ exports.appDevAppViewMobilePageComponentOptionsCommand = appDevAppViewMobilePageComponentOptionsCommand;
18473
+ exports.appDevAppViewMobileMenuComponentOptionsCommand = appDevAppViewMobileMenuComponentOptionsCommand;
18474
+ const logger_ts_1 = __webpack_require__(3333);
18475
+ const app_view_mobile_create_ts_1 = __webpack_require__(4091);
18476
+ const app_view_mobile_detail_ts_1 = __webpack_require__(1646);
18477
+ const app_view_mobile_list_ts_1 = __webpack_require__(2299);
18478
+ const app_view_mobile_menu_component_options_ts_1 = __webpack_require__(3133);
18479
+ const app_view_mobile_page_component_options_ts_1 = __webpack_require__(9897);
18480
+ const app_view_mobile_pull_ts_1 = __webpack_require__(4124);
18481
+ const app_view_mobile_push_ts_1 = __webpack_require__(215);
18482
+ const app_view_mobile_update_ts_1 = __webpack_require__(4976);
18483
+ const app_view_shared_ts_1 = __webpack_require__(2518);
18484
+ const isJsonObject = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
18485
+ const parseRequiredString = (value, optionName) => {
18486
+ const parsed = value?.trim();
18487
+ if (!parsed) {
18488
+ throw new Error(`${optionName} is required.`);
18489
+ }
18490
+ return parsed;
18491
+ };
18492
+ const parsePositiveInteger = (value, optionName, max) => {
18493
+ if (value === undefined) {
18494
+ return undefined;
18495
+ }
18496
+ const parsed = Number(value);
18497
+ if (!Number.isSafeInteger(parsed) || parsed <= 0 || (max !== undefined && parsed > max)) {
18498
+ const maxHint = max === undefined ? '' : ` and at most ${max}`;
18499
+ throw new Error(`${optionName} must be a positive integer${maxHint}.`);
18500
+ }
18501
+ return parsed;
18502
+ };
18503
+ const parseUpdateTime = (value) => {
18504
+ if (value === undefined) {
18505
+ return undefined;
18506
+ }
18507
+ return parsePositiveInteger(value, '--updateTime');
18508
+ };
18509
+ const printResponse = (response, commandName) => {
18510
+ logger_ts_1.loggerService.printJson(response);
18511
+ if (isJsonObject(response) && response.success === true && response.code === 'OK') {
18512
+ return;
18513
+ }
18514
+ const message = isJsonObject(response) && typeof response.message === 'string' && response.message.trim()
18515
+ ? response.message.trim() : 'Unknown server error.';
18516
+ throw new Error(`${commandName} failed: ${message}`);
18517
+ };
18518
+ const runCommand = async (loadingMessage, commandName, operation) => {
18519
+ logger_ts_1.loggerService.startLoading(loadingMessage);
18520
+ try {
18521
+ printResponse(await operation(), commandName);
18522
+ }
18523
+ finally {
18524
+ logger_ts_1.loggerService.stopLoading();
18525
+ }
18451
18526
  };
18527
+ const parseListInput = (options) => ({
18528
+ appId: parseRequiredString(options.appId, '--appId'),
18529
+ pageNum: parsePositiveInteger(options.pageNum, '--pageNum'),
18530
+ pageSize: parsePositiveInteger(options.pageSize, '--pageSize', 100),
18531
+ });
18532
+ async function appDevAppViewMobileListCommand(context, options) {
18533
+ void context;
18534
+ await runCommand('Listing PaaS application Mobile views...', 'app-view-mobile-list', () => (0, app_view_mobile_list_ts_1.appViewMobileListService)(parseListInput(options)));
18535
+ }
18536
+ async function appDevAppViewMobileDetailCommand(context, options) {
18537
+ void context;
18538
+ await runCommand('Loading the PaaS application Mobile view...', 'app-view-mobile-detail', () => (0, app_view_mobile_detail_ts_1.appViewMobileDetailService)({ templateId: parseRequiredString(options.templateId, '--templateId') }));
18539
+ }
18540
+ async function appDevAppViewMobileCreateCommand(context, options) {
18541
+ void context;
18542
+ const content = (0, app_view_shared_ts_1.parseAppViewContent)(options.content);
18543
+ const result = await (0, app_view_mobile_create_ts_1.appViewMobileCreateService)(options.localKey, content, { force: options.force === true });
18544
+ if (result.errorMessages.length) {
18545
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18546
+ return;
18547
+ }
18548
+ logger_ts_1.loggerService.success(`Local Mobile application view created: ${result.filePath}`);
18549
+ }
18550
+ async function appDevAppViewMobileUpdateCommand(context, options) {
18551
+ void context;
18552
+ const content = (0, app_view_shared_ts_1.parseAppViewContent)(options.content);
18553
+ const result = await (0, app_view_mobile_update_ts_1.appViewMobileUpdateService)(options.templateId, content, parseUpdateTime(options.updateTime));
18554
+ if (result.errorMessages.length) {
18555
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18556
+ return;
18557
+ }
18558
+ logger_ts_1.loggerService.success(`Local Mobile application view updated: ${result.filePath}`);
18559
+ }
18560
+ async function appDevAppViewMobilePullCommand(context, options) {
18561
+ void context;
18562
+ const result = await (0, app_view_mobile_pull_ts_1.appViewMobilePullService)(parseRequiredString(options.appId, '--appId'), {
18563
+ pageNum: parsePositiveInteger(options.pageNum, '--pageNum'),
18564
+ pageSize: parsePositiveInteger(options.pageSize, '--pageSize', 100),
18565
+ force: options.force === true,
18566
+ yes: options.yes === true,
18567
+ });
18568
+ if (result.errorMessages.length) {
18569
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18570
+ }
18571
+ logger_ts_1.loggerService.success(`Mobile view pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
18572
+ }
18573
+ async function appDevAppViewMobilePushCommand(context, options) {
18574
+ void context;
18575
+ const result = await (0, app_view_mobile_push_ts_1.appViewMobilePushService)({
18576
+ all: options.all,
18577
+ templateId: options.templateId,
18578
+ skipOverwriteConfirm: options.yes === true,
18579
+ });
18580
+ if (result.errorMessages.length) {
18581
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18582
+ }
18583
+ logger_ts_1.loggerService.success(`Mobile view push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
18584
+ }
18585
+ async function appDevAppViewMobilePageComponentOptionsCommand(context, _options) {
18586
+ void context;
18587
+ await runCommand('Loading PaaS application Mobile page component options...', 'app-view-mobile-page-component-options', () => (0, app_view_mobile_page_component_options_ts_1.appViewMobilePageComponentOptionsService)());
18588
+ }
18589
+ async function appDevAppViewMobileMenuComponentOptionsCommand(context, _options) {
18590
+ void context;
18591
+ await runCommand('Loading PaaS application Mobile menu component options...', 'app-view-mobile-menu-component-options', () => (0, app_view_mobile_menu_component_options_ts_1.appViewMobileMenuComponentOptionsService)());
18592
+ }
18593
+
18594
+
18595
+ /***/ },
18596
+
18597
+ /***/ 1579
18598
+ (__unused_webpack_module, exports, __webpack_require__) {
18599
+
18600
+
18452
18601
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18453
- exports.isAppDevRecord = void 0;
18454
- exports.requestAppDevExecute = requestAppDevExecute;
18455
- exports.extractAppDevServiceResult = extractAppDevServiceResult;
18456
- const request_execute_ts_1 = __webpack_require__(8554);
18457
- const normalize_ts_1 = __importDefault(__webpack_require__(9268));
18458
- const isRecordLike = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
18459
- exports.isAppDevRecord = isRecordLike;
18460
- /** executeShareCliCommand 返回的 unknown 安全转换为 AppDevResponse */
18461
- async function requestAppDevExecute(commandPath, data, others) {
18462
- const response = await (0, request_execute_ts_1.executeShareCliCommand)(commandPath, data, others);
18463
- if (!isRecordLike(response)) {
18464
- throw new Error('Response is not an object or is empty.');
18602
+ exports.appDevAppViewWebListCommand = appDevAppViewWebListCommand;
18603
+ exports.appDevAppViewWebDetailCommand = appDevAppViewWebDetailCommand;
18604
+ exports.appDevAppViewWebCreateCommand = appDevAppViewWebCreateCommand;
18605
+ exports.appDevAppViewWebUpdateCommand = appDevAppViewWebUpdateCommand;
18606
+ exports.appDevAppViewWebPullCommand = appDevAppViewWebPullCommand;
18607
+ exports.appDevAppViewWebPushCommand = appDevAppViewWebPushCommand;
18608
+ exports.appDevAppViewWebMenuOptionsCommand = appDevAppViewWebMenuOptionsCommand;
18609
+ exports.appDevAppViewWebLayoutComponentOptionsCommand = appDevAppViewWebLayoutComponentOptionsCommand;
18610
+ exports.appDevAppViewWebUtilityBarComponentOptionsCommand = appDevAppViewWebUtilityBarComponentOptionsCommand;
18611
+ exports.appDevAppViewWebUtilityBarIconOptionsCommand = appDevAppViewWebUtilityBarIconOptionsCommand;
18612
+ const logger_ts_1 = __webpack_require__(3333);
18613
+ const app_view_web_create_ts_1 = __webpack_require__(9371);
18614
+ const app_view_web_detail_ts_1 = __webpack_require__(5822);
18615
+ const app_view_web_layout_component_options_ts_1 = __webpack_require__(1060);
18616
+ const app_view_web_list_ts_1 = __webpack_require__(1771);
18617
+ const app_view_web_menu_options_ts_1 = __webpack_require__(9515);
18618
+ const app_view_web_pull_ts_1 = __webpack_require__(6572);
18619
+ const app_view_web_push_ts_1 = __webpack_require__(8087);
18620
+ const app_view_web_update_ts_1 = __webpack_require__(1926);
18621
+ const app_view_web_utility_bar_component_options_ts_1 = __webpack_require__(3698);
18622
+ const app_view_web_utility_bar_icon_options_ts_1 = __webpack_require__(4066);
18623
+ const app_view_shared_ts_1 = __webpack_require__(2518);
18624
+ const isJsonObject = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
18625
+ const parseRequiredString = (value, optionName) => {
18626
+ const parsed = value?.trim();
18627
+ if (!parsed) {
18628
+ throw new Error(`${optionName} is required.`);
18465
18629
  }
18466
- return response;
18630
+ return parsed;
18631
+ };
18632
+ const parsePositiveInteger = (value, optionName, max) => {
18633
+ if (value === undefined) {
18634
+ return undefined;
18635
+ }
18636
+ const parsed = Number(value);
18637
+ if (!Number.isSafeInteger(parsed) || parsed <= 0 || (max !== undefined && parsed > max)) {
18638
+ const maxHint = max === undefined ? '' : ` and at most ${max}`;
18639
+ throw new Error(`${optionName} must be a positive integer${maxHint}.`);
18640
+ }
18641
+ return parsed;
18642
+ };
18643
+ const parseUpdateTime = (value) => {
18644
+ if (value === undefined) {
18645
+ return undefined;
18646
+ }
18647
+ return parsePositiveInteger(value, '--updateTime');
18648
+ };
18649
+ const printResponse = (response, commandName) => {
18650
+ logger_ts_1.loggerService.printJson(response);
18651
+ if (isJsonObject(response) && response.success === true && response.code === 'OK') {
18652
+ return;
18653
+ }
18654
+ const message = isJsonObject(response) && typeof response.message === 'string' && response.message.trim()
18655
+ ? response.message.trim() : 'Unknown server error.';
18656
+ throw new Error(`${commandName} failed: ${message}`);
18657
+ };
18658
+ const runCommand = async (loadingMessage, commandName, operation) => {
18659
+ logger_ts_1.loggerService.startLoading(loadingMessage);
18660
+ try {
18661
+ printResponse(await operation(), commandName);
18662
+ }
18663
+ finally {
18664
+ logger_ts_1.loggerService.stopLoading();
18665
+ }
18666
+ };
18667
+ const parseListInput = (options) => ({
18668
+ appId: parseRequiredString(options.appId, '--appId'),
18669
+ pageNum: parsePositiveInteger(options.pageNum, '--pageNum'),
18670
+ pageSize: parsePositiveInteger(options.pageSize, '--pageSize', 100),
18671
+ });
18672
+ async function appDevAppViewWebListCommand(context, options) {
18673
+ void context;
18674
+ await runCommand('Listing PaaS application Web views...', 'app-view-web-list', () => (0, app_view_web_list_ts_1.appViewWebListService)(parseListInput(options)));
18467
18675
  }
18468
- /** 从操作中心响应中提取业务结果(success === true && code === 'OK') */
18469
- async function extractAppDevServiceResult(response, dataGetter) {
18470
- if (!isRecordLike(response)) {
18471
- throw new Error('Response is not an object or is empty.');
18676
+ async function appDevAppViewWebDetailCommand(context, options) {
18677
+ void context;
18678
+ await runCommand('Loading the PaaS application Web view...', 'app-view-web-detail', () => (0, app_view_web_detail_ts_1.appViewWebDetailService)({ templateId: parseRequiredString(options.templateId, '--templateId') }));
18679
+ }
18680
+ async function appDevAppViewWebCreateCommand(context, options) {
18681
+ void context;
18682
+ const content = (0, app_view_shared_ts_1.parseAppViewContent)(options.content);
18683
+ const result = await (0, app_view_web_create_ts_1.appViewWebCreateService)(options.localKey, content, { force: options.force === true });
18684
+ if (result.errorMessages.length) {
18685
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18686
+ return;
18472
18687
  }
18473
- if (response.success === true && response.code === 'OK') {
18474
- return { success: true, errorMessage: '', data: dataGetter(response) };
18688
+ logger_ts_1.loggerService.success(`Local Web application view created: ${result.filePath}`);
18689
+ }
18690
+ async function appDevAppViewWebUpdateCommand(context, options) {
18691
+ void context;
18692
+ const content = (0, app_view_shared_ts_1.parseAppViewContent)(options.content);
18693
+ const result = await (0, app_view_web_update_ts_1.appViewWebUpdateService)(options.templateId, content, parseUpdateTime(options.updateTime));
18694
+ if (result.errorMessages.length) {
18695
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18696
+ return;
18475
18697
  }
18476
- return {
18477
- success: false,
18478
- errorMessage: normalize_ts_1.default.normalizeText(response.message) || 'Unknown error.',
18479
- data: undefined,
18480
- };
18698
+ logger_ts_1.loggerService.success(`Local Web application view updated: ${result.filePath}`);
18699
+ }
18700
+ async function appDevAppViewWebPullCommand(context, options) {
18701
+ void context;
18702
+ const result = await (0, app_view_web_pull_ts_1.appViewWebPullService)(parseRequiredString(options.appId, '--appId'), {
18703
+ pageNum: parsePositiveInteger(options.pageNum, '--pageNum'),
18704
+ pageSize: parsePositiveInteger(options.pageSize, '--pageSize', 100),
18705
+ force: options.force === true,
18706
+ yes: options.yes === true,
18707
+ });
18708
+ if (result.errorMessages.length) {
18709
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18710
+ }
18711
+ logger_ts_1.loggerService.success(`Web view pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
18712
+ }
18713
+ async function appDevAppViewWebPushCommand(context, options) {
18714
+ void context;
18715
+ const result = await (0, app_view_web_push_ts_1.appViewWebPushService)({
18716
+ all: options.all,
18717
+ templateId: options.templateId,
18718
+ skipOverwriteConfirm: options.yes === true,
18719
+ });
18720
+ if (result.errorMessages.length) {
18721
+ result.errorMessages.forEach((e) => logger_ts_1.loggerService.error(e));
18722
+ }
18723
+ logger_ts_1.loggerService.success(`Web view push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
18724
+ }
18725
+ async function appDevAppViewWebMenuOptionsCommand(context, _options) {
18726
+ void context;
18727
+ await runCommand('Loading PaaS application Web menu options...', 'app-view-web-menu-options', () => (0, app_view_web_menu_options_ts_1.appViewWebMenuOptionsService)());
18728
+ }
18729
+ async function appDevAppViewWebLayoutComponentOptionsCommand(context, _options) {
18730
+ void context;
18731
+ await runCommand('Loading PaaS application Web layout component options...', 'app-view-web-layout-component-options', () => (0, app_view_web_layout_component_options_ts_1.appViewWebLayoutComponentOptionsService)());
18732
+ }
18733
+ async function appDevAppViewWebUtilityBarComponentOptionsCommand(context, options) {
18734
+ void context;
18735
+ await runCommand('Loading PaaS application Web utility bar component options...', 'app-view-web-utility-bar-component-options', () => (0, app_view_web_utility_bar_component_options_ts_1.appViewWebUtilityBarComponentOptionsService)({ appId: parseRequiredString(options.appId, '--appId') }));
18736
+ }
18737
+ async function appDevAppViewWebUtilityBarIconOptionsCommand(context, options) {
18738
+ void context;
18739
+ await runCommand('Loading PaaS application Web utility bar icon options...', 'app-view-web-utility-bar-icon-options', () => (0, app_view_web_utility_bar_icon_options_ts_1.appViewWebUtilityBarIconOptionsService)({ appId: parseRequiredString(options.appId, '--appId') }));
18481
18740
  }
18482
18741
 
18483
18742
 
18484
18743
  /***/ },
18485
18744
 
18486
- /***/ 4815
18745
+ /***/ 8645
18487
18746
  (__unused_webpack_module, exports, __webpack_require__) {
18488
18747
 
18489
18748
 
@@ -18491,17 +18750,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18491
18750
  return (mod && mod.__esModule) ? mod : { "default": mod };
18492
18751
  };
18493
18752
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18494
- exports.appDevCustomAppPushCommand = exports.appDevCustomAppPullCommand = exports.appDevCustomAppUpdateCommand = exports.appDevCustomAppCreateCommand = exports.appDevCustomAppListCommand = void 0;
18753
+ exports.appDevCustomAppListCommand = appDevCustomAppListCommand;
18754
+ exports.appDevCustomAppCreateCommand = appDevCustomAppCreateCommand;
18755
+ exports.appDevCustomAppUpdateCommand = appDevCustomAppUpdateCommand;
18756
+ exports.appDevCustomAppPullCommand = appDevCustomAppPullCommand;
18757
+ exports.appDevCustomAppPushCommand = appDevCustomAppPushCommand;
18495
18758
  const logger_ts_1 = __webpack_require__(3333);
18496
18759
  const normalize_ts_1 = __importDefault(__webpack_require__(9268));
18497
- const app_dev_shared_ts_1 = __webpack_require__(7564);
18498
- const custom_app_service_ts_1 = __webpack_require__(5033);
18760
+ const request_ts_1 = __webpack_require__(6272);
18761
+ const custom_app_create_ts_1 = __webpack_require__(6500);
18762
+ const custom_app_list_ts_1 = __webpack_require__(8);
18763
+ const custom_app_pull_ts_1 = __webpack_require__(7543);
18764
+ const custom_app_push_ts_1 = __webpack_require__(2852);
18765
+ const custom_app_update_ts_1 = __webpack_require__(133);
18499
18766
  const getCustomAppListItems = (response) => {
18500
18767
  const data = response.data;
18501
18768
  if (!Array.isArray(data)) {
18502
18769
  return [];
18503
18770
  }
18504
- return data.filter(app_dev_shared_ts_1.isAppDevRecord);
18771
+ return data.filter(request_ts_1.isAppDevRecord);
18505
18772
  };
18506
18773
  const printErrorMessages = (errorMessages) => {
18507
18774
  if (!errorMessages.length) {
@@ -18510,12 +18777,12 @@ const printErrorMessages = (errorMessages) => {
18510
18777
  errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
18511
18778
  return true;
18512
18779
  };
18513
- const appDevCustomAppListCommand = async (context, options) => {
18780
+ async function appDevCustomAppListCommand(context, options) {
18514
18781
  void context;
18515
18782
  const nameKeyword = options.nameKeyword?.trim() || undefined;
18516
18783
  logger_ts_1.loggerService.startLoading('Listing enterprise custom applications...');
18517
18784
  try {
18518
- const response = await (0, custom_app_service_ts_1.customAppListService)({ nameKeyword });
18785
+ const response = await (0, custom_app_list_ts_1.customAppListService)({ nameKeyword });
18519
18786
  if (options.json) {
18520
18787
  logger_ts_1.loggerService.printJson(response);
18521
18788
  return;
@@ -18533,11 +18800,10 @@ const appDevCustomAppListCommand = async (context, options) => {
18533
18800
  finally {
18534
18801
  logger_ts_1.loggerService.stopLoading();
18535
18802
  }
18536
- };
18537
- exports.appDevCustomAppListCommand = appDevCustomAppListCommand;
18538
- const appDevCustomAppCreateCommand = async (context, options) => {
18803
+ }
18804
+ async function appDevCustomAppCreateCommand(context, options) {
18539
18805
  void context;
18540
- const result = await (0, custom_app_service_ts_1.customAppCreateService)(options.localKey ?? options.localkey, options.content, {
18806
+ const result = await (0, custom_app_create_ts_1.customAppCreateService)(options.localKey ?? options.localkey, options.content, {
18541
18807
  force: options.force === true,
18542
18808
  });
18543
18809
  if (printErrorMessages(result.errorMessages)) {
@@ -18548,11 +18814,10 @@ const appDevCustomAppCreateCommand = async (context, options) => {
18548
18814
  }
18549
18815
  logger_ts_1.loggerService.success('Command completed: custom-app create');
18550
18816
  logger_ts_1.loggerService.info(`Custom app metadata created: ${result.filePath}`);
18551
- };
18552
- exports.appDevCustomAppCreateCommand = appDevCustomAppCreateCommand;
18553
- const appDevCustomAppUpdateCommand = async (context, options) => {
18817
+ }
18818
+ async function appDevCustomAppUpdateCommand(context, options) {
18554
18819
  void context;
18555
- const result = await (0, custom_app_service_ts_1.customAppUpdateService)(options.appId, options.content);
18820
+ const result = await (0, custom_app_update_ts_1.customAppUpdateService)(options.appId, options.content);
18556
18821
  if (printErrorMessages(result.errorMessages)) {
18557
18822
  return;
18558
18823
  }
@@ -18561,20 +18826,18 @@ const appDevCustomAppUpdateCommand = async (context, options) => {
18561
18826
  }
18562
18827
  logger_ts_1.loggerService.success('Command completed: custom-app update');
18563
18828
  logger_ts_1.loggerService.info(`Custom app metadata updated: ${result.filePath}`);
18564
- };
18565
- exports.appDevCustomAppUpdateCommand = appDevCustomAppUpdateCommand;
18566
- const appDevCustomAppPullCommand = async (context, options) => {
18829
+ }
18830
+ async function appDevCustomAppPullCommand(context, options) {
18567
18831
  void context;
18568
- const result = await (0, custom_app_service_ts_1.customAppPullService)({ nameKeyword: options.nameKeyword?.trim() || undefined }, false, options.force === true, options.yes === true);
18832
+ const result = await (0, custom_app_pull_ts_1.customAppPullService)({ nameKeyword: options.nameKeyword?.trim() || undefined }, false, options.force === true, options.yes === true);
18569
18833
  if (printErrorMessages(result.errorMessages)) {
18570
18834
  return;
18571
18835
  }
18572
18836
  logger_ts_1.loggerService.success(`Custom app pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
18573
- };
18574
- exports.appDevCustomAppPullCommand = appDevCustomAppPullCommand;
18575
- const appDevCustomAppPushCommand = async (context, options) => {
18837
+ }
18838
+ async function appDevCustomAppPushCommand(context, options) {
18576
18839
  void context;
18577
- const result = await (0, custom_app_service_ts_1.customAppPushService)({
18840
+ const result = await (0, custom_app_push_ts_1.customAppPushService)({
18578
18841
  all: options.all,
18579
18842
  appId: options.appId,
18580
18843
  skipOverwriteConfirm: options.yes === true,
@@ -18583,57 +18846,54 @@ const appDevCustomAppPushCommand = async (context, options) => {
18583
18846
  return;
18584
18847
  }
18585
18848
  logger_ts_1.loggerService.success(`Custom app push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
18586
- };
18587
- exports.appDevCustomAppPushCommand = appDevCustomAppPushCommand;
18849
+ }
18588
18850
 
18589
18851
 
18590
18852
  /***/ },
18591
18853
 
18592
- /***/ 3216
18854
+ /***/ 4355
18593
18855
  (__unused_webpack_module, exports, __webpack_require__) {
18594
18856
 
18595
18857
 
18596
- var __importDefault = (this && this.__importDefault) || function (mod) {
18597
- return (mod && mod.__esModule) ? mod : { "default": mod };
18598
- };
18599
18858
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18600
- exports.customAppCreateService = customAppCreateService;
18601
- const normalize_ts_1 = __importDefault(__webpack_require__(9268));
18602
- const index_ts_1 = __webpack_require__(9985);
18603
- const custom_app_service_ts_1 = __webpack_require__(5033);
18604
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
18605
- /**
18606
- * 创建本地企业自定义应用 XML 文件(仅操作本地,不调用远端接口)
18607
- * - 服务端以 appId 标识应用,本地创建尚无 appId,故以 `local-<localkey>` 作为本地身份
18608
- * - 校验 --localkey 命名规则与 --content(appName 必填且匹配 ^.{2,10}$)
18609
- * - 本地文件已存在时非 --force 抛出错误
18610
- * - 写入 tenant-config/custom-apps/local-<localkey>.xml,状态标记为 new,待 push 时创建远端
18611
- */
18612
- async function customAppCreateService(localKey, contentJson, options = {}) {
18613
- const normalizedLocalKey = normalize_ts_1.default.validateLocalKey(localKey);
18614
- if (!normalizedLocalKey) {
18615
- throw new Error('Invalid arguments: --localkey is required. Must start with a letter, contain only letters/numbers/underscores, max 50 characters.');
18616
- }
18617
- const content = (0, custom_app_service_ts_1.parseContent)(contentJson);
18618
- (0, custom_app_service_ts_1.validateCreateContent)(content);
18619
- const identity = `${custom_app_service_ts_1.CUSTOM_APP_LOCAL_PREFIX}${normalizedLocalKey}`;
18620
- const current = await xmlMetadataManager.readXml('CustomApp', identity, { fields: ['content'] });
18621
- if (!options.force && current.content !== null && current.content !== undefined) {
18622
- throw new Error(`Custom app metadata already exists locally: ${identity}. Use --force to overwrite.`);
18623
- }
18624
- const filePath = await xmlMetadataManager.writeXml('CustomApp', identity, content, {
18625
- status: 'new',
18626
- });
18627
- return {
18628
- filePath,
18629
- errorMessages: [],
18630
- };
18631
- }
18859
+ exports.appDevPaasAppPushCommand = exports.appDevPaasAppPullCommand = exports.appDevPaasAppUpdateCommand = exports.appDevPaasAppCreateCommand = exports.appDevPaasAppListCommand = exports.appDevAppViewMobileMenuComponentOptionsCommand = exports.appDevAppViewMobilePageComponentOptionsCommand = exports.appDevAppViewMobilePushCommand = exports.appDevAppViewMobilePullCommand = exports.appDevAppViewMobileUpdateCommand = exports.appDevAppViewMobileCreateCommand = exports.appDevAppViewMobileDetailCommand = exports.appDevAppViewMobileListCommand = exports.appDevAppViewWebUtilityBarIconOptionsCommand = exports.appDevAppViewWebUtilityBarComponentOptionsCommand = exports.appDevAppViewWebLayoutComponentOptionsCommand = exports.appDevAppViewWebMenuOptionsCommand = exports.appDevAppViewWebPushCommand = exports.appDevAppViewWebPullCommand = exports.appDevAppViewWebUpdateCommand = exports.appDevAppViewWebCreateCommand = exports.appDevAppViewWebDetailCommand = exports.appDevAppViewWebListCommand = exports.appDevCustomAppPushCommand = exports.appDevCustomAppPullCommand = exports.appDevCustomAppUpdateCommand = exports.appDevCustomAppCreateCommand = exports.appDevCustomAppListCommand = void 0;
18860
+ var custom_app_ts_1 = __webpack_require__(8645);
18861
+ Object.defineProperty(exports, "appDevCustomAppListCommand", ({ enumerable: true, get: function () { return custom_app_ts_1.appDevCustomAppListCommand; } }));
18862
+ Object.defineProperty(exports, "appDevCustomAppCreateCommand", ({ enumerable: true, get: function () { return custom_app_ts_1.appDevCustomAppCreateCommand; } }));
18863
+ Object.defineProperty(exports, "appDevCustomAppUpdateCommand", ({ enumerable: true, get: function () { return custom_app_ts_1.appDevCustomAppUpdateCommand; } }));
18864
+ Object.defineProperty(exports, "appDevCustomAppPullCommand", ({ enumerable: true, get: function () { return custom_app_ts_1.appDevCustomAppPullCommand; } }));
18865
+ Object.defineProperty(exports, "appDevCustomAppPushCommand", ({ enumerable: true, get: function () { return custom_app_ts_1.appDevCustomAppPushCommand; } }));
18866
+ var app_view_web_ts_1 = __webpack_require__(1579);
18867
+ Object.defineProperty(exports, "appDevAppViewWebListCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebListCommand; } }));
18868
+ Object.defineProperty(exports, "appDevAppViewWebDetailCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebDetailCommand; } }));
18869
+ Object.defineProperty(exports, "appDevAppViewWebCreateCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebCreateCommand; } }));
18870
+ Object.defineProperty(exports, "appDevAppViewWebUpdateCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebUpdateCommand; } }));
18871
+ Object.defineProperty(exports, "appDevAppViewWebPullCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebPullCommand; } }));
18872
+ Object.defineProperty(exports, "appDevAppViewWebPushCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebPushCommand; } }));
18873
+ Object.defineProperty(exports, "appDevAppViewWebMenuOptionsCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebMenuOptionsCommand; } }));
18874
+ Object.defineProperty(exports, "appDevAppViewWebLayoutComponentOptionsCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebLayoutComponentOptionsCommand; } }));
18875
+ Object.defineProperty(exports, "appDevAppViewWebUtilityBarComponentOptionsCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebUtilityBarComponentOptionsCommand; } }));
18876
+ Object.defineProperty(exports, "appDevAppViewWebUtilityBarIconOptionsCommand", ({ enumerable: true, get: function () { return app_view_web_ts_1.appDevAppViewWebUtilityBarIconOptionsCommand; } }));
18877
+ var app_view_mobile_ts_1 = __webpack_require__(8023);
18878
+ Object.defineProperty(exports, "appDevAppViewMobileListCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobileListCommand; } }));
18879
+ Object.defineProperty(exports, "appDevAppViewMobileDetailCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobileDetailCommand; } }));
18880
+ Object.defineProperty(exports, "appDevAppViewMobileCreateCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobileCreateCommand; } }));
18881
+ Object.defineProperty(exports, "appDevAppViewMobileUpdateCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobileUpdateCommand; } }));
18882
+ Object.defineProperty(exports, "appDevAppViewMobilePullCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobilePullCommand; } }));
18883
+ Object.defineProperty(exports, "appDevAppViewMobilePushCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobilePushCommand; } }));
18884
+ Object.defineProperty(exports, "appDevAppViewMobilePageComponentOptionsCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobilePageComponentOptionsCommand; } }));
18885
+ Object.defineProperty(exports, "appDevAppViewMobileMenuComponentOptionsCommand", ({ enumerable: true, get: function () { return app_view_mobile_ts_1.appDevAppViewMobileMenuComponentOptionsCommand; } }));
18886
+ var paas_app_ts_1 = __webpack_require__(4689);
18887
+ Object.defineProperty(exports, "appDevPaasAppListCommand", ({ enumerable: true, get: function () { return paas_app_ts_1.appDevPaasAppListCommand; } }));
18888
+ Object.defineProperty(exports, "appDevPaasAppCreateCommand", ({ enumerable: true, get: function () { return paas_app_ts_1.appDevPaasAppCreateCommand; } }));
18889
+ Object.defineProperty(exports, "appDevPaasAppUpdateCommand", ({ enumerable: true, get: function () { return paas_app_ts_1.appDevPaasAppUpdateCommand; } }));
18890
+ Object.defineProperty(exports, "appDevPaasAppPullCommand", ({ enumerable: true, get: function () { return paas_app_ts_1.appDevPaasAppPullCommand; } }));
18891
+ Object.defineProperty(exports, "appDevPaasAppPushCommand", ({ enumerable: true, get: function () { return paas_app_ts_1.appDevPaasAppPushCommand; } }));
18632
18892
 
18633
18893
 
18634
18894
  /***/ },
18635
18895
 
18636
- /***/ 5235
18896
+ /***/ 4689
18637
18897
  (__unused_webpack_module, exports, __webpack_require__) {
18638
18898
 
18639
18899
 
@@ -18641,132 +18901,111 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18641
18901
  return (mod && mod.__esModule) ? mod : { "default": mod };
18642
18902
  };
18643
18903
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18644
- exports.customAppPullService = customAppPullService;
18645
- const prompts_1 = __webpack_require__(118);
18904
+ exports.appDevPaasAppListCommand = appDevPaasAppListCommand;
18905
+ exports.appDevPaasAppCreateCommand = appDevPaasAppCreateCommand;
18906
+ exports.appDevPaasAppUpdateCommand = appDevPaasAppUpdateCommand;
18907
+ exports.appDevPaasAppPullCommand = appDevPaasAppPullCommand;
18908
+ exports.appDevPaasAppPushCommand = appDevPaasAppPushCommand;
18646
18909
  const logger_ts_1 = __webpack_require__(3333);
18647
- const index_ts_1 = __webpack_require__(9985);
18648
- const app_dev_shared_ts_1 = __webpack_require__(7564);
18649
- const custom_app_service_ts_1 = __webpack_require__(5033);
18650
18910
  const normalize_ts_1 = __importDefault(__webpack_require__(9268));
18651
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
18652
- /**
18653
- * list 响应中的原始项映射为本地应用文件所需的结构
18654
- * custom-app list 响应 data 为数组,每项含 appId 与应用字段
18655
- */
18656
- function mapListItemsToFiles(rawItems) {
18657
- return rawItems
18658
- .map((item) => {
18659
- const rec = (0, app_dev_shared_ts_1.isAppDevRecord)(item) ? item : {};
18660
- const appId = normalize_ts_1.default.normalizeText(rec.appId) ?? '';
18661
- const content = (0, app_dev_shared_ts_1.isAppDevRecord)(rec.content) ? rec.content : rec;
18662
- const updateTimeRaw = rec.updateTime;
18663
- const updateTime = typeof updateTimeRaw === 'number'
18664
- ? updateTimeRaw
18665
- : typeof updateTimeRaw === 'string' && updateTimeRaw.trim()
18666
- ? Number(updateTimeRaw)
18667
- : 0;
18668
- return { appId, content, updateTime };
18669
- })
18670
- .filter((item) => item.appId);
18671
- }
18672
- const fetchCustomAppListItems = async (input) => {
18673
- const response = await (0, custom_app_service_ts_1.customAppListService)(input);
18674
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, (res) => {
18675
- const data = res.data;
18676
- if (Array.isArray(data)) {
18677
- return data;
18678
- }
18679
- if ((0, app_dev_shared_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
18680
- return data.items;
18681
- }
18682
- return [];
18683
- });
18684
- if (!result.success) {
18685
- throw new Error(result.errorMessage);
18911
+ const request_ts_1 = __webpack_require__(6272);
18912
+ const paas_app_create_ts_1 = __webpack_require__(7928);
18913
+ const paas_app_list_ts_1 = __webpack_require__(7988);
18914
+ const paas_app_pull_ts_1 = __webpack_require__(3035);
18915
+ const paas_app_push_ts_1 = __webpack_require__(7752);
18916
+ const paas_app_update_ts_1 = __webpack_require__(3473);
18917
+ const getPaasAppListItems = (response) => {
18918
+ const data = response.data;
18919
+ if ((0, request_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
18920
+ return data.items.filter(request_ts_1.isAppDevRecord);
18686
18921
  }
18687
- return mapListItemsToFiles(result.data ?? []);
18922
+ if (Array.isArray(data)) {
18923
+ return data.filter(request_ts_1.isAppDevRecord);
18924
+ }
18925
+ return [];
18688
18926
  };
18689
- /**
18690
- * 拉取企业自定义应用并写入本地 XML 文件
18691
- * - 复用 list 接口获取应用项,逐个写入 tenant-config/custom-apps/{appId}.xml
18692
- * - 写入前检查本地状态,非 unchanged 默认跳过,--force 强制覆盖,--yes 跳过确认
18693
- * - updateTime 存入 extra,供后续 push 的 update 调用使用
18694
- */
18695
- async function customAppPullService(queryOptions = {}, skipOverwriteConfirm = false, force = false, yes = false) {
18696
- const errorMessages = [];
18697
- logger_ts_1.loggerService.startLoading('Fetching custom app list...');
18698
- let items;
18699
- try {
18700
- items = await fetchCustomAppListItems(queryOptions);
18927
+ const printErrorMessages = (errorMessages) => {
18928
+ if (!errorMessages.length) {
18929
+ return false;
18701
18930
  }
18702
- catch (error) {
18703
- errorMessages.push(`Custom app list failed: ${error instanceof Error ? error.message : String(error)}`);
18704
- return { found: 0, written: 0, skipped: 0, errorMessages };
18931
+ errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
18932
+ return true;
18933
+ };
18934
+ async function appDevPaasAppListCommand(context, options) {
18935
+ void context;
18936
+ logger_ts_1.loggerService.startLoading('Listing PaaS applications...');
18937
+ try {
18938
+ const response = await (0, paas_app_list_ts_1.paasAppListService)();
18939
+ if (options.json) {
18940
+ logger_ts_1.loggerService.printJson(response);
18941
+ return;
18942
+ }
18943
+ const items = getPaasAppListItems(response);
18944
+ logger_ts_1.loggerService.printTable(['name', 'description', 'appId', 'appType', 'status', 'sourceType', 'updateTime'], items.map((item) => [
18945
+ normalize_ts_1.default.normalizeText(item.name),
18946
+ normalize_ts_1.default.normalizeText(item.description),
18947
+ normalize_ts_1.default.normalizeText(item.appId),
18948
+ normalize_ts_1.default.normalizeText(item.appTypeName),
18949
+ normalize_ts_1.default.normalizeText(item.status),
18950
+ normalize_ts_1.default.normalizeText(item.sourceType),
18951
+ normalize_ts_1.default.normalizeDateTime(item.updateTime),
18952
+ ]), [0, 0, 30, 12, 8, 12, 18]);
18705
18953
  }
18706
18954
  finally {
18707
18955
  logger_ts_1.loggerService.stopLoading();
18708
18956
  }
18709
- if (items.length === 0) {
18710
- if (!errorMessages.length) {
18711
- logger_ts_1.loggerService.warn('No custom app items found.');
18712
- }
18713
- return { found: 0, written: 0, skipped: 0, errorMessages };
18957
+ }
18958
+ async function appDevPaasAppCreateCommand(context, options) {
18959
+ void context;
18960
+ const result = await (0, paas_app_create_ts_1.paasAppCreateService)(options.localKey ?? options.localkey, options.content, {
18961
+ force: options.force === true,
18962
+ });
18963
+ if (printErrorMessages(result.errorMessages)) {
18964
+ return;
18714
18965
  }
18715
- let written = 0;
18716
- let skipped = 0;
18717
- logger_ts_1.loggerService.startLoading(`Writing custom app xml: ${items.length}`);
18718
- try {
18719
- for (const item of items) {
18720
- try {
18721
- const localStatus = await xmlMetadataManager.readXml('CustomApp', item.appId, { fields: ['status'] });
18722
- if (force) {
18723
- if (localStatus.status !== 'unchanged' && !yes) {
18724
- const userConfirm = await (0, prompts_1.confirm)({
18725
- message: `Local CustomApp status is "${localStatus.status}": ${item.appId}, overwrite?`,
18726
- initialValue: false,
18727
- });
18728
- if (!userConfirm) {
18729
- skipped += 1;
18730
- continue;
18731
- }
18732
- }
18733
- await xmlMetadataManager.writeXml('CustomApp', item.appId, item.content, {
18734
- status: 'unchanged',
18735
- extra: { updateTime: item.updateTime },
18736
- });
18737
- written += 1;
18738
- continue;
18739
- }
18740
- if (localStatus.status !== 'unchanged') {
18741
- if (skipOverwriteConfirm) {
18742
- skipped += 1;
18743
- continue;
18744
- }
18745
- logger_ts_1.loggerService.warn(`Local CustomApp status is "${localStatus.status}": ${item.appId}, skipped. Use --force to overwrite.`);
18746
- skipped += 1;
18747
- continue;
18748
- }
18749
- await xmlMetadataManager.writeXml('CustomApp', item.appId, item.content, {
18750
- status: 'unchanged',
18751
- extra: { updateTime: item.updateTime },
18752
- });
18753
- written += 1;
18754
- }
18755
- catch (error) {
18756
- errorMessages.push(`${item.appId}: ${error instanceof Error ? error.message : String(error)}`);
18757
- }
18758
- }
18966
+ if (!result.filePath) {
18967
+ throw new Error('PaaS app metadata not created.');
18759
18968
  }
18760
- finally {
18761
- logger_ts_1.loggerService.stopLoading();
18969
+ logger_ts_1.loggerService.success('Command completed: paas-app create');
18970
+ logger_ts_1.loggerService.info(`PaaS app metadata created: ${result.filePath}`);
18971
+ }
18972
+ async function appDevPaasAppUpdateCommand(context, options) {
18973
+ void context;
18974
+ const result = await (0, paas_app_update_ts_1.paasAppUpdateService)(options.appId, options.content);
18975
+ if (printErrorMessages(result.errorMessages)) {
18976
+ return;
18762
18977
  }
18763
- return { found: items.length, written, skipped, errorMessages };
18978
+ if (!result.filePath) {
18979
+ throw new Error('PaaS app metadata not updated.');
18980
+ }
18981
+ logger_ts_1.loggerService.success('Command completed: paas-app update');
18982
+ logger_ts_1.loggerService.info(`PaaS app metadata updated: ${result.filePath}`);
18983
+ }
18984
+ async function appDevPaasAppPullCommand(context, options) {
18985
+ void context;
18986
+ const result = await (0, paas_app_pull_ts_1.paasAppPullService)(false, options.force === true, options.yes === true);
18987
+ if (printErrorMessages(result.errorMessages)) {
18988
+ return;
18989
+ }
18990
+ logger_ts_1.loggerService.success(`PaaS app pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
18991
+ }
18992
+ async function appDevPaasAppPushCommand(context, options) {
18993
+ void context;
18994
+ const result = await (0, paas_app_push_ts_1.paasAppPushService)({
18995
+ all: options.all,
18996
+ appId: options.appId,
18997
+ skipOverwriteConfirm: options.yes === true,
18998
+ });
18999
+ if (printErrorMessages(result.errorMessages)) {
19000
+ return;
19001
+ }
19002
+ logger_ts_1.loggerService.success(`PaaS app push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
18764
19003
  }
18765
19004
 
18766
19005
 
18767
19006
  /***/ },
18768
19007
 
18769
- /***/ 5216
19008
+ /***/ 4091
18770
19009
  (__unused_webpack_module, exports, __webpack_require__) {
18771
19010
 
18772
19011
 
@@ -18774,421 +19013,414 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
18774
19013
  return (mod && mod.__esModule) ? mod : { "default": mod };
18775
19014
  };
18776
19015
  Object.defineProperty(exports, "__esModule", ({ value: true }));
18777
- exports.customAppPushService = customAppPushService;
18778
- const node_path_1 = __importDefault(__webpack_require__(6760));
18779
- const node_fs_1 = __webpack_require__(3024);
18780
- const file_ts_1 = __webpack_require__(5409);
18781
- const logger_ts_1 = __webpack_require__(3333);
19016
+ exports.appViewMobileCreateService = appViewMobileCreateService;
18782
19017
  const index_ts_1 = __webpack_require__(9985);
18783
- const request_execute_command_paths_ts_1 = __webpack_require__(2351);
18784
- const app_dev_shared_ts_1 = __webpack_require__(7564);
18785
- const custom_app_service_ts_1 = __webpack_require__(5033);
18786
- const custom_app_pull_ts_1 = __webpack_require__(5235);
18787
19018
  const normalize_ts_1 = __importDefault(__webpack_require__(9268));
18788
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
18789
- async function findLocalCustomAppFiles() {
18790
- const results = [];
18791
- const cwd = process.cwd();
18792
- const dirPath = node_path_1.default.join(cwd, 'tenant-config', 'custom-apps');
18793
- if (!(await (0, file_ts_1.pathExists)(dirPath))) {
18794
- return results;
18795
- }
18796
- let entries;
18797
- try {
18798
- const dirEntries = await node_fs_1.promises.readdir(dirPath, { withFileTypes: true });
18799
- entries = dirEntries;
18800
- }
18801
- catch {
18802
- return results;
19019
+ const xml = new index_ts_1.XmlMetadataManager();
19020
+ const PREFIX = 'local-';
19021
+ /** 创建本地 Mobile 视图 XML(仅写本地,远端同步走 push) */
19022
+ async function appViewMobileCreateService(localKey, content, options = {}) {
19023
+ const key = normalize_ts_1.default.validateLocalKey(localKey);
19024
+ if (!key) {
19025
+ throw new Error('--localkey is required.');
18803
19026
  }
18804
- for (const entry of entries) {
18805
- if (!entry.isFile() || !entry.name.endsWith('.custom-app.xml')) {
18806
- continue;
18807
- }
18808
- const appId = entry.name.slice(0, -'.custom-app.xml'.length);
18809
- results.push({ appId, filePath: node_path_1.default.join(dirPath, entry.name) });
19027
+ const identity = `${PREFIX}${key}`;
19028
+ const current = await xml.readXml('PaasAppViewMobile', identity, { fields: ['content'] });
19029
+ if (!options.force && current.content !== null && current.content !== undefined) {
19030
+ throw new Error(`Application view metadata already exists locally: ${identity}. Use --force to overwrite.`);
18810
19031
  }
18811
- return results;
18812
- }
18813
- async function readLocalCustomApp(appId) {
18814
- const localXml = await xmlMetadataManager.readXml('CustomApp', appId, { fields: ['content', 'status', 'extra'] });
18815
- const extra = (0, app_dev_shared_ts_1.isAppDevRecord)(localXml.extra) ? localXml.extra : {};
18816
- const updateTimeRaw = extra.updateTime;
18817
- const updateTime = typeof updateTimeRaw === 'number'
18818
- ? updateTimeRaw
18819
- : typeof updateTimeRaw === 'string' && updateTimeRaw.trim()
18820
- ? Number(updateTimeRaw)
18821
- : undefined;
18822
- return {
18823
- content: (0, app_dev_shared_ts_1.isAppDevRecord)(localXml.content) ? localXml.content : null,
18824
- status: localXml.status,
18825
- updateTime,
18826
- extra,
18827
- };
19032
+ const filePath = await xml.writeXml('PaasAppViewMobile', identity, content, { status: 'new' });
19033
+ return { filePath, errorMessages: [] };
18828
19034
  }
18829
- async function fetchRemoteCustomApp(appId, errorMessages) {
18830
- try {
18831
- const response = await (0, custom_app_service_ts_1.customAppListService)({ nameKeyword: appId });
18832
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, (res) => {
18833
- const data = res.data;
18834
- if (Array.isArray(data)) {
18835
- return data;
18836
- }
18837
- return [];
18838
- });
18839
- if (!result.success || !result.data) {
18840
- return { exists: false };
18841
- }
18842
- const matched = result.data.find((item) => normalize_ts_1.default.normalizeText(item.appId) === appId);
18843
- if (!matched) {
18844
- return { exists: false };
18845
- }
18846
- const rawTime = matched.updateTime;
18847
- const updateTime = typeof rawTime === 'number'
18848
- ? rawTime
18849
- : typeof rawTime === 'string' && rawTime.trim()
18850
- ? Number(rawTime)
18851
- : undefined;
18852
- return { exists: true, updateTime };
18853
- }
18854
- catch (error) {
18855
- errorMessages.push(`remote existence check failed: ${appId}: ${error instanceof Error ? error.message : String(error)}`);
18856
- return { exists: false };
18857
- }
19035
+
19036
+
19037
+ /***/ },
19038
+
19039
+ /***/ 1646
19040
+ (__unused_webpack_module, exports, __webpack_require__) {
19041
+
19042
+
19043
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19044
+ exports.appViewMobileDetailService = appViewMobileDetailService;
19045
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19046
+ const request_ts_1 = __webpack_require__(6272);
19047
+ const requestAppViewMobileDetailExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewMobileDetail'), input));
19048
+ /** 查询指定 Mobile 视图的完整详情 */
19049
+ async function appViewMobileDetailService(input) {
19050
+ return await requestAppViewMobileDetailExecute(input);
18858
19051
  }
18859
- async function requestCreateCustomApp(content) {
18860
- logger_ts_1.loggerService.startLoading('custom-app push request (create)');
18861
- const response = await (0, app_dev_shared_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'customAppCreate'), content);
18862
- logger_ts_1.loggerService.stopLoading();
18863
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, (res) => {
18864
- const data = res.data;
18865
- return (0, app_dev_shared_ts_1.isAppDevRecord)(data) ? data : {};
18866
- });
18867
- if (!result.success) {
18868
- return { errorMessage: result.errorMessage };
18869
- }
18870
- const serverId = normalize_ts_1.default.normalizeText(result.data?.appId);
18871
- if (!serverId) {
18872
- return { errorMessage: 'Server response missing appId.' };
18873
- }
18874
- return { serverId };
19052
+
19053
+
19054
+ /***/ },
19055
+
19056
+ /***/ 2299
19057
+ (__unused_webpack_module, exports, __webpack_require__) {
19058
+
19059
+
19060
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19061
+ exports.appViewMobileListService = appViewMobileListService;
19062
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19063
+ const request_ts_1 = __webpack_require__(6272);
19064
+ const requestAppViewMobileListExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewMobileList'), input));
19065
+ /** 查询指定 PaaS 应用下的 Mobile 视图列表 */
19066
+ async function appViewMobileListService(input) {
19067
+ return await requestAppViewMobileListExecute(input);
18875
19068
  }
18876
- async function requestUpdateCustomApp(appId, content) {
18877
- logger_ts_1.loggerService.startLoading(`custom-app push request (update): ${appId}`);
18878
- const response = await (0, app_dev_shared_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'customAppUpdate'), { ...content, appId });
18879
- logger_ts_1.loggerService.stopLoading();
18880
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, () => ({}));
18881
- if (!result.success) {
18882
- return { errorMessage: result.errorMessage };
18883
- }
18884
- return {};
19069
+
19070
+
19071
+ /***/ },
19072
+
19073
+ /***/ 3133
19074
+ (__unused_webpack_module, exports, __webpack_require__) {
19075
+
19076
+
19077
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19078
+ exports.appViewMobileMenuComponentOptionsService = appViewMobileMenuComponentOptionsService;
19079
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19080
+ const request_ts_1 = __webpack_require__(6272);
19081
+ const requestAppViewMobileMenuComponentOptionsExecute = async () => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewMobileMenuComponentOptions'), {}));
19082
+ /** 查询 Mobile 视图可选菜单入口组件 */
19083
+ async function appViewMobileMenuComponentOptionsService() {
19084
+ return await requestAppViewMobileMenuComponentOptionsExecute();
18885
19085
  }
18886
- async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
18887
- const { appId } = file;
18888
- let local = await readLocalCustomApp(appId);
18889
- if (!local.content) {
18890
- return { appId, action: 'skip', errorMessage: `Invalid local content: ${appId}` };
18891
- }
18892
- const isLocalPlaceholder = appId.startsWith(custom_app_service_ts_1.CUSTOM_APP_LOCAL_PREFIX);
18893
- let isCreate = local.status === 'new';
18894
- if (!isLocalPlaceholder) {
18895
- const remote = await fetchRemoteCustomApp(appId, errorMessages);
18896
- if (local.status === 'new' && remote.exists) {
18897
- await xmlMetadataManager.writeXml('CustomApp', appId, local.content, {
18898
- status: 'modified',
18899
- extra: { updateTime: remote.updateTime },
18900
- });
18901
- logger_ts_1.loggerService.warn(`Custom app exists remotely, local status changed from new to modified: ${appId}`);
18902
- local = await readLocalCustomApp(appId);
18903
- }
18904
- else if (local.status !== 'new' && !remote.exists) {
18905
- await xmlMetadataManager.writeXml('CustomApp', appId, local.content, { status: 'new' });
18906
- logger_ts_1.loggerService.warn(`Custom app does not exist remotely, local status changed from ${local.status} to new: ${appId}`);
18907
- local = await readLocalCustomApp(appId);
18908
- }
18909
- isCreate = local.status === 'new';
18910
- }
18911
- else {
18912
- isCreate = true;
18913
- }
18914
- if (!isCreate) {
18915
- logger_ts_1.loggerService.startLoading(`custom-app push pre-pull: ${appId}`);
18916
- try {
18917
- const prePullResult = await (0, custom_app_pull_ts_1.customAppPullService)({ nameKeyword: appId }, skipOverwriteConfirm, false, skipOverwriteConfirm);
18918
- errorMessages.push(...prePullResult.errorMessages);
18919
- local = await readLocalCustomApp(appId);
18920
- }
18921
- finally {
18922
- logger_ts_1.loggerService.stopLoading();
18923
- }
18924
- if (!local.content) {
18925
- return { appId, action: 'skip', errorMessage: `Invalid local content after pre-pull: ${appId}` };
18926
- }
18927
- }
18928
- const content = local.content;
18929
- if (!content) {
18930
- return { appId, action: 'skip', errorMessage: `Invalid local content before push: ${appId}` };
18931
- }
18932
- let targetId = appId;
18933
- let newId;
18934
- if (isCreate) {
18935
- const createResult = await requestCreateCustomApp(content);
18936
- if (createResult.errorMessage) {
18937
- return { appId, action: 'create', errorMessage: createResult.errorMessage };
18938
- }
18939
- newId = createResult.serverId;
18940
- targetId = newId;
18941
- await xmlMetadataManager.renameXml('CustomApp', appId, targetId, {});
18942
- }
18943
- else {
18944
- const updateResult = await requestUpdateCustomApp(appId, content);
18945
- if (updateResult.errorMessage) {
18946
- return { appId, action: 'update', errorMessage: updateResult.errorMessage };
18947
- }
18948
- }
18949
- await xmlMetadataManager.writeXml('CustomApp', targetId, content, { status: 'unchanged' });
18950
- logger_ts_1.loggerService.startLoading(`custom-app push post-pull: ${targetId}`);
18951
- try {
18952
- const postPullResult = await (0, custom_app_pull_ts_1.customAppPullService)({ nameKeyword: targetId }, skipOverwriteConfirm, false, skipOverwriteConfirm);
18953
- errorMessages.push(...postPullResult.errorMessages);
18954
- }
18955
- finally {
18956
- logger_ts_1.loggerService.stopLoading();
18957
- }
18958
- logger_ts_1.loggerService.debug(`push success: ${appId}${newId ? ` -> ${newId}` : ''}`);
18959
- return { appId, action: isCreate ? 'create' : 'update', newId };
19086
+
19087
+
19088
+ /***/ },
19089
+
19090
+ /***/ 9897
19091
+ (__unused_webpack_module, exports, __webpack_require__) {
19092
+
19093
+
19094
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19095
+ exports.appViewMobilePageComponentOptionsService = appViewMobilePageComponentOptionsService;
19096
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19097
+ const request_ts_1 = __webpack_require__(6272);
19098
+ const requestAppViewMobilePageComponentOptionsExecute = async () => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewMobilePageComponentOptions'), {}));
19099
+ /** 查询 Mobile 视图可选页面组件 */
19100
+ async function appViewMobilePageComponentOptionsService() {
19101
+ return await requestAppViewMobilePageComponentOptionsExecute();
18960
19102
  }
18961
- async function customAppPushService(options) {
18962
- const errorMessages = [];
18963
- const results = [];
18964
- const skipOverwriteConfirm = options.skipOverwriteConfirm === true;
18965
- if (options.all && options.appId) {
18966
- throw new Error('Invalid arguments: use either --all or --appId, not both.');
19103
+
19104
+
19105
+ /***/ },
19106
+
19107
+ /***/ 4124
19108
+ (__unused_webpack_module, exports, __webpack_require__) {
19109
+
19110
+
19111
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19112
+ exports.appViewMobilePullService = appViewMobilePullService;
19113
+ const prompts_1 = __webpack_require__(118);
19114
+ const logger_ts_1 = __webpack_require__(3333);
19115
+ const index_ts_1 = __webpack_require__(9985);
19116
+ const request_ts_1 = __webpack_require__(6272);
19117
+ const app_view_mobile_detail_ts_1 = __webpack_require__(1646);
19118
+ const app_view_mobile_list_ts_1 = __webpack_require__(2299);
19119
+ const xml = new index_ts_1.XmlMetadataManager();
19120
+ const asText = (value) => (typeof value === 'string' && value.trim() ? value.trim() : undefined);
19121
+ const extractListItems = (response) => {
19122
+ const data = response.data;
19123
+ if (Array.isArray(data)) {
19124
+ return data;
18967
19125
  }
18968
- let candidates;
18969
- if (options.appId) {
18970
- const normalizedId = normalize_ts_1.default.normalizeString(options.appId);
18971
- if (!normalizedId) {
18972
- throw new Error('Invalid arguments: --appId is required.');
18973
- }
18974
- const allFiles = await findLocalCustomAppFiles();
18975
- candidates = allFiles.filter((f) => f.appId === normalizedId);
18976
- if (candidates.length === 0) {
18977
- throw new Error(`Custom app not found locally: ${normalizedId}`);
19126
+ const body = (0, request_ts_1.isAppDevRecord)(data) ? data : {};
19127
+ const items = body.items ?? body.records ?? body.list;
19128
+ return Array.isArray(items) ? items.filter(request_ts_1.isAppDevRecord) : [];
19129
+ };
19130
+ const extractDataRecord = (response) => ((0, request_ts_1.isAppDevRecord)(response.data) ? response.data : {});
19131
+ /** 拉取指定应用下的 Mobile 视图并写入本地 XML */
19132
+ async function appViewMobilePullService(appId, options = {}) {
19133
+ const errorMessages = [];
19134
+ const pageNum = options.pageNum ?? 1;
19135
+ const pageSize = options.pageSize ?? 100;
19136
+ // 获取远端列表
19137
+ let items = [];
19138
+ try {
19139
+ const listResponse = await (0, app_view_mobile_list_ts_1.appViewMobileListService)({ appId, pageNum, pageSize });
19140
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(listResponse, extractListItems);
19141
+ if (!result.success || result.data === undefined) {
19142
+ throw new Error(result.errorMessage || 'Unknown error.');
18978
19143
  }
19144
+ items = result.data;
18979
19145
  }
18980
- else if (options.all) {
18981
- candidates = await findLocalCustomAppFiles();
18982
- }
18983
- else {
18984
- throw new Error('Invalid arguments: specify --all to push all local files, or --appId to push a single file.');
18985
- }
18986
- if (candidates.length === 0) {
18987
- logger_ts_1.loggerService.warn('No local custom-app files found to push.');
18988
- return { pushed: 0, skipped: 0, failed: 0, results: [], errorMessages: [] };
19146
+ catch (error) {
19147
+ errorMessages.push(`Application view list failed: ${error instanceof Error ? error.message : String(error)}`);
19148
+ return { found: 0, written: 0, skipped: 0, errorMessages };
18989
19149
  }
18990
- let pushed = 0;
19150
+ let written = 0;
18991
19151
  let skipped = 0;
18992
- let failed = 0;
18993
- for (const file of candidates) {
18994
- try {
18995
- const statusCheck = await readLocalCustomApp(file.appId);
18996
- if (statusCheck.status === 'unchanged') {
19152
+ // 逐条拉详情并写入本地
19153
+ for (const item of items) {
19154
+ const id = asText(item.templateId ?? item.id);
19155
+ if (!id) {
19156
+ continue;
19157
+ }
19158
+ const current = await xml.readXml('PaasAppViewMobile', id, { fields: ['status'] });
19159
+ if (!options.force && current.status !== 'unchanged') {
19160
+ logger_ts_1.loggerService.warn(`Local Mobile view status is "${current.status}": ${id}, skipped. Use --force to overwrite.`);
19161
+ skipped += 1;
19162
+ continue;
19163
+ }
19164
+ if (options.force && current.status !== 'unchanged' && !options.yes) {
19165
+ const userConfirm = await (0, prompts_1.confirm)({
19166
+ message: `Local Mobile view status is "${current.status}": ${id}, overwrite?`,
19167
+ initialValue: false,
19168
+ });
19169
+ if (!userConfirm) {
18997
19170
  skipped += 1;
18998
- results.push({ appId: file.appId, action: 'skip' });
18999
- logger_ts_1.loggerService.debug(`push skip (unchanged): ${file.appId}`);
19000
19171
  continue;
19001
19172
  }
19002
- const itemResult = await pushSingleFile(file, skipOverwriteConfirm, errorMessages);
19003
- results.push(itemResult);
19004
- if (itemResult.errorMessage) {
19005
- failed += 1;
19006
- errorMessages.push(`${file.appId}: ${itemResult.errorMessage}`);
19007
- }
19008
- else {
19009
- pushed += 1;
19173
+ }
19174
+ try {
19175
+ const detailResponse = await (0, app_view_mobile_detail_ts_1.appViewMobileDetailService)({ templateId: id });
19176
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(detailResponse, extractDataRecord);
19177
+ if (!result.success || result.data === undefined) {
19178
+ throw new Error(result.errorMessage || 'Unknown error.');
19010
19179
  }
19180
+ const detail = result.data;
19181
+ const content = (0, request_ts_1.isAppDevRecord)(detail.content) ? detail.content : detail;
19182
+ content.appId = asText(item.appId ?? detail.appId) ?? appId;
19183
+ await xml.writeXml('PaasAppViewMobile', id, content, {
19184
+ status: 'unchanged',
19185
+ extra: { updateTime: detail.updateTime ?? item.updateTime },
19186
+ });
19187
+ written += 1;
19011
19188
  }
19012
19189
  catch (error) {
19013
- failed += 1;
19014
- const errorMsg = error instanceof Error ? error.message : String(error);
19015
- errorMessages.push(`${file.appId}: ${errorMsg}`);
19016
- results.push({ appId: file.appId, action: 'skip', errorMessage: errorMsg });
19190
+ errorMessages.push(`${id}: ${error instanceof Error ? error.message : String(error)}`);
19017
19191
  }
19018
19192
  }
19019
- return { pushed, skipped, failed, results, errorMessages };
19193
+ return { found: items.length, written, skipped, errorMessages };
19020
19194
  }
19021
19195
 
19022
19196
 
19023
19197
  /***/ },
19024
19198
 
19025
- /***/ 5033
19199
+ /***/ 215
19026
19200
  (__unused_webpack_module, exports, __webpack_require__) {
19027
19201
 
19028
19202
 
19203
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19204
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19205
+ };
19029
19206
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19030
- exports.customAppPushService = exports.customAppPullService = exports.customAppUpdateService = exports.customAppCreateService = exports.parseAppId = exports.validateUpdateContent = exports.validateCreateContent = exports.parseContent = exports.customAppListService = exports.CUSTOM_APP_LOCAL_PREFIX = void 0;
19207
+ exports.appViewMobilePushService = appViewMobilePushService;
19208
+ const node_path_1 = __importDefault(__webpack_require__(6760));
19209
+ const node_fs_1 = __webpack_require__(3024);
19210
+ const file_ts_1 = __webpack_require__(5409);
19211
+ const index_ts_1 = __webpack_require__(9985);
19031
19212
  const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19032
- const app_dev_shared_ts_1 = __webpack_require__(7564);
19033
- /** 本地创建文件时 localkey 的前缀,用于区分服务端自动生成的 appId */
19034
- exports.CUSTOM_APP_LOCAL_PREFIX = 'local-';
19035
- // ========================================================================
19036
- // list 服务(调用操作中心)
19037
- // ========================================================================
19038
- const customAppListService = async (input = {}) => (0, app_dev_shared_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'customAppList'), input.nameKeyword ? { nameKeyword: input.nameKeyword } : {});
19039
- exports.customAppListService = customAppListService;
19040
- // ========================================================================
19041
- // 校验辅助函数(供 create / update / command 复用)
19042
- // ========================================================================
19043
- const isCustomAppContent = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
19044
- const parseContent = (rawContent) => {
19045
- if (!rawContent?.trim()) {
19046
- throw new Error('--content is required.');
19213
+ const request_ts_1 = __webpack_require__(6272);
19214
+ const app_view_mobile_detail_ts_1 = __webpack_require__(1646);
19215
+ const xml = new index_ts_1.XmlMetadataManager();
19216
+ const PREFIX = 'local-';
19217
+ const SUFFIX = '.paas-app-view-mobile.xml';
19218
+ const asText = (value) => (typeof value === 'string' && value.trim() ? value.trim() : undefined);
19219
+ const extractDataRecord = (response) => ((0, request_ts_1.isAppDevRecord)(response.data) ? response.data : {});
19220
+ const asRecord = (value) => ((0, request_ts_1.isAppDevRecord)(value) ? value : {});
19221
+ /** 扫描本地 Mobile 视图 XML 文件 */
19222
+ async function findLocalFiles() {
19223
+ const dir = node_path_1.default.join(process.cwd(), 'tenant-config', 'paas-app-views', 'mobile');
19224
+ if (!(await (0, file_ts_1.pathExists)(dir))) {
19225
+ return [];
19047
19226
  }
19227
+ const entries = await node_fs_1.promises.readdir(dir, { withFileTypes: true });
19228
+ return entries
19229
+ .filter((entry) => entry.isFile() && entry.name.endsWith(SUFFIX))
19230
+ .map((entry) => entry.name.slice(0, -SUFFIX.length));
19231
+ }
19232
+ /** 按 templateId 精确查询远端存在性 */
19233
+ async function fetchRemoteView(templateId, errorMessages) {
19048
19234
  try {
19049
- const parsedContent = JSON.parse(rawContent);
19050
- if (!isCustomAppContent(parsedContent)) {
19051
- throw new Error('--content must be a JSON object.');
19235
+ const response = await (0, app_view_mobile_detail_ts_1.appViewMobileDetailService)({ templateId });
19236
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, extractDataRecord);
19237
+ if (!result.success) {
19238
+ const message = result.errorMessage || 'Unknown error.';
19239
+ if (/not found|不存在|404/i.test(message)) {
19240
+ return { status: 'missing' };
19241
+ }
19242
+ errorMessages.push(`remote existence check failed: ${templateId}: ${message}`);
19243
+ return { status: 'unknown' };
19052
19244
  }
19053
- return parsedContent;
19245
+ const data = result.data ?? {};
19246
+ return { status: 'exists', updateTime: typeof data.updateTime === 'number' ? data.updateTime : undefined };
19054
19247
  }
19055
19248
  catch (error) {
19056
- if (error instanceof Error && error.message === '--content must be a JSON object.') {
19057
- throw error;
19058
- }
19059
- throw new Error('--content must be valid JSON.');
19060
- }
19061
- };
19062
- exports.parseContent = parseContent;
19063
- const validateAppName = (content, required) => {
19064
- if (required && content.appName === undefined) {
19065
- throw new Error('appName is required and must match ^.{2,10}$.');
19249
+ errorMessages.push(`remote existence check failed: ${templateId}: ${error instanceof Error ? error.message : String(error)}`);
19250
+ return { status: 'unknown' };
19066
19251
  }
19067
- if (content.appName !== undefined && (typeof content.appName !== 'string' || !/^.{2,10}$/.test(content.appName))) {
19068
- throw new Error('appName must match ^.{2,10}$.');
19252
+ }
19253
+ /** 推送本地 Mobile 视图 XML 到远端 */
19254
+ async function appViewMobilePushService(options) {
19255
+ if (options.all && options.templateId) {
19256
+ throw new Error('Invalid arguments: use either --all or --templateId, not both.');
19069
19257
  }
19070
- };
19071
- /** 创建时校验:appName 必填且匹配 ^.{2,10}$ */
19072
- const validateCreateContent = (content) => {
19073
- validateAppName(content, true);
19074
- };
19075
- exports.validateCreateContent = validateCreateContent;
19076
- /** 更新时校验:appName 可选但若提供需匹配规则,其余字段不强制 */
19077
- const validateUpdateContent = (content) => {
19078
- validateAppName(content, false);
19079
- if (Object.keys(content).length === 0) {
19080
- throw new Error('--content must include at least one field for update.');
19258
+ const ids = options.templateId
19259
+ ? [options.templateId.trim()]
19260
+ : options.all
19261
+ ? await findLocalFiles()
19262
+ : [];
19263
+ if (!ids.length) {
19264
+ throw new Error('Specify --all or --templateId.');
19081
19265
  }
19082
- };
19083
- exports.validateUpdateContent = validateUpdateContent;
19084
- const parseAppId = (rawAppId) => {
19085
- const appId = rawAppId?.trim();
19086
- if (!appId) {
19087
- throw new Error('--appId is required. Run custom-app list to get the current appId.');
19266
+ const result = { pushed: 0, skipped: 0, failed: 0, results: [], errorMessages: [] };
19267
+ for (const id of ids) {
19268
+ try {
19269
+ const local = await xml.readXml('PaasAppViewMobile', id, { fields: ['content', 'status', 'extra'] });
19270
+ if (local.status === 'unchanged') {
19271
+ result.skipped += 1;
19272
+ result.results.push({ templateId: id, action: 'skip' });
19273
+ continue;
19274
+ }
19275
+ const content = asRecord(local.content);
19276
+ const appId = asText(content.appId);
19277
+ if (!appId) {
19278
+ throw new Error(`Missing appId in local view: ${id}`);
19279
+ }
19280
+ // local- 前缀文件没有远端 id,跳过存在性检查,直接走 create
19281
+ const isLocalPlaceholder = id.startsWith(PREFIX);
19282
+ let isCreate = isLocalPlaceholder || local.status === 'new';
19283
+ if (!isLocalPlaceholder) {
19284
+ const remote = await fetchRemoteView(id, result.errorMessages);
19285
+ if (remote.status === 'unknown') {
19286
+ throw new Error(`Remote existence check failed: ${id}`);
19287
+ }
19288
+ if (local.status === 'new' && remote.status === 'exists') {
19289
+ await xml.writeXml('PaasAppViewMobile', id, content, {
19290
+ status: 'modified',
19291
+ extra: { ...asRecord(local.extra), updateTime: remote.updateTime },
19292
+ });
19293
+ isCreate = false;
19294
+ }
19295
+ else if (local.status !== 'new' && remote.status === 'missing') {
19296
+ await xml.writeXml('PaasAppViewMobile', id, content, { status: 'new' });
19297
+ isCreate = true;
19298
+ }
19299
+ }
19300
+ // pre-pull:非 create 时精确复核当前目标并校准 updateTime(不触碰同应用其他文件)
19301
+ if (!isCreate) {
19302
+ const preDetail = await (0, app_view_mobile_detail_ts_1.appViewMobileDetailService)({ templateId: id });
19303
+ const preResult = await (0, request_ts_1.extractAppDevServiceResult)(preDetail, extractDataRecord);
19304
+ if (!preResult.success || preResult.data === undefined) {
19305
+ throw new Error(preResult.errorMessage || 'Unknown error.');
19306
+ }
19307
+ const preData = preResult.data;
19308
+ const remoteUpdateTime = typeof preData.updateTime === 'number' ? preData.updateTime : undefined;
19309
+ if (remoteUpdateTime !== undefined) {
19310
+ await xml.writeXml('PaasAppViewMobile', id, content, {
19311
+ status: 'modified',
19312
+ extra: { ...asRecord(local.extra), updateTime: remoteUpdateTime },
19313
+ });
19314
+ }
19315
+ }
19316
+ let newId;
19317
+ const latest = await xml.readXml('PaasAppViewMobile', id, { fields: ['content', 'extra'] });
19318
+ const latestContent = asRecord(latest.content ?? content);
19319
+ if (isCreate) {
19320
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewMobileCreate'), latestContent);
19321
+ const data = await (0, request_ts_1.extractAppDevServiceResult)(response, extractDataRecord);
19322
+ if (!data.success || data.data === undefined) {
19323
+ throw new Error(data.errorMessage || 'Unknown error.');
19324
+ }
19325
+ newId = asText(data.data.templateId ?? data.data.id);
19326
+ if (!newId) {
19327
+ throw new Error('Server response missing templateId.');
19328
+ }
19329
+ await xml.renameXml('PaasAppViewMobile', id, newId, {});
19330
+ }
19331
+ else {
19332
+ const extra = asRecord(latest.extra);
19333
+ const updateTime = Number(extra.updateTime);
19334
+ if (!Number.isSafeInteger(updateTime) || updateTime <= 0) {
19335
+ throw new Error(`Missing updateTime for ${id}, try pull first.`);
19336
+ }
19337
+ const payload = { ...latestContent, templateId: id, updateTime };
19338
+ delete payload.appId;
19339
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewMobileUpdate'), payload);
19340
+ const updated = await (0, request_ts_1.extractAppDevServiceResult)(response, extractDataRecord);
19341
+ if (!updated.success) {
19342
+ throw new Error(updated.errorMessage || 'Unknown error.');
19343
+ }
19344
+ }
19345
+ // 回写本地 status=unchanged(本次推送已成功,本地与远端一致)
19346
+ const targetId = newId ?? id;
19347
+ await xml.writeXml('PaasAppViewMobile', targetId, latestContent, { status: 'unchanged' });
19348
+ // post-pull:精确拉取当前目标并以远端完整 content replace(不触碰同应用其他文件;失败仅记录,不影响本次 push 结果)
19349
+ const postDetail = await (0, app_view_mobile_detail_ts_1.appViewMobileDetailService)({ templateId: targetId });
19350
+ const postResult = await (0, request_ts_1.extractAppDevServiceResult)(postDetail, extractDataRecord);
19351
+ if (postResult.success && postResult.data !== undefined) {
19352
+ const postData = postResult.data;
19353
+ const remoteContent = (0, request_ts_1.isAppDevRecord)(postData.content) ? postData.content : postData;
19354
+ remoteContent.appId = appId;
19355
+ await xml.writeXml('PaasAppViewMobile', targetId, remoteContent, {
19356
+ status: 'unchanged',
19357
+ extra: { updateTime: typeof postData.updateTime === 'number' ? postData.updateTime : undefined },
19358
+ });
19359
+ }
19360
+ else {
19361
+ result.errorMessages.push(`Post-pull failed for ${targetId}: ${postResult.errorMessage || 'Unknown error.'}`);
19362
+ }
19363
+ result.pushed += 1;
19364
+ result.results.push({ templateId: id, action: isCreate ? 'create' : 'update', newId });
19365
+ }
19366
+ catch (error) {
19367
+ result.failed += 1;
19368
+ const message = error instanceof Error ? error.message : String(error);
19369
+ result.errorMessages.push(`${id}: ${message}`);
19370
+ result.results.push({ templateId: id, action: 'skip', errorMessage: message });
19371
+ }
19088
19372
  }
19089
- return appId;
19090
- };
19091
- exports.parseAppId = parseAppId;
19092
- // ========================================================================
19093
- // 本地 create / update / pull / push 服务(仅操作本地 XML,对齐 mobile-navigation 模式)
19094
- // ========================================================================
19095
- var custom_app_create_ts_1 = __webpack_require__(3216);
19096
- Object.defineProperty(exports, "customAppCreateService", ({ enumerable: true, get: function () { return custom_app_create_ts_1.customAppCreateService; } }));
19097
- var custom_app_update_ts_1 = __webpack_require__(5577);
19098
- Object.defineProperty(exports, "customAppUpdateService", ({ enumerable: true, get: function () { return custom_app_update_ts_1.customAppUpdateService; } }));
19099
- var custom_app_pull_ts_1 = __webpack_require__(5235);
19100
- Object.defineProperty(exports, "customAppPullService", ({ enumerable: true, get: function () { return custom_app_pull_ts_1.customAppPullService; } }));
19101
- var custom_app_push_ts_1 = __webpack_require__(5216);
19102
- Object.defineProperty(exports, "customAppPushService", ({ enumerable: true, get: function () { return custom_app_push_ts_1.customAppPushService; } }));
19373
+ return result;
19374
+ }
19103
19375
 
19104
19376
 
19105
19377
  /***/ },
19106
19378
 
19107
- /***/ 5577
19379
+ /***/ 4976
19108
19380
  (__unused_webpack_module, exports, __webpack_require__) {
19109
19381
 
19110
19382
 
19111
19383
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19112
- exports.customAppUpdateService = customAppUpdateService;
19384
+ exports.appViewMobileUpdateService = appViewMobileUpdateService;
19113
19385
  const index_ts_1 = __webpack_require__(9985);
19114
- const custom_app_service_ts_1 = __webpack_require__(5033);
19115
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
19116
- /**
19117
- * 更新本地企业自定义应用 XML 文件(仅操作本地,不调用远端接口)
19118
- * - --appId 为本地文件身份(远端 appId 或本地创建时的 local-<localkey>)
19119
- * - 校验 --content JSON 结构(appName 可选但若提供需匹配规则)
19120
- * - 本地文件不存在时抛出错误
19121
- * - 回写 XML:原状态为 new 时保持 new,否则标记为 modified(保留 extra 中的 updateTime)
19122
- */
19123
- async function customAppUpdateService(appId, contentJson, options = {}) {
19124
- void options;
19125
- const normalizedAppId = (0, custom_app_service_ts_1.parseAppId)(appId);
19126
- const content = (0, custom_app_service_ts_1.parseContent)(contentJson);
19127
- (0, custom_app_service_ts_1.validateUpdateContent)(content);
19128
- const current = await xmlMetadataManager.readXml('CustomApp', normalizedAppId, {
19129
- fields: ['content', 'status', 'extra'],
19130
- });
19386
+ const request_ts_1 = __webpack_require__(6272);
19387
+ const xml = new index_ts_1.XmlMetadataManager();
19388
+ /** 更新本地 Mobile 视图 XML(仅写本地,远端同步走 push) */
19389
+ async function appViewMobileUpdateService(templateId, content, updateTime) {
19390
+ const id = templateId?.trim();
19391
+ if (!id) {
19392
+ throw new Error('--templateId is required.');
19393
+ }
19394
+ const current = await xml.readXml('PaasAppViewMobile', id, { fields: ['content', 'status', 'extra'] });
19131
19395
  if (current.content === null || current.content === undefined) {
19132
- throw new Error(`Custom app metadata not found: ${normalizedAppId}`);
19396
+ throw new Error(`Application view metadata not found: ${id}`);
19133
19397
  }
19134
- const filePath = await xmlMetadataManager.writeXml('CustomApp', normalizedAppId, content, {
19398
+ const extra = updateTime === undefined
19399
+ ? current.extra
19400
+ : { ...((0, request_ts_1.isAppDevRecord)(current.extra) ? current.extra : {}), updateTime };
19401
+ const filePath = await xml.writeXml('PaasAppViewMobile', id, content, {
19135
19402
  contentMode: 'merge',
19136
19403
  status: current.status === 'new' ? 'new' : 'modified',
19137
- extra: current.extra,
19404
+ extra,
19138
19405
  });
19139
- return {
19140
- filePath,
19141
- errorMessages: [],
19142
- };
19406
+ return { filePath, errorMessages: [] };
19143
19407
  }
19144
19408
 
19145
19409
 
19146
19410
  /***/ },
19147
19411
 
19148
- /***/ 5443
19412
+ /***/ 2518
19149
19413
  (__unused_webpack_module, exports, __webpack_require__) {
19150
19414
 
19151
19415
 
19152
- var __importDefault = (this && this.__importDefault) || function (mod) {
19153
- return (mod && mod.__esModule) ? mod : { "default": mod };
19154
- };
19155
19416
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19156
19417
  exports.parseAppViewContent = void 0;
19157
- exports.appViewCreateService = appViewCreateService;
19158
- exports.appViewUpdateService = appViewUpdateService;
19159
- exports.appViewPullService = appViewPullService;
19160
- exports.appViewPushService = appViewPushService;
19161
- const node_path_1 = __importDefault(__webpack_require__(6760));
19162
- const node_fs_1 = __webpack_require__(3024);
19163
- const index_ts_1 = __webpack_require__(9985);
19164
- const file_ts_1 = __webpack_require__(5409);
19165
- const normalize_ts_1 = __importDefault(__webpack_require__(9268));
19166
- const paas_app_view_service_ts_1 = __webpack_require__(5585);
19167
- const xml = new index_ts_1.XmlMetadataManager();
19168
- const isRecord = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
19169
- const asRecord = (value) => isRecord(value) ? value : {};
19170
- const asText = (value) => typeof value === 'string' && value.trim() ? value.trim() : undefined;
19171
- const resultData = (value) => {
19172
- const response = asRecord(value);
19173
- return asRecord(response.data);
19174
- };
19175
- const listItems = (value) => {
19176
- const data = resultData(value);
19177
- const items = data.items ?? data.records ?? data.list ?? responseList(value);
19178
- return Array.isArray(items) ? items.filter(isRecord) : [];
19179
- };
19180
- const responseList = (value) => {
19181
- const response = asRecord(value);
19182
- return Array.isArray(response.data) ? response.data : undefined;
19183
- };
19184
- const PREFIX = 'local-';
19185
- const ruleName = (platform) => platform === 'web' ? 'PaasAppViewWeb' : 'PaasAppViewMobile';
19186
- const suffix = (platform) => platform === 'web' ? '.paas-app-view-web.xml' : '.paas-app-view-mobile.xml';
19187
- const listService = (platform) => platform === 'web' ? paas_app_view_service_ts_1.paasAppViewWebListService : paas_app_view_service_ts_1.paasAppViewMobileListService;
19188
- const detailService = (platform) => platform === 'web' ? paas_app_view_service_ts_1.paasAppViewWebDetailService : paas_app_view_service_ts_1.paasAppViewMobileDetailService;
19418
+ const request_ts_1 = __webpack_require__(6272);
19419
+ /** 解析 --content JSON 并校验为对象 */
19189
19420
  const parseAppViewContent = (raw) => {
19190
- if (!raw?.trim())
19421
+ if (!raw?.trim()) {
19191
19422
  throw new Error('--content is required.');
19423
+ }
19192
19424
  let parsed;
19193
19425
  try {
19194
19426
  parsed = JSON.parse(raw);
@@ -19196,79 +19428,278 @@ const parseAppViewContent = (raw) => {
19196
19428
  catch {
19197
19429
  throw new Error('--content must be valid JSON.');
19198
19430
  }
19199
- if (!isRecord(parsed))
19431
+ if (!(0, request_ts_1.isAppDevRecord)(parsed)) {
19200
19432
  throw new Error('--content must be a JSON object.');
19433
+ }
19201
19434
  return parsed;
19202
19435
  };
19203
19436
  exports.parseAppViewContent = parseAppViewContent;
19204
- async function appViewCreateService(platform, localKey, content, options = {}) {
19437
+
19438
+
19439
+ /***/ },
19440
+
19441
+ /***/ 9371
19442
+ (__unused_webpack_module, exports, __webpack_require__) {
19443
+
19444
+
19445
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19446
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19447
+ };
19448
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19449
+ exports.appViewWebCreateService = appViewWebCreateService;
19450
+ const index_ts_1 = __webpack_require__(9985);
19451
+ const normalize_ts_1 = __importDefault(__webpack_require__(9268));
19452
+ const xml = new index_ts_1.XmlMetadataManager();
19453
+ const PREFIX = 'local-';
19454
+ /** 创建本地 Web 视图 XML(仅写本地,远端同步走 push) */
19455
+ async function appViewWebCreateService(localKey, content, options = {}) {
19205
19456
  const key = normalize_ts_1.default.validateLocalKey(localKey);
19206
- if (!key)
19457
+ if (!key) {
19207
19458
  throw new Error('--localkey is required.');
19459
+ }
19208
19460
  const identity = `${PREFIX}${key}`;
19209
- const current = await xml.readXml(ruleName(platform), identity, { fields: ['content'] });
19210
- if (!options.force && current.content !== null && current.content !== undefined)
19461
+ const current = await xml.readXml('PaasAppViewWeb', identity, { fields: ['content'] });
19462
+ if (!options.force && current.content !== null && current.content !== undefined) {
19211
19463
  throw new Error(`Application view metadata already exists locally: ${identity}. Use --force to overwrite.`);
19212
- const filePath = await xml.writeXml(ruleName(platform), identity, content, { status: 'new' });
19464
+ }
19465
+ const filePath = await xml.writeXml('PaasAppViewWeb', identity, content, { status: 'new' });
19213
19466
  return { filePath, errorMessages: [] };
19214
19467
  }
19215
- async function appViewUpdateService(platform, templateId, content, updateTime) {
19216
- const id = templateId?.trim();
19217
- if (!id)
19218
- throw new Error('--templateId is required.');
19219
- const current = await xml.readXml(ruleName(platform), id, { fields: ['content', 'status', 'extra'] });
19220
- if (current.content === null || current.content === undefined)
19221
- throw new Error(`Application view metadata not found: ${id}`);
19222
- const filePath = await xml.writeXml(ruleName(platform), id, content, { contentMode: 'merge', status: current.status === 'new' ? 'new' : 'modified', extra: updateTime === undefined ? current.extra : { ...asRecord(current.extra), updateTime } });
19223
- return { filePath, errorMessages: [] };
19468
+
19469
+
19470
+ /***/ },
19471
+
19472
+ /***/ 5822
19473
+ (__unused_webpack_module, exports, __webpack_require__) {
19474
+
19475
+
19476
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19477
+ exports.appViewWebDetailService = appViewWebDetailService;
19478
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19479
+ const request_ts_1 = __webpack_require__(6272);
19480
+ const requestAppViewWebDetailExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebDetail'), input));
19481
+ /** 查询指定 Web 视图的完整详情 */
19482
+ async function appViewWebDetailService(input) {
19483
+ return await requestAppViewWebDetailExecute(input);
19224
19484
  }
19225
- async function appViewPullService(platform, appId, force = false) {
19226
- const errors = [];
19227
- const listResponse = await listService(platform)({ appId, pageNum: 1, pageSize: 100 });
19228
- const items = listItems(listResponse);
19485
+
19486
+
19487
+ /***/ },
19488
+
19489
+ /***/ 1060
19490
+ (__unused_webpack_module, exports, __webpack_require__) {
19491
+
19492
+
19493
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19494
+ exports.appViewWebLayoutComponentOptionsService = appViewWebLayoutComponentOptionsService;
19495
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19496
+ const request_ts_1 = __webpack_require__(6272);
19497
+ const requestAppViewWebLayoutComponentOptionsExecute = async () => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebLayoutComponentOptions'), {}));
19498
+ /** 查询 Web 视图可选布局组件 */
19499
+ async function appViewWebLayoutComponentOptionsService() {
19500
+ return await requestAppViewWebLayoutComponentOptionsExecute();
19501
+ }
19502
+
19503
+
19504
+ /***/ },
19505
+
19506
+ /***/ 1771
19507
+ (__unused_webpack_module, exports, __webpack_require__) {
19508
+
19509
+
19510
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19511
+ exports.appViewWebListService = appViewWebListService;
19512
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19513
+ const request_ts_1 = __webpack_require__(6272);
19514
+ const requestAppViewWebListExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebList'), input));
19515
+ /** 查询指定 PaaS 应用下的 Web 视图列表 */
19516
+ async function appViewWebListService(input) {
19517
+ return await requestAppViewWebListExecute(input);
19518
+ }
19519
+
19520
+
19521
+ /***/ },
19522
+
19523
+ /***/ 9515
19524
+ (__unused_webpack_module, exports, __webpack_require__) {
19525
+
19526
+
19527
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19528
+ exports.appViewWebMenuOptionsService = appViewWebMenuOptionsService;
19529
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19530
+ const request_ts_1 = __webpack_require__(6272);
19531
+ const requestAppViewWebMenuOptionsExecute = async () => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebMenuOptions'), {}));
19532
+ /** 查询 Web 视图可选菜单项 */
19533
+ async function appViewWebMenuOptionsService() {
19534
+ return await requestAppViewWebMenuOptionsExecute();
19535
+ }
19536
+
19537
+
19538
+ /***/ },
19539
+
19540
+ /***/ 6572
19541
+ (__unused_webpack_module, exports, __webpack_require__) {
19542
+
19543
+
19544
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19545
+ exports.appViewWebPullService = appViewWebPullService;
19546
+ const prompts_1 = __webpack_require__(118);
19547
+ const logger_ts_1 = __webpack_require__(3333);
19548
+ const index_ts_1 = __webpack_require__(9985);
19549
+ const request_ts_1 = __webpack_require__(6272);
19550
+ const app_view_web_detail_ts_1 = __webpack_require__(5822);
19551
+ const app_view_web_list_ts_1 = __webpack_require__(1771);
19552
+ const xml = new index_ts_1.XmlMetadataManager();
19553
+ const asText = (value) => (typeof value === 'string' && value.trim() ? value.trim() : undefined);
19554
+ const extractListItems = (response) => {
19555
+ const data = response.data;
19556
+ if (Array.isArray(data)) {
19557
+ return data;
19558
+ }
19559
+ const body = (0, request_ts_1.isAppDevRecord)(data) ? data : {};
19560
+ const items = body.items ?? body.records ?? body.list;
19561
+ return Array.isArray(items) ? items.filter(request_ts_1.isAppDevRecord) : [];
19562
+ };
19563
+ const extractDataRecord = (response) => ((0, request_ts_1.isAppDevRecord)(response.data) ? response.data : {});
19564
+ /** 拉取指定应用下的 Web 视图并写入本地 XML */
19565
+ async function appViewWebPullService(appId, options = {}) {
19566
+ const errorMessages = [];
19567
+ const pageNum = options.pageNum ?? 1;
19568
+ const pageSize = options.pageSize ?? 100;
19569
+ // 获取远端列表
19570
+ let items = [];
19571
+ try {
19572
+ const listResponse = await (0, app_view_web_list_ts_1.appViewWebListService)({ appId, pageNum, pageSize });
19573
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(listResponse, extractListItems);
19574
+ if (!result.success || result.data === undefined) {
19575
+ throw new Error(result.errorMessage || 'Unknown error.');
19576
+ }
19577
+ items = result.data;
19578
+ }
19579
+ catch (error) {
19580
+ errorMessages.push(`Application view list failed: ${error instanceof Error ? error.message : String(error)}`);
19581
+ return { found: 0, written: 0, skipped: 0, errorMessages };
19582
+ }
19229
19583
  let written = 0;
19230
19584
  let skipped = 0;
19585
+ // 逐条拉详情并写入本地
19231
19586
  for (const item of items) {
19232
19587
  const id = asText(item.templateId ?? item.id);
19233
- if (!id)
19588
+ if (!id) {
19234
19589
  continue;
19235
- const current = await xml.readXml(ruleName(platform), id, { fields: ['status'] });
19236
- if (!force && current.status !== 'unchanged' && current.status !== 'new') {
19590
+ }
19591
+ const current = await xml.readXml('PaasAppViewWeb', id, { fields: ['status'] });
19592
+ if (!options.force && current.status !== 'unchanged') {
19593
+ logger_ts_1.loggerService.warn(`Local Web view status is "${current.status}": ${id}, skipped. Use --force to overwrite.`);
19237
19594
  skipped += 1;
19238
19595
  continue;
19239
19596
  }
19597
+ if (options.force && current.status !== 'unchanged' && !options.yes) {
19598
+ const userConfirm = await (0, prompts_1.confirm)({
19599
+ message: `Local Web view status is "${current.status}": ${id}, overwrite?`,
19600
+ initialValue: false,
19601
+ });
19602
+ if (!userConfirm) {
19603
+ skipped += 1;
19604
+ continue;
19605
+ }
19606
+ }
19240
19607
  try {
19241
- const detailResponse = await detailService(platform)({ templateId: id });
19242
- const detail = resultData(detailResponse);
19243
- const content = asRecord(detail.content ?? detail);
19608
+ const detailResponse = await (0, app_view_web_detail_ts_1.appViewWebDetailService)({ templateId: id });
19609
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(detailResponse, extractDataRecord);
19610
+ if (!result.success || result.data === undefined) {
19611
+ throw new Error(result.errorMessage || 'Unknown error.');
19612
+ }
19613
+ const detail = result.data;
19614
+ const content = (0, request_ts_1.isAppDevRecord)(detail.content) ? detail.content : detail;
19244
19615
  content.appId = asText(item.appId ?? detail.appId) ?? appId;
19245
- const updateTime = detail.updateTime ?? item.updateTime;
19246
- await xml.writeXml(ruleName(platform), id, content, { status: 'unchanged', extra: { updateTime }, });
19616
+ await xml.writeXml('PaasAppViewWeb', id, content, {
19617
+ status: 'unchanged',
19618
+ extra: { updateTime: detail.updateTime ?? item.updateTime },
19619
+ });
19247
19620
  written += 1;
19248
19621
  }
19249
19622
  catch (error) {
19250
- errors.push(`${id}: ${error instanceof Error ? error.message : String(error)}`);
19623
+ errorMessages.push(`${id}: ${error instanceof Error ? error.message : String(error)}`);
19251
19624
  }
19252
19625
  }
19253
- return { found: items.length, written, skipped, errorMessages: errors };
19626
+ return { found: items.length, written, skipped, errorMessages };
19254
19627
  }
19255
- async function findFiles(platform) {
19256
- const dir = node_path_1.default.join(process.cwd(), 'tenant-config', 'paas-app-views', platform);
19257
- if (!(await (0, file_ts_1.pathExists)(dir)))
19628
+
19629
+
19630
+ /***/ },
19631
+
19632
+ /***/ 8087
19633
+ (__unused_webpack_module, exports, __webpack_require__) {
19634
+
19635
+
19636
+ var __importDefault = (this && this.__importDefault) || function (mod) {
19637
+ return (mod && mod.__esModule) ? mod : { "default": mod };
19638
+ };
19639
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19640
+ exports.appViewWebPushService = appViewWebPushService;
19641
+ const node_path_1 = __importDefault(__webpack_require__(6760));
19642
+ const node_fs_1 = __webpack_require__(3024);
19643
+ const file_ts_1 = __webpack_require__(5409);
19644
+ const index_ts_1 = __webpack_require__(9985);
19645
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19646
+ const request_ts_1 = __webpack_require__(6272);
19647
+ const app_view_web_detail_ts_1 = __webpack_require__(5822);
19648
+ const xml = new index_ts_1.XmlMetadataManager();
19649
+ const PREFIX = 'local-';
19650
+ const SUFFIX = '.paas-app-view-web.xml';
19651
+ const asText = (value) => (typeof value === 'string' && value.trim() ? value.trim() : undefined);
19652
+ const extractDataRecord = (response) => ((0, request_ts_1.isAppDevRecord)(response.data) ? response.data : {});
19653
+ const asRecord = (value) => ((0, request_ts_1.isAppDevRecord)(value) ? value : {});
19654
+ /** 扫描本地 Web 视图 XML 文件 */
19655
+ async function findLocalFiles() {
19656
+ const dir = node_path_1.default.join(process.cwd(), 'tenant-config', 'paas-app-views', 'web');
19657
+ if (!(await (0, file_ts_1.pathExists)(dir))) {
19258
19658
  return [];
19659
+ }
19259
19660
  const entries = await node_fs_1.promises.readdir(dir, { withFileTypes: true });
19260
- return entries.filter((entry) => entry.isFile() && entry.name.endsWith(suffix(platform))).map((entry) => entry.name.slice(0, -suffix(platform).length));
19661
+ return entries
19662
+ .filter((entry) => entry.isFile() && entry.name.endsWith(SUFFIX))
19663
+ .map((entry) => entry.name.slice(0, -SUFFIX.length));
19261
19664
  }
19262
- async function appViewPushService(platform, options) {
19263
- if (options.all && options.templateId)
19665
+ /** templateId 精确查询远端存在性 */
19666
+ async function fetchRemoteView(templateId, errorMessages) {
19667
+ try {
19668
+ const response = await (0, app_view_web_detail_ts_1.appViewWebDetailService)({ templateId });
19669
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, extractDataRecord);
19670
+ if (!result.success) {
19671
+ const message = result.errorMessage || 'Unknown error.';
19672
+ if (/not found|不存在|404/i.test(message)) {
19673
+ return { status: 'missing' };
19674
+ }
19675
+ errorMessages.push(`remote existence check failed: ${templateId}: ${message}`);
19676
+ return { status: 'unknown' };
19677
+ }
19678
+ const data = result.data ?? {};
19679
+ return { status: 'exists', updateTime: typeof data.updateTime === 'number' ? data.updateTime : undefined };
19680
+ }
19681
+ catch (error) {
19682
+ errorMessages.push(`remote existence check failed: ${templateId}: ${error instanceof Error ? error.message : String(error)}`);
19683
+ return { status: 'unknown' };
19684
+ }
19685
+ }
19686
+ /** 推送本地 Web 视图 XML 到远端 */
19687
+ async function appViewWebPushService(options) {
19688
+ if (options.all && options.templateId) {
19264
19689
  throw new Error('Invalid arguments: use either --all or --templateId, not both.');
19265
- const ids = options.templateId ? [options.templateId.trim()] : options.all ? await findFiles(platform) : [];
19266
- if (!ids.length)
19690
+ }
19691
+ const ids = options.templateId
19692
+ ? [options.templateId.trim()]
19693
+ : options.all
19694
+ ? await findLocalFiles()
19695
+ : [];
19696
+ if (!ids.length) {
19267
19697
  throw new Error('Specify --all or --templateId.');
19698
+ }
19268
19699
  const result = { pushed: 0, skipped: 0, failed: 0, results: [], errorMessages: [] };
19269
19700
  for (const id of ids) {
19270
19701
  try {
19271
- const local = await xml.readXml(ruleName(platform), id, { fields: ['content', 'status', 'extra'] });
19702
+ const local = await xml.readXml('PaasAppViewWeb', id, { fields: ['content', 'status', 'extra'] });
19272
19703
  if (local.status === 'unchanged') {
19273
19704
  result.skipped += 1;
19274
19705
  result.results.push({ templateId: id, action: 'skip' });
@@ -19276,35 +19707,94 @@ async function appViewPushService(platform, options) {
19276
19707
  }
19277
19708
  const content = asRecord(local.content);
19278
19709
  const appId = asText(content.appId);
19279
- if (!appId)
19710
+ if (!appId) {
19280
19711
  throw new Error(`Missing appId in local view: ${id}`);
19281
- const extra = asRecord(local.extra);
19282
- const updateTime = Number(extra.updateTime);
19712
+ }
19713
+ // local- 前缀文件没有远端 id,跳过存在性检查,直接走 create
19714
+ const isLocalPlaceholder = id.startsWith(PREFIX);
19715
+ let isCreate = isLocalPlaceholder || local.status === 'new';
19716
+ if (!isLocalPlaceholder) {
19717
+ const remote = await fetchRemoteView(id, result.errorMessages);
19718
+ if (remote.status === 'unknown') {
19719
+ throw new Error(`Remote existence check failed: ${id}`);
19720
+ }
19721
+ if (local.status === 'new' && remote.status === 'exists') {
19722
+ await xml.writeXml('PaasAppViewWeb', id, content, {
19723
+ status: 'modified',
19724
+ extra: { ...asRecord(local.extra), updateTime: remote.updateTime },
19725
+ });
19726
+ isCreate = false;
19727
+ }
19728
+ else if (local.status !== 'new' && remote.status === 'missing') {
19729
+ await xml.writeXml('PaasAppViewWeb', id, content, { status: 'new' });
19730
+ isCreate = true;
19731
+ }
19732
+ }
19733
+ // pre-pull:非 create 时精确复核当前目标并校准 updateTime(不触碰同应用其他文件)
19734
+ if (!isCreate) {
19735
+ const preDetail = await (0, app_view_web_detail_ts_1.appViewWebDetailService)({ templateId: id });
19736
+ const preResult = await (0, request_ts_1.extractAppDevServiceResult)(preDetail, extractDataRecord);
19737
+ if (!preResult.success || preResult.data === undefined) {
19738
+ throw new Error(preResult.errorMessage || 'Unknown error.');
19739
+ }
19740
+ const preData = preResult.data;
19741
+ const remoteUpdateTime = typeof preData.updateTime === 'number' ? preData.updateTime : undefined;
19742
+ if (remoteUpdateTime !== undefined) {
19743
+ await xml.writeXml('PaasAppViewWeb', id, content, {
19744
+ status: 'modified',
19745
+ extra: { ...asRecord(local.extra), updateTime: remoteUpdateTime },
19746
+ });
19747
+ }
19748
+ }
19283
19749
  let newId;
19284
- if (id.startsWith(PREFIX)) {
19285
- const payload = { ...content };
19286
- const response = platform === 'web'
19287
- ? await (0, paas_app_view_service_ts_1.paasAppViewWebCreateService)(payload)
19288
- : await (0, paas_app_view_service_ts_1.paasAppViewMobileCreateService)(payload);
19289
- const data = resultData(response);
19290
- newId = asText(data.templateId ?? data.id);
19291
- if (!newId)
19750
+ const latest = await xml.readXml('PaasAppViewWeb', id, { fields: ['content', 'extra'] });
19751
+ const latestContent = asRecord(latest.content ?? content);
19752
+ if (isCreate) {
19753
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebCreate'), latestContent);
19754
+ const data = await (0, request_ts_1.extractAppDevServiceResult)(response, extractDataRecord);
19755
+ if (!data.success || data.data === undefined) {
19756
+ throw new Error(data.errorMessage || 'Unknown error.');
19757
+ }
19758
+ newId = asText(data.data.templateId ?? data.data.id);
19759
+ if (!newId) {
19292
19760
  throw new Error('Server response missing templateId.');
19293
- await xml.renameXml(ruleName(platform), id, newId, {});
19761
+ }
19762
+ await xml.renameXml('PaasAppViewWeb', id, newId, {});
19294
19763
  }
19295
19764
  else {
19296
- if (!Number.isSafeInteger(updateTime) || updateTime <= 0)
19765
+ const extra = asRecord(latest.extra);
19766
+ const updateTime = Number(extra.updateTime);
19767
+ if (!Number.isSafeInteger(updateTime) || updateTime <= 0) {
19297
19768
  throw new Error(`Missing updateTime for ${id}, try pull first.`);
19298
- const payload = { templateId: id, updateTime, ...content };
19769
+ }
19770
+ const payload = { ...latestContent, templateId: id, updateTime };
19299
19771
  delete payload.appId;
19300
- if (platform === 'web')
19301
- await (0, paas_app_view_service_ts_1.paasAppViewWebUpdateService)(payload);
19302
- else
19303
- await (0, paas_app_view_service_ts_1.paasAppViewMobileUpdateService)(payload);
19772
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebUpdate'), payload);
19773
+ const updated = await (0, request_ts_1.extractAppDevServiceResult)(response, extractDataRecord);
19774
+ if (!updated.success) {
19775
+ throw new Error(updated.errorMessage || 'Unknown error.');
19776
+ }
19777
+ }
19778
+ // 回写本地 status=unchanged(本次推送已成功,本地与远端一致)
19779
+ const targetId = newId ?? id;
19780
+ await xml.writeXml('PaasAppViewWeb', targetId, latestContent, { status: 'unchanged' });
19781
+ // post-pull:精确拉取当前目标并以远端完整 content replace(不触碰同应用其他文件;失败仅记录,不影响本次 push 结果)
19782
+ const postDetail = await (0, app_view_web_detail_ts_1.appViewWebDetailService)({ templateId: targetId });
19783
+ const postResult = await (0, request_ts_1.extractAppDevServiceResult)(postDetail, extractDataRecord);
19784
+ if (postResult.success && postResult.data !== undefined) {
19785
+ const postData = postResult.data;
19786
+ const remoteContent = (0, request_ts_1.isAppDevRecord)(postData.content) ? postData.content : postData;
19787
+ remoteContent.appId = appId;
19788
+ await xml.writeXml('PaasAppViewWeb', targetId, remoteContent, {
19789
+ status: 'unchanged',
19790
+ extra: { updateTime: typeof postData.updateTime === 'number' ? postData.updateTime : undefined },
19791
+ });
19792
+ }
19793
+ else {
19794
+ result.errorMessages.push(`Post-pull failed for ${targetId}: ${postResult.errorMessage || 'Unknown error.'}`);
19304
19795
  }
19305
- await xml.writeXml(ruleName(platform), newId ?? id, content, { status: 'unchanged' });
19306
19796
  result.pushed += 1;
19307
- result.results.push({ templateId: id, action: id.startsWith(PREFIX) ? 'create' : 'update', newId });
19797
+ result.results.push({ templateId: id, action: isCreate ? 'create' : 'update', newId });
19308
19798
  }
19309
19799
  catch (error) {
19310
19800
  result.failed += 1;
@@ -19319,411 +19809,74 @@ async function appViewPushService(platform, options) {
19319
19809
 
19320
19810
  /***/ },
19321
19811
 
19322
- /***/ 439
19812
+ /***/ 1926
19323
19813
  (__unused_webpack_module, exports, __webpack_require__) {
19324
19814
 
19325
19815
 
19326
- var __importDefault = (this && this.__importDefault) || function (mod) {
19327
- return (mod && mod.__esModule) ? mod : { "default": mod };
19328
- };
19329
19816
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19330
- exports.appDevPaasAppViewMobileMenuComponentOptionsCommand = exports.appDevPaasAppViewMobilePageComponentOptionsCommand = exports.appDevPaasAppViewMobileUpdateCommand = exports.appDevPaasAppViewMobileCreateCommand = exports.appDevPaasAppViewMobileDetailCommand = exports.appDevPaasAppViewMobileListCommand = exports.appDevPaasAppViewWebUtilityBarIconOptionsCommand = exports.appDevPaasAppViewWebUtilityBarComponentOptionsCommand = exports.appDevPaasAppViewWebLayoutComponentOptionsCommand = exports.appDevPaasAppViewWebMenuOptionsCommand = exports.appDevPaasAppViewWebUpdateCommand = exports.appDevPaasAppViewWebCreateCommand = exports.appDevPaasAppViewWebDetailCommand = exports.appDevPaasAppViewWebListCommand = void 0;
19331
- const logger_ts_1 = __webpack_require__(3333);
19332
- const file_ts_1 = __webpack_require__(5409);
19333
- const node_path_1 = __importDefault(__webpack_require__(6760));
19334
- const paas_app_view_service_ts_1 = __webpack_require__(5585);
19335
- const paas_app_view_local_service_ts_1 = __webpack_require__(5443);
19336
- const isJsonObject = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
19337
- const parseRequiredString = (value, optionName) => {
19338
- const parsed = value?.trim();
19339
- if (!parsed) {
19340
- throw new Error(`${optionName} is required.`);
19341
- }
19342
- return parsed;
19343
- };
19344
- const parsePositiveInteger = (value, optionName, max) => {
19345
- if (value === undefined) {
19346
- return undefined;
19347
- }
19348
- const parsed = Number(value);
19349
- if (!Number.isSafeInteger(parsed) || parsed <= 0 || (max !== undefined && parsed > max)) {
19350
- const maxHint = max === undefined ? '' : ` and at most ${max}`;
19351
- throw new Error(`${optionName} must be a positive integer${maxHint}.`);
19352
- }
19353
- return parsed;
19354
- };
19355
- const parseUpdateTime = (value) => {
19356
- const parsed = parsePositiveInteger(value, '--updateTime');
19357
- if (parsed === undefined) {
19358
- throw new Error('--updateTime is required.');
19359
- }
19360
- return parsed;
19361
- };
19362
- const parseJsonObject = (value, optionName, required) => {
19363
- if (!value?.trim()) {
19364
- if (required) {
19365
- throw new Error(`${optionName} is required.`);
19366
- }
19367
- return undefined;
19368
- }
19369
- let parsed;
19370
- try {
19371
- parsed = JSON.parse(value);
19372
- }
19373
- catch {
19374
- throw new Error(`${optionName} must be valid JSON.`);
19375
- }
19376
- if (!isJsonObject(parsed)) {
19377
- throw new Error(`${optionName} must be a JSON object.`);
19378
- }
19379
- return parsed;
19380
- };
19381
- const parseFileString = (value, fieldName) => {
19382
- if (typeof value !== 'string' || !value.trim()) {
19383
- throw new Error(`${fieldName} in --input-file must be a non-empty string.`);
19384
- }
19385
- return value.trim();
19386
- };
19387
- const parseFileUpdateTime = (value) => {
19388
- if (typeof value !== 'number' || !Number.isSafeInteger(value) || value <= 0) {
19389
- throw new Error('updateTime in --input-file must be a positive safe integer.');
19390
- }
19391
- return value;
19392
- };
19393
- const parseFileJsonObject = (value, fieldName, required) => {
19394
- if (value === undefined) {
19395
- if (required) {
19396
- throw new Error(`${fieldName} is required in --input-file.`);
19397
- }
19398
- return undefined;
19399
- }
19400
- if (!isJsonObject(value)) {
19401
- throw new Error(`${fieldName} in --input-file must be a JSON object.`);
19402
- }
19403
- return value;
19404
- };
19405
- const assertFileFields = (input, allowedFields) => {
19406
- const unsupportedFields = Object.keys(input).filter((field) => !allowedFields.includes(field));
19407
- if (unsupportedFields.length) {
19408
- throw new Error(`--input-file contains unsupported fields: ${unsupportedFields.join(', ')}.`);
19409
- }
19410
- };
19411
- const readApplicationViewInputFile = async (context, inputFile) => {
19412
- const filePath = node_path_1.default.resolve(context.cwd, parseRequiredString(inputFile, '--input-file'));
19413
- let content;
19414
- try {
19415
- content = await (0, file_ts_1.readTextFile)(filePath);
19416
- }
19417
- catch {
19418
- throw new Error(`Unable to read --input-file: ${filePath}.`);
19419
- }
19420
- let parsed;
19421
- try {
19422
- parsed = JSON.parse(content.replace(/^\uFEFF/, '').trim());
19423
- }
19424
- catch {
19425
- throw new Error('--input-file must contain valid JSON.');
19426
- }
19427
- if (!isJsonObject(parsed)) {
19428
- throw new Error('--input-file must contain a JSON object.');
19429
- }
19430
- return parsed;
19431
- };
19432
- const assertInputFileExclusive = (inputFile, inlineOptions) => {
19433
- if (inputFile === undefined) {
19434
- return;
19435
- }
19436
- if (inlineOptions.some(([, value]) => value !== undefined)) {
19437
- const optionNames = inlineOptions.map(([name]) => name);
19438
- const lastOption = optionNames.pop();
19439
- throw new Error(`--input-file cannot be combined with ${optionNames.join(', ')}, or ${lastOption}.`);
19440
- }
19441
- };
19442
- const parseWebCreateFileInput = (input) => {
19443
- assertFileFields(input, ['appId', 'template', 'menu', 'layout', 'utilityBar']);
19444
- return {
19445
- appId: parseFileString(input.appId, 'appId'),
19446
- template: parseFileJsonObject(input.template, 'template', true),
19447
- menu: parseFileJsonObject(input.menu, 'menu', true),
19448
- layout: parseFileJsonObject(input.layout, 'layout', true),
19449
- utilityBar: parseFileJsonObject(input.utilityBar, 'utilityBar', false),
19450
- };
19451
- };
19452
- const parseWebUpdateFileInput = (input) => {
19453
- assertFileFields(input, ['templateId', 'updateTime', 'template', 'menu', 'layout', 'utilityBar']);
19454
- return {
19455
- templateId: parseFileString(input.templateId, 'templateId'),
19456
- updateTime: parseFileUpdateTime(input.updateTime),
19457
- template: parseFileJsonObject(input.template, 'template', false),
19458
- menu: parseFileJsonObject(input.menu, 'menu', false),
19459
- layout: parseFileJsonObject(input.layout, 'layout', false),
19460
- utilityBar: parseFileJsonObject(input.utilityBar, 'utilityBar', false),
19461
- };
19462
- };
19463
- const parseMobileCreateFileInput = (input) => {
19464
- assertFileFields(input, ['appId', 'template', 'pageData']);
19465
- return {
19466
- appId: parseFileString(input.appId, 'appId'),
19467
- template: parseFileJsonObject(input.template, 'template', true),
19468
- pageData: parseFileJsonObject(input.pageData, 'pageData', true),
19469
- };
19470
- };
19471
- const parseMobileUpdateFileInput = (input) => {
19472
- assertFileFields(input, ['templateId', 'updateTime', 'template', 'pageData']);
19473
- return {
19474
- templateId: parseFileString(input.templateId, 'templateId'),
19475
- updateTime: parseFileUpdateTime(input.updateTime),
19476
- template: parseFileJsonObject(input.template, 'template', false),
19477
- pageData: parseFileJsonObject(input.pageData, 'pageData', false),
19478
- };
19479
- };
19480
- const printApplicationViewResponse = (response, commandName) => {
19481
- logger_ts_1.loggerService.printJson(response);
19482
- if (isJsonObject(response)
19483
- && response.success === true
19484
- && response.code === 'OK') {
19485
- return;
19486
- }
19487
- const message = isJsonObject(response) && typeof response.message === 'string' && response.message.trim()
19488
- ? response.message.trim()
19489
- : 'Unknown server error.';
19490
- throw new Error(`${commandName} failed: ${message}`);
19491
- };
19492
- const runApplicationViewCommand = async (loadingMessage, commandName, operation) => {
19493
- logger_ts_1.loggerService.startLoading(loadingMessage);
19494
- try {
19495
- printApplicationViewResponse(await operation(), commandName);
19496
- }
19497
- finally {
19498
- logger_ts_1.loggerService.stopLoading();
19499
- }
19500
- };
19501
- const parseListInput = (options) => ({
19502
- appId: parseRequiredString(options.appId, '--appId'),
19503
- pageNum: parsePositiveInteger(options.pageNum, '--pageNum'),
19504
- pageSize: parsePositiveInteger(options.pageSize, '--pageSize', 100),
19505
- });
19506
- const parseDetailInput = (options) => ({
19507
- templateId: parseRequiredString(options.templateId, '--templateId'),
19508
- });
19509
- const appDevPaasAppViewWebListCommand = async (context, options) => {
19510
- void context;
19511
- const input = parseListInput(options);
19512
- await runApplicationViewCommand('Listing PaaS application Web views...', 'app-view-web-list', () => (0, paas_app_view_service_ts_1.paasAppViewWebListService)(input));
19513
- };
19514
- exports.appDevPaasAppViewWebListCommand = appDevPaasAppViewWebListCommand;
19515
- const appDevPaasAppViewWebDetailCommand = async (context, options) => {
19516
- void context;
19517
- const input = parseDetailInput(options);
19518
- await runApplicationViewCommand('Loading the PaaS application Web view...', 'app-view-web-detail', () => (0, paas_app_view_service_ts_1.paasAppViewWebDetailService)(input));
19519
- };
19520
- exports.appDevPaasAppViewWebDetailCommand = appDevPaasAppViewWebDetailCommand;
19521
- const appDevPaasAppViewWebCreateCommand = async (context, options) => {
19522
- if (options.localKey !== undefined || options.content !== undefined) {
19523
- if (options.inputFile !== undefined || options.appId !== undefined || options.template !== undefined || options.menu !== undefined || options.layout !== undefined || options.utilityBar !== undefined) {
19524
- throw new Error('--localkey/--content cannot be combined with remote create options.');
19525
- }
19526
- const content = (0, paas_app_view_local_service_ts_1.parseAppViewContent)(options.content);
19527
- const result = await (0, paas_app_view_local_service_ts_1.appViewCreateService)('web', options.localKey, content, { force: options.force === true });
19528
- logger_ts_1.loggerService.success(`Local Web application view created: ${result.filePath}`);
19529
- return;
19530
- }
19531
- assertInputFileExclusive(options.inputFile, [
19532
- ['--appId', options.appId],
19533
- ['--template', options.template],
19534
- ['--menu', options.menu],
19535
- ['--layout', options.layout],
19536
- ['--utilityBar', options.utilityBar],
19537
- ]);
19538
- const input = options.inputFile !== undefined
19539
- ? parseWebCreateFileInput(await readApplicationViewInputFile(context, options.inputFile))
19540
- : {
19541
- appId: parseRequiredString(options.appId, '--appId'),
19542
- template: parseJsonObject(options.template, '--template', true),
19543
- menu: parseJsonObject(options.menu, '--menu', true),
19544
- layout: parseJsonObject(options.layout, '--layout', true),
19545
- utilityBar: parseJsonObject(options.utilityBar, '--utilityBar', false),
19546
- };
19547
- await runApplicationViewCommand('Creating the PaaS application Web view...', 'app-view-web-create', () => (0, paas_app_view_service_ts_1.paasAppViewWebCreateService)(input));
19548
- };
19549
- exports.appDevPaasAppViewWebCreateCommand = appDevPaasAppViewWebCreateCommand;
19550
- const appDevPaasAppViewWebUpdateCommand = async (context, options) => {
19551
- if (options.content !== undefined) {
19552
- const content = (0, paas_app_view_local_service_ts_1.parseAppViewContent)(options.content);
19553
- const result = await (0, paas_app_view_local_service_ts_1.appViewUpdateService)('web', options.templateId, content, options.updateTime === undefined ? undefined : parseUpdateTime(options.updateTime));
19554
- logger_ts_1.loggerService.success(`Local Web application view updated: ${result.filePath}`);
19555
- return;
19556
- }
19557
- assertInputFileExclusive(options.inputFile, [
19558
- ['--templateId', options.templateId],
19559
- ['--updateTime', options.updateTime],
19560
- ['--template', options.template],
19561
- ['--menu', options.menu],
19562
- ['--layout', options.layout],
19563
- ['--utilityBar', options.utilityBar],
19564
- ]);
19565
- const input = options.inputFile !== undefined
19566
- ? parseWebUpdateFileInput(await readApplicationViewInputFile(context, options.inputFile))
19567
- : {
19568
- templateId: parseRequiredString(options.templateId, '--templateId'),
19569
- updateTime: parseUpdateTime(options.updateTime),
19570
- template: parseJsonObject(options.template, '--template', false),
19571
- menu: parseJsonObject(options.menu, '--menu', false),
19572
- layout: parseJsonObject(options.layout, '--layout', false),
19573
- utilityBar: parseJsonObject(options.utilityBar, '--utilityBar', false),
19574
- };
19575
- if (!input.template && !input.menu && !input.layout && !input.utilityBar) {
19576
- throw new Error('Web application view update requires at least one of --template, --menu, --layout, or --utilityBar.');
19577
- }
19578
- await runApplicationViewCommand('Updating the PaaS application Web view...', 'app-view-web-update', () => (0, paas_app_view_service_ts_1.paasAppViewWebUpdateService)(input));
19579
- };
19580
- exports.appDevPaasAppViewWebUpdateCommand = appDevPaasAppViewWebUpdateCommand;
19581
- const appDevPaasAppViewWebMenuOptionsCommand = async (context, _options) => {
19582
- void context;
19583
- await runApplicationViewCommand('Loading PaaS application Web menu options...', 'app-view-web-menu-options', () => (0, paas_app_view_service_ts_1.paasAppViewWebMenuOptionsService)({}));
19584
- };
19585
- exports.appDevPaasAppViewWebMenuOptionsCommand = appDevPaasAppViewWebMenuOptionsCommand;
19586
- const appDevPaasAppViewWebLayoutComponentOptionsCommand = async (context, _options) => {
19587
- void context;
19588
- await runApplicationViewCommand('Loading PaaS application Web layout component options...', 'app-view-web-layout-component-options', () => (0, paas_app_view_service_ts_1.paasAppViewWebLayoutComponentOptionsService)({}));
19589
- };
19590
- exports.appDevPaasAppViewWebLayoutComponentOptionsCommand = appDevPaasAppViewWebLayoutComponentOptionsCommand;
19591
- const parseOptionsByAppInput = (options) => ({
19592
- appId: parseRequiredString(options.appId, '--appId'),
19593
- });
19594
- const appDevPaasAppViewWebUtilityBarComponentOptionsCommand = async (context, options) => {
19595
- void context;
19596
- const input = parseOptionsByAppInput(options);
19597
- await runApplicationViewCommand('Loading PaaS application Web utility bar component options...', 'app-view-web-utility-bar-component-options', () => (0, paas_app_view_service_ts_1.paasAppViewWebUtilityBarComponentOptionsService)(input));
19598
- };
19599
- exports.appDevPaasAppViewWebUtilityBarComponentOptionsCommand = appDevPaasAppViewWebUtilityBarComponentOptionsCommand;
19600
- const appDevPaasAppViewWebUtilityBarIconOptionsCommand = async (context, options) => {
19601
- void context;
19602
- const input = parseOptionsByAppInput(options);
19603
- await runApplicationViewCommand('Loading PaaS application Web utility bar icon options...', 'app-view-web-utility-bar-icon-options', () => (0, paas_app_view_service_ts_1.paasAppViewWebUtilityBarIconOptionsService)(input));
19604
- };
19605
- exports.appDevPaasAppViewWebUtilityBarIconOptionsCommand = appDevPaasAppViewWebUtilityBarIconOptionsCommand;
19606
- const appDevPaasAppViewMobileListCommand = async (context, options) => {
19607
- void context;
19608
- const input = parseListInput(options);
19609
- await runApplicationViewCommand('Listing PaaS application Mobile views...', 'app-view-mobile-list', () => (0, paas_app_view_service_ts_1.paasAppViewMobileListService)(input));
19610
- };
19611
- exports.appDevPaasAppViewMobileListCommand = appDevPaasAppViewMobileListCommand;
19612
- const appDevPaasAppViewMobileDetailCommand = async (context, options) => {
19613
- void context;
19614
- const input = parseDetailInput(options);
19615
- await runApplicationViewCommand('Loading the PaaS application Mobile view...', 'app-view-mobile-detail', () => (0, paas_app_view_service_ts_1.paasAppViewMobileDetailService)(input));
19616
- };
19617
- exports.appDevPaasAppViewMobileDetailCommand = appDevPaasAppViewMobileDetailCommand;
19618
- const appDevPaasAppViewMobileCreateCommand = async (context, options) => {
19619
- if (options.localKey !== undefined || options.content !== undefined) {
19620
- if (options.inputFile !== undefined || options.appId !== undefined || options.template !== undefined || options.pageData !== undefined) {
19621
- throw new Error('--localkey/--content cannot be combined with remote create options.');
19622
- }
19623
- const content = (0, paas_app_view_local_service_ts_1.parseAppViewContent)(options.content);
19624
- const result = await (0, paas_app_view_local_service_ts_1.appViewCreateService)('mobile', options.localKey, content, { force: options.force === true });
19625
- logger_ts_1.loggerService.success(`Local Mobile application view created: ${result.filePath}`);
19626
- return;
19627
- }
19628
- assertInputFileExclusive(options.inputFile, [
19629
- ['--appId', options.appId],
19630
- ['--template', options.template],
19631
- ['--pageData', options.pageData],
19632
- ]);
19633
- const input = options.inputFile !== undefined
19634
- ? parseMobileCreateFileInput(await readApplicationViewInputFile(context, options.inputFile))
19635
- : {
19636
- appId: parseRequiredString(options.appId, '--appId'),
19637
- template: parseJsonObject(options.template, '--template', true),
19638
- pageData: parseJsonObject(options.pageData, '--pageData', true),
19639
- };
19640
- await runApplicationViewCommand('Creating the PaaS application Mobile view...', 'app-view-mobile-create', () => (0, paas_app_view_service_ts_1.paasAppViewMobileCreateService)(input));
19641
- };
19642
- exports.appDevPaasAppViewMobileCreateCommand = appDevPaasAppViewMobileCreateCommand;
19643
- const appDevPaasAppViewMobileUpdateCommand = async (context, options) => {
19644
- if (options.content !== undefined) {
19645
- const content = (0, paas_app_view_local_service_ts_1.parseAppViewContent)(options.content);
19646
- const result = await (0, paas_app_view_local_service_ts_1.appViewUpdateService)('mobile', options.templateId, content, options.updateTime === undefined ? undefined : parseUpdateTime(options.updateTime));
19647
- logger_ts_1.loggerService.success(`Local Mobile application view updated: ${result.filePath}`);
19648
- return;
19817
+ exports.appViewWebUpdateService = appViewWebUpdateService;
19818
+ const index_ts_1 = __webpack_require__(9985);
19819
+ const request_ts_1 = __webpack_require__(6272);
19820
+ const xml = new index_ts_1.XmlMetadataManager();
19821
+ /** 更新本地 Web 视图 XML(仅写本地,远端同步走 push) */
19822
+ async function appViewWebUpdateService(templateId, content, updateTime) {
19823
+ const id = templateId?.trim();
19824
+ if (!id) {
19825
+ throw new Error('--templateId is required.');
19649
19826
  }
19650
- assertInputFileExclusive(options.inputFile, [
19651
- ['--templateId', options.templateId],
19652
- ['--updateTime', options.updateTime],
19653
- ['--template', options.template],
19654
- ['--pageData', options.pageData],
19655
- ]);
19656
- const input = options.inputFile !== undefined
19657
- ? parseMobileUpdateFileInput(await readApplicationViewInputFile(context, options.inputFile))
19658
- : {
19659
- templateId: parseRequiredString(options.templateId, '--templateId'),
19660
- updateTime: parseUpdateTime(options.updateTime),
19661
- template: parseJsonObject(options.template, '--template', false),
19662
- pageData: parseJsonObject(options.pageData, '--pageData', false),
19663
- };
19664
- if (!input.template && !input.pageData) {
19665
- const fields = options.inputFile !== undefined ? 'template or pageData' : '--template or --pageData';
19666
- throw new Error(`Mobile application view update requires at least one of ${fields}.`);
19827
+ const current = await xml.readXml('PaasAppViewWeb', id, { fields: ['content', 'status', 'extra'] });
19828
+ if (current.content === null || current.content === undefined) {
19829
+ throw new Error(`Application view metadata not found: ${id}`);
19667
19830
  }
19668
- await runApplicationViewCommand('Updating the PaaS application Mobile view...', 'app-view-mobile-update', () => (0, paas_app_view_service_ts_1.paasAppViewMobileUpdateService)(input));
19669
- };
19670
- exports.appDevPaasAppViewMobileUpdateCommand = appDevPaasAppViewMobileUpdateCommand;
19671
- const appDevPaasAppViewMobilePageComponentOptionsCommand = async (context, _options) => {
19672
- void context;
19673
- await runApplicationViewCommand('Loading PaaS application Mobile page component options...', 'app-view-mobile-page-component-options', () => (0, paas_app_view_service_ts_1.paasAppViewMobilePageComponentOptionsService)({}));
19674
- };
19675
- exports.appDevPaasAppViewMobilePageComponentOptionsCommand = appDevPaasAppViewMobilePageComponentOptionsCommand;
19676
- const appDevPaasAppViewMobileMenuComponentOptionsCommand = async (context, _options) => {
19677
- void context;
19678
- await runApplicationViewCommand('Loading PaaS application Mobile menu component options...', 'app-view-mobile-menu-component-options', () => (0, paas_app_view_service_ts_1.paasAppViewMobileMenuComponentOptionsService)({}));
19679
- };
19680
- exports.appDevPaasAppViewMobileMenuComponentOptionsCommand = appDevPaasAppViewMobileMenuComponentOptionsCommand;
19831
+ const extra = updateTime === undefined
19832
+ ? current.extra
19833
+ : { ...((0, request_ts_1.isAppDevRecord)(current.extra) ? current.extra : {}), updateTime };
19834
+ const filePath = await xml.writeXml('PaasAppViewWeb', id, content, {
19835
+ contentMode: 'merge',
19836
+ status: current.status === 'new' ? 'new' : 'modified',
19837
+ extra,
19838
+ });
19839
+ return { filePath, errorMessages: [] };
19840
+ }
19681
19841
 
19682
19842
 
19683
19843
  /***/ },
19684
19844
 
19685
- /***/ 5585
19845
+ /***/ 3698
19686
19846
  (__unused_webpack_module, exports, __webpack_require__) {
19687
19847
 
19688
19848
 
19689
19849
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19690
- exports.paasAppViewMobileMenuComponentOptionsService = exports.paasAppViewMobilePageComponentOptionsService = exports.paasAppViewMobileUpdateService = exports.paasAppViewMobileCreateService = exports.paasAppViewMobileDetailService = exports.paasAppViewMobileListService = exports.paasAppViewWebUtilityBarIconOptionsService = exports.paasAppViewWebUtilityBarComponentOptionsService = exports.paasAppViewWebLayoutComponentOptionsService = exports.paasAppViewWebMenuOptionsService = exports.paasAppViewWebUpdateService = exports.paasAppViewWebCreateService = exports.paasAppViewWebDetailService = exports.paasAppViewWebListService = void 0;
19850
+ exports.appViewWebUtilityBarComponentOptionsService = appViewWebUtilityBarComponentOptionsService;
19691
19851
  const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19692
- const request_execute_ts_1 = __webpack_require__(8554);
19693
- const executeAppViewCommand = async (key, data) => (0, request_execute_ts_1.executeShareCliCommand)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', key), data);
19694
- const paasAppViewWebListService = async (input) => executeAppViewCommand('paasAppViewWebList', input);
19695
- exports.paasAppViewWebListService = paasAppViewWebListService;
19696
- const paasAppViewWebDetailService = async (input) => executeAppViewCommand('paasAppViewWebDetail', input);
19697
- exports.paasAppViewWebDetailService = paasAppViewWebDetailService;
19698
- const paasAppViewWebCreateService = async (input) => executeAppViewCommand('paasAppViewWebCreate', input);
19699
- exports.paasAppViewWebCreateService = paasAppViewWebCreateService;
19700
- const paasAppViewWebUpdateService = async (input) => executeAppViewCommand('paasAppViewWebUpdate', input);
19701
- exports.paasAppViewWebUpdateService = paasAppViewWebUpdateService;
19702
- const paasAppViewWebMenuOptionsService = async (input) => executeAppViewCommand('paasAppViewWebMenuOptions', input);
19703
- exports.paasAppViewWebMenuOptionsService = paasAppViewWebMenuOptionsService;
19704
- const paasAppViewWebLayoutComponentOptionsService = async (input) => executeAppViewCommand('paasAppViewWebLayoutComponentOptions', input);
19705
- exports.paasAppViewWebLayoutComponentOptionsService = paasAppViewWebLayoutComponentOptionsService;
19706
- const paasAppViewWebUtilityBarComponentOptionsService = async (input) => executeAppViewCommand('paasAppViewWebUtilityBarComponentOptions', input);
19707
- exports.paasAppViewWebUtilityBarComponentOptionsService = paasAppViewWebUtilityBarComponentOptionsService;
19708
- const paasAppViewWebUtilityBarIconOptionsService = async (input) => executeAppViewCommand('paasAppViewWebUtilityBarIconOptions', input);
19709
- exports.paasAppViewWebUtilityBarIconOptionsService = paasAppViewWebUtilityBarIconOptionsService;
19710
- const paasAppViewMobileListService = async (input) => executeAppViewCommand('paasAppViewMobileList', input);
19711
- exports.paasAppViewMobileListService = paasAppViewMobileListService;
19712
- const paasAppViewMobileDetailService = async (input) => executeAppViewCommand('paasAppViewMobileDetail', input);
19713
- exports.paasAppViewMobileDetailService = paasAppViewMobileDetailService;
19714
- const paasAppViewMobileCreateService = async (input) => executeAppViewCommand('paasAppViewMobileCreate', input);
19715
- exports.paasAppViewMobileCreateService = paasAppViewMobileCreateService;
19716
- const paasAppViewMobileUpdateService = async (input) => executeAppViewCommand('paasAppViewMobileUpdate', input);
19717
- exports.paasAppViewMobileUpdateService = paasAppViewMobileUpdateService;
19718
- const paasAppViewMobilePageComponentOptionsService = async (input) => executeAppViewCommand('paasAppViewMobilePageComponentOptions', input);
19719
- exports.paasAppViewMobilePageComponentOptionsService = paasAppViewMobilePageComponentOptionsService;
19720
- const paasAppViewMobileMenuComponentOptionsService = async (input) => executeAppViewCommand('paasAppViewMobileMenuComponentOptions', input);
19721
- exports.paasAppViewMobileMenuComponentOptionsService = paasAppViewMobileMenuComponentOptionsService;
19722
-
19723
-
19724
- /***/ },
19725
-
19726
- /***/ 7275
19852
+ const request_ts_1 = __webpack_require__(6272);
19853
+ const requestAppViewWebUtilityBarComponentOptionsExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebUtilityBarComponentOptions'), input));
19854
+ /** 查询指定应用下 Web 视图可选工具栏组件 */
19855
+ async function appViewWebUtilityBarComponentOptionsService(input) {
19856
+ return await requestAppViewWebUtilityBarComponentOptionsExecute(input);
19857
+ }
19858
+
19859
+
19860
+ /***/ },
19861
+
19862
+ /***/ 4066
19863
+ (__unused_webpack_module, exports, __webpack_require__) {
19864
+
19865
+
19866
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
19867
+ exports.appViewWebUtilityBarIconOptionsService = appViewWebUtilityBarIconOptionsService;
19868
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19869
+ const request_ts_1 = __webpack_require__(6272);
19870
+ const requestAppViewWebUtilityBarIconOptionsExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppViewWebUtilityBarIconOptions'), input));
19871
+ /** 查询指定应用下 Web 视图可选工具栏图标 */
19872
+ async function appViewWebUtilityBarIconOptionsService(input) {
19873
+ return await requestAppViewWebUtilityBarIconOptionsExecute(input);
19874
+ }
19875
+
19876
+
19877
+ /***/ },
19878
+
19879
+ /***/ 6500
19727
19880
  (__unused_webpack_module, exports, __webpack_require__) {
19728
19881
 
19729
19882
 
@@ -19731,219 +19884,146 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19731
19884
  return (mod && mod.__esModule) ? mod : { "default": mod };
19732
19885
  };
19733
19886
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19734
- exports.appDevPaasAppPushCommand = exports.appDevPaasAppPullCommand = exports.appDevPaasAppUpdateCommand = exports.appDevPaasAppCreateCommand = exports.appDevPaasAppListCommand = void 0;
19735
- const logger_ts_1 = __webpack_require__(3333);
19887
+ exports.validateUpdateContent = exports.validateCreateContent = exports.parseContent = void 0;
19888
+ exports.customAppCreateService = customAppCreateService;
19889
+ const index_ts_1 = __webpack_require__(9985);
19736
19890
  const normalize_ts_1 = __importDefault(__webpack_require__(9268));
19737
- const app_dev_shared_ts_1 = __webpack_require__(7564);
19738
- const paas_app_service_ts_1 = __webpack_require__(7957);
19739
- const getPaasAppListItems = (response) => {
19740
- const data = response.data;
19741
- if ((0, app_dev_shared_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
19742
- return data.items.filter(app_dev_shared_ts_1.isAppDevRecord);
19743
- }
19744
- if (Array.isArray(data)) {
19745
- return data.filter(app_dev_shared_ts_1.isAppDevRecord);
19746
- }
19747
- return [];
19748
- };
19749
- const printErrorMessages = (errorMessages) => {
19750
- if (!errorMessages.length) {
19751
- return false;
19891
+ const xml = new index_ts_1.XmlMetadataManager();
19892
+ const PREFIX = 'local-';
19893
+ const isCustomAppContent = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
19894
+ /** 解析 --content JSON 并校验为对象 */
19895
+ const parseContent = (rawContent) => {
19896
+ if (!rawContent?.trim()) {
19897
+ throw new Error('--content is required.');
19752
19898
  }
19753
- errorMessages.forEach((error) => logger_ts_1.loggerService.error(error));
19754
- return true;
19755
- };
19756
- const appDevPaasAppListCommand = async (context, options) => {
19757
- void context;
19758
- logger_ts_1.loggerService.startLoading('Listing PaaS applications...');
19759
19899
  try {
19760
- const response = await (0, paas_app_service_ts_1.paasAppListService)();
19761
- if (options.json) {
19762
- logger_ts_1.loggerService.printJson(response);
19763
- return;
19900
+ const parsedContent = JSON.parse(rawContent);
19901
+ if (!isCustomAppContent(parsedContent)) {
19902
+ throw new Error('--content must be a JSON object.');
19764
19903
  }
19765
- const items = getPaasAppListItems(response);
19766
- logger_ts_1.loggerService.printTable(['name', 'description', 'appId', 'appType', 'status', 'sourceType', 'updateTime'], items.map((item) => [
19767
- normalize_ts_1.default.normalizeText(item.name),
19768
- normalize_ts_1.default.normalizeText(item.description),
19769
- normalize_ts_1.default.normalizeText(item.appId),
19770
- normalize_ts_1.default.normalizeText(item.appTypeName),
19771
- normalize_ts_1.default.normalizeText(item.status),
19772
- normalize_ts_1.default.normalizeText(item.sourceType),
19773
- normalize_ts_1.default.normalizeDateTime(item.updateTime),
19774
- ]), [0, 0, 30, 12, 8, 12, 18]);
19904
+ return parsedContent;
19775
19905
  }
19776
- finally {
19777
- logger_ts_1.loggerService.stopLoading();
19906
+ catch (error) {
19907
+ if (error instanceof Error && error.message === '--content must be a JSON object.') {
19908
+ throw error;
19909
+ }
19910
+ throw new Error('--content must be valid JSON.');
19778
19911
  }
19779
19912
  };
19780
- exports.appDevPaasAppListCommand = appDevPaasAppListCommand;
19781
- const appDevPaasAppCreateCommand = async (context, options) => {
19782
- void context;
19783
- const result = await (0, paas_app_service_ts_1.paasAppCreateService)(options.localKey ?? options.localkey, options.content, {
19784
- force: options.force === true,
19785
- });
19786
- if (printErrorMessages(result.errorMessages)) {
19787
- return;
19913
+ exports.parseContent = parseContent;
19914
+ const validateAppName = (content, required) => {
19915
+ if (required && content.appName === undefined) {
19916
+ throw new Error('appName is required and must match ^.{2,10}$.');
19788
19917
  }
19789
- if (!result.filePath) {
19790
- throw new Error('PaaS app metadata not created.');
19918
+ if (content.appName !== undefined && (typeof content.appName !== 'string' || !/^.{2,10}$/.test(content.appName))) {
19919
+ throw new Error('appName must match ^.{2,10}$.');
19791
19920
  }
19792
- logger_ts_1.loggerService.success('Command completed: paas-app create');
19793
- logger_ts_1.loggerService.info(`PaaS app metadata created: ${result.filePath}`);
19794
19921
  };
19795
- exports.appDevPaasAppCreateCommand = appDevPaasAppCreateCommand;
19796
- const appDevPaasAppUpdateCommand = async (context, options) => {
19797
- void context;
19798
- const result = await (0, paas_app_service_ts_1.paasAppUpdateService)(options.appId, options.content);
19799
- if (printErrorMessages(result.errorMessages)) {
19800
- return;
19801
- }
19802
- if (!result.filePath) {
19803
- throw new Error('PaaS app metadata not updated.');
19804
- }
19805
- logger_ts_1.loggerService.success('Command completed: paas-app update');
19806
- logger_ts_1.loggerService.info(`PaaS app metadata updated: ${result.filePath}`);
19922
+ /** 创建时校验:appName 必填且匹配 ^.{2,10}$ */
19923
+ const validateCreateContent = (content) => {
19924
+ validateAppName(content, true);
19807
19925
  };
19808
- exports.appDevPaasAppUpdateCommand = appDevPaasAppUpdateCommand;
19809
- const appDevPaasAppPullCommand = async (context, options) => {
19810
- void context;
19811
- const result = await (0, paas_app_service_ts_1.paasAppPullService)(false, options.force === true, options.yes === true);
19812
- if (printErrorMessages(result.errorMessages)) {
19813
- return;
19926
+ exports.validateCreateContent = validateCreateContent;
19927
+ /** 更新时校验:appName 可选但若提供需匹配规则 */
19928
+ const validateUpdateContent = (content) => {
19929
+ validateAppName(content, false);
19930
+ if (Object.keys(content).length === 0) {
19931
+ throw new Error('--content must include at least one field for update.');
19814
19932
  }
19815
- logger_ts_1.loggerService.success(`PaaS app pull completed: found=${result.found}, written=${result.written}, skipped=${result.skipped}`);
19816
19933
  };
19817
- exports.appDevPaasAppPullCommand = appDevPaasAppPullCommand;
19818
- const appDevPaasAppPushCommand = async (context, options) => {
19819
- void context;
19820
- const result = await (0, paas_app_service_ts_1.paasAppPushService)({
19821
- all: options.all,
19822
- appId: options.appId,
19823
- skipOverwriteConfirm: options.yes === true,
19824
- });
19825
- if (printErrorMessages(result.errorMessages)) {
19826
- return;
19934
+ exports.validateUpdateContent = validateUpdateContent;
19935
+ /** 创建本地企业自定义应用 XML(仅写本地,远端同步走 push) */
19936
+ async function customAppCreateService(localKey, contentJson, options = {}) {
19937
+ const normalizedLocalKey = normalize_ts_1.default.validateLocalKey(localKey);
19938
+ if (!normalizedLocalKey) {
19939
+ throw new Error('Invalid arguments: --localkey is required. Must start with a letter, contain only letters/numbers/underscores, max 50 characters.');
19827
19940
  }
19828
- logger_ts_1.loggerService.success(`PaaS app push completed: pushed=${result.pushed}, skipped=${result.skipped}, failed=${result.failed}`);
19829
- };
19830
- exports.appDevPaasAppPushCommand = appDevPaasAppPushCommand;
19941
+ const content = (0, exports.parseContent)(contentJson);
19942
+ (0, exports.validateCreateContent)(content);
19943
+ const identity = `${PREFIX}${normalizedLocalKey}`;
19944
+ const current = await xml.readXml('CustomApp', identity, { fields: ['content'] });
19945
+ if (!options.force && current.content !== null && current.content !== undefined) {
19946
+ throw new Error(`Custom app metadata already exists locally: ${identity}. Use --force to overwrite.`);
19947
+ }
19948
+ const filePath = await xml.writeXml('CustomApp', identity, content, { status: 'new' });
19949
+ return { filePath, errorMessages: [] };
19950
+ }
19831
19951
 
19832
19952
 
19833
19953
  /***/ },
19834
19954
 
19835
- /***/ 6692
19955
+ /***/ 8
19836
19956
  (__unused_webpack_module, exports, __webpack_require__) {
19837
19957
 
19838
19958
 
19839
- var __importDefault = (this && this.__importDefault) || function (mod) {
19840
- return (mod && mod.__esModule) ? mod : { "default": mod };
19841
- };
19842
19959
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19843
- exports.paasAppCreateService = paasAppCreateService;
19844
- const normalize_ts_1 = __importDefault(__webpack_require__(9268));
19845
- const index_ts_1 = __webpack_require__(9985);
19846
- const paas_app_service_ts_1 = __webpack_require__(7957);
19847
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
19848
- /**
19849
- * 创建本地 PaaS 应用 XML 文件(仅操作本地,不调用远端接口)
19850
- * - 服务端以 appId 标识应用,本地创建尚无 appId,故以 `local-<localkey>` 作为本地身份
19851
- * - 校验 --localkey 命名规则与 --content JSON 结构
19852
- * - 本地文件已存在时非 --force 抛出错误
19853
- * - 写入 tenant-config/paas-apps/local-<localkey>.xml,状态标记为 new,待 push 时创建远端
19854
- */
19855
- async function paasAppCreateService(localKey, contentJson, options = {}) {
19856
- const normalizedLocalKey = normalize_ts_1.default.validateLocalKey(localKey);
19857
- if (!normalizedLocalKey) {
19858
- throw new Error('Invalid arguments: --localkey is required. Must start with a letter, contain only letters/numbers/underscores, max 50 characters.');
19859
- }
19860
- const content = (0, paas_app_service_ts_1.parseContent)(contentJson);
19861
- (0, paas_app_service_ts_1.validateCreateContent)(content);
19862
- const identity = `${paas_app_service_ts_1.PAAS_APP_LOCAL_PREFIX}${normalizedLocalKey}`;
19863
- const current = await xmlMetadataManager.readXml('PaasApp', identity, { fields: ['content'] });
19864
- if (!options.force && current.content !== null && current.content !== undefined) {
19865
- throw new Error(`PaaS app metadata already exists locally: ${identity}. Use --force to overwrite.`);
19866
- }
19867
- const filePath = await xmlMetadataManager.writeXml('PaasApp', identity, content, {
19868
- status: 'new',
19869
- });
19870
- return {
19871
- filePath,
19872
- errorMessages: [],
19873
- };
19960
+ exports.customAppListService = customAppListService;
19961
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
19962
+ const request_ts_1 = __webpack_require__(6272);
19963
+ const requestCustomAppListExecute = async (input) => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'customAppList'), input.nameKeyword ? { nameKeyword: input.nameKeyword } : {}));
19964
+ /** 查询企业自定义应用列表 */
19965
+ async function customAppListService(input = {}) {
19966
+ return await requestCustomAppListExecute(input);
19874
19967
  }
19875
19968
 
19876
19969
 
19877
19970
  /***/ },
19878
19971
 
19879
- /***/ 1655
19972
+ /***/ 7543
19880
19973
  (__unused_webpack_module, exports, __webpack_require__) {
19881
19974
 
19882
19975
 
19883
- var __importDefault = (this && this.__importDefault) || function (mod) {
19884
- return (mod && mod.__esModule) ? mod : { "default": mod };
19885
- };
19886
19976
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19887
- exports.paasAppPullService = paasAppPullService;
19977
+ exports.customAppPullService = customAppPullService;
19888
19978
  const prompts_1 = __webpack_require__(118);
19889
19979
  const logger_ts_1 = __webpack_require__(3333);
19890
19980
  const index_ts_1 = __webpack_require__(9985);
19891
- const app_dev_shared_ts_1 = __webpack_require__(7564);
19892
- const paas_app_service_ts_1 = __webpack_require__(7957);
19893
- const normalize_ts_1 = __importDefault(__webpack_require__(9268));
19894
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
19895
- /**
19896
- * 将 list 响应中的原始项映射为本地应用文件所需的结构
19897
- * paas-app list 响应 data.items 为数组,每项含 appId/name/content/updateTime
19898
- */
19981
+ const request_ts_1 = __webpack_require__(6272);
19982
+ const custom_app_list_ts_1 = __webpack_require__(8);
19983
+ const xml = new index_ts_1.XmlMetadataManager();
19984
+ /** list 响应原始项映射为本地文件所需结构 */
19899
19985
  function mapListItemsToFiles(rawItems) {
19900
19986
  return rawItems
19901
19987
  .map((item) => {
19902
- const rec = (0, app_dev_shared_ts_1.isAppDevRecord)(item) ? item : {};
19903
- const appId = normalize_ts_1.default.normalizeText(rec.appId) ?? '';
19904
- const content = (0, app_dev_shared_ts_1.isAppDevRecord)(rec.content) ? rec.content : rec;
19988
+ const rec = (0, request_ts_1.isAppDevRecord)(item) ? item : {};
19989
+ const appId = rec.appId;
19990
+ const appIdText = typeof appId === 'string' ? appId.trim() : '';
19991
+ const content = (0, request_ts_1.isAppDevRecord)(rec.content) ? rec.content : rec;
19905
19992
  const updateTimeRaw = rec.updateTime;
19906
19993
  const updateTime = typeof updateTimeRaw === 'number'
19907
19994
  ? updateTimeRaw
19908
19995
  : typeof updateTimeRaw === 'string' && updateTimeRaw.trim()
19909
19996
  ? Number(updateTimeRaw)
19910
19997
  : 0;
19911
- return { appId, content, updateTime };
19998
+ return { appId: appIdText, content, updateTime };
19912
19999
  })
19913
20000
  .filter((item) => item.appId);
19914
20001
  }
19915
- const fetchPaasAppListItems = async () => {
19916
- const response = await (0, paas_app_service_ts_1.paasAppListService)();
19917
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, (res) => {
19918
- const data = res.data;
19919
- if ((0, app_dev_shared_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
19920
- return data.items;
19921
- }
19922
- if (Array.isArray(data)) {
19923
- return data;
19924
- }
19925
- return [];
19926
- });
19927
- if (!result.success) {
19928
- throw new Error(result.errorMessage);
19929
- }
19930
- return mapListItemsToFiles(result.data ?? []);
19931
- };
19932
- /**
19933
- * 拉取 PaaS 应用并写入本地 XML 文件
19934
- * - 复用 list 接口获取应用项,逐个写入 tenant-config/paas-apps/{appId}.xml
19935
- * - 写入前检查本地状态,非 unchanged 默认跳过,--force 强制覆盖,--yes 跳过确认
19936
- * - updateTime 存入 extra,供后续 push 的 update 调用使用
19937
- */
19938
- async function paasAppPullService(skipOverwriteConfirm = false, force = false, yes = false) {
20002
+ /** 拉取企业自定义应用并写入本地 XML */
20003
+ async function customAppPullService(queryOptions = {}, skipOverwriteConfirm = false, force = false, yes = false) {
19939
20004
  const errorMessages = [];
19940
- logger_ts_1.loggerService.startLoading('Fetching PaaS app list...');
19941
- let items;
20005
+ // 获取远端列表
20006
+ logger_ts_1.loggerService.startLoading('Fetching custom app list...');
20007
+ let items = [];
19942
20008
  try {
19943
- items = await fetchPaasAppListItems();
20009
+ const response = await (0, custom_app_list_ts_1.customAppListService)(queryOptions);
20010
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, (res) => {
20011
+ const data = res.data;
20012
+ if (Array.isArray(data)) {
20013
+ return data;
20014
+ }
20015
+ if ((0, request_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
20016
+ return data.items;
20017
+ }
20018
+ return [];
20019
+ });
20020
+ if (!result.success) {
20021
+ throw new Error(result.errorMessage);
20022
+ }
20023
+ items = mapListItemsToFiles(result.data ?? []);
19944
20024
  }
19945
20025
  catch (error) {
19946
- errorMessages.push(`PaaS app list failed: ${error instanceof Error ? error.message : String(error)}`);
20026
+ errorMessages.push(`Custom app list failed: ${error instanceof Error ? error.message : String(error)}`);
19947
20027
  return { found: 0, written: 0, skipped: 0, errorMessages };
19948
20028
  }
19949
20029
  finally {
@@ -19951,21 +20031,22 @@ async function paasAppPullService(skipOverwriteConfirm = false, force = false, y
19951
20031
  }
19952
20032
  if (items.length === 0) {
19953
20033
  if (!errorMessages.length) {
19954
- logger_ts_1.loggerService.warn('No PaaS app items found.');
20034
+ logger_ts_1.loggerService.warn('No custom app items found.');
19955
20035
  }
19956
20036
  return { found: 0, written: 0, skipped: 0, errorMessages };
19957
20037
  }
19958
20038
  let written = 0;
19959
20039
  let skipped = 0;
19960
- logger_ts_1.loggerService.startLoading(`Writing PaaS app xml: ${items.length}`);
20040
+ // 逐条写入本地 XML
20041
+ logger_ts_1.loggerService.startLoading(`Writing custom app xml: ${items.length}`);
19961
20042
  try {
19962
20043
  for (const item of items) {
19963
20044
  try {
19964
- const localStatus = await xmlMetadataManager.readXml('PaasApp', item.appId, { fields: ['status'] });
20045
+ const localStatus = await xml.readXml('CustomApp', item.appId, { fields: ['status'] });
19965
20046
  if (force) {
19966
20047
  if (localStatus.status !== 'unchanged' && !yes) {
19967
20048
  const userConfirm = await (0, prompts_1.confirm)({
19968
- message: `Local PaasApp status is "${localStatus.status}": ${item.appId}, overwrite?`,
20049
+ message: `Local CustomApp status is "${localStatus.status}": ${item.appId}, overwrite?`,
19969
20050
  initialValue: false,
19970
20051
  });
19971
20052
  if (!userConfirm) {
@@ -19973,7 +20054,7 @@ async function paasAppPullService(skipOverwriteConfirm = false, force = false, y
19973
20054
  continue;
19974
20055
  }
19975
20056
  }
19976
- await xmlMetadataManager.writeXml('PaasApp', item.appId, item.content, {
20057
+ await xml.writeXml('CustomApp', item.appId, item.content, {
19977
20058
  status: 'unchanged',
19978
20059
  extra: { updateTime: item.updateTime },
19979
20060
  });
@@ -19985,11 +20066,11 @@ async function paasAppPullService(skipOverwriteConfirm = false, force = false, y
19985
20066
  skipped += 1;
19986
20067
  continue;
19987
20068
  }
19988
- logger_ts_1.loggerService.warn(`Local PaasApp status is "${localStatus.status}": ${item.appId}, skipped. Use --force to overwrite.`);
20069
+ logger_ts_1.loggerService.warn(`Local CustomApp status is "${localStatus.status}": ${item.appId}, skipped. Use --force to overwrite.`);
19989
20070
  skipped += 1;
19990
20071
  continue;
19991
20072
  }
19992
- await xmlMetadataManager.writeXml('PaasApp', item.appId, item.content, {
20073
+ await xml.writeXml('CustomApp', item.appId, item.content, {
19993
20074
  status: 'unchanged',
19994
20075
  extra: { updateTime: item.updateTime },
19995
20076
  });
@@ -20009,7 +20090,7 @@ async function paasAppPullService(skipOverwriteConfirm = false, force = false, y
20009
20090
 
20010
20091
  /***/ },
20011
20092
 
20012
- /***/ 8500
20093
+ /***/ 2852
20013
20094
  (__unused_webpack_module, exports, __webpack_require__) {
20014
20095
 
20015
20096
 
@@ -20017,22 +20098,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
20017
20098
  return (mod && mod.__esModule) ? mod : { "default": mod };
20018
20099
  };
20019
20100
  Object.defineProperty(exports, "__esModule", ({ value: true }));
20020
- exports.paasAppPushService = paasAppPushService;
20101
+ exports.customAppPushService = customAppPushService;
20021
20102
  const node_path_1 = __importDefault(__webpack_require__(6760));
20022
20103
  const node_fs_1 = __webpack_require__(3024);
20023
20104
  const file_ts_1 = __webpack_require__(5409);
20024
20105
  const logger_ts_1 = __webpack_require__(3333);
20025
20106
  const index_ts_1 = __webpack_require__(9985);
20026
20107
  const request_execute_command_paths_ts_1 = __webpack_require__(2351);
20027
- const app_dev_shared_ts_1 = __webpack_require__(7564);
20028
- const paas_app_service_ts_1 = __webpack_require__(7957);
20029
- const paas_app_pull_ts_1 = __webpack_require__(1655);
20108
+ const request_ts_1 = __webpack_require__(6272);
20109
+ const custom_app_list_ts_1 = __webpack_require__(8);
20110
+ const custom_app_pull_ts_1 = __webpack_require__(7543);
20030
20111
  const normalize_ts_1 = __importDefault(__webpack_require__(9268));
20031
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
20032
- async function findLocalPaasAppFiles() {
20112
+ const xml = new index_ts_1.XmlMetadataManager();
20113
+ const PREFIX = 'local-';
20114
+ /** 扫描本地 CustomApp XML 文件 */
20115
+ async function findLocalCustomAppFiles() {
20033
20116
  const results = [];
20034
20117
  const cwd = process.cwd();
20035
- const dirPath = node_path_1.default.join(cwd, 'tenant-config', 'paas-apps');
20118
+ const dirPath = node_path_1.default.join(cwd, 'tenant-config', 'custom-apps');
20036
20119
  if (!(await (0, file_ts_1.pathExists)(dirPath))) {
20037
20120
  return results;
20038
20121
  }
@@ -20045,17 +20128,18 @@ async function findLocalPaasAppFiles() {
20045
20128
  return results;
20046
20129
  }
20047
20130
  for (const entry of entries) {
20048
- if (!entry.isFile() || !entry.name.endsWith('.paas-app.xml')) {
20131
+ if (!entry.isFile() || !entry.name.endsWith('.custom-app.xml')) {
20049
20132
  continue;
20050
20133
  }
20051
- const appId = entry.name.slice(0, -'.paas-app.xml'.length);
20134
+ const appId = entry.name.slice(0, -'.custom-app.xml'.length);
20052
20135
  results.push({ appId, filePath: node_path_1.default.join(dirPath, entry.name) });
20053
20136
  }
20054
20137
  return results;
20055
20138
  }
20056
- async function readLocalPaasApp(appId) {
20057
- const localXml = await xmlMetadataManager.readXml('PaasApp', appId, { fields: ['content', 'status', 'extra'] });
20058
- const extra = (0, app_dev_shared_ts_1.isAppDevRecord)(localXml.extra) ? localXml.extra : {};
20139
+ /** 读取本地 CustomApp 元数据 */
20140
+ async function readLocalCustomApp(appId) {
20141
+ const localXml = await xml.readXml('CustomApp', appId, { fields: ['content', 'status', 'extra'] });
20142
+ const extra = (0, request_ts_1.isAppDevRecord)(localXml.extra) ? localXml.extra : {};
20059
20143
  const updateTimeRaw = extra.updateTime;
20060
20144
  const updateTime = typeof updateTimeRaw === 'number'
20061
20145
  ? updateTimeRaw
@@ -20063,31 +20147,30 @@ async function readLocalPaasApp(appId) {
20063
20147
  ? Number(updateTimeRaw)
20064
20148
  : undefined;
20065
20149
  return {
20066
- content: (0, app_dev_shared_ts_1.isAppDevRecord)(localXml.content) ? localXml.content : null,
20150
+ content: (0, request_ts_1.isAppDevRecord)(localXml.content) ? localXml.content : null,
20067
20151
  status: localXml.status,
20068
20152
  updateTime,
20069
20153
  extra,
20070
20154
  };
20071
20155
  }
20072
- async function fetchRemotePaasApp(appId, errorMessages) {
20156
+ /** 查询远端 CustomApp 存在性 */
20157
+ async function fetchRemoteCustomApp(appId, errorMessages) {
20073
20158
  try {
20074
- const response = await (0, paas_app_service_ts_1.paasAppListService)();
20075
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, (res) => {
20159
+ const response = await (0, custom_app_list_ts_1.customAppListService)({ nameKeyword: appId });
20160
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, (res) => {
20076
20161
  const data = res.data;
20077
- if ((0, app_dev_shared_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
20078
- return data.items;
20079
- }
20080
20162
  if (Array.isArray(data)) {
20081
20163
  return data;
20082
20164
  }
20083
20165
  return [];
20084
20166
  });
20085
20167
  if (!result.success || !result.data) {
20086
- return { exists: false };
20168
+ errorMessages.push(`remote existence check failed: ${appId}: ${result.errorMessage || 'Unknown error.'}`);
20169
+ return { status: 'unknown' };
20087
20170
  }
20088
20171
  const matched = result.data.find((item) => normalize_ts_1.default.normalizeText(item.appId) === appId);
20089
20172
  if (!matched) {
20090
- return { exists: false };
20173
+ return { status: 'missing' };
20091
20174
  }
20092
20175
  const rawTime = matched.updateTime;
20093
20176
  const updateTime = typeof rawTime === 'number'
@@ -20095,74 +20178,53 @@ async function fetchRemotePaasApp(appId, errorMessages) {
20095
20178
  : typeof rawTime === 'string' && rawTime.trim()
20096
20179
  ? Number(rawTime)
20097
20180
  : undefined;
20098
- return { exists: true, updateTime };
20181
+ return { status: 'exists', updateTime };
20099
20182
  }
20100
20183
  catch (error) {
20101
20184
  errorMessages.push(`remote existence check failed: ${appId}: ${error instanceof Error ? error.message : String(error)}`);
20102
- return { exists: false };
20103
- }
20104
- }
20105
- async function requestCreatePaasApp(content) {
20106
- logger_ts_1.loggerService.startLoading('paas-app push request (create)');
20107
- const response = await (0, app_dev_shared_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppCreate'), { content });
20108
- logger_ts_1.loggerService.stopLoading();
20109
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, (res) => {
20110
- const data = res.data;
20111
- return (0, app_dev_shared_ts_1.isAppDevRecord)(data) ? data : {};
20112
- });
20113
- if (!result.success) {
20114
- return { errorMessage: result.errorMessage };
20115
- }
20116
- const serverId = normalize_ts_1.default.normalizeText(result.data?.appId);
20117
- if (!serverId) {
20118
- return { errorMessage: 'Server response missing appId.' };
20185
+ return { status: 'unknown' };
20119
20186
  }
20120
- return { serverId };
20121
- }
20122
- async function requestUpdatePaasApp(appId, updateTime, content) {
20123
- logger_ts_1.loggerService.startLoading(`paas-app push request (update): ${appId}`);
20124
- const response = await (0, app_dev_shared_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppUpdate'), { appId, updateTime, content });
20125
- logger_ts_1.loggerService.stopLoading();
20126
- const result = await (0, app_dev_shared_ts_1.extractAppDevServiceResult)(response, () => ({}));
20127
- if (!result.success) {
20128
- return { errorMessage: result.errorMessage };
20129
- }
20130
- return {};
20131
20187
  }
20188
+ /** 推送单个本地 CustomApp 文件 */
20132
20189
  async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
20133
20190
  const { appId } = file;
20134
- let local = await readLocalPaasApp(appId);
20191
+ let local = await readLocalCustomApp(appId);
20135
20192
  if (!local.content) {
20136
20193
  return { appId, action: 'skip', errorMessage: `Invalid local content: ${appId}` };
20137
20194
  }
20138
- const isLocalPlaceholder = appId.startsWith(paas_app_service_ts_1.PAAS_APP_LOCAL_PREFIX);
20195
+ // local- 前缀文件没有远端 id,跳过存在性检查,直接走 create
20196
+ const isLocalPlaceholder = appId.startsWith(PREFIX);
20139
20197
  let isCreate = local.status === 'new';
20140
20198
  if (!isLocalPlaceholder) {
20141
- const remote = await fetchRemotePaasApp(appId, errorMessages);
20142
- if (local.status === 'new' && remote.exists) {
20143
- await xmlMetadataManager.writeXml('PaasApp', appId, local.content, {
20199
+ const remote = await fetchRemoteCustomApp(appId, errorMessages);
20200
+ if (remote.status === 'unknown') {
20201
+ return { appId, action: 'skip', errorMessage: `Remote existence check failed: ${appId}` };
20202
+ }
20203
+ if (local.status === 'new' && remote.status === 'exists') {
20204
+ await xml.writeXml('CustomApp', appId, local.content, {
20144
20205
  status: 'modified',
20145
20206
  extra: { updateTime: remote.updateTime },
20146
20207
  });
20147
- logger_ts_1.loggerService.warn(`PaaS app exists remotely, local status changed from new to modified: ${appId}`);
20148
- local = await readLocalPaasApp(appId);
20208
+ logger_ts_1.loggerService.warn(`Custom app exists remotely, local status changed from new to modified: ${appId}`);
20209
+ local = await readLocalCustomApp(appId);
20149
20210
  }
20150
- else if (local.status !== 'new' && !remote.exists) {
20151
- await xmlMetadataManager.writeXml('PaasApp', appId, local.content, { status: 'new' });
20152
- logger_ts_1.loggerService.warn(`PaaS app does not exist remotely, local status changed from ${local.status} to new: ${appId}`);
20153
- local = await readLocalPaasApp(appId);
20211
+ else if (local.status !== 'new' && remote.status === 'missing') {
20212
+ await xml.writeXml('CustomApp', appId, local.content, { status: 'new' });
20213
+ logger_ts_1.loggerService.warn(`Custom app does not exist remotely, local status changed from ${local.status} to new: ${appId}`);
20214
+ local = await readLocalCustomApp(appId);
20154
20215
  }
20155
20216
  isCreate = local.status === 'new';
20156
20217
  }
20157
20218
  else {
20158
20219
  isCreate = true;
20159
20220
  }
20221
+ // pre-pull:非 create 时对齐远端基线
20160
20222
  if (!isCreate) {
20161
- logger_ts_1.loggerService.startLoading(`paas-app push pre-pull: ${appId}`);
20223
+ logger_ts_1.loggerService.startLoading(`custom-app push pre-pull: ${appId}`);
20162
20224
  try {
20163
- const prePullResult = await (0, paas_app_pull_ts_1.paasAppPullService)(skipOverwriteConfirm, false, skipOverwriteConfirm);
20225
+ const prePullResult = await (0, custom_app_pull_ts_1.customAppPullService)({ nameKeyword: appId }, skipOverwriteConfirm, false, skipOverwriteConfirm);
20164
20226
  errorMessages.push(...prePullResult.errorMessages);
20165
- local = await readLocalPaasApp(appId);
20227
+ local = await readLocalCustomApp(appId);
20166
20228
  }
20167
20229
  finally {
20168
20230
  logger_ts_1.loggerService.stopLoading();
@@ -20171,39 +20233,44 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
20171
20233
  return { appId, action: 'skip', errorMessage: `Invalid local content after pre-pull: ${appId}` };
20172
20234
  }
20173
20235
  }
20174
- const content = local.content;
20175
- if (!content) {
20176
- return { appId, action: 'skip', errorMessage: `Invalid local content before push: ${appId}` };
20177
- }
20236
+ const content = local.content ?? {};
20178
20237
  let targetId = appId;
20179
20238
  let newId;
20180
20239
  if (isCreate) {
20181
- const createResult = await requestCreatePaasApp(content);
20182
- if (createResult.errorMessage) {
20183
- return { appId, action: 'create', errorMessage: createResult.errorMessage };
20240
+ // 调用远端 create
20241
+ logger_ts_1.loggerService.startLoading('custom-app push request (create)');
20242
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'customAppCreate'), content);
20243
+ logger_ts_1.loggerService.stopLoading();
20244
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, (res) => {
20245
+ const data = res.data;
20246
+ return (0, request_ts_1.isAppDevRecord)(data) ? data : {};
20247
+ });
20248
+ if (!result.success) {
20249
+ return { appId, action: 'create', errorMessage: result.errorMessage };
20250
+ }
20251
+ newId = normalize_ts_1.default.normalizeText(result.data?.appId);
20252
+ if (!newId) {
20253
+ return { appId, action: 'create', errorMessage: 'Server response missing appId.' };
20184
20254
  }
20185
- newId = createResult.serverId;
20186
20255
  targetId = newId;
20187
- await xmlMetadataManager.renameXml('PaasApp', appId, targetId, {});
20256
+ await xml.renameXml('CustomApp', appId, targetId, {});
20188
20257
  }
20189
20258
  else {
20190
- const updateTime = local.updateTime;
20191
- if (updateTime === undefined) {
20192
- return {
20193
- appId,
20194
- action: 'update',
20195
- errorMessage: `Missing updateTime for ${appId}, try pull first to fetch the latest updateTime.`,
20196
- };
20197
- }
20198
- const updateResult = await requestUpdatePaasApp(appId, updateTime, content);
20199
- if (updateResult.errorMessage) {
20200
- return { appId, action: 'update', errorMessage: updateResult.errorMessage };
20259
+ // 调用远端 update
20260
+ logger_ts_1.loggerService.startLoading(`custom-app push request (update): ${appId}`);
20261
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'customAppUpdate'), { ...content, appId });
20262
+ logger_ts_1.loggerService.stopLoading();
20263
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, () => ({}));
20264
+ if (!result.success) {
20265
+ return { appId, action: 'update', errorMessage: result.errorMessage };
20201
20266
  }
20202
20267
  }
20203
- await xmlMetadataManager.writeXml('PaasApp', targetId, content, { status: 'unchanged' });
20204
- logger_ts_1.loggerService.startLoading(`paas-app push post-pull: ${targetId}`);
20268
+ // 回写本地 status=unchanged(本次推送已成功,本地与远端一致)
20269
+ await xml.writeXml('CustomApp', targetId, content, { status: 'unchanged' });
20270
+ // post-pull:精确按 targetId 拉取同步远端最新(失败仅记录,不影响本次 push 结果)
20271
+ logger_ts_1.loggerService.startLoading(`custom-app push post-pull: ${targetId}`);
20205
20272
  try {
20206
- const postPullResult = await (0, paas_app_pull_ts_1.paasAppPullService)(skipOverwriteConfirm, false, skipOverwriteConfirm);
20273
+ const postPullResult = await (0, custom_app_pull_ts_1.customAppPullService)({ nameKeyword: targetId }, skipOverwriteConfirm, false, skipOverwriteConfirm);
20207
20274
  errorMessages.push(...postPullResult.errorMessages);
20208
20275
  }
20209
20276
  finally {
@@ -20212,7 +20279,8 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
20212
20279
  logger_ts_1.loggerService.debug(`push success: ${appId}${newId ? ` -> ${newId}` : ''}`);
20213
20280
  return { appId, action: isCreate ? 'create' : 'update', newId };
20214
20281
  }
20215
- async function paasAppPushService(options) {
20282
+ /** 推送本地 CustomApp XML 到远端 */
20283
+ async function customAppPushService(options) {
20216
20284
  const errorMessages = [];
20217
20285
  const results = [];
20218
20286
  const skipOverwriteConfirm = options.skipOverwriteConfirm === true;
@@ -20225,20 +20293,20 @@ async function paasAppPushService(options) {
20225
20293
  if (!normalizedId) {
20226
20294
  throw new Error('Invalid arguments: --appId is required.');
20227
20295
  }
20228
- const allFiles = await findLocalPaasAppFiles();
20296
+ const allFiles = await findLocalCustomAppFiles();
20229
20297
  candidates = allFiles.filter((f) => f.appId === normalizedId);
20230
20298
  if (candidates.length === 0) {
20231
- throw new Error(`PaaS app not found locally: ${normalizedId}`);
20299
+ throw new Error(`Custom app not found locally: ${normalizedId}`);
20232
20300
  }
20233
20301
  }
20234
20302
  else if (options.all) {
20235
- candidates = await findLocalPaasAppFiles();
20303
+ candidates = await findLocalCustomAppFiles();
20236
20304
  }
20237
20305
  else {
20238
20306
  throw new Error('Invalid arguments: specify --all to push all local files, or --appId to push a single file.');
20239
20307
  }
20240
20308
  if (candidates.length === 0) {
20241
- logger_ts_1.loggerService.warn('No local paas-app files found to push.');
20309
+ logger_ts_1.loggerService.warn('No local custom-app files found to push.');
20242
20310
  return { pushed: 0, skipped: 0, failed: 0, results: [], errorMessages: [] };
20243
20311
  }
20244
20312
  let pushed = 0;
@@ -20246,7 +20314,7 @@ async function paasAppPushService(options) {
20246
20314
  let failed = 0;
20247
20315
  for (const file of candidates) {
20248
20316
  try {
20249
- const statusCheck = await readLocalPaasApp(file.appId);
20317
+ const statusCheck = await readLocalCustomApp(file.appId);
20250
20318
  if (statusCheck.status === 'unchanged') {
20251
20319
  skipped += 1;
20252
20320
  results.push({ appId: file.appId, action: 'skip' });
@@ -20276,25 +20344,61 @@ async function paasAppPushService(options) {
20276
20344
 
20277
20345
  /***/ },
20278
20346
 
20279
- /***/ 7957
20347
+ /***/ 133
20280
20348
  (__unused_webpack_module, exports, __webpack_require__) {
20281
20349
 
20282
20350
 
20283
20351
  Object.defineProperty(exports, "__esModule", ({ value: true }));
20284
- exports.paasAppPushService = exports.paasAppPullService = exports.paasAppUpdateService = exports.paasAppCreateService = exports.parseUpdateTime = exports.parseAppId = exports.validateUpdateContent = exports.validateCreateContent = exports.parseContent = exports.paasAppListService = exports.PAAS_APP_LOCAL_PREFIX = void 0;
20285
- const request_execute_command_paths_ts_1 = __webpack_require__(2351);
20286
- const app_dev_shared_ts_1 = __webpack_require__(7564);
20287
- /** 本地创建文件时 localkey 的前缀,用于区分服务端自动生成的 appId */
20288
- exports.PAAS_APP_LOCAL_PREFIX = 'local-';
20289
- // ========================================================================
20290
- // list 服务(调用操作中心)
20291
- // ========================================================================
20292
- const paasAppListService = async () => ((0, app_dev_shared_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppList'), {}));
20293
- exports.paasAppListService = paasAppListService;
20294
- // ========================================================================
20295
- // 校验辅助函数(供 create / update / command 复用)
20296
- // ========================================================================
20352
+ exports.parseAppId = void 0;
20353
+ exports.customAppUpdateService = customAppUpdateService;
20354
+ const index_ts_1 = __webpack_require__(9985);
20355
+ const custom_app_create_ts_1 = __webpack_require__(6500);
20356
+ const xml = new index_ts_1.XmlMetadataManager();
20357
+ /** 解析 --appId(必填) */
20358
+ const parseAppId = (rawAppId) => {
20359
+ const appId = rawAppId?.trim();
20360
+ if (!appId) {
20361
+ throw new Error('--appId is required. Run custom-app list to get the current appId.');
20362
+ }
20363
+ return appId;
20364
+ };
20365
+ exports.parseAppId = parseAppId;
20366
+ /** 更新本地企业自定义应用 XML(仅写本地,远端同步走 push) */
20367
+ async function customAppUpdateService(appId, contentJson) {
20368
+ const normalizedAppId = (0, exports.parseAppId)(appId);
20369
+ const content = (0, custom_app_create_ts_1.parseContent)(contentJson);
20370
+ (0, custom_app_create_ts_1.validateUpdateContent)(content);
20371
+ const current = await xml.readXml('CustomApp', normalizedAppId, { fields: ['content', 'status', 'extra'] });
20372
+ if (current.content === null || current.content === undefined) {
20373
+ throw new Error(`Custom app metadata not found: ${normalizedAppId}`);
20374
+ }
20375
+ const filePath = await xml.writeXml('CustomApp', normalizedAppId, content, {
20376
+ contentMode: 'merge',
20377
+ status: current.status === 'new' ? 'new' : 'modified',
20378
+ extra: current.extra,
20379
+ });
20380
+ return { filePath, errorMessages: [] };
20381
+ }
20382
+
20383
+
20384
+ /***/ },
20385
+
20386
+ /***/ 7928
20387
+ (__unused_webpack_module, exports, __webpack_require__) {
20388
+
20389
+
20390
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20391
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20392
+ };
20393
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20394
+ exports.parseUpdateTime = exports.parseAppId = exports.validateUpdateContent = exports.validateCreateContent = exports.parseContent = void 0;
20395
+ exports.paasAppCreateService = paasAppCreateService;
20396
+ const index_ts_1 = __webpack_require__(9985);
20397
+ const normalize_ts_1 = __importDefault(__webpack_require__(9268));
20398
+ const xml = new index_ts_1.XmlMetadataManager();
20399
+ const PREFIX = 'local-';
20297
20400
  const isPaasAppContent = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
20401
+ /** 解析 --content JSON 并校验为对象 */
20298
20402
  const parseContent = (rawContent) => {
20299
20403
  if (!rawContent?.trim()) {
20300
20404
  throw new Error('--content is required.');
@@ -20342,49 +20446,449 @@ const parseUpdateTime = (rawUpdateTime) => {
20342
20446
  return updateTime;
20343
20447
  };
20344
20448
  exports.parseUpdateTime = parseUpdateTime;
20345
- // ========================================================================
20346
- // 本地 create / update / pull / push 服务(仅操作本地 XML,对齐 mobile-navigation 模式)
20347
- // ========================================================================
20348
- var paas_app_create_ts_1 = __webpack_require__(6692);
20349
- Object.defineProperty(exports, "paasAppCreateService", ({ enumerable: true, get: function () { return paas_app_create_ts_1.paasAppCreateService; } }));
20350
- var paas_app_update_ts_1 = __webpack_require__(5269);
20351
- Object.defineProperty(exports, "paasAppUpdateService", ({ enumerable: true, get: function () { return paas_app_update_ts_1.paasAppUpdateService; } }));
20352
- var paas_app_pull_ts_1 = __webpack_require__(1655);
20353
- Object.defineProperty(exports, "paasAppPullService", ({ enumerable: true, get: function () { return paas_app_pull_ts_1.paasAppPullService; } }));
20354
- var paas_app_push_ts_1 = __webpack_require__(8500);
20355
- Object.defineProperty(exports, "paasAppPushService", ({ enumerable: true, get: function () { return paas_app_push_ts_1.paasAppPushService; } }));
20449
+ /** 创建本地 PaaS 应用 XML(仅写本地,远端同步走 push) */
20450
+ async function paasAppCreateService(localKey, contentJson, options = {}) {
20451
+ const normalizedLocalKey = normalize_ts_1.default.validateLocalKey(localKey);
20452
+ if (!normalizedLocalKey) {
20453
+ throw new Error('Invalid arguments: --localkey is required. Must start with a letter, contain only letters/numbers/underscores, max 50 characters.');
20454
+ }
20455
+ const content = (0, exports.parseContent)(contentJson);
20456
+ (0, exports.validateCreateContent)(content);
20457
+ const identity = `${PREFIX}${normalizedLocalKey}`;
20458
+ const current = await xml.readXml('PaasApp', identity, { fields: ['content'] });
20459
+ if (!options.force && current.content !== null && current.content !== undefined) {
20460
+ throw new Error(`PaaS app metadata already exists locally: ${identity}. Use --force to overwrite.`);
20461
+ }
20462
+ const filePath = await xml.writeXml('PaasApp', identity, content, { status: 'new' });
20463
+ return { filePath, errorMessages: [] };
20464
+ }
20465
+
20466
+
20467
+ /***/ },
20468
+
20469
+ /***/ 7988
20470
+ (__unused_webpack_module, exports, __webpack_require__) {
20471
+
20472
+
20473
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20474
+ exports.paasAppListService = paasAppListService;
20475
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
20476
+ const request_ts_1 = __webpack_require__(6272);
20477
+ const requestPaasAppListExecute = async () => (await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppList'), {}));
20478
+ /** 查询 PaaS 应用列表 */
20479
+ async function paasAppListService() {
20480
+ return await requestPaasAppListExecute();
20481
+ }
20482
+
20483
+
20484
+ /***/ },
20485
+
20486
+ /***/ 3035
20487
+ (__unused_webpack_module, exports, __webpack_require__) {
20488
+
20489
+
20490
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20491
+ exports.paasAppPullService = paasAppPullService;
20492
+ const prompts_1 = __webpack_require__(118);
20493
+ const logger_ts_1 = __webpack_require__(3333);
20494
+ const index_ts_1 = __webpack_require__(9985);
20495
+ const request_ts_1 = __webpack_require__(6272);
20496
+ const paas_app_list_ts_1 = __webpack_require__(7988);
20497
+ const xml = new index_ts_1.XmlMetadataManager();
20498
+ /** 将 list 响应原始项映射为本地文件所需结构(data.items 数组或 data 数组) */
20499
+ function mapListItemsToFiles(rawItems) {
20500
+ return rawItems
20501
+ .map((item) => {
20502
+ const rec = (0, request_ts_1.isAppDevRecord)(item) ? item : {};
20503
+ const appId = typeof rec.appId === 'string' ? rec.appId.trim() : '';
20504
+ const content = (0, request_ts_1.isAppDevRecord)(rec.content) ? rec.content : rec;
20505
+ const updateTimeRaw = rec.updateTime;
20506
+ const updateTime = typeof updateTimeRaw === 'number'
20507
+ ? updateTimeRaw
20508
+ : typeof updateTimeRaw === 'string' && updateTimeRaw.trim()
20509
+ ? Number(updateTimeRaw)
20510
+ : 0;
20511
+ return { appId, content, updateTime };
20512
+ })
20513
+ .filter((item) => item.appId);
20514
+ }
20515
+ /** 拉取 PaaS 应用并写入本地 XML */
20516
+ async function paasAppPullService(skipOverwriteConfirm = false, force = false, yes = false) {
20517
+ const errorMessages = [];
20518
+ // 获取远端列表
20519
+ logger_ts_1.loggerService.startLoading('Fetching PaaS app list...');
20520
+ let items = [];
20521
+ try {
20522
+ const response = await (0, paas_app_list_ts_1.paasAppListService)();
20523
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, (res) => {
20524
+ const data = res.data;
20525
+ if ((0, request_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
20526
+ return data.items;
20527
+ }
20528
+ if (Array.isArray(data)) {
20529
+ return data;
20530
+ }
20531
+ return [];
20532
+ });
20533
+ if (!result.success) {
20534
+ throw new Error(result.errorMessage);
20535
+ }
20536
+ items = mapListItemsToFiles(result.data ?? []);
20537
+ }
20538
+ catch (error) {
20539
+ errorMessages.push(`PaaS app list failed: ${error instanceof Error ? error.message : String(error)}`);
20540
+ return { found: 0, written: 0, skipped: 0, errorMessages };
20541
+ }
20542
+ finally {
20543
+ logger_ts_1.loggerService.stopLoading();
20544
+ }
20545
+ if (items.length === 0) {
20546
+ if (!errorMessages.length) {
20547
+ logger_ts_1.loggerService.warn('No PaaS app items found.');
20548
+ }
20549
+ return { found: 0, written: 0, skipped: 0, errorMessages };
20550
+ }
20551
+ let written = 0;
20552
+ let skipped = 0;
20553
+ // 逐条写入本地 XML
20554
+ logger_ts_1.loggerService.startLoading(`Writing PaaS app xml: ${items.length}`);
20555
+ try {
20556
+ for (const item of items) {
20557
+ try {
20558
+ const localStatus = await xml.readXml('PaasApp', item.appId, { fields: ['status'] });
20559
+ if (force) {
20560
+ if (localStatus.status !== 'unchanged' && !yes) {
20561
+ const userConfirm = await (0, prompts_1.confirm)({
20562
+ message: `Local PaasApp status is "${localStatus.status}": ${item.appId}, overwrite?`,
20563
+ initialValue: false,
20564
+ });
20565
+ if (!userConfirm) {
20566
+ skipped += 1;
20567
+ continue;
20568
+ }
20569
+ }
20570
+ await xml.writeXml('PaasApp', item.appId, item.content, {
20571
+ status: 'unchanged',
20572
+ extra: { updateTime: item.updateTime },
20573
+ });
20574
+ written += 1;
20575
+ continue;
20576
+ }
20577
+ if (localStatus.status !== 'unchanged') {
20578
+ if (skipOverwriteConfirm) {
20579
+ skipped += 1;
20580
+ continue;
20581
+ }
20582
+ logger_ts_1.loggerService.warn(`Local PaasApp status is "${localStatus.status}": ${item.appId}, skipped. Use --force to overwrite.`);
20583
+ skipped += 1;
20584
+ continue;
20585
+ }
20586
+ await xml.writeXml('PaasApp', item.appId, item.content, {
20587
+ status: 'unchanged',
20588
+ extra: { updateTime: item.updateTime },
20589
+ });
20590
+ written += 1;
20591
+ }
20592
+ catch (error) {
20593
+ errorMessages.push(`${item.appId}: ${error instanceof Error ? error.message : String(error)}`);
20594
+ }
20595
+ }
20596
+ }
20597
+ finally {
20598
+ logger_ts_1.loggerService.stopLoading();
20599
+ }
20600
+ return { found: items.length, written, skipped, errorMessages };
20601
+ }
20356
20602
 
20357
20603
 
20358
20604
  /***/ },
20359
20605
 
20360
- /***/ 5269
20606
+ /***/ 7752
20607
+ (__unused_webpack_module, exports, __webpack_require__) {
20608
+
20609
+
20610
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20611
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20612
+ };
20613
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20614
+ exports.paasAppPushService = paasAppPushService;
20615
+ const node_path_1 = __importDefault(__webpack_require__(6760));
20616
+ const node_fs_1 = __webpack_require__(3024);
20617
+ const file_ts_1 = __webpack_require__(5409);
20618
+ const logger_ts_1 = __webpack_require__(3333);
20619
+ const index_ts_1 = __webpack_require__(9985);
20620
+ const request_execute_command_paths_ts_1 = __webpack_require__(2351);
20621
+ const request_ts_1 = __webpack_require__(6272);
20622
+ const paas_app_list_ts_1 = __webpack_require__(7988);
20623
+ const paas_app_pull_ts_1 = __webpack_require__(3035);
20624
+ const normalize_ts_1 = __importDefault(__webpack_require__(9268));
20625
+ const xml = new index_ts_1.XmlMetadataManager();
20626
+ const PREFIX = 'local-';
20627
+ /** 扫描本地 PaasApp XML 文件 */
20628
+ async function findLocalPaasAppFiles() {
20629
+ const results = [];
20630
+ const cwd = process.cwd();
20631
+ const dirPath = node_path_1.default.join(cwd, 'tenant-config', 'paas-apps');
20632
+ if (!(await (0, file_ts_1.pathExists)(dirPath))) {
20633
+ return results;
20634
+ }
20635
+ let entries;
20636
+ try {
20637
+ const dirEntries = await node_fs_1.promises.readdir(dirPath, { withFileTypes: true });
20638
+ entries = dirEntries;
20639
+ }
20640
+ catch {
20641
+ return results;
20642
+ }
20643
+ for (const entry of entries) {
20644
+ if (!entry.isFile() || !entry.name.endsWith('.paas-app.xml')) {
20645
+ continue;
20646
+ }
20647
+ const appId = entry.name.slice(0, -'.paas-app.xml'.length);
20648
+ results.push({ appId, filePath: node_path_1.default.join(dirPath, entry.name) });
20649
+ }
20650
+ return results;
20651
+ }
20652
+ /** 读取本地 PaasApp 元数据 */
20653
+ async function readLocalPaasApp(appId) {
20654
+ const localXml = await xml.readXml('PaasApp', appId, { fields: ['content', 'status', 'extra'] });
20655
+ const extra = (0, request_ts_1.isAppDevRecord)(localXml.extra) ? localXml.extra : {};
20656
+ const updateTimeRaw = extra.updateTime;
20657
+ const updateTime = typeof updateTimeRaw === 'number'
20658
+ ? updateTimeRaw
20659
+ : typeof updateTimeRaw === 'string' && updateTimeRaw.trim()
20660
+ ? Number(updateTimeRaw)
20661
+ : undefined;
20662
+ return {
20663
+ content: (0, request_ts_1.isAppDevRecord)(localXml.content) ? localXml.content : null,
20664
+ status: localXml.status,
20665
+ updateTime,
20666
+ extra,
20667
+ };
20668
+ }
20669
+ /** 查询远端 PaasApp 存在性 */
20670
+ async function fetchRemotePaasApp(appId, errorMessages) {
20671
+ try {
20672
+ const response = await (0, paas_app_list_ts_1.paasAppListService)();
20673
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, (res) => {
20674
+ const data = res.data;
20675
+ if ((0, request_ts_1.isAppDevRecord)(data) && Array.isArray(data.items)) {
20676
+ return data.items;
20677
+ }
20678
+ if (Array.isArray(data)) {
20679
+ return data;
20680
+ }
20681
+ return [];
20682
+ });
20683
+ if (!result.success || !result.data) {
20684
+ errorMessages.push(`remote existence check failed: ${appId}: ${result.errorMessage || 'Unknown error.'}`);
20685
+ return { status: 'unknown' };
20686
+ }
20687
+ const matched = result.data.find((item) => normalize_ts_1.default.normalizeText(item.appId) === appId);
20688
+ if (!matched) {
20689
+ return { status: 'missing' };
20690
+ }
20691
+ const rawTime = matched.updateTime;
20692
+ const updateTime = typeof rawTime === 'number'
20693
+ ? rawTime
20694
+ : typeof rawTime === 'string' && rawTime.trim()
20695
+ ? Number(rawTime)
20696
+ : undefined;
20697
+ return { status: 'exists', updateTime };
20698
+ }
20699
+ catch (error) {
20700
+ errorMessages.push(`remote existence check failed: ${appId}: ${error instanceof Error ? error.message : String(error)}`);
20701
+ return { status: 'unknown' };
20702
+ }
20703
+ }
20704
+ /** 推送单个本地 PaasApp 文件 */
20705
+ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
20706
+ const { appId } = file;
20707
+ let local = await readLocalPaasApp(appId);
20708
+ if (!local.content) {
20709
+ return { appId, action: 'skip', errorMessage: `Invalid local content: ${appId}` };
20710
+ }
20711
+ // local- 前缀文件没有远端 id,跳过存在性检查,直接走 create
20712
+ const isLocalPlaceholder = appId.startsWith(PREFIX);
20713
+ let isCreate = local.status === 'new';
20714
+ if (!isLocalPlaceholder) {
20715
+ const remote = await fetchRemotePaasApp(appId, errorMessages);
20716
+ if (remote.status === 'unknown') {
20717
+ return { appId, action: 'skip', errorMessage: `Remote existence check failed: ${appId}` };
20718
+ }
20719
+ if (local.status === 'new' && remote.status === 'exists') {
20720
+ await xml.writeXml('PaasApp', appId, local.content, {
20721
+ status: 'modified',
20722
+ extra: { updateTime: remote.updateTime },
20723
+ });
20724
+ logger_ts_1.loggerService.warn(`PaaS app exists remotely, local status changed from new to modified: ${appId}`);
20725
+ local = await readLocalPaasApp(appId);
20726
+ }
20727
+ else if (local.status !== 'new' && remote.status === 'missing') {
20728
+ await xml.writeXml('PaasApp', appId, local.content, { status: 'new' });
20729
+ logger_ts_1.loggerService.warn(`PaaS app does not exist remotely, local status changed from ${local.status} to new: ${appId}`);
20730
+ local = await readLocalPaasApp(appId);
20731
+ }
20732
+ isCreate = local.status === 'new';
20733
+ }
20734
+ else {
20735
+ isCreate = true;
20736
+ }
20737
+ // pre-pull:非 create 时对齐远端基线
20738
+ if (!isCreate) {
20739
+ logger_ts_1.loggerService.startLoading(`paas-app push pre-pull: ${appId}`);
20740
+ try {
20741
+ const prePullResult = await (0, paas_app_pull_ts_1.paasAppPullService)(skipOverwriteConfirm, false, skipOverwriteConfirm);
20742
+ errorMessages.push(...prePullResult.errorMessages);
20743
+ local = await readLocalPaasApp(appId);
20744
+ }
20745
+ finally {
20746
+ logger_ts_1.loggerService.stopLoading();
20747
+ }
20748
+ if (!local.content) {
20749
+ return { appId, action: 'skip', errorMessage: `Invalid local content after pre-pull: ${appId}` };
20750
+ }
20751
+ }
20752
+ const content = local.content ?? {};
20753
+ let targetId = appId;
20754
+ let newId;
20755
+ if (isCreate) {
20756
+ // 调用远端 create(请求体 { content })
20757
+ logger_ts_1.loggerService.startLoading('paas-app push request (create)');
20758
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppCreate'), { content });
20759
+ logger_ts_1.loggerService.stopLoading();
20760
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, (res) => {
20761
+ const data = res.data;
20762
+ return (0, request_ts_1.isAppDevRecord)(data) ? data : {};
20763
+ });
20764
+ if (!result.success) {
20765
+ return { appId, action: 'create', errorMessage: result.errorMessage };
20766
+ }
20767
+ newId = normalize_ts_1.default.normalizeText(result.data?.appId);
20768
+ if (!newId) {
20769
+ return { appId, action: 'create', errorMessage: 'Server response missing appId.' };
20770
+ }
20771
+ targetId = newId;
20772
+ await xml.renameXml('PaasApp', appId, targetId, {});
20773
+ }
20774
+ else {
20775
+ // 调用远端 update(请求体 { appId, updateTime, content })
20776
+ const updateTime = local.updateTime;
20777
+ if (updateTime === undefined) {
20778
+ return {
20779
+ appId,
20780
+ action: 'update',
20781
+ errorMessage: `Missing updateTime for ${appId}, try pull first to fetch the latest updateTime.`,
20782
+ };
20783
+ }
20784
+ logger_ts_1.loggerService.startLoading(`paas-app push request (update): ${appId}`);
20785
+ const response = await (0, request_ts_1.requestAppDevExecute)((0, request_execute_command_paths_ts_1.getShareCliCommandPath)('appDev', 'paasAppUpdate'), { appId, updateTime, content });
20786
+ logger_ts_1.loggerService.stopLoading();
20787
+ const result = await (0, request_ts_1.extractAppDevServiceResult)(response, () => ({}));
20788
+ if (!result.success) {
20789
+ return { appId, action: 'update', errorMessage: result.errorMessage };
20790
+ }
20791
+ }
20792
+ // 回写本地 status=unchanged(本次推送已成功,本地与远端一致)
20793
+ await xml.writeXml('PaasApp', targetId, content, { status: 'unchanged' });
20794
+ // post-pull:拉取同步远端最新(失败仅记录,不影响本次 push 结果)
20795
+ logger_ts_1.loggerService.startLoading(`paas-app push post-pull: ${targetId}`);
20796
+ try {
20797
+ const postPullResult = await (0, paas_app_pull_ts_1.paasAppPullService)(skipOverwriteConfirm, false, skipOverwriteConfirm);
20798
+ errorMessages.push(...postPullResult.errorMessages);
20799
+ }
20800
+ finally {
20801
+ logger_ts_1.loggerService.stopLoading();
20802
+ }
20803
+ logger_ts_1.loggerService.debug(`push success: ${appId}${newId ? ` -> ${newId}` : ''}`);
20804
+ return { appId, action: isCreate ? 'create' : 'update', newId };
20805
+ }
20806
+ /** 推送本地 PaasApp XML 到远端 */
20807
+ async function paasAppPushService(options) {
20808
+ const errorMessages = [];
20809
+ const results = [];
20810
+ const skipOverwriteConfirm = options.skipOverwriteConfirm === true;
20811
+ if (options.all && options.appId) {
20812
+ throw new Error('Invalid arguments: use either --all or --appId, not both.');
20813
+ }
20814
+ let candidates;
20815
+ if (options.appId) {
20816
+ const normalizedId = normalize_ts_1.default.normalizeString(options.appId);
20817
+ if (!normalizedId) {
20818
+ throw new Error('Invalid arguments: --appId is required.');
20819
+ }
20820
+ const allFiles = await findLocalPaasAppFiles();
20821
+ candidates = allFiles.filter((f) => f.appId === normalizedId);
20822
+ if (candidates.length === 0) {
20823
+ throw new Error(`PaaS app not found locally: ${normalizedId}`);
20824
+ }
20825
+ }
20826
+ else if (options.all) {
20827
+ candidates = await findLocalPaasAppFiles();
20828
+ }
20829
+ else {
20830
+ throw new Error('Invalid arguments: specify --all to push all local files, or --appId to push a single file.');
20831
+ }
20832
+ if (candidates.length === 0) {
20833
+ logger_ts_1.loggerService.warn('No local paas-app files found to push.');
20834
+ return { pushed: 0, skipped: 0, failed: 0, results: [], errorMessages: [] };
20835
+ }
20836
+ let pushed = 0;
20837
+ let skipped = 0;
20838
+ let failed = 0;
20839
+ for (const file of candidates) {
20840
+ try {
20841
+ const statusCheck = await readLocalPaasApp(file.appId);
20842
+ if (statusCheck.status === 'unchanged') {
20843
+ skipped += 1;
20844
+ results.push({ appId: file.appId, action: 'skip' });
20845
+ logger_ts_1.loggerService.debug(`push skip (unchanged): ${file.appId}`);
20846
+ continue;
20847
+ }
20848
+ const itemResult = await pushSingleFile(file, skipOverwriteConfirm, errorMessages);
20849
+ results.push(itemResult);
20850
+ if (itemResult.errorMessage) {
20851
+ failed += 1;
20852
+ errorMessages.push(`${file.appId}: ${itemResult.errorMessage}`);
20853
+ }
20854
+ else {
20855
+ pushed += 1;
20856
+ }
20857
+ }
20858
+ catch (error) {
20859
+ failed += 1;
20860
+ const errorMsg = error instanceof Error ? error.message : String(error);
20861
+ errorMessages.push(`${file.appId}: ${errorMsg}`);
20862
+ results.push({ appId: file.appId, action: 'skip', errorMessage: errorMsg });
20863
+ }
20864
+ }
20865
+ return { pushed, skipped, failed, results, errorMessages };
20866
+ }
20867
+
20868
+
20869
+ /***/ },
20870
+
20871
+ /***/ 3473
20361
20872
  (__unused_webpack_module, exports, __webpack_require__) {
20362
20873
 
20363
20874
 
20364
20875
  Object.defineProperty(exports, "__esModule", ({ value: true }));
20365
20876
  exports.paasAppUpdateService = paasAppUpdateService;
20366
20877
  const index_ts_1 = __webpack_require__(9985);
20367
- const paas_app_service_ts_1 = __webpack_require__(7957);
20368
- const xmlMetadataManager = new index_ts_1.XmlMetadataManager();
20369
- /**
20370
- * 更新本地 PaaS 应用 XML 文件(仅操作本地,不调用远端接口)
20371
- * - --appId 为本地文件身份(远端 appId 或本地创建时的 local-<localkey>)
20372
- * - 校验 --content JSON 结构
20373
- * - 本地文件不存在时抛出错误
20374
- * - 回写 XML:原状态为 new 时保持 new,否则标记为 modified(保留 extra 中的 updateTime)
20375
- */
20376
- async function paasAppUpdateService(appId, contentJson, options = {}) {
20377
- void options;
20378
- const normalizedAppId = (0, paas_app_service_ts_1.parseAppId)(appId);
20379
- const content = (0, paas_app_service_ts_1.parseContent)(contentJson);
20380
- (0, paas_app_service_ts_1.validateUpdateContent)(content);
20381
- const current = await xmlMetadataManager.readXml('PaasApp', normalizedAppId, {
20878
+ const paas_app_create_ts_1 = __webpack_require__(7928);
20879
+ const xml = new index_ts_1.XmlMetadataManager();
20880
+ /** 更新本地 PaaS 应用 XML(仅写本地,远端同步走 push) */
20881
+ async function paasAppUpdateService(appId, contentJson) {
20882
+ const normalizedAppId = (0, paas_app_create_ts_1.parseAppId)(appId);
20883
+ const content = (0, paas_app_create_ts_1.parseContent)(contentJson);
20884
+ (0, paas_app_create_ts_1.validateUpdateContent)(content);
20885
+ const current = await xml.readXml('PaasApp', normalizedAppId, {
20382
20886
  fields: ['content', 'status', 'extra'],
20383
20887
  });
20384
20888
  if (current.content === null || current.content === undefined) {
20385
20889
  throw new Error(`PaaS app metadata not found: ${normalizedAppId}`);
20386
20890
  }
20387
- const filePath = await xmlMetadataManager.writeXml('PaasApp', normalizedAppId, content, {
20891
+ const filePath = await xml.writeXml('PaasApp', normalizedAppId, content, {
20388
20892
  contentMode: 'merge',
20389
20893
  status: current.status === 'new' ? 'new' : 'modified',
20390
20894
  extra: current.extra,
@@ -20396,6 +20900,50 @@ async function paasAppUpdateService(appId, contentJson, options = {}) {
20396
20900
  }
20397
20901
 
20398
20902
 
20903
+ /***/ },
20904
+
20905
+ /***/ 6272
20906
+ (__unused_webpack_module, exports, __webpack_require__) {
20907
+
20908
+
20909
+ var __importDefault = (this && this.__importDefault) || function (mod) {
20910
+ return (mod && mod.__esModule) ? mod : { "default": mod };
20911
+ };
20912
+ Object.defineProperty(exports, "__esModule", ({ value: true }));
20913
+ exports.isAppDevRecord = void 0;
20914
+ exports.requestAppDevExecute = requestAppDevExecute;
20915
+ exports.extractAppDevServiceResult = extractAppDevServiceResult;
20916
+ const request_execute_ts_1 = __webpack_require__(8554);
20917
+ const normalize_ts_1 = __importDefault(__webpack_require__(9268));
20918
+ /** app-dev 操作中心接口包装调用 */
20919
+ async function requestAppDevExecute(commandPath, data, others) {
20920
+ const response = others === undefined
20921
+ ? await (0, request_execute_ts_1.executeShareCliCommand)(commandPath, data)
20922
+ : await (0, request_execute_ts_1.executeShareCliCommand)(commandPath, data, others);
20923
+ if (!response || typeof response !== 'object') {
20924
+ throw new Error('Response is not an object or is empty.');
20925
+ }
20926
+ return response;
20927
+ }
20928
+ /** 从操作中心响应中提取业务结果(success === true && code === 'OK') */
20929
+ async function extractAppDevServiceResult(response, dataGetter) {
20930
+ if (!response || typeof response !== 'object') {
20931
+ throw new Error('Response is not an object or is empty.');
20932
+ }
20933
+ if (response.success === true && response.code === 'OK') {
20934
+ return { success: true, errorMessage: '', data: dataGetter(response) };
20935
+ }
20936
+ return {
20937
+ success: false,
20938
+ errorMessage: normalize_ts_1.default.normalizeText(response.message) || 'Unknown error.',
20939
+ data: undefined,
20940
+ };
20941
+ }
20942
+ /** 运行时判断 value 是否为合法 record(供各 service 复用) */
20943
+ const isAppDevRecord = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value));
20944
+ exports.isAppDevRecord = isAppDevRecord;
20945
+
20946
+
20399
20947
  /***/ },
20400
20948
 
20401
20949
  /***/ 5805
@@ -25772,22 +26320,24 @@ async function fetchRemoteUpdateTime(menuApiName, errorMessages) {
25772
26320
  return (0, types_ts_1.narrowInterfaceDevResponse)(list) ?? [];
25773
26321
  });
25774
26322
  if (!result.success || !result.data) {
25775
- return null;
26323
+ errorMessages.push(`remote existence check failed: ${menuApiName}: ${result.errorMessage || 'Unknown error.'}`);
26324
+ return { status: 'unknown' };
25776
26325
  }
25777
26326
  const matched = result.data.find((item) => normalize_ts_1.default.normalizeText(item.menuApiName) === menuApiName);
25778
26327
  if (!matched) {
25779
- return null;
26328
+ return { status: 'missing' };
25780
26329
  }
25781
26330
  const rawTime = matched.updateTime;
25782
- return typeof rawTime === 'number'
26331
+ const updateTime = typeof rawTime === 'number'
25783
26332
  ? rawTime
25784
26333
  : typeof rawTime === 'string' && rawTime.trim()
25785
26334
  ? Number(rawTime)
25786
- : null;
26335
+ : undefined;
26336
+ return { status: 'exists', updateTime };
25787
26337
  }
25788
26338
  catch (error) {
25789
26339
  errorMessages.push(`remote existence check failed: ${menuApiName}: ${error instanceof Error ? error.message : String(error)}`);
25790
- return null;
26340
+ return { status: 'unknown' };
25791
26341
  }
25792
26342
  }
25793
26343
  // ========================================================================
@@ -25853,17 +26403,23 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
25853
26403
  };
25854
26404
  }
25855
26405
  // 2) 远端存在性校验(按 menuApiName 精确匹配),修正状态与 updateTime
25856
- const remoteUpdateTime = await fetchRemoteUpdateTime(menuApiName, errorMessages);
25857
- const remoteExists = remoteUpdateTime !== null;
25858
- if (local.status === 'new' && remoteExists) {
26406
+ const remote = await fetchRemoteUpdateTime(menuApiName, errorMessages);
26407
+ if (remote.status === 'unknown') {
26408
+ return {
26409
+ menuApiName,
26410
+ action: 'skip',
26411
+ errorMessage: `Remote existence check failed: ${menuApiName}`,
26412
+ };
26413
+ }
26414
+ if (local.status === 'new' && remote.status === 'exists') {
25859
26415
  await xmlMetadataManager.writeXml('CustomMenu', menuApiName, local.content, {
25860
26416
  status: 'modified',
25861
- extra: { updateTime: remoteUpdateTime },
26417
+ extra: { updateTime: remote.updateTime },
25862
26418
  });
25863
26419
  logger_ts_1.loggerService.warn(`Custom menu exists remotely, local status changed from new to modified: ${menuApiName}`);
25864
26420
  local = await readLocalCustomMenu(menuApiName);
25865
26421
  }
25866
- else if (local.status !== 'new' && !remoteExists) {
26422
+ else if (local.status !== 'new' && remote.status === 'missing') {
25867
26423
  await xmlMetadataManager.writeXml('CustomMenu', menuApiName, local.content, { status: 'new' });
25868
26424
  logger_ts_1.loggerService.warn(`Custom menu does not exist remotely, local status changed from ${local.status} to new: ${menuApiName}`);
25869
26425
  local = await readLocalCustomMenu(menuApiName);
@@ -26014,7 +26570,7 @@ async function customMenuPushService(options) {
26014
26570
 
26015
26571
 
26016
26572
  Object.defineProperty(exports, "__esModule", ({ value: true }));
26017
- exports.customMenuPageOptionsService = exports.customMenuListService = exports.validateUpdateContent = exports.validateCreateContent = exports.parseMenuTypes = exports.parsePositiveInteger = exports.parseContent = exports.parseMenuApiName = exports.validateName = exports.isValidMenuApiName = exports.isScopeList = exports.isNonEmptyStringArray = exports.isNonEmptyString = exports.SUPPORTED_MENU_TYPES = void 0;
26573
+ exports.customMenuPageOptionsService = exports.customMenuListService = exports.validateUpdateContent = exports.validateCreateContent = exports.parseMenuTypes = exports.parsePositiveInteger = exports.parseContent = exports.parseMenuApiName = exports.validateName = exports.isValidMenuApiName = exports.isScopeListUpdate = exports.isScopeList = exports.isNonEmptyStringArray = exports.isNonEmptyString = exports.SUPPORTED_MENU_TYPES = void 0;
26018
26574
  const request_execute_command_paths_ts_1 = __webpack_require__(2351);
26019
26575
  const request_ts_1 = __webpack_require__(6856);
26020
26576
  // ========================================================================
@@ -26052,6 +26608,18 @@ const isScopeList = (value) => (Array.isArray(value) && value.every((item) => (i
26052
26608
  && Number.isInteger(item.DataType)
26053
26609
  && SUPPORTED_SCOPE_TYPES.has(item.DataType))));
26054
26610
  exports.isScopeList = isScopeList;
26611
+ /**
26612
+ * update 场景的宽松 scopeList 校验:不限制字段集合,允许未知字段透传,
26613
+ * 仅保证结构合法(create 场景继续使用 isScopeList 严格校验)
26614
+ */
26615
+ const isScopeListUpdate = (value) => (Array.isArray(value)
26616
+ && value.length > 0
26617
+ && value.every((item) => (item !== null
26618
+ && typeof item === 'object'
26619
+ && !Array.isArray(item)
26620
+ && (0, exports.isNonEmptyString)(item.DataID)
26621
+ && Number.isInteger(item.DataType))));
26622
+ exports.isScopeListUpdate = isScopeListUpdate;
26055
26623
  const isValidMenuApiName = (value) => {
26056
26624
  if (value.length > 50 || !/^[A-Za-z][A-Za-z0-9_]+__c$/.test(value)) {
26057
26625
  return false;
@@ -26185,16 +26753,12 @@ const validateCreateContent = (menuApiName, content) => {
26185
26753
  };
26186
26754
  exports.validateCreateContent = validateCreateContent;
26187
26755
  const validateUpdateContent = (content) => {
26188
- const allowedKeys = new Set(['name', 'scopeList']);
26189
- if (Object.keys(content).some((key) => !allowedKeys.has(key))) {
26190
- throw new Error('--content for update only accepts name and scopeList.');
26191
- }
26192
26756
  if (content.name !== undefined) {
26193
26757
  (0, exports.validateName)(content.name, '--content.name');
26194
26758
  }
26195
26759
  if (content.scopeList !== undefined
26196
- && (!(0, exports.isScopeList)(content.scopeList) || content.scopeList.length === 0)) {
26197
- throw new Error('--content.scopeList must be a non-empty array using internal DataType 1 (member), 2 (department), or 4 (role) when provided.');
26760
+ && (!(0, exports.isScopeListUpdate)(content.scopeList) || content.scopeList.length === 0)) {
26761
+ throw new Error('--content.scopeList must be a non-empty array whose items contain a non-empty DataID and an integer DataType when provided.');
26198
26762
  }
26199
26763
  if (content.scopeList !== undefined
26200
26764
  && new Set(content.scopeList.map((item) => `${item.DataType}:${item.DataID}`)).size !== content.scopeList.length) {
@@ -27392,11 +27956,12 @@ async function fetchRemoteMobileNavigation(id, errorMessages) {
27392
27956
  return (0, types_ts_1.narrowInterfaceDevResponse)(list) ?? [];
27393
27957
  });
27394
27958
  if (!result.success || !result.data) {
27395
- return { exists: false };
27959
+ errorMessages.push(`remote existence check failed: ${id}: ${result.errorMessage || 'Unknown error.'}`);
27960
+ return { status: 'unknown' };
27396
27961
  }
27397
27962
  const matched = result.data.find((item) => normalize_ts_1.default.normalizeText(item.id) === id);
27398
27963
  if (!matched) {
27399
- return { exists: false };
27964
+ return { status: 'missing' };
27400
27965
  }
27401
27966
  const rawTime = matched.updateTime;
27402
27967
  const updateTime = typeof rawTime === 'number'
@@ -27404,11 +27969,11 @@ async function fetchRemoteMobileNavigation(id, errorMessages) {
27404
27969
  : typeof rawTime === 'string' && rawTime.trim()
27405
27970
  ? Number(rawTime)
27406
27971
  : undefined;
27407
- return { exists: true, updateTime };
27972
+ return { status: 'exists', updateTime };
27408
27973
  }
27409
27974
  catch (error) {
27410
27975
  errorMessages.push(`remote existence check failed: ${id}: ${error instanceof Error ? error.message : String(error)}`);
27411
- return { exists: false };
27976
+ return { status: 'unknown' };
27412
27977
  }
27413
27978
  }
27414
27979
  // ========================================================================
@@ -27479,7 +28044,10 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
27479
28044
  let isCreate = local.status === 'new';
27480
28045
  if (!isLocalPlaceholder) {
27481
28046
  const remote = await fetchRemoteMobileNavigation(id, errorMessages);
27482
- if (local.status === 'new' && remote.exists) {
28047
+ if (remote.status === 'unknown') {
28048
+ return { id, action: 'skip', errorMessage: `Remote existence check failed: ${id}` };
28049
+ }
28050
+ if (local.status === 'new' && remote.status === 'exists') {
27483
28051
  await xmlMetadataManager.writeXml('MobileNavigation', id, local.content, {
27484
28052
  status: 'modified',
27485
28053
  extra: { updateTime: remote.updateTime },
@@ -27487,7 +28055,7 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
27487
28055
  logger_ts_1.loggerService.warn(`Mobile navigation exists remotely, local status changed from new to modified: ${id}`);
27488
28056
  local = await readLocalMobileNavigation(id);
27489
28057
  }
27490
- else if (local.status !== 'new' && !remote.exists && local.updateTime === undefined) {
28058
+ else if (local.status !== 'new' && remote.status === 'missing' && local.updateTime === undefined) {
27491
28059
  await xmlMetadataManager.writeXml('MobileNavigation', id, local.content, { status: 'new' });
27492
28060
  logger_ts_1.loggerService.warn(`Mobile navigation does not exist remotely, local status changed from ${local.status} to new: ${id}`);
27493
28061
  local = await readLocalMobileNavigation(id);
@@ -27788,25 +28356,10 @@ const validateContent = (content) => {
27788
28356
  }
27789
28357
  };
27790
28358
  exports.validateContent = validateContent;
27791
- const MOBILE_NAVIGATION_UPDATE_ALLOWED_KEYS = new Set([
27792
- 'name',
27793
- 'defaultMenuIndex',
27794
- 'items',
27795
- 'scope',
27796
- 'priority',
27797
- 'conflictStrategy',
27798
- ]);
27799
28359
  /**
27800
- * 更新时校验(对齐 custom-menu validateUpdateContent):
27801
- * - 仅允许部分业务字段,拒绝 unsupported field
27802
- * - 不强制必填项齐全(仅对传入字段做类型/合法性校验)
27803
- * - 至少提供一个支持字段
28360
+ * 更新时校验:不拒绝未知字段,允许 pull 得到的完整 content 原样回写
27804
28361
  */
27805
28362
  const validateUpdateContent = (content) => {
27806
- const unsupported = Object.keys(content).filter((key) => !MOBILE_NAVIGATION_UPDATE_ALLOWED_KEYS.has(key));
27807
- if (unsupported.length) {
27808
- throw new Error(`--content contains unsupported field: ${unsupported.join(', ')}.`);
27809
- }
27810
28363
  if (Object.keys(content).length === 0) {
27811
28364
  throw new Error('--content must include at least one supported field for update.');
27812
28365
  }
@@ -28247,11 +28800,12 @@ async function fetchRemoteUpdateTime(apiName, errorMessages) {
28247
28800
  return (0, types_ts_1.narrowInterfaceDevResponse)(list) ?? [];
28248
28801
  });
28249
28802
  if (!result.success || !result.data) {
28250
- return { exists: false };
28803
+ errorMessages.push(`remote existence check failed: ${apiName}: ${result.errorMessage || 'Unknown error.'}`);
28804
+ return { status: 'unknown' };
28251
28805
  }
28252
28806
  const matched = result.data.find((item) => normalize_ts_1.default.normalizeText(item.apiName) === apiName);
28253
28807
  if (!matched) {
28254
- return { exists: false };
28808
+ return { status: 'missing' };
28255
28809
  }
28256
28810
  const rawTime = matched.updateTime;
28257
28811
  const updateTime = typeof rawTime === 'number'
@@ -28259,11 +28813,11 @@ async function fetchRemoteUpdateTime(apiName, errorMessages) {
28259
28813
  : typeof rawTime === 'string' && rawTime.trim()
28260
28814
  ? Number(rawTime)
28261
28815
  : undefined;
28262
- return { exists: true, updateTime };
28816
+ return { status: 'exists', updateTime };
28263
28817
  }
28264
28818
  catch (error) {
28265
28819
  errorMessages.push(`remote existence check failed: ${apiName}: ${error instanceof Error ? error.message : String(error)}`);
28266
- return { exists: false };
28820
+ return { status: 'unknown' };
28267
28821
  }
28268
28822
  }
28269
28823
  // ========================================================================
@@ -28329,7 +28883,10 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
28329
28883
  };
28330
28884
  }
28331
28885
  const remote = await fetchRemoteUpdateTime(apiName, errorMessages);
28332
- if (local.status === 'new' && remote.exists) {
28886
+ if (remote.status === 'unknown') {
28887
+ return { apiName, action: 'skip', errorMessage: `Remote existence check failed: ${apiName}` };
28888
+ }
28889
+ if (local.status === 'new' && remote.status === 'exists') {
28333
28890
  await xmlMetadataManager.writeXml('WebNavigation', apiName, local.content, {
28334
28891
  status: 'modified',
28335
28892
  extra: { updateTime: remote.updateTime },
@@ -28337,7 +28894,7 @@ async function pushSingleFile(file, skipOverwriteConfirm, errorMessages) {
28337
28894
  logger_ts_1.loggerService.warn(`Web navigation exists remotely, local status changed from new to modified: ${apiName}`);
28338
28895
  local = await readLocalWebNavigation(apiName);
28339
28896
  }
28340
- else if (local.status !== 'new' && !remote.exists) {
28897
+ else if (local.status !== 'new' && remote.status === 'missing') {
28341
28898
  await xmlMetadataManager.writeXml('WebNavigation', apiName, local.content, { status: 'new' });
28342
28899
  logger_ts_1.loggerService.warn(`Web navigation does not exist remotely, local status changed from ${local.status} to new: ${apiName}`);
28343
28900
  local = await readLocalWebNavigation(apiName);
@@ -28610,6 +29167,34 @@ const validateTopNavToolListStrict = (topNavToolList) => {
28610
29167
  toolIds.add(tool.id);
28611
29168
  }
28612
29169
  };
29170
+ /**
29171
+ * update 场景的宽松 topNavToolList 校验:不限制内置工具 ID,允许未知工具透传,
29172
+ * 仅保证结构合法(create 场景继续使用 validateTopNavToolListStrict)
29173
+ */
29174
+ const validateTopNavToolList = (topNavToolList) => {
29175
+ if (!Array.isArray(topNavToolList)) {
29176
+ throw new Error('--content.topNavToolList must be an array.');
29177
+ }
29178
+ const toolIds = new Set();
29179
+ for (const tool of topNavToolList) {
29180
+ if (!tool || typeof tool !== 'object' || Array.isArray(tool)) {
29181
+ throw new Error('--content.topNavToolList must contain supported tool objects.');
29182
+ }
29183
+ if (typeof tool.id !== 'string' || !tool.id.trim()) {
29184
+ throw new Error('--content.topNavToolList[].id must be a non-empty string.');
29185
+ }
29186
+ if (toolIds.has(tool.id)) {
29187
+ throw new Error('--content.topNavToolList cannot contain duplicate tools.');
29188
+ }
29189
+ if (typeof tool.hidden !== 'boolean') {
29190
+ throw new Error('--content.topNavToolList[].hidden must be a boolean.');
29191
+ }
29192
+ if (!Number.isInteger(tool.order) || tool.order <= 0) {
29193
+ throw new Error('--content.topNavToolList[].order must be a positive integer.');
29194
+ }
29195
+ toolIds.add(tool.id);
29196
+ }
29197
+ };
28613
29198
  const validateNavMode = (navMode) => {
28614
29199
  if (navMode !== 'vertical' && navMode !== 'horizontal') {
28615
29200
  throw new Error('--content.navMode must be "vertical" or "horizontal".');
@@ -28648,26 +29233,10 @@ const validateContent = (content) => {
28648
29233
  }
28649
29234
  };
28650
29235
  exports.validateContent = validateContent;
28651
- const WEB_NAVIGATION_UPDATE_ALLOWED_KEYS = new Set([
28652
- 'name',
28653
- 'mainChannelMenuVOList',
28654
- 'scopeList',
28655
- 'topNavToolList',
28656
- 'navMode',
28657
- 'priorityLevel',
28658
- ...WEB_NAVIGATION_BOOLEAN_FIELDS,
28659
- ]);
28660
29236
  /**
28661
- * 更新时校验(对齐 custom-menu validateUpdateContent):
28662
- * - 仅允许部分业务字段,拒绝 unsupported field
28663
- * - 不强制必填项齐全(仅对传入字段做类型/合法性校验)
28664
- * - 至少提供一个支持字段
29237
+ * 更新时校验:不拒绝未知字段,允许 pull 得到的完整 content 原样回写
28665
29238
  */
28666
29239
  const validateUpdateContent = (content) => {
28667
- const unsupported = Object.keys(content).filter((key) => !WEB_NAVIGATION_UPDATE_ALLOWED_KEYS.has(key));
28668
- if (unsupported.length) {
28669
- throw new Error(`--content contains unsupported field: ${unsupported.join(', ')}.`);
28670
- }
28671
29240
  if (Object.keys(content).length === 0) {
28672
29241
  throw new Error('--content must include at least one supported field for update.');
28673
29242
  }
@@ -28687,7 +29256,7 @@ const validateUpdateContent = (content) => {
28687
29256
  validateNavMode(content.navMode);
28688
29257
  }
28689
29258
  if (content.topNavToolList !== undefined) {
28690
- validateTopNavToolListStrict(content.topNavToolList);
29259
+ validateTopNavToolList(content.topNavToolList);
28691
29260
  }
28692
29261
  for (const field of WEB_NAVIGATION_BOOLEAN_FIELDS) {
28693
29262
  if (content[field] !== undefined) {
@@ -32240,10 +32809,10 @@ async function findLocalEmailTemplateFiles() {
32240
32809
  return results;
32241
32810
  }
32242
32811
  for (const entry of entries) {
32243
- if (!entry.isFile() || !entry.name.endsWith('.xml')) {
32812
+ if (!entry.isFile() || !entry.name.endsWith('.email-template.xml')) {
32244
32813
  continue;
32245
32814
  }
32246
- const templateId = entry.name.slice(0, -'.xml'.length);
32815
+ const templateId = entry.name.slice(0, -'.email-template.xml'.length);
32247
32816
  results.push({
32248
32817
  templateId,
32249
32818
  filePath: node_path_1.default.join(dirPath, entry.name),
@@ -38075,10 +38644,10 @@ async function findLocalPrintTemplateFiles() {
38075
38644
  return results;
38076
38645
  }
38077
38646
  for (const entry of entries) {
38078
- if (!entry.isFile() || !entry.name.endsWith('.xml')) {
38647
+ if (!entry.isFile() || !entry.name.endsWith('.print-template.xml')) {
38079
38648
  continue;
38080
38649
  }
38081
- const templateId = entry.name.slice(0, -'.xml'.length);
38650
+ const templateId = entry.name.slice(0, -'.print-template.xml'.length);
38082
38651
  results.push({
38083
38652
  templateId,
38084
38653
  filePath: node_path_1.default.join(dirPath, entry.name),
@@ -40346,8 +40915,10 @@ async function pwcCreateCommand(options, context) {
40346
40915
  ...templatePayload
40347
40916
  });
40348
40917
  }
40349
- logger_ts_1.loggerService.updateLoading('Downloading created resource to local workspace');
40350
40918
  const createdType = input.kind === 'component' ? pwc_types_ts_1.PWCType.Component : pwc_types_ts_1.PWCType.Plugin;
40919
+ logger_ts_1.loggerService.updateLoading(`Enabling remote PWC ${input.kind}`);
40920
+ await (0, pwc_service_ts_1.enablePwcResource)(createdType, input.apiName);
40921
+ logger_ts_1.loggerService.updateLoading('Downloading created resource to local workspace');
40351
40922
  const created = await fetchCreatedPwc(createdType, input.apiName);
40352
40923
  const componentRoot = await hydrateAndWritePwcComponent(context, created);
40353
40924
  await ensurePwcCreateDefaultEntry(context, createdType, input.apiName);
@@ -41378,6 +41949,7 @@ exports.getPwcConfig = getPwcConfig;
41378
41949
  exports.getObjectApiNames = getObjectApiNames;
41379
41950
  exports.createComponentSource = createComponentSource;
41380
41951
  exports.createPluginSource = createPluginSource;
41952
+ exports.enablePwcResource = enablePwcResource;
41381
41953
  exports.getUrlByApiName = getUrlByApiName;
41382
41954
  const request_ts_1 = __webpack_require__(2088);
41383
41955
  async function fetchCode(type, apiName) {
@@ -41534,6 +42106,18 @@ async function createPluginSource(data) {
41534
42106
  data
41535
42107
  });
41536
42108
  }
42109
+ /**
42110
+ * 启用已创建并上传成功的 PWC 组件或插件。
42111
+ * create 成功后必须立即调用,失败时由请求层抛错并中止后续本地回拉流程。
42112
+ */
42113
+ async function enablePwcResource(type, apiName) {
42114
+ const resourceType = type === 'plugin' ? 'Plugin' : 'Component';
42115
+ const action = type === 'plugin' ? 'enablePlugin' : 'enableComponent';
42116
+ await request_ts_1.requestService.FHH({
42117
+ url: `/EM1HCompBuild/${resourceType}/${action}`,
42118
+ data: { apiName }
42119
+ });
42120
+ }
41537
42121
  async function getUrlByApiName(apiName, type) {
41538
42122
  if (type === 'plugin') {
41539
42123
  const response = await request_ts_1.requestService.FHH({
@@ -58160,7 +58744,7 @@ module.exports = /*#__PURE__*/JSON.parse('{"application/1d-interleaved-parityfec
58160
58744
  /***/ 8330
58161
58745
  (module) {
58162
58746
 
58163
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@share-crm/sharedev-cli","version":"0.0.4-rc.34","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"}');
58747
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@share-crm/sharedev-cli","version":"0.0.4-rc.36","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"}');
58164
58748
 
58165
58749
  /***/ }
58166
58750