@smartspace/api-client 0.1.0-pr.1281.731801 → 0.1.0-pr.1281.c381ade
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/generated/config/api.js +2 -2
- package/dist/generated/config/zod.d.ts +2 -2
- package/dist/generated/config/zod.js +2 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -1
- package/dist/problem.d.ts +12 -0
- package/dist/problem.js +22 -0
- package/package.json +1 -1
|
@@ -869,8 +869,8 @@ const getSmartSpaceAdminAPI = () => {
|
|
|
869
869
|
});
|
|
870
870
|
};
|
|
871
871
|
/**
|
|
872
|
-
* @summary Upserts the override value for a parameter.
|
|
873
|
-
boolean key requires a JSON boolean value, etc.
|
|
872
|
+
* @summary Upserts the override value for a parameter. The management API type-checks it against the
|
|
873
|
+
registry (a boolean key requires a JSON boolean value, etc.); this route forwards it unchanged.
|
|
874
874
|
*/
|
|
875
875
|
const installParametersUpsert = (key, coreManagementUpsertInstallParameterModel) => {
|
|
876
876
|
return (0, instance_1.customInstance)({ url: `/v1/InstallParameters/${key}`, method: 'PUT',
|
|
@@ -2653,8 +2653,8 @@ export declare const installParametersGetResponse: zod.ZodObject<{
|
|
|
2653
2653
|
key: zod.ZodString;
|
|
2654
2654
|
}, zod.core.$strip>;
|
|
2655
2655
|
/**
|
|
2656
|
-
* @summary Upserts the override value for a parameter.
|
|
2657
|
-
boolean key requires a JSON boolean value, etc.
|
|
2656
|
+
* @summary Upserts the override value for a parameter. The management API type-checks it against the
|
|
2657
|
+
registry (a boolean key requires a JSON boolean value, etc.); this route forwards it unchanged.
|
|
2658
2658
|
*/
|
|
2659
2659
|
export declare const installParametersUpsertParams: zod.ZodObject<{
|
|
2660
2660
|
key: zod.ZodString;
|
|
@@ -2353,8 +2353,8 @@ exports.installParametersGetResponse = zod_1.default.object({
|
|
|
2353
2353
|
"key": zod_1.default.string()
|
|
2354
2354
|
});
|
|
2355
2355
|
/**
|
|
2356
|
-
* @summary Upserts the override value for a parameter.
|
|
2357
|
-
boolean key requires a JSON boolean value, etc.
|
|
2356
|
+
* @summary Upserts the override value for a parameter. The management API type-checks it against the
|
|
2357
|
+
registry (a boolean key requires a JSON boolean value, etc.); this route forwards it unchanged.
|
|
2358
2358
|
*/
|
|
2359
2359
|
exports.installParametersUpsertParams = zod_1.default.strictObject({
|
|
2360
2360
|
"key": zod_1.default.string()
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.AXIOS_INSTANCE = exports.SignalR = exports.ConfigZod = exports.ConfigModels = exports.ConfigApi = exports.ChatZod = exports.ChatModels = exports.ChatApi = void 0;
|
|
36
|
+
exports.isApiProblem = exports.AXIOS_INSTANCE = exports.SignalR = exports.ConfigZod = exports.ConfigModels = exports.ConfigApi = exports.ChatZod = exports.ChatModels = exports.ChatApi = void 0;
|
|
37
37
|
exports.ChatApi = __importStar(require("./generated/chat/api"));
|
|
38
38
|
exports.ChatModels = __importStar(require("./generated/chat/models"));
|
|
39
39
|
exports.ChatZod = __importStar(require("./generated/chat/zod"));
|
|
@@ -43,3 +43,5 @@ exports.ConfigZod = __importStar(require("./generated/config/zod"));
|
|
|
43
43
|
exports.SignalR = __importStar(require("./signalr"));
|
|
44
44
|
var instance_1 = require("./instance");
|
|
45
45
|
Object.defineProperty(exports, "AXIOS_INSTANCE", { enumerable: true, get: function () { return instance_1.AXIOS_INSTANCE; } });
|
|
46
|
+
var problem_1 = require("./problem");
|
|
47
|
+
Object.defineProperty(exports, "isApiProblem", { enumerable: true, get: function () { return problem_1.isApiProblem; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AxiosError, AxiosResponse } from 'axios';
|
|
2
|
+
import type { MicrosoftAspNetCoreMvcProblemDetails } from './generated/chat/models';
|
|
3
|
+
/** The problem+json body every SmartSpace API error response carries. */
|
|
4
|
+
export type ApiProblem = MicrosoftAspNetCoreMvcProblemDetails;
|
|
5
|
+
/**
|
|
6
|
+
* Narrows a thrown error to an API error response with a problem+json body, so `code`,
|
|
7
|
+
* `retryable` and `traceId` are typed without a cast. False for network errors, cancellations
|
|
8
|
+
* and error responses that did not come from the API (a gateway's HTML 502, for one).
|
|
9
|
+
*/
|
|
10
|
+
export declare const isApiProblem: (error: unknown) => error is AxiosError<ApiProblem> & {
|
|
11
|
+
response: AxiosResponse<ApiProblem>;
|
|
12
|
+
};
|
package/dist/problem.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isApiProblem = void 0;
|
|
7
|
+
const axios_1 = __importDefault(require("axios"));
|
|
8
|
+
/**
|
|
9
|
+
* Narrows a thrown error to an API error response with a problem+json body, so `code`,
|
|
10
|
+
* `retryable` and `traceId` are typed without a cast. False for network errors, cancellations
|
|
11
|
+
* and error responses that did not come from the API (a gateway's HTML 502, for one).
|
|
12
|
+
*/
|
|
13
|
+
const isApiProblem = (error) => {
|
|
14
|
+
if (!axios_1.default.isAxiosError(error))
|
|
15
|
+
return false;
|
|
16
|
+
const body = error.response?.data;
|
|
17
|
+
if (!body || typeof body !== 'object')
|
|
18
|
+
return false;
|
|
19
|
+
const { code, retryable, traceId } = body;
|
|
20
|
+
return typeof code === 'string' && typeof retryable === 'boolean' && typeof traceId === 'string';
|
|
21
|
+
};
|
|
22
|
+
exports.isApiProblem = isApiProblem;
|