@xbongbong/xbbcli 2.1.1 → 2.4.0
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/README.md +97 -6
- package/auth-login.js +306 -0
- package/auth-logout.js +175 -0
- package/auth-status.js +105 -0
- package/bin/xbbcli.js +15 -2
- package/buyer-inquiry-detail.js +2 -14
- package/buyer-inquiry-list.js +2 -14
- package/clue-add-couser.js +2 -14
- package/clue-add.js +2 -14
- package/clue-back.js +2 -14
- package/clue-del.js +2 -14
- package/clue-delete-couser.js +2 -14
- package/clue-delete-mainuser.js +2 -14
- package/clue-detail.js +2 -14
- package/clue-distribution.js +2 -14
- package/clue-edit.js +2 -14
- package/clue-handover.js +3 -15
- package/clue-list.js +2 -14
- package/clue-thorough-delete.js +2 -14
- package/communicate-add.js +2 -14
- package/communicate-del.js +2 -14
- package/communicate-detail.js +2 -14
- package/communicate-edit.js +2 -14
- package/communicate-list.js +2 -14
- package/communicate-plan-add.js +2 -14
- package/communicate-plan-cancel.js +2 -14
- package/communicate-plan-del.js +2 -14
- package/communicate-plan-detail.js +2 -14
- package/communicate-plan-list.js +2 -14
- package/communicate-plan-single-operate.js +2 -14
- package/contact-add-couser.js +2 -14
- package/contact-add-mainuser.js +2 -14
- package/contact-add.js +2 -14
- package/contact-del.js +2 -14
- package/contact-delete-couser.js +2 -14
- package/contact-delete-mainuser.js +2 -14
- package/contact-detail.js +2 -14
- package/contact-edit.js +2 -14
- package/contact-handover.js +2 -14
- package/contact-list.js +2 -14
- package/contract-add-couser.js +2 -14
- package/contract-add-mainuser.js +2 -14
- package/contract-add.js +2 -14
- package/contract-del.js +2 -14
- package/contract-delete-couser.js +2 -14
- package/contract-delete-mainuser.js +2 -14
- package/contract-detail.js +2 -14
- package/contract-edit.js +2 -14
- package/contract-handover.js +2 -14
- package/contract-list.js +2 -14
- package/contract-outstock-add.js +2 -14
- package/contract-outstock-del.js +2 -14
- package/contract-outstock-detail.js +2 -14
- package/contract-outstock-edit.js +2 -14
- package/contract-outstock-list.js +2 -14
- package/customer-add-couser.js +2 -14
- package/customer-add.js +2 -14
- package/customer-back.js +2 -14
- package/customer-del.js +2 -14
- package/customer-delete-couser.js +2 -14
- package/customer-delete-mainuser.js +2 -14
- package/customer-detail.js +2 -14
- package/customer-distribution.js +2 -14
- package/customer-edit.js +2 -14
- package/customer-handover.js +2 -14
- package/customer-invoice-address-add.js +2 -14
- package/customer-invoice-address-edit.js +2 -14
- package/customer-invoice-address.js +2 -14
- package/customer-invoice-info-add.js +2 -14
- package/customer-invoice-info-edit.js +2 -14
- package/customer-invoice-info.js +2 -14
- package/customer-list.js +2 -14
- package/department-add.js +2 -14
- package/department-del.js +2 -14
- package/department-edit.js +2 -14
- package/department-list.js +2 -14
- package/form-data-add-couser.js +2 -14
- package/form-data-add-mainuser.js +2 -14
- package/form-data-add.js +2 -14
- package/form-data-del.js +2 -14
- package/form-data-delete-couser.js +2 -14
- package/form-data-delete-mainuser.js +2 -14
- package/form-data-detail.js +2 -14
- package/form-data-edit.js +2 -14
- package/form-data-handover.js +2 -14
- package/form-data-list.js +2 -14
- package/form-get.js +2 -14
- package/form-list.js +2 -14
- package/{ai-call-add-task.js → hkh-call-add-task.js} +4 -16
- package/{ai-word-list.js → hkh-word-list.js} +4 -16
- package/invoice-add.js +3 -15
- package/invoice-cancel.js +3 -15
- package/invoice-del.js +3 -15
- package/invoice-detail.js +3 -15
- package/invoice-edit.js +3 -15
- package/invoice-get-amount-detail.js +3 -15
- package/invoice-list.js +3 -15
- package/invoice-red.js +3 -15
- package/label-add.js +3 -15
- package/label-all-list.js +3 -15
- package/label-batch-add.js +3 -15
- package/label-batch-remove.js +3 -15
- package/label-del-completely.js +3 -15
- package/label-del.js +3 -15
- package/label-edit.js +3 -15
- package/label-group-add.js +3 -15
- package/label-group-del.js +3 -15
- package/label-group-list.js +3 -15
- package/label-group-update.js +3 -15
- package/label-list.js +3 -15
- package/label-reduction.js +3 -15
- package/label-repeat.js +3 -15
- package/market-activity-add.js +2 -14
- package/market-activity-del.js +2 -14
- package/market-activity-detail.js +2 -14
- package/market-activity-edit.js +2 -14
- package/market-activity-handover.js +2 -14
- package/market-activity-list.js +2 -14
- package/opportunity-add-couser.js +2 -14
- package/opportunity-add-mainuser.js +2 -14
- package/opportunity-add.js +2 -14
- package/opportunity-del.js +2 -14
- package/opportunity-delete-couser.js +2 -14
- package/opportunity-delete-mainuser.js +2 -14
- package/opportunity-detail.js +2 -14
- package/opportunity-edit.js +2 -14
- package/opportunity-handover.js +2 -14
- package/opportunity-list.js +2 -14
- package/package.json +2 -2
- package/pay-plan-add-couser.js +2 -14
- package/pay-plan-add-mainuser.js +2 -14
- package/pay-plan-add.js +2 -14
- package/pay-plan-delete-couser.js +2 -14
- package/pay-plan-delete-mainuser.js +2 -14
- package/pay-plan-handover.js +2 -14
- package/pay-sheet-add-bad.js +2 -14
- package/pay-sheet-add-couser.js +2 -14
- package/pay-sheet-add-mainuser.js +2 -14
- package/pay-sheet-add-red.js +2 -14
- package/pay-sheet-add-write-off.js +2 -14
- package/pay-sheet-del.js +2 -14
- package/pay-sheet-delete-couser.js +2 -14
- package/pay-sheet-delete-mainuser.js +2 -14
- package/pay-sheet-detail.js +2 -14
- package/pay-sheet-edit-bad.js +2 -14
- package/pay-sheet-edit-red.js +2 -14
- package/pay-sheet-edit-write-off.js +2 -14
- package/pay-sheet-get-amount-detail.js +2 -14
- package/pay-sheet-list.js +2 -14
- package/payment-add-couser.js +2 -14
- package/payment-add-mainuser.js +2 -14
- package/payment-add.js +2 -14
- package/payment-del.js +2 -14
- package/payment-delete-couser.js +2 -14
- package/payment-delete-mainuser.js +2 -14
- package/payment-detail.js +2 -14
- package/payment-edit.js +2 -14
- package/payment-handover.js +2 -14
- package/payment-list.js +2 -14
- package/payment-sheet-add-bad-debt.js +2 -14
- package/payment-sheet-add-pre.js +2 -14
- package/payment-sheet-add-red.js +2 -14
- package/payment-sheet-add-write-off.js +2 -14
- package/payment-sheet-del.js +2 -14
- package/payment-sheet-detail.js +2 -14
- package/payment-sheet-edit-bad-debt.js +2 -14
- package/payment-sheet-edit-red.js +2 -14
- package/payment-sheet-edit-write-off.js +2 -14
- package/payment-sheet-get-amount-detail.js +2 -14
- package/payment-sheet-handover.js +2 -14
- package/payment-sheet-list.js +2 -14
- package/product-add.js +2 -14
- package/product-category-add.js +2 -14
- package/product-category-del.js +2 -14
- package/product-category-list.js +2 -14
- package/product-category-update.js +2 -14
- package/product-del.js +2 -14
- package/product-detail.js +2 -14
- package/product-edit.js +2 -14
- package/product-list.js +2 -14
- package/product-online.js +2 -14
- package/quotation-add-couser.js +3 -15
- package/quotation-add-mainuser.js +3 -15
- package/quotation-add.js +3 -15
- package/quotation-del.js +3 -15
- package/quotation-delete-couser.js +3 -15
- package/quotation-delete-mainuser.js +3 -15
- package/quotation-detail.js +3 -15
- package/quotation-edit.js +3 -15
- package/quotation-handover.js +2 -14
- package/quotation-list.js +3 -15
- package/refund-add.js +2 -14
- package/refund-del.js +2 -14
- package/refund-detail.js +2 -14
- package/refund-edit.js +2 -14
- package/refund-list.js +2 -14
- package/role-list.js +2 -14
- package/sign-in-list.js +2 -14
- package/stage-get.js +2 -14
- package/stage-jump.js +2 -14
- package/supplier-add.js +2 -14
- package/token-del.js +5 -0
- package/token-generate.js +2 -14
- package/token-list.js +20 -2
- package/token-set.js +6 -374
- package/token-use.js +5 -0
- package/user-add.js +2 -14
- package/user-del.js +2 -14
- package/user-edit.js +2 -14
- package/user-handover.js +2 -14
- package/user-list.js +2 -14
- package/work-order-add.js +2 -14
- package/work-order-asset-add-couser.js +3 -15
- package/work-order-asset-add-mainuser.js +3 -15
- package/work-order-asset-add.js +3 -15
- package/work-order-asset-del-couser.js +3 -15
- package/work-order-asset-del-mainuser.js +3 -15
- package/work-order-asset-del.js +3 -15
- package/work-order-asset-detail.js +3 -15
- package/work-order-asset-edit.js +3 -15
- package/work-order-asset-handover.js +3 -15
- package/work-order-asset-list.js +3 -15
- package/work-order-del.js +2 -14
- package/work-order-detail.js +2 -14
- package/work-order-dynamic-list.js +2 -14
- package/work-order-edit.js +2 -14
- package/work-order-list.js +2 -14
- package/work-order-operate.js +2 -14
- package/work-order-template-detail.js +2 -14
- package/work-order-template-list.js +2 -14
- package/work-report-daily-add.js +2 -14
- package/work-report-daily-del.js +2 -14
- package/work-report-daily-detail.js +2 -14
- package/work-report-daily-edit.js +2 -14
- package/work-report-daily-get-work-plan.js +2 -14
- package/work-report-daily-list.js +2 -14
- package/work-report-monthly-add.js +2 -14
- package/work-report-monthly-del.js +2 -14
- package/work-report-monthly-detail.js +2 -14
- package/work-report-monthly-edit.js +2 -14
- package/work-report-monthly-list.js +2 -14
- package/work-report-weekly-add.js +2 -14
- package/work-report-weekly-del.js +2 -14
- package/work-report-weekly-detail.js +2 -14
- package/work-report-weekly-edit.js +2 -14
- package/work-report-weekly-list.js +2 -14
- package/work-task-add-couser.js +2 -14
- package/work-task-add.js +2 -14
- package/work-task-delete-couser.js +2 -14
- package/work-task-detail.js +2 -14
- package/work-task-edit.js +2 -14
- package/work-task-handover.js +2 -14
- package/workorder-add-couser.js +2 -14
- package/workorder-delete-couser.js +2 -14
- package/workorder-handover.js +2 -14
- package/workorderlist.js +2 -14
- package/workorderproductlist.js +2 -14
- package/worktimerecorddetail.js +2 -14
- package/worktimerecordlist.js +2 -14
- package/xbb-browser.js +330 -0
- package/xbb-config.js +146 -0
- package/xbb-token-store.js +389 -0
- package/version.js +0 -18
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/hkh/call/addTask';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
|
@@ -60,7 +48,7 @@ function makeErrorRow(code, msg) {
|
|
|
60
48
|
|
|
61
49
|
cli({
|
|
62
50
|
site: 'xbb',
|
|
63
|
-
name: '
|
|
51
|
+
name: 'hkh-call-add-task',
|
|
64
52
|
description: '批量AI呼叫接口(businessType: -1;业务模块: hkh AI呼叫)',
|
|
65
53
|
strategy: Strategy.PUBLIC,
|
|
66
54
|
access: 'write',
|
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/hkh/call/aiWords';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
|
@@ -47,7 +35,7 @@ function makeErrorRow(code, msg) {
|
|
|
47
35
|
|
|
48
36
|
cli({
|
|
49
37
|
site: 'xbb',
|
|
50
|
-
name: '
|
|
38
|
+
name: 'hkh-word-list',
|
|
51
39
|
description: '获取AI话术列表接口(businessType: -1;业务模块: hkh AI呼叫)',
|
|
52
40
|
strategy: Strategy.PUBLIC,
|
|
53
41
|
access: 'read',
|
package/invoice-add.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/add';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/invoice-cancel.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/cancel';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/invoice-del.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/del';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/invoice-detail.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/detail';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/invoice-edit.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/edit';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/getAmountDetail';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/invoice-list.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/list';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/invoice-red.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/invoice/red';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-add.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/add';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-all-list.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/allList';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-batch-add.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/batch/add';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-batch-remove.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/batch/remove';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-del-completely.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/del/completely';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-del.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/del';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-edit.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/edit';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-group-add.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/group/add';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-group-del.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/group/del';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|
package/label-group-list.js
CHANGED
|
@@ -2,7 +2,8 @@ import crypto from 'node:crypto';
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import os from 'node:os';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { cli, Strategy } from './xbb-registry.js';
|
|
5
|
+
import { cli, Strategy } from './xbb-registry.js';
|
|
6
|
+
import { readActiveConfig } from './xbb-config.js';
|
|
6
7
|
|
|
7
8
|
const CONFIG_FILE = path.join(os.homedir(), '.opencli', 'xbb', 'config.env');
|
|
8
9
|
const API_URL = 'https://proapi.xbongbong.com/pro/v2/api/label/group/list';
|
|
@@ -10,20 +11,7 @@ const DEFAULT_BASE_URL = 'https://proapi.xbongbong.com';
|
|
|
10
11
|
const MISSING_TOKEN_MESSAGE = '缺少 token;请先执行 opencli xbb token-set --corpid <CORPID> --token <TOKEN> --userId <USERID>';
|
|
11
12
|
|
|
12
13
|
function readConfig() {
|
|
13
|
-
|
|
14
|
-
const parsed = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
-
const companies = Array.isArray(parsed)
|
|
16
|
-
? parsed
|
|
17
|
-
: Array.isArray(parsed?.companies)
|
|
18
|
-
? parsed.companies
|
|
19
|
-
: null;
|
|
20
|
-
if (companies) {
|
|
21
|
-
return companies.find((item) => item && item.enable) || {};
|
|
22
|
-
}
|
|
23
|
-
return parsed || {};
|
|
24
|
-
} catch {
|
|
25
|
-
return {};
|
|
26
|
-
}
|
|
14
|
+
return readActiveConfig();
|
|
27
15
|
}
|
|
28
16
|
|
|
29
17
|
function getRuntimeConfig() {
|