@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.
Files changed (135) hide show
  1. package/dist/apierror/apierror.d.ts +52 -49
  2. package/dist/apierror/apierror.d.ts.map +1 -1
  3. package/dist/apierror/apierror.js +124 -172
  4. package/dist/apierror/apierror.js.map +1 -1
  5. package/dist/apierror/codes/codes.d.ts +113 -113
  6. package/dist/apierror/codes/codes.d.ts.map +1 -1
  7. package/dist/apierror/codes/codes.js +24 -115
  8. package/dist/apierror/codes/codes.js.map +1 -1
  9. package/dist/apierror/codes/index.d.ts +2 -7
  10. package/dist/apierror/codes/index.js +3 -7
  11. package/dist/apierror/details.d.ts +104 -101
  12. package/dist/apierror/details.d.ts.map +1 -1
  13. package/dist/apierror/details.js +151 -226
  14. package/dist/apierror/details.js.map +1 -1
  15. package/dist/apierror/index.d.ts +3 -8
  16. package/dist/apierror/index.js +3 -7
  17. package/dist/clientinfo/agent.d.ts +6 -3
  18. package/dist/clientinfo/agent.d.ts.map +1 -1
  19. package/dist/clientinfo/agent.js +134 -112
  20. package/dist/clientinfo/agent.js.map +1 -1
  21. package/dist/clientinfo/base.d.ts +13 -15
  22. package/dist/clientinfo/base.d.ts.map +1 -1
  23. package/dist/clientinfo/base.js +50 -50
  24. package/dist/clientinfo/base.js.map +1 -1
  25. package/dist/clientinfo/clientinfo.d.ts +40 -38
  26. package/dist/clientinfo/clientinfo.d.ts.map +1 -1
  27. package/dist/clientinfo/clientinfo.js +78 -88
  28. package/dist/clientinfo/clientinfo.js.map +1 -1
  29. package/dist/clientinfo/default.browser.d.ts +6 -10
  30. package/dist/clientinfo/default.browser.d.ts.map +1 -1
  31. package/dist/clientinfo/default.browser.js +24 -16
  32. package/dist/clientinfo/default.browser.js.map +1 -1
  33. package/dist/clientinfo/default.d.ts +8 -4
  34. package/dist/clientinfo/default.d.ts.map +1 -1
  35. package/dist/clientinfo/default.js +157 -102
  36. package/dist/clientinfo/default.js.map +1 -1
  37. package/dist/clientinfo/index.browser.d.ts +4 -5
  38. package/dist/clientinfo/index.browser.js +5 -4
  39. package/dist/clientinfo/index.d.ts +4 -5
  40. package/dist/clientinfo/index.js +5 -4
  41. package/dist/clientinfo/meta-harness.d.ts +6 -3
  42. package/dist/clientinfo/meta-harness.d.ts.map +1 -1
  43. package/dist/clientinfo/meta-harness.js +30 -46
  44. package/dist/clientinfo/meta-harness.js.map +1 -1
  45. package/dist/http/http.d.ts +25 -22
  46. package/dist/http/http.d.ts.map +1 -1
  47. package/dist/http/http.js +24 -34
  48. package/dist/http/http.js.map +1 -1
  49. package/dist/http/index.d.ts +2 -8
  50. package/dist/http/index.js +3 -7
  51. package/dist/index.d.ts +1 -6
  52. package/dist/index.js +7 -5
  53. package/dist/index.js.map +1 -1
  54. package/dist/logger/index.d.ts +2 -8
  55. package/dist/logger/index.js +3 -7
  56. package/dist/logger/logger.d.ts +26 -23
  57. package/dist/logger/logger.d.ts.map +1 -1
  58. package/dist/logger/logger.js +46 -60
  59. package/dist/logger/logger.js.map +1 -1
  60. package/dist/ops/execute.d.ts +7 -3
  61. package/dist/ops/execute.d.ts.map +1 -1
  62. package/dist/ops/execute.js +55 -67
  63. package/dist/ops/execute.js.map +1 -1
  64. package/dist/ops/index.d.ts +5 -12
  65. package/dist/ops/index.js +4 -9
  66. package/dist/ops/limiter.d.ts +5 -2
  67. package/dist/ops/limiter.d.ts.map +1 -1
  68. package/dist/ops/limiter.js +0 -2
  69. package/dist/ops/options.d.ts +23 -19
  70. package/dist/ops/options.d.ts.map +1 -1
  71. package/dist/ops/options.js +0 -2
  72. package/dist/ops/retrier.d.ts +34 -31
  73. package/dist/ops/retrier.d.ts.map +1 -1
  74. package/dist/ops/retrier.js +55 -66
  75. package/dist/ops/retrier.js.map +1 -1
  76. package/dist/package.js +6 -0
  77. package/dist/package.js.map +1 -0
  78. package/dist/profiles/errors.d.ts +7 -4
  79. package/dist/profiles/errors.d.ts.map +1 -1
  80. package/dist/profiles/errors.js +16 -17
  81. package/dist/profiles/errors.js.map +1 -1
  82. package/dist/profiles/index.browser.d.ts +4 -10
  83. package/dist/profiles/index.browser.js +4 -8
  84. package/dist/profiles/index.d.ts +5 -15
  85. package/dist/profiles/index.js +5 -13
  86. package/dist/profiles/ini.d.ts +6 -3
  87. package/dist/profiles/ini.d.ts.map +1 -1
  88. package/dist/profiles/ini.js +60 -108
  89. package/dist/profiles/ini.js.map +1 -1
  90. package/dist/profiles/profile.d.ts +66 -67
  91. package/dist/profiles/profile.d.ts.map +1 -1
  92. package/dist/profiles/profile.js +89 -84
  93. package/dist/profiles/profile.js.map +1 -1
  94. package/dist/profiles/resolve.d.ts +8 -9
  95. package/dist/profiles/resolve.d.ts.map +1 -1
  96. package/dist/profiles/resolve.js +140 -185
  97. package/dist/profiles/resolve.js.map +1 -1
  98. package/dist/profiles/secret.d.ts +15 -12
  99. package/dist/profiles/secret.d.ts.map +1 -1
  100. package/dist/profiles/secret.js +38 -35
  101. package/dist/profiles/secret.js.map +1 -1
  102. package/dist/wkt/fieldmask.d.ts +23 -20
  103. package/dist/wkt/fieldmask.d.ts.map +1 -1
  104. package/dist/wkt/fieldmask.js +53 -62
  105. package/dist/wkt/fieldmask.js.map +1 -1
  106. package/dist/wkt/index.d.ts +3 -4
  107. package/dist/wkt/index.js +3 -2
  108. package/dist/wkt/value.d.ts +6 -3
  109. package/dist/wkt/value.d.ts.map +1 -1
  110. package/dist/wkt/value.js +0 -2
  111. package/package.json +2 -2
  112. package/dist/apierror/codes/index.d.ts.map +0 -1
  113. package/dist/apierror/codes/index.js.map +0 -1
  114. package/dist/apierror/index.d.ts.map +0 -1
  115. package/dist/apierror/index.js.map +0 -1
  116. package/dist/clientinfo/index.browser.d.ts.map +0 -1
  117. package/dist/clientinfo/index.browser.js.map +0 -1
  118. package/dist/clientinfo/index.d.ts.map +0 -1
  119. package/dist/clientinfo/index.js.map +0 -1
  120. package/dist/http/index.d.ts.map +0 -1
  121. package/dist/http/index.js.map +0 -1
  122. package/dist/index.d.ts.map +0 -1
  123. package/dist/logger/index.d.ts.map +0 -1
  124. package/dist/logger/index.js.map +0 -1
  125. package/dist/ops/index.d.ts.map +0 -1
  126. package/dist/ops/index.js.map +0 -1
  127. package/dist/ops/limiter.js.map +0 -1
  128. package/dist/ops/options.js.map +0 -1
  129. package/dist/profiles/index.browser.d.ts.map +0 -1
  130. package/dist/profiles/index.browser.js.map +0 -1
  131. package/dist/profiles/index.d.ts.map +0 -1
  132. package/dist/profiles/index.js.map +0 -1
  133. package/dist/wkt/index.d.ts.map +0 -1
  134. package/dist/wkt/index.js.map +0 -1
  135. package/dist/wkt/value.js.map +0 -1
@@ -1,10 +1,14 @@
1
- import type { Options } from './options';
1
+ import { Options } from "./options.js";
2
+
3
+ //#region src/ops/execute.d.ts
2
4
  /**
3
5
  * Sleeps for the given duration. It is mostly equivalent to setTimeout, but
4
6
  * can be interrupted by the AbortSignal if the signal aborts before the
5
7
  * duration elapses.
6
8
  */
7
- export declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
9
+ declare function sleep(ms: number, signal?: AbortSignal): Promise<void>;
8
10
  /** Executes operation op with the given options. */
9
- export declare function execute(signal: AbortSignal | undefined, op: (signal?: AbortSignal) => Promise<void>, options?: Options): Promise<void>;
11
+ declare function execute(signal: AbortSignal | undefined, op: (signal?: AbortSignal) => Promise<void>, options?: Options): Promise<void>;
12
+ //#endregion
13
+ export { execute, sleep };
10
14
  //# sourceMappingURL=execute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/ops/execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAQvC;;;;GAIG;AACH,wBAAgB,KAAK,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAoBrE;AAKD,oDAAoD;AACpD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,WAAW,GAAG,SAAS,EAC/B,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,IAAI,CAAC,EAC3C,OAAO,CAAC,EAAE,OAAO,GAChB,OAAO,CAAC,IAAI,CAAC,CAGf"}
1
+ {"version":3,"file":"execute.d.ts","names":[],"sources":["../../src/ops/execute.ts"],"mappings":";;;;;AAaA;;;iBAAgB,KAAA,CAAM,EAAA,UAAY,MAAA,GAAS,WAAA,GAAc,OAAA;;iBA0BnC,OAAA,CACpB,MAAA,EAAQ,WAAA,cACR,EAAA,GAAK,MAAA,GAAS,WAAA,KAAgB,OAAA,QAC9B,OAAA,GAAU,OAAA,GACT,OAAA"}
@@ -1,77 +1,65 @@
1
- // Coerces an unknown value to an Error instance.
1
+ //#region src/ops/execute.ts
2
2
  function toError(value) {
3
- return value instanceof Error ? value : new Error(String(value));
3
+ return value instanceof Error ? value : new Error(String(value));
4
4
  }
5
5
  /**
6
- * Sleeps for the given duration. It is mostly equivalent to setTimeout, but
7
- * can be interrupted by the AbortSignal if the signal aborts before the
8
- * duration elapses.
9
- */
10
- export function sleep(ms, signal) {
11
- return new Promise((resolve, reject) => {
12
- if (signal?.aborted === true) {
13
- reject(toError(signal.reason));
14
- return;
15
- }
16
- if (signal === undefined) {
17
- setTimeout(resolve, ms);
18
- return;
19
- }
20
- const onAbort = () => {
21
- clearTimeout(timer);
22
- reject(toError(signal.reason));
23
- };
24
- const timer = setTimeout(() => {
25
- signal.removeEventListener('abort', onAbort);
26
- resolve();
27
- }, ms);
28
- signal.addEventListener('abort', onAbort, { once: true });
29
- });
6
+ * Sleeps for the given duration. It is mostly equivalent to setTimeout, but
7
+ * can be interrupted by the AbortSignal if the signal aborts before the
8
+ * duration elapses.
9
+ */
10
+ function sleep(ms, signal) {
11
+ return new Promise((resolve, reject) => {
12
+ if (signal?.aborted === true) {
13
+ reject(toError(signal.reason));
14
+ return;
15
+ }
16
+ if (signal === void 0) {
17
+ setTimeout(resolve, ms);
18
+ return;
19
+ }
20
+ const onAbort = () => {
21
+ clearTimeout(timer);
22
+ reject(toError(signal.reason));
23
+ };
24
+ const timer = setTimeout(() => {
25
+ signal.removeEventListener("abort", onAbort);
26
+ resolve();
27
+ }, ms);
28
+ signal.addEventListener("abort", onAbort, { once: true });
29
+ });
30
30
  }
31
31
  /** Executes operation op with the given options. */
32
- export async function execute(signal, op, options) {
33
- const opts = { ...options };
34
- return executeImpl(signal, op, opts, sleep);
32
+ async function execute(signal, op, options) {
33
+ return executeImpl(signal, op, { ...options }, sleep);
35
34
  }
36
35
  /**
37
- * The actual implementation of execute. Its purpose is to ease testing by
38
- * providing a convenient way to mock the sleeping logic.
39
- */
36
+ * The actual implementation of execute. Its purpose is to ease testing by
37
+ * providing a convenient way to mock the sleeping logic.
38
+ */
40
39
  async function executeImpl(signal, op, opts, sleep) {
41
- // Optionally combine the signal with a timeout signal. If the signal
42
- // already has a deadline, that deadline is updated to the minimum of the
43
- // signal's deadline and the timeout.
44
- if (opts.timeout !== undefined && opts.timeout > 0) {
45
- const timeoutSignal = AbortSignal.timeout(opts.timeout);
46
- signal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
47
- }
48
- // Get a new retrier for this specific execution. This is instantiated
49
- // lazily if and when the first operation execution returns an error.
50
- let retrier;
51
- for (;;) {
52
- if (opts.rateLimiter) {
53
- await opts.rateLimiter.wait(signal);
54
- }
55
- try {
56
- await op(signal);
57
- return; // Nothing to retry.
58
- }
59
- catch (err) {
60
- const error = toError(err);
61
- if (retrier === undefined) {
62
- if (opts.retrier) {
63
- retrier = opts.retrier(); // Lazily instantiate the retrier.
64
- }
65
- if (retrier === undefined) {
66
- throw error; // No retrier == no retry.
67
- }
68
- }
69
- const delay = retrier.isRetriable(error);
70
- if (delay === undefined) {
71
- throw error; // Not retriable.
72
- }
73
- await sleep(delay, signal);
74
- }
75
- }
40
+ if (opts.timeout !== void 0 && opts.timeout > 0) {
41
+ const timeoutSignal = AbortSignal.timeout(opts.timeout);
42
+ signal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;
43
+ }
44
+ let retrier;
45
+ for (;;) {
46
+ if (opts.rateLimiter) await opts.rateLimiter.wait(signal);
47
+ try {
48
+ await op(signal);
49
+ return;
50
+ } catch (err) {
51
+ const error = toError(err);
52
+ if (retrier === void 0) {
53
+ if (opts.retrier) retrier = opts.retrier();
54
+ if (retrier === void 0) throw error;
55
+ }
56
+ const delay = retrier.isRetriable(error);
57
+ if (delay === void 0) throw error;
58
+ await sleep(delay, signal);
59
+ }
60
+ }
76
61
  }
62
+
63
+ //#endregion
64
+ export { execute, sleep };
77
65
  //# sourceMappingURL=execute.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"execute.js","sourceRoot":"","sources":["../../src/ops/execute.ts"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"execute.js","names":[],"sources":["../../src/ops/execute.ts"],"sourcesContent":["import type {Options} from './options';\nimport type {Retrier} from './retrier';\n\n// Coerces an unknown value to an Error instance.\nfunction toError(value: unknown): Error {\n return value instanceof Error ? value : new Error(String(value));\n}\n\n/**\n * Sleeps for the given duration. It is mostly equivalent to setTimeout, but\n * can be interrupted by the AbortSignal if the signal aborts before the\n * duration elapses.\n */\nexport function sleep(ms: number, signal?: AbortSignal): Promise<void> {\n return new Promise<void>((resolve, reject) => {\n if (signal?.aborted === true) {\n reject(toError(signal.reason));\n return;\n }\n if (signal === undefined) {\n setTimeout(resolve, ms);\n return;\n }\n const onAbort = (): void => {\n clearTimeout(timer);\n reject(toError(signal.reason));\n };\n const timer = setTimeout(() => {\n signal.removeEventListener('abort', onAbort);\n resolve();\n }, ms);\n signal.addEventListener('abort', onAbort, {once: true});\n });\n}\n\n// Sleeper is a convenience type for readability.\ntype Sleeper = (ms: number, signal?: AbortSignal) => Promise<void>;\n\n/** Executes operation op with the given options. */\nexport async function execute(\n signal: AbortSignal | undefined,\n op: (signal?: AbortSignal) => Promise<void>,\n options?: Options\n): Promise<void> {\n const opts: Options = {...options};\n return executeImpl(signal, op, opts, sleep);\n}\n\n/**\n * The actual implementation of execute. Its purpose is to ease testing by\n * providing a convenient way to mock the sleeping logic.\n */\nasync function executeImpl(\n signal: AbortSignal | undefined,\n op: (signal?: AbortSignal) => Promise<void>,\n opts: Options,\n sleep: Sleeper\n): Promise<void> {\n // Optionally combine the signal with a timeout signal. If the signal\n // already has a deadline, that deadline is updated to the minimum of the\n // signal's deadline and the timeout.\n if (opts.timeout !== undefined && opts.timeout > 0) {\n const timeoutSignal = AbortSignal.timeout(opts.timeout);\n signal = signal ? AbortSignal.any([signal, timeoutSignal]) : timeoutSignal;\n }\n\n // Get a new retrier for this specific execution. This is instantiated\n // lazily if and when the first operation execution returns an error.\n let retrier: Retrier | undefined;\n\n for (;;) {\n if (opts.rateLimiter) {\n await opts.rateLimiter.wait(signal);\n }\n\n try {\n await op(signal);\n return; // Nothing to retry.\n } catch (err: unknown) {\n const error = toError(err);\n\n if (retrier === undefined) {\n if (opts.retrier) {\n retrier = opts.retrier(); // Lazily instantiate the retrier.\n }\n if (retrier === undefined) {\n throw error; // No retrier == no retry.\n }\n }\n\n const delay = retrier.isRetriable(error);\n if (delay === undefined) {\n throw error; // Not retriable.\n }\n\n await sleep(delay, signal);\n }\n }\n}\n"],"mappings":";AAIA,SAAS,QAAQ,OAAuB;AACtC,QAAO,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,OAAO,MAAM,CAAC;;;;;;;AAQlE,SAAgB,MAAM,IAAY,QAAqC;AACrE,QAAO,IAAI,SAAe,SAAS,WAAW;AAC5C,MAAI,QAAQ,YAAY,MAAM;AAC5B,UAAO,QAAQ,OAAO,OAAO,CAAC;AAC9B;;AAEF,MAAI,WAAW,QAAW;AACxB,cAAW,SAAS,GAAG;AACvB;;EAEF,MAAM,gBAAsB;AAC1B,gBAAa,MAAM;AACnB,UAAO,QAAQ,OAAO,OAAO,CAAC;;EAEhC,MAAM,QAAQ,iBAAiB;AAC7B,UAAO,oBAAoB,SAAS,QAAQ;AAC5C,YAAS;KACR,GAAG;AACN,SAAO,iBAAiB,SAAS,SAAS,EAAC,MAAM,MAAK,CAAC;GACvD;;;AAOJ,eAAsB,QACpB,QACA,IACA,SACe;AAEf,QAAO,YAAY,QAAQ,IADL,EAAC,GAAG,SAAQ,EACG,MAAM;;;;;;AAO7C,eAAe,YACb,QACA,IACA,MACA,OACe;AAIf,KAAI,KAAK,YAAY,UAAa,KAAK,UAAU,GAAG;EAClD,MAAM,gBAAgB,YAAY,QAAQ,KAAK,QAAQ;AACvD,WAAS,SAAS,YAAY,IAAI,CAAC,QAAQ,cAAc,CAAC,GAAG;;CAK/D,IAAI;AAEJ,UAAS;AACP,MAAI,KAAK,YACP,OAAM,KAAK,YAAY,KAAK,OAAO;AAGrC,MAAI;AACF,SAAM,GAAG,OAAO;AAChB;WACO,KAAc;GACrB,MAAM,QAAQ,QAAQ,IAAI;AAE1B,OAAI,YAAY,QAAW;AACzB,QAAI,KAAK,QACP,WAAU,KAAK,SAAS;AAE1B,QAAI,YAAY,OACd,OAAM;;GAIV,MAAM,QAAQ,QAAQ,YAAY,MAAM;AACxC,OAAI,UAAU,OACZ,OAAM;AAGR,SAAM,MAAM,OAAO,OAAO"}
@@ -1,12 +1,5 @@
1
- /**
2
- * Utilities to execute Databricks operations with retry, timeout, and rate
3
- * limiting.
4
- *
5
- * @packageDocumentation
6
- */
7
- export { execute } from './execute';
8
- export type { Limiter } from './limiter';
9
- export type { Options } from './options';
10
- export { BackoffPolicy, retryOn } from './retrier';
11
- export type { BackoffPolicyOptions, Retrier } from './retrier';
12
- //# sourceMappingURL=index.d.ts.map
1
+ import { Limiter } from "./limiter.js";
2
+ import { BackoffPolicy, BackoffPolicyOptions, Retrier, retryOn } from "./retrier.js";
3
+ import { Options } from "./options.js";
4
+ import { execute } from "./execute.js";
5
+ export { BackoffPolicy, type BackoffPolicyOptions, type Limiter, type Options, type Retrier, execute, retryOn };
package/dist/ops/index.js CHANGED
@@ -1,9 +1,4 @@
1
- /**
2
- * Utilities to execute Databricks operations with retry, timeout, and rate
3
- * limiting.
4
- *
5
- * @packageDocumentation
6
- */
7
- export { execute } from './execute';
8
- export { BackoffPolicy, retryOn } from './retrier';
9
- //# sourceMappingURL=index.js.map
1
+ import { execute } from "./execute.js";
2
+ import { BackoffPolicy, retryOn } from "./retrier.js";
3
+
4
+ export { BackoffPolicy, execute, retryOn };
@@ -1,9 +1,12 @@
1
+ //#region src/ops/limiter.d.ts
1
2
  /**
2
3
  * Limiter is anything that can wait. It is typically used to implement
3
4
  * client-side rate limiting. Implementations of this interface must be
4
5
  * safe to call concurrently.
5
6
  */
6
- export interface Limiter {
7
- wait(signal?: AbortSignal): Promise<void>;
7
+ interface Limiter {
8
+ wait(signal?: AbortSignal): Promise<void>;
8
9
  }
10
+ //#endregion
11
+ export { Limiter };
9
12
  //# sourceMappingURL=limiter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"limiter.d.ts","sourceRoot":"","sources":["../../src/ops/limiter.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,OAAO;IACtB,IAAI,CAAC,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C"}
1
+ {"version":3,"file":"limiter.d.ts","names":[],"sources":["../../src/ops/limiter.ts"],"mappings":";;AAKA;;;;UAAiB,OAAA;EACf,IAAA,CAAK,MAAA,GAAS,WAAA,GAAc,OAAA;AAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=limiter.js.map
@@ -1,22 +1,26 @@
1
- import type { Limiter } from './limiter';
2
- import type { Retrier } from './retrier';
1
+ import { Limiter } from "./limiter.js";
2
+ import { Retrier } from "./retrier.js";
3
+
4
+ //#region src/ops/options.d.ts
3
5
  /** Options that control the behavior of an operation. */
4
- export interface Options {
5
- /**
6
- * Provides a new Retrier to be used to execute an operation. The function
7
- * is called for each operation and must be safe to call concurrently. The
8
- * retrier must be fresh within the context of an execute call (e.g. no
9
- * need to reset a BackoffPolicy).
10
- */
11
- retrier?: (() => Retrier) | undefined;
12
- /** The rate limiter used to potentially rate limit the operation. */
13
- rateLimiter?: Limiter | undefined;
14
- /**
15
- * Timeout duration in milliseconds. If the signal already has a deadline,
16
- * that deadline is updated to the minimum of the signal's deadline and the
17
- * timeout. The timeout covers the whole operation execution; it is not a
18
- * timeout for each intermediary call.
19
- */
20
- timeout?: number | undefined;
6
+ interface Options {
7
+ /**
8
+ * Provides a new Retrier to be used to execute an operation. The function
9
+ * is called for each operation and must be safe to call concurrently. The
10
+ * retrier must be fresh within the context of an execute call (e.g. no
11
+ * need to reset a BackoffPolicy).
12
+ */
13
+ retrier?: (() => Retrier) | undefined;
14
+ /** The rate limiter used to potentially rate limit the operation. */
15
+ rateLimiter?: Limiter | undefined;
16
+ /**
17
+ * Timeout duration in milliseconds. If the signal already has a deadline,
18
+ * that deadline is updated to the minimum of the signal's deadline and the
19
+ * timeout. The timeout covers the whole operation execution; it is not a
20
+ * timeout for each intermediary call.
21
+ */
22
+ timeout?: number | undefined;
21
23
  }
24
+ //#endregion
25
+ export { Options };
22
26
  //# sourceMappingURL=options.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options.d.ts","sourceRoot":"","sources":["../../src/ops/options.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AACvC,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAEvC,yDAAyD;AACzD,MAAM,WAAW,OAAO;IACtB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,OAAO,CAAC,GAAG,SAAS,CAAC;IACtC,qEAAqE;IACrE,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAClC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9B"}
1
+ {"version":3,"file":"options.d.ts","names":[],"sources":["../../src/ops/options.ts"],"mappings":";;;;;UAIiB,OAAA;EAAA;;;;;;EAOf,OAAA,UAAiB,OAAA;EAEH;EAAd,WAAA,GAAc,OAAA;EAOP;;;;;;EAAP,OAAA;AAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=options.js.map
@@ -1,17 +1,18 @@
1
+ //#region src/ops/retrier.d.ts
1
2
  /** Options for configuring a {@link BackoffPolicy}. */
2
- export interface BackoffPolicyOptions {
3
- /** Initial delay in milliseconds; defaults to 1000. */
4
- initial?: number;
5
- /** Maximum delay in milliseconds; defaults to 60000. */
6
- maximum?: number;
7
- /**
8
- * Factor by which the delay is multiplied after each retry. The value must
9
- * be greater or equal to 1. If not, it defaults to 2.
10
- */
11
- factor?: number;
3
+ interface BackoffPolicyOptions {
4
+ /** Initial delay in milliseconds; defaults to 1000. */
5
+ initial?: number;
6
+ /** Maximum delay in milliseconds; defaults to 60000. */
7
+ maximum?: number;
8
+ /**
9
+ * Factor by which the delay is multiplied after each retry. The value must
10
+ * be greater or equal to 1. If not, it defaults to 2.
11
+ */
12
+ factor?: number;
12
13
  }
13
- export declare const rand: {
14
- int(n: number): number;
14
+ declare const rand: {
15
+ int(n: number): number;
15
16
  };
16
17
  /**
17
18
  * BackoffPolicy implements an exponential backoff policy. The delay between
@@ -25,26 +26,26 @@ export declare const rand: {
25
26
  *
26
27
  * [Exponential Backoff And Jitter]: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
27
28
  */
28
- export declare class BackoffPolicy {
29
- /** Initial delay in milliseconds. */
30
- readonly initial: number;
31
- /** Maximum delay in milliseconds. */
32
- readonly maximum: number;
33
- /** Factor by which the delay is multiplied after each retry. */
34
- readonly factor: number;
35
- private current;
36
- constructor(options?: BackoffPolicyOptions);
37
- /** Returns a random delay in [0, current] and grows the current delay. */
38
- delay(): number;
29
+ declare class BackoffPolicy {
30
+ /** Initial delay in milliseconds. */
31
+ readonly initial: number;
32
+ /** Maximum delay in milliseconds. */
33
+ readonly maximum: number;
34
+ /** Factor by which the delay is multiplied after each retry. */
35
+ readonly factor: number;
36
+ private current;
37
+ constructor(options?: BackoffPolicyOptions);
38
+ /** Returns a random delay in [0, current] and grows the current delay. */
39
+ delay(): number;
39
40
  }
40
41
  /** Retrier defines a retry behavior. */
41
- export interface Retrier {
42
- /**
43
- * Returns the delay in milliseconds before the next retry, or undefined if
44
- * the error is not retriable. Implementations should assume that the given
45
- * error is never undefined.
46
- */
47
- isRetriable(err: Error): number | undefined;
42
+ interface Retrier {
43
+ /**
44
+ * Returns the delay in milliseconds before the next retry, or undefined if
45
+ * the error is not retriable. Implementations should assume that the given
46
+ * error is never undefined.
47
+ */
48
+ isRetriable(err: Error): number | undefined;
48
49
  }
49
50
  /**
50
51
  * Returns a Retrier that retries based on the isRetriable predicate and relies
@@ -54,5 +55,7 @@ export interface Retrier {
54
55
  * reset by design. Users who need to reset the backoff policy should rather
55
56
  * create a new retrier.
56
57
  */
57
- export declare function retryOn(options: BackoffPolicyOptions, isRetriable: (err: Error) => boolean): Retrier;
58
+ declare function retryOn(options: BackoffPolicyOptions, isRetriable: (err: Error) => boolean): Retrier;
59
+ //#endregion
60
+ export { BackoffPolicy, BackoffPolicyOptions, Retrier, rand, retryOn };
58
61
  //# sourceMappingURL=retrier.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrier.d.ts","sourceRoot":"","sources":["../../src/ops/retrier.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,WAAW,oBAAoB;IACnC,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,wDAAwD;IACxD,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAGD,eAAO,MAAM,IAAI;WAER,MAAM,GAAG,MAAM;CAGvB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;IACxB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAGxB,OAAO,CAAC,OAAO,CAAS;gBAEZ,OAAO,CAAC,EAAE,oBAAoB;IAgB1C,0EAA0E;IAC1E,KAAK,IAAI,MAAM;CAShB;AAED,wCAAwC;AACxC,MAAM,WAAW,OAAO;IACtB;;;;OAIG;IACH,WAAW,CAAC,GAAG,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,CAAC;CAC7C;AAED;;;;;;;GAOG;AACH,wBAAgB,OAAO,CACrB,OAAO,EAAE,oBAAoB,EAC7B,WAAW,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,OAAO,GACnC,OAAO,CAUT"}
1
+ {"version":3,"file":"retrier.d.ts","names":[],"sources":["../../src/ops/retrier.ts"],"mappings":";;UACiB,oBAAA;EAAoB;EAEnC,OAAA;EAFmC;EAKnC,OAAA;EAAA;;;;EAMA,MAAA;AAAA;AAAA,cAIW,IAAA;EAKZ,GAAA,CAAA,CAAA;AAAA;AAcD;;;;;;;;;;;;AAAA,cAAa,aAAA;EA8BN;EAAA,SA5BI,OAAA;EAwCa;EAAA,SArCb,OAAA;EA2Ca;EAAA,SAxCb,MAAA;EAAA,QAGD,OAAA;cAEI,OAAA,GAAU,oBAAA;EAmCA;EAlBtB,KAAA,CAAA;AAAA;;UAYe,OAAA;EAkBN;;;;;EAZT,WAAA,CAAY,GAAA,EAAK,KAAA;AAAA;;;;;;;;;iBAWH,OAAA,CACd,OAAA,EAAS,oBAAA,EACT,WAAA,GAAc,GAAA,EAAK,KAAA,eAClB,OAAA"}
@@ -1,70 +1,59 @@
1
- // Random number generation, wrapped in an object for testability.
2
- export const rand = {
3
- // Returns a random integer in [0, n).
4
- int(n) {
5
- return Math.floor(Math.random() * n);
6
- },
7
- };
1
+ //#region src/ops/retrier.ts
2
+ const rand = { int(n) {
3
+ return Math.floor(Math.random() * n);
4
+ } };
8
5
  /**
9
- * BackoffPolicy implements an exponential backoff policy. The delay between
10
- * retries is randomly computed between 0 and the "exponential delay" as
11
- * recommended in [Exponential Backoff And Jitter]. The retry delay starts from
12
- * initial and grows exponentially by factor at every retry. The maximum retry
13
- * delay is capped by maximum.
14
- *
15
- * There is no parameter to limit the number of retries. This is intended as
16
- * such logic should be implemented upstream (e.g. in a Retrier).
17
- *
18
- * [Exponential Backoff And Jitter]: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
19
- */
20
- export class BackoffPolicy {
21
- /** Initial delay in milliseconds. */
22
- initial;
23
- /** Maximum delay in milliseconds. */
24
- maximum;
25
- /** Factor by which the delay is multiplied after each retry. */
26
- factor;
27
- // Current delay before the next retry.
28
- current;
29
- constructor(options) {
30
- let initial = options?.initial ?? 1000; // Default initial delay of 1 second.
31
- const maximum = options?.maximum ?? 60000; // Default maximum delay of 60 seconds.
32
- if (initial > maximum) {
33
- // Initial cannot be greater than maximum.
34
- initial = maximum;
35
- }
36
- this.initial = initial;
37
- this.maximum = maximum;
38
- this.factor =
39
- options?.factor !== undefined && options.factor >= 1 ? options.factor : 2;
40
- this.current = this.initial;
41
- }
42
- /** Returns a random delay in [0, current] and grows the current delay. */
43
- delay() {
44
- // Random duration in the range [0, this.current].
45
- const d = rand.int(this.current + 1);
46
- // Grow delay for the next call.
47
- this.current = Math.min(this.current * this.factor, this.maximum);
48
- return d;
49
- }
50
- }
6
+ * BackoffPolicy implements an exponential backoff policy. The delay between
7
+ * retries is randomly computed between 0 and the "exponential delay" as
8
+ * recommended in [Exponential Backoff And Jitter]. The retry delay starts from
9
+ * initial and grows exponentially by factor at every retry. The maximum retry
10
+ * delay is capped by maximum.
11
+ *
12
+ * There is no parameter to limit the number of retries. This is intended as
13
+ * such logic should be implemented upstream (e.g. in a Retrier).
14
+ *
15
+ * [Exponential Backoff And Jitter]: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/
16
+ */
17
+ var BackoffPolicy = class {
18
+ /** Initial delay in milliseconds. */
19
+ initial;
20
+ /** Maximum delay in milliseconds. */
21
+ maximum;
22
+ /** Factor by which the delay is multiplied after each retry. */
23
+ factor;
24
+ current;
25
+ constructor(options) {
26
+ let initial = options?.initial ?? 1e3;
27
+ const maximum = options?.maximum ?? 6e4;
28
+ if (initial > maximum) initial = maximum;
29
+ this.initial = initial;
30
+ this.maximum = maximum;
31
+ this.factor = options?.factor !== void 0 && options.factor >= 1 ? options.factor : 2;
32
+ this.current = this.initial;
33
+ }
34
+ /** Returns a random delay in [0, current] and grows the current delay. */
35
+ delay() {
36
+ const d = rand.int(this.current + 1);
37
+ this.current = Math.min(this.current * this.factor, this.maximum);
38
+ return d;
39
+ }
40
+ };
51
41
  /**
52
- * Returns a Retrier that retries based on the isRetriable predicate and relies
53
- * on an internal backoff policy to decide how long to wait between retries.
54
- *
55
- * Important: the retrier has its own backoff policy which cannot be trivially
56
- * reset by design. Users who need to reset the backoff policy should rather
57
- * create a new retrier.
58
- */
59
- export function retryOn(options, isRetriable) {
60
- const bp = new BackoffPolicy(options);
61
- return {
62
- isRetriable(err) {
63
- if (!isRetriable(err)) {
64
- return undefined;
65
- }
66
- return bp.delay();
67
- },
68
- };
42
+ * Returns a Retrier that retries based on the isRetriable predicate and relies
43
+ * on an internal backoff policy to decide how long to wait between retries.
44
+ *
45
+ * Important: the retrier has its own backoff policy which cannot be trivially
46
+ * reset by design. Users who need to reset the backoff policy should rather
47
+ * create a new retrier.
48
+ */
49
+ function retryOn(options, isRetriable) {
50
+ const bp = new BackoffPolicy(options);
51
+ return { isRetriable(err) {
52
+ if (!isRetriable(err)) return;
53
+ return bp.delay();
54
+ } };
69
55
  }
56
+
57
+ //#endregion
58
+ export { BackoffPolicy, rand, retryOn };
70
59
  //# sourceMappingURL=retrier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"retrier.js","sourceRoot":"","sources":["../../src/ops/retrier.ts"],"names":[],"mappings":"AAeA,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,sCAAsC;IACtC,GAAG,CAAC,CAAS;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACvC,CAAC;CACF,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,MAAM,OAAO,aAAa;IACxB,qCAAqC;IAC5B,OAAO,CAAS;IAEzB,qCAAqC;IAC5B,OAAO,CAAS;IAEzB,gEAAgE;IACvD,MAAM,CAAS;IAExB,uCAAuC;IAC/B,OAAO,CAAS;IAExB,YAAY,OAA8B;QACxC,IAAI,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,IAAI,CAAC,CAAC,qCAAqC;QAC7E,MAAM,OAAO,GAAG,OAAO,EAAE,OAAO,IAAI,KAAK,CAAC,CAAC,uCAAuC;QAElF,IAAI,OAAO,GAAG,OAAO,EAAE,CAAC;YACtB,0CAA0C;YAC1C,OAAO,GAAG,OAAO,CAAC;QACpB,CAAC;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,MAAM;YACT,OAAO,EAAE,MAAM,KAAK,SAAS,IAAI,OAAO,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5E,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;IAC9B,CAAC;IAED,0EAA0E;IAC1E,KAAK;QACH,kDAAkD;QAClD,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QAErC,gCAAgC;QAChC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAElE,OAAO,CAAC,CAAC;IACX,CAAC;CACF;AAYD;;;;;;;GAOG;AACH,MAAM,UAAU,OAAO,CACrB,OAA6B,EAC7B,WAAoC;IAEpC,MAAM,EAAE,GAAG,IAAI,aAAa,CAAC,OAAO,CAAC,CAAC;IACtC,OAAO;QACL,WAAW,CAAC,GAAU;YACpB,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC;gBACtB,OAAO,SAAS,CAAC;YACnB,CAAC;YACD,OAAO,EAAE,CAAC,KAAK,EAAE,CAAC;QACpB,CAAC;KACF,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"retrier.js","names":[],"sources":["../../src/ops/retrier.ts"],"sourcesContent":["/** Options for configuring a {@link BackoffPolicy}. */\nexport interface BackoffPolicyOptions {\n /** Initial delay in milliseconds; defaults to 1000. */\n initial?: number;\n\n /** Maximum delay in milliseconds; defaults to 60000. */\n maximum?: number;\n\n /**\n * Factor by which the delay is multiplied after each retry. The value must\n * be greater or equal to 1. If not, it defaults to 2.\n */\n factor?: number;\n}\n\n// Random number generation, wrapped in an object for testability.\nexport const rand = {\n // Returns a random integer in [0, n).\n int(n: number): number {\n return Math.floor(Math.random() * n);\n },\n};\n\n/**\n * BackoffPolicy implements an exponential backoff policy. The delay between\n * retries is randomly computed between 0 and the \"exponential delay\" as\n * recommended in [Exponential Backoff And Jitter]. The retry delay starts from\n * initial and grows exponentially by factor at every retry. The maximum retry\n * delay is capped by maximum.\n *\n * There is no parameter to limit the number of retries. This is intended as\n * such logic should be implemented upstream (e.g. in a Retrier).\n *\n * [Exponential Backoff And Jitter]: https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/\n */\nexport class BackoffPolicy {\n /** Initial delay in milliseconds. */\n readonly initial: number;\n\n /** Maximum delay in milliseconds. */\n readonly maximum: number;\n\n /** Factor by which the delay is multiplied after each retry. */\n readonly factor: number;\n\n // Current delay before the next retry.\n private current: number;\n\n constructor(options?: BackoffPolicyOptions) {\n let initial = options?.initial ?? 1000; // Default initial delay of 1 second.\n const maximum = options?.maximum ?? 60000; // Default maximum delay of 60 seconds.\n\n if (initial > maximum) {\n // Initial cannot be greater than maximum.\n initial = maximum;\n }\n\n this.initial = initial;\n this.maximum = maximum;\n this.factor =\n options?.factor !== undefined && options.factor >= 1 ? options.factor : 2;\n this.current = this.initial;\n }\n\n /** Returns a random delay in [0, current] and grows the current delay. */\n delay(): number {\n // Random duration in the range [0, this.current].\n const d = rand.int(this.current + 1);\n\n // Grow delay for the next call.\n this.current = Math.min(this.current * this.factor, this.maximum);\n\n return d;\n }\n}\n\n/** Retrier defines a retry behavior. */\nexport interface Retrier {\n /**\n * Returns the delay in milliseconds before the next retry, or undefined if\n * the error is not retriable. Implementations should assume that the given\n * error is never undefined.\n */\n isRetriable(err: Error): number | undefined;\n}\n\n/**\n * Returns a Retrier that retries based on the isRetriable predicate and relies\n * on an internal backoff policy to decide how long to wait between retries.\n *\n * Important: the retrier has its own backoff policy which cannot be trivially\n * reset by design. Users who need to reset the backoff policy should rather\n * create a new retrier.\n */\nexport function retryOn(\n options: BackoffPolicyOptions,\n isRetriable: (err: Error) => boolean\n): Retrier {\n const bp = new BackoffPolicy(options);\n return {\n isRetriable(err: Error): number | undefined {\n if (!isRetriable(err)) {\n return undefined;\n }\n return bp.delay();\n },\n };\n}\n"],"mappings":";AAgBA,MAAa,OAAO,EAElB,IAAI,GAAmB;AACrB,QAAO,KAAK,MAAM,KAAK,QAAQ,GAAG,EAAE;GAEvC;;;;;;;;;;;;;AAcD,IAAa,gBAAb,MAA2B;;CAEzB,AAAS;;CAGT,AAAS;;CAGT,AAAS;CAGT,AAAQ;CAER,YAAY,SAAgC;EAC1C,IAAI,UAAU,SAAS,WAAW;EAClC,MAAM,UAAU,SAAS,WAAW;AAEpC,MAAI,UAAU,QAEZ,WAAU;AAGZ,OAAK,UAAU;AACf,OAAK,UAAU;AACf,OAAK,SACH,SAAS,WAAW,UAAa,QAAQ,UAAU,IAAI,QAAQ,SAAS;AAC1E,OAAK,UAAU,KAAK;;;CAItB,QAAgB;EAEd,MAAM,IAAI,KAAK,IAAI,KAAK,UAAU,EAAE;AAGpC,OAAK,UAAU,KAAK,IAAI,KAAK,UAAU,KAAK,QAAQ,KAAK,QAAQ;AAEjE,SAAO;;;;;;;;;;;AAsBX,SAAgB,QACd,SACA,aACS;CACT,MAAM,KAAK,IAAI,cAAc,QAAQ;AACrC,QAAO,EACL,YAAY,KAAgC;AAC1C,MAAI,CAAC,YAAY,IAAI,CACnB;AAEF,SAAO,GAAG,OAAO;IAEpB"}
@@ -0,0 +1,6 @@
1
+ //#region package.json
2
+ var version = "0.35.0";
3
+
4
+ //#endregion
5
+ export { version };
6
+ //# sourceMappingURL=package.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"package.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
@@ -1,17 +1,20 @@
1
+ //#region src/profiles/errors.d.ts
1
2
  /**
2
3
  * Error types for Databricks configuration profile operations.
3
4
  *
4
5
  * @module
5
6
  */
6
7
  /** Discriminant codes for {@link ProfileError}. */
7
- export type ProfileErrorCode = 'CONFIG_FILE_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'EMPTY_PATH' | 'EMPTY_PROFILE' | 'INVALID_PROFILE_NAME' | 'CONFLICTING_OPTIONS';
8
+ type ProfileErrorCode = 'CONFIG_FILE_NOT_FOUND' | 'PROFILE_NOT_FOUND' | 'EMPTY_PATH' | 'EMPTY_PROFILE' | 'INVALID_PROFILE_NAME' | 'CONFLICTING_OPTIONS';
8
9
  /**
9
10
  * Error thrown by profile operations.
10
11
  *
11
12
  * Use the {@link ProfileError.code} field to distinguish between error causes.
12
13
  */
13
- export declare class ProfileError extends Error {
14
- readonly code: ProfileErrorCode;
15
- constructor(code: ProfileErrorCode, message: string);
14
+ declare class ProfileError extends Error {
15
+ readonly code: ProfileErrorCode;
16
+ constructor(code: ProfileErrorCode, message: string);
16
17
  }
18
+ //#endregion
19
+ export { ProfileError, ProfileErrorCode };
17
20
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +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,GACtB,qBAAqB,CAAC;AAE1B;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;gBAEpB,IAAI,EAAE,gBAAgB,EAAE,OAAO,EAAE,MAAM;CAKpD"}
1
+ {"version":3,"file":"errors.d.ts","names":[],"sources":["../../src/profiles/errors.ts"],"mappings":";;AAOA;;;;;KAAY,gBAAA;;;;;;cAaC,YAAA,SAAqB,KAAA;EAAA,SACvB,IAAA,EAAM,gBAAA;cAEH,IAAA,EAAM,gBAAA,EAAkB,OAAA;AAAA"}
@@ -1,19 +1,18 @@
1
+ //#region src/profiles/errors.ts
1
2
  /**
2
- * Error types for Databricks configuration profile operations.
3
- *
4
- * @module
5
- */
6
- /**
7
- * Error thrown by profile operations.
8
- *
9
- * Use the {@link ProfileError.code} field to distinguish between error causes.
10
- */
11
- export class ProfileError extends Error {
12
- code;
13
- constructor(code, message) {
14
- super(message);
15
- this.name = 'ProfileError';
16
- this.code = code;
17
- }
18
- }
3
+ * Error thrown by profile operations.
4
+ *
5
+ * Use the {@link ProfileError.code} field to distinguish between error causes.
6
+ */
7
+ var ProfileError = class extends Error {
8
+ code;
9
+ constructor(code, message) {
10
+ super(message);
11
+ this.name = "ProfileError";
12
+ this.code = code;
13
+ }
14
+ };
15
+
16
+ //#endregion
17
+ export { ProfileError };
19
18
  //# sourceMappingURL=errors.js.map