@databricks/sdk-features 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/package.js +7 -0
- package/dist/package.js.map +1 -0
- package/dist/v1/client.d.ts +80 -76
- package/dist/v1/client.d.ts.map +1 -1
- package/dist/v1/client.js +527 -690
- package/dist/v1/client.js.map +1 -1
- package/dist/v1/index.d.ts +3 -8
- package/dist/v1/index.js +4 -8
- package/dist/v1/model.d.ts +1163 -1199
- package/dist/v1/model.d.ts.map +1 -1
- package/dist/v1/model.js +1838 -2702
- package/dist/v1/model.js.map +1 -1
- package/dist/v1/transport.d.ts +21 -17
- package/dist/v1/transport.d.ts.map +1 -1
- package/dist/v1/transport.js +60 -69
- package/dist/v1/transport.js.map +1 -1
- package/dist/v1/utils.d.ts +18 -14
- package/dist/v1/utils.d.ts.map +1 -1
- package/dist/v1/utils.js +76 -103
- package/dist/v1/utils.js.map +1 -1
- package/package.json +5 -5
- package/dist/v1/index.d.ts.map +0 -1
- package/dist/v1/index.js.map +0 -1
package/dist/v1/client.js
CHANGED
|
@@ -1,693 +1,530 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
import { resolveClientConfig } from "./transport.js";
|
|
2
|
+
import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse } from "./utils.js";
|
|
3
|
+
import { name, version } from "../package.js";
|
|
4
|
+
import { marshalBatchCreateMaterializedFeaturesRequestSchema, marshalFeatureSchema, marshalKafkaConfigSchema, marshalMaterializedFeatureSchema, marshalStreamSchema, unmarshalBatchCreateMaterializedFeaturesResponseSchema, unmarshalFeatureSchema, unmarshalKafkaConfigSchema, unmarshalListFeaturesResponseSchema, unmarshalListKafkaConfigsResponseSchema, unmarshalListMaterializedFeaturesResponseSchema, unmarshalListStreamsResponseSchema, unmarshalMaterializedFeatureSchema, unmarshalStreamSchema } from "./model.js";
|
|
5
|
+
import { VERSION } from "@databricks/sdk-auth";
|
|
6
|
+
import { createDefault } from "@databricks/sdk-core/clientinfo";
|
|
7
|
+
import { NoOpLogger } from "@databricks/sdk-core/logger";
|
|
8
|
+
|
|
9
|
+
//#region src/v1/client.ts
|
|
10
10
|
const PACKAGE_SEGMENT = {
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
|
|
12
|
+
value: version
|
|
13
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
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
531
|
-
}
|
|
532
|
-
headers.set('User-Agent', this.userAgent);
|
|
533
|
-
const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
|
|
534
|
-
const respBody = await executeHttpCall({
|
|
535
|
-
request: httpReq,
|
|
536
|
-
httpClient,
|
|
537
|
-
logger: this.logger,
|
|
538
|
-
});
|
|
539
|
-
resp = parseResponse(respBody, unmarshalListStreamsResponseSchema);
|
|
540
|
-
};
|
|
541
|
-
await executeCall(call, options);
|
|
542
|
-
if (resp === undefined) {
|
|
543
|
-
throw new Error('operation completed without a result.');
|
|
544
|
-
}
|
|
545
|
-
return resp;
|
|
546
|
-
}
|
|
547
|
-
async *listStreamsIter(req, options) {
|
|
548
|
-
const pageReq = { ...req };
|
|
549
|
-
for (;;) {
|
|
550
|
-
const resp = await this.listStreams(pageReq, options);
|
|
551
|
-
for (const item of resp.streams ?? []) {
|
|
552
|
-
yield item;
|
|
553
|
-
}
|
|
554
|
-
if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
pageReq.pageToken = resp.nextPageToken;
|
|
558
|
-
}
|
|
559
|
-
}
|
|
560
|
-
/** Update a Feature. */
|
|
561
|
-
async updateFeature(req, options) {
|
|
562
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
563
|
-
const url = `${host}/api/2.0/feature-engineering/features/${req.feature?.fullName ?? ''}`;
|
|
564
|
-
const params = new URLSearchParams();
|
|
565
|
-
if (req.updateMask !== undefined) {
|
|
566
|
-
params.append('update_mask', req.updateMask.toString());
|
|
567
|
-
}
|
|
568
|
-
const query = params.toString();
|
|
569
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
570
|
-
const body = marshalRequest(req.feature, marshalFeatureSchema);
|
|
571
|
-
let resp;
|
|
572
|
-
const call = async (callSignal) => {
|
|
573
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
574
|
-
if (workspaceId !== undefined) {
|
|
575
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
576
|
-
}
|
|
577
|
-
headers.set('User-Agent', this.userAgent);
|
|
578
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
579
|
-
const respBody = await executeHttpCall({
|
|
580
|
-
request: httpReq,
|
|
581
|
-
httpClient,
|
|
582
|
-
logger: this.logger,
|
|
583
|
-
});
|
|
584
|
-
resp = parseResponse(respBody, unmarshalFeatureSchema);
|
|
585
|
-
};
|
|
586
|
-
await executeCall(call, options);
|
|
587
|
-
if (resp === undefined) {
|
|
588
|
-
throw new Error('operation completed without a result.');
|
|
589
|
-
}
|
|
590
|
-
return resp;
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* Update a Kafka config.
|
|
594
|
-
* During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
|
|
595
|
-
* Only the creator of the Kafka config can delete it.
|
|
596
|
-
*/
|
|
597
|
-
async updateKafkaConfig(req, options) {
|
|
598
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
599
|
-
const url = `${host}/api/2.0/feature-engineering/features/kafka-configs/${req.kafkaConfig?.name ?? ''}`;
|
|
600
|
-
const params = new URLSearchParams();
|
|
601
|
-
if (req.updateMask !== undefined) {
|
|
602
|
-
params.append('update_mask', req.updateMask.toString());
|
|
603
|
-
}
|
|
604
|
-
const query = params.toString();
|
|
605
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
606
|
-
const body = marshalRequest(req.kafkaConfig, marshalKafkaConfigSchema);
|
|
607
|
-
let resp;
|
|
608
|
-
const call = async (callSignal) => {
|
|
609
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
610
|
-
if (workspaceId !== undefined) {
|
|
611
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
612
|
-
}
|
|
613
|
-
headers.set('User-Agent', this.userAgent);
|
|
614
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
615
|
-
const respBody = await executeHttpCall({
|
|
616
|
-
request: httpReq,
|
|
617
|
-
httpClient,
|
|
618
|
-
logger: this.logger,
|
|
619
|
-
});
|
|
620
|
-
resp = parseResponse(respBody, unmarshalKafkaConfigSchema);
|
|
621
|
-
};
|
|
622
|
-
await executeCall(call, options);
|
|
623
|
-
if (resp === undefined) {
|
|
624
|
-
throw new Error('operation completed without a result.');
|
|
625
|
-
}
|
|
626
|
-
return resp;
|
|
627
|
-
}
|
|
628
|
-
/** Update a materialized feature (pause/resume). */
|
|
629
|
-
async updateMaterializedFeature(req, options) {
|
|
630
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
631
|
-
const url = `${host}/api/2.0/feature-engineering/materialized-features/${req.materializedFeature?.materializedFeatureId ?? ''}`;
|
|
632
|
-
const params = new URLSearchParams();
|
|
633
|
-
if (req.updateMask !== undefined) {
|
|
634
|
-
params.append('update_mask', req.updateMask.toString());
|
|
635
|
-
}
|
|
636
|
-
const query = params.toString();
|
|
637
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
638
|
-
const body = marshalRequest(req.materializedFeature, marshalMaterializedFeatureSchema);
|
|
639
|
-
let resp;
|
|
640
|
-
const call = async (callSignal) => {
|
|
641
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
642
|
-
if (workspaceId !== undefined) {
|
|
643
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
644
|
-
}
|
|
645
|
-
headers.set('User-Agent', this.userAgent);
|
|
646
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
647
|
-
const respBody = await executeHttpCall({
|
|
648
|
-
request: httpReq,
|
|
649
|
-
httpClient,
|
|
650
|
-
logger: this.logger,
|
|
651
|
-
});
|
|
652
|
-
resp = parseResponse(respBody, unmarshalMaterializedFeatureSchema);
|
|
653
|
-
};
|
|
654
|
-
await executeCall(call, options);
|
|
655
|
-
if (resp === undefined) {
|
|
656
|
-
throw new Error('operation completed without a result.');
|
|
657
|
-
}
|
|
658
|
-
return resp;
|
|
659
|
-
}
|
|
660
|
-
/** Update a Stream. Only fields listed in `update_mask` are mutated. */
|
|
661
|
-
async updateStream(req, options) {
|
|
662
|
-
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
663
|
-
const url = `${host}/api/2.0/feature-engineering/streams/${req.stream?.name ?? ''}`;
|
|
664
|
-
const params = new URLSearchParams();
|
|
665
|
-
if (req.updateMask !== undefined) {
|
|
666
|
-
params.append('update_mask', req.updateMask.toString());
|
|
667
|
-
}
|
|
668
|
-
const query = params.toString();
|
|
669
|
-
const fullUrl = query !== '' ? `${url}?${query}` : url;
|
|
670
|
-
const body = marshalRequest(req.stream, marshalStreamSchema);
|
|
671
|
-
let resp;
|
|
672
|
-
const call = async (callSignal) => {
|
|
673
|
-
const headers = new Headers({ 'Content-Type': 'application/json' });
|
|
674
|
-
if (workspaceId !== undefined) {
|
|
675
|
-
headers.set('X-Databricks-Workspace-Id', workspaceId);
|
|
676
|
-
}
|
|
677
|
-
headers.set('User-Agent', this.userAgent);
|
|
678
|
-
const httpReq = buildHttpRequest('PATCH', fullUrl, headers, callSignal, body);
|
|
679
|
-
const respBody = await executeHttpCall({
|
|
680
|
-
request: httpReq,
|
|
681
|
-
httpClient,
|
|
682
|
-
logger: this.logger,
|
|
683
|
-
});
|
|
684
|
-
resp = parseResponse(respBody, unmarshalStreamSchema);
|
|
685
|
-
};
|
|
686
|
-
await executeCall(call, options);
|
|
687
|
-
if (resp === undefined) {
|
|
688
|
-
throw new Error('operation completed without a result.');
|
|
689
|
-
}
|
|
690
|
-
return resp;
|
|
691
|
-
}
|
|
692
|
-
}
|
|
14
|
+
var FeaturesClient = class {
|
|
15
|
+
options;
|
|
16
|
+
logger;
|
|
17
|
+
userAgent;
|
|
18
|
+
config;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.options = options;
|
|
21
|
+
this.logger = options.logger ?? new NoOpLogger();
|
|
22
|
+
this.userAgent = createDefault().with(PACKAGE_SEGMENT).with({
|
|
23
|
+
key: "sdk-js-auth",
|
|
24
|
+
value: VERSION
|
|
25
|
+
}).with({
|
|
26
|
+
key: "auth",
|
|
27
|
+
value: options.credentials?.name() ?? "default"
|
|
28
|
+
}).toString();
|
|
29
|
+
}
|
|
30
|
+
resolveConfig() {
|
|
31
|
+
this.config ??= resolveClientConfig(this.options);
|
|
32
|
+
return this.config;
|
|
33
|
+
}
|
|
34
|
+
/** Batch create materialized features. */
|
|
35
|
+
async batchCreateMaterializedFeatures(req, options) {
|
|
36
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
37
|
+
const url = `${host}/api/2.0/feature-engineering/materialized-features:batchCreate`;
|
|
38
|
+
const body = marshalRequest(req, marshalBatchCreateMaterializedFeaturesRequestSchema);
|
|
39
|
+
let resp;
|
|
40
|
+
const call = async (callSignal) => {
|
|
41
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
42
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
43
|
+
headers.set("User-Agent", this.userAgent);
|
|
44
|
+
resp = parseResponse(await executeHttpCall({
|
|
45
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
46
|
+
httpClient,
|
|
47
|
+
logger: this.logger
|
|
48
|
+
}), unmarshalBatchCreateMaterializedFeaturesResponseSchema);
|
|
49
|
+
};
|
|
50
|
+
await executeCall(call, options);
|
|
51
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
52
|
+
return resp;
|
|
53
|
+
}
|
|
54
|
+
/** Create a Feature. */
|
|
55
|
+
async createFeature(req, options) {
|
|
56
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
57
|
+
const url = `${host}/api/2.0/feature-engineering/features`;
|
|
58
|
+
const body = marshalRequest(req.feature, marshalFeatureSchema);
|
|
59
|
+
let resp;
|
|
60
|
+
const call = async (callSignal) => {
|
|
61
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
62
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
63
|
+
headers.set("User-Agent", this.userAgent);
|
|
64
|
+
resp = parseResponse(await executeHttpCall({
|
|
65
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
66
|
+
httpClient,
|
|
67
|
+
logger: this.logger
|
|
68
|
+
}), unmarshalFeatureSchema);
|
|
69
|
+
};
|
|
70
|
+
await executeCall(call, options);
|
|
71
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
72
|
+
return resp;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Create a Kafka config.
|
|
76
|
+
* During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
|
|
77
|
+
* Only the creator of the Kafka config can delete it.
|
|
78
|
+
*/
|
|
79
|
+
async createKafkaConfig(req, options) {
|
|
80
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
81
|
+
const url = `${host}/api/2.0/feature-engineering/features/kafka-configs`;
|
|
82
|
+
const body = marshalRequest(req.kafkaConfig, marshalKafkaConfigSchema);
|
|
83
|
+
let resp;
|
|
84
|
+
const call = async (callSignal) => {
|
|
85
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
86
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
87
|
+
headers.set("User-Agent", this.userAgent);
|
|
88
|
+
resp = parseResponse(await executeHttpCall({
|
|
89
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
90
|
+
httpClient,
|
|
91
|
+
logger: this.logger
|
|
92
|
+
}), unmarshalKafkaConfigSchema);
|
|
93
|
+
};
|
|
94
|
+
await executeCall(call, options);
|
|
95
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
96
|
+
return resp;
|
|
97
|
+
}
|
|
98
|
+
/** Create a materialized feature. */
|
|
99
|
+
async createMaterializedFeature(req, options) {
|
|
100
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
101
|
+
const url = `${host}/api/2.0/feature-engineering/materialized-features`;
|
|
102
|
+
const body = marshalRequest(req.materializedFeature, marshalMaterializedFeatureSchema);
|
|
103
|
+
let resp;
|
|
104
|
+
const call = async (callSignal) => {
|
|
105
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
106
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
107
|
+
headers.set("User-Agent", this.userAgent);
|
|
108
|
+
resp = parseResponse(await executeHttpCall({
|
|
109
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
110
|
+
httpClient,
|
|
111
|
+
logger: this.logger
|
|
112
|
+
}), unmarshalMaterializedFeatureSchema);
|
|
113
|
+
};
|
|
114
|
+
await executeCall(call, options);
|
|
115
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
116
|
+
return resp;
|
|
117
|
+
}
|
|
118
|
+
/** Create a Stream, a governed UC entity representing an external streaming data source. */
|
|
119
|
+
async createStream(req, options) {
|
|
120
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
121
|
+
const url = `${host}/api/2.0/feature-engineering/streams`;
|
|
122
|
+
const body = marshalRequest(req.stream, marshalStreamSchema);
|
|
123
|
+
let resp;
|
|
124
|
+
const call = async (callSignal) => {
|
|
125
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
126
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
127
|
+
headers.set("User-Agent", this.userAgent);
|
|
128
|
+
resp = parseResponse(await executeHttpCall({
|
|
129
|
+
request: buildHttpRequest("POST", url, headers, callSignal, body),
|
|
130
|
+
httpClient,
|
|
131
|
+
logger: this.logger
|
|
132
|
+
}), unmarshalStreamSchema);
|
|
133
|
+
};
|
|
134
|
+
await executeCall(call, options);
|
|
135
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
136
|
+
return resp;
|
|
137
|
+
}
|
|
138
|
+
/** Delete a Feature. */
|
|
139
|
+
async deleteFeature(req, options) {
|
|
140
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
141
|
+
const url = `${host}/api/2.0/feature-engineering/features/${req.fullName ?? ""}`;
|
|
142
|
+
const call = async (callSignal) => {
|
|
143
|
+
const headers = new Headers();
|
|
144
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
145
|
+
headers.set("User-Agent", this.userAgent);
|
|
146
|
+
await executeHttpCall({
|
|
147
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
148
|
+
httpClient,
|
|
149
|
+
logger: this.logger
|
|
150
|
+
});
|
|
151
|
+
};
|
|
152
|
+
await executeCall(call, options);
|
|
153
|
+
}
|
|
154
|
+
/**
|
|
155
|
+
* Delete a Kafka config.
|
|
156
|
+
* During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
|
|
157
|
+
* Only the creator of the Kafka config can delete it.
|
|
158
|
+
*/
|
|
159
|
+
async deleteKafkaConfig(req, options) {
|
|
160
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
161
|
+
const url = `${host}/api/2.0/feature-engineering/features/kafka-configs/${req.name ?? ""}`;
|
|
162
|
+
const call = async (callSignal) => {
|
|
163
|
+
const headers = new Headers();
|
|
164
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
165
|
+
headers.set("User-Agent", this.userAgent);
|
|
166
|
+
await executeHttpCall({
|
|
167
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
168
|
+
httpClient,
|
|
169
|
+
logger: this.logger
|
|
170
|
+
});
|
|
171
|
+
};
|
|
172
|
+
await executeCall(call, options);
|
|
173
|
+
}
|
|
174
|
+
/** Delete a materialized feature. */
|
|
175
|
+
async deleteMaterializedFeature(req, options) {
|
|
176
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
177
|
+
const url = `${host}/api/2.0/feature-engineering/materialized-features/${req.materializedFeatureId ?? ""}`;
|
|
178
|
+
const call = async (callSignal) => {
|
|
179
|
+
const headers = new Headers();
|
|
180
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
181
|
+
headers.set("User-Agent", this.userAgent);
|
|
182
|
+
await executeHttpCall({
|
|
183
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
184
|
+
httpClient,
|
|
185
|
+
logger: this.logger
|
|
186
|
+
});
|
|
187
|
+
};
|
|
188
|
+
await executeCall(call, options);
|
|
189
|
+
}
|
|
190
|
+
/** Delete a Stream by its full three-part name (catalog.schema.stream). */
|
|
191
|
+
async deleteStream(req, options) {
|
|
192
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
193
|
+
const url = `${host}/api/2.0/feature-engineering/streams/${req.name ?? ""}`;
|
|
194
|
+
const call = async (callSignal) => {
|
|
195
|
+
const headers = new Headers();
|
|
196
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
197
|
+
headers.set("User-Agent", this.userAgent);
|
|
198
|
+
await executeHttpCall({
|
|
199
|
+
request: buildHttpRequest("DELETE", url, headers, callSignal),
|
|
200
|
+
httpClient,
|
|
201
|
+
logger: this.logger
|
|
202
|
+
});
|
|
203
|
+
};
|
|
204
|
+
await executeCall(call, options);
|
|
205
|
+
}
|
|
206
|
+
/** Get a Feature. */
|
|
207
|
+
async getFeature(req, options) {
|
|
208
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
209
|
+
const url = `${host}/api/2.0/feature-engineering/features/${req.fullName ?? ""}`;
|
|
210
|
+
let resp;
|
|
211
|
+
const call = async (callSignal) => {
|
|
212
|
+
const headers = new Headers();
|
|
213
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
214
|
+
headers.set("User-Agent", this.userAgent);
|
|
215
|
+
resp = parseResponse(await executeHttpCall({
|
|
216
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
217
|
+
httpClient,
|
|
218
|
+
logger: this.logger
|
|
219
|
+
}), unmarshalFeatureSchema);
|
|
220
|
+
};
|
|
221
|
+
await executeCall(call, options);
|
|
222
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
223
|
+
return resp;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get a Kafka config.
|
|
227
|
+
* During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
|
|
228
|
+
* Only the creator of the Kafka config can delete it.
|
|
229
|
+
*/
|
|
230
|
+
async getKafkaConfig(req, options) {
|
|
231
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
232
|
+
const url = `${host}/api/2.0/feature-engineering/features/kafka-configs/${req.name ?? ""}`;
|
|
233
|
+
let resp;
|
|
234
|
+
const call = async (callSignal) => {
|
|
235
|
+
const headers = new Headers();
|
|
236
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
237
|
+
headers.set("User-Agent", this.userAgent);
|
|
238
|
+
resp = parseResponse(await executeHttpCall({
|
|
239
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
240
|
+
httpClient,
|
|
241
|
+
logger: this.logger
|
|
242
|
+
}), unmarshalKafkaConfigSchema);
|
|
243
|
+
};
|
|
244
|
+
await executeCall(call, options);
|
|
245
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
246
|
+
return resp;
|
|
247
|
+
}
|
|
248
|
+
/** Get a materialized feature. */
|
|
249
|
+
async getMaterializedFeature(req, options) {
|
|
250
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
251
|
+
const url = `${host}/api/2.0/feature-engineering/materialized-features/${req.materializedFeatureId ?? ""}`;
|
|
252
|
+
let resp;
|
|
253
|
+
const call = async (callSignal) => {
|
|
254
|
+
const headers = new Headers();
|
|
255
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
256
|
+
headers.set("User-Agent", this.userAgent);
|
|
257
|
+
resp = parseResponse(await executeHttpCall({
|
|
258
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
259
|
+
httpClient,
|
|
260
|
+
logger: this.logger
|
|
261
|
+
}), unmarshalMaterializedFeatureSchema);
|
|
262
|
+
};
|
|
263
|
+
await executeCall(call, options);
|
|
264
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
265
|
+
return resp;
|
|
266
|
+
}
|
|
267
|
+
/** Get a Stream by its full three-part name (catalog.schema.stream). */
|
|
268
|
+
async getStream(req, options) {
|
|
269
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
270
|
+
const url = `${host}/api/2.0/feature-engineering/streams/${req.name ?? ""}`;
|
|
271
|
+
let resp;
|
|
272
|
+
const call = async (callSignal) => {
|
|
273
|
+
const headers = new Headers();
|
|
274
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
275
|
+
headers.set("User-Agent", this.userAgent);
|
|
276
|
+
resp = parseResponse(await executeHttpCall({
|
|
277
|
+
request: buildHttpRequest("GET", url, headers, callSignal),
|
|
278
|
+
httpClient,
|
|
279
|
+
logger: this.logger
|
|
280
|
+
}), unmarshalStreamSchema);
|
|
281
|
+
};
|
|
282
|
+
await executeCall(call, options);
|
|
283
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
284
|
+
return resp;
|
|
285
|
+
}
|
|
286
|
+
/** List Features. */
|
|
287
|
+
async listFeatures(req, options) {
|
|
288
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
289
|
+
const url = `${host}/api/2.0/feature-engineering/features`;
|
|
290
|
+
const params = new URLSearchParams();
|
|
291
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
292
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
293
|
+
if (req.catalogName !== void 0) params.append("catalog_name", req.catalogName);
|
|
294
|
+
if (req.schemaName !== void 0) params.append("schema_name", req.schemaName);
|
|
295
|
+
const query = params.toString();
|
|
296
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
297
|
+
let resp;
|
|
298
|
+
const call = async (callSignal) => {
|
|
299
|
+
const headers = new Headers();
|
|
300
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
301
|
+
headers.set("User-Agent", this.userAgent);
|
|
302
|
+
resp = parseResponse(await executeHttpCall({
|
|
303
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
304
|
+
httpClient,
|
|
305
|
+
logger: this.logger
|
|
306
|
+
}), unmarshalListFeaturesResponseSchema);
|
|
307
|
+
};
|
|
308
|
+
await executeCall(call, options);
|
|
309
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
310
|
+
return resp;
|
|
311
|
+
}
|
|
312
|
+
async *listFeaturesIter(req, options) {
|
|
313
|
+
const pageReq = { ...req };
|
|
314
|
+
for (;;) {
|
|
315
|
+
const resp = await this.listFeatures(pageReq, options);
|
|
316
|
+
for (const item of resp.features ?? []) yield item;
|
|
317
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
318
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* List Kafka configs.
|
|
323
|
+
* During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
|
|
324
|
+
* Only the creator of the Kafka config can delete it.
|
|
325
|
+
*/
|
|
326
|
+
async listKafkaConfigs(req, options) {
|
|
327
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
328
|
+
const url = `${host}/api/2.0/feature-engineering/features/kafka-configs`;
|
|
329
|
+
const params = new URLSearchParams();
|
|
330
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
331
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
332
|
+
const query = params.toString();
|
|
333
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
334
|
+
let resp;
|
|
335
|
+
const call = async (callSignal) => {
|
|
336
|
+
const headers = new Headers();
|
|
337
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
338
|
+
headers.set("User-Agent", this.userAgent);
|
|
339
|
+
resp = parseResponse(await executeHttpCall({
|
|
340
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
341
|
+
httpClient,
|
|
342
|
+
logger: this.logger
|
|
343
|
+
}), unmarshalListKafkaConfigsResponseSchema);
|
|
344
|
+
};
|
|
345
|
+
await executeCall(call, options);
|
|
346
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
347
|
+
return resp;
|
|
348
|
+
}
|
|
349
|
+
async *listKafkaConfigsIter(req, options) {
|
|
350
|
+
const pageReq = { ...req };
|
|
351
|
+
for (;;) {
|
|
352
|
+
const resp = await this.listKafkaConfigs(pageReq, options);
|
|
353
|
+
for (const item of resp.kafkaConfigs ?? []) yield item;
|
|
354
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
355
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
/** List materialized features. */
|
|
359
|
+
async listMaterializedFeatures(req, options) {
|
|
360
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
361
|
+
const url = `${host}/api/2.0/feature-engineering/materialized-features`;
|
|
362
|
+
const params = new URLSearchParams();
|
|
363
|
+
if (req.featureName !== void 0) params.append("feature_name", req.featureName);
|
|
364
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
365
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
366
|
+
const query = params.toString();
|
|
367
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
368
|
+
let resp;
|
|
369
|
+
const call = async (callSignal) => {
|
|
370
|
+
const headers = new Headers();
|
|
371
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
372
|
+
headers.set("User-Agent", this.userAgent);
|
|
373
|
+
resp = parseResponse(await executeHttpCall({
|
|
374
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
375
|
+
httpClient,
|
|
376
|
+
logger: this.logger
|
|
377
|
+
}), unmarshalListMaterializedFeaturesResponseSchema);
|
|
378
|
+
};
|
|
379
|
+
await executeCall(call, options);
|
|
380
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
381
|
+
return resp;
|
|
382
|
+
}
|
|
383
|
+
async *listMaterializedFeaturesIter(req, options) {
|
|
384
|
+
const pageReq = { ...req };
|
|
385
|
+
for (;;) {
|
|
386
|
+
const resp = await this.listMaterializedFeatures(pageReq, options);
|
|
387
|
+
for (const item of resp.materializedFeatures ?? []) yield item;
|
|
388
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
389
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
/** List Streams under a given catalog.schema parent. */
|
|
393
|
+
async listStreams(req, options) {
|
|
394
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
395
|
+
const url = `${host}/api/2.0/feature-engineering/streams`;
|
|
396
|
+
const params = new URLSearchParams();
|
|
397
|
+
if (req.parent !== void 0) params.append("parent", req.parent);
|
|
398
|
+
if (req.pageSize !== void 0) params.append("page_size", String(req.pageSize));
|
|
399
|
+
if (req.pageToken !== void 0) params.append("page_token", req.pageToken);
|
|
400
|
+
const query = params.toString();
|
|
401
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
402
|
+
let resp;
|
|
403
|
+
const call = async (callSignal) => {
|
|
404
|
+
const headers = new Headers();
|
|
405
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
406
|
+
headers.set("User-Agent", this.userAgent);
|
|
407
|
+
resp = parseResponse(await executeHttpCall({
|
|
408
|
+
request: buildHttpRequest("GET", fullUrl, headers, callSignal),
|
|
409
|
+
httpClient,
|
|
410
|
+
logger: this.logger
|
|
411
|
+
}), unmarshalListStreamsResponseSchema);
|
|
412
|
+
};
|
|
413
|
+
await executeCall(call, options);
|
|
414
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
415
|
+
return resp;
|
|
416
|
+
}
|
|
417
|
+
async *listStreamsIter(req, options) {
|
|
418
|
+
const pageReq = { ...req };
|
|
419
|
+
for (;;) {
|
|
420
|
+
const resp = await this.listStreams(pageReq, options);
|
|
421
|
+
for (const item of resp.streams ?? []) yield item;
|
|
422
|
+
if (resp.nextPageToken === void 0 || resp.nextPageToken === "") return;
|
|
423
|
+
pageReq.pageToken = resp.nextPageToken;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
/** Update a Feature. */
|
|
427
|
+
async updateFeature(req, options) {
|
|
428
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
429
|
+
const url = `${host}/api/2.0/feature-engineering/features/${req.feature?.fullName ?? ""}`;
|
|
430
|
+
const params = new URLSearchParams();
|
|
431
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
432
|
+
const query = params.toString();
|
|
433
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
434
|
+
const body = marshalRequest(req.feature, marshalFeatureSchema);
|
|
435
|
+
let resp;
|
|
436
|
+
const call = async (callSignal) => {
|
|
437
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
438
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
439
|
+
headers.set("User-Agent", this.userAgent);
|
|
440
|
+
resp = parseResponse(await executeHttpCall({
|
|
441
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
442
|
+
httpClient,
|
|
443
|
+
logger: this.logger
|
|
444
|
+
}), unmarshalFeatureSchema);
|
|
445
|
+
};
|
|
446
|
+
await executeCall(call, options);
|
|
447
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
448
|
+
return resp;
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Update a Kafka config.
|
|
452
|
+
* During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
|
|
453
|
+
* Only the creator of the Kafka config can delete it.
|
|
454
|
+
*/
|
|
455
|
+
async updateKafkaConfig(req, options) {
|
|
456
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
457
|
+
const url = `${host}/api/2.0/feature-engineering/features/kafka-configs/${req.kafkaConfig?.name ?? ""}`;
|
|
458
|
+
const params = new URLSearchParams();
|
|
459
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
460
|
+
const query = params.toString();
|
|
461
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
462
|
+
const body = marshalRequest(req.kafkaConfig, marshalKafkaConfigSchema);
|
|
463
|
+
let resp;
|
|
464
|
+
const call = async (callSignal) => {
|
|
465
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
466
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
467
|
+
headers.set("User-Agent", this.userAgent);
|
|
468
|
+
resp = parseResponse(await executeHttpCall({
|
|
469
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
470
|
+
httpClient,
|
|
471
|
+
logger: this.logger
|
|
472
|
+
}), unmarshalKafkaConfigSchema);
|
|
473
|
+
};
|
|
474
|
+
await executeCall(call, options);
|
|
475
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
476
|
+
return resp;
|
|
477
|
+
}
|
|
478
|
+
/** Update a materialized feature (pause/resume). */
|
|
479
|
+
async updateMaterializedFeature(req, options) {
|
|
480
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
481
|
+
const url = `${host}/api/2.0/feature-engineering/materialized-features/${req.materializedFeature?.materializedFeatureId ?? ""}`;
|
|
482
|
+
const params = new URLSearchParams();
|
|
483
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
484
|
+
const query = params.toString();
|
|
485
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
486
|
+
const body = marshalRequest(req.materializedFeature, marshalMaterializedFeatureSchema);
|
|
487
|
+
let resp;
|
|
488
|
+
const call = async (callSignal) => {
|
|
489
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
490
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
491
|
+
headers.set("User-Agent", this.userAgent);
|
|
492
|
+
resp = parseResponse(await executeHttpCall({
|
|
493
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
494
|
+
httpClient,
|
|
495
|
+
logger: this.logger
|
|
496
|
+
}), unmarshalMaterializedFeatureSchema);
|
|
497
|
+
};
|
|
498
|
+
await executeCall(call, options);
|
|
499
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
500
|
+
return resp;
|
|
501
|
+
}
|
|
502
|
+
/** Update a Stream. Only fields listed in `update_mask` are mutated. */
|
|
503
|
+
async updateStream(req, options) {
|
|
504
|
+
const { host, workspaceId, httpClient } = await this.resolveConfig();
|
|
505
|
+
const url = `${host}/api/2.0/feature-engineering/streams/${req.stream?.name ?? ""}`;
|
|
506
|
+
const params = new URLSearchParams();
|
|
507
|
+
if (req.updateMask !== void 0) params.append("update_mask", req.updateMask.toString());
|
|
508
|
+
const query = params.toString();
|
|
509
|
+
const fullUrl = query !== "" ? `${url}?${query}` : url;
|
|
510
|
+
const body = marshalRequest(req.stream, marshalStreamSchema);
|
|
511
|
+
let resp;
|
|
512
|
+
const call = async (callSignal) => {
|
|
513
|
+
const headers = new Headers({ "Content-Type": "application/json" });
|
|
514
|
+
if (workspaceId !== void 0) headers.set("X-Databricks-Workspace-Id", workspaceId);
|
|
515
|
+
headers.set("User-Agent", this.userAgent);
|
|
516
|
+
resp = parseResponse(await executeHttpCall({
|
|
517
|
+
request: buildHttpRequest("PATCH", fullUrl, headers, callSignal, body),
|
|
518
|
+
httpClient,
|
|
519
|
+
logger: this.logger
|
|
520
|
+
}), unmarshalStreamSchema);
|
|
521
|
+
};
|
|
522
|
+
await executeCall(call, options);
|
|
523
|
+
if (resp === void 0) throw new Error("operation completed without a result.");
|
|
524
|
+
return resp;
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
//#endregion
|
|
529
|
+
export { FeaturesClient };
|
|
693
530
|
//# sourceMappingURL=client.js.map
|