@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,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Collects information about the client and its environment into an
|
|
3
|
+
* immutable {@link ClientInfo} value.
|
|
4
|
+
*
|
|
5
|
+
* {@link ClientInfo.with} derives a new value with additional key/value
|
|
6
|
+
* segments; it never mutates the original.
|
|
7
|
+
*
|
|
8
|
+
* @module
|
|
9
|
+
*/
|
|
10
|
+
export class ClientInfoError extends Error {
|
|
11
|
+
code;
|
|
12
|
+
constructor(code, message) {
|
|
13
|
+
super(message);
|
|
14
|
+
this.name = 'ClientInfoError';
|
|
15
|
+
this.code = code;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const SEMVER_CORE = String.raw `(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)`;
|
|
19
|
+
const SEMVER_PRERELEASE = String.raw `(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?`;
|
|
20
|
+
const SEMVER_BUILDMETADATA = String.raw `(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?`;
|
|
21
|
+
const REGEXP_SEMVER = new RegExp('^' + SEMVER_CORE + SEMVER_PRERELEASE + SEMVER_BUILDMETADATA + '$');
|
|
22
|
+
const REGEXP_VALID_SEGMENT = /^[-0-9A-Za-z_.+]+$/;
|
|
23
|
+
const REGEXP_INVALID_SEGMENT_CHAR = /[^-0-9A-Za-z_.+]/g;
|
|
24
|
+
export function isSemVer(s) {
|
|
25
|
+
return REGEXP_SEMVER.test(s);
|
|
26
|
+
}
|
|
27
|
+
export function isValidSegment(s) {
|
|
28
|
+
return REGEXP_VALID_SEGMENT.test(s);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Replaces characters that are not valid in segment values with
|
|
32
|
+
* hyphens. Used for environment-sourced values (runtime version,
|
|
33
|
+
* upstream) that we do not control and cannot reject.
|
|
34
|
+
*/
|
|
35
|
+
export function sanitize(s) {
|
|
36
|
+
return s.replace(REGEXP_INVALID_SEGMENT_CHAR, '-');
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* ClientInfo is an immutable, ordered list of key/value segments. Use
|
|
40
|
+
* {@link ClientInfo.with} to derive new values with additional segments.
|
|
41
|
+
*/
|
|
42
|
+
export class ClientInfo {
|
|
43
|
+
static EMPTY = new ClientInfo();
|
|
44
|
+
segments;
|
|
45
|
+
constructor(segments = []) {
|
|
46
|
+
this.segments = [...segments];
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Returns a new {@link ClientInfo} with the given items appended. Accepts
|
|
50
|
+
* either individual key/value pairs or another {@link ClientInfo} whose
|
|
51
|
+
* segments are merged in order. The original is not modified; mixing the
|
|
52
|
+
* two forms in a single call is supported.
|
|
53
|
+
*
|
|
54
|
+
* Keys and values on pair arguments must contain only alphanumeric
|
|
55
|
+
* characters plus `_`, `.`, `+`, or `-`. Exact key+value duplicates are
|
|
56
|
+
* silently ignored. On error, an exception is thrown (all-or-nothing).
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* base.with({key: 'partner', value: 'acme'});
|
|
61
|
+
* base.with(pkgClientInfo);
|
|
62
|
+
* base.with(pkgClientInfo, {key: 'sdk-feature', value: 'pagination'});
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
with(...items) {
|
|
66
|
+
if (items.length === 0) {
|
|
67
|
+
return this;
|
|
68
|
+
}
|
|
69
|
+
const newSegments = [...this.segments];
|
|
70
|
+
for (const item of items) {
|
|
71
|
+
const pairs = item instanceof ClientInfo ? item.segments : [item];
|
|
72
|
+
for (const { key, value } of pairs) {
|
|
73
|
+
if (!isValidSegment(key)) {
|
|
74
|
+
throw new ClientInfoError('INVALID_KEY', `Invalid key: ${key}.`);
|
|
75
|
+
}
|
|
76
|
+
if (!isValidSegment(value)) {
|
|
77
|
+
throw new ClientInfoError('INVALID_VALUE', `Invalid value for "${key}": ${value}.`);
|
|
78
|
+
}
|
|
79
|
+
if (newSegments.some(s => s.key === key && s.value === value)) {
|
|
80
|
+
continue;
|
|
81
|
+
}
|
|
82
|
+
newSegments.push({ key, value });
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return new ClientInfo(newSegments);
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Returns a string representation of the client info suitable for
|
|
89
|
+
* inclusion in HTTP headers. Key/value pairs are formatted as
|
|
90
|
+
* "key/value" and joined by spaces in the order they were inserted.
|
|
91
|
+
*/
|
|
92
|
+
toString() {
|
|
93
|
+
return this.segments.map(s => `${s.key}/${s.value}`).join(' ');
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=clientinfo.js.map
|
|
@@ -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AAE,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-compatible {@link createDefault}. Contains no Node.js-specific
|
|
3
|
+
* APIs (no `process.version`, `process.platform`, or `process.env`); only
|
|
4
|
+
* the segments registered via {@link setProduct}, {@link setPartner}, and
|
|
5
|
+
* {@link addToDefault} are returned, plus the core SDK identity.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { ClientInfo } from './clientinfo';
|
|
10
|
+
/**
|
|
11
|
+
* Returns a {@link ClientInfo} populated with SDK metadata and segments
|
|
12
|
+
* registered via {@link addToDefault}. Unlike the Node.js variant, this
|
|
13
|
+
* does not auto-detect runtime, OS, CI/CD, or agent because those signals
|
|
14
|
+
* are not available in a browser.
|
|
15
|
+
*/
|
|
16
|
+
export declare function createDefault(): ClientInfo;
|
|
17
|
+
//# sourceMappingURL=default.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.browser.d.ts","sourceRoot":"","sources":["../../src/clientinfo/default.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AAGxC;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAK1C"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-compatible {@link createDefault}. Contains no Node.js-specific
|
|
3
|
+
* APIs (no `process.version`, `process.platform`, or `process.env`); only
|
|
4
|
+
* the segments registered via {@link setProduct}, {@link setPartner}, and
|
|
5
|
+
* {@link addToDefault} are returned, plus the core SDK identity.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
import { ClientInfo } from './clientinfo';
|
|
10
|
+
import { MODULE_NAME, VERSION, getBase } from './base';
|
|
11
|
+
/**
|
|
12
|
+
* Returns a {@link ClientInfo} populated with SDK metadata and segments
|
|
13
|
+
* registered via {@link addToDefault}. Unlike the Node.js variant, this
|
|
14
|
+
* does not auto-detect runtime, OS, CI/CD, or agent because those signals
|
|
15
|
+
* are not available in a browser.
|
|
16
|
+
*/
|
|
17
|
+
export function createDefault() {
|
|
18
|
+
return ClientInfo.EMPTY.with({ key: MODULE_NAME, value: VERSION }, ...getBase().segments);
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=default.browser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.browser.js","sourceRoot":"","sources":["../../src/clientinfo/default.browser.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,WAAW,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAErD;;;;;GAKG;AACH,MAAM,UAAU,aAAa;IAC3B,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAC1B,EAAC,GAAG,EAAE,WAAW,EAAE,KAAK,EAAE,OAAO,EAAC,EAClC,GAAG,OAAO,EAAE,CAAC,QAAQ,CACtB,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ClientInfo } from './clientinfo';
|
|
2
|
+
/**
|
|
3
|
+
* Converts a Node.js version string (e.g., "v22.0.0") into a bare
|
|
4
|
+
* semver string (e.g., "22.0.0").
|
|
5
|
+
*/
|
|
6
|
+
export declare function normalizeNodeVersion(raw: string): string;
|
|
7
|
+
export declare const CACHED_NODE_VERSION: string;
|
|
8
|
+
/**
|
|
9
|
+
* Returns a {@link ClientInfo} populated with SDK metadata, runtime
|
|
10
|
+
* information, segments registered via {@link addToDefault}, and
|
|
11
|
+
* automatically detected environment properties.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createDefault(): ClientInfo;
|
|
14
|
+
//# sourceMappingURL=default.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.d.ts","sourceRoot":"","sources":["../../src/clientinfo/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAW,MAAM,cAAc,CAAC;AAoElD;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAKxD;AAID,eAAO,MAAM,mBAAmB,QAAwC,CAAC;AAEzE;;;;GAIG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAuC1C"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ClientInfo, sanitize } from './clientinfo';
|
|
2
|
+
import { MODULE_NAME, VERSION, getBase } from './base';
|
|
3
|
+
import { agentProvider } from './agent';
|
|
4
|
+
const CICD_PROVIDERS = [
|
|
5
|
+
{
|
|
6
|
+
name: 'github',
|
|
7
|
+
envVars: [{ name: 'GITHUB_ACTIONS', expectedValue: 'true' }],
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
name: 'gitlab',
|
|
11
|
+
envVars: [{ name: 'GITLAB_CI', expectedValue: 'true' }],
|
|
12
|
+
},
|
|
13
|
+
{ name: 'jenkins', envVars: [{ name: 'JENKINS_URL', expectedValue: '' }] },
|
|
14
|
+
{
|
|
15
|
+
name: 'azure-devops',
|
|
16
|
+
envVars: [{ name: 'TF_BUILD', expectedValue: 'True' }],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
name: 'circle',
|
|
20
|
+
envVars: [{ name: 'CIRCLECI', expectedValue: 'true' }],
|
|
21
|
+
},
|
|
22
|
+
{ name: 'travis', envVars: [{ name: 'TRAVIS', expectedValue: 'true' }] },
|
|
23
|
+
{
|
|
24
|
+
name: 'bitbucket',
|
|
25
|
+
envVars: [{ name: 'BITBUCKET_BUILD_NUMBER', expectedValue: '' }],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'google-cloud-build',
|
|
29
|
+
envVars: [
|
|
30
|
+
{ name: 'PROJECT_ID', expectedValue: '' },
|
|
31
|
+
{ name: 'BUILD_ID', expectedValue: '' },
|
|
32
|
+
{ name: 'PROJECT_NUMBER', expectedValue: '' },
|
|
33
|
+
{ name: 'LOCATION', expectedValue: '' },
|
|
34
|
+
],
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'aws-code-build',
|
|
38
|
+
envVars: [{ name: 'CODEBUILD_BUILD_ARN', expectedValue: '' }],
|
|
39
|
+
},
|
|
40
|
+
{ name: 'tf-cloud', envVars: [{ name: 'TFC_RUN_ID', expectedValue: '' }] },
|
|
41
|
+
];
|
|
42
|
+
function detectCicd() {
|
|
43
|
+
for (const p of CICD_PROVIDERS) {
|
|
44
|
+
const allMatch = p.envVars.every(ev => {
|
|
45
|
+
const v = process.env[ev.name];
|
|
46
|
+
return (v !== undefined && (ev.expectedValue === '' || v === ev.expectedValue));
|
|
47
|
+
});
|
|
48
|
+
if (allMatch) {
|
|
49
|
+
return p.name;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return '';
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Converts a Node.js version string (e.g., "v22.0.0") into a bare
|
|
56
|
+
* semver string (e.g., "22.0.0").
|
|
57
|
+
*/
|
|
58
|
+
export function normalizeNodeVersion(raw) {
|
|
59
|
+
if (!raw.startsWith('v')) {
|
|
60
|
+
return '0.0.0-dev';
|
|
61
|
+
}
|
|
62
|
+
return raw.slice(1);
|
|
63
|
+
}
|
|
64
|
+
// Computed once at module load because process.version never changes
|
|
65
|
+
// during a process lifetime.
|
|
66
|
+
export const CACHED_NODE_VERSION = normalizeNodeVersion(process.version);
|
|
67
|
+
/**
|
|
68
|
+
* Returns a {@link ClientInfo} populated with SDK metadata, runtime
|
|
69
|
+
* information, segments registered via {@link addToDefault}, and
|
|
70
|
+
* automatically detected environment properties.
|
|
71
|
+
*/
|
|
72
|
+
export function createDefault() {
|
|
73
|
+
const pairs = [
|
|
74
|
+
{ key: MODULE_NAME, value: VERSION },
|
|
75
|
+
{ key: 'node', value: CACHED_NODE_VERSION },
|
|
76
|
+
{ key: 'os', value: process.platform },
|
|
77
|
+
...getBase().segments,
|
|
78
|
+
];
|
|
79
|
+
// DATABRICKS_SDK_UPSTREAM and DATABRICKS_SDK_UPSTREAM_VERSION are set
|
|
80
|
+
// by tools built on top of this SDK (e.g. Terraform provider, Pulumi)
|
|
81
|
+
// to identify themselves as the upstream product. Both must be present
|
|
82
|
+
// for the upstream segment to be included.
|
|
83
|
+
const upstream = process.env.DATABRICKS_SDK_UPSTREAM;
|
|
84
|
+
if (upstream !== undefined) {
|
|
85
|
+
const upstreamVersion = process.env.DATABRICKS_SDK_UPSTREAM_VERSION;
|
|
86
|
+
if (upstreamVersion !== undefined) {
|
|
87
|
+
pairs.push({ key: 'upstream', value: sanitize(upstream) }, { key: 'upstream-version', value: sanitize(upstreamVersion) });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
const cicd = detectCicd();
|
|
91
|
+
if (cicd !== '') {
|
|
92
|
+
pairs.push({ key: 'cicd', value: cicd });
|
|
93
|
+
}
|
|
94
|
+
const runtime = process.env.DATABRICKS_RUNTIME_VERSION;
|
|
95
|
+
if (runtime !== undefined && runtime !== '') {
|
|
96
|
+
pairs.push({ key: 'runtime', value: sanitize(runtime) });
|
|
97
|
+
}
|
|
98
|
+
const agent = agentProvider();
|
|
99
|
+
if (agent !== '') {
|
|
100
|
+
pairs.push({ key: 'agent', value: agent });
|
|
101
|
+
}
|
|
102
|
+
return ClientInfo.EMPTY.with(...pairs);
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=default.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/clientinfo/default.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,c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,IAAI,KAAK,KAAK,EAAE,EAAE,CAAC;QACjB,KAAK,CAAC,IAAI,CAAC,EAAC,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;IAC3C,CAAC;IAED,OAAO,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type { ClientInfoErrorCode } from './clientinfo';
|
|
2
|
+
export { ClientInfo, ClientInfoError } from './clientinfo';
|
|
3
|
+
export { addToDefault, setPartner, setProduct } from './base';
|
|
4
|
+
export { createDefault } from './default.browser';
|
|
5
|
+
//# sourceMappingURL=index.browser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.d.ts","sourceRoot":"","sources":["../../src/clientinfo/index.browser.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACtD,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.browser.js","sourceRoot":"","sources":["../../src/clientinfo/index.browser.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/clientinfo/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACtD,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/clientinfo/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,YAAY,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP transport primitives. Defines the {@link HttpClient} interface and a
|
|
3
|
+
* {@link newFetchHttpClient} implementation backed by the Fetch API.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/** HttpRequest represents an outgoing HTTP request. */
|
|
8
|
+
export interface HttpRequest {
|
|
9
|
+
/** The URL to send the request to. */
|
|
10
|
+
url: string;
|
|
11
|
+
/** The HTTP method (GET, POST, etc.). */
|
|
12
|
+
method: string;
|
|
13
|
+
/** The request headers. */
|
|
14
|
+
headers: Headers;
|
|
15
|
+
/** The request body. */
|
|
16
|
+
body?: string | ArrayBuffer | Uint8Array | ReadableStream<Uint8Array> | null;
|
|
17
|
+
/** An optional signal to abort the request. */
|
|
18
|
+
signal?: AbortSignal;
|
|
19
|
+
}
|
|
20
|
+
/** HttpResponse represents the response from an HTTP request. */
|
|
21
|
+
export interface HttpResponse {
|
|
22
|
+
/** The HTTP status code. */
|
|
23
|
+
statusCode: number;
|
|
24
|
+
/** The response headers. */
|
|
25
|
+
headers: Headers;
|
|
26
|
+
/** The raw response body stream. */
|
|
27
|
+
body: ReadableStream<Uint8Array> | null;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* HttpClient sends HTTP requests and returns responses.
|
|
31
|
+
*/
|
|
32
|
+
export interface HttpClient {
|
|
33
|
+
/** Sends an HTTP request and returns the response. */
|
|
34
|
+
send(request: HttpRequest): Promise<HttpResponse>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new HttpClient that uses the Fetch API as its transport.
|
|
38
|
+
*/
|
|
39
|
+
export declare function newFetchHttpClient(): HttpClient;
|
|
40
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/http/http.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,uDAAuD;AACvD,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,GAAG,EAAE,MAAM,CAAC;IAEZ,yCAAyC;IACzC,MAAM,EAAE,MAAM,CAAC;IAEf,2BAA2B;IAC3B,OAAO,EAAE,OAAO,CAAC;IAEjB,wBAAwB;IACxB,IAAI,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;IAE7E,+CAA+C;IAC/C,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB;AAED,iEAAiE;AACjE,MAAM,WAAW,YAAY;IAC3B,4BAA4B;IAC5B,UAAU,EAAE,MAAM,CAAC;IAEnB,4BAA4B;IAC5B,OAAO,EAAE,OAAO,CAAC;IAEjB,oCAAoC;IACpC,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;CACzC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,sDAAsD;IACtD,IAAI,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;CACnD;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,UAAU,CA0B/C"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP transport primitives. Defines the {@link HttpClient} interface and a
|
|
3
|
+
* {@link newFetchHttpClient} implementation backed by the Fetch API.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Creates a new HttpClient that uses the Fetch API as its transport.
|
|
9
|
+
*/
|
|
10
|
+
export function newFetchHttpClient() {
|
|
11
|
+
return {
|
|
12
|
+
async send(request) {
|
|
13
|
+
const init = {
|
|
14
|
+
method: request.method,
|
|
15
|
+
headers: request.headers,
|
|
16
|
+
};
|
|
17
|
+
if (request.body !== undefined) {
|
|
18
|
+
init.body = request.body;
|
|
19
|
+
// The Fetch spec requires duplex: 'half' for streaming request bodies.
|
|
20
|
+
// See https://fetch.spec.whatwg.org/#dom-requestinit-duplex.
|
|
21
|
+
if (request.body instanceof ReadableStream) {
|
|
22
|
+
init.duplex = 'half';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (request.signal !== undefined) {
|
|
26
|
+
init.signal = request.signal;
|
|
27
|
+
}
|
|
28
|
+
const response = await fetch(request.url, init);
|
|
29
|
+
return {
|
|
30
|
+
statusCode: response.status,
|
|
31
|
+
headers: response.headers,
|
|
32
|
+
body: response.body,
|
|
33
|
+
};
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=http.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/http/http.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAwCH;;GAEG;AACH,MAAM,UAAU,kBAAkB;IAChC,OAAO;QACL,KAAK,CAAC,IAAI,CAAC,OAAoB;YAC7B,MAAM,IAAI,GAAgB;gBACxB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,OAAO,EAAE,OAAO,CAAC,OAAO;aACzB,CAAC;YACF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;gBAC/B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;gBACzB,uEAAuE;gBACvE,6DAA6D;gBAC7D,IAAI,OAAO,CAAC,IAAI,YAAY,cAAc,EAAE,CAAC;oBAC3C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;gBACvB,CAAC;YACH,CAAC;YACD,IAAI,OAAO,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC;gBACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;YAC/B,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAChD,OAAO;gBACL,UAAU,EAAE,QAAQ,CAAC,MAAM;gBAC3B,OAAO,EAAE,QAAQ,CAAC,OAAO;gBACzB,IAAI,EAAE,QAAQ,CAAC,IAAI;aACpB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,kBAAkB,EAAC,MAAM,QAAQ,CAAC;AAC1C,YAAY,EAAC,UAAU,EAAE,WAAW,EAAE,YAAY,EAAC,MAAM,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/http/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAC,kBAAkB,EAAC,MAAM,QAAQ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,YAAY,EAAC,KAAK,EAAE,MAAM,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/logger/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/** Logger interface and built-in implementations. */
|
|
2
|
+
/** Supported log levels in order of increasing severity. */
|
|
3
|
+
export type Level = 'debug' | 'info' | 'warn' | 'error' | 'off';
|
|
4
|
+
/**
|
|
5
|
+
* A logger that receives messages at different severity levels.
|
|
6
|
+
*
|
|
7
|
+
* The method signatures are intentionally compatible with the global
|
|
8
|
+
* {@link Console} object so that `console` can be used as a Logger when level
|
|
9
|
+
* filtering is not needed.
|
|
10
|
+
*/
|
|
11
|
+
export interface Logger {
|
|
12
|
+
/** Logs a debug-level message. */
|
|
13
|
+
debug(message: string, ...args: unknown[]): void;
|
|
14
|
+
/** Logs an info-level message. */
|
|
15
|
+
info(message: string, ...args: unknown[]): void;
|
|
16
|
+
/** Logs a warn-level message. */
|
|
17
|
+
warn(message: string, ...args: unknown[]): void;
|
|
18
|
+
/** Logs an error-level message. */
|
|
19
|
+
error(message: string, ...args: unknown[]): void;
|
|
20
|
+
}
|
|
21
|
+
/** A logger that silently discards all messages. */
|
|
22
|
+
export declare class NoOpLogger implements Logger {
|
|
23
|
+
debug(): void;
|
|
24
|
+
info(): void;
|
|
25
|
+
warn(): void;
|
|
26
|
+
error(): void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* A decorator that adds level filtering to any {@link Logger}.
|
|
30
|
+
*
|
|
31
|
+
* Only messages at or above the configured minimum level are forwarded to the
|
|
32
|
+
* underlying logger. The default underlying logger is `console`.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* // Only warn and error go to console.
|
|
37
|
+
* const logger = new LogLevel('warn');
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export declare class LogLevel implements Logger {
|
|
41
|
+
private readonly threshold;
|
|
42
|
+
private readonly logger;
|
|
43
|
+
constructor(level: Level, logger?: Logger);
|
|
44
|
+
debug(message: string, ...args: unknown[]): void;
|
|
45
|
+
info(message: string, ...args: unknown[]): void;
|
|
46
|
+
warn(message: string, ...args: unknown[]): void;
|
|
47
|
+
error(message: string, ...args: unknown[]): void;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,qDAAqD;AAErD,4DAA4D;AAC5D,MAAM,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,MAAM;IACrB,kCAAkC;IAClC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEjD,kCAAkC;IAClC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEhD,iCAAiC;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEhD,mCAAmC;IACnC,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;CAClD;AAED,oDAAoD;AACpD,qBAAa,UAAW,YAAW,MAAM;IACvC,KAAK,IAAI,IAAI;IAIb,IAAI,IAAI,IAAI;IAIZ,IAAI,IAAI,IAAI;IAIZ,KAAK,IAAI,IAAI;CAGd;AAWD;;;;;;;;;;;GAWG;AACH,qBAAa,QAAS,YAAW,MAAM;IACrC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,KAAK,EAAE,KAAK,EAAE,MAAM,GAAE,MAAgB;IAKlD,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAMhD,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;IAM/C,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE,GAAG,IAAI;CAKjD"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Logger interface and built-in implementations. */
|
|
2
|
+
/** A logger that silently discards all messages. */
|
|
3
|
+
export class NoOpLogger {
|
|
4
|
+
debug() {
|
|
5
|
+
// Intentionally empty.
|
|
6
|
+
}
|
|
7
|
+
info() {
|
|
8
|
+
// Intentionally empty.
|
|
9
|
+
}
|
|
10
|
+
warn() {
|
|
11
|
+
// Intentionally empty.
|
|
12
|
+
}
|
|
13
|
+
error() {
|
|
14
|
+
// Intentionally empty.
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// Numeric severity used by LogLevel to gate calls.
|
|
18
|
+
const LEVEL_SEVERITY = {
|
|
19
|
+
debug: 0,
|
|
20
|
+
info: 1,
|
|
21
|
+
warn: 2,
|
|
22
|
+
error: 3,
|
|
23
|
+
off: 4,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* A decorator that adds level filtering to any {@link Logger}.
|
|
27
|
+
*
|
|
28
|
+
* Only messages at or above the configured minimum level are forwarded to the
|
|
29
|
+
* underlying logger. The default underlying logger is `console`.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* // Only warn and error go to console.
|
|
34
|
+
* const logger = new LogLevel('warn');
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export class LogLevel {
|
|
38
|
+
threshold;
|
|
39
|
+
logger;
|
|
40
|
+
constructor(level, logger = console) {
|
|
41
|
+
this.threshold = LEVEL_SEVERITY[level];
|
|
42
|
+
this.logger = logger;
|
|
43
|
+
}
|
|
44
|
+
debug(message, ...args) {
|
|
45
|
+
if (this.threshold <= LEVEL_SEVERITY.debug) {
|
|
46
|
+
this.logger.debug(message, ...args);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
info(message, ...args) {
|
|
50
|
+
if (this.threshold <= LEVEL_SEVERITY.info) {
|
|
51
|
+
this.logger.info(message, ...args);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
warn(message, ...args) {
|
|
55
|
+
if (this.threshold <= LEVEL_SEVERITY.warn) {
|
|
56
|
+
this.logger.warn(message, ...args);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
error(message, ...args) {
|
|
60
|
+
if (this.threshold <= LEVEL_SEVERITY.error) {
|
|
61
|
+
this.logger.error(message, ...args);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../../src/logger/logger.ts"],"names":[],"mappings":"AAAA,qDAAqD;AA0BrD,oDAAoD;AACpD,MAA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Ae;QACvC,IAAI,IAAI,CAAC,SAAS,IAAI,cAAc,CAAC,KAAK,EAAE,CAAC;YAC3C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,GAAG,IAAI,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for Databricks configuration profile operations.
|
|
3
|
+
*
|
|
4
|
+
* @module
|
|
5
|
+
*/
|
|
6
|
+
/** Discriminant codes for {@link ProfileError}. */
|
|
7
|
+
export type ProfileErrorCode = 'CONFIG_FILE_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'EMPTY_PATH' | 'EMPTY_PROFILE' | 'INVALID_PROFILE_NAME';
|
|
8
|
+
/**
|
|
9
|
+
* Error thrown by profile operations.
|
|
10
|
+
*
|
|
11
|
+
* Use the {@link ProfileError.code} field to distinguish between error causes.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ProfileError extends Error {
|
|
14
|
+
readonly code: ProfileErrorCode;
|
|
15
|
+
constructor(code: ProfileErrorCode, message: string);
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/profiles/errors.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,mDAAmD;AACnD,MAAM,MAAM,gBAAgB,GACxB,uBAAuB,GACvB,mBAAmB,GACnB,YAAY,GACZ,eAAe,GACf,sBAAsB,CAAC;AAE3B;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;gBAEpB,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;CAKpD"}
|