@oleanderhq/sdk 0.1.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/README.md +89 -0
- package/dist/index.cjs +314 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +343 -0
- package/dist/index.d.ts +343 -0
- package/dist/index.js +275 -0
- package/dist/index.js.map +1 -0
- package/package.json +47 -0
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** API error response body */
|
|
4
|
+
declare const apiErrorBodySchema: z.ZodObject<{
|
|
5
|
+
error: z.ZodOptional<z.ZodString>;
|
|
6
|
+
details: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
error?: string | undefined;
|
|
9
|
+
details?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
error?: string | undefined;
|
|
12
|
+
details?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
type ApiErrorBody = z.infer<typeof apiErrorBodySchema>;
|
|
15
|
+
/** Constructor options. apiKey can be omitted if OLEANDER_API_KEY env is set. */
|
|
16
|
+
declare const optionsSchema: z.ZodObject<{
|
|
17
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
18
|
+
baseUrl: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
apiKey?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
apiKey?: string | undefined;
|
|
24
|
+
baseUrl?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
type OleanderOptions = z.input<typeof optionsSchema>;
|
|
27
|
+
/** Lake query options */
|
|
28
|
+
declare const queryOptionsSchema: z.ZodObject<{
|
|
29
|
+
save: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
save: boolean;
|
|
32
|
+
}, {
|
|
33
|
+
save?: boolean | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
type QueryOptions = z.input<typeof queryOptionsSchema>;
|
|
36
|
+
/** Lake query result (API response) */
|
|
37
|
+
declare const lakeQueryResultSchema: z.ZodObject<{
|
|
38
|
+
success: z.ZodBoolean;
|
|
39
|
+
results: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
columns: z.ZodArray<z.ZodString, "many">;
|
|
41
|
+
column_types: z.ZodArray<z.ZodString, "many">;
|
|
42
|
+
rows: z.ZodArray<z.ZodArray<z.ZodUnknown, "many">, "many">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
columns: string[];
|
|
45
|
+
column_types: string[];
|
|
46
|
+
rows: unknown[][];
|
|
47
|
+
}, {
|
|
48
|
+
columns: string[];
|
|
49
|
+
column_types: string[];
|
|
50
|
+
rows: unknown[][];
|
|
51
|
+
}>>;
|
|
52
|
+
row_count: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
execution_time: z.ZodOptional<z.ZodString>;
|
|
54
|
+
saved_table_name: z.ZodOptional<z.ZodString>;
|
|
55
|
+
error: z.ZodOptional<z.ZodString>;
|
|
56
|
+
details: z.ZodOptional<z.ZodString>;
|
|
57
|
+
query: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
success: boolean;
|
|
60
|
+
error?: string | undefined;
|
|
61
|
+
details?: string | undefined;
|
|
62
|
+
results?: {
|
|
63
|
+
columns: string[];
|
|
64
|
+
column_types: string[];
|
|
65
|
+
rows: unknown[][];
|
|
66
|
+
} | undefined;
|
|
67
|
+
row_count?: number | undefined;
|
|
68
|
+
execution_time?: string | undefined;
|
|
69
|
+
saved_table_name?: string | undefined;
|
|
70
|
+
query?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
success: boolean;
|
|
73
|
+
error?: string | undefined;
|
|
74
|
+
details?: string | undefined;
|
|
75
|
+
results?: {
|
|
76
|
+
columns: string[];
|
|
77
|
+
column_types: string[];
|
|
78
|
+
rows: unknown[][];
|
|
79
|
+
} | undefined;
|
|
80
|
+
row_count?: number | undefined;
|
|
81
|
+
execution_time?: string | undefined;
|
|
82
|
+
saved_table_name?: string | undefined;
|
|
83
|
+
query?: string | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
type LakeQueryResult = z.infer<typeof lakeQueryResultSchema>;
|
|
86
|
+
/** API response for one page of spark scripts (S3-style) */
|
|
87
|
+
declare const sparkJobListPageSchema: z.ZodObject<{
|
|
88
|
+
scripts: z.ZodArray<z.ZodString, "many">;
|
|
89
|
+
continuationToken: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
scripts: string[];
|
|
92
|
+
continuationToken?: string | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
scripts: string[];
|
|
95
|
+
continuationToken?: string | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
type SparkJobListPage = z.infer<typeof sparkJobListPageSchema>;
|
|
98
|
+
/** Options for listSparkJobs (limit/offset pagination) */
|
|
99
|
+
declare const listSparkJobsOptionsSchema: z.ZodObject<{
|
|
100
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
limit: number;
|
|
104
|
+
offset: number;
|
|
105
|
+
}, {
|
|
106
|
+
limit?: number | undefined;
|
|
107
|
+
offset?: number | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
type ListSparkJobsOptions = z.input<typeof listSparkJobsOptionsSchema>;
|
|
110
|
+
/** Result of listSparkJobs with limit/offset */
|
|
111
|
+
declare const listSparkJobsResultSchema: z.ZodObject<{
|
|
112
|
+
scripts: z.ZodArray<z.ZodString, "many">;
|
|
113
|
+
hasMore: z.ZodBoolean;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
scripts: string[];
|
|
116
|
+
hasMore: boolean;
|
|
117
|
+
}, {
|
|
118
|
+
scripts: string[];
|
|
119
|
+
hasMore: boolean;
|
|
120
|
+
}>;
|
|
121
|
+
type ListSparkJobsResult = z.infer<typeof listSparkJobsResultSchema>;
|
|
122
|
+
/** Spark machine type enum */
|
|
123
|
+
declare const sparkMachineTypeSchema: z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>;
|
|
124
|
+
type SparkMachineType = z.infer<typeof sparkMachineTypeSchema>;
|
|
125
|
+
/** Spark job submit options. Optional fields have defaults. */
|
|
126
|
+
declare const submitOptionsSchema: z.ZodObject<{
|
|
127
|
+
namespace: z.ZodString;
|
|
128
|
+
name: z.ZodString;
|
|
129
|
+
scriptName: z.ZodString;
|
|
130
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
driverMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
132
|
+
executorMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
133
|
+
executorNumbers: z.ZodDefault<z.ZodNumber>;
|
|
134
|
+
jobTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
135
|
+
runTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
namespace: string;
|
|
138
|
+
name: string;
|
|
139
|
+
scriptName: string;
|
|
140
|
+
args: string[];
|
|
141
|
+
driverMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
142
|
+
executorMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
143
|
+
executorNumbers: number;
|
|
144
|
+
jobTags: string[];
|
|
145
|
+
runTags: string[];
|
|
146
|
+
}, {
|
|
147
|
+
namespace: string;
|
|
148
|
+
name: string;
|
|
149
|
+
scriptName: string;
|
|
150
|
+
args?: string[] | undefined;
|
|
151
|
+
driverMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
152
|
+
executorMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
153
|
+
executorNumbers?: number | undefined;
|
|
154
|
+
jobTags?: string[] | undefined;
|
|
155
|
+
runTags?: string[] | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
type SparkJobSubmitOptions = z.input<typeof submitOptionsSchema>;
|
|
158
|
+
/** Options for submitSparkJobAndWait (submit options + optional wait tuning) */
|
|
159
|
+
declare const submitSparkJobAndWaitOptionsSchema: z.ZodObject<{
|
|
160
|
+
namespace: z.ZodString;
|
|
161
|
+
name: z.ZodString;
|
|
162
|
+
scriptName: z.ZodString;
|
|
163
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
164
|
+
driverMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
165
|
+
executorMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
166
|
+
executorNumbers: z.ZodDefault<z.ZodNumber>;
|
|
167
|
+
jobTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
168
|
+
runTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
169
|
+
} & {
|
|
170
|
+
pollIntervalMs: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
namespace: string;
|
|
174
|
+
name: string;
|
|
175
|
+
scriptName: string;
|
|
176
|
+
args: string[];
|
|
177
|
+
driverMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
178
|
+
executorMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
179
|
+
executorNumbers: number;
|
|
180
|
+
jobTags: string[];
|
|
181
|
+
runTags: string[];
|
|
182
|
+
pollIntervalMs: number;
|
|
183
|
+
timeoutMs: number;
|
|
184
|
+
}, {
|
|
185
|
+
namespace: string;
|
|
186
|
+
name: string;
|
|
187
|
+
scriptName: string;
|
|
188
|
+
args?: string[] | undefined;
|
|
189
|
+
driverMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
190
|
+
executorMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
191
|
+
executorNumbers?: number | undefined;
|
|
192
|
+
jobTags?: string[] | undefined;
|
|
193
|
+
runTags?: string[] | undefined;
|
|
194
|
+
pollIntervalMs?: number | undefined;
|
|
195
|
+
timeoutMs?: number | undefined;
|
|
196
|
+
}>;
|
|
197
|
+
type SubmitSparkJobAndWaitOptions = z.input<typeof submitSparkJobAndWaitOptionsSchema>;
|
|
198
|
+
/** Spark job submit response */
|
|
199
|
+
declare const sparkJobRunSchema: z.ZodObject<{
|
|
200
|
+
runId: z.ZodString;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
runId: string;
|
|
203
|
+
}, {
|
|
204
|
+
runId: string;
|
|
205
|
+
}>;
|
|
206
|
+
type SparkJobRun = z.infer<typeof sparkJobRunSchema>;
|
|
207
|
+
/** Run status (for polling) */
|
|
208
|
+
declare const runResponseSchema: z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
state: z.ZodNullable<z.ZodString>;
|
|
211
|
+
started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
queued_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
|
+
scheduled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
ended_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
216
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
217
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
218
|
+
key: z.ZodString;
|
|
219
|
+
value: z.ZodString;
|
|
220
|
+
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
value: string;
|
|
223
|
+
key: string;
|
|
224
|
+
source?: string | null | undefined;
|
|
225
|
+
}, {
|
|
226
|
+
value: string;
|
|
227
|
+
key: string;
|
|
228
|
+
source?: string | null | undefined;
|
|
229
|
+
}>, "many">;
|
|
230
|
+
job: z.ZodObject<{
|
|
231
|
+
id: z.ZodString;
|
|
232
|
+
name: z.ZodString;
|
|
233
|
+
namespace: z.ZodString;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
namespace: string;
|
|
236
|
+
name: string;
|
|
237
|
+
id: string;
|
|
238
|
+
}, {
|
|
239
|
+
namespace: string;
|
|
240
|
+
name: string;
|
|
241
|
+
id: string;
|
|
242
|
+
}>;
|
|
243
|
+
pipeline: z.ZodObject<{
|
|
244
|
+
id: z.ZodString;
|
|
245
|
+
name: z.ZodString;
|
|
246
|
+
namespace: z.ZodString;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
namespace: string;
|
|
249
|
+
name: string;
|
|
250
|
+
id: string;
|
|
251
|
+
}, {
|
|
252
|
+
namespace: string;
|
|
253
|
+
name: string;
|
|
254
|
+
id: string;
|
|
255
|
+
}>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
id: string;
|
|
258
|
+
state: string | null;
|
|
259
|
+
tags: {
|
|
260
|
+
value: string;
|
|
261
|
+
key: string;
|
|
262
|
+
source?: string | null | undefined;
|
|
263
|
+
}[];
|
|
264
|
+
job: {
|
|
265
|
+
namespace: string;
|
|
266
|
+
name: string;
|
|
267
|
+
id: string;
|
|
268
|
+
};
|
|
269
|
+
pipeline: {
|
|
270
|
+
namespace: string;
|
|
271
|
+
name: string;
|
|
272
|
+
id: string;
|
|
273
|
+
};
|
|
274
|
+
error?: unknown;
|
|
275
|
+
started_at?: string | null | undefined;
|
|
276
|
+
queued_at?: string | null | undefined;
|
|
277
|
+
scheduled_at?: string | null | undefined;
|
|
278
|
+
ended_at?: string | null | undefined;
|
|
279
|
+
duration?: number | null | undefined;
|
|
280
|
+
}, {
|
|
281
|
+
id: string;
|
|
282
|
+
state: string | null;
|
|
283
|
+
tags: {
|
|
284
|
+
value: string;
|
|
285
|
+
key: string;
|
|
286
|
+
source?: string | null | undefined;
|
|
287
|
+
}[];
|
|
288
|
+
job: {
|
|
289
|
+
namespace: string;
|
|
290
|
+
name: string;
|
|
291
|
+
id: string;
|
|
292
|
+
};
|
|
293
|
+
pipeline: {
|
|
294
|
+
namespace: string;
|
|
295
|
+
name: string;
|
|
296
|
+
id: string;
|
|
297
|
+
};
|
|
298
|
+
error?: unknown;
|
|
299
|
+
started_at?: string | null | undefined;
|
|
300
|
+
queued_at?: string | null | undefined;
|
|
301
|
+
scheduled_at?: string | null | undefined;
|
|
302
|
+
ended_at?: string | null | undefined;
|
|
303
|
+
duration?: number | null | undefined;
|
|
304
|
+
}>;
|
|
305
|
+
type RunResponse = z.infer<typeof runResponseSchema>;
|
|
306
|
+
type RunState = "COMPLETE" | "FAIL" | "ABORT" | string;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* oleander API. Mirrors the CLI for query, list spark jobs, and launch spark jobs.
|
|
310
|
+
*/
|
|
311
|
+
declare class Oleander {
|
|
312
|
+
private readonly apiKey;
|
|
313
|
+
private readonly baseUrl;
|
|
314
|
+
constructor(options?: OleanderOptions);
|
|
315
|
+
/**
|
|
316
|
+
* Execute a lake query (mirrors `oleander query`).
|
|
317
|
+
*/
|
|
318
|
+
query(sql: string, options?: QueryOptions): Promise<LakeQueryResult>;
|
|
319
|
+
/**
|
|
320
|
+
* List spark jobs (mirrors `oleander spark jobs list`).
|
|
321
|
+
* Uses limit/offset pagination; pages through the API internally.
|
|
322
|
+
*/
|
|
323
|
+
listSparkJobs(options?: ListSparkJobsOptions): Promise<ListSparkJobsResult>;
|
|
324
|
+
/**
|
|
325
|
+
* Submit a spark job (mirrors `oleander spark jobs submit`).
|
|
326
|
+
* Returns the run ID; use getRun() or submitSparkJobAndWait() to poll status.
|
|
327
|
+
*/
|
|
328
|
+
submitSparkJob(options: SparkJobSubmitOptions): Promise<SparkJobRun>;
|
|
329
|
+
/**
|
|
330
|
+
* Get run status (used for polling after submit).
|
|
331
|
+
*/
|
|
332
|
+
getRun(runId: string): Promise<RunResponse>;
|
|
333
|
+
/**
|
|
334
|
+
* Submit a spark job and wait until the run reaches a terminal state (COMPLETE, FAIL, ABORT).
|
|
335
|
+
*/
|
|
336
|
+
submitSparkJobAndWait(options: SubmitSparkJobAndWaitOptions): Promise<{
|
|
337
|
+
runId: string;
|
|
338
|
+
state: RunState;
|
|
339
|
+
run: RunResponse;
|
|
340
|
+
}>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { type ApiErrorBody, type LakeQueryResult, type ListSparkJobsOptions, type ListSparkJobsResult, Oleander, type OleanderOptions, type QueryOptions, type RunResponse, type RunState, type SparkJobListPage, type SparkJobRun, type SparkJobSubmitOptions, type SparkMachineType, type SubmitSparkJobAndWaitOptions, apiErrorBodySchema, lakeQueryResultSchema, listSparkJobsOptionsSchema, listSparkJobsResultSchema, optionsSchema, queryOptionsSchema, runResponseSchema, sparkJobListPageSchema, sparkJobRunSchema, sparkMachineTypeSchema, submitOptionsSchema, submitSparkJobAndWaitOptionsSchema };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/** API error response body */
|
|
4
|
+
declare const apiErrorBodySchema: z.ZodObject<{
|
|
5
|
+
error: z.ZodOptional<z.ZodString>;
|
|
6
|
+
details: z.ZodOptional<z.ZodString>;
|
|
7
|
+
}, "strip", z.ZodTypeAny, {
|
|
8
|
+
error?: string | undefined;
|
|
9
|
+
details?: string | undefined;
|
|
10
|
+
}, {
|
|
11
|
+
error?: string | undefined;
|
|
12
|
+
details?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
type ApiErrorBody = z.infer<typeof apiErrorBodySchema>;
|
|
15
|
+
/** Constructor options. apiKey can be omitted if OLEANDER_API_KEY env is set. */
|
|
16
|
+
declare const optionsSchema: z.ZodObject<{
|
|
17
|
+
apiKey: z.ZodOptional<z.ZodString>;
|
|
18
|
+
baseUrl: z.ZodEffects<z.ZodDefault<z.ZodString>, string, string | undefined>;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
baseUrl: string;
|
|
21
|
+
apiKey?: string | undefined;
|
|
22
|
+
}, {
|
|
23
|
+
apiKey?: string | undefined;
|
|
24
|
+
baseUrl?: string | undefined;
|
|
25
|
+
}>;
|
|
26
|
+
type OleanderOptions = z.input<typeof optionsSchema>;
|
|
27
|
+
/** Lake query options */
|
|
28
|
+
declare const queryOptionsSchema: z.ZodObject<{
|
|
29
|
+
save: z.ZodDefault<z.ZodBoolean>;
|
|
30
|
+
}, "strip", z.ZodTypeAny, {
|
|
31
|
+
save: boolean;
|
|
32
|
+
}, {
|
|
33
|
+
save?: boolean | undefined;
|
|
34
|
+
}>;
|
|
35
|
+
type QueryOptions = z.input<typeof queryOptionsSchema>;
|
|
36
|
+
/** Lake query result (API response) */
|
|
37
|
+
declare const lakeQueryResultSchema: z.ZodObject<{
|
|
38
|
+
success: z.ZodBoolean;
|
|
39
|
+
results: z.ZodOptional<z.ZodObject<{
|
|
40
|
+
columns: z.ZodArray<z.ZodString, "many">;
|
|
41
|
+
column_types: z.ZodArray<z.ZodString, "many">;
|
|
42
|
+
rows: z.ZodArray<z.ZodArray<z.ZodUnknown, "many">, "many">;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
columns: string[];
|
|
45
|
+
column_types: string[];
|
|
46
|
+
rows: unknown[][];
|
|
47
|
+
}, {
|
|
48
|
+
columns: string[];
|
|
49
|
+
column_types: string[];
|
|
50
|
+
rows: unknown[][];
|
|
51
|
+
}>>;
|
|
52
|
+
row_count: z.ZodOptional<z.ZodNumber>;
|
|
53
|
+
execution_time: z.ZodOptional<z.ZodString>;
|
|
54
|
+
saved_table_name: z.ZodOptional<z.ZodString>;
|
|
55
|
+
error: z.ZodOptional<z.ZodString>;
|
|
56
|
+
details: z.ZodOptional<z.ZodString>;
|
|
57
|
+
query: z.ZodOptional<z.ZodString>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
success: boolean;
|
|
60
|
+
error?: string | undefined;
|
|
61
|
+
details?: string | undefined;
|
|
62
|
+
results?: {
|
|
63
|
+
columns: string[];
|
|
64
|
+
column_types: string[];
|
|
65
|
+
rows: unknown[][];
|
|
66
|
+
} | undefined;
|
|
67
|
+
row_count?: number | undefined;
|
|
68
|
+
execution_time?: string | undefined;
|
|
69
|
+
saved_table_name?: string | undefined;
|
|
70
|
+
query?: string | undefined;
|
|
71
|
+
}, {
|
|
72
|
+
success: boolean;
|
|
73
|
+
error?: string | undefined;
|
|
74
|
+
details?: string | undefined;
|
|
75
|
+
results?: {
|
|
76
|
+
columns: string[];
|
|
77
|
+
column_types: string[];
|
|
78
|
+
rows: unknown[][];
|
|
79
|
+
} | undefined;
|
|
80
|
+
row_count?: number | undefined;
|
|
81
|
+
execution_time?: string | undefined;
|
|
82
|
+
saved_table_name?: string | undefined;
|
|
83
|
+
query?: string | undefined;
|
|
84
|
+
}>;
|
|
85
|
+
type LakeQueryResult = z.infer<typeof lakeQueryResultSchema>;
|
|
86
|
+
/** API response for one page of spark scripts (S3-style) */
|
|
87
|
+
declare const sparkJobListPageSchema: z.ZodObject<{
|
|
88
|
+
scripts: z.ZodArray<z.ZodString, "many">;
|
|
89
|
+
continuationToken: z.ZodOptional<z.ZodString>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
scripts: string[];
|
|
92
|
+
continuationToken?: string | undefined;
|
|
93
|
+
}, {
|
|
94
|
+
scripts: string[];
|
|
95
|
+
continuationToken?: string | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
type SparkJobListPage = z.infer<typeof sparkJobListPageSchema>;
|
|
98
|
+
/** Options for listSparkJobs (limit/offset pagination) */
|
|
99
|
+
declare const listSparkJobsOptionsSchema: z.ZodObject<{
|
|
100
|
+
limit: z.ZodDefault<z.ZodNumber>;
|
|
101
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
102
|
+
}, "strip", z.ZodTypeAny, {
|
|
103
|
+
limit: number;
|
|
104
|
+
offset: number;
|
|
105
|
+
}, {
|
|
106
|
+
limit?: number | undefined;
|
|
107
|
+
offset?: number | undefined;
|
|
108
|
+
}>;
|
|
109
|
+
type ListSparkJobsOptions = z.input<typeof listSparkJobsOptionsSchema>;
|
|
110
|
+
/** Result of listSparkJobs with limit/offset */
|
|
111
|
+
declare const listSparkJobsResultSchema: z.ZodObject<{
|
|
112
|
+
scripts: z.ZodArray<z.ZodString, "many">;
|
|
113
|
+
hasMore: z.ZodBoolean;
|
|
114
|
+
}, "strip", z.ZodTypeAny, {
|
|
115
|
+
scripts: string[];
|
|
116
|
+
hasMore: boolean;
|
|
117
|
+
}, {
|
|
118
|
+
scripts: string[];
|
|
119
|
+
hasMore: boolean;
|
|
120
|
+
}>;
|
|
121
|
+
type ListSparkJobsResult = z.infer<typeof listSparkJobsResultSchema>;
|
|
122
|
+
/** Spark machine type enum */
|
|
123
|
+
declare const sparkMachineTypeSchema: z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>;
|
|
124
|
+
type SparkMachineType = z.infer<typeof sparkMachineTypeSchema>;
|
|
125
|
+
/** Spark job submit options. Optional fields have defaults. */
|
|
126
|
+
declare const submitOptionsSchema: z.ZodObject<{
|
|
127
|
+
namespace: z.ZodString;
|
|
128
|
+
name: z.ZodString;
|
|
129
|
+
scriptName: z.ZodString;
|
|
130
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
131
|
+
driverMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
132
|
+
executorMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
133
|
+
executorNumbers: z.ZodDefault<z.ZodNumber>;
|
|
134
|
+
jobTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
135
|
+
runTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
136
|
+
}, "strip", z.ZodTypeAny, {
|
|
137
|
+
namespace: string;
|
|
138
|
+
name: string;
|
|
139
|
+
scriptName: string;
|
|
140
|
+
args: string[];
|
|
141
|
+
driverMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
142
|
+
executorMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
143
|
+
executorNumbers: number;
|
|
144
|
+
jobTags: string[];
|
|
145
|
+
runTags: string[];
|
|
146
|
+
}, {
|
|
147
|
+
namespace: string;
|
|
148
|
+
name: string;
|
|
149
|
+
scriptName: string;
|
|
150
|
+
args?: string[] | undefined;
|
|
151
|
+
driverMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
152
|
+
executorMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
153
|
+
executorNumbers?: number | undefined;
|
|
154
|
+
jobTags?: string[] | undefined;
|
|
155
|
+
runTags?: string[] | undefined;
|
|
156
|
+
}>;
|
|
157
|
+
type SparkJobSubmitOptions = z.input<typeof submitOptionsSchema>;
|
|
158
|
+
/** Options for submitSparkJobAndWait (submit options + optional wait tuning) */
|
|
159
|
+
declare const submitSparkJobAndWaitOptionsSchema: z.ZodObject<{
|
|
160
|
+
namespace: z.ZodString;
|
|
161
|
+
name: z.ZodString;
|
|
162
|
+
scriptName: z.ZodString;
|
|
163
|
+
args: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
164
|
+
driverMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
165
|
+
executorMachineType: z.ZodDefault<z.ZodEnum<["spark.1.c", "spark.2.c", "spark.4.c", "spark.8.c", "spark.16.c", "spark.1.b", "spark.2.b", "spark.4.b", "spark.8.b", "spark.16.b", "spark.1.m", "spark.2.m", "spark.4.m", "spark.8.m", "spark.16.m"]>>;
|
|
166
|
+
executorNumbers: z.ZodDefault<z.ZodNumber>;
|
|
167
|
+
jobTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
168
|
+
runTags: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
169
|
+
} & {
|
|
170
|
+
pollIntervalMs: z.ZodDefault<z.ZodNumber>;
|
|
171
|
+
timeoutMs: z.ZodDefault<z.ZodNumber>;
|
|
172
|
+
}, "strip", z.ZodTypeAny, {
|
|
173
|
+
namespace: string;
|
|
174
|
+
name: string;
|
|
175
|
+
scriptName: string;
|
|
176
|
+
args: string[];
|
|
177
|
+
driverMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
178
|
+
executorMachineType: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m";
|
|
179
|
+
executorNumbers: number;
|
|
180
|
+
jobTags: string[];
|
|
181
|
+
runTags: string[];
|
|
182
|
+
pollIntervalMs: number;
|
|
183
|
+
timeoutMs: number;
|
|
184
|
+
}, {
|
|
185
|
+
namespace: string;
|
|
186
|
+
name: string;
|
|
187
|
+
scriptName: string;
|
|
188
|
+
args?: string[] | undefined;
|
|
189
|
+
driverMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
190
|
+
executorMachineType?: "spark.1.c" | "spark.2.c" | "spark.4.c" | "spark.8.c" | "spark.16.c" | "spark.1.b" | "spark.2.b" | "spark.4.b" | "spark.8.b" | "spark.16.b" | "spark.1.m" | "spark.2.m" | "spark.4.m" | "spark.8.m" | "spark.16.m" | undefined;
|
|
191
|
+
executorNumbers?: number | undefined;
|
|
192
|
+
jobTags?: string[] | undefined;
|
|
193
|
+
runTags?: string[] | undefined;
|
|
194
|
+
pollIntervalMs?: number | undefined;
|
|
195
|
+
timeoutMs?: number | undefined;
|
|
196
|
+
}>;
|
|
197
|
+
type SubmitSparkJobAndWaitOptions = z.input<typeof submitSparkJobAndWaitOptionsSchema>;
|
|
198
|
+
/** Spark job submit response */
|
|
199
|
+
declare const sparkJobRunSchema: z.ZodObject<{
|
|
200
|
+
runId: z.ZodString;
|
|
201
|
+
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
runId: string;
|
|
203
|
+
}, {
|
|
204
|
+
runId: string;
|
|
205
|
+
}>;
|
|
206
|
+
type SparkJobRun = z.infer<typeof sparkJobRunSchema>;
|
|
207
|
+
/** Run status (for polling) */
|
|
208
|
+
declare const runResponseSchema: z.ZodObject<{
|
|
209
|
+
id: z.ZodString;
|
|
210
|
+
state: z.ZodNullable<z.ZodString>;
|
|
211
|
+
started_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
212
|
+
queued_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
213
|
+
scheduled_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
214
|
+
ended_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
215
|
+
duration: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
216
|
+
error: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
217
|
+
tags: z.ZodArray<z.ZodObject<{
|
|
218
|
+
key: z.ZodString;
|
|
219
|
+
value: z.ZodString;
|
|
220
|
+
source: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
221
|
+
}, "strip", z.ZodTypeAny, {
|
|
222
|
+
value: string;
|
|
223
|
+
key: string;
|
|
224
|
+
source?: string | null | undefined;
|
|
225
|
+
}, {
|
|
226
|
+
value: string;
|
|
227
|
+
key: string;
|
|
228
|
+
source?: string | null | undefined;
|
|
229
|
+
}>, "many">;
|
|
230
|
+
job: z.ZodObject<{
|
|
231
|
+
id: z.ZodString;
|
|
232
|
+
name: z.ZodString;
|
|
233
|
+
namespace: z.ZodString;
|
|
234
|
+
}, "strip", z.ZodTypeAny, {
|
|
235
|
+
namespace: string;
|
|
236
|
+
name: string;
|
|
237
|
+
id: string;
|
|
238
|
+
}, {
|
|
239
|
+
namespace: string;
|
|
240
|
+
name: string;
|
|
241
|
+
id: string;
|
|
242
|
+
}>;
|
|
243
|
+
pipeline: z.ZodObject<{
|
|
244
|
+
id: z.ZodString;
|
|
245
|
+
name: z.ZodString;
|
|
246
|
+
namespace: z.ZodString;
|
|
247
|
+
}, "strip", z.ZodTypeAny, {
|
|
248
|
+
namespace: string;
|
|
249
|
+
name: string;
|
|
250
|
+
id: string;
|
|
251
|
+
}, {
|
|
252
|
+
namespace: string;
|
|
253
|
+
name: string;
|
|
254
|
+
id: string;
|
|
255
|
+
}>;
|
|
256
|
+
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
id: string;
|
|
258
|
+
state: string | null;
|
|
259
|
+
tags: {
|
|
260
|
+
value: string;
|
|
261
|
+
key: string;
|
|
262
|
+
source?: string | null | undefined;
|
|
263
|
+
}[];
|
|
264
|
+
job: {
|
|
265
|
+
namespace: string;
|
|
266
|
+
name: string;
|
|
267
|
+
id: string;
|
|
268
|
+
};
|
|
269
|
+
pipeline: {
|
|
270
|
+
namespace: string;
|
|
271
|
+
name: string;
|
|
272
|
+
id: string;
|
|
273
|
+
};
|
|
274
|
+
error?: unknown;
|
|
275
|
+
started_at?: string | null | undefined;
|
|
276
|
+
queued_at?: string | null | undefined;
|
|
277
|
+
scheduled_at?: string | null | undefined;
|
|
278
|
+
ended_at?: string | null | undefined;
|
|
279
|
+
duration?: number | null | undefined;
|
|
280
|
+
}, {
|
|
281
|
+
id: string;
|
|
282
|
+
state: string | null;
|
|
283
|
+
tags: {
|
|
284
|
+
value: string;
|
|
285
|
+
key: string;
|
|
286
|
+
source?: string | null | undefined;
|
|
287
|
+
}[];
|
|
288
|
+
job: {
|
|
289
|
+
namespace: string;
|
|
290
|
+
name: string;
|
|
291
|
+
id: string;
|
|
292
|
+
};
|
|
293
|
+
pipeline: {
|
|
294
|
+
namespace: string;
|
|
295
|
+
name: string;
|
|
296
|
+
id: string;
|
|
297
|
+
};
|
|
298
|
+
error?: unknown;
|
|
299
|
+
started_at?: string | null | undefined;
|
|
300
|
+
queued_at?: string | null | undefined;
|
|
301
|
+
scheduled_at?: string | null | undefined;
|
|
302
|
+
ended_at?: string | null | undefined;
|
|
303
|
+
duration?: number | null | undefined;
|
|
304
|
+
}>;
|
|
305
|
+
type RunResponse = z.infer<typeof runResponseSchema>;
|
|
306
|
+
type RunState = "COMPLETE" | "FAIL" | "ABORT" | string;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* oleander API. Mirrors the CLI for query, list spark jobs, and launch spark jobs.
|
|
310
|
+
*/
|
|
311
|
+
declare class Oleander {
|
|
312
|
+
private readonly apiKey;
|
|
313
|
+
private readonly baseUrl;
|
|
314
|
+
constructor(options?: OleanderOptions);
|
|
315
|
+
/**
|
|
316
|
+
* Execute a lake query (mirrors `oleander query`).
|
|
317
|
+
*/
|
|
318
|
+
query(sql: string, options?: QueryOptions): Promise<LakeQueryResult>;
|
|
319
|
+
/**
|
|
320
|
+
* List spark jobs (mirrors `oleander spark jobs list`).
|
|
321
|
+
* Uses limit/offset pagination; pages through the API internally.
|
|
322
|
+
*/
|
|
323
|
+
listSparkJobs(options?: ListSparkJobsOptions): Promise<ListSparkJobsResult>;
|
|
324
|
+
/**
|
|
325
|
+
* Submit a spark job (mirrors `oleander spark jobs submit`).
|
|
326
|
+
* Returns the run ID; use getRun() or submitSparkJobAndWait() to poll status.
|
|
327
|
+
*/
|
|
328
|
+
submitSparkJob(options: SparkJobSubmitOptions): Promise<SparkJobRun>;
|
|
329
|
+
/**
|
|
330
|
+
* Get run status (used for polling after submit).
|
|
331
|
+
*/
|
|
332
|
+
getRun(runId: string): Promise<RunResponse>;
|
|
333
|
+
/**
|
|
334
|
+
* Submit a spark job and wait until the run reaches a terminal state (COMPLETE, FAIL, ABORT).
|
|
335
|
+
*/
|
|
336
|
+
submitSparkJobAndWait(options: SubmitSparkJobAndWaitOptions): Promise<{
|
|
337
|
+
runId: string;
|
|
338
|
+
state: RunState;
|
|
339
|
+
run: RunResponse;
|
|
340
|
+
}>;
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
export { type ApiErrorBody, type LakeQueryResult, type ListSparkJobsOptions, type ListSparkJobsResult, Oleander, type OleanderOptions, type QueryOptions, type RunResponse, type RunState, type SparkJobListPage, type SparkJobRun, type SparkJobSubmitOptions, type SparkMachineType, type SubmitSparkJobAndWaitOptions, apiErrorBodySchema, lakeQueryResultSchema, listSparkJobsOptionsSchema, listSparkJobsResultSchema, optionsSchema, queryOptionsSchema, runResponseSchema, sparkJobListPageSchema, sparkJobRunSchema, sparkMachineTypeSchema, submitOptionsSchema, submitSparkJobAndWaitOptionsSchema };
|