@ariacompute/engine-ts 1.20.1 → 1.21.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/dist/index.d.ts +1 -5
- package/dist/index.js +2 -16
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -43,13 +43,9 @@ export declare const INTL_UPGRADE = "https://github.com/ariacompute";
|
|
|
43
43
|
export declare const CN_SITE = "https://ariacompute.cn";
|
|
44
44
|
export declare const CN_UPGRADE = "https://gitee.com/ariacompute";
|
|
45
45
|
export interface SetupConfig {
|
|
46
|
-
/** Local (router registration) */
|
|
47
46
|
router: string;
|
|
47
|
+
/** sk-aria_ or bfvk-; router associates by prefix */
|
|
48
48
|
router_api_key: string;
|
|
49
|
-
/** OAuth (Aria Compute) */
|
|
50
|
-
serve_site: string;
|
|
51
|
-
serve_api_key: string;
|
|
52
|
-
/** Hub / compute */
|
|
53
49
|
site_url: string;
|
|
54
50
|
upgrade_url: string;
|
|
55
51
|
compute: string;
|
package/dist/index.js
CHANGED
|
@@ -67,8 +67,6 @@ function defaultSetupConfig() {
|
|
|
67
67
|
return {
|
|
68
68
|
router: "",
|
|
69
69
|
router_api_key: "",
|
|
70
|
-
serve_site: "",
|
|
71
|
-
serve_api_key: "",
|
|
72
70
|
site_url: "",
|
|
73
71
|
upgrade_url: "",
|
|
74
72
|
compute: "auto",
|
|
@@ -103,20 +101,9 @@ function validateRouterApiKey(key) {
|
|
|
103
101
|
const t = (key || "").trim();
|
|
104
102
|
if (!t)
|
|
105
103
|
return;
|
|
106
|
-
if (t.startsWith("bfvk-"))
|
|
107
|
-
throw new Error("OAuth key detected (bfvk-); use serve_api_key / [2/2] OAuth (Aria Compute)");
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
function validateServeApiKey(key) {
|
|
111
|
-
const t = (key || "").trim();
|
|
112
|
-
if (!t)
|
|
104
|
+
if (t.startsWith("sk-aria_") || t.startsWith("bfvk-"))
|
|
113
105
|
return;
|
|
114
|
-
|
|
115
|
-
throw new Error("Local router key detected (sk-aria_); use router_api_key / [1/2] Local");
|
|
116
|
-
}
|
|
117
|
-
if (!t.startsWith("bfvk-")) {
|
|
118
|
-
throw new Error("serve_api_key must start with bfvk-");
|
|
119
|
-
}
|
|
106
|
+
throw new Error("router_api_key must start with sk-aria_ or bfvk-");
|
|
120
107
|
}
|
|
121
108
|
function applySetup(existing, updates) {
|
|
122
109
|
const out = { ...existing };
|
|
@@ -129,7 +116,6 @@ function applySetup(existing, updates) {
|
|
|
129
116
|
throw new Error(`invalid compute: ${out.compute}`);
|
|
130
117
|
}
|
|
131
118
|
validateRouterApiKey(out.router_api_key);
|
|
132
|
-
validateServeApiKey(out.serve_api_key);
|
|
133
119
|
return fillSetupUrls(out);
|
|
134
120
|
}
|
|
135
121
|
const DEFAULT_SDK = "v1.0";
|