@nvwa-app/sdk-functions 6.47.0 → 6.49.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.mts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -6
- package/dist/index.mjs +8 -6
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -142,7 +142,11 @@ interface CapabilityExecuteResponse<Data = unknown> {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 在 Edge Function 中调用已开通的 Nvwa capability(经 Server internal HMAC 路由)。
|
|
145
|
-
*
|
|
145
|
+
*
|
|
146
|
+
* 环境变量与 nvwa.json `server` 一致;**优先使用 `NVWA_*`**(Agent Pod 会注入),未设置时可回退:
|
|
147
|
+
* - `NVWA_SERVER_BASE_URL` → `WORKSPACE_BASE_URL`
|
|
148
|
+
* - `NVWA_INTERNAL_SECRET` → `RUNTIME_PROJECT_INTERNAL_KEY`
|
|
149
|
+
* - `NVWA_PROJECT_CODE` → `PROJECT_CODE`
|
|
146
150
|
*/
|
|
147
151
|
declare function executeCapability<Result = unknown>(capabilityName: string, param?: unknown, options?: ExecuteCapabilityOptions): Promise<Result | undefined>;
|
|
148
152
|
|
package/dist/index.d.ts
CHANGED
|
@@ -142,7 +142,11 @@ interface CapabilityExecuteResponse<Data = unknown> {
|
|
|
142
142
|
}
|
|
143
143
|
/**
|
|
144
144
|
* 在 Edge Function 中调用已开通的 Nvwa capability(经 Server internal HMAC 路由)。
|
|
145
|
-
*
|
|
145
|
+
*
|
|
146
|
+
* 环境变量与 nvwa.json `server` 一致;**优先使用 `NVWA_*`**(Agent Pod 会注入),未设置时可回退:
|
|
147
|
+
* - `NVWA_SERVER_BASE_URL` → `WORKSPACE_BASE_URL`
|
|
148
|
+
* - `NVWA_INTERNAL_SECRET` → `RUNTIME_PROJECT_INTERNAL_KEY`
|
|
149
|
+
* - `NVWA_PROJECT_CODE` → `PROJECT_CODE`
|
|
146
150
|
*/
|
|
147
151
|
declare function executeCapability<Result = unknown>(capabilityName: string, param?: unknown, options?: ExecuteCapabilityOptions): Promise<Result | undefined>;
|
|
148
152
|
|
package/dist/index.js
CHANGED
|
@@ -366,27 +366,29 @@ async function hmacSha256Hex(secret, content) {
|
|
|
366
366
|
return bytesToHex(new Uint8Array(signature));
|
|
367
367
|
}
|
|
368
368
|
function resolveServerBaseUrl(explicit) {
|
|
369
|
-
const url = explicit ?? getEnv("NVWA_SERVER_BASE_URL");
|
|
369
|
+
const url = explicit ?? getEnv("NVWA_SERVER_BASE_URL") ?? getEnv("WORKSPACE_BASE_URL");
|
|
370
370
|
if (!url) {
|
|
371
371
|
throw new Error(
|
|
372
|
-
"
|
|
372
|
+
"Workspace server base URL is not set; set NVWA_SERVER_BASE_URL (preferred) or WORKSPACE_BASE_URL \u2014 same as nvwa.json server.baseUrl"
|
|
373
373
|
);
|
|
374
374
|
}
|
|
375
375
|
return url.replace(/\/$/, "");
|
|
376
376
|
}
|
|
377
377
|
function resolveInternalSecret(explicit) {
|
|
378
|
-
const s = explicit ?? getEnv("NVWA_INTERNAL_SECRET");
|
|
378
|
+
const s = explicit ?? getEnv("NVWA_INTERNAL_SECRET") ?? getEnv("RUNTIME_PROJECT_INTERNAL_KEY");
|
|
379
379
|
if (!s) {
|
|
380
380
|
throw new Error(
|
|
381
|
-
"
|
|
381
|
+
"Internal HMAC secret is not set; set NVWA_INTERNAL_SECRET (preferred) or RUNTIME_PROJECT_INTERNAL_KEY \u2014 same as nvwa.json server.internalSecret"
|
|
382
382
|
);
|
|
383
383
|
}
|
|
384
384
|
return s;
|
|
385
385
|
}
|
|
386
386
|
function resolveProjectCode(explicit) {
|
|
387
|
-
const c = explicit ?? getEnv("NVWA_PROJECT_CODE");
|
|
387
|
+
const c = explicit ?? getEnv("NVWA_PROJECT_CODE") ?? getEnv("PROJECT_CODE");
|
|
388
388
|
if (!c) {
|
|
389
|
-
throw new Error(
|
|
389
|
+
throw new Error(
|
|
390
|
+
"Project code is not set; set NVWA_PROJECT_CODE (preferred) or PROJECT_CODE"
|
|
391
|
+
);
|
|
390
392
|
}
|
|
391
393
|
return c;
|
|
392
394
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -317,27 +317,29 @@ async function hmacSha256Hex(secret, content) {
|
|
|
317
317
|
return bytesToHex(new Uint8Array(signature));
|
|
318
318
|
}
|
|
319
319
|
function resolveServerBaseUrl(explicit) {
|
|
320
|
-
const url = explicit ?? getEnv("NVWA_SERVER_BASE_URL");
|
|
320
|
+
const url = explicit ?? getEnv("NVWA_SERVER_BASE_URL") ?? getEnv("WORKSPACE_BASE_URL");
|
|
321
321
|
if (!url) {
|
|
322
322
|
throw new Error(
|
|
323
|
-
"
|
|
323
|
+
"Workspace server base URL is not set; set NVWA_SERVER_BASE_URL (preferred) or WORKSPACE_BASE_URL \u2014 same as nvwa.json server.baseUrl"
|
|
324
324
|
);
|
|
325
325
|
}
|
|
326
326
|
return url.replace(/\/$/, "");
|
|
327
327
|
}
|
|
328
328
|
function resolveInternalSecret(explicit) {
|
|
329
|
-
const s = explicit ?? getEnv("NVWA_INTERNAL_SECRET");
|
|
329
|
+
const s = explicit ?? getEnv("NVWA_INTERNAL_SECRET") ?? getEnv("RUNTIME_PROJECT_INTERNAL_KEY");
|
|
330
330
|
if (!s) {
|
|
331
331
|
throw new Error(
|
|
332
|
-
"
|
|
332
|
+
"Internal HMAC secret is not set; set NVWA_INTERNAL_SECRET (preferred) or RUNTIME_PROJECT_INTERNAL_KEY \u2014 same as nvwa.json server.internalSecret"
|
|
333
333
|
);
|
|
334
334
|
}
|
|
335
335
|
return s;
|
|
336
336
|
}
|
|
337
337
|
function resolveProjectCode(explicit) {
|
|
338
|
-
const c = explicit ?? getEnv("NVWA_PROJECT_CODE");
|
|
338
|
+
const c = explicit ?? getEnv("NVWA_PROJECT_CODE") ?? getEnv("PROJECT_CODE");
|
|
339
339
|
if (!c) {
|
|
340
|
-
throw new Error(
|
|
340
|
+
throw new Error(
|
|
341
|
+
"Project code is not set; set NVWA_PROJECT_CODE (preferred) or PROJECT_CODE"
|
|
342
|
+
);
|
|
341
343
|
}
|
|
342
344
|
return c;
|
|
343
345
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nvwa-app/sdk-functions",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.49.0",
|
|
4
4
|
"description": "NVWA Edge Functions SDK: db, payment gateway, auth, provider list. Use in Deno: import from 'npm:@nvwa-app/sdk-functions'.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"access": "public"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nvwa-app/sdk-shared": "^6.
|
|
27
|
+
"@nvwa-app/sdk-shared": "^6.49.0",
|
|
28
28
|
"drizzle-orm": "^0.44.7",
|
|
29
29
|
"postgres": "^3.4.8"
|
|
30
30
|
},
|