@goplus123/core-api 1.1.6 → 1.1.8

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.js CHANGED
@@ -2182,7 +2182,26 @@ var UnifiedApiClient = class {
2182
2182
  serviceTypeName: service.typeName,
2183
2183
  methodName
2184
2184
  });
2185
- if (!adapter) return res;
2185
+ if (!adapter) {
2186
+ if (this.isGrpcBaseResponse(res) && !this.isGrpcOk(res)) {
2187
+ throw new GrpcBizError({
2188
+ endpointId: endpoint.id,
2189
+ serviceTypeName: service.typeName,
2190
+ methodName,
2191
+ code: this.normalizeNumber(
2192
+ this.pickField(res, ["code", "errCode", "errorCode", "resultCode"])
2193
+ ),
2194
+ status: this.normalizeNumber(
2195
+ this.pickField(res, ["status", "statusCode", "httpStatus", "http_code"])
2196
+ ),
2197
+ message: this.normalizeString(
2198
+ this.pickField(res, ["message", "msg", "error", "errMsg", "errmsg", "errorMessage"])
2199
+ ) ?? "Request failed",
2200
+ raw: res
2201
+ });
2202
+ }
2203
+ return res;
2204
+ }
2186
2205
  if (!this.isGrpcOkWithAdapter(res, adapter)) {
2187
2206
  throw new GrpcBizError({
2188
2207
  endpointId: endpoint.id,
@@ -2231,6 +2250,12 @@ var UnifiedApiClient = class {
2231
2250
  }
2232
2251
  return void 0;
2233
2252
  }
2253
+ isGrpcBaseResponse(value) {
2254
+ if (!value || typeof value !== "object") return false;
2255
+ const typeName = value.$typeName;
2256
+ if (typeof typeName !== "string" || typeName.length === 0) return false;
2257
+ return /(^|\.)BaseResponse$/.test(typeName);
2258
+ }
2234
2259
  normalizeNumber(value) {
2235
2260
  if (typeof value === "number" && Number.isFinite(value)) return value;
2236
2261
  if (typeof value === "string") {
@@ -2661,7 +2686,7 @@ function buildEndpointRegistry(apiMap) {
2661
2686
  async function ensureEndpointRegistry() {
2662
2687
  if (endpointRegistryReady) return;
2663
2688
  if (endpointRegistryBuildPromise) return endpointRegistryBuildPromise;
2664
- endpointRegistryBuildPromise = import("./spec-KZB5WSAG.js").then((mod) => buildEndpointRegistry(mod.apiMap)).catch((err) => {
2689
+ endpointRegistryBuildPromise = import("./spec-LWSTA33O.js").then((mod) => buildEndpointRegistry(mod.apiMap)).catch((err) => {
2665
2690
  endpointRegistryReady = false;
2666
2691
  throw err;
2667
2692
  }).finally(() => {
@@ -3311,7 +3336,7 @@ function initSDK(config) {
3311
3336
  setGrpcAdapterClient(sdk.client);
3312
3337
  setUnifiedClient(sdk.client);
3313
3338
  if (config.grpc?.baseUrl) {
3314
- const legacyPromise = import("./legacy-L42EYXU6.js").then((m) => m.createLegacyServices(api.grpc));
3339
+ const legacyPromise = import("./legacy-6NUFSLQG.js").then((m) => m.createLegacyServices(api.grpc));
3315
3340
  const loadLegacy = () => legacyPromise;
3316
3341
  sdk.auth = createLazyObject(
3317
3342
  () => loadLegacy().then((m) => m.auth)