@databricks/sdk-features 0.33.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/v1/client.js CHANGED
@@ -1,693 +1,530 @@
1
- // Code generated from API definition by Databricks SDK Generator. DO NOT EDIT.
2
- import { VERSION as AUTH_VERSION } from '@databricks/sdk-auth';
3
- import { createDefault } from '@databricks/sdk-core/clientinfo';
4
- import { NoOpLogger } from '@databricks/sdk-core/logger';
5
- import { resolveClientConfig } from './transport';
6
- import { buildHttpRequest, executeCall, executeHttpCall, marshalRequest, parseResponse, } from './utils';
7
- import pkgJson from '../../package.json' with { type: 'json' };
8
- import { marshalBatchCreateMaterializedFeaturesRequestSchema, marshalFeatureSchema, marshalKafkaConfigSchema, marshalMaterializedFeatureSchema, marshalStreamSchema, unmarshalBatchCreateMaterializedFeaturesResponseSchema, unmarshalFeatureSchema, unmarshalKafkaConfigSchema, unmarshalListFeaturesResponseSchema, unmarshalListKafkaConfigsResponseSchema, unmarshalListMaterializedFeaturesResponseSchema, unmarshalListStreamsResponseSchema, unmarshalMaterializedFeatureSchema, unmarshalStreamSchema, } from './model';
9
- // Package identity segment for this client to be used in the User-Agent header.
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
- key: 'sdk-js-' + pkgJson.name.replace(/^@[^/]+\/sdk-/, ''),
12
- value: pkgJson.version,
11
+ key: "sdk-js-" + name.replace(/^@[^/]+\/sdk-/, ""),
12
+ value: version
13
13
  };
14
- export class FeaturesClient {
15
- options;
16
- logger;
17
- // User-Agent header value. Composed once at construction from
18
- // createDefault() merged with this package's identity and the active
19
- // credential's name.
20
- userAgent;
21
- // Memoized configuration. The profile is resolved once, lazily, on the first
22
- // request, then reused; host, workspaceId/accountId, and credentials are
23
- // filled from it when not set explicitly on the options.
24
- config;
25
- constructor(options) {
26
- this.options = options;
27
- this.logger = options.logger ?? new NoOpLogger();
28
- const info = createDefault()
29
- .with(PACKAGE_SEGMENT)
30
- .with({ key: 'sdk-js-auth', value: AUTH_VERSION })
31
- .with({ key: 'auth', value: options.credentials?.name() ?? 'default' });
32
- this.userAgent = info.toString();
33
- }
34
- resolveConfig() {
35
- this.config ??= resolveClientConfig(this.options);
36
- return this.config;
37
- }
38
- /** Batch create materialized features. */
39
- async batchCreateMaterializedFeatures(req, options) {
40
- const { host, workspaceId, httpClient } = await this.resolveConfig();
41
- const url = `${host}/api/2.0/feature-engineering/materialized-features:batchCreate`;
42
- const body = marshalRequest(req, marshalBatchCreateMaterializedFeaturesRequestSchema);
43
- let resp;
44
- const call = async (callSignal) => {
45
- const headers = new Headers({ 'Content-Type': 'application/json' });
46
- if (workspaceId !== undefined) {
47
- headers.set('X-Databricks-Workspace-Id', workspaceId);
48
- }
49
- headers.set('User-Agent', this.userAgent);
50
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
51
- const respBody = await executeHttpCall({
52
- request: httpReq,
53
- httpClient,
54
- logger: this.logger,
55
- });
56
- resp = parseResponse(respBody, unmarshalBatchCreateMaterializedFeaturesResponseSchema);
57
- };
58
- await executeCall(call, options);
59
- if (resp === undefined) {
60
- throw new Error('operation completed without a result.');
61
- }
62
- return resp;
63
- }
64
- /** Create a Feature. */
65
- async createFeature(req, options) {
66
- const { host, workspaceId, httpClient } = await this.resolveConfig();
67
- const url = `${host}/api/2.0/feature-engineering/features`;
68
- const body = marshalRequest(req.feature, marshalFeatureSchema);
69
- let resp;
70
- const call = async (callSignal) => {
71
- const headers = new Headers({ 'Content-Type': 'application/json' });
72
- if (workspaceId !== undefined) {
73
- headers.set('X-Databricks-Workspace-Id', workspaceId);
74
- }
75
- headers.set('User-Agent', this.userAgent);
76
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
77
- const respBody = await executeHttpCall({
78
- request: httpReq,
79
- httpClient,
80
- logger: this.logger,
81
- });
82
- resp = parseResponse(respBody, unmarshalFeatureSchema);
83
- };
84
- await executeCall(call, options);
85
- if (resp === undefined) {
86
- throw new Error('operation completed without a result.');
87
- }
88
- return resp;
89
- }
90
- /**
91
- * Create a Kafka config.
92
- * During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
93
- * Only the creator of the Kafka config can delete it.
94
- */
95
- async createKafkaConfig(req, options) {
96
- const { host, workspaceId, httpClient } = await this.resolveConfig();
97
- const url = `${host}/api/2.0/feature-engineering/features/kafka-configs`;
98
- const body = marshalRequest(req.kafkaConfig, marshalKafkaConfigSchema);
99
- let resp;
100
- const call = async (callSignal) => {
101
- const headers = new Headers({ 'Content-Type': 'application/json' });
102
- if (workspaceId !== undefined) {
103
- headers.set('X-Databricks-Workspace-Id', workspaceId);
104
- }
105
- headers.set('User-Agent', this.userAgent);
106
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
107
- const respBody = await executeHttpCall({
108
- request: httpReq,
109
- httpClient,
110
- logger: this.logger,
111
- });
112
- resp = parseResponse(respBody, unmarshalKafkaConfigSchema);
113
- };
114
- await executeCall(call, options);
115
- if (resp === undefined) {
116
- throw new Error('operation completed without a result.');
117
- }
118
- return resp;
119
- }
120
- /** Create a materialized feature. */
121
- async createMaterializedFeature(req, options) {
122
- const { host, workspaceId, httpClient } = await this.resolveConfig();
123
- const url = `${host}/api/2.0/feature-engineering/materialized-features`;
124
- const body = marshalRequest(req.materializedFeature, marshalMaterializedFeatureSchema);
125
- let resp;
126
- const call = async (callSignal) => {
127
- const headers = new Headers({ 'Content-Type': 'application/json' });
128
- if (workspaceId !== undefined) {
129
- headers.set('X-Databricks-Workspace-Id', workspaceId);
130
- }
131
- headers.set('User-Agent', this.userAgent);
132
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
133
- const respBody = await executeHttpCall({
134
- request: httpReq,
135
- httpClient,
136
- logger: this.logger,
137
- });
138
- resp = parseResponse(respBody, unmarshalMaterializedFeatureSchema);
139
- };
140
- await executeCall(call, options);
141
- if (resp === undefined) {
142
- throw new Error('operation completed without a result.');
143
- }
144
- return resp;
145
- }
146
- /** Create a Stream, a governed UC entity representing an external streaming data source. */
147
- async createStream(req, options) {
148
- const { host, workspaceId, httpClient } = await this.resolveConfig();
149
- const url = `${host}/api/2.0/feature-engineering/streams`;
150
- const body = marshalRequest(req.stream, marshalStreamSchema);
151
- let resp;
152
- const call = async (callSignal) => {
153
- const headers = new Headers({ 'Content-Type': 'application/json' });
154
- if (workspaceId !== undefined) {
155
- headers.set('X-Databricks-Workspace-Id', workspaceId);
156
- }
157
- headers.set('User-Agent', this.userAgent);
158
- const httpReq = buildHttpRequest('POST', url, headers, callSignal, body);
159
- const respBody = await executeHttpCall({
160
- request: httpReq,
161
- httpClient,
162
- logger: this.logger,
163
- });
164
- resp = parseResponse(respBody, unmarshalStreamSchema);
165
- };
166
- await executeCall(call, options);
167
- if (resp === undefined) {
168
- throw new Error('operation completed without a result.');
169
- }
170
- return resp;
171
- }
172
- /** Delete a Feature. */
173
- async deleteFeature(req, options) {
174
- const { host, workspaceId, httpClient } = await this.resolveConfig();
175
- const url = `${host}/api/2.0/feature-engineering/features/${req.fullName ?? ''}`;
176
- const call = async (callSignal) => {
177
- const headers = new Headers();
178
- if (workspaceId !== undefined) {
179
- headers.set('X-Databricks-Workspace-Id', workspaceId);
180
- }
181
- headers.set('User-Agent', this.userAgent);
182
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
183
- await executeHttpCall({
184
- request: httpReq,
185
- httpClient,
186
- logger: this.logger,
187
- });
188
- };
189
- await executeCall(call, options);
190
- }
191
- /**
192
- * Delete a Kafka config.
193
- * During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
194
- * Only the creator of the Kafka config can delete it.
195
- */
196
- async deleteKafkaConfig(req, options) {
197
- const { host, workspaceId, httpClient } = await this.resolveConfig();
198
- const url = `${host}/api/2.0/feature-engineering/features/kafka-configs/${req.name ?? ''}`;
199
- const call = async (callSignal) => {
200
- const headers = new Headers();
201
- if (workspaceId !== undefined) {
202
- headers.set('X-Databricks-Workspace-Id', workspaceId);
203
- }
204
- headers.set('User-Agent', this.userAgent);
205
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
206
- await executeHttpCall({
207
- request: httpReq,
208
- httpClient,
209
- logger: this.logger,
210
- });
211
- };
212
- await executeCall(call, options);
213
- }
214
- /** Delete a materialized feature. */
215
- async deleteMaterializedFeature(req, options) {
216
- const { host, workspaceId, httpClient } = await this.resolveConfig();
217
- const url = `${host}/api/2.0/feature-engineering/materialized-features/${req.materializedFeatureId ?? ''}`;
218
- const call = async (callSignal) => {
219
- const headers = new Headers();
220
- if (workspaceId !== undefined) {
221
- headers.set('X-Databricks-Workspace-Id', workspaceId);
222
- }
223
- headers.set('User-Agent', this.userAgent);
224
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
225
- await executeHttpCall({
226
- request: httpReq,
227
- httpClient,
228
- logger: this.logger,
229
- });
230
- };
231
- await executeCall(call, options);
232
- }
233
- /** Delete a Stream by its full three-part name (catalog.schema.stream). */
234
- async deleteStream(req, options) {
235
- const { host, workspaceId, httpClient } = await this.resolveConfig();
236
- const url = `${host}/api/2.0/feature-engineering/streams/${req.name ?? ''}`;
237
- const call = async (callSignal) => {
238
- const headers = new Headers();
239
- if (workspaceId !== undefined) {
240
- headers.set('X-Databricks-Workspace-Id', workspaceId);
241
- }
242
- headers.set('User-Agent', this.userAgent);
243
- const httpReq = buildHttpRequest('DELETE', url, headers, callSignal);
244
- await executeHttpCall({
245
- request: httpReq,
246
- httpClient,
247
- logger: this.logger,
248
- });
249
- };
250
- await executeCall(call, options);
251
- }
252
- /** Get a Feature. */
253
- async getFeature(req, options) {
254
- const { host, workspaceId, httpClient } = await this.resolveConfig();
255
- const url = `${host}/api/2.0/feature-engineering/features/${req.fullName ?? ''}`;
256
- let resp;
257
- const call = async (callSignal) => {
258
- const headers = new Headers();
259
- if (workspaceId !== undefined) {
260
- headers.set('X-Databricks-Workspace-Id', workspaceId);
261
- }
262
- headers.set('User-Agent', this.userAgent);
263
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
264
- const respBody = await executeHttpCall({
265
- request: httpReq,
266
- httpClient,
267
- logger: this.logger,
268
- });
269
- resp = parseResponse(respBody, unmarshalFeatureSchema);
270
- };
271
- await executeCall(call, options);
272
- if (resp === undefined) {
273
- throw new Error('operation completed without a result.');
274
- }
275
- return resp;
276
- }
277
- /**
278
- * Get a Kafka config.
279
- * During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
280
- * Only the creator of the Kafka config can delete it.
281
- */
282
- async getKafkaConfig(req, options) {
283
- const { host, workspaceId, httpClient } = await this.resolveConfig();
284
- const url = `${host}/api/2.0/feature-engineering/features/kafka-configs/${req.name ?? ''}`;
285
- let resp;
286
- const call = async (callSignal) => {
287
- const headers = new Headers();
288
- if (workspaceId !== undefined) {
289
- headers.set('X-Databricks-Workspace-Id', workspaceId);
290
- }
291
- headers.set('User-Agent', this.userAgent);
292
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
293
- const respBody = await executeHttpCall({
294
- request: httpReq,
295
- httpClient,
296
- logger: this.logger,
297
- });
298
- resp = parseResponse(respBody, unmarshalKafkaConfigSchema);
299
- };
300
- await executeCall(call, options);
301
- if (resp === undefined) {
302
- throw new Error('operation completed without a result.');
303
- }
304
- return resp;
305
- }
306
- /** Get a materialized feature. */
307
- async getMaterializedFeature(req, options) {
308
- const { host, workspaceId, httpClient } = await this.resolveConfig();
309
- const url = `${host}/api/2.0/feature-engineering/materialized-features/${req.materializedFeatureId ?? ''}`;
310
- let resp;
311
- const call = async (callSignal) => {
312
- const headers = new Headers();
313
- if (workspaceId !== undefined) {
314
- headers.set('X-Databricks-Workspace-Id', workspaceId);
315
- }
316
- headers.set('User-Agent', this.userAgent);
317
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
318
- const respBody = await executeHttpCall({
319
- request: httpReq,
320
- httpClient,
321
- logger: this.logger,
322
- });
323
- resp = parseResponse(respBody, unmarshalMaterializedFeatureSchema);
324
- };
325
- await executeCall(call, options);
326
- if (resp === undefined) {
327
- throw new Error('operation completed without a result.');
328
- }
329
- return resp;
330
- }
331
- /** Get a Stream by its full three-part name (catalog.schema.stream). */
332
- async getStream(req, options) {
333
- const { host, workspaceId, httpClient } = await this.resolveConfig();
334
- const url = `${host}/api/2.0/feature-engineering/streams/${req.name ?? ''}`;
335
- let resp;
336
- const call = async (callSignal) => {
337
- const headers = new Headers();
338
- if (workspaceId !== undefined) {
339
- headers.set('X-Databricks-Workspace-Id', workspaceId);
340
- }
341
- headers.set('User-Agent', this.userAgent);
342
- const httpReq = buildHttpRequest('GET', url, headers, callSignal);
343
- const respBody = await executeHttpCall({
344
- request: httpReq,
345
- httpClient,
346
- logger: this.logger,
347
- });
348
- resp = parseResponse(respBody, unmarshalStreamSchema);
349
- };
350
- await executeCall(call, options);
351
- if (resp === undefined) {
352
- throw new Error('operation completed without a result.');
353
- }
354
- return resp;
355
- }
356
- /** List Features. */
357
- async listFeatures(req, options) {
358
- const { host, workspaceId, httpClient } = await this.resolveConfig();
359
- const url = `${host}/api/2.0/feature-engineering/features`;
360
- const params = new URLSearchParams();
361
- if (req.pageToken !== undefined) {
362
- params.append('page_token', req.pageToken);
363
- }
364
- if (req.pageSize !== undefined) {
365
- params.append('page_size', String(req.pageSize));
366
- }
367
- if (req.catalogName !== undefined) {
368
- params.append('catalog_name', req.catalogName);
369
- }
370
- if (req.schemaName !== undefined) {
371
- params.append('schema_name', req.schemaName);
372
- }
373
- const query = params.toString();
374
- const fullUrl = query !== '' ? `${url}?${query}` : url;
375
- let resp;
376
- const call = async (callSignal) => {
377
- const headers = new Headers();
378
- if (workspaceId !== undefined) {
379
- headers.set('X-Databricks-Workspace-Id', workspaceId);
380
- }
381
- headers.set('User-Agent', this.userAgent);
382
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
383
- const respBody = await executeHttpCall({
384
- request: httpReq,
385
- httpClient,
386
- logger: this.logger,
387
- });
388
- resp = parseResponse(respBody, unmarshalListFeaturesResponseSchema);
389
- };
390
- await executeCall(call, options);
391
- if (resp === undefined) {
392
- throw new Error('operation completed without a result.');
393
- }
394
- return resp;
395
- }
396
- async *listFeaturesIter(req, options) {
397
- const pageReq = { ...req };
398
- for (;;) {
399
- const resp = await this.listFeatures(pageReq, options);
400
- for (const item of resp.features ?? []) {
401
- yield item;
402
- }
403
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
404
- return;
405
- }
406
- pageReq.pageToken = resp.nextPageToken;
407
- }
408
- }
409
- /**
410
- * List Kafka configs.
411
- * During PrPr, Kafka configs can be read and used when creating features under the entire metastore.
412
- * Only the creator of the Kafka config can delete it.
413
- */
414
- async listKafkaConfigs(req, options) {
415
- const { host, workspaceId, httpClient } = await this.resolveConfig();
416
- const url = `${host}/api/2.0/feature-engineering/features/kafka-configs`;
417
- const params = new URLSearchParams();
418
- if (req.pageToken !== undefined) {
419
- params.append('page_token', req.pageToken);
420
- }
421
- if (req.pageSize !== undefined) {
422
- params.append('page_size', String(req.pageSize));
423
- }
424
- const query = params.toString();
425
- const fullUrl = query !== '' ? `${url}?${query}` : url;
426
- let resp;
427
- const call = async (callSignal) => {
428
- const headers = new Headers();
429
- if (workspaceId !== undefined) {
430
- headers.set('X-Databricks-Workspace-Id', workspaceId);
431
- }
432
- headers.set('User-Agent', this.userAgent);
433
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
434
- const respBody = await executeHttpCall({
435
- request: httpReq,
436
- httpClient,
437
- logger: this.logger,
438
- });
439
- resp = parseResponse(respBody, unmarshalListKafkaConfigsResponseSchema);
440
- };
441
- await executeCall(call, options);
442
- if (resp === undefined) {
443
- throw new Error('operation completed without a result.');
444
- }
445
- return resp;
446
- }
447
- async *listKafkaConfigsIter(req, options) {
448
- const pageReq = { ...req };
449
- for (;;) {
450
- const resp = await this.listKafkaConfigs(pageReq, options);
451
- for (const item of resp.kafkaConfigs ?? []) {
452
- yield item;
453
- }
454
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
455
- return;
456
- }
457
- pageReq.pageToken = resp.nextPageToken;
458
- }
459
- }
460
- /** List materialized features. */
461
- async listMaterializedFeatures(req, options) {
462
- const { host, workspaceId, httpClient } = await this.resolveConfig();
463
- const url = `${host}/api/2.0/feature-engineering/materialized-features`;
464
- const params = new URLSearchParams();
465
- if (req.featureName !== undefined) {
466
- params.append('feature_name', req.featureName);
467
- }
468
- if (req.pageToken !== undefined) {
469
- params.append('page_token', req.pageToken);
470
- }
471
- if (req.pageSize !== undefined) {
472
- params.append('page_size', String(req.pageSize));
473
- }
474
- const query = params.toString();
475
- const fullUrl = query !== '' ? `${url}?${query}` : url;
476
- let resp;
477
- const call = async (callSignal) => {
478
- const headers = new Headers();
479
- if (workspaceId !== undefined) {
480
- headers.set('X-Databricks-Workspace-Id', workspaceId);
481
- }
482
- headers.set('User-Agent', this.userAgent);
483
- const httpReq = buildHttpRequest('GET', fullUrl, headers, callSignal);
484
- const respBody = await executeHttpCall({
485
- request: httpReq,
486
- httpClient,
487
- logger: this.logger,
488
- });
489
- resp = parseResponse(respBody, unmarshalListMaterializedFeaturesResponseSchema);
490
- };
491
- await executeCall(call, options);
492
- if (resp === undefined) {
493
- throw new Error('operation completed without a result.');
494
- }
495
- return resp;
496
- }
497
- async *listMaterializedFeaturesIter(req, options) {
498
- const pageReq = { ...req };
499
- for (;;) {
500
- const resp = await this.listMaterializedFeatures(pageReq, options);
501
- for (const item of resp.materializedFeatures ?? []) {
502
- yield item;
503
- }
504
- if (resp.nextPageToken === undefined || resp.nextPageToken === '') {
505
- return;
506
- }
507
- pageReq.pageToken = resp.nextPageToken;
508
- }
509
- }
510
- /** List Streams under a given catalog.schema parent. */
511
- async listStreams(req, options) {
512
- const { host, workspaceId, httpClient } = await this.resolveConfig();
513
- const url = `${host}/api/2.0/feature-engineering/streams`;
514
- const params = new URLSearchParams();
515
- if (req.parent !== undefined) {
516
- params.append('parent', req.parent);
517
- }
518
- if (req.pageSize !== undefined) {
519
- params.append('page_size', String(req.pageSize));
520
- }
521
- if (req.pageToken !== undefined) {
522
- params.append('page_token', req.pageToken);
523
- }
524
- const query = params.toString();
525
- const fullUrl = query !== '' ? `${url}?${query}` : url;
526
- let resp;
527
- const call = async (callSignal) => {
528
- const headers = new Headers();
529
- if (workspaceId !== undefined) {
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