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