UNPKG

@lcap/nasl

Version:

NetEase Application Specific Language

57 lines 1.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.initialize = void 0; const requestUrl = '/api/v1/app/config'; async function initialize({ app, axios, useCache }) { if (useCache) { return; } const { data: res } = await axios.get(requestUrl, { headers: { appId: app.id, }, params: { key: 'processV2Enabled', }, }); if (!res?.result || !Array.isArray(res.result)) { return; } if (res.result.length === 0) { app.newProcessVersion = app.processes.length === 0; } else { app.newProcessVersion = res.result[0]?.value === 'true'; } if (app.frontendTypes.find(ft => ft.frameworkKind === 'react')) { app.newProcessVersion = true; } // 应用模板导入后,流程版本没有切换成 2.0 if (!app.newProcessVersion && app.processV2s?.length) { await axios.post(requestUrl, { key: 'processV2Enabled', value: true, }, { headers: { appId: app.id, }, }); app.newProcessVersion = true; } app.processV2s?.forEach((process) => { const selectDefination = process.processDefinitions?.find((item) => process.previewedVersion === item.version); process.selectedVersion = selectDefination ? selectDefination.version : process.processDefinitions[0].version; }); if (app.newProcessVersion) { app.processes.forEach((process) => { process.__isVirtual = true; }); } else { app.processes.forEach((process) => { process.__isVirtual = false; }); } } exports.initialize = initialize; //# sourceMappingURL=processV2.js.map