@fabric-harness/databricks 5.0.0 → 5.2.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.
@@ -4,6 +4,11 @@ import { type DatabricksManagedResourceStore } from "./managed-resource.js";
4
4
  export interface DatabricksAssetBundleOptions {
5
5
  /** Directory containing the checked-in bundle's `databricks.yml`. */
6
6
  bundleDir: string;
7
+ /**
8
+ * Logical bundle name from the named `assetBundles` map; scopes the managed-resource identity so
9
+ * lifecycles sharing one durable store never overwrite each other's records.
10
+ */
11
+ instanceName?: string;
7
12
  /** Bundle target (dev/prod) passed through to the Databricks CLI. */
8
13
  target?: string;
9
14
  /** Databricks CLI profile. */
@@ -18,6 +23,20 @@ export interface DatabricksAssetBundleOptions {
18
23
  /** Label recorded as `createdBy`; never a token. */
19
24
  principalLabel?: string;
20
25
  }
26
+ /** Structured handoff from bounded bundle submission to Jobs/Lakeflow polling tools. */
27
+ export interface DatabricksAssetBundleRunResult {
28
+ submitted: true;
29
+ resourceKey: string;
30
+ runKind?: "job" | "pipeline";
31
+ /** Jobs run id, directly accepted by the Databricks jobs status/output tools. */
32
+ runId?: number;
33
+ /** Lakeflow pipeline id, paired with `updateId` for pipeline status polling. */
34
+ pipelineId?: string;
35
+ /** Lakeflow update id, paired with `pipelineId` for pipeline status polling. */
36
+ updateId?: string;
37
+ runUrl?: string;
38
+ output: string;
39
+ }
21
40
  /**
22
41
  * Governed lifecycle for a checked-in Databricks Asset Bundle (DAB).
23
42
  *
@@ -40,6 +59,8 @@ export interface DatabricksAssetBundleOptions {
40
59
  export declare class DatabricksAssetBundleLifecycle {
41
60
  /** Resolved bundle directory; also the governed resource identity on the tools. */
42
61
  readonly bundleDir: string;
62
+ /** Logical name of this bundle within a named `assetBundles` map; unset in the single-bundle form. */
63
+ readonly instanceName?: string;
43
64
  private readonly target?;
44
65
  private readonly profile?;
45
66
  private readonly executable;
@@ -74,10 +95,7 @@ export declare class DatabricksAssetBundleLifecycle {
74
95
  run(options: {
75
96
  key: string;
76
97
  restart?: boolean;
77
- }): Promise<{
78
- submitted: true;
79
- output: string;
80
- }>;
98
+ }): Promise<DatabricksAssetBundleRunResult>;
81
99
  /** Destroy a Harness-recorded bundle deployment and delete its managed record. */
82
100
  destroy(options?: {
83
101
  force?: boolean;
@@ -85,16 +103,48 @@ export declare class DatabricksAssetBundleLifecycle {
85
103
  destroyed: true;
86
104
  output: string;
87
105
  }>;
88
- /** Bundle `name:` parsed from `databricks.yml`, falling back to the directory basename. */
106
+ /**
107
+ * Bundle `name:` parsed from `databricks.yml`, falling back to the directory basename. Named
108
+ * bundles append `#instanceName` (and `#target` when set) so two lifecycles over the same manifest
109
+ * cannot collide in a shared managed-resource store; the single-bundle form keeps the bare name so
110
+ * existing records stay addressable.
111
+ */
89
112
  private resourceId;
90
113
  private requireManifest;
91
114
  private targetArgs;
92
115
  private profileArgs;
93
116
  }
94
117
  export declare function databricksAssetBundleLifecycle(options: DatabricksAssetBundleOptions): DatabricksAssetBundleLifecycle;
118
+ /** Several checked-in bundles keyed by logical name; the key becomes the lifecycle's `instanceName`. */
119
+ export type DatabricksAssetBundleMapOptions = Record<string, Omit<DatabricksAssetBundleOptions, "instanceName">>;
120
+ /**
121
+ * Discriminates the single-bundle form from the named-bundle map. A map key literally called
122
+ * `bundleDir` still selects map mode because its value is an entry object, not a string.
123
+ */
124
+ export declare function isDatabricksAssetBundleEntry(value: unknown): value is {
125
+ bundleDir: string;
126
+ } | DatabricksAssetBundleLifecycle;
127
+ /**
128
+ * Reject a named-bundle container that is not a plain object. Arrays are rejected too (isPlainObject
129
+ * excludes them): from untyped or parsed config they would otherwise enumerate as bundles named
130
+ * "0", "1", … Shared with `databricks()` so the config boundary and this helper report one message.
131
+ * Only the container is checked, so the assertion says nothing about the entries — each one is
132
+ * validated during enumeration in `databricksAssetBundleLifecycles`.
133
+ */
134
+ export declare function requireDatabricksAssetBundleMap(value: unknown): asserts value is Record<string, unknown>;
135
+ /**
136
+ * Build one lifecycle per named bundle. Names are validated (they reach the model as tool input and
137
+ * the managed-resource store as ids) and sorted, so tool enums and dispatch stay deterministic.
138
+ * `defaults` are applied under each entry, letting a caller set one `principalLabel` for every bundle.
139
+ */
140
+ export declare function databricksAssetBundleLifecycles(options: DatabricksAssetBundleMapOptions, defaults?: Omit<DatabricksAssetBundleOptions, "bundleDir" | "instanceName">): Map<string, DatabricksAssetBundleLifecycle>;
95
141
  /**
96
142
  * Model-facing tools for the governed bundle lifecycle. Write tools are approval-gated
97
143
  * by the `databricks()` bundle like every other authoring surface.
144
+ *
145
+ * A single bundle keeps bundle-free tool schemas; a named map adds a required `bundle` selector to
146
+ * every schema (even with one entry, so the schema and its approval digests stay stable when a second
147
+ * bundle is added) and governs only the bundle the call actually names.
98
148
  */
99
- export declare function databricksAssetBundleTools(options: DatabricksAssetBundleOptions | DatabricksAssetBundleLifecycle): ToolDef[];
149
+ export declare function databricksAssetBundleTools(options: DatabricksAssetBundleOptions | DatabricksAssetBundleLifecycle | DatabricksAssetBundleMapOptions | Map<string, DatabricksAssetBundleLifecycle>): ToolDef[];
100
150
  //# sourceMappingURL=asset-bundles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"asset-bundles.d.ts","sourceRoot":"","sources":["../src/asset-bundles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAc,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,EAEL,KAAK,uBAAuB,EAE7B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAEL,KAAK,8BAA8B,EAIpC,MAAM,uBAAuB,CAAC;AAM/B,MAAM,WAAW,4BAA4B;IAC3C,qEAAqE;IACrE,SAAS,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAA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