@lovrabet/sdk 1.4.3 → 1.5.1-beta.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 CHANGED
@@ -551,11 +551,31 @@ interface ClientConfig {
551
551
  secretKey?: string; // 密钥(可选)
552
552
  token?: string; // 预生成 token(浏览器)
553
553
  timestamp?: number; // token 时间戳
554
- env?: "online" | "daily"; // 环境
554
+ env?: "production" | "online" | "daily" | "development"; // 环境
555
+ region?: "cn" | "id"; // 官方节点,默认 cn
556
+ runtimeDomain?: string; // 企业独立部署覆盖,优先于 region
555
557
  models?: ModelsConfig; // 模型配置
556
558
  }
557
559
  ```
558
560
 
561
+ 官方印尼节点:
562
+
563
+ ```typescript
564
+ const client = createClient({
565
+ appCode: "app-xxx",
566
+ region: "id",
567
+ env: "production"
568
+ });
569
+ ```
570
+
571
+ 企业独立部署直接传入 `runtimeDomain`。解析优先级为:`runtimeDomain` →
572
+ 兼容字段 `serverUrl` → 页面注入的 `RUNTIME_API_DOMAIN` → `region + env`
573
+ → 默认 CN Production。
574
+
575
+ SDK 会对显式 Runtime 地址去除首尾空白和尾斜杠,并拒绝非法 URL、凭证、
576
+ query 或 fragment。未传 `region` 时默认 `cn`;显式传入 `cn` / `id` 以外的值
577
+ 会抛出 `INVALID_REGION`,不会静默请求其他区域。
578
+
559
579
  ### CRUD 操作
560
580
 
561
581
  ```typescript
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { createClient } from "./src/client/index";
2
2
  export { registerModels, getRegisteredModels, getRegisteredConfigNames, unregisterModels, clearAllRegistrations, } from "./src/config/model-registry";
3
- export { getApiEndpoint, getAvailableEnvironments, } from "./src/config/endpoints";
4
- export { CONFIG_NAMES, ENVIRONMENTS, DEFAULTS, HTTP_STATUS, ERROR_MESSAGES, API_PATHS, } from "./src/config/constants";
3
+ export { getApiEndpoint, getAvailableEnvironments, getAvailableRegions, } from "./src/config/endpoints";
4
+ export { CONFIG_NAMES, ENVIRONMENTS, REGIONS, DEFAULTS, HTTP_STATUS, ERROR_MESSAGES, API_PATHS, } from "./src/config/constants";
5
5
  export { LovrabetError } from "./src/utils/errors";
6
6
  export { safe } from "./src/utils/safe";
7
7
  export type { SafeResult } from "./src/utils/safe";
@@ -13,7 +13,7 @@ export { ServicesNamespace, FileClient, OcrClient, OcrType, OCR_TYPES, } from ".
13
13
  export type { LovrabetServices, FileQueryUrlRequest, FileService, FileUploadRequest, FileUploadResponse, FileUrlResponse, OcrRecognizeRequest, OcrRecognizeResponse, OcrService, ServiceRequestOptions, } from "./src/services/index";
14
14
  export { AuthManager, } from "./src/auth/index";
15
15
  export { generateOpenApiToken, TokenGenerator, isTokenExpiring, getTokenRemainingTime, type GenerateTokenParams, type TokenResult } from "./src/auth/index";
16
- export type { ClientConfig, LovrabetClient, ModelConfig, ModelsConfig, AuthMode, } from "./src/types/index";
16
+ export type { ClientConfig, LovrabetClient, ModelConfig, ModelsConfig, AuthMode, Region, } from "./src/types/index";
17
17
  export type { ListParams, ListResponse, FilterParams, WhereCondition, FieldCondition, ConditionOperator, Environment, BaseModelMethods, SortList, SelectOption, SelectOptionsParams, AggregateParams, AggregateField, HavingCondition, } from "./src/types/index";
18
18
  export type { SqlExecuteRequest, SqlExecuteResult, } from "./src/api/types";
19
19
  export { SortOrder, } from "./src/types/index";