@share-crm/sharedev-cli 0.0.4-rc.50-test.1 → 0.0.4-rc.50-test.3
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 +38 -16
- package/package.json +1 -1
package/dist/sharedev.js
CHANGED
|
@@ -14877,7 +14877,10 @@ async function findSharedevPath(startDir) {
|
|
|
14877
14877
|
let currentDir = node_path_1.default.resolve(startDir);
|
|
14878
14878
|
while (true) {
|
|
14879
14879
|
const candidate = node_path_1.default.join(currentDir, SHAREDEV_RELATIVE_PATH);
|
|
14880
|
-
|
|
14880
|
+
// .sharedev 目录必须包含 settings.json 才算已初始化的工作区:
|
|
14881
|
+
// 只存在 .sharedev 目录(如家目录的文档/快照残留)时继续向上查找,
|
|
14882
|
+
// 避免误命中导致 settings 读写与 init 落位跑到错误目录
|
|
14883
|
+
if (await (0, file_ts_1.pathExists)(node_path_1.default.join(candidate, SETTINGS_NAME))) {
|
|
14881
14884
|
return candidate;
|
|
14882
14885
|
}
|
|
14883
14886
|
const parentDir = node_path_1.default.dirname(currentDir);
|
|
@@ -14902,9 +14905,8 @@ async function findSettings(startDir) {
|
|
|
14902
14905
|
return node_path_1.default.join(sharedevPath, SETTINGS_NAME);
|
|
14903
14906
|
}
|
|
14904
14907
|
function validateSettings(settings) {
|
|
14905
|
-
|
|
14906
|
-
|
|
14907
|
-
}
|
|
14908
|
+
// certificate 允许为空(工作区可仅以 sharecrm 登录态运行);
|
|
14909
|
+
// FHH 请求在 certificate 缺失时由通道层给出明确引导
|
|
14908
14910
|
if (!settings.domain?.trim()) {
|
|
14909
14911
|
throw new Error('Missing domain in .sharedev/settings.json.');
|
|
14910
14912
|
}
|
|
@@ -14987,7 +14989,7 @@ async function createCliRuntimeContext(_options) {
|
|
|
14987
14989
|
settings = await (0, config_ts_1.loadSettings)(searchDir);
|
|
14988
14990
|
}
|
|
14989
14991
|
catch (error) {
|
|
14990
|
-
// settings
|
|
14992
|
+
// settings 文件缺失或内容损坏时,工作区内存在登录凭证(.sharedev/session.json)则降级为
|
|
14991
14993
|
// 「登录态模式」继续运行(certificate 可为空,业务请求走 open API 通道)。
|
|
14992
14994
|
// 此时 configureSharecrmSession 尚未注入,直接按 .sharedev 目录读取凭证文件。
|
|
14993
14995
|
const sharedevDir = await (0, config_ts_1.findSharedevPath)(searchDir);
|
|
@@ -19515,7 +19517,19 @@ async function getFuncList(options = {}) {
|
|
|
19515
19517
|
});
|
|
19516
19518
|
return response.function ?? [];
|
|
19517
19519
|
}
|
|
19520
|
+
/**
|
|
19521
|
+
* open API 通道的批量函数查询(sharecrm 登录态时替代 FHH biz/batchQuery)。
|
|
19522
|
+
* 响应结构 2026-10-21 实测:content.function 直接为数组(无 result 嵌套,
|
|
19523
|
+
* 与 get-by-apiname-and-binding-object-apiname 的 {result:{function}} 不同形)。
|
|
19524
|
+
*/
|
|
19525
|
+
async function findFuncByApiNamesViaOpenApi(apiNames) {
|
|
19526
|
+
const content = await (0, openapi_request_ts_1.executeOpenApiCommand)('code-dev function query-by-apinames', { apiNames });
|
|
19527
|
+
return content?.function ?? [];
|
|
19528
|
+
}
|
|
19518
19529
|
async function findFuncByApiNames(apiNames) {
|
|
19530
|
+
if ((0, request_channel_ts_1.resolveRequestChannel)() === 'openapi') {
|
|
19531
|
+
return findFuncByApiNamesViaOpenApi(apiNames);
|
|
19532
|
+
}
|
|
19519
19533
|
const response = await request_ts_1.requestService.FHH({
|
|
19520
19534
|
url: '/EM1HFUNC/biz/batchQuery',
|
|
19521
19535
|
data: {
|
|
@@ -29389,6 +29403,7 @@ const node_path_1 = __importDefault(__webpack_require__(76760));
|
|
|
29389
29403
|
const prompts_1 = __webpack_require__(53503);
|
|
29390
29404
|
const logger_ts_1 = __webpack_require__(87562);
|
|
29391
29405
|
const request_ts_1 = __webpack_require__(83733);
|
|
29406
|
+
const sharecrm_session_ts_1 = __webpack_require__(47166);
|
|
29392
29407
|
const file_ts_1 = __webpack_require__(57452);
|
|
29393
29408
|
const pkgMeta_ts_1 = __webpack_require__(48559);
|
|
29394
29409
|
const apl_command_ts_1 = __webpack_require__(10508);
|
|
@@ -29457,7 +29472,7 @@ async function collectInitSettings(options) {
|
|
|
29457
29472
|
domain = await askWithDefault('Enter enterprise domain', 'https://www.fxiaoke.com');
|
|
29458
29473
|
}
|
|
29459
29474
|
if (!certificate) {
|
|
29460
|
-
certificate = await askWithDefault('Enter developer certificate');
|
|
29475
|
+
certificate = await askWithDefault('Enter developer certificate (optional — leave empty to use sharecrm login)', '');
|
|
29461
29476
|
}
|
|
29462
29477
|
// if (!developerName) {
|
|
29463
29478
|
// developerName = await askWithDefault('Enter your developer name (optional)');
|
|
@@ -29475,9 +29490,8 @@ async function collectInitSettings(options) {
|
|
|
29475
29490
|
if (!isValidUrl(domain)) {
|
|
29476
29491
|
throw new Error('Invalid enterprise domain URL. Use a full URL, e.g. https://www.fxiaoke.com.');
|
|
29477
29492
|
}
|
|
29478
|
-
|
|
29479
|
-
|
|
29480
|
-
}
|
|
29493
|
+
// certificate 可选:留空时工作区以 sharecrm 登录态运行(sharedev auth login),
|
|
29494
|
+
// FHH 通道命令在未配置时由通道层给出引导
|
|
29481
29495
|
return {
|
|
29482
29496
|
enterpriseEA,
|
|
29483
29497
|
domain,
|
|
@@ -29719,22 +29733,28 @@ async function runInitMetadataDownload(context) {
|
|
|
29719
29733
|
await (0, dev_metadata_workspace_ts_1.writeNamespaceMetadataFile)(namespacesDir, namespaceResult.raw);
|
|
29720
29734
|
logger_ts_1.loggerService.success(`Metadata download complete: objects=${succeeded}${failed ? `, failed=${failed}` : ''}, namespaces=${namespaceResult.namespaces.length}`);
|
|
29721
29735
|
}
|
|
29722
|
-
async function runInitDownloadsConcurrently(context, options, pullSelections, agentName) {
|
|
29736
|
+
async function runInitDownloadsConcurrently(context, options, pullSelections, agentName, hasCredentials) {
|
|
29723
29737
|
const tasks = [];
|
|
29738
|
+
if (!hasCredentials && (pullSelections.pullAllApl || pullSelections.pullAllPwc)) {
|
|
29739
|
+
// 凭证未就绪(certificate 未配置且工作区未登录):远端拉取类任务全部跳过,
|
|
29740
|
+
// 文档/spec 模板(公网资源)照常下载
|
|
29741
|
+
logger_ts_1.loggerService.warn('Credentials not ready (no certificate configured and not logged in). Skipping remote pulls.');
|
|
29742
|
+
logger_ts_1.loggerService.info('Run `sharedev auth login` first, then `sharedev apl pull --all` / `sharedev pwc pull --all --type <component|plugin>`.');
|
|
29743
|
+
}
|
|
29724
29744
|
if (pullSelections.pullAllApl || pullSelections.pullAllPwc) {
|
|
29725
29745
|
tasks.push(runInitDocsDownload(context, pullSelections));
|
|
29726
29746
|
}
|
|
29727
29747
|
if (pullSelections.pullAllApl || pullSelections.pullAllPwc) {
|
|
29728
29748
|
tasks.push(runInitSpec(context, options, agentName));
|
|
29729
29749
|
}
|
|
29730
|
-
if (pullSelections.pullAllApl || pullSelections.pullAllPwc) {
|
|
29750
|
+
if (hasCredentials && (pullSelections.pullAllApl || pullSelections.pullAllPwc)) {
|
|
29731
29751
|
request_ts_1.requestService.configure(context.settings);
|
|
29732
29752
|
tasks.push(runInitMetadataDownload(context));
|
|
29733
29753
|
}
|
|
29734
|
-
if (pullSelections.pullAllApl) {
|
|
29754
|
+
if (hasCredentials && pullSelections.pullAllApl) {
|
|
29735
29755
|
tasks.push(runInitAplPull(context));
|
|
29736
29756
|
}
|
|
29737
|
-
if (pullSelections.pullAllPwc) {
|
|
29757
|
+
if (hasCredentials && pullSelections.pullAllPwc) {
|
|
29738
29758
|
tasks.push(runInitPwcPull(context));
|
|
29739
29759
|
}
|
|
29740
29760
|
const results = await Promise.allSettled(tasks);
|
|
@@ -29768,8 +29788,10 @@ async function initProjectCommand(runtimeContext, options) {
|
|
|
29768
29788
|
await (0, file_ts_1.writeJsonFile)(settingsPath, payload);
|
|
29769
29789
|
logger_ts_1.loggerService.success(`Initialization completed: ${settingsPath}`);
|
|
29770
29790
|
logger_ts_1.loggerService.info(`Workspace folder created: ${workspaceDir}`);
|
|
29791
|
+
// 凭证就绪判定:本次配置了 certificate,或工作区已存在 sharecrm 登录态(--force 重建场景)
|
|
29792
|
+
const hasCredentials = Boolean(payload.certificate?.trim()) || Boolean((0, sharecrm_session_ts_1.readSharedevAuthSession)(settingsDir)?.accessToken);
|
|
29771
29793
|
const initContext = createInitRuntimeContext(runtimeContext, workspaceDir, settingsDir, settingsPath, payload);
|
|
29772
|
-
await runInitDownloadsConcurrently(initContext, options, pullSelections, agentName);
|
|
29794
|
+
await runInitDownloadsConcurrently(initContext, options, pullSelections, agentName, hasCredentials);
|
|
29773
29795
|
}
|
|
29774
29796
|
|
|
29775
29797
|
|
|
@@ -51281,8 +51303,8 @@ async function readCliPackageMeta() {
|
|
|
51281
51303
|
? "@share-crm/sharedev-cli".trim()
|
|
51282
51304
|
: '@share-crm/sharedev-cli';
|
|
51283
51305
|
const debugEnabled = true && Boolean(false);
|
|
51284
|
-
const rawVersion = ( true && "0.0.4-rc.50-test.
|
|
51285
|
-
? "0.0.4-rc.50-test.
|
|
51306
|
+
const rawVersion = ( true && "0.0.4-rc.50-test.3".trim())
|
|
51307
|
+
? "0.0.4-rc.50-test.3".trim()
|
|
51286
51308
|
: '0.0.0';
|
|
51287
51309
|
const version = rawVersion + (debugEnabled ? '-debug' : '');
|
|
51288
51310
|
return { name, version };
|