@databricks/sdk-core 0.34.0 → 0.35.0
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/apierror/apierror.d.ts +52 -49
- package/dist/apierror/apierror.d.ts.map +1 -1
- package/dist/apierror/apierror.js +124 -172
- package/dist/apierror/apierror.js.map +1 -1
- package/dist/apierror/codes/codes.d.ts +113 -113
- package/dist/apierror/codes/codes.d.ts.map +1 -1
- package/dist/apierror/codes/codes.js +24 -115
- package/dist/apierror/codes/codes.js.map +1 -1
- package/dist/apierror/codes/index.d.ts +2 -7
- package/dist/apierror/codes/index.js +3 -7
- package/dist/apierror/details.d.ts +104 -101
- package/dist/apierror/details.d.ts.map +1 -1
- package/dist/apierror/details.js +151 -226
- package/dist/apierror/details.js.map +1 -1
- package/dist/apierror/index.d.ts +3 -8
- package/dist/apierror/index.js +3 -7
- package/dist/clientinfo/agent.d.ts +6 -3
- package/dist/clientinfo/agent.d.ts.map +1 -1
- package/dist/clientinfo/agent.js +134 -112
- package/dist/clientinfo/agent.js.map +1 -1
- package/dist/clientinfo/base.d.ts +13 -15
- package/dist/clientinfo/base.d.ts.map +1 -1
- package/dist/clientinfo/base.js +50 -50
- package/dist/clientinfo/base.js.map +1 -1
- package/dist/clientinfo/clientinfo.d.ts +40 -38
- package/dist/clientinfo/clientinfo.d.ts.map +1 -1
- package/dist/clientinfo/clientinfo.js +78 -88
- package/dist/clientinfo/clientinfo.js.map +1 -1
- package/dist/clientinfo/default.browser.d.ts +6 -10
- package/dist/clientinfo/default.browser.d.ts.map +1 -1
- package/dist/clientinfo/default.browser.js +24 -16
- package/dist/clientinfo/default.browser.js.map +1 -1
- package/dist/clientinfo/default.d.ts +8 -4
- package/dist/clientinfo/default.d.ts.map +1 -1
- package/dist/clientinfo/default.js +157 -102
- package/dist/clientinfo/default.js.map +1 -1
- package/dist/clientinfo/index.browser.d.ts +4 -5
- package/dist/clientinfo/index.browser.js +5 -4
- package/dist/clientinfo/index.d.ts +4 -5
- package/dist/clientinfo/index.js +5 -4
- package/dist/clientinfo/meta-harness.d.ts +6 -3
- package/dist/clientinfo/meta-harness.d.ts.map +1 -1
- package/dist/clientinfo/meta-harness.js +30 -46
- package/dist/clientinfo/meta-harness.js.map +1 -1
- package/dist/http/http.d.ts +25 -22
- package/dist/http/http.d.ts.map +1 -1
- package/dist/http/http.js +24 -34
- package/dist/http/http.js.map +1 -1
- package/dist/http/index.d.ts +2 -8
- package/dist/http/index.js +3 -7
- package/dist/index.d.ts +1 -6
- package/dist/index.js +7 -5
- package/dist/index.js.map +1 -1
- package/dist/logger/index.d.ts +2 -8
- package/dist/logger/index.js +3 -7
- package/dist/logger/logger.d.ts +26 -23
- package/dist/logger/logger.d.ts.map +1 -1
- package/dist/logger/logger.js +46 -60
- package/dist/logger/logger.js.map +1 -1
- package/dist/ops/execute.d.ts +7 -3
- package/dist/ops/execute.d.ts.map +1 -1
- package/dist/ops/execute.js +55 -67
- package/dist/ops/execute.js.map +1 -1
- package/dist/ops/index.d.ts +5 -12
- package/dist/ops/index.js +4 -9
- package/dist/ops/limiter.d.ts +5 -2
- package/dist/ops/limiter.d.ts.map +1 -1
- package/dist/ops/limiter.js +0 -2
- package/dist/ops/options.d.ts +23 -19
- package/dist/ops/options.d.ts.map +1 -1
- package/dist/ops/options.js +0 -2
- package/dist/ops/retrier.d.ts +34 -31
- package/dist/ops/retrier.d.ts.map +1 -1
- package/dist/ops/retrier.js +55 -66
- package/dist/ops/retrier.js.map +1 -1
- package/dist/package.js +6 -0
- package/dist/package.js.map +1 -0
- package/dist/profiles/errors.d.ts +7 -4
- package/dist/profiles/errors.d.ts.map +1 -1
- package/dist/profiles/errors.js +16 -17
- package/dist/profiles/errors.js.map +1 -1
- package/dist/profiles/index.browser.d.ts +4 -10
- package/dist/profiles/index.browser.js +4 -8
- package/dist/profiles/index.d.ts +5 -15
- package/dist/profiles/index.js +5 -13
- package/dist/profiles/ini.d.ts +6 -3
- package/dist/profiles/ini.d.ts.map +1 -1
- package/dist/profiles/ini.js +60 -108
- package/dist/profiles/ini.js.map +1 -1
- package/dist/profiles/profile.d.ts +66 -67
- package/dist/profiles/profile.d.ts.map +1 -1
- package/dist/profiles/profile.js +89 -84
- package/dist/profiles/profile.js.map +1 -1
- package/dist/profiles/resolve.d.ts +8 -9
- package/dist/profiles/resolve.d.ts.map +1 -1
- package/dist/profiles/resolve.js +140 -185
- package/dist/profiles/resolve.js.map +1 -1
- package/dist/profiles/secret.d.ts +15 -12
- package/dist/profiles/secret.d.ts.map +1 -1
- package/dist/profiles/secret.js +38 -35
- package/dist/profiles/secret.js.map +1 -1
- package/dist/wkt/fieldmask.d.ts +23 -20
- package/dist/wkt/fieldmask.d.ts.map +1 -1
- package/dist/wkt/fieldmask.js +53 -62
- package/dist/wkt/fieldmask.js.map +1 -1
- package/dist/wkt/index.d.ts +3 -4
- package/dist/wkt/index.js +3 -2
- package/dist/wkt/value.d.ts +6 -3
- package/dist/wkt/value.d.ts.map +1 -1
- package/dist/wkt/value.js +0 -2
- package/package.json +2 -2
- package/dist/apierror/codes/index.d.ts.map +0 -1
- package/dist/apierror/codes/index.js.map +0 -1
- package/dist/apierror/index.d.ts.map +0 -1
- package/dist/apierror/index.js.map +0 -1
- package/dist/clientinfo/index.browser.d.ts.map +0 -1
- package/dist/clientinfo/index.browser.js.map +0 -1
- package/dist/clientinfo/index.d.ts.map +0 -1
- package/dist/clientinfo/index.js.map +0 -1
- package/dist/http/index.d.ts.map +0 -1
- package/dist/http/index.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/logger/index.d.ts.map +0 -1
- package/dist/logger/index.js.map +0 -1
- package/dist/ops/index.d.ts.map +0 -1
- package/dist/ops/index.js.map +0 -1
- package/dist/ops/limiter.js.map +0 -1
- package/dist/ops/options.js.map +0 -1
- package/dist/profiles/index.browser.d.ts.map +0 -1
- package/dist/profiles/index.browser.js.map +0 -1
- package/dist/profiles/index.d.ts.map +0 -1
- package/dist/profiles/index.js.map +0 -1
- package/dist/wkt/index.d.ts.map +0 -1
- package/dist/wkt/index.js.map +0 -1
- package/dist/wkt/value.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","
|
|
1
|
+
{"version":3,"file":"errors.js","names":[],"sources":["../../src/profiles/errors.ts"],"sourcesContent":["/**\n * Error types for Databricks configuration profile operations.\n *\n * @module\n */\n\n/** Discriminant codes for {@link ProfileError}. */\nexport type ProfileErrorCode =\n | 'CONFIG_FILE_NOT_FOUND'\n | 'PROFILE_NOT_FOUND'\n | 'EMPTY_PATH'\n | 'EMPTY_PROFILE'\n | 'INVALID_PROFILE_NAME'\n | 'CONFLICTING_OPTIONS';\n\n/**\n * Error thrown by profile operations.\n *\n * Use the {@link ProfileError.code} field to distinguish between error causes.\n */\nexport class ProfileError extends Error {\n readonly code: ProfileErrorCode;\n\n constructor(code: ProfileErrorCode, message: string) {\n super(message);\n this.name = 'ProfileError';\n this.code = code;\n }\n}\n"],"mappings":";;;;;;AAoBA,IAAa,eAAb,cAAkC,MAAM;CACtC,AAAS;CAET,YAAY,MAAwB,SAAiB;AACnD,QAAM,QAAQ;AACd,OAAK,OAAO;AACZ,OAAK,OAAO"}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export { ProfileError } from './errors';
|
|
7
|
-
export type { ProfileErrorCode } from './errors';
|
|
8
|
-
export type { Profile, ProfileOptions } from './profile';
|
|
9
|
-
export { Secret } from './secret';
|
|
10
|
-
//# sourceMappingURL=index.browser.d.ts.map
|
|
1
|
+
import { ProfileError, ProfileErrorCode } from "./errors.js";
|
|
2
|
+
import { Secret } from "./secret.js";
|
|
3
|
+
import { Profile, ProfileOptions } from "./profile.js";
|
|
4
|
+
export { type Profile, ProfileError, type ProfileErrorCode, type ProfileOptions, Secret };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
*/
|
|
6
|
-
export { ProfileError } from './errors';
|
|
7
|
-
export { Secret } from './secret';
|
|
8
|
-
//# sourceMappingURL=index.browser.js.map
|
|
1
|
+
import { ProfileError } from "./errors.js";
|
|
2
|
+
import { Secret } from "./secret.js";
|
|
3
|
+
|
|
4
|
+
export { ProfileError, Secret };
|
package/dist/profiles/index.d.ts
CHANGED
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* file and/or environment variables using the {@link resolve} function.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
export { ProfileError } from './errors';
|
|
11
|
-
export type { ProfileErrorCode } from './errors';
|
|
12
|
-
export type { Profile, ProfileOptions } from './profile';
|
|
13
|
-
export { defaultConfigFile, listProfiles, resolve } from './resolve';
|
|
14
|
-
export { Secret } from './secret';
|
|
15
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { ProfileError, ProfileErrorCode } from "./errors.js";
|
|
2
|
+
import { Secret } from "./secret.js";
|
|
3
|
+
import { Profile, ProfileOptions } from "./profile.js";
|
|
4
|
+
import { defaultConfigFile, listProfiles, resolve } from "./resolve.js";
|
|
5
|
+
export { type Profile, ProfileError, type ProfileErrorCode, type ProfileOptions, Secret, defaultConfigFile, listProfiles, resolve };
|
package/dist/profiles/index.js
CHANGED
|
@@ -1,13 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
* file and/or environment variables using the {@link resolve} function.
|
|
7
|
-
*
|
|
8
|
-
* @packageDocumentation
|
|
9
|
-
*/
|
|
10
|
-
export { ProfileError } from './errors';
|
|
11
|
-
export { defaultConfigFile, listProfiles, resolve } from './resolve';
|
|
12
|
-
export { Secret } from './secret';
|
|
13
|
-
//# sourceMappingURL=index.js.map
|
|
1
|
+
import { ProfileError } from "./errors.js";
|
|
2
|
+
import { Secret } from "./secret.js";
|
|
3
|
+
import { defaultConfigFile, listProfiles, resolve } from "./resolve.js";
|
|
4
|
+
|
|
5
|
+
export { ProfileError, Secret, defaultConfigFile, listProfiles, resolve };
|
package/dist/profiles/ini.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/profiles/ini.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Minimal INI parser and writer for the Databricks config file format.
|
|
3
4
|
*
|
|
@@ -18,13 +19,13 @@
|
|
|
18
19
|
* @module
|
|
19
20
|
*/
|
|
20
21
|
/** Parsed INI data as an ordered map of section names to key-value maps. */
|
|
21
|
-
|
|
22
|
+
type IniData = Map<string, Map<string, string>>;
|
|
22
23
|
/**
|
|
23
24
|
* Parses an INI-formatted string into structured data.
|
|
24
25
|
*
|
|
25
26
|
* Keys before any section header are assigned to the "DEFAULT" section.
|
|
26
27
|
*/
|
|
27
|
-
|
|
28
|
+
declare function parseIni(content: string): IniData;
|
|
28
29
|
/**
|
|
29
30
|
* Formats structured INI data back into a string.
|
|
30
31
|
*
|
|
@@ -32,5 +33,7 @@ export declare function parseIni(content: string): IniData;
|
|
|
32
33
|
* column, matching the output format of go-ini's `PrettyFormat` default.
|
|
33
34
|
* Sections are separated by blank lines (`PrettySection` default).
|
|
34
35
|
*/
|
|
35
|
-
|
|
36
|
+
declare function formatIni(data: IniData): string;
|
|
37
|
+
//#endregion
|
|
38
|
+
export { IniData, formatIni, parseIni };
|
|
36
39
|
//# sourceMappingURL=ini.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ini.d.ts","
|
|
1
|
+
{"version":3,"file":"ini.d.ts","names":[],"sources":["../../src/profiles/ini.ts"],"mappings":";;AAqBA;;;;;AAOA;;;;;AA+EA;;;;;;;;;KAtFY,OAAA,GAAU,GAAA,SAAY,GAAA;;;;;;iBAOlB,QAAA,CAAS,OAAA,WAAkB,OAAA;;;;;;;;iBA+E3B,SAAA,CAAU,IAAA,EAAM,OAAA"}
|
package/dist/profiles/ini.js
CHANGED
|
@@ -1,113 +1,65 @@
|
|
|
1
|
+
//#region src/profiles/ini.ts
|
|
1
2
|
/**
|
|
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
|
-
const name = line.slice(1, closeIdx);
|
|
42
|
-
if (name === '') {
|
|
43
|
-
throw new Error('empty section name');
|
|
44
|
-
}
|
|
45
|
-
currentSection = name;
|
|
46
|
-
if (!result.has(currentSection)) {
|
|
47
|
-
result.set(currentSection, new Map());
|
|
48
|
-
}
|
|
49
|
-
continue;
|
|
50
|
-
}
|
|
51
|
-
// Key-value pair: first '=' or ':' splits key from value.
|
|
52
|
-
const eqIdx = line.indexOf('=');
|
|
53
|
-
const colonIdx = line.indexOf(':');
|
|
54
|
-
let delimIdx;
|
|
55
|
-
if (eqIdx === -1 && colonIdx === -1) {
|
|
56
|
-
throw new Error(`key-value delimiter not found: ${line}`);
|
|
57
|
-
}
|
|
58
|
-
else if (eqIdx === -1) {
|
|
59
|
-
delimIdx = colonIdx;
|
|
60
|
-
}
|
|
61
|
-
else if (colonIdx === -1) {
|
|
62
|
-
delimIdx = eqIdx;
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
delimIdx = Math.min(eqIdx, colonIdx);
|
|
66
|
-
}
|
|
67
|
-
const key = line.slice(0, delimIdx).trim();
|
|
68
|
-
if (key === '') {
|
|
69
|
-
throw new Error(`empty key name: ${line}`);
|
|
70
|
-
}
|
|
71
|
-
let value = line.slice(delimIdx + 1).trim();
|
|
72
|
-
// Strip inline comments matching go-ini's SpaceBeforeInlineComment
|
|
73
|
-
// precedence: try " #" first, then " ;" only if " #" is absent.
|
|
74
|
-
let commentIdx = value.indexOf(' #');
|
|
75
|
-
if (commentIdx === -1) {
|
|
76
|
-
commentIdx = value.indexOf(' ;');
|
|
77
|
-
}
|
|
78
|
-
if (commentIdx !== -1) {
|
|
79
|
-
value = value.slice(0, commentIdx).trimEnd();
|
|
80
|
-
}
|
|
81
|
-
if (!result.has(currentSection)) {
|
|
82
|
-
result.set(currentSection, new Map());
|
|
83
|
-
}
|
|
84
|
-
const section = result.get(currentSection);
|
|
85
|
-
if (section !== undefined) {
|
|
86
|
-
section.set(key, value);
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return result;
|
|
3
|
+
* Parses an INI-formatted string into structured data.
|
|
4
|
+
*
|
|
5
|
+
* Keys before any section header are assigned to the "DEFAULT" section.
|
|
6
|
+
*/
|
|
7
|
+
function parseIni(content) {
|
|
8
|
+
const result = /* @__PURE__ */ new Map();
|
|
9
|
+
let currentSection = "DEFAULT";
|
|
10
|
+
result.set(currentSection, /* @__PURE__ */ new Map());
|
|
11
|
+
for (const rawLine of content.split(/\r?\n/)) {
|
|
12
|
+
const line = rawLine.trim();
|
|
13
|
+
if (line === "" || line.startsWith("#") || line.startsWith(";")) continue;
|
|
14
|
+
if (line.startsWith("[")) {
|
|
15
|
+
const closeIdx = line.lastIndexOf("]");
|
|
16
|
+
if (closeIdx === -1) throw new Error(`unclosed section: ${line}`);
|
|
17
|
+
const name = line.slice(1, closeIdx);
|
|
18
|
+
if (name === "") throw new Error("empty section name");
|
|
19
|
+
currentSection = name;
|
|
20
|
+
if (!result.has(currentSection)) result.set(currentSection, /* @__PURE__ */ new Map());
|
|
21
|
+
continue;
|
|
22
|
+
}
|
|
23
|
+
const eqIdx = line.indexOf("=");
|
|
24
|
+
const colonIdx = line.indexOf(":");
|
|
25
|
+
let delimIdx;
|
|
26
|
+
if (eqIdx === -1 && colonIdx === -1) throw new Error(`key-value delimiter not found: ${line}`);
|
|
27
|
+
else if (eqIdx === -1) delimIdx = colonIdx;
|
|
28
|
+
else if (colonIdx === -1) delimIdx = eqIdx;
|
|
29
|
+
else delimIdx = Math.min(eqIdx, colonIdx);
|
|
30
|
+
const key = line.slice(0, delimIdx).trim();
|
|
31
|
+
if (key === "") throw new Error(`empty key name: ${line}`);
|
|
32
|
+
let value = line.slice(delimIdx + 1).trim();
|
|
33
|
+
let commentIdx = value.indexOf(" #");
|
|
34
|
+
if (commentIdx === -1) commentIdx = value.indexOf(" ;");
|
|
35
|
+
if (commentIdx !== -1) value = value.slice(0, commentIdx).trimEnd();
|
|
36
|
+
if (!result.has(currentSection)) result.set(currentSection, /* @__PURE__ */ new Map());
|
|
37
|
+
const section = result.get(currentSection);
|
|
38
|
+
if (section !== void 0) section.set(key, value);
|
|
39
|
+
}
|
|
40
|
+
return result;
|
|
90
41
|
}
|
|
91
42
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
return sections.join('\n\n') + '\n';
|
|
43
|
+
* Formats structured INI data back into a string.
|
|
44
|
+
*
|
|
45
|
+
* Each section's keys are aligned so that all `=` signs appear in the same
|
|
46
|
+
* column, matching the output format of go-ini's `PrettyFormat` default.
|
|
47
|
+
* Sections are separated by blank lines (`PrettySection` default).
|
|
48
|
+
*/
|
|
49
|
+
function formatIni(data) {
|
|
50
|
+
const sections = [];
|
|
51
|
+
for (const [name, keys] of data) {
|
|
52
|
+
const lines = [];
|
|
53
|
+
lines.push(`[${name}]`);
|
|
54
|
+
if (keys.size > 0) {
|
|
55
|
+
const maxKeyLen = Math.max(...[...keys.keys()].map((k) => k.length));
|
|
56
|
+
for (const [key, value] of keys) lines.push(`${key.padEnd(maxKeyLen)} = ${value}`);
|
|
57
|
+
}
|
|
58
|
+
sections.push(lines.join("\n"));
|
|
59
|
+
}
|
|
60
|
+
return sections.join("\n\n") + "\n";
|
|
112
61
|
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
export { formatIni, parseIni };
|
|
113
65
|
//# sourceMappingURL=ini.js.map
|
package/dist/profiles/ini.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ini.js","
|
|
1
|
+
{"version":3,"file":"ini.js","names":[],"sources":["../../src/profiles/ini.ts"],"sourcesContent":["/**\n * Minimal INI parser and writer for the Databricks config file format.\n *\n * This matches the behavior of {@link https://pkg.go.dev/gopkg.in/ini.v1 | go-ini}\n * with `SpaceBeforeInlineComment: true`, which is how the Go SDK loads\n * databrickscfg files. Key behavioral details:\n *\n * - Inline comments are only recognized when `#` or `;` is preceded by a\n * space. The parser checks for `\" #\"` first; only if absent does it check\n * for `\" ;\"`. This matches Go's `strings.Index` precedence.\n * - Both `=` and `:` are key-value delimiters (Go default). Only the first\n * delimiter on a line splits key from value.\n * - Section names are the raw text between `[` and the last `]` on the line,\n * with no trimming.\n * - Keys and values are trimmed of surrounding whitespace.\n * - Lines without a delimiter throw an error (matching go-ini default).\n *\n * @module\n */\n\n/** Parsed INI data as an ordered map of section names to key-value maps. */\nexport type IniData = Map<string, Map<string, string>>;\n\n/**\n * Parses an INI-formatted string into structured data.\n *\n * Keys before any section header are assigned to the \"DEFAULT\" section.\n */\nexport function parseIni(content: string): IniData {\n const result: IniData = new Map();\n let currentSection = 'DEFAULT';\n result.set(currentSection, new Map());\n\n for (const rawLine of content.split(/\\r?\\n/)) {\n const line = rawLine.trim();\n\n // Skip empty lines and full-line comments.\n if (line === '' || line.startsWith('#') || line.startsWith(';')) {\n continue;\n }\n\n // Section header: text between '[' and the last ']'.\n if (line.startsWith('[')) {\n const closeIdx = line.lastIndexOf(']');\n if (closeIdx === -1) {\n throw new Error(`unclosed section: ${line}`);\n }\n const name = line.slice(1, closeIdx);\n if (name === '') {\n throw new Error('empty section name');\n }\n currentSection = name;\n if (!result.has(currentSection)) {\n result.set(currentSection, new Map());\n }\n continue;\n }\n\n // Key-value pair: first '=' or ':' splits key from value.\n const eqIdx = line.indexOf('=');\n const colonIdx = line.indexOf(':');\n let delimIdx: number;\n if (eqIdx === -1 && colonIdx === -1) {\n throw new Error(`key-value delimiter not found: ${line}`);\n } else if (eqIdx === -1) {\n delimIdx = colonIdx;\n } else if (colonIdx === -1) {\n delimIdx = eqIdx;\n } else {\n delimIdx = Math.min(eqIdx, colonIdx);\n }\n\n const key = line.slice(0, delimIdx).trim();\n if (key === '') {\n throw new Error(`empty key name: ${line}`);\n }\n let value = line.slice(delimIdx + 1).trim();\n\n // Strip inline comments matching go-ini's SpaceBeforeInlineComment\n // precedence: try \" #\" first, then \" ;\" only if \" #\" is absent.\n let commentIdx = value.indexOf(' #');\n if (commentIdx === -1) {\n commentIdx = value.indexOf(' ;');\n }\n if (commentIdx !== -1) {\n value = value.slice(0, commentIdx).trimEnd();\n }\n\n if (!result.has(currentSection)) {\n result.set(currentSection, new Map());\n }\n const section = result.get(currentSection);\n if (section !== undefined) {\n section.set(key, value);\n }\n }\n\n return result;\n}\n\n/**\n * Formats structured INI data back into a string.\n *\n * Each section's keys are aligned so that all `=` signs appear in the same\n * column, matching the output format of go-ini's `PrettyFormat` default.\n * Sections are separated by blank lines (`PrettySection` default).\n */\nexport function formatIni(data: IniData): string {\n const sections: string[] = [];\n\n for (const [name, keys] of data) {\n const lines: string[] = [];\n lines.push(`[${name}]`);\n\n if (keys.size > 0) {\n const maxKeyLen = Math.max(...[...keys.keys()].map(k => k.length));\n for (const [key, value] of keys) {\n lines.push(`${key.padEnd(maxKeyLen)} = ${value}`);\n }\n }\n\n sections.push(lines.join('\\n'));\n }\n\n return sections.join('\\n\\n') + '\\n';\n}\n"],"mappings":";;;;;;AA4BA,SAAgB,SAAS,SAA0B;CACjD,MAAM,yBAAkB,IAAI,KAAK;CACjC,IAAI,iBAAiB;AACrB,QAAO,IAAI,gCAAgB,IAAI,KAAK,CAAC;AAErC,MAAK,MAAM,WAAW,QAAQ,MAAM,QAAQ,EAAE;EAC5C,MAAM,OAAO,QAAQ,MAAM;AAG3B,MAAI,SAAS,MAAM,KAAK,WAAW,IAAI,IAAI,KAAK,WAAW,IAAI,CAC7D;AAIF,MAAI,KAAK,WAAW,IAAI,EAAE;GACxB,MAAM,WAAW,KAAK,YAAY,IAAI;AACtC,OAAI,aAAa,GACf,OAAM,IAAI,MAAM,qBAAqB,OAAO;GAE9C,MAAM,OAAO,KAAK,MAAM,GAAG,SAAS;AACpC,OAAI,SAAS,GACX,OAAM,IAAI,MAAM,qBAAqB;AAEvC,oBAAiB;AACjB,OAAI,CAAC,OAAO,IAAI,eAAe,CAC7B,QAAO,IAAI,gCAAgB,IAAI,KAAK,CAAC;AAEvC;;EAIF,MAAM,QAAQ,KAAK,QAAQ,IAAI;EAC/B,MAAM,WAAW,KAAK,QAAQ,IAAI;EAClC,IAAI;AACJ,MAAI,UAAU,MAAM,aAAa,GAC/B,OAAM,IAAI,MAAM,kCAAkC,OAAO;WAChD,UAAU,GACnB,YAAW;WACF,aAAa,GACtB,YAAW;MAEX,YAAW,KAAK,IAAI,OAAO,SAAS;EAGtC,MAAM,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC,MAAM;AAC1C,MAAI,QAAQ,GACV,OAAM,IAAI,MAAM,mBAAmB,OAAO;EAE5C,IAAI,QAAQ,KAAK,MAAM,WAAW,EAAE,CAAC,MAAM;EAI3C,IAAI,aAAa,MAAM,QAAQ,KAAK;AACpC,MAAI,eAAe,GACjB,cAAa,MAAM,QAAQ,KAAK;AAElC,MAAI,eAAe,GACjB,SAAQ,MAAM,MAAM,GAAG,WAAW,CAAC,SAAS;AAG9C,MAAI,CAAC,OAAO,IAAI,eAAe,CAC7B,QAAO,IAAI,gCAAgB,IAAI,KAAK,CAAC;EAEvC,MAAM,UAAU,OAAO,IAAI,eAAe;AAC1C,MAAI,YAAY,OACd,SAAQ,IAAI,KAAK,MAAM;;AAI3B,QAAO;;;;;;;;;AAUT,SAAgB,UAAU,MAAuB;CAC/C,MAAM,WAAqB,EAAE;AAE7B,MAAK,MAAM,CAAC,MAAM,SAAS,MAAM;EAC/B,MAAM,QAAkB,EAAE;AAC1B,QAAM,KAAK,IAAI,KAAK,GAAG;AAEvB,MAAI,KAAK,OAAO,GAAG;GACjB,MAAM,YAAY,KAAK,IAAI,GAAG,CAAC,GAAG,KAAK,MAAM,CAAC,CAAC,KAAI,MAAK,EAAE,OAAO,CAAC;AAClE,QAAK,MAAM,CAAC,KAAK,UAAU,KACzB,OAAM,KAAK,GAAG,IAAI,OAAO,UAAU,CAAC,KAAK,QAAQ;;AAIrD,WAAS,KAAK,MAAM,KAAK,KAAK,CAAC;;AAGjC,QAAO,SAAS,KAAK,OAAO,GAAG"}
|
|
@@ -1,42 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
* @module
|
|
5
|
-
*/
|
|
6
|
-
import { Secret } from './secret';
|
|
1
|
+
import { Secret } from "./secret.js";
|
|
2
|
+
|
|
3
|
+
//#region src/profiles/profile.d.ts
|
|
7
4
|
/**
|
|
8
5
|
* Holds configuration values resolved from a databrickscfg file and/or
|
|
9
6
|
* environment variables. All fields are optional; an absent field means the
|
|
10
7
|
* value was not configured.
|
|
11
8
|
*/
|
|
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
|
-
|
|
9
|
+
interface Profile {
|
|
10
|
+
/** Profile name (INI section name). */
|
|
11
|
+
name?: string;
|
|
12
|
+
/** Databricks workspace or Accounts API endpoint URL. */
|
|
13
|
+
host?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Databricks Workspace ID, used with unified hosts. Accepts either a classic
|
|
16
|
+
* numeric workspace ID or another workspace identifier format that the server
|
|
17
|
+
* understands.
|
|
18
|
+
*/
|
|
19
|
+
workspaceId?: string;
|
|
20
|
+
/** Databricks Account ID for Accounts API. */
|
|
21
|
+
accountId?: string;
|
|
22
|
+
/** Personal access token for PAT authentication. */
|
|
23
|
+
token?: Secret;
|
|
24
|
+
/** Selects a specific auth method when multiple credentials are available. */
|
|
25
|
+
authType?: string;
|
|
26
|
+
/** OAuth client ID for M2M authentication. */
|
|
27
|
+
clientId?: string;
|
|
28
|
+
/** OAuth client secret for M2M authentication. */
|
|
29
|
+
clientSecret?: Secret;
|
|
30
|
+
/** Path to the Databricks CLI binary (>= 0.100.0) for CLI-based auth. */
|
|
31
|
+
databricksCliPath?: string;
|
|
32
|
+
/**
|
|
33
|
+
* INI keys not mapped to a known field. Only populated when loading from a
|
|
34
|
+
* config file; environment variables do not contribute to extra.
|
|
35
|
+
*/
|
|
36
|
+
extra?: Record<string, string>;
|
|
40
37
|
}
|
|
41
38
|
/**
|
|
42
39
|
* Configures how a profile is resolved by {@link resolve}.
|
|
@@ -46,51 +43,53 @@ export interface Profile {
|
|
|
46
43
|
* source can be disabled independently with {@link ProfileOptions.noProfile}
|
|
47
44
|
* and {@link ProfileOptions.disableEnv}.
|
|
48
45
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
46
|
+
interface ProfileOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Profile name (INI section) to load. If not set, resolves from the
|
|
49
|
+
* DATABRICKS_CONFIG_PROFILE environment variable, then the default_profile
|
|
50
|
+
* key in the __settings__ section, then falls back to the DEFAULT section.
|
|
51
|
+
*/
|
|
52
|
+
profile?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Path to the databrickscfg file. If not set, reads DATABRICKS_CONFIG_FILE
|
|
55
|
+
* from the environment, falling back to ~/.databrickscfg.
|
|
56
|
+
*/
|
|
57
|
+
configFile?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Disable reading the config file. Cannot be combined with
|
|
60
|
+
* {@link ProfileOptions.profile} or {@link ProfileOptions.configFile},
|
|
61
|
+
* which would have nothing to read.
|
|
62
|
+
*/
|
|
63
|
+
noProfile?: boolean;
|
|
64
|
+
/**
|
|
65
|
+
* Disable overlaying DATABRICKS_* environment variables.
|
|
66
|
+
*/
|
|
67
|
+
disableEnv?: boolean;
|
|
71
68
|
}
|
|
72
69
|
/**
|
|
73
70
|
* Reserved INI section name for SDK settings. It is never treated as a
|
|
74
71
|
* profile.
|
|
75
72
|
*/
|
|
76
|
-
|
|
73
|
+
declare const SETTINGS_SECTION = "__settings__";
|
|
77
74
|
/**
|
|
78
75
|
* Maps a {@link Profile} field to its environment variable and INI key,
|
|
79
76
|
* with typed getter and setter closures. This avoids reflection while
|
|
80
77
|
* keeping the mapping declarative, matching the Go SDK's approach.
|
|
81
78
|
*/
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
79
|
+
interface PropertyDef {
|
|
80
|
+
/** The Profile field name this property maps to. */
|
|
81
|
+
readonly field: keyof Profile;
|
|
82
|
+
readonly envVar: string;
|
|
83
|
+
readonly iniKey: string;
|
|
84
|
+
/** Sets the profile field from a raw INI/env string value. */
|
|
85
|
+
readonly set: (profile: Profile, raw: string) => void;
|
|
86
|
+
/** Returns the profile field as a string, or undefined if unset. */
|
|
87
|
+
readonly get: (profile: Profile) => string | undefined;
|
|
91
88
|
}
|
|
92
89
|
/**
|
|
93
90
|
* Declarative property mapping table for all known profile fields.
|
|
94
91
|
*/
|
|
95
|
-
|
|
92
|
+
declare const PROPERTY_DEFS: readonly PropertyDef[];
|
|
93
|
+
//#endregion
|
|
94
|
+
export { PROPERTY_DEFS, Profile, ProfileOptions, PropertyDef, SETTINGS_SECTION };
|
|
96
95
|
//# sourceMappingURL=profile.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profile.d.ts","
|
|
1
|
+
{"version":3,"file":"profile.d.ts","names":[],"sources":["../../src/profiles/profile.ts"],"mappings":";;;;;;;;UAaiB,OAAA;EAKf;EAHA,IAAA;EAaA;EAVA,IAAA;EAaQ;;;;;EANR,WAAA;EAwBA;EArBA,SAAA;EAqBc;EAlBd,KAAA,GAAQ,MAAA;EA6BO;EA1Bf,QAAA;;EAGA,QAAA;EA6BA;EA1BA,YAAA,GAAe,MAAA;EAuCf;EApCA,iBAAA;EAyCU;;AAOZ;;EA1CE,KAAA,GAAQ,MAAA;AAAA;;AAqDV;;;;;;;UA1CiB,cAAA;EA4CN;;;;;EAtCT,OAAA;EA0Ce;;;;EApCf,UAAA;EAsC+B;;AAMjC;;;EArCE,SAAA;EAqC8C;;;EAhC9C,UAAA;AAAA;;;;;cAOW,gBAAA;;;;;;UAWI,WAAA;;WAEN,KAAA,QAAa,OAAA;EAAA,SACb,MAAA;EAAA,SACA,MAAA;;WAEA,GAAA,GAAM,OAAA,EAAS,OAAA,EAAS,GAAA;;WAExB,GAAA,GAAM,OAAA,EAAS,OAAA;AAAA;;;;cAMb,aAAA,WAAwB,WAAA"}
|