@databricks/sdk-core 0.0.0-dev → 0.1.0-dev.1
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/README.md +11 -1
- package/dist/api/execute.d.ts +12 -0
- package/dist/api/execute.d.ts.map +1 -0
- package/dist/api/execute.js +77 -0
- package/dist/api/execute.js.map +1 -0
- package/dist/api/index.d.ts +12 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +8 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/limiter.d.ts +9 -0
- package/dist/api/limiter.d.ts.map +1 -0
- package/dist/api/limiter.js +2 -0
- package/dist/api/limiter.js.map +1 -0
- package/dist/api/options.d.ts +22 -0
- package/dist/api/options.d.ts.map +1 -0
- package/dist/api/options.js +2 -0
- package/dist/api/options.js.map +1 -0
- package/dist/api/retrier.d.ts +58 -0
- package/dist/api/retrier.d.ts.map +1 -0
- package/dist/api/retrier.js +70 -0
- package/dist/api/retrier.js.map +1 -0
- package/dist/apierror/apierror.d.ts +53 -0
- package/dist/apierror/apierror.d.ts.map +1 -0
- package/dist/apierror/apierror.js +217 -0
- package/dist/apierror/apierror.js.map +1 -0
- package/dist/apierror/codes/codes.d.ts +140 -0
- package/dist/apierror/codes/codes.d.ts.map +1 -0
- package/dist/apierror/codes/codes.js +167 -0
- package/dist/apierror/codes/codes.js.map +1 -0
- package/dist/apierror/codes/index.d.ts +7 -0
- package/dist/apierror/codes/index.d.ts.map +1 -0
- package/dist/apierror/codes/index.js +7 -0
- package/dist/apierror/codes/index.js.map +1 -0
- package/dist/apierror/details.d.ts +177 -0
- package/dist/apierror/details.d.ts.map +1 -0
- package/dist/apierror/details.js +250 -0
- package/dist/apierror/details.js.map +1 -0
- package/dist/apierror/index.d.ts +8 -0
- package/dist/apierror/index.d.ts.map +1 -0
- package/dist/apierror/index.js +7 -0
- package/dist/apierror/index.js.map +1 -0
- package/dist/clientinfo/agent.d.ts +56 -0
- package/dist/clientinfo/agent.d.ts.map +1 -0
- package/dist/clientinfo/agent.js +120 -0
- package/dist/clientinfo/agent.js.map +1 -0
- package/dist/clientinfo/base.d.ts +39 -0
- package/dist/clientinfo/base.d.ts.map +1 -0
- package/dist/clientinfo/base.js +61 -0
- package/dist/clientinfo/base.js.map +1 -0
- package/dist/clientinfo/clientinfo.d.ts +61 -0
- package/dist/clientinfo/clientinfo.d.ts.map +1 -0
- package/dist/clientinfo/clientinfo.js +96 -0
- package/dist/clientinfo/clientinfo.js.map +1 -0
- package/dist/clientinfo/default.browser.d.ts +17 -0
- package/dist/clientinfo/default.browser.d.ts.map +1 -0
- package/dist/clientinfo/default.browser.js +20 -0
- package/dist/clientinfo/default.browser.js.map +1 -0
- package/dist/clientinfo/default.d.ts +14 -0
- package/dist/clientinfo/default.d.ts.map +1 -0
- package/dist/clientinfo/default.js +104 -0
- package/dist/clientinfo/default.js.map +1 -0
- package/dist/clientinfo/index.browser.d.ts +5 -0
- package/dist/clientinfo/index.browser.d.ts.map +1 -0
- package/dist/clientinfo/index.browser.js +4 -0
- package/dist/clientinfo/index.browser.js.map +1 -0
- package/dist/clientinfo/index.d.ts +5 -0
- package/dist/clientinfo/index.d.ts.map +1 -0
- package/dist/clientinfo/index.js +4 -0
- package/dist/clientinfo/index.js.map +1 -0
- package/dist/http/http.d.ts +40 -0
- package/dist/http/http.d.ts.map +1 -0
- package/dist/http/http.js +37 -0
- package/dist/http/http.js.map +1 -0
- package/dist/http/index.d.ts +8 -0
- package/dist/http/index.d.ts.map +1 -0
- package/dist/http/index.js +7 -0
- package/dist/http/index.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/logger/index.d.ts +8 -0
- package/dist/logger/index.d.ts.map +1 -0
- package/dist/logger/index.js +7 -0
- package/dist/logger/index.js.map +1 -0
- package/dist/logger/logger.d.ts +49 -0
- package/dist/logger/logger.d.ts.map +1 -0
- package/dist/logger/logger.js +65 -0
- package/dist/logger/logger.js.map +1 -0
- package/dist/profiles/errors.d.ts +17 -0
- package/dist/profiles/errors.d.ts.map +1 -0
- package/dist/profiles/errors.js +19 -0
- package/dist/profiles/errors.js.map +1 -0
- package/dist/profiles/index.browser.d.ts +10 -0
- package/dist/profiles/index.browser.d.ts.map +1 -0
- package/dist/profiles/index.browser.js +8 -0
- package/dist/profiles/index.browser.js.map +1 -0
- package/dist/profiles/index.d.ts +15 -0
- package/dist/profiles/index.d.ts.map +1 -0
- package/dist/profiles/index.js +13 -0
- package/dist/profiles/index.js.map +1 -0
- package/dist/profiles/ini.d.ts +36 -0
- package/dist/profiles/ini.d.ts.map +1 -0
- package/dist/profiles/ini.js +113 -0
- package/dist/profiles/ini.js.map +1 -0
- package/dist/profiles/profile.d.ts +131 -0
- package/dist/profiles/profile.d.ts.map +1 -0
- package/dist/profiles/profile.js +307 -0
- package/dist/profiles/profile.js.map +1 -0
- package/dist/profiles/resolve.d.ts +29 -0
- package/dist/profiles/resolve.d.ts.map +1 -0
- package/dist/profiles/resolve.js +206 -0
- package/dist/profiles/resolve.js.map +1 -0
- package/dist/profiles/secret.d.ts +25 -0
- package/dist/profiles/secret.d.ts.map +1 -0
- package/dist/profiles/secret.js +38 -0
- package/dist/profiles/secret.js.map +1 -0
- package/dist/wkt/fieldmask.d.ts +32 -0
- package/dist/wkt/fieldmask.d.ts.map +1 -0
- package/dist/wkt/fieldmask.js +68 -0
- package/dist/wkt/fieldmask.js.map +1 -0
- package/dist/wkt/index.d.ts +4 -0
- package/dist/wkt/index.d.ts.map +1 -0
- package/dist/wkt/index.js +2 -0
- package/dist/wkt/index.js.map +1 -0
- package/dist/wkt/value.d.ts +13 -0
- package/dist/wkt/value.d.ts.map +1 -0
- package/dist/wkt/value.js +2 -0
- package/dist/wkt/value.js.map +1 -0
- package/package.json +80 -4
- package/src/api/execute.ts +102 -0
- package/src/api/index.ts +12 -0
- package/src/api/limiter.ts +8 -0
- package/src/api/options.ts +22 -0
- package/src/api/retrier.ts +108 -0
- package/src/apierror/apierror.ts +253 -0
- package/src/apierror/codes/codes.ts +189 -0
- package/src/apierror/codes/index.ts +7 -0
- package/src/apierror/details.ts +459 -0
- package/src/apierror/index.ts +24 -0
- package/src/clientinfo/agent.ts +131 -0
- package/src/clientinfo/base.ts +72 -0
- package/src/clientinfo/clientinfo.ts +129 -0
- package/src/clientinfo/default.browser.ts +24 -0
- package/src/clientinfo/default.ts +128 -0
- package/src/clientinfo/index.browser.ts +4 -0
- package/src/clientinfo/index.ts +4 -0
- package/src/http/http.ts +75 -0
- package/src/http/index.ts +8 -0
- package/src/index.ts +5 -0
- package/src/logger/index.ts +8 -0
- package/src/logger/logger.ts +99 -0
- package/src/profiles/errors.ts +28 -0
- package/src/profiles/index.browser.ts +10 -0
- package/src/profiles/index.ts +15 -0
- package/src/profiles/ini.ts +126 -0
- package/src/profiles/profile.ts +467 -0
- package/src/profiles/resolve.ts +251 -0
- package/src/profiles/secret.ts +40 -0
- package/src/wkt/fieldmask.ts +89 -0
- package/src/wkt/index.ts +3 -0
- package/src/wkt/value.ts +19 -0
- package/index.js +0 -1
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines error codes for API errors and their retry semantics.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Code is a numeric code for an error.
|
|
8
|
+
*
|
|
9
|
+
* The numeric values are stable and can be relied upon across SDK versions.
|
|
10
|
+
*/
|
|
11
|
+
declare enum Code {
|
|
12
|
+
/**
|
|
13
|
+
* Unknown indicates an error that cannot be classified.
|
|
14
|
+
*
|
|
15
|
+
* This code might be used for malformed error responses or error responses
|
|
16
|
+
* using an error code that cannot be mapped to a code in this package.
|
|
17
|
+
*/
|
|
18
|
+
UNKNOWN = 0,
|
|
19
|
+
/** OK indicates the operation completed successfully. */
|
|
20
|
+
OK = 1,
|
|
21
|
+
/** Canceled indicates the operation was canceled (typically by the caller). */
|
|
22
|
+
CANCELED = 2,
|
|
23
|
+
/**
|
|
24
|
+
* InvalidArgument indicates the client specified an invalid argument.
|
|
25
|
+
*
|
|
26
|
+
* By contrast with FailedPrecondition, InvalidArgument indicates arguments
|
|
27
|
+
* that are problematic regardless of the state of the system. For example,
|
|
28
|
+
* a malformed request parameter.
|
|
29
|
+
*/
|
|
30
|
+
INVALID_ARGUMENT = 3,
|
|
31
|
+
/**
|
|
32
|
+
* DeadlineExceeded means the operation expired before completion.
|
|
33
|
+
*
|
|
34
|
+
* For operations that modify the state of the system, this error may be
|
|
35
|
+
* returned even if the operation has completed successfully. For
|
|
36
|
+
* example, a successful response from a server could have been delayed
|
|
37
|
+
* long enough for the deadline to expire.
|
|
38
|
+
*/
|
|
39
|
+
DEADLINE_EXCEEDED = 4,
|
|
40
|
+
/**
|
|
41
|
+
* NotFound means a requested entity (e.g. a resource or a file) was
|
|
42
|
+
* not found.
|
|
43
|
+
*/
|
|
44
|
+
NOT_FOUND = 5,
|
|
45
|
+
/**
|
|
46
|
+
* AlreadyExists means an attempt to create an entity failed because one
|
|
47
|
+
* already exists.
|
|
48
|
+
*/
|
|
49
|
+
ALREADY_EXISTS = 6,
|
|
50
|
+
/**
|
|
51
|
+
* PermissionDenied indicates the caller does not have permission to
|
|
52
|
+
* execute the specified operation.
|
|
53
|
+
*
|
|
54
|
+
* This is different from an error returned when the user has exhausted
|
|
55
|
+
* some resource (e.g. too many requests) which is a ResourceExhausted
|
|
56
|
+
* error.
|
|
57
|
+
*/
|
|
58
|
+
PERMISSION_DENIED = 7,
|
|
59
|
+
/**
|
|
60
|
+
* ResourceExhausted indicates some resource has been exhausted, perhaps
|
|
61
|
+
* a per-user quota, or perhaps the entire file system is out of space.
|
|
62
|
+
*/
|
|
63
|
+
RESOURCE_EXHAUSTED = 8,
|
|
64
|
+
/**
|
|
65
|
+
* FailedPrecondition indicates the operation was rejected because the
|
|
66
|
+
* system is not in a state required for the operation's execution.
|
|
67
|
+
* For example, directory to be deleted may be non-empty, an rmdir
|
|
68
|
+
* operation is applied to a non-directory, etc.
|
|
69
|
+
*/
|
|
70
|
+
FAILED_PRECONDITION = 9,
|
|
71
|
+
/**
|
|
72
|
+
* Aborted indicates the operation was aborted, typically due to a
|
|
73
|
+
* concurrency issue like sequencer check failures, transaction aborts,
|
|
74
|
+
* etc.
|
|
75
|
+
*/
|
|
76
|
+
ABORTED = 10,
|
|
77
|
+
/**
|
|
78
|
+
* OutOfRange means the operation was attempted past the valid range.
|
|
79
|
+
* E.g., seeking or reading past end of file.
|
|
80
|
+
*
|
|
81
|
+
* Unlike InvalidArgument, this error indicates a problem that may
|
|
82
|
+
* be fixed if the system state changes. For example, a 32-bit file
|
|
83
|
+
* system will generate InvalidArgument if asked to read at an
|
|
84
|
+
* offset that is not in the range [0,2^32-1], but it will generate
|
|
85
|
+
* OutOfRange if asked to read from an offset past the current
|
|
86
|
+
* file size.
|
|
87
|
+
*
|
|
88
|
+
* There is a fair bit of overlap between FailedPrecondition and
|
|
89
|
+
* OutOfRange. We recommend using OutOfRange (the more specific
|
|
90
|
+
* error) when it applies so that callers who are iterating through
|
|
91
|
+
* a space can easily look for an OutOfRange error to detect when
|
|
92
|
+
* they are done.
|
|
93
|
+
*/
|
|
94
|
+
OUT_OF_RANGE = 11,
|
|
95
|
+
/**
|
|
96
|
+
* Unimplemented indicates the operation is not implemented or not
|
|
97
|
+
* supported/enabled in this service.
|
|
98
|
+
*/
|
|
99
|
+
UNIMPLEMENTED = 12,
|
|
100
|
+
/**
|
|
101
|
+
* Internal indicates an internal error. This means some invariants
|
|
102
|
+
* expected by the underlying system have been broken. If you see
|
|
103
|
+
* this error, something is very broken.
|
|
104
|
+
*/
|
|
105
|
+
INTERNAL = 13,
|
|
106
|
+
/**
|
|
107
|
+
* Unavailable indicates the service is currently unavailable.
|
|
108
|
+
*
|
|
109
|
+
* This is most likely a transient condition and may be corrected by
|
|
110
|
+
* retrying. Though, this might not always be safe to retry if the
|
|
111
|
+
* operation is non-idempotent.
|
|
112
|
+
*
|
|
113
|
+
* The Databricks SDK will generally automatically retry the request
|
|
114
|
+
* with a backoff when encountering this error.
|
|
115
|
+
*/
|
|
116
|
+
UNAVAILABLE = 14,
|
|
117
|
+
/** DataLoss indicates unrecoverable data loss or corruption. */
|
|
118
|
+
DATA_LOSS = 15,
|
|
119
|
+
/**
|
|
120
|
+
* Unauthenticated indicates the request does not have valid
|
|
121
|
+
* authentication credentials for the operation.
|
|
122
|
+
*/
|
|
123
|
+
UNAUTHENTICATED = 16
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Returns the canonical string representation of an error code.
|
|
127
|
+
*
|
|
128
|
+
* If the code is not recognized, "UNKNOWN" is returned. Note that
|
|
129
|
+
* Code.CANCELED maps to "CANCELLED" (British spelling) to match the gRPC
|
|
130
|
+
* convention.
|
|
131
|
+
*/
|
|
132
|
+
declare function codeToString(code: Code): string;
|
|
133
|
+
/**
|
|
134
|
+
* Converts a string representation of an error code to its corresponding
|
|
135
|
+
* Code value. If the string does not match any known code, Code.UNKNOWN is
|
|
136
|
+
* returned.
|
|
137
|
+
*/
|
|
138
|
+
declare function codeFromString(s: string): Code;
|
|
139
|
+
export { Code, codeToString, codeFromString };
|
|
140
|
+
//# sourceMappingURL=codes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codes.d.ts","sourceRoot":"","sources":["../../../src/apierror/codes/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,aAAK,IAAI;IACP;;;;;OAKG;IACH,OAAO,IAAI;IAEX,yDAAyD;IACzD,EAAE,IAAI;IAEN,+EAA+E;IAC/E,QAAQ,IAAI;IAEZ;;;;;;OAMG;IACH,gBAAgB,IAAI;IAEpB;;;;;;;OAOG;IACH,iBAAiB,IAAI;IAErB;;;OAGG;IACH,SAAS,IAAI;IAEb;;;OAGG;IACH,cAAc,IAAI;IAElB;;;;;;;OAOG;IACH,iBAAiB,IAAI;IAErB;;;OAGG;IACH,kBAAkB,IAAI;IAEtB;;;;;OAKG;IACH,mBAAmB,IAAI;IAEvB;;;;OAIG;IACH,OAAO,KAAK;IAEZ;;;;;;;;;;;;;;;;OAgBG;IACH,YAAY,KAAK;IAEjB;;;OAGG;IACH,aAAa,KAAK;IAElB;;;;OAIG;IACH,QAAQ,KAAK;IAEb;;;;;;;;;OASG;IACH,WAAW,KAAK;IAEhB,gEAAgE;IAChE,SAAS,KAAK;IAEd;;;OAGG;IACH,eAAe,KAAK;CACrB;AA4BD;;;;;;GAMG;AACH,iBAAS,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAExC;AAED;;;;GAIG;AACH,iBAAS,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI,CAEvC;AAED,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAC,CAAC"}
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines error codes for API errors and their retry semantics.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Code is a numeric code for an error.
|
|
8
|
+
*
|
|
9
|
+
* The numeric values are stable and can be relied upon across SDK versions.
|
|
10
|
+
*/
|
|
11
|
+
var Code;
|
|
12
|
+
(function (Code) {
|
|
13
|
+
/**
|
|
14
|
+
* Unknown indicates an error that cannot be classified.
|
|
15
|
+
*
|
|
16
|
+
* This code might be used for malformed error responses or error responses
|
|
17
|
+
* using an error code that cannot be mapped to a code in this package.
|
|
18
|
+
*/
|
|
19
|
+
Code[Code["UNKNOWN"] = 0] = "UNKNOWN";
|
|
20
|
+
/** OK indicates the operation completed successfully. */
|
|
21
|
+
Code[Code["OK"] = 1] = "OK";
|
|
22
|
+
/** Canceled indicates the operation was canceled (typically by the caller). */
|
|
23
|
+
Code[Code["CANCELED"] = 2] = "CANCELED";
|
|
24
|
+
/**
|
|
25
|
+
* InvalidArgument indicates the client specified an invalid argument.
|
|
26
|
+
*
|
|
27
|
+
* By contrast with FailedPrecondition, InvalidArgument indicates arguments
|
|
28
|
+
* that are problematic regardless of the state of the system. For example,
|
|
29
|
+
* a malformed request parameter.
|
|
30
|
+
*/
|
|
31
|
+
Code[Code["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT";
|
|
32
|
+
/**
|
|
33
|
+
* DeadlineExceeded means the operation expired before completion.
|
|
34
|
+
*
|
|
35
|
+
* For operations that modify the state of the system, this error may be
|
|
36
|
+
* returned even if the operation has completed successfully. For
|
|
37
|
+
* example, a successful response from a server could have been delayed
|
|
38
|
+
* long enough for the deadline to expire.
|
|
39
|
+
*/
|
|
40
|
+
Code[Code["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED";
|
|
41
|
+
/**
|
|
42
|
+
* NotFound means a requested entity (e.g. a resource or a file) was
|
|
43
|
+
* not found.
|
|
44
|
+
*/
|
|
45
|
+
Code[Code["NOT_FOUND"] = 5] = "NOT_FOUND";
|
|
46
|
+
/**
|
|
47
|
+
* AlreadyExists means an attempt to create an entity failed because one
|
|
48
|
+
* already exists.
|
|
49
|
+
*/
|
|
50
|
+
Code[Code["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS";
|
|
51
|
+
/**
|
|
52
|
+
* PermissionDenied indicates the caller does not have permission to
|
|
53
|
+
* execute the specified operation.
|
|
54
|
+
*
|
|
55
|
+
* This is different from an error returned when the user has exhausted
|
|
56
|
+
* some resource (e.g. too many requests) which is a ResourceExhausted
|
|
57
|
+
* error.
|
|
58
|
+
*/
|
|
59
|
+
Code[Code["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED";
|
|
60
|
+
/**
|
|
61
|
+
* ResourceExhausted indicates some resource has been exhausted, perhaps
|
|
62
|
+
* a per-user quota, or perhaps the entire file system is out of space.
|
|
63
|
+
*/
|
|
64
|
+
Code[Code["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED";
|
|
65
|
+
/**
|
|
66
|
+
* FailedPrecondition indicates the operation was rejected because the
|
|
67
|
+
* system is not in a state required for the operation's execution.
|
|
68
|
+
* For example, directory to be deleted may be non-empty, an rmdir
|
|
69
|
+
* operation is applied to a non-directory, etc.
|
|
70
|
+
*/
|
|
71
|
+
Code[Code["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION";
|
|
72
|
+
/**
|
|
73
|
+
* Aborted indicates the operation was aborted, typically due to a
|
|
74
|
+
* concurrency issue like sequencer check failures, transaction aborts,
|
|
75
|
+
* etc.
|
|
76
|
+
*/
|
|
77
|
+
Code[Code["ABORTED"] = 10] = "ABORTED";
|
|
78
|
+
/**
|
|
79
|
+
* OutOfRange means the operation was attempted past the valid range.
|
|
80
|
+
* E.g., seeking or reading past end of file.
|
|
81
|
+
*
|
|
82
|
+
* Unlike InvalidArgument, this error indicates a problem that may
|
|
83
|
+
* be fixed if the system state changes. For example, a 32-bit file
|
|
84
|
+
* system will generate InvalidArgument if asked to read at an
|
|
85
|
+
* offset that is not in the range [0,2^32-1], but it will generate
|
|
86
|
+
* OutOfRange if asked to read from an offset past the current
|
|
87
|
+
* file size.
|
|
88
|
+
*
|
|
89
|
+
* There is a fair bit of overlap between FailedPrecondition and
|
|
90
|
+
* OutOfRange. We recommend using OutOfRange (the more specific
|
|
91
|
+
* error) when it applies so that callers who are iterating through
|
|
92
|
+
* a space can easily look for an OutOfRange error to detect when
|
|
93
|
+
* they are done.
|
|
94
|
+
*/
|
|
95
|
+
Code[Code["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE";
|
|
96
|
+
/**
|
|
97
|
+
* Unimplemented indicates the operation is not implemented or not
|
|
98
|
+
* supported/enabled in this service.
|
|
99
|
+
*/
|
|
100
|
+
Code[Code["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED";
|
|
101
|
+
/**
|
|
102
|
+
* Internal indicates an internal error. This means some invariants
|
|
103
|
+
* expected by the underlying system have been broken. If you see
|
|
104
|
+
* this error, something is very broken.
|
|
105
|
+
*/
|
|
106
|
+
Code[Code["INTERNAL"] = 13] = "INTERNAL";
|
|
107
|
+
/**
|
|
108
|
+
* Unavailable indicates the service is currently unavailable.
|
|
109
|
+
*
|
|
110
|
+
* This is most likely a transient condition and may be corrected by
|
|
111
|
+
* retrying. Though, this might not always be safe to retry if the
|
|
112
|
+
* operation is non-idempotent.
|
|
113
|
+
*
|
|
114
|
+
* The Databricks SDK will generally automatically retry the request
|
|
115
|
+
* with a backoff when encountering this error.
|
|
116
|
+
*/
|
|
117
|
+
Code[Code["UNAVAILABLE"] = 14] = "UNAVAILABLE";
|
|
118
|
+
/** DataLoss indicates unrecoverable data loss or corruption. */
|
|
119
|
+
Code[Code["DATA_LOSS"] = 15] = "DATA_LOSS";
|
|
120
|
+
/**
|
|
121
|
+
* Unauthenticated indicates the request does not have valid
|
|
122
|
+
* authentication credentials for the operation.
|
|
123
|
+
*/
|
|
124
|
+
Code[Code["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED";
|
|
125
|
+
})(Code || (Code = {}));
|
|
126
|
+
// Maps Code values to their canonical string representation.
|
|
127
|
+
const CODE_TO_STRING = new Map([
|
|
128
|
+
[Code.UNKNOWN, 'UNKNOWN'],
|
|
129
|
+
[Code.OK, 'OK'],
|
|
130
|
+
[Code.CANCELED, 'CANCELLED'],
|
|
131
|
+
[Code.INVALID_ARGUMENT, 'INVALID_ARGUMENT'],
|
|
132
|
+
[Code.DEADLINE_EXCEEDED, 'DEADLINE_EXCEEDED'],
|
|
133
|
+
[Code.NOT_FOUND, 'NOT_FOUND'],
|
|
134
|
+
[Code.ALREADY_EXISTS, 'ALREADY_EXISTS'],
|
|
135
|
+
[Code.PERMISSION_DENIED, 'PERMISSION_DENIED'],
|
|
136
|
+
[Code.RESOURCE_EXHAUSTED, 'RESOURCE_EXHAUSTED'],
|
|
137
|
+
[Code.FAILED_PRECONDITION, 'FAILED_PRECONDITION'],
|
|
138
|
+
[Code.ABORTED, 'ABORTED'],
|
|
139
|
+
[Code.OUT_OF_RANGE, 'OUT_OF_RANGE'],
|
|
140
|
+
[Code.UNIMPLEMENTED, 'UNIMPLEMENTED'],
|
|
141
|
+
[Code.INTERNAL, 'INTERNAL'],
|
|
142
|
+
[Code.UNAVAILABLE, 'UNAVAILABLE'],
|
|
143
|
+
[Code.DATA_LOSS, 'DATA_LOSS'],
|
|
144
|
+
[Code.UNAUTHENTICATED, 'UNAUTHENTICATED'],
|
|
145
|
+
]);
|
|
146
|
+
// Maps canonical strings back to Code values.
|
|
147
|
+
const STRING_TO_CODE = new Map([...CODE_TO_STRING.entries()].map(([code, str]) => [str, code]));
|
|
148
|
+
/**
|
|
149
|
+
* Returns the canonical string representation of an error code.
|
|
150
|
+
*
|
|
151
|
+
* If the code is not recognized, "UNKNOWN" is returned. Note that
|
|
152
|
+
* Code.CANCELED maps to "CANCELLED" (British spelling) to match the gRPC
|
|
153
|
+
* convention.
|
|
154
|
+
*/
|
|
155
|
+
function codeToString(code) {
|
|
156
|
+
return CODE_TO_STRING.get(code) ?? 'UNKNOWN';
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Converts a string representation of an error code to its corresponding
|
|
160
|
+
* Code value. If the string does not match any known code, Code.UNKNOWN is
|
|
161
|
+
* returned.
|
|
162
|
+
*/
|
|
163
|
+
function codeFromString(s) {
|
|
164
|
+
return STRING_TO_CODE.get(s) ?? Code.UNKNOWN;
|
|
165
|
+
}
|
|
166
|
+
export { Code, codeToString, codeFromString };
|
|
167
|
+
//# sourceMappingURL=codes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codes.js","sourceRoot":"","sources":["../../../src/apierror/codes/codes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;GAIG;AACH,IAAK,IAiIJ;AAjID,WAAK,IAAI;IACP;;;;;OAKG;IACH,qCAAW,CAAA;IAEX,yDAAyD;IACzD,2BAAM,CAAA;IAEN,+EAA+E;IAC/E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,cAAc,CAAC;IACnC,CAAC,IAAI,CAAC,aAAa,EAAE,eAAe,CAAC;IACrC,CAAC,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC;IAC3B,CAAC,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC;IACjC,CAAC,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC;IAC7B,CAAC,IAAI,CAAC,eAAe,EAAE,iBAAiB,CAAC;CAC1C,CAAC,CAAC;AAEH,8CAA8C;AAC9C,MAAM,cAAc,GAA8B,IAAI,GAAG,CACvD,CAAC,GAAG,cAAc,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAChE,CAAC;AAEF;;;;;;GAMG;AACH,SAAS,YAAY,CAAC,IAAU;IAC9B,OAAO,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,SAAS,CAAC;AAC/C,CAAC;AAED;;;;GAIG;AACH,SAAS,cAAc,CAAC,CAAS;IAC/B,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,OAAO,CAAC;AAC/C,CAAC;AAED,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/apierror/codes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/apierror/codes/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defines structured error detail types for API errors.
|
|
3
|
+
*
|
|
4
|
+
* @packageDocumentation
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* ErrorDetails contains the error details of an API error. It is the union of
|
|
8
|
+
* known error details types and unknown details.
|
|
9
|
+
*/
|
|
10
|
+
export interface ErrorDetails {
|
|
11
|
+
errorInfo?: ErrorInfo;
|
|
12
|
+
requestInfo?: RequestInfo;
|
|
13
|
+
retryInfo?: RetryInfo;
|
|
14
|
+
debugInfo?: DebugInfo;
|
|
15
|
+
quotaFailure?: QuotaFailure;
|
|
16
|
+
preconditionFailure?: PreconditionFailure;
|
|
17
|
+
badRequest?: BadRequest;
|
|
18
|
+
resourceInfo?: ResourceInfo;
|
|
19
|
+
help?: Help;
|
|
20
|
+
/**
|
|
21
|
+
* UnknownDetails contains error details that cannot be parsed into one of
|
|
22
|
+
* the known types above.
|
|
23
|
+
*/
|
|
24
|
+
unknownDetails: unknown[];
|
|
25
|
+
}
|
|
26
|
+
/** ErrorInfo describes the cause of the error with structured details. */
|
|
27
|
+
export interface ErrorInfo {
|
|
28
|
+
/**
|
|
29
|
+
* The reason of the error. This is a constant value that identifies the
|
|
30
|
+
* proximate cause of the error.
|
|
31
|
+
*/
|
|
32
|
+
reason: string;
|
|
33
|
+
/** The logical grouping to which the "reason" belongs. */
|
|
34
|
+
domain: string;
|
|
35
|
+
/** Additional structured details about this error. */
|
|
36
|
+
metadata: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* RequestInfo contains metadata about the request that clients can attach when
|
|
40
|
+
* filing a bug or providing other forms of feedback.
|
|
41
|
+
*/
|
|
42
|
+
export interface RequestInfo {
|
|
43
|
+
/**
|
|
44
|
+
* An opaque string that should only be interpreted by the service that
|
|
45
|
+
* generated it. For example, it can be used to identify requests in the
|
|
46
|
+
* service's logs.
|
|
47
|
+
*/
|
|
48
|
+
requestId: string;
|
|
49
|
+
/**
|
|
50
|
+
* Any data that was used to serve this request. For example, an encrypted
|
|
51
|
+
* stack trace that can be sent back to the service provider for debugging.
|
|
52
|
+
*/
|
|
53
|
+
servingData: string;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* RetryInfo describes when the clients can retry a failed request. Clients
|
|
57
|
+
* could ignore the recommendation here or retry when this information is
|
|
58
|
+
* missing from error responses.
|
|
59
|
+
*
|
|
60
|
+
* It's always recommended that clients should use exponential backoff when
|
|
61
|
+
* retrying.
|
|
62
|
+
*
|
|
63
|
+
* Clients should wait until `retryDelayMs` amount of time has passed since
|
|
64
|
+
* receiving the error response before retrying. If retrying requests also
|
|
65
|
+
* fail, clients should use an exponential backoff scheme to gradually increase
|
|
66
|
+
* the delay between retries based on `retryDelayMs`, until either a maximum
|
|
67
|
+
* number of retries have been reached or a maximum retry delay cap has been
|
|
68
|
+
* reached.
|
|
69
|
+
*/
|
|
70
|
+
export interface RetryInfo {
|
|
71
|
+
/** Clients should wait at least this long between retrying the same request, in milliseconds. */
|
|
72
|
+
retryDelayMs: number;
|
|
73
|
+
}
|
|
74
|
+
/** Describes additional debugging info. */
|
|
75
|
+
export interface DebugInfo {
|
|
76
|
+
/** The stack trace entries indicating where the error occurred. */
|
|
77
|
+
stackEntries: string[];
|
|
78
|
+
/** Additional debugging information provided by the server. */
|
|
79
|
+
detail: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Describes how a quota check failed.
|
|
83
|
+
*
|
|
84
|
+
* For example if a daily limit was exceeded for the calling project,
|
|
85
|
+
* a service could respond with a QuotaFailure detail containing the project
|
|
86
|
+
* id and the description of the quota limit that was exceeded. If the
|
|
87
|
+
* calling project hasn't enabled the service in the developer console, then
|
|
88
|
+
* a service could respond with the project id and set `service_disabled`
|
|
89
|
+
* to true.
|
|
90
|
+
*
|
|
91
|
+
* Also see RetryInfo and Help types for other details about handling a
|
|
92
|
+
* quota failure.
|
|
93
|
+
*/
|
|
94
|
+
export interface QuotaFailure {
|
|
95
|
+
/** Describes all quota violations. */
|
|
96
|
+
violations: QuotaFailureViolation[];
|
|
97
|
+
}
|
|
98
|
+
export interface QuotaFailureViolation {
|
|
99
|
+
/** The subject on which the quota check failed. */
|
|
100
|
+
subject: string;
|
|
101
|
+
/**
|
|
102
|
+
* A description of how the quota check failed. Clients can use this
|
|
103
|
+
* description to find more about the quota configuration in the service's
|
|
104
|
+
* public documentation, or find the relevant quota limit to adjust through
|
|
105
|
+
* developer console.
|
|
106
|
+
*
|
|
107
|
+
* For example: "Service disabled" or "Daily Limit for read operations
|
|
108
|
+
* exceeded".
|
|
109
|
+
*/
|
|
110
|
+
description: string;
|
|
111
|
+
}
|
|
112
|
+
/** Describes what preconditions have failed. */
|
|
113
|
+
export interface PreconditionFailure {
|
|
114
|
+
/** Describes all precondition violations. */
|
|
115
|
+
violations: PreconditionFailureViolation[];
|
|
116
|
+
}
|
|
117
|
+
export interface PreconditionFailureViolation {
|
|
118
|
+
/** The type of PreconditionFailure. */
|
|
119
|
+
type: string;
|
|
120
|
+
/** The subject, relative to the type, that failed. */
|
|
121
|
+
subject: string;
|
|
122
|
+
/**
|
|
123
|
+
* A description of how the precondition failed. Developers can use this
|
|
124
|
+
* description to understand how to fix the failure.
|
|
125
|
+
*
|
|
126
|
+
* For example: "Terms of service not accepted".
|
|
127
|
+
*/
|
|
128
|
+
description: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Describes violations in a client request. This error type focuses on the
|
|
132
|
+
* syntactic aspects of the request.
|
|
133
|
+
*/
|
|
134
|
+
export interface BadRequest {
|
|
135
|
+
fieldViolations: BadRequestFieldViolation[];
|
|
136
|
+
}
|
|
137
|
+
export interface BadRequestFieldViolation {
|
|
138
|
+
/** A path leading to a field in the request body. */
|
|
139
|
+
field: string;
|
|
140
|
+
/** A description of why the request element is bad. */
|
|
141
|
+
description: string;
|
|
142
|
+
}
|
|
143
|
+
/** Describes the resource that is being accessed. */
|
|
144
|
+
export interface ResourceInfo {
|
|
145
|
+
/** A name for the type of resource being accessed. */
|
|
146
|
+
resourceType: string;
|
|
147
|
+
/** The name of the resource being accessed. */
|
|
148
|
+
resourceName: string;
|
|
149
|
+
/** The owner of the resource (optional). */
|
|
150
|
+
owner: string;
|
|
151
|
+
/** Describes what error is encountered when accessing this resource. */
|
|
152
|
+
description: string;
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Provides links to documentation or for performing an out of band action.
|
|
156
|
+
*
|
|
157
|
+
* For example, if a quota check failed with an error indicating the calling
|
|
158
|
+
* project hasn't enabled the accessed service, this can contain a URL pointing
|
|
159
|
+
* directly to the right place in the developer console to flip the bit.
|
|
160
|
+
*/
|
|
161
|
+
export interface Help {
|
|
162
|
+
/** URL(s) pointing to additional information on handling the current error. */
|
|
163
|
+
links: HelpLink[];
|
|
164
|
+
}
|
|
165
|
+
export interface HelpLink {
|
|
166
|
+
/** Describes what the link offers. */
|
|
167
|
+
description: string;
|
|
168
|
+
/** The URL of the link. */
|
|
169
|
+
url: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Parses an array of raw error detail values into a structured ErrorDetails
|
|
173
|
+
* object. If multiple details of the same known type are present, the last
|
|
174
|
+
* one wins.
|
|
175
|
+
*/
|
|
176
|
+
export declare function parseErrorDetails(rawDetails: unknown[]): ErrorDetails;
|
|
177
|
+
//# sourceMappingURL=details.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../../src/apierror/details.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,YAAY,CAAC,EAAE,YAAY,CAAC;IAC5B,mBAAmB,C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