@smartspace/api-client 0.1.0-pr.1415.da24eae → 0.1.0-pr.1418.9ae73b3
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/chat/api.msw.js +11 -11
- package/dist/generated/chat/models/errorCode.d.ts +179 -0
- package/dist/generated/chat/models/errorCode.js +183 -0
- package/dist/generated/chat/models/index.d.ts +2 -0
- package/dist/generated/chat/models/index.js +2 -0
- package/dist/generated/chat/models/messagesMessageError.d.ts +3 -1
- package/dist/generated/chat/models/messagesMessageErrorErrorCode.d.ts +11 -0
- package/dist/generated/chat/models/messagesMessageErrorErrorCode.js +2 -0
- package/dist/generated/chat/models/microsoftAspNetCoreMvcProblemDetails.d.ts +2 -1
- package/dist/generated/chat/models/microsoftAspNetCoreMvcProblemDetails.js +0 -6
- package/dist/generated/chat/zod.js +22 -22
- package/dist/generated/config/api.msw.js +6 -6
- package/dist/generated/config/models/errorCode.d.ts +179 -0
- package/dist/generated/config/models/errorCode.js +183 -0
- package/dist/generated/config/models/index.d.ts +2 -0
- package/dist/generated/config/models/index.js +2 -0
- package/dist/generated/config/models/messagesMessageError.d.ts +3 -1
- package/dist/generated/config/models/messagesMessageErrorErrorCode.d.ts +11 -0
- package/dist/generated/config/models/messagesMessageErrorErrorCode.js +2 -0
- package/dist/generated/config/models/microsoftAspNetCoreMvcProblemDetails.d.ts +2 -1
- package/dist/generated/config/models/microsoftAspNetCoreMvcProblemDetails.js +0 -6
- package/dist/generated/config/zod.js +12 -12
- package/dist/generated/error-codes.d.ts +24 -0
- package/dist/generated/error-codes.js +161 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +8 -1
- package/dist/problem.d.ts +26 -6
- package/dist/problem.js +22 -11
- package/dist/type-checks.d.ts +1 -0
- package/dist/type-checks.js +5 -0
- package/package.json +3 -3
|
@@ -214,6 +214,7 @@ __exportStar(require("./enumsPermissions"), exports);
|
|
|
214
214
|
__exportStar(require("./enumsPinType"), exports);
|
|
215
215
|
__exportStar(require("./enumsPortType"), exports);
|
|
216
216
|
__exportStar(require("./enumsVirtualMachineServerType"), exports);
|
|
217
|
+
__exportStar(require("./errorCode"), exports);
|
|
217
218
|
__exportStar(require("./filesAddMessageFileFromBlobUri"), exports);
|
|
218
219
|
__exportStar(require("./filesCreateFileFromBlobUri"), exports);
|
|
219
220
|
__exportStar(require("./filesDownloadFileParams"), exports);
|
|
@@ -320,6 +321,7 @@ __exportStar(require("./messagesMessageCreatorProfileImage"), exports);
|
|
|
320
321
|
__exportStar(require("./messagesMessageDelta"), exports);
|
|
321
322
|
__exportStar(require("./messagesMessageError"), exports);
|
|
322
323
|
__exportStar(require("./messagesMessageErrorData"), exports);
|
|
324
|
+
__exportStar(require("./messagesMessageErrorErrorCode"), exports);
|
|
323
325
|
__exportStar(require("./messagesMessageValue"), exports);
|
|
324
326
|
__exportStar(require("./messagesMessageValueChannels"), exports);
|
|
325
327
|
__exportStar(require("./messagesMessageValueValue"), exports);
|
|
@@ -5,14 +5,16 @@
|
|
|
5
5
|
* OpenAPI spec version: v1
|
|
6
6
|
*/
|
|
7
7
|
import type { MessagesMessageErrorData } from './messagesMessageErrorData';
|
|
8
|
+
import type { MessagesMessageErrorErrorCode } from './messagesMessageErrorErrorCode';
|
|
8
9
|
export interface MessagesMessageError {
|
|
9
10
|
/** @nullable */
|
|
10
11
|
blockId?: string | null;
|
|
12
|
+
/** HTTP status of the failure. For a failure the AI API reported, this can be the AI API's own status rather than the one in ErrorCode's x-error-code-info. */
|
|
11
13
|
code: number;
|
|
12
14
|
/** @nullable */
|
|
13
15
|
data?: MessagesMessageErrorData;
|
|
14
16
|
/** @nullable */
|
|
15
|
-
errorCode?:
|
|
17
|
+
errorCode?: MessagesMessageErrorErrorCode;
|
|
16
18
|
/** @nullable */
|
|
17
19
|
message?: string | null;
|
|
18
20
|
/** @nullable */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated by orval v7.13.2 🍺
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
* SmartSpace Admin API
|
|
5
|
+
* OpenAPI spec version: v1
|
|
6
|
+
*/
|
|
7
|
+
import type { ErrorCode } from './errorCode';
|
|
8
|
+
/**
|
|
9
|
+
* @nullable
|
|
10
|
+
*/
|
|
11
|
+
export type MessagesMessageErrorErrorCode = ErrorCode | null;
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* SmartSpace Admin API
|
|
5
5
|
* OpenAPI spec version: v1
|
|
6
6
|
*/
|
|
7
|
+
import type { ErrorCode } from './errorCode';
|
|
7
8
|
export interface MicrosoftAspNetCoreMvcProblemDetails {
|
|
8
9
|
/** Machine-readable error code, e.g. thread.already_running. Key on this, not on title or detail. */
|
|
9
|
-
code:
|
|
10
|
+
code: ErrorCode;
|
|
10
11
|
/** @nullable */
|
|
11
12
|
detail?: string | null;
|
|
12
13
|
/** @nullable */
|
|
@@ -5057,9 +5057,9 @@ exports.sandBoxGetThreadMessagesResponseItem = zod_1.default.object({
|
|
|
5057
5057
|
"createdByUserId": zod_1.default.string(),
|
|
5058
5058
|
"errors": zod_1.default.array(zod_1.default.object({
|
|
5059
5059
|
"blockId": zod_1.default.string().nullish(),
|
|
5060
|
-
"code": zod_1.default.number(),
|
|
5060
|
+
"code": zod_1.default.number().describe('HTTP status of the failure. For a failure the AI API reported, this can be the AI API\'s own status rather than the one in ErrorCode\'s x-error-code-info.'),
|
|
5061
5061
|
"data": zod_1.default.any().nullish(),
|
|
5062
|
-
"errorCode": zod_1.default.string().nullish(),
|
|
5062
|
+
"errorCode": zod_1.default.string().describe('A machine-readable error code. The set can grow, so treat an unknown code by the response\'s status.').nullish(),
|
|
5063
5063
|
"message": zod_1.default.string().nullish(),
|
|
5064
5064
|
"traceId": zod_1.default.string().nullish()
|
|
5065
5065
|
})),
|
|
@@ -5107,9 +5107,9 @@ exports.sandBoxThreadMessagesResponse = zod_1.default.object({
|
|
|
5107
5107
|
"createdByUserId": zod_1.default.string(),
|
|
5108
5108
|
"errors": zod_1.default.array(zod_1.default.object({
|
|
5109
5109
|
"blockId": zod_1.default.string().nullish(),
|
|
5110
|
-
"code": zod_1.default.number(),
|
|
5110
|
+
"code": zod_1.default.number().describe('HTTP status of the failure. For a failure the AI API reported, this can be the AI API\'s own status rather than the one in ErrorCode\'s x-error-code-info.'),
|
|
5111
5111
|
"data": zod_1.default.any().nullish(),
|
|
5112
|
-
"errorCode": zod_1.default.string().nullish(),
|
|
5112
|
+
"errorCode": zod_1.default.string().describe('A machine-readable error code. The set can grow, so treat an unknown code by the response\'s status.').nullish(),
|
|
5113
5113
|
"message": zod_1.default.string().nullish(),
|
|
5114
5114
|
"traceId": zod_1.default.string().nullish()
|
|
5115
5115
|
})),
|
|
@@ -5155,9 +5155,9 @@ exports.sandBoxStreamSandboxMessagesResponse = zod_1.default.object({
|
|
|
5155
5155
|
"delta": zod_1.default.object({
|
|
5156
5156
|
"errors": zod_1.default.array(zod_1.default.object({
|
|
5157
5157
|
"blockId": zod_1.default.string().nullish(),
|
|
5158
|
-
"code": zod_1.default.number(),
|
|
5158
|
+
"code": zod_1.default.number().describe('HTTP status of the failure. For a failure the AI API reported, this can be the AI API\'s own status rather than the one in ErrorCode\'s x-error-code-info.'),
|
|
5159
5159
|
"data": zod_1.default.any().nullish(),
|
|
5160
|
-
"errorCode": zod_1.default.string().nullish(),
|
|
5160
|
+
"errorCode": zod_1.default.string().describe('A machine-readable error code. The set can grow, so treat an unknown code by the response\'s status.').nullish(),
|
|
5161
5161
|
"message": zod_1.default.string().nullish(),
|
|
5162
5162
|
"traceId": zod_1.default.string().nullish()
|
|
5163
5163
|
})),
|
|
@@ -5179,9 +5179,9 @@ exports.sandBoxStreamSandboxMessagesResponse = zod_1.default.object({
|
|
|
5179
5179
|
"createdByUserId": zod_1.default.string(),
|
|
5180
5180
|
"errors": zod_1.default.array(zod_1.default.object({
|
|
5181
5181
|
"blockId": zod_1.default.string().nullish(),
|
|
5182
|
-
"code": zod_1.default.number(),
|
|
5182
|
+
"code": zod_1.default.number().describe('HTTP status of the failure. For a failure the AI API reported, this can be the AI API\'s own status rather than the one in ErrorCode\'s x-error-code-info.'),
|
|
5183
5183
|
"data": zod_1.default.any().nullish(),
|
|
5184
|
-
"errorCode": zod_1.default.string().nullish(),
|
|
5184
|
+
"errorCode": zod_1.default.string().describe('A machine-readable error code. The set can grow, so treat an unknown code by the response\'s status.').nullish(),
|
|
5185
5185
|
"message": zod_1.default.string().nullish(),
|
|
5186
5186
|
"traceId": zod_1.default.string().nullish()
|
|
5187
5187
|
})),
|
|
@@ -5206,9 +5206,9 @@ exports.sandBoxStreamSandboxMessagesResponse = zod_1.default.object({
|
|
|
5206
5206
|
"createdByUserId": zod_1.default.string(),
|
|
5207
5207
|
"errors": zod_1.default.array(zod_1.default.object({
|
|
5208
5208
|
"blockId": zod_1.default.string().nullish(),
|
|
5209
|
-
"code": zod_1.default.number(),
|
|
5209
|
+
"code": zod_1.default.number().describe('HTTP status of the failure. For a failure the AI API reported, this can be the AI API\'s own status rather than the one in ErrorCode\'s x-error-code-info.'),
|
|
5210
5210
|
"data": zod_1.default.any().nullish(),
|
|
5211
|
-
"errorCode": zod_1.default.string().nullish(),
|
|
5211
|
+
"errorCode": zod_1.default.string().describe('A machine-readable error code. The set can grow, so treat an unknown code by the response\'s status.').nullish(),
|
|
5212
5212
|
"message": zod_1.default.string().nullish(),
|
|
5213
5213
|
"traceId": zod_1.default.string().nullish()
|
|
5214
5214
|
})),
|
|
@@ -5270,9 +5270,9 @@ exports.sandBoxAddValueToMessageResponse = zod_1.default.object({
|
|
|
5270
5270
|
"createdByUserId": zod_1.default.string(),
|
|
5271
5271
|
"errors": zod_1.default.array(zod_1.default.object({
|
|
5272
5272
|
"blockId": zod_1.default.string().nullish(),
|
|
5273
|
-
"code": zod_1.default.number(),
|
|
5273
|
+
"code": zod_1.default.number().describe('HTTP status of the failure. For a failure the AI API reported, this can be the AI API\'s own status rather than the one in ErrorCode\'s x-error-code-info.'),
|
|
5274
5274
|
"data": zod_1.default.any().nullish(),
|
|
5275
|
-
"errorCode": zod_1.default.string().nullish(),
|
|
5275
|
+
"errorCode": zod_1.default.string().describe('A machine-readable error code. The set can grow, so treat an unknown code by the response\'s status.').nullish(),
|
|
5276
5276
|
"message": zod_1.default.string().nullish(),
|
|
5277
5277
|
"traceId": zod_1.default.string().nullish()
|
|
5278
5278
|
})),
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generated from the `ErrorCode` schema's `x-error-code-info` by scripts/error-codes.js.
|
|
3
|
+
* Do not edit manually.
|
|
4
|
+
*/
|
|
5
|
+
import type { ErrorCodeKnown } from './chat/models';
|
|
6
|
+
/** The category app-api raises a code in; it decides the status. */
|
|
7
|
+
export type ErrorCodeCategory = 'Conflict' | 'Dependency' | 'Error' | 'NotFound' | 'Security' | 'Validation';
|
|
8
|
+
/**
|
|
9
|
+
* What a code answers with, for planning text before a failure happens. The response a client
|
|
10
|
+
* gets always wins: read its own status and `retryable` when you have them.
|
|
11
|
+
*
|
|
12
|
+
* `retryable` means the same request may succeed if repeated. Sending a chat message again runs
|
|
13
|
+
* its flow again, so offer a Retry for it rather than resending automatically.
|
|
14
|
+
*/
|
|
15
|
+
export interface ErrorCodeInfo {
|
|
16
|
+
readonly category: ErrorCodeCategory;
|
|
17
|
+
/** Absent for a code with no single status, such as one only ever on a failed message. */
|
|
18
|
+
readonly status?: number;
|
|
19
|
+
readonly retryable: boolean;
|
|
20
|
+
}
|
|
21
|
+
/** Per known code. A code with no entry has no single or no published answer; go by the response. */
|
|
22
|
+
export declare const errorCodeInfo: {
|
|
23
|
+
readonly [K in ErrorCodeKnown]?: ErrorCodeInfo;
|
|
24
|
+
};
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.errorCodeInfo = void 0;
|
|
4
|
+
/** Per known code. A code with no entry has no single or no published answer; go by the response. */
|
|
5
|
+
exports.errorCodeInfo = {
|
|
6
|
+
'access.denied': { category: 'Security', status: 403, retryable: false },
|
|
7
|
+
'access.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
8
|
+
'access.platform_admin_required': { category: 'Security', status: 403, retryable: false },
|
|
9
|
+
'agent.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
10
|
+
'ai_api.conflict': { category: 'Conflict', status: 409, retryable: false },
|
|
11
|
+
'ai_api.error': { category: 'Error', status: 500, retryable: false },
|
|
12
|
+
'ai_api.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
13
|
+
'ai_api.stream_broken': { category: 'Dependency', retryable: true },
|
|
14
|
+
'ai_api.unauthorized': { category: 'Dependency', status: 503, retryable: false },
|
|
15
|
+
'ai_api.unavailable': { category: 'Dependency', status: 503, retryable: true },
|
|
16
|
+
'ai_api.validation': { category: 'Validation', status: 400, retryable: false },
|
|
17
|
+
'ai_service.failed': { category: 'Error', status: 500, retryable: false },
|
|
18
|
+
'app_role.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
19
|
+
'auth.invalid_key': { category: 'Dependency', status: 503, retryable: false },
|
|
20
|
+
'auth.no_principal': { category: 'Error', status: 500, retryable: false },
|
|
21
|
+
'block.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
22
|
+
'block.source_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
23
|
+
'block.source_unavailable': { category: 'NotFound', status: 404, retryable: false },
|
|
24
|
+
'block.version_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
25
|
+
'block_set.in_use': { category: 'Conflict', status: 409, retryable: false },
|
|
26
|
+
'block_set.name_taken': { category: 'Conflict', status: 409, retryable: false },
|
|
27
|
+
'block_set.native_block_name': { category: 'Validation', status: 400, retryable: false },
|
|
28
|
+
'block_set.publish_needs_confirmation': { category: 'Conflict', status: 409, retryable: false },
|
|
29
|
+
'block_set.storage_unavailable': { category: 'Dependency', status: 503, retryable: true },
|
|
30
|
+
'chat.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
31
|
+
'chat_message.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
32
|
+
'comment.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
33
|
+
'comment.target_required': { category: 'Validation', status: 400, retryable: false },
|
|
34
|
+
'config_api.error': { category: 'Dependency', status: 503, retryable: false },
|
|
35
|
+
'config_api.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
36
|
+
'config_api.rejected': { category: 'Dependency', status: 503, retryable: false },
|
|
37
|
+
'config_api.unauthorized': { category: 'Dependency', status: 503, retryable: false },
|
|
38
|
+
'config_api.unavailable': { category: 'Dependency', status: 503, retryable: true },
|
|
39
|
+
'config_api.unreachable': { category: 'Dependency', status: 503, retryable: true },
|
|
40
|
+
'conflict': { category: 'Conflict', status: 409, retryable: false },
|
|
41
|
+
'connector.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
42
|
+
'connector.not_attached': { category: 'Security', status: 403, retryable: false },
|
|
43
|
+
'connector.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
44
|
+
'container.multiple_runs': { category: 'Validation', status: 400, retryable: false },
|
|
45
|
+
'container_item.deleted_at_source': { category: 'Conflict', status: 409, retryable: false },
|
|
46
|
+
'container_item.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
47
|
+
'cosmos.throttled': { category: 'Dependency', status: 503, retryable: true },
|
|
48
|
+
'credential.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
49
|
+
'dataset.export_failed': { category: 'Error', status: 500, retryable: false },
|
|
50
|
+
'dataset.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
51
|
+
'dataset.name_taken': { category: 'Conflict', status: 409, retryable: false },
|
|
52
|
+
'dataset.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
53
|
+
'dataset.property_name_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
54
|
+
'dataset.too_many_data_types': { category: 'Validation', status: 400, retryable: false },
|
|
55
|
+
'dataset_item.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
56
|
+
'datasource.admin_required': { category: 'Security', status: 403, retryable: false },
|
|
57
|
+
'datasource.assigned': { category: 'Validation', status: 400, retryable: false },
|
|
58
|
+
'datasource.connection_failed': { category: 'Dependency', status: 503, retryable: true },
|
|
59
|
+
'datasource.connection_rejected': { category: 'Validation', status: 400, retryable: false },
|
|
60
|
+
'datasource.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
61
|
+
'datasource.name_taken': { category: 'Conflict', status: 409, retryable: false },
|
|
62
|
+
'datasource.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
63
|
+
'datasource.not_searchable': { category: 'Validation', status: 400, retryable: false },
|
|
64
|
+
'datasource_container.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
65
|
+
'datasource_type.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
66
|
+
'dataspace.admin_required': { category: 'Security', status: 403, retryable: false },
|
|
67
|
+
'dataspace.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
68
|
+
'dataspace.name_taken': { category: 'Conflict', status: 409, retryable: false },
|
|
69
|
+
'dataspace.name_too_long': { category: 'Validation', status: 400, retryable: false },
|
|
70
|
+
'dataspace.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
71
|
+
'directory.service_principal_not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
72
|
+
'directory.user_not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
73
|
+
'draft.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
74
|
+
'draft.not_publishable': { category: 'Validation', status: 400, retryable: false },
|
|
75
|
+
'draft.row_version_stale': { category: 'Conflict', status: 409, retryable: false },
|
|
76
|
+
'embeddings.model_not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
77
|
+
'favourite.user_required': { category: 'Validation', status: 400, retryable: false },
|
|
78
|
+
'file.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
79
|
+
'file.scope_mismatch': { category: 'Security', status: 403, retryable: false },
|
|
80
|
+
'file.upload_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
81
|
+
'flow.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
82
|
+
'flow.trigger_input_missing': { category: 'Conflict', status: 409, retryable: false },
|
|
83
|
+
'flow_definition.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
84
|
+
'flow_run.already_finished': { category: 'Conflict', status: 409, retryable: false },
|
|
85
|
+
'flow_run.execution_not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
86
|
+
'flow_run.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
87
|
+
'flow_run.value_not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
88
|
+
'flow_variable.not_editable': { category: 'Validation', status: 400, retryable: false },
|
|
89
|
+
'flow_variable.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
90
|
+
'gone': { category: 'Error', status: 500, retryable: false },
|
|
91
|
+
'group.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
92
|
+
'ingest_queue.unavailable': { category: 'Dependency', status: 503, retryable: true },
|
|
93
|
+
'install.config_unavailable': { category: 'Error', status: 500, retryable: false },
|
|
94
|
+
'install.no_version_history': { category: 'NotFound', status: 404, retryable: false },
|
|
95
|
+
'install_parameter.value_required': { category: 'Validation', status: 400, retryable: false },
|
|
96
|
+
'llm.auth_failed': { category: 'Dependency', status: 503, retryable: false },
|
|
97
|
+
'llm.content_policy': { category: 'Validation', status: 400, retryable: false },
|
|
98
|
+
'llm.context_window': { category: 'Validation', status: 400, retryable: false },
|
|
99
|
+
'llm.invalid_request': { category: 'Validation', status: 400, retryable: false },
|
|
100
|
+
'llm.not_found': { category: 'Dependency', status: 503, retryable: false },
|
|
101
|
+
'llm.provider_error': { category: 'Dependency', status: 503, retryable: false },
|
|
102
|
+
'llm.rate_limit': { category: 'Dependency', status: 503, retryable: true },
|
|
103
|
+
'llm.schema_validation': { category: 'Dependency', status: 503, retryable: false },
|
|
104
|
+
'llm.timeout': { category: 'Dependency', status: 503, retryable: true },
|
|
105
|
+
'llm.transient_connection': { category: 'Dependency', status: 503, retryable: true },
|
|
106
|
+
'llm.unsupported_modality': { category: 'Validation', status: 400, retryable: false },
|
|
107
|
+
'llm.unsupported_tools': { category: 'Validation', status: 400, retryable: false },
|
|
108
|
+
'llm.upstream_error': { category: 'Dependency', status: 503, retryable: true },
|
|
109
|
+
'message.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
110
|
+
'method_not_allowed': { category: 'Error', status: 500, retryable: false },
|
|
111
|
+
'model.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
112
|
+
'model.no_deployment': { category: 'Validation', status: 400, retryable: false },
|
|
113
|
+
'model.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
114
|
+
'model_catalog.credentials_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
115
|
+
'model_catalog.unreachable': { category: 'Dependency', status: 503, retryable: true },
|
|
116
|
+
'model_deployment.failed': { category: 'Error', status: 500, retryable: false },
|
|
117
|
+
'model_deployment.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
118
|
+
'model_deployment.misconfigured': { category: 'Validation', status: 400, retryable: false },
|
|
119
|
+
'model_deployment.no_provider': { category: 'Validation', status: 400, retryable: false },
|
|
120
|
+
'model_deployment.no_region': { category: 'Validation', status: 400, retryable: false },
|
|
121
|
+
'model_deployment.no_url': { category: 'Validation', status: 400, retryable: false },
|
|
122
|
+
'model_deployment.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
123
|
+
'model_deployment.script_failed': { category: 'Error', status: 500, retryable: false },
|
|
124
|
+
'model_deployment_provider.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
125
|
+
'model_deployment_provider.not_allowed': { category: 'Validation', status: 400, retryable: false },
|
|
126
|
+
'model_deployment_provider.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
127
|
+
'not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
128
|
+
'notification.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
129
|
+
'plan.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
130
|
+
'report.parameters_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
131
|
+
'restore.already_running': { category: 'Conflict', status: 409, retryable: false },
|
|
132
|
+
'restore.timestamp_not_past': { category: 'Validation', status: 400, retryable: false },
|
|
133
|
+
'restore.unknown_store': { category: 'Validation', status: 400, retryable: false },
|
|
134
|
+
'secret.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
135
|
+
'secret.mode_mismatch': { category: 'Conflict', status: 409, retryable: false },
|
|
136
|
+
'secret.name_taken': { category: 'Conflict', status: 409, retryable: false },
|
|
137
|
+
'secret.no_user': { category: 'Security', status: 403, retryable: false },
|
|
138
|
+
'secret.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
139
|
+
'secret.run_has_no_user': { category: 'Validation', status: 400, retryable: false },
|
|
140
|
+
'secret.run_required': { category: 'Validation', status: 400, retryable: false },
|
|
141
|
+
'secret.user_mismatch': { category: 'Security', status: 403, retryable: false },
|
|
142
|
+
'secret.user_value_not_set': { category: 'NotFound', status: 404, retryable: false },
|
|
143
|
+
'speech.identity_misconfigured': { category: 'Error', status: 500, retryable: false },
|
|
144
|
+
'speech.token_unavailable': { category: 'Dependency', status: 503, retryable: true },
|
|
145
|
+
'sync.container_in_use': { category: 'Conflict', status: 409, retryable: false },
|
|
146
|
+
'thread.already_exists': { category: 'Conflict', status: 409, retryable: false },
|
|
147
|
+
'thread.already_running': { category: 'Conflict', status: 409, retryable: false },
|
|
148
|
+
'thread.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
149
|
+
'thread.user_not_member': { category: 'Validation', status: 400, retryable: false },
|
|
150
|
+
'unavailable': { category: 'Dependency', status: 503, retryable: true },
|
|
151
|
+
'user.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
152
|
+
'validation': { category: 'Validation', status: 400, retryable: false },
|
|
153
|
+
'workspace.admin_required': { category: 'Security', status: 403, retryable: false },
|
|
154
|
+
'workspace.files_dataspace_locked': { category: 'Validation', status: 400, retryable: false },
|
|
155
|
+
'workspace.id_invalid': { category: 'Validation', status: 400, retryable: false },
|
|
156
|
+
'workspace.invalid': { category: 'Validation', status: 400, retryable: false },
|
|
157
|
+
'workspace.name_taken': { category: 'Conflict', status: 409, retryable: false },
|
|
158
|
+
'workspace.no_active_flow': { category: 'Conflict', status: 409, retryable: false },
|
|
159
|
+
'workspace.not_found': { category: 'NotFound', status: 404, retryable: false },
|
|
160
|
+
'workspace_admin.user_lacks_permission': { category: 'Validation', status: 400, retryable: false },
|
|
161
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,7 +6,9 @@ export * as ConfigModels from './generated/config/models';
|
|
|
6
6
|
export * as ConfigZod from './generated/config/zod';
|
|
7
7
|
export * as SignalR from './signalr';
|
|
8
8
|
export { AXIOS_INSTANCE, getChatAxiosInstance, setChatAxiosInstance } from './instance';
|
|
9
|
-
export { isApiProblem, type ApiProblem } from './problem';
|
|
9
|
+
export { isApiProblem, errorCodeInfoFor, type ApiProblem, type ApiProblemError } from './problem';
|
|
10
|
+
export { ErrorCode, isKnownErrorCode, type ErrorCodeKnown } from './generated/chat/models';
|
|
11
|
+
export { errorCodeInfo, type ErrorCodeInfo, type ErrorCodeCategory } from './generated/error-codes';
|
|
10
12
|
export * from './generated/config/change-tags';
|
|
11
13
|
export { OperationTags as ConfigOperationTags } from './generated/config/operation-tags';
|
|
12
14
|
export { OperationTags as ChatOperationTags } from './generated/chat/operation-tags';
|
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
36
36
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.ChatOperationTags = exports.ConfigOperationTags = exports.isApiProblem = exports.setChatAxiosInstance = exports.getChatAxiosInstance = exports.AXIOS_INSTANCE = exports.SignalR = exports.ConfigZod = exports.ConfigModels = exports.ConfigApi = exports.ChatZod = exports.ChatModels = exports.ChatApi = void 0;
|
|
39
|
+
exports.ChatOperationTags = exports.ConfigOperationTags = exports.errorCodeInfo = exports.isKnownErrorCode = exports.ErrorCode = exports.errorCodeInfoFor = exports.isApiProblem = exports.setChatAxiosInstance = exports.getChatAxiosInstance = exports.AXIOS_INSTANCE = exports.SignalR = exports.ConfigZod = exports.ConfigModels = exports.ConfigApi = exports.ChatZod = exports.ChatModels = exports.ChatApi = void 0;
|
|
40
40
|
exports.ChatApi = __importStar(require("./generated/chat/api"));
|
|
41
41
|
exports.ChatModels = __importStar(require("./generated/chat/models"));
|
|
42
42
|
exports.ChatZod = __importStar(require("./generated/chat/zod"));
|
|
@@ -50,6 +50,13 @@ Object.defineProperty(exports, "getChatAxiosInstance", { enumerable: true, get:
|
|
|
50
50
|
Object.defineProperty(exports, "setChatAxiosInstance", { enumerable: true, get: function () { return instance_1.setChatAxiosInstance; } });
|
|
51
51
|
var problem_1 = require("./problem");
|
|
52
52
|
Object.defineProperty(exports, "isApiProblem", { enumerable: true, get: function () { return problem_1.isApiProblem; } });
|
|
53
|
+
Object.defineProperty(exports, "errorCodeInfoFor", { enumerable: true, get: function () { return problem_1.errorCodeInfoFor; } });
|
|
54
|
+
// The same list in both clients (ChatModels.ErrorCode and ConfigModels.ErrorCode); one name for it.
|
|
55
|
+
var models_1 = require("./generated/chat/models");
|
|
56
|
+
Object.defineProperty(exports, "ErrorCode", { enumerable: true, get: function () { return models_1.ErrorCode; } });
|
|
57
|
+
Object.defineProperty(exports, "isKnownErrorCode", { enumerable: true, get: function () { return models_1.isKnownErrorCode; } });
|
|
58
|
+
var error_codes_1 = require("./generated/error-codes");
|
|
59
|
+
Object.defineProperty(exports, "errorCodeInfo", { enumerable: true, get: function () { return error_codes_1.errorCodeInfo; } });
|
|
53
60
|
__exportStar(require("./generated/config/change-tags"), exports);
|
|
54
61
|
var operation_tags_1 = require("./generated/config/operation-tags");
|
|
55
62
|
Object.defineProperty(exports, "ConfigOperationTags", { enumerable: true, get: function () { return operation_tags_1.OperationTags; } });
|
package/dist/problem.d.ts
CHANGED
|
@@ -1,12 +1,32 @@
|
|
|
1
1
|
import { AxiosError, AxiosResponse } from 'axios';
|
|
2
|
-
import type { MicrosoftAspNetCoreMvcProblemDetails } from './generated/chat/models';
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { ErrorCode, MicrosoftAspNetCoreMvcProblemDetails } from './generated/chat/models';
|
|
3
|
+
import { type ErrorCodeInfo } from './generated/error-codes';
|
|
4
|
+
/**
|
|
5
|
+
* The problem+json body every SmartSpace API error response carries. `code` is an `ErrorCode`:
|
|
6
|
+
* the codes the API publishes, autocompleted, or any other string.
|
|
7
|
+
*/
|
|
8
|
+
export type ApiProblem<C extends ErrorCode = ErrorCode> = MicrosoftAspNetCoreMvcProblemDetails & {
|
|
9
|
+
code: C;
|
|
10
|
+
};
|
|
11
|
+
/** A thrown axios error whose response is an API problem body. */
|
|
12
|
+
export type ApiProblemError<C extends ErrorCode = ErrorCode> = AxiosError<ApiProblem<C>> & {
|
|
13
|
+
response: AxiosResponse<ApiProblem<C>>;
|
|
14
|
+
};
|
|
5
15
|
/**
|
|
6
16
|
* Narrows a thrown error to an API error response with a problem+json body, so `code`,
|
|
7
17
|
* `retryable` and `traceId` are typed without a cast. False for network errors, cancellations
|
|
8
18
|
* and error responses that did not come from the API (a gateway's HTML 502, for one).
|
|
19
|
+
*
|
|
20
|
+
* Given a code, or a list of them, it is true only for a problem with one of those codes, and
|
|
21
|
+
* narrows `response.data.code` to it: `isApiProblem(e, 'thread.already_running')`.
|
|
9
22
|
*/
|
|
10
|
-
export declare
|
|
11
|
-
|
|
12
|
-
|
|
23
|
+
export declare function isApiProblem(error: unknown): error is ApiProblemError;
|
|
24
|
+
export declare function isApiProblem<C extends ErrorCode>(error: unknown, code: C | readonly C[]): error is ApiProblemError<C>;
|
|
25
|
+
/**
|
|
26
|
+
* What a code answers with, as the spec publishes it: from a problem body's `code` or a failed
|
|
27
|
+
* message's `errorCode`. Undefined for no code, a code the spec does not list (a newer service
|
|
28
|
+
* can send one), or a listed code with no published answer (it has no single one, or its source
|
|
29
|
+
* does not publish it); go by the response's own status and `retryable` then, as you always
|
|
30
|
+
* should when you have them.
|
|
31
|
+
*/
|
|
32
|
+
export declare const errorCodeInfoFor: (code: ErrorCode | null | undefined) => ErrorCodeInfo | undefined;
|
package/dist/problem.js
CHANGED
|
@@ -3,20 +3,31 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.errorCodeInfoFor = void 0;
|
|
7
|
+
exports.isApiProblem = isApiProblem;
|
|
7
8
|
const axios_1 = __importDefault(require("axios"));
|
|
8
|
-
|
|
9
|
-
|
|
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) => {
|
|
9
|
+
const error_codes_1 = require("./generated/error-codes");
|
|
10
|
+
function isApiProblem(error, code) {
|
|
14
11
|
if (!axios_1.default.isAxiosError(error))
|
|
15
12
|
return false;
|
|
16
13
|
const body = error.response?.data;
|
|
17
14
|
if (!body || typeof body !== 'object')
|
|
18
15
|
return false;
|
|
19
|
-
const { code, retryable, traceId } = body;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
const { code: sent, retryable, traceId } = body;
|
|
17
|
+
if (typeof sent !== 'string' || typeof retryable !== 'boolean' || typeof traceId !== 'string')
|
|
18
|
+
return false;
|
|
19
|
+
if (code === undefined)
|
|
20
|
+
return true;
|
|
21
|
+
return typeof code === 'string' ? sent === code : code.includes(sent);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* What a code answers with, as the spec publishes it: from a problem body's `code` or a failed
|
|
25
|
+
* message's `errorCode`. Undefined for no code, a code the spec does not list (a newer service
|
|
26
|
+
* can send one), or a listed code with no published answer (it has no single one, or its source
|
|
27
|
+
* does not publish it); go by the response's own status and `retryable` then, as you always
|
|
28
|
+
* should when you have them.
|
|
29
|
+
*/
|
|
30
|
+
const errorCodeInfoFor = (code) => code != null && Object.prototype.hasOwnProperty.call(error_codes_1.errorCodeInfo, code)
|
|
31
|
+
? error_codes_1.errorCodeInfo[code]
|
|
32
|
+
: undefined;
|
|
33
|
+
exports.errorCodeInfoFor = errorCodeInfoFor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const problem_1 = require("./problem");
|
|
4
|
+
// Given a code, isApiProblem narrows the body's code to it.
|
|
5
|
+
const _narrows = (error) => (0, problem_1.isApiProblem)(error, 'thread.already_running') ? error.response.data.code : undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@smartspace/api-client",
|
|
3
|
-
"version": "0.1.0-pr.
|
|
3
|
+
"version": "0.1.0-pr.1418.9ae73b3",
|
|
4
4
|
"description": "Generated TypeScript client for SmartSpace APIs",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"scripts": {
|
|
21
21
|
"generate": "npm run generate:rest && npm run generate:signalr",
|
|
22
|
-
"generate:rest": "node ./scripts/sse-frames-zod-input.js && orval --config orval.config.ts && node ./scripts/request-options.js && node ./scripts/extensible-enums.js && node ./scripts/change-tags.js && node ./scripts/operation-tags.js",
|
|
22
|
+
"generate:rest": "node ./scripts/sse-frames-zod-input.js && orval --config orval.config.ts && node ./scripts/request-options.js && node ./scripts/extensible-enums.js && node ./scripts/error-codes.js && node ./scripts/change-tags.js && node ./scripts/operation-tags.js",
|
|
23
23
|
"generate:signalr": "dotnet tsrts --project ../../SmartSpace.App.Business/SmartSpace.App.Business.csproj --output src/generated/signalr --asm --enum Name",
|
|
24
24
|
"build": "tsc",
|
|
25
25
|
"prepublishOnly": "npm run generate && npm run build"
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"url": "https://github.com/Smartspace-ai/Smartspace-app-api.git",
|
|
54
54
|
"directory": "tools/sdk-package"
|
|
55
55
|
},
|
|
56
|
-
"smartspaceContentHash": "
|
|
56
|
+
"smartspaceContentHash": "1e6bf4b6d03d248d0840113132c683a88f638458200ef5b20c8b9f5d5e8346cc"
|
|
57
57
|
}
|