-
Notifications
You must be signed in to change notification settings - Fork 208
/
RpcConstants.ts
109 lines (99 loc) · 2.84 KB
/
RpcConstants.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
/** @packageDocumentation
* @module RpcInterface
*/
/* eslint-disable deprecation/deprecation */
/** Describes available options for RPC response caching.
* @public
*/
export enum RpcResponseCacheControl {
None,
Immutable,
}
/** RPC protocol event types.
* @public
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
*/
export enum RpcProtocolEvent {
RequestCreated,
ResponseLoaded,
ResponseLoading,
ConnectionErrorReceived,
UnknownErrorReceived,
BackendErrorReceived,
ConnectionAborted,
RequestReceived,
BackendResponseCreated,
BackendReportedPending,
BackendReportedNotFound,
BackendErrorOccurred,
BackendReportedNoContent,
}
/** The status of an RPC operation request.
* @public
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
*/
export enum RpcRequestStatus {
Unknown,
Created,
Submitted,
Pending,
Resolved,
Rejected,
Disposed,
NotFound,
Cancelled,
NoContent,
BadGateway,
ServiceUnavailable,
GatewayTimeout,
RequestTimeout,
TooManyRequests
}
/** @public @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future. */
export namespace RpcRequestStatus { // eslint-disable-line @typescript-eslint/no-redeclare
export function isTransientError(status: RpcRequestStatus) {
return status === RpcRequestStatus.BadGateway || status === RpcRequestStatus.ServiceUnavailable || status === RpcRequestStatus.GatewayTimeout
|| status === RpcRequestStatus.RequestTimeout || status === RpcRequestStatus.TooManyRequests;
}
}
/** RPC request event types.
* @public
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
*/
export enum RpcRequestEvent {
StatusChanged,
PendingUpdateReceived,
TransientErrorReceived
}
/** RPC content types.
* @public
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
*/
export enum RpcContentType {
Unknown,
Text,
Binary,
Multipart,
Stream,
}
/** Endpoints for RPC protocols.
* @public
* @deprecated in 3.6. The RPC system will be significantly refactored (or replaced) in the future.
*/
export enum RpcEndpoint {
Frontend,
Backend,
}
/* eslint-disable @typescript-eslint/naming-convention */
/** @internal */
export const WEB_RPC_CONSTANTS = {
CONTENT: "Content-Type",
TEXT: "text/plain",
ANY_TEXT: "text/",
BINARY: "application/octet-stream",
MULTIPART: "multipart/form-data",
};