@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/{chunk-XID56HIJ.cjs → chunk-23EAHSO4.cjs} +37 -20
- package/dist/chunk-23EAHSO4.cjs.map +1 -0
- package/dist/{chunk-4OY73C3O.js → chunk-MYVBRDE4.js} +438 -421
- package/dist/chunk-MYVBRDE4.js.map +1 -0
- package/dist/index.cjs +28 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9617 -8921
- package/dist/index.d.ts +9617 -8921
- package/dist/index.js +28 -3
- package/dist/index.js.map +1 -1
- package/dist/{legacy-L42EYXU6.js → legacy-6NUFSLQG.js} +4 -3
- package/dist/legacy-6NUFSLQG.js.map +1 -0
- package/dist/{legacy-CO3UUF6P.cjs → legacy-LOUPMLZX.cjs} +189 -188
- package/dist/legacy-LOUPMLZX.cjs.map +1 -0
- package/dist/{spec-KZB5WSAG.js → spec-LWSTA33O.js} +51 -67
- package/dist/spec-LWSTA33O.js.map +1 -0
- package/dist/{spec-HWWEQVB6.cjs → spec-WKJMH322.cjs} +368 -384
- package/dist/spec-WKJMH322.cjs.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-4OY73C3O.js.map +0 -1
- package/dist/chunk-XID56HIJ.cjs.map +0 -1
- package/dist/legacy-CO3UUF6P.cjs.map +0 -1
- package/dist/legacy-L42EYXU6.js.map +0 -1
- package/dist/spec-HWWEQVB6.cjs.map +0 -1
- package/dist/spec-KZB5WSAG.js.map +0 -1
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)
|
|
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-
|
|
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-
|
|
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)
|